7 * Copyright (C) 2009 Hewlett-Packard Development Company, L.P.
10 * Alex Williamson <alex.williamson@hp.com>
12 * This work is licensed under the terms of the GNU GPL, version 2. See
13 * the COPYING file in the top-level directory.
17 #include "qemu/option.h"
19 #define SMBIOS_MAX_TYPE 127
21 /* memory area description, used by type 19 table */
22 struct smbios_phys_mem_area
{
28 * SMBIOS spec defined tables
30 typedef enum SmbiosEntryPointType
{
31 SMBIOS_ENTRY_POINT_21
,
32 SMBIOS_ENTRY_POINT_30
,
33 } SmbiosEntryPointType
;
36 * There are two types of entry points defined in the SMBIOS specification
37 * (see below). BIOS must place the entry point(s) at a 16-byte-aligned
38 * address between 0xf0000 and 0xfffff. Note that either entry point type
39 * can be used in a 64-bit target system, except that SMBIOS 2.1 entry point
40 * only allows the SMBIOS struct table to reside below 4GB address space.
43 /* SMBIOS 2.1 (32-bit) Entry Point
44 * - introduced since SMBIOS 2.1
45 * - supports structure table below 4GB only
47 struct smbios_21_entry_point
{
48 uint8_t anchor_string
[4];
51 uint8_t smbios_major_version
;
52 uint8_t smbios_minor_version
;
53 uint16_t max_structure_size
;
54 uint8_t entry_point_revision
;
55 uint8_t formatted_area
[5];
56 uint8_t intermediate_anchor_string
[5];
57 uint8_t intermediate_checksum
;
58 uint16_t structure_table_length
;
59 uint32_t structure_table_address
;
60 uint16_t number_of_structures
;
61 uint8_t smbios_bcd_revision
;
64 /* SMBIOS 3.0 (64-bit) Entry Point
65 * - introduced since SMBIOS 3.0
66 * - supports structure table at 64-bit address space
68 struct smbios_30_entry_point
{
69 uint8_t anchor_string
[5];
72 uint8_t smbios_major_version
;
73 uint8_t smbios_minor_version
;
74 uint8_t smbios_doc_rev
;
75 uint8_t entry_point_revision
;
77 uint32_t structure_table_max_size
;
78 uint64_t structure_table_address
;
82 struct smbios_21_entry_point ep21
;
83 struct smbios_30_entry_point ep30
;
84 } QEMU_PACKED SmbiosEntryPoint
;
86 /* This goes at the beginning of every SMBIOS structure. */
87 struct smbios_structure_header
{
93 /* SMBIOS type 0 - BIOS Information */
94 struct smbios_type_0
{
95 struct smbios_structure_header header
;
97 uint8_t bios_version_str
;
98 uint16_t bios_starting_address_segment
;
99 uint8_t bios_release_date_str
;
100 uint8_t bios_rom_size
;
101 uint64_t bios_characteristics
;
102 uint8_t bios_characteristics_extension_bytes
[2];
103 uint8_t system_bios_major_release
;
104 uint8_t system_bios_minor_release
;
105 uint8_t embedded_controller_major_release
;
106 uint8_t embedded_controller_minor_release
;
109 /* UUID encoding. The time_* fields are little-endian, as specified by SMBIOS
115 uint16_t time_hi_and_version
;
116 uint8_t clock_seq_hi_and_reserved
;
117 uint8_t clock_seq_low
;
121 /* SMBIOS type 1 - System Information */
122 struct smbios_type_1
{
123 struct smbios_structure_header header
;
124 uint8_t manufacturer_str
;
125 uint8_t product_name_str
;
127 uint8_t serial_number_str
;
128 struct smbios_uuid uuid
;
129 uint8_t wake_up_type
;
130 uint8_t sku_number_str
;
134 /* SMBIOS type 2 - Base Board */
135 struct smbios_type_2
{
136 struct smbios_structure_header header
;
137 uint8_t manufacturer_str
;
140 uint8_t serial_number_str
;
141 uint8_t asset_tag_number_str
;
142 uint8_t feature_flags
;
143 uint8_t location_str
;
144 uint16_t chassis_handle
;
146 uint8_t contained_element_count
;
147 /* contained elements follow */
150 /* SMBIOS type 3 - System Enclosure (v2.7) */
151 struct smbios_type_3
{
152 struct smbios_structure_header header
;
153 uint8_t manufacturer_str
;
156 uint8_t serial_number_str
;
157 uint8_t asset_tag_number_str
;
158 uint8_t boot_up_state
;
159 uint8_t power_supply_state
;
160 uint8_t thermal_state
;
161 uint8_t security_status
;
162 uint32_t oem_defined
;
164 uint8_t number_of_power_cords
;
165 uint8_t contained_element_count
;
166 uint8_t sku_number_str
;
167 /* contained elements follow */
170 /* SMBIOS type 4 - Processor Information (v2.6) */
171 struct smbios_type_4
{
172 struct smbios_structure_header header
;
173 uint8_t socket_designation_str
;
174 uint8_t processor_type
;
175 uint8_t processor_family
;
176 uint8_t processor_manufacturer_str
;
177 uint32_t processor_id
[2];
178 uint8_t processor_version_str
;
180 uint16_t external_clock
;
182 uint16_t current_speed
;
184 uint8_t processor_upgrade
;
185 uint16_t l1_cache_handle
;
186 uint16_t l2_cache_handle
;
187 uint16_t l3_cache_handle
;
188 uint8_t serial_number_str
;
189 uint8_t asset_tag_number_str
;
190 uint8_t part_number_str
;
192 uint8_t core_enabled
;
193 uint8_t thread_count
;
194 uint16_t processor_characteristics
;
195 uint16_t processor_family2
;
198 /* SMBIOS type 16 - Physical Memory Array (v2.7) */
199 struct smbios_type_16
{
200 struct smbios_structure_header header
;
203 uint8_t error_correction
;
204 uint32_t maximum_capacity
;
205 uint16_t memory_error_information_handle
;
206 uint16_t number_of_memory_devices
;
207 uint64_t extended_maximum_capacity
;
210 /* SMBIOS type 17 - Memory Device (v2.8) */
211 struct smbios_type_17
{
212 struct smbios_structure_header header
;
213 uint16_t physical_memory_array_handle
;
214 uint16_t memory_error_information_handle
;
215 uint16_t total_width
;
220 uint8_t device_locator_str
;
221 uint8_t bank_locator_str
;
223 uint16_t type_detail
;
225 uint8_t manufacturer_str
;
226 uint8_t serial_number_str
;
227 uint8_t asset_tag_number_str
;
228 uint8_t part_number_str
;
230 uint32_t extended_size
;
231 uint16_t configured_clock_speed
;
232 uint16_t minimum_voltage
;
233 uint16_t maximum_voltage
;
234 uint16_t configured_voltage
;
237 /* SMBIOS type 19 - Memory Array Mapped Address (v2.7) */
238 struct smbios_type_19
{
239 struct smbios_structure_header header
;
240 uint32_t starting_address
;
241 uint32_t ending_address
;
242 uint16_t memory_array_handle
;
243 uint8_t partition_width
;
244 uint64_t extended_starting_address
;
245 uint64_t extended_ending_address
;
248 /* SMBIOS type 32 - System Boot Information */
249 struct smbios_type_32
{
250 struct smbios_structure_header header
;
255 /* SMBIOS type 127 -- End-of-table */
256 struct smbios_type_127
{
257 struct smbios_structure_header header
;
260 void smbios_entry_add(QemuOpts
*opts
, Error
**errp
);
261 void smbios_set_cpuid(uint32_t version
, uint32_t features
);
262 void smbios_set_defaults(const char *manufacturer
, const char *product
,
263 const char *version
, bool legacy_mode
,
264 bool uuid_encoded
, SmbiosEntryPointType ep_type
);
265 uint8_t *smbios_get_table_legacy(size_t *length
);
266 void smbios_get_tables(const struct smbios_phys_mem_area
*mem_array
,
267 const unsigned int mem_array_size
,
268 uint8_t **tables
, size_t *tables_len
,
269 uint8_t **anchor
, size_t *anchor_len
);
270 #endif /* QEMU_SMBIOS_H */