2
0

smbios.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. #ifndef QEMU_SMBIOS_H
  2. #define QEMU_SMBIOS_H
  3. /*
  4. * SMBIOS Support
  5. *
  6. * Copyright (C) 2009 Hewlett-Packard Development Company, L.P.
  7. *
  8. * Authors:
  9. * Alex Williamson <alex.williamson@hp.com>
  10. *
  11. * This work is licensed under the terms of the GNU GPL, version 2. See
  12. * the COPYING file in the top-level directory.
  13. *
  14. */
  15. int smbios_entry_add(const char *t);
  16. void smbios_add_field(int type, int offset, int len, void *data);
  17. uint8_t *smbios_get_table(size_t *length);
  18. /*
  19. * SMBIOS spec defined tables
  20. */
  21. /* This goes at the beginning of every SMBIOS structure. */
  22. struct smbios_structure_header {
  23. uint8_t type;
  24. uint8_t length;
  25. uint16_t handle;
  26. } QEMU_PACKED;
  27. /* SMBIOS type 0 - BIOS Information */
  28. struct smbios_type_0 {
  29. struct smbios_structure_header header;
  30. uint8_t vendor_str;
  31. uint8_t bios_version_str;
  32. uint16_t bios_starting_address_segment;
  33. uint8_t bios_release_date_str;
  34. uint8_t bios_rom_size;
  35. uint8_t bios_characteristics[8];
  36. uint8_t bios_characteristics_extension_bytes[2];
  37. uint8_t system_bios_major_release;
  38. uint8_t system_bios_minor_release;
  39. uint8_t embedded_controller_major_release;
  40. uint8_t embedded_controller_minor_release;
  41. } QEMU_PACKED;
  42. /* SMBIOS type 1 - System Information */
  43. struct smbios_type_1 {
  44. struct smbios_structure_header header;
  45. uint8_t manufacturer_str;
  46. uint8_t product_name_str;
  47. uint8_t version_str;
  48. uint8_t serial_number_str;
  49. uint8_t uuid[16];
  50. uint8_t wake_up_type;
  51. uint8_t sku_number_str;
  52. uint8_t family_str;
  53. } QEMU_PACKED;
  54. /* SMBIOS type 3 - System Enclosure (v2.3) */
  55. struct smbios_type_3 {
  56. struct smbios_structure_header header;
  57. uint8_t manufacturer_str;
  58. uint8_t type;
  59. uint8_t version_str;
  60. uint8_t serial_number_str;
  61. uint8_t asset_tag_number_str;
  62. uint8_t boot_up_state;
  63. uint8_t power_supply_state;
  64. uint8_t thermal_state;
  65. uint8_t security_status;
  66. uint32_t oem_defined;
  67. uint8_t height;
  68. uint8_t number_of_power_cords;
  69. uint8_t contained_element_count;
  70. // contained elements follow
  71. } QEMU_PACKED;
  72. /* SMBIOS type 4 - Processor Information (v2.0) */
  73. struct smbios_type_4 {
  74. struct smbios_structure_header header;
  75. uint8_t socket_designation_str;
  76. uint8_t processor_type;
  77. uint8_t processor_family;
  78. uint8_t processor_manufacturer_str;
  79. uint32_t processor_id[2];
  80. uint8_t processor_version_str;
  81. uint8_t voltage;
  82. uint16_t external_clock;
  83. uint16_t max_speed;
  84. uint16_t current_speed;
  85. uint8_t status;
  86. uint8_t processor_upgrade;
  87. uint16_t l1_cache_handle;
  88. uint16_t l2_cache_handle;
  89. uint16_t l3_cache_handle;
  90. } QEMU_PACKED;
  91. /* SMBIOS type 16 - Physical Memory Array
  92. * Associated with one type 17 (Memory Device).
  93. */
  94. struct smbios_type_16 {
  95. struct smbios_structure_header header;
  96. uint8_t location;
  97. uint8_t use;
  98. uint8_t error_correction;
  99. uint32_t maximum_capacity;
  100. uint16_t memory_error_information_handle;
  101. uint16_t number_of_memory_devices;
  102. } QEMU_PACKED;
  103. /* SMBIOS type 17 - Memory Device
  104. * Associated with one type 19
  105. */
  106. struct smbios_type_17 {
  107. struct smbios_structure_header header;
  108. uint16_t physical_memory_array_handle;
  109. uint16_t memory_error_information_handle;
  110. uint16_t total_width;
  111. uint16_t data_width;
  112. uint16_t size;
  113. uint8_t form_factor;
  114. uint8_t device_set;
  115. uint8_t device_locator_str;
  116. uint8_t bank_locator_str;
  117. uint8_t memory_type;
  118. uint16_t type_detail;
  119. } QEMU_PACKED;
  120. /* SMBIOS type 19 - Memory Array Mapped Address */
  121. struct smbios_type_19 {
  122. struct smbios_structure_header header;
  123. uint32_t starting_address;
  124. uint32_t ending_address;
  125. uint16_t memory_array_handle;
  126. uint8_t partition_width;
  127. } QEMU_PACKED;
  128. /* SMBIOS type 20 - Memory Device Mapped Address */
  129. struct smbios_type_20 {
  130. struct smbios_structure_header header;
  131. uint32_t starting_address;
  132. uint32_t ending_address;
  133. uint16_t memory_device_handle;
  134. uint16_t memory_array_mapped_address_handle;
  135. uint8_t partition_row_position;
  136. uint8_t interleave_position;
  137. uint8_t interleaved_data_depth;
  138. } QEMU_PACKED;
  139. /* SMBIOS type 32 - System Boot Information */
  140. struct smbios_type_32 {
  141. struct smbios_structure_header header;
  142. uint8_t reserved[6];
  143. uint8_t boot_status;
  144. } QEMU_PACKED;
  145. /* SMBIOS type 127 -- End-of-table */
  146. struct smbios_type_127 {
  147. struct smbios_structure_header header;
  148. } QEMU_PACKED;
  149. #endif /*QEMU_SMBIOS_H */