4 #include "qapi/qapi-types-machine.h"
9 * Copyright (C) 2009 Hewlett-Packard Development Company, L.P.
14 * This work is licensed under the terms of the GNU GPL, version 2. See
15 * the COPYING file in the top-level directory.
20 #define SMBIOS_MAX_TYPE 127
21 #define offsetofend(TYPE, MEMBER) \
22 (offsetof(TYPE, MEMBER) + sizeof_field(TYPE, MEMBER))
24 /* memory area description, used by type 19 table */
25 struct smbios_phys_mem_area {
31 * There are two types of entry points defined in the SMBIOS specification
32 * (see below). BIOS must place the entry point(s) at a 16-byte-aligned
33 * address between 0xf0000 and 0xfffff. Note that either entry point type
34 * can be used in a 64-bit target system, except that SMBIOS 2.1 entry point
35 * only allows the SMBIOS struct table to reside below 4GB address space.
38 /* SMBIOS 2.1 (32-bit) Entry Point
39 * - introduced since SMBIOS 2.1
40 * - supports structure table below 4GB only
42 struct smbios_21_entry_point {
43 uint8_t anchor_string[4];
46 uint8_t smbios_major_version;
47 uint8_t smbios_minor_version;
48 uint16_t max_structure_size;
49 uint8_t entry_point_revision;
50 uint8_t formatted_area[5];
51 uint8_t intermediate_anchor_string[5];
52 uint8_t intermediate_checksum;
53 uint16_t structure_table_length;
54 uint32_t structure_table_address;
55 uint16_t number_of_structures;
56 uint8_t smbios_bcd_revision;
59 /* SMBIOS 3.0 (64-bit) Entry Point
60 * - introduced since SMBIOS 3.0
61 * - supports structure table at 64-bit address space
63 struct smbios_30_entry_point {
64 uint8_t anchor_string[5];
67 uint8_t smbios_major_version;
68 uint8_t smbios_minor_version;
69 uint8_t smbios_doc_rev;
70 uint8_t entry_point_revision;
72 uint32_t structure_table_max_size;
73 uint64_t structure_table_address;
77 struct smbios_21_entry_point ep21;
78 struct smbios_30_entry_point ep30;
79 } QEMU_PACKED SmbiosEntryPoint;
81 /* This goes at the beginning of every SMBIOS structure. */
82 struct smbios_structure_header {
88 /* SMBIOS type 0 - BIOS Information */
89 struct smbios_type_0 {
90 struct smbios_structure_header header;
92 uint8_t bios_version_str;
93 uint16_t bios_starting_address_segment;
94 uint8_t bios_release_date_str;
95 uint8_t bios_rom_size;
96 uint64_t bios_characteristics;
97 uint8_t bios_characteristics_extension_bytes[2];
98 uint8_t system_bios_major_release;
99 uint8_t system_bios_minor_release;
100 uint8_t embedded_controller_major_release;
101 uint8_t embedded_controller_minor_release;
104 /* UUID encoding. The time_* fields are little-endian, as specified by SMBIOS
110 uint16_t time_hi_and_version;
111 uint8_t clock_seq_hi_and_reserved;
112 uint8_t clock_seq_low;
116 /* SMBIOS type 1 - System Information */
117 struct smbios_type_1 {
118 struct smbios_structure_header header;
119 uint8_t manufacturer_str;
120 uint8_t product_name_str;
122 uint8_t serial_number_str;
123 struct smbios_uuid uuid;
124 uint8_t wake_up_type;
125 uint8_t sku_number_str;
129 /* SMBIOS type 2 - Base Board */
130 struct smbios_type_2 {
131 struct smbios_structure_header header;
132 uint8_t manufacturer_str;
135 uint8_t serial_number_str;
136 uint8_t asset_tag_number_str;
137 uint8_t feature_flags;
138 uint8_t location_str;
139 uint16_t chassis_handle;
141 uint8_t contained_element_count;
142 /* contained elements follow */
145 /* SMBIOS type 3 - System Enclosure (v2.7) */
146 struct smbios_type_3 {
147 struct smbios_structure_header header;
148 uint8_t manufacturer_str;
151 uint8_t serial_number_str;
152 uint8_t asset_tag_number_str;
153 uint8_t boot_up_state;
154 uint8_t power_supply_state;
155 uint8_t thermal_state;
156 uint8_t security_status;
157 uint32_t oem_defined;
159 uint8_t number_of_power_cords;
160 uint8_t contained_element_count;
161 uint8_t contained_element_record_length;
162 uint8_t sku_number_str;
163 /* contained elements follow */
166 /* SMBIOS type 4 - Processor Information (v2.6) */
167 struct smbios_type_4 {
168 struct smbios_structure_header header;
169 uint8_t socket_designation_str;
170 uint8_t processor_type;
171 uint8_t processor_family;
172 uint8_t processor_manufacturer_str;
173 uint32_t processor_id[2];
174 uint8_t processor_version_str;
176 uint16_t external_clock;
178 uint16_t current_speed;
180 uint8_t processor_upgrade;
181 uint16_t l1_cache_handle;
182 uint16_t l2_cache_handle;
183 uint16_t l3_cache_handle;
184 uint8_t serial_number_str;
185 uint8_t asset_tag_number_str;
186 uint8_t part_number_str;
188 uint8_t core_enabled;
189 uint8_t thread_count;
190 uint16_t processor_characteristics;
191 uint16_t processor_family2;
192 /* SMBIOS spec 3.0.0, Table 21 */
193 uint16_t core_count2;
194 uint16_t core_enabled2;
195 uint16_t thread_count2;
198 typedef enum smbios_type_4_len_ver {
199 SMBIOS_TYPE_4_LEN_V28 = offsetofend(struct smbios_type_4,
201 SMBIOS_TYPE_4_LEN_V30 = offsetofend(struct smbios_type_4, thread_count2),
202 } smbios_type_4_len_ver;
204 /* SMBIOS type 8 - Port Connector Information */
205 struct smbios_type_8 {
206 struct smbios_structure_header header;
207 uint8_t internal_reference_str;
208 uint8_t internal_connector_type;
209 uint8_t external_reference_str;
210 uint8_t external_connector_type;
214 /* SMBIOS type 11 - OEM strings */
215 struct smbios_type_11 {
216 struct smbios_structure_header header;
220 /* SMBIOS type 16 - Physical Memory Array (v2.7) */
221 struct smbios_type_16 {
222 struct smbios_structure_header header;
225 uint8_t error_correction;
226 uint32_t maximum_capacity;
227 uint16_t memory_error_information_handle;
228 uint16_t number_of_memory_devices;
229 uint64_t extended_maximum_capacity;
232 /* SMBIOS type 17 - Memory Device (v2.8) */
233 struct smbios_type_17 {
234 struct smbios_structure_header header;
235 uint16_t physical_memory_array_handle;
236 uint16_t memory_error_information_handle;
237 uint16_t total_width;
242 uint8_t device_locator_str;
243 uint8_t bank_locator_str;
245 uint16_t type_detail;
247 uint8_t manufacturer_str;
248 uint8_t serial_number_str;
249 uint8_t asset_tag_number_str;
250 uint8_t part_number_str;
252 uint32_t extended_size;
253 uint16_t configured_clock_speed;
254 uint16_t minimum_voltage;
255 uint16_t maximum_voltage;
256 uint16_t configured_voltage;
259 /* SMBIOS type 19 - Memory Array Mapped Address (v2.7) */
260 struct smbios_type_19 {
261 struct smbios_structure_header header;
262 uint32_t starting_address;
263 uint32_t ending_address;
264 uint16_t memory_array_handle;
265 uint8_t partition_width;
266 uint64_t extended_starting_address;
267 uint64_t extended_ending_address;
270 /* SMBIOS type 32 - System Boot Information */
271 struct smbios_type_32 {
272 struct smbios_structure_header header;
277 /* SMBIOS type 41 - Onboard Devices Extended Information */
278 struct smbios_type_41 {
279 struct smbios_structure_header header;
280 uint8_t reference_designation_str;
282 uint8_t device_type_instance;
283 uint16_t segment_group_number;
285 uint8_t device_number;
288 /* SMBIOS type 127 -- End-of-table */
289 struct smbios_type_127 {
290 struct smbios_structure_header header;
293 void smbios_entry_add(QemuOpts *opts, Error **errp);
294 void smbios_set_cpuid(uint32_t version, uint32_t features);
295 void smbios_set_defaults(const char *manufacturer, const char *product,
296 const char *version, bool legacy_mode,
297 bool uuid_encoded, SmbiosEntryPointType ep_type);
298 uint8_t *smbios_get_table_legacy(MachineState *ms, size_t *length);
299 void smbios_get_tables(MachineState *ms,
300 const struct smbios_phys_mem_area *mem_array,
301 const unsigned int mem_array_size,
302 uint8_t **tables, size_t *tables_len,
303 uint8_t **anchor, size_t *anchor_len,
305 #endif /* QEMU_SMBIOS_H */