20945d3c0b2db0acdfb2a8a9909afc3f6ad04f6b
[sliver-openvswitch.git] / datapath / linux / compat / include / linux / dmi.h
1 #ifndef __LINUX_DMI_WRAPPER_H
2 #define __LINUX_DMI_WRAPPER_H 1
3
4 #include <linux/version.h>
5 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23)
6
7 #include_next <linux/dmi.h>
8
9 #else  /* linux version >= 2.6.23 */
10
11 #ifndef __DMI_H__
12 #define __DMI_H__
13
14 #include <linux/list.h>
15
16 enum dmi_field {
17         DMI_NONE,
18         DMI_BIOS_VENDOR,
19         DMI_BIOS_VERSION,
20         DMI_BIOS_DATE,
21         DMI_SYS_VENDOR,
22         DMI_PRODUCT_NAME,
23         DMI_PRODUCT_VERSION,
24         DMI_PRODUCT_SERIAL,
25         DMI_PRODUCT_UUID,
26         DMI_BOARD_VENDOR,
27         DMI_BOARD_NAME,
28         DMI_BOARD_VERSION,
29         DMI_BOARD_SERIAL,
30         DMI_BOARD_ASSET_TAG,
31         DMI_CHASSIS_VENDOR,
32         DMI_CHASSIS_TYPE,
33         DMI_CHASSIS_VERSION,
34         DMI_CHASSIS_SERIAL,
35         DMI_CHASSIS_ASSET_TAG,
36         DMI_STRING_MAX,
37 };
38
39 enum dmi_device_type {
40         DMI_DEV_TYPE_ANY = 0,
41         DMI_DEV_TYPE_OTHER,
42         DMI_DEV_TYPE_UNKNOWN,
43         DMI_DEV_TYPE_VIDEO,
44         DMI_DEV_TYPE_SCSI,
45         DMI_DEV_TYPE_ETHERNET,
46         DMI_DEV_TYPE_TOKENRING,
47         DMI_DEV_TYPE_SOUND,
48         DMI_DEV_TYPE_IPMI = -1,
49         DMI_DEV_TYPE_OEM_STRING = -2
50 };
51
52 struct dmi_header {
53         u8 type;
54         u8 length;
55         u16 handle;
56 };
57
58 /*
59  *      DMI callbacks for problem boards
60  */
61 struct dmi_strmatch {
62         u8 slot;
63         char *substr;
64 };
65
66 struct dmi_system_id {
67         int (*callback)(struct dmi_system_id *);
68         const char *ident;
69         struct dmi_strmatch matches[4];
70         void *driver_data;
71 };
72
73 #define DMI_MATCH(a, b) { a, b }
74
75 struct dmi_device {
76         struct list_head list;
77         int type;
78         const char *name;
79         void *device_data;      /* Type specific data */
80 };
81
82 /* No CONFIG_DMI before 2.6.16 */
83 #if defined(CONFIG_DMI) || defined(CONFIG_X86_32)
84
85 extern int dmi_check_system(struct dmi_system_id *list);
86 extern char *dmi_get_system_info(int field);
87 extern struct dmi_device *dmi_find_device(int type, const char *name,
88                                           struct dmi_device *from);
89 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
90 extern void dmi_scan_machine(void);
91 #endif
92 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,17)
93 extern int dmi_get_year(int field);
94 #endif
95 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
96 extern int dmi_name_in_vendors(char *str);
97 #endif
98
99 #else
100
101 static inline int dmi_check_system(struct dmi_system_id *list) { return 0; }
102 static inline char *dmi_get_system_info(int field) { return NULL; }
103 static inline struct dmi_device *dmi_find_device(int type, const char *name,
104                         struct dmi_device *from) { return NULL; }
105 static inline int dmi_get_year(int year) { return 0; }
106 static inline int dmi_name_in_vendors(char *s) { return 0; }
107
108 #endif
109
110 #endif  /* __DMI_H__ */
111
112 #endif /* linux kernel < 2.6.22 */
113
114 #endif