dmi.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. #ifndef __DMI_H__
  2. #define __DMI_H__
  3. #include <linux/list.h>
  4. #include <linux/mod_devicetable.h>
  5. /* enum dmi_field is in mod_devicetable.h */
  6. enum dmi_device_type {
  7. DMI_DEV_TYPE_ANY = 0,
  8. DMI_DEV_TYPE_OTHER,
  9. DMI_DEV_TYPE_UNKNOWN,
  10. DMI_DEV_TYPE_VIDEO,
  11. DMI_DEV_TYPE_SCSI,
  12. DMI_DEV_TYPE_ETHERNET,
  13. DMI_DEV_TYPE_TOKENRING,
  14. DMI_DEV_TYPE_SOUND,
  15. DMI_DEV_TYPE_PATA,
  16. DMI_DEV_TYPE_SATA,
  17. DMI_DEV_TYPE_SAS,
  18. DMI_DEV_TYPE_IPMI = -1,
  19. DMI_DEV_TYPE_OEM_STRING = -2,
  20. DMI_DEV_TYPE_DEV_ONBOARD = -3,
  21. };
  22. enum dmi_entry_type {
  23. DMI_ENTRY_BIOS = 0,
  24. DMI_ENTRY_SYSTEM,
  25. DMI_ENTRY_BASEBOARD,
  26. DMI_ENTRY_CHASSIS,
  27. DMI_ENTRY_PROCESSOR,
  28. DMI_ENTRY_MEM_CONTROLLER,
  29. DMI_ENTRY_MEM_MODULE,
  30. DMI_ENTRY_CACHE,
  31. DMI_ENTRY_PORT_CONNECTOR,
  32. DMI_ENTRY_SYSTEM_SLOT,
  33. DMI_ENTRY_ONBOARD_DEVICE,
  34. DMI_ENTRY_OEMSTRINGS,
  35. DMI_ENTRY_SYSCONF,
  36. DMI_ENTRY_BIOS_LANG,
  37. DMI_ENTRY_GROUP_ASSOC,
  38. DMI_ENTRY_SYSTEM_EVENT_LOG,
  39. DMI_ENTRY_PHYS_MEM_ARRAY,
  40. DMI_ENTRY_MEM_DEVICE,
  41. DMI_ENTRY_32_MEM_ERROR,
  42. DMI_ENTRY_MEM_ARRAY_MAPPED_ADDR,
  43. DMI_ENTRY_MEM_DEV_MAPPED_ADDR,
  44. DMI_ENTRY_BUILTIN_POINTING_DEV,
  45. DMI_ENTRY_PORTABLE_BATTERY,
  46. DMI_ENTRY_SYSTEM_RESET,
  47. DMI_ENTRY_HW_SECURITY,
  48. DMI_ENTRY_SYSTEM_POWER_CONTROLS,
  49. DMI_ENTRY_VOLTAGE_PROBE,
  50. DMI_ENTRY_COOLING_DEV,
  51. DMI_ENTRY_TEMP_PROBE,
  52. DMI_ENTRY_ELECTRICAL_CURRENT_PROBE,
  53. DMI_ENTRY_OOB_REMOTE_ACCESS,
  54. DMI_ENTRY_BIS_ENTRY,
  55. DMI_ENTRY_SYSTEM_BOOT,
  56. DMI_ENTRY_MGMT_DEV,
  57. DMI_ENTRY_MGMT_DEV_COMPONENT,
  58. DMI_ENTRY_MGMT_DEV_THRES,
  59. DMI_ENTRY_MEM_CHANNEL,
  60. DMI_ENTRY_IPMI_DEV,
  61. DMI_ENTRY_SYS_POWER_SUPPLY,
  62. DMI_ENTRY_ADDITIONAL,
  63. DMI_ENTRY_ONBOARD_DEV_EXT,
  64. DMI_ENTRY_MGMT_CONTROLLER_HOST,
  65. DMI_ENTRY_INACTIVE = 126,
  66. DMI_ENTRY_END_OF_TABLE = 127,
  67. };
  68. struct dmi_header {
  69. u8 type;
  70. u8 length;
  71. u16 handle;
  72. };
  73. struct dmi_device {
  74. struct list_head list;
  75. int type;
  76. const char *name;
  77. void *device_data; /* Type specific data */
  78. };
  79. #ifdef CONFIG_DMI
  80. struct dmi_dev_onboard {
  81. struct dmi_device dev;
  82. int instance;
  83. int segment;
  84. int bus;
  85. int devfn;
  86. };
  87. extern int dmi_check_system(const struct dmi_system_id *list);
  88. const struct dmi_system_id *dmi_first_match(const struct dmi_system_id *list);
  89. extern const char * dmi_get_system_info(int field);
  90. extern const struct dmi_device * dmi_find_device(int type, const char *name,
  91. const struct dmi_device *from);
  92. extern void dmi_scan_machine(void);
  93. extern bool dmi_get_date(int field, int *yearp, int *monthp, int *dayp);
  94. extern int dmi_name_in_vendors(const char *str);
  95. extern int dmi_name_in_serial(const char *str);
  96. extern int dmi_available;
  97. extern int dmi_walk(void (*decode)(const struct dmi_header *, void *),
  98. void *private_data);
  99. extern bool dmi_match(enum dmi_field f, const char *str);
  100. #else
  101. static inline int dmi_check_system(const struct dmi_system_id *list) { return 0; }
  102. static inline const char * dmi_get_system_info(int field) { return NULL; }
  103. static inline const struct dmi_device * dmi_find_device(int type, const char *name,
  104. const struct dmi_device *from) { return NULL; }
  105. static inline void dmi_scan_machine(void) { return; }
  106. static inline bool dmi_get_date(int field, int *yearp, int *monthp, int *dayp)
  107. {
  108. if (yearp)
  109. *yearp = 0;
  110. if (monthp)
  111. *monthp = 0;
  112. if (dayp)
  113. *dayp = 0;
  114. return false;
  115. }
  116. static inline int dmi_name_in_vendors(const char *s) { return 0; }
  117. static inline int dmi_name_in_serial(const char *s) { return 0; }
  118. #define dmi_available 0
  119. static inline int dmi_walk(void (*decode)(const struct dmi_header *, void *),
  120. void *private_data) { return -1; }
  121. static inline bool dmi_match(enum dmi_field f, const char *str)
  122. { return false; }
  123. static inline const struct dmi_system_id *
  124. dmi_first_match(const struct dmi_system_id *list) { return NULL; }
  125. #endif
  126. #endif /* __DMI_H__ */