blob: 90e087f8d951808724a1207de64681f556216bf1 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef __DMI_H__
2#define __DMI_H__
3
Andrey Paninebad6a42005-09-06 15:18:29 -07004#include <linux/list.h>
David Woodhoused945b692008-09-16 16:23:28 -07005#include <linux/mod_devicetable.h>
Andrey Paninebad6a42005-09-06 15:18:29 -07006
David Woodhoused945b692008-09-16 16:23:28 -07007/* enum dmi_field is in mod_devicetable.h */
Linus Torvalds1da177e2005-04-16 15:20:36 -07008
Andrey Paninebad6a42005-09-06 15:18:29 -07009enum dmi_device_type {
10 DMI_DEV_TYPE_ANY = 0,
11 DMI_DEV_TYPE_OTHER,
12 DMI_DEV_TYPE_UNKNOWN,
13 DMI_DEV_TYPE_VIDEO,
14 DMI_DEV_TYPE_SCSI,
15 DMI_DEV_TYPE_ETHERNET,
16 DMI_DEV_TYPE_TOKENRING,
17 DMI_DEV_TYPE_SOUND,
Wim Van Sebroeckb4bd7d52008-02-08 04:20:58 -080018 DMI_DEV_TYPE_PATA,
19 DMI_DEV_TYPE_SATA,
20 DMI_DEV_TYPE_SAS,
Shem Multinymous2e0c1f62006-09-29 01:59:37 -070021 DMI_DEV_TYPE_IPMI = -1,
Wim Van Sebroeckb4bd7d52008-02-08 04:20:58 -080022 DMI_DEV_TYPE_OEM_STRING = -2,
Narendra K911e1c92010-07-26 05:56:50 -050023 DMI_DEV_TYPE_DEV_ONBOARD = -3,
Andrey Paninebad6a42005-09-06 15:18:29 -070024};
25
26struct dmi_header {
27 u8 type;
28 u8 length;
29 u16 handle;
30};
31
Andrey Paninebad6a42005-09-06 15:18:29 -070032struct dmi_device {
33 struct list_head list;
34 int type;
35 const char *name;
36 void *device_data; /* Type specific data */
37};
Linus Torvalds1da177e2005-04-16 15:20:36 -070038
Andi Kleene9928672006-01-11 22:43:33 +010039#ifdef CONFIG_DMI
Linus Torvalds1da177e2005-04-16 15:20:36 -070040
Narendra K911e1c92010-07-26 05:56:50 -050041struct dmi_dev_onboard {
42 struct dmi_device dev;
43 int instance;
44 int segment;
45 int bus;
46 int devfn;
47};
48
Jeff Garzik18552562007-10-03 15:15:40 -040049extern int dmi_check_system(const struct dmi_system_id *list);
Rafael J. Wysockid7b19562009-01-19 20:55:50 +010050const struct dmi_system_id *dmi_first_match(const struct dmi_system_id *list);
Jeff Garzik18552562007-10-03 15:15:40 -040051extern const char * dmi_get_system_info(int field);
52extern const struct dmi_device * dmi_find_device(int type, const char *name,
53 const struct dmi_device *from);
Andi Kleene9928672006-01-11 22:43:33 +010054extern void dmi_scan_machine(void);
Tejun Heo3e5cd1f2009-08-16 21:02:36 +090055extern bool dmi_get_date(int field, int *yearp, int *monthp, int *dayp);
Jeff Garzik18552562007-10-03 15:15:40 -040056extern int dmi_name_in_vendors(const char *str);
Alok Katariafd8cd7e2008-11-03 15:50:38 -080057extern int dmi_name_in_serial(const char *str);
Len Brown81b4e1f2008-01-16 17:20:37 -050058extern int dmi_available;
Jean Delvaree7a19c562009-03-30 21:46:44 +020059extern int dmi_walk(void (*decode)(const struct dmi_header *, void *),
60 void *private_data);
Jiri Slabyd61c72e2008-12-10 14:07:21 +010061extern bool dmi_match(enum dmi_field f, const char *str);
Andi Kleene9928672006-01-11 22:43:33 +010062
Linus Torvalds1da177e2005-04-16 15:20:36 -070063#else
64
Jeff Garzik18552562007-10-03 15:15:40 -040065static inline int dmi_check_system(const struct dmi_system_id *list) { return 0; }
66static inline const char * dmi_get_system_info(int field) { return NULL; }
67static inline const struct dmi_device * dmi_find_device(int type, const char *name,
68 const struct dmi_device *from) { return NULL; }
Thomas Petazzoni7ae93922008-04-28 02:14:14 -070069static inline void dmi_scan_machine(void) { return; }
Tejun Heo3e5cd1f2009-08-16 21:02:36 +090070static inline bool dmi_get_date(int field, int *yearp, int *monthp, int *dayp)
71{
72 if (yearp)
73 *yearp = 0;
74 if (monthp)
75 *monthp = 0;
76 if (dayp)
77 *dayp = 0;
78 return false;
79}
Jeff Garzik18552562007-10-03 15:15:40 -040080static inline int dmi_name_in_vendors(const char *s) { return 0; }
Alok Katariafd8cd7e2008-11-03 15:50:38 -080081static inline int dmi_name_in_serial(const char *s) { return 0; }
Len Brown81b4e1f2008-01-16 17:20:37 -050082#define dmi_available 0
Jean Delvaree7a19c562009-03-30 21:46:44 +020083static inline int dmi_walk(void (*decode)(const struct dmi_header *, void *),
84 void *private_data) { return -1; }
Jiri Slabyd61c72e2008-12-10 14:07:21 +010085static inline bool dmi_match(enum dmi_field f, const char *str)
86 { return false; }
Kumar Galad8204ee2009-01-28 00:07:20 -060087static inline const struct dmi_system_id *
88 dmi_first_match(const struct dmi_system_id *list) { return NULL; }
Linus Torvalds1da177e2005-04-16 15:20:36 -070089
90#endif
91
92#endif /* __DMI_H__ */