blob: f156cca25ad0f13174884c54c305c868e1b19ed6 [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
Mike Waychison93c890d2011-02-22 17:53:15 -080026enum dmi_entry_type {
27 DMI_ENTRY_BIOS = 0,
28 DMI_ENTRY_SYSTEM,
29 DMI_ENTRY_BASEBOARD,
30 DMI_ENTRY_CHASSIS,
31 DMI_ENTRY_PROCESSOR,
32 DMI_ENTRY_MEM_CONTROLLER,
33 DMI_ENTRY_MEM_MODULE,
34 DMI_ENTRY_CACHE,
35 DMI_ENTRY_PORT_CONNECTOR,
36 DMI_ENTRY_SYSTEM_SLOT,
37 DMI_ENTRY_ONBOARD_DEVICE,
38 DMI_ENTRY_OEMSTRINGS,
39 DMI_ENTRY_SYSCONF,
40 DMI_ENTRY_BIOS_LANG,
41 DMI_ENTRY_GROUP_ASSOC,
42 DMI_ENTRY_SYSTEM_EVENT_LOG,
43 DMI_ENTRY_PHYS_MEM_ARRAY,
44 DMI_ENTRY_MEM_DEVICE,
45 DMI_ENTRY_32_MEM_ERROR,
46 DMI_ENTRY_MEM_ARRAY_MAPPED_ADDR,
47 DMI_ENTRY_MEM_DEV_MAPPED_ADDR,
48 DMI_ENTRY_BUILTIN_POINTING_DEV,
49 DMI_ENTRY_PORTABLE_BATTERY,
50 DMI_ENTRY_SYSTEM_RESET,
51 DMI_ENTRY_HW_SECURITY,
52 DMI_ENTRY_SYSTEM_POWER_CONTROLS,
53 DMI_ENTRY_VOLTAGE_PROBE,
54 DMI_ENTRY_COOLING_DEV,
55 DMI_ENTRY_TEMP_PROBE,
56 DMI_ENTRY_ELECTRICAL_CURRENT_PROBE,
57 DMI_ENTRY_OOB_REMOTE_ACCESS,
58 DMI_ENTRY_BIS_ENTRY,
59 DMI_ENTRY_SYSTEM_BOOT,
60 DMI_ENTRY_MGMT_DEV,
61 DMI_ENTRY_MGMT_DEV_COMPONENT,
62 DMI_ENTRY_MGMT_DEV_THRES,
63 DMI_ENTRY_MEM_CHANNEL,
64 DMI_ENTRY_IPMI_DEV,
65 DMI_ENTRY_SYS_POWER_SUPPLY,
66 DMI_ENTRY_ADDITIONAL,
67 DMI_ENTRY_ONBOARD_DEV_EXT,
68 DMI_ENTRY_MGMT_CONTROLLER_HOST,
69 DMI_ENTRY_INACTIVE = 126,
70 DMI_ENTRY_END_OF_TABLE = 127,
71};
72
Andrey Paninebad6a42005-09-06 15:18:29 -070073struct dmi_header {
74 u8 type;
75 u8 length;
76 u16 handle;
77};
78
Andrey Paninebad6a42005-09-06 15:18:29 -070079struct dmi_device {
80 struct list_head list;
81 int type;
82 const char *name;
83 void *device_data; /* Type specific data */
84};
Linus Torvalds1da177e2005-04-16 15:20:36 -070085
Andi Kleene9928672006-01-11 22:43:33 +010086#ifdef CONFIG_DMI
Linus Torvalds1da177e2005-04-16 15:20:36 -070087
Narendra K911e1c92010-07-26 05:56:50 -050088struct dmi_dev_onboard {
89 struct dmi_device dev;
90 int instance;
91 int segment;
92 int bus;
93 int devfn;
94};
95
Jeff Garzik18552562007-10-03 15:15:40 -040096extern int dmi_check_system(const struct dmi_system_id *list);
Rafael J. Wysockid7b19562009-01-19 20:55:50 +010097const struct dmi_system_id *dmi_first_match(const struct dmi_system_id *list);
Jeff Garzik18552562007-10-03 15:15:40 -040098extern const char * dmi_get_system_info(int field);
99extern const struct dmi_device * dmi_find_device(int type, const char *name,
100 const struct dmi_device *from);
Andi Kleene9928672006-01-11 22:43:33 +0100101extern void dmi_scan_machine(void);
Tejun Heo3e5cd1f2009-08-16 21:02:36 +0900102extern bool dmi_get_date(int field, int *yearp, int *monthp, int *dayp);
Jeff Garzik18552562007-10-03 15:15:40 -0400103extern int dmi_name_in_vendors(const char *str);
Alok Katariafd8cd7e2008-11-03 15:50:38 -0800104extern int dmi_name_in_serial(const char *str);
Len Brown81b4e1f2008-01-16 17:20:37 -0500105extern int dmi_available;
Jean Delvaree7a19c52009-03-30 21:46:44 +0200106extern int dmi_walk(void (*decode)(const struct dmi_header *, void *),
107 void *private_data);
Jiri Slabyd61c72e2008-12-10 14:07:21 +0100108extern bool dmi_match(enum dmi_field f, const char *str);
Andi Kleene9928672006-01-11 22:43:33 +0100109
Linus Torvalds1da177e2005-04-16 15:20:36 -0700110#else
111
Jeff Garzik18552562007-10-03 15:15:40 -0400112static inline int dmi_check_system(const struct dmi_system_id *list) { return 0; }
113static inline const char * dmi_get_system_info(int field) { return NULL; }
114static inline const struct dmi_device * dmi_find_device(int type, const char *name,
115 const struct dmi_device *from) { return NULL; }
Thomas Petazzoni7ae93922008-04-28 02:14:14 -0700116static inline void dmi_scan_machine(void) { return; }
Tejun Heo3e5cd1f2009-08-16 21:02:36 +0900117static inline bool dmi_get_date(int field, int *yearp, int *monthp, int *dayp)
118{
119 if (yearp)
120 *yearp = 0;
121 if (monthp)
122 *monthp = 0;
123 if (dayp)
124 *dayp = 0;
125 return false;
126}
Jeff Garzik18552562007-10-03 15:15:40 -0400127static inline int dmi_name_in_vendors(const char *s) { return 0; }
Alok Katariafd8cd7e2008-11-03 15:50:38 -0800128static inline int dmi_name_in_serial(const char *s) { return 0; }
Len Brown81b4e1f2008-01-16 17:20:37 -0500129#define dmi_available 0
Jean Delvaree7a19c52009-03-30 21:46:44 +0200130static inline int dmi_walk(void (*decode)(const struct dmi_header *, void *),
131 void *private_data) { return -1; }
Jiri Slabyd61c72e2008-12-10 14:07:21 +0100132static inline bool dmi_match(enum dmi_field f, const char *str)
133 { return false; }
Kumar Galad8204ee2009-01-28 00:07:20 -0600134static inline const struct dmi_system_id *
135 dmi_first_match(const struct dmi_system_id *list) { return NULL; }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700136
137#endif
138
139#endif /* __DMI_H__ */