Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef __DMI_H__ |
| 2 | #define __DMI_H__ |
| 3 | |
Andrey Panin | ebad6a4 | 2005-09-06 15:18:29 -0700 | [diff] [blame] | 4 | #include <linux/list.h> |
Ivan Khoronzhuk | d7f96f97 | 2015-06-25 09:06:56 +0200 | [diff] [blame] | 5 | #include <linux/kobject.h> |
David Woodhouse | d945b69 | 2008-09-16 16:23:28 -0700 | [diff] [blame] | 6 | #include <linux/mod_devicetable.h> |
Andrey Panin | ebad6a4 | 2005-09-06 15:18:29 -0700 | [diff] [blame] | 7 | |
David Woodhouse | d945b69 | 2008-09-16 16:23:28 -0700 | [diff] [blame] | 8 | /* enum dmi_field is in mod_devicetable.h */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 9 | |
Andrey Panin | ebad6a4 | 2005-09-06 15:18:29 -0700 | [diff] [blame] | 10 | enum dmi_device_type { |
| 11 | DMI_DEV_TYPE_ANY = 0, |
| 12 | DMI_DEV_TYPE_OTHER, |
| 13 | DMI_DEV_TYPE_UNKNOWN, |
| 14 | DMI_DEV_TYPE_VIDEO, |
| 15 | DMI_DEV_TYPE_SCSI, |
| 16 | DMI_DEV_TYPE_ETHERNET, |
| 17 | DMI_DEV_TYPE_TOKENRING, |
| 18 | DMI_DEV_TYPE_SOUND, |
Wim Van Sebroeck | b4bd7d5 | 2008-02-08 04:20:58 -0800 | [diff] [blame] | 19 | DMI_DEV_TYPE_PATA, |
| 20 | DMI_DEV_TYPE_SATA, |
| 21 | DMI_DEV_TYPE_SAS, |
Shem Multinymous | 2e0c1f6 | 2006-09-29 01:59:37 -0700 | [diff] [blame] | 22 | DMI_DEV_TYPE_IPMI = -1, |
Wim Van Sebroeck | b4bd7d5 | 2008-02-08 04:20:58 -0800 | [diff] [blame] | 23 | DMI_DEV_TYPE_OEM_STRING = -2, |
Narendra K | 911e1c9 | 2010-07-26 05:56:50 -0500 | [diff] [blame] | 24 | DMI_DEV_TYPE_DEV_ONBOARD = -3, |
Andrey Panin | ebad6a4 | 2005-09-06 15:18:29 -0700 | [diff] [blame] | 25 | }; |
| 26 | |
Mike Waychison | 93c890d | 2011-02-22 17:53:15 -0800 | [diff] [blame] | 27 | enum dmi_entry_type { |
| 28 | DMI_ENTRY_BIOS = 0, |
| 29 | DMI_ENTRY_SYSTEM, |
| 30 | DMI_ENTRY_BASEBOARD, |
| 31 | DMI_ENTRY_CHASSIS, |
| 32 | DMI_ENTRY_PROCESSOR, |
| 33 | DMI_ENTRY_MEM_CONTROLLER, |
| 34 | DMI_ENTRY_MEM_MODULE, |
| 35 | DMI_ENTRY_CACHE, |
| 36 | DMI_ENTRY_PORT_CONNECTOR, |
| 37 | DMI_ENTRY_SYSTEM_SLOT, |
| 38 | DMI_ENTRY_ONBOARD_DEVICE, |
| 39 | DMI_ENTRY_OEMSTRINGS, |
| 40 | DMI_ENTRY_SYSCONF, |
| 41 | DMI_ENTRY_BIOS_LANG, |
| 42 | DMI_ENTRY_GROUP_ASSOC, |
| 43 | DMI_ENTRY_SYSTEM_EVENT_LOG, |
| 44 | DMI_ENTRY_PHYS_MEM_ARRAY, |
| 45 | DMI_ENTRY_MEM_DEVICE, |
| 46 | DMI_ENTRY_32_MEM_ERROR, |
| 47 | DMI_ENTRY_MEM_ARRAY_MAPPED_ADDR, |
| 48 | DMI_ENTRY_MEM_DEV_MAPPED_ADDR, |
| 49 | DMI_ENTRY_BUILTIN_POINTING_DEV, |
| 50 | DMI_ENTRY_PORTABLE_BATTERY, |
| 51 | DMI_ENTRY_SYSTEM_RESET, |
| 52 | DMI_ENTRY_HW_SECURITY, |
| 53 | DMI_ENTRY_SYSTEM_POWER_CONTROLS, |
| 54 | DMI_ENTRY_VOLTAGE_PROBE, |
| 55 | DMI_ENTRY_COOLING_DEV, |
| 56 | DMI_ENTRY_TEMP_PROBE, |
| 57 | DMI_ENTRY_ELECTRICAL_CURRENT_PROBE, |
| 58 | DMI_ENTRY_OOB_REMOTE_ACCESS, |
| 59 | DMI_ENTRY_BIS_ENTRY, |
| 60 | DMI_ENTRY_SYSTEM_BOOT, |
| 61 | DMI_ENTRY_MGMT_DEV, |
| 62 | DMI_ENTRY_MGMT_DEV_COMPONENT, |
| 63 | DMI_ENTRY_MGMT_DEV_THRES, |
| 64 | DMI_ENTRY_MEM_CHANNEL, |
| 65 | DMI_ENTRY_IPMI_DEV, |
| 66 | DMI_ENTRY_SYS_POWER_SUPPLY, |
| 67 | DMI_ENTRY_ADDITIONAL, |
| 68 | DMI_ENTRY_ONBOARD_DEV_EXT, |
| 69 | DMI_ENTRY_MGMT_CONTROLLER_HOST, |
| 70 | DMI_ENTRY_INACTIVE = 126, |
| 71 | DMI_ENTRY_END_OF_TABLE = 127, |
| 72 | }; |
| 73 | |
Andrey Panin | ebad6a4 | 2005-09-06 15:18:29 -0700 | [diff] [blame] | 74 | struct dmi_header { |
| 75 | u8 type; |
| 76 | u8 length; |
| 77 | u16 handle; |
Jean Delvare | 9ea650c8 | 2015-06-25 09:06:57 +0200 | [diff] [blame] | 78 | } __packed; |
Andrey Panin | ebad6a4 | 2005-09-06 15:18:29 -0700 | [diff] [blame] | 79 | |
Andrey Panin | ebad6a4 | 2005-09-06 15:18:29 -0700 | [diff] [blame] | 80 | struct dmi_device { |
| 81 | struct list_head list; |
| 82 | int type; |
| 83 | const char *name; |
| 84 | void *device_data; /* Type specific data */ |
| 85 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 86 | |
Andi Kleen | e992867 | 2006-01-11 22:43:33 +0100 | [diff] [blame] | 87 | #ifdef CONFIG_DMI |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 88 | |
Narendra K | 911e1c9 | 2010-07-26 05:56:50 -0500 | [diff] [blame] | 89 | struct dmi_dev_onboard { |
| 90 | struct dmi_device dev; |
| 91 | int instance; |
| 92 | int segment; |
| 93 | int bus; |
| 94 | int devfn; |
| 95 | }; |
| 96 | |
Ivan Khoronzhuk | d7f96f97 | 2015-06-25 09:06:56 +0200 | [diff] [blame] | 97 | extern struct kobject *dmi_kobj; |
Jeff Garzik | 1855256 | 2007-10-03 15:15:40 -0400 | [diff] [blame] | 98 | extern int dmi_check_system(const struct dmi_system_id *list); |
Rafael J. Wysocki | d7b1956 | 2009-01-19 20:55:50 +0100 | [diff] [blame] | 99 | const struct dmi_system_id *dmi_first_match(const struct dmi_system_id *list); |
Jeff Garzik | 1855256 | 2007-10-03 15:15:40 -0400 | [diff] [blame] | 100 | extern const char * dmi_get_system_info(int field); |
| 101 | extern const struct dmi_device * dmi_find_device(int type, const char *name, |
| 102 | const struct dmi_device *from); |
Andi Kleen | e992867 | 2006-01-11 22:43:33 +0100 | [diff] [blame] | 103 | extern void dmi_scan_machine(void); |
Chen, Gong | dd6dad4 | 2013-10-18 14:29:25 -0700 | [diff] [blame] | 104 | extern void dmi_memdev_walk(void); |
Tejun Heo | 98e5e1b | 2013-04-30 15:27:15 -0700 | [diff] [blame] | 105 | extern void dmi_set_dump_stack_arch_desc(void); |
Tejun Heo | 3e5cd1f | 2009-08-16 21:02:36 +0900 | [diff] [blame] | 106 | extern bool dmi_get_date(int field, int *yearp, int *monthp, int *dayp); |
Jeff Garzik | 1855256 | 2007-10-03 15:15:40 -0400 | [diff] [blame] | 107 | extern int dmi_name_in_vendors(const char *str); |
Alok Kataria | fd8cd7e | 2008-11-03 15:50:38 -0800 | [diff] [blame] | 108 | extern int dmi_name_in_serial(const char *str); |
Len Brown | 81b4e1f | 2008-01-16 17:20:37 -0500 | [diff] [blame] | 109 | extern int dmi_available; |
Jean Delvare | e7a19c56 | 2009-03-30 21:46:44 +0200 | [diff] [blame] | 110 | extern int dmi_walk(void (*decode)(const struct dmi_header *, void *), |
| 111 | void *private_data); |
Jiri Slaby | d61c72e | 2008-12-10 14:07:21 +0100 | [diff] [blame] | 112 | extern bool dmi_match(enum dmi_field f, const char *str); |
Chen, Gong | dd6dad4 | 2013-10-18 14:29:25 -0700 | [diff] [blame] | 113 | extern void dmi_memdev_name(u16 handle, const char **bank, const char **device); |
Andi Kleen | e992867 | 2006-01-11 22:43:33 +0100 | [diff] [blame] | 114 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 115 | #else |
| 116 | |
Jeff Garzik | 1855256 | 2007-10-03 15:15:40 -0400 | [diff] [blame] | 117 | static inline int dmi_check_system(const struct dmi_system_id *list) { return 0; } |
| 118 | static inline const char * dmi_get_system_info(int field) { return NULL; } |
| 119 | static inline const struct dmi_device * dmi_find_device(int type, const char *name, |
| 120 | const struct dmi_device *from) { return NULL; } |
Thomas Petazzoni | 7ae9392 | 2008-04-28 02:14:14 -0700 | [diff] [blame] | 121 | static inline void dmi_scan_machine(void) { return; } |
Chen, Gong | dd6dad4 | 2013-10-18 14:29:25 -0700 | [diff] [blame] | 122 | static inline void dmi_memdev_walk(void) { } |
Tejun Heo | 98e5e1b | 2013-04-30 15:27:15 -0700 | [diff] [blame] | 123 | static inline void dmi_set_dump_stack_arch_desc(void) { } |
Tejun Heo | 3e5cd1f | 2009-08-16 21:02:36 +0900 | [diff] [blame] | 124 | static inline bool dmi_get_date(int field, int *yearp, int *monthp, int *dayp) |
| 125 | { |
| 126 | if (yearp) |
| 127 | *yearp = 0; |
| 128 | if (monthp) |
| 129 | *monthp = 0; |
| 130 | if (dayp) |
| 131 | *dayp = 0; |
| 132 | return false; |
| 133 | } |
Jeff Garzik | 1855256 | 2007-10-03 15:15:40 -0400 | [diff] [blame] | 134 | static inline int dmi_name_in_vendors(const char *s) { return 0; } |
Alok Kataria | fd8cd7e | 2008-11-03 15:50:38 -0800 | [diff] [blame] | 135 | static inline int dmi_name_in_serial(const char *s) { return 0; } |
Len Brown | 81b4e1f | 2008-01-16 17:20:37 -0500 | [diff] [blame] | 136 | #define dmi_available 0 |
Jean Delvare | e7a19c56 | 2009-03-30 21:46:44 +0200 | [diff] [blame] | 137 | static inline int dmi_walk(void (*decode)(const struct dmi_header *, void *), |
| 138 | void *private_data) { return -1; } |
Jiri Slaby | d61c72e | 2008-12-10 14:07:21 +0100 | [diff] [blame] | 139 | static inline bool dmi_match(enum dmi_field f, const char *str) |
| 140 | { return false; } |
Chen, Gong | dd6dad4 | 2013-10-18 14:29:25 -0700 | [diff] [blame] | 141 | static inline void dmi_memdev_name(u16 handle, const char **bank, |
| 142 | const char **device) { } |
Kumar Gala | d8204ee | 2009-01-28 00:07:20 -0600 | [diff] [blame] | 143 | static inline const struct dmi_system_id * |
| 144 | dmi_first_match(const struct dmi_system_id *list) { return NULL; } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 145 | |
| 146 | #endif |
| 147 | |
| 148 | #endif /* __DMI_H__ */ |