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> |
| 5 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | enum dmi_field { |
| 7 | DMI_NONE, |
| 8 | DMI_BIOS_VENDOR, |
| 9 | DMI_BIOS_VERSION, |
| 10 | DMI_BIOS_DATE, |
| 11 | DMI_SYS_VENDOR, |
| 12 | DMI_PRODUCT_NAME, |
| 13 | DMI_PRODUCT_VERSION, |
Dmitry Torokhov | e70c9d5 | 2005-06-25 14:54:25 -0700 | [diff] [blame] | 14 | DMI_PRODUCT_SERIAL, |
Lennart Poettering | 4f5c791 | 2007-05-08 22:07:02 +0200 | [diff] [blame] | 15 | DMI_PRODUCT_UUID, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 | DMI_BOARD_VENDOR, |
| 17 | DMI_BOARD_NAME, |
| 18 | DMI_BOARD_VERSION, |
Lennart Poettering | 4f5c791 | 2007-05-08 22:07:02 +0200 | [diff] [blame] | 19 | DMI_BOARD_SERIAL, |
| 20 | DMI_BOARD_ASSET_TAG, |
| 21 | DMI_CHASSIS_VENDOR, |
| 22 | DMI_CHASSIS_TYPE, |
| 23 | DMI_CHASSIS_VERSION, |
| 24 | DMI_CHASSIS_SERIAL, |
| 25 | DMI_CHASSIS_ASSET_TAG, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | DMI_STRING_MAX, |
| 27 | }; |
| 28 | |
Andrey Panin | ebad6a4 | 2005-09-06 15:18:29 -0700 | [diff] [blame] | 29 | enum dmi_device_type { |
| 30 | DMI_DEV_TYPE_ANY = 0, |
| 31 | DMI_DEV_TYPE_OTHER, |
| 32 | DMI_DEV_TYPE_UNKNOWN, |
| 33 | DMI_DEV_TYPE_VIDEO, |
| 34 | DMI_DEV_TYPE_SCSI, |
| 35 | DMI_DEV_TYPE_ETHERNET, |
| 36 | DMI_DEV_TYPE_TOKENRING, |
| 37 | DMI_DEV_TYPE_SOUND, |
Wim Van Sebroeck | b4bd7d5 | 2008-02-08 04:20:58 -0800 | [diff] [blame] | 38 | DMI_DEV_TYPE_PATA, |
| 39 | DMI_DEV_TYPE_SATA, |
| 40 | DMI_DEV_TYPE_SAS, |
Shem Multinymous | 2e0c1f6 | 2006-09-29 01:59:37 -0700 | [diff] [blame] | 41 | DMI_DEV_TYPE_IPMI = -1, |
Wim Van Sebroeck | b4bd7d5 | 2008-02-08 04:20:58 -0800 | [diff] [blame] | 42 | DMI_DEV_TYPE_OEM_STRING = -2, |
Andrey Panin | ebad6a4 | 2005-09-06 15:18:29 -0700 | [diff] [blame] | 43 | }; |
| 44 | |
| 45 | struct dmi_header { |
| 46 | u8 type; |
| 47 | u8 length; |
| 48 | u16 handle; |
| 49 | }; |
| 50 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 51 | /* |
| 52 | * DMI callbacks for problem boards |
| 53 | */ |
| 54 | struct dmi_strmatch { |
| 55 | u8 slot; |
| 56 | char *substr; |
| 57 | }; |
| 58 | |
| 59 | struct dmi_system_id { |
Jeff Garzik | 1855256 | 2007-10-03 15:15:40 -0400 | [diff] [blame] | 60 | int (*callback)(const struct dmi_system_id *); |
Andrey Panin | ebad6a4 | 2005-09-06 15:18:29 -0700 | [diff] [blame] | 61 | const char *ident; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 62 | struct dmi_strmatch matches[4]; |
| 63 | void *driver_data; |
| 64 | }; |
| 65 | |
Andrey Panin | ebad6a4 | 2005-09-06 15:18:29 -0700 | [diff] [blame] | 66 | #define DMI_MATCH(a, b) { a, b } |
| 67 | |
| 68 | struct dmi_device { |
| 69 | struct list_head list; |
| 70 | int type; |
| 71 | const char *name; |
| 72 | void *device_data; /* Type specific data */ |
| 73 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 74 | |
Andi Kleen | e992867 | 2006-01-11 22:43:33 +0100 | [diff] [blame] | 75 | #ifdef CONFIG_DMI |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 76 | |
Jeff Garzik | 1855256 | 2007-10-03 15:15:40 -0400 | [diff] [blame] | 77 | extern int dmi_check_system(const struct dmi_system_id *list); |
| 78 | extern const char * dmi_get_system_info(int field); |
| 79 | extern const struct dmi_device * dmi_find_device(int type, const char *name, |
| 80 | const struct dmi_device *from); |
Andi Kleen | e992867 | 2006-01-11 22:43:33 +0100 | [diff] [blame] | 81 | extern void dmi_scan_machine(void); |
Andi Kleen | f083a32 | 2006-03-25 16:30:19 +0100 | [diff] [blame] | 82 | extern int dmi_get_year(int field); |
Jeff Garzik | 1855256 | 2007-10-03 15:15:40 -0400 | [diff] [blame] | 83 | extern int dmi_name_in_vendors(const char *str); |
Len Brown | 81b4e1f | 2008-01-16 17:20:37 -0500 | [diff] [blame] | 84 | extern int dmi_available; |
Jean Delvare | 7fce084 | 2007-11-03 17:29:20 +0100 | [diff] [blame] | 85 | extern int dmi_walk(void (*decode)(const struct dmi_header *)); |
Andi Kleen | e992867 | 2006-01-11 22:43:33 +0100 | [diff] [blame] | 86 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 87 | #else |
| 88 | |
Jeff Garzik | 1855256 | 2007-10-03 15:15:40 -0400 | [diff] [blame] | 89 | static inline int dmi_check_system(const struct dmi_system_id *list) { return 0; } |
| 90 | static inline const char * dmi_get_system_info(int field) { return NULL; } |
| 91 | static inline const struct dmi_device * dmi_find_device(int type, const char *name, |
| 92 | const struct dmi_device *from) { return NULL; } |
Thomas Petazzoni | 7ae9392 | 2008-04-28 02:14:14 -0700 | [diff] [blame] | 93 | static inline void dmi_scan_machine(void) { return; } |
Andi Kleen | f083a32 | 2006-03-25 16:30:19 +0100 | [diff] [blame] | 94 | static inline int dmi_get_year(int year) { return 0; } |
Jeff Garzik | 1855256 | 2007-10-03 15:15:40 -0400 | [diff] [blame] | 95 | static inline int dmi_name_in_vendors(const char *s) { return 0; } |
Len Brown | 81b4e1f | 2008-01-16 17:20:37 -0500 | [diff] [blame] | 96 | #define dmi_available 0 |
Jean Delvare | 7fce084 | 2007-11-03 17:29:20 +0100 | [diff] [blame] | 97 | static inline int dmi_walk(void (*decode)(const struct dmi_header *)) |
| 98 | { return -1; } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 99 | |
| 100 | #endif |
| 101 | |
| 102 | #endif /* __DMI_H__ */ |