blob: a8a3e1ac281dfb1cb27df81200fb2055d6c71ae4 [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,
Andrey Paninebad6a42005-09-06 15:18:29 -070023};
24
25struct dmi_header {
26 u8 type;
27 u8 length;
28 u16 handle;
29};
30
Andrey Paninebad6a42005-09-06 15:18:29 -070031struct dmi_device {
32 struct list_head list;
33 int type;
34 const char *name;
35 void *device_data; /* Type specific data */
36};
Linus Torvalds1da177e2005-04-16 15:20:36 -070037
Andi Kleene9928672006-01-11 22:43:33 +010038#ifdef CONFIG_DMI
Linus Torvalds1da177e2005-04-16 15:20:36 -070039
Jeff Garzik18552562007-10-03 15:15:40 -040040extern int dmi_check_system(const struct dmi_system_id *list);
Rafael J. Wysockid7b19562009-01-19 20:55:50 +010041const struct dmi_system_id *dmi_first_match(const struct dmi_system_id *list);
Jeff Garzik18552562007-10-03 15:15:40 -040042extern const char * dmi_get_system_info(int field);
43extern const struct dmi_device * dmi_find_device(int type, const char *name,
44 const struct dmi_device *from);
Andi Kleene9928672006-01-11 22:43:33 +010045extern void dmi_scan_machine(void);
Tejun Heo3e5cd1f2009-08-16 21:02:36 +090046extern bool dmi_get_date(int field, int *yearp, int *monthp, int *dayp);
Jeff Garzik18552562007-10-03 15:15:40 -040047extern int dmi_name_in_vendors(const char *str);
Alok Katariafd8cd7e2008-11-03 15:50:38 -080048extern int dmi_name_in_serial(const char *str);
Len Brown81b4e1f2008-01-16 17:20:37 -050049extern int dmi_available;
Jean Delvaree7a19c562009-03-30 21:46:44 +020050extern int dmi_walk(void (*decode)(const struct dmi_header *, void *),
51 void *private_data);
Jiri Slabyd61c72e2008-12-10 14:07:21 +010052extern bool dmi_match(enum dmi_field f, const char *str);
Andi Kleene9928672006-01-11 22:43:33 +010053
Linus Torvalds1da177e2005-04-16 15:20:36 -070054#else
55
Jeff Garzik18552562007-10-03 15:15:40 -040056static inline int dmi_check_system(const struct dmi_system_id *list) { return 0; }
57static inline const char * dmi_get_system_info(int field) { return NULL; }
58static inline const struct dmi_device * dmi_find_device(int type, const char *name,
59 const struct dmi_device *from) { return NULL; }
Thomas Petazzoni7ae93922008-04-28 02:14:14 -070060static inline void dmi_scan_machine(void) { return; }
Tejun Heo3e5cd1f2009-08-16 21:02:36 +090061static inline bool dmi_get_date(int field, int *yearp, int *monthp, int *dayp)
62{
63 if (yearp)
64 *yearp = 0;
65 if (monthp)
66 *monthp = 0;
67 if (dayp)
68 *dayp = 0;
69 return false;
70}
Jeff Garzik18552562007-10-03 15:15:40 -040071static inline int dmi_name_in_vendors(const char *s) { return 0; }
Alok Katariafd8cd7e2008-11-03 15:50:38 -080072static inline int dmi_name_in_serial(const char *s) { return 0; }
Len Brown81b4e1f2008-01-16 17:20:37 -050073#define dmi_available 0
Jean Delvaree7a19c562009-03-30 21:46:44 +020074static inline int dmi_walk(void (*decode)(const struct dmi_header *, void *),
75 void *private_data) { return -1; }
Jiri Slabyd61c72e2008-12-10 14:07:21 +010076static inline bool dmi_match(enum dmi_field f, const char *str)
77 { return false; }
Kumar Galad8204ee2009-01-28 00:07:20 -060078static inline const struct dmi_system_id *
79 dmi_first_match(const struct dmi_system_id *list) { return NULL; }
Linus Torvalds1da177e2005-04-16 15:20:36 -070080
81#endif
82
83#endif /* __DMI_H__ */