4 #include "qapi/qapi-types-machine.h"
5 #include "qemu/bitmap.h"
10 * Copyright (C) 2009 Hewlett-Packard Development Company, L.P.
13 * Alex Williamson <alex.williamson@hp.com>
15 * This work is licensed under the terms of the GNU GPL, version 2. See
16 * the COPYING file in the top-level directory.
20 extern uint8_t *usr_blobs
;
21 extern GArray
*usr_blobs_sizes
;
24 const char *vendor
, *version
, *date
;
25 bool have_major_minor
, uefi
;
28 extern smbios_type0_t smbios_type0
;
31 const char *manufacturer
, *product
, *version
, *serial
, *sku
, *family
;
32 /* uuid is in qemu_uuid */
34 extern smbios_type1_t smbios_type1
;
36 #define SMBIOS_MAX_TYPE 127
37 extern DECLARE_BITMAP(smbios_have_binfile_bitmap
, SMBIOS_MAX_TYPE
+ 1);
38 extern DECLARE_BITMAP(smbios_have_fields_bitmap
, SMBIOS_MAX_TYPE
+ 1);
40 #define offsetofend(TYPE, MEMBER) \
41 (offsetof(TYPE, MEMBER) + sizeof_field(TYPE, MEMBER))
43 /* memory area description, used by type 19 table */
44 struct smbios_phys_mem_area
{
50 * There are two types of entry points defined in the SMBIOS specification
51 * (see below). BIOS must place the entry point(s) at a 16-byte-aligned
52 * address between 0xf0000 and 0xfffff. Note that either entry point type
53 * can be used in a 64-bit target system, except that SMBIOS 2.1 entry point
54 * only allows the SMBIOS struct table to reside below 4GB address space.
57 /* SMBIOS 2.1 (32-bit) Entry Point
58 * - introduced since SMBIOS 2.1
59 * - supports structure table below 4GB only
61 struct smbios_21_entry_point
{
62 uint8_t anchor_string
[4];
65 uint8_t smbios_major_version
;
66 uint8_t smbios_minor_version
;
67 uint16_t max_structure_size
;
68 uint8_t entry_point_revision
;
69 uint8_t formatted_area
[5];
70 uint8_t intermediate_anchor_string
[5];
71 uint8_t intermediate_checksum
;
72 uint16_t structure_table_length
;
73 uint32_t structure_table_address
;
74 uint16_t number_of_structures
;
75 uint8_t smbios_bcd_revision
;
78 /* SMBIOS 3.0 (64-bit) Entry Point
79 * - introduced since SMBIOS 3.0
80 * - supports structure table at 64-bit address space
82 struct smbios_30_entry_point
{
83 uint8_t anchor_string
[5];
86 uint8_t smbios_major_version
;
87 uint8_t smbios_minor_version
;
88 uint8_t smbios_doc_rev
;
89 uint8_t entry_point_revision
;
91 uint32_t structure_table_max_size
;
92 uint64_t structure_table_address
;
96 struct smbios_21_entry_point ep21
;
97 struct smbios_30_entry_point ep30
;
98 } QEMU_PACKED SmbiosEntryPoint
;
100 /* This goes at the beginning of every SMBIOS structure. */
101 struct smbios_structure_header
{
107 /* SMBIOS type 0 - BIOS Information */
108 struct smbios_type_0
{
109 struct smbios_structure_header header
;
111 uint8_t bios_version_str
;
112 uint16_t bios_starting_address_segment
;
113 uint8_t bios_release_date_str
;
114 uint8_t bios_rom_size
;
115 uint64_t bios_characteristics
;
116 uint8_t bios_characteristics_extension_bytes
[2];
117 uint8_t system_bios_major_release
;
118 uint8_t system_bios_minor_release
;
119 uint8_t embedded_controller_major_release
;
120 uint8_t embedded_controller_minor_release
;
123 /* UUID encoding. The time_* fields are little-endian, as specified by SMBIOS
129 uint16_t time_hi_and_version
;
130 uint8_t clock_seq_hi_and_reserved
;
131 uint8_t clock_seq_low
;
135 /* SMBIOS type 1 - System Information */
136 struct smbios_type_1
{
137 struct smbios_structure_header header
;
138 uint8_t manufacturer_str
;
139 uint8_t product_name_str
;
141 uint8_t serial_number_str
;
142 struct smbios_uuid uuid
;
143 uint8_t wake_up_type
;
144 uint8_t sku_number_str
;
148 /* SMBIOS type 2 - Base Board */
149 struct smbios_type_2
{
150 struct smbios_structure_header header
;
151 uint8_t manufacturer_str
;
154 uint8_t serial_number_str
;
155 uint8_t asset_tag_number_str
;
156 uint8_t feature_flags
;
157 uint8_t location_str
;
158 uint16_t chassis_handle
;
160 uint8_t contained_element_count
;
161 /* contained elements follow */
164 /* SMBIOS type 3 - System Enclosure (v2.7) */
165 struct smbios_type_3
{
166 struct smbios_structure_header header
;
167 uint8_t manufacturer_str
;
170 uint8_t serial_number_str
;
171 uint8_t asset_tag_number_str
;
172 uint8_t boot_up_state
;
173 uint8_t power_supply_state
;
174 uint8_t thermal_state
;
175 uint8_t security_status
;
176 uint32_t oem_defined
;
178 uint8_t number_of_power_cords
;
179 uint8_t contained_element_count
;
180 uint8_t contained_element_record_length
;
181 uint8_t sku_number_str
;
182 /* contained elements follow */
185 /* SMBIOS type 4 - Processor Information (v2.6) */
186 struct smbios_type_4
{
187 struct smbios_structure_header header
;
188 uint8_t socket_designation_str
;
189 uint8_t processor_type
;
190 uint8_t processor_family
;
191 uint8_t processor_manufacturer_str
;
192 uint32_t processor_id
[2];
193 uint8_t processor_version_str
;
195 uint16_t external_clock
;
197 uint16_t current_speed
;
199 uint8_t processor_upgrade
;
200 uint16_t l1_cache_handle
;
201 uint16_t l2_cache_handle
;
202 uint16_t l3_cache_handle
;
203 uint8_t serial_number_str
;
204 uint8_t asset_tag_number_str
;
205 uint8_t part_number_str
;
207 uint8_t core_enabled
;
208 uint8_t thread_count
;
209 uint16_t processor_characteristics
;
210 uint16_t processor_family2
;
211 /* SMBIOS spec 3.0.0, Table 21 */
212 uint16_t core_count2
;
213 uint16_t core_enabled2
;
214 uint16_t thread_count2
;
217 typedef enum smbios_type_4_len_ver
{
218 SMBIOS_TYPE_4_LEN_V28
= offsetofend(struct smbios_type_4
,
220 SMBIOS_TYPE_4_LEN_V30
= offsetofend(struct smbios_type_4
, thread_count2
),
221 } smbios_type_4_len_ver
;
223 /* SMBIOS type 8 - Port Connector Information */
224 struct smbios_type_8
{
225 struct smbios_structure_header header
;
226 uint8_t internal_reference_str
;
227 uint8_t internal_connector_type
;
228 uint8_t external_reference_str
;
229 uint8_t external_connector_type
;
233 /* SMBIOS type 9 - System Slots (v2.1+) */
234 struct smbios_type_9
{
235 struct smbios_structure_header header
;
236 uint8_t slot_designation
;
238 uint8_t slot_data_bus_width
;
239 uint8_t current_usage
;
242 uint8_t slot_characteristics1
;
243 uint8_t slot_characteristics2
;
244 /* SMBIOS spec v2.6+ */
245 uint16_t segment_group_number
;
247 uint8_t device_number
;
250 /* SMBIOS type 11 - OEM strings */
251 struct smbios_type_11
{
252 struct smbios_structure_header header
;
256 /* SMBIOS type 16 - Physical Memory Array (v2.7) */
257 struct smbios_type_16
{
258 struct smbios_structure_header header
;
261 uint8_t error_correction
;
262 uint32_t maximum_capacity
;
263 uint16_t memory_error_information_handle
;
264 uint16_t number_of_memory_devices
;
265 uint64_t extended_maximum_capacity
;
268 /* SMBIOS type 17 - Memory Device (v2.8) */
269 struct smbios_type_17
{
270 struct smbios_structure_header header
;
271 uint16_t physical_memory_array_handle
;
272 uint16_t memory_error_information_handle
;
273 uint16_t total_width
;
278 uint8_t device_locator_str
;
279 uint8_t bank_locator_str
;
281 uint16_t type_detail
;
283 uint8_t manufacturer_str
;
284 uint8_t serial_number_str
;
285 uint8_t asset_tag_number_str
;
286 uint8_t part_number_str
;
288 uint32_t extended_size
;
289 uint16_t configured_clock_speed
;
290 uint16_t minimum_voltage
;
291 uint16_t maximum_voltage
;
292 uint16_t configured_voltage
;
295 /* SMBIOS type 19 - Memory Array Mapped Address (v2.7) */
296 struct smbios_type_19
{
297 struct smbios_structure_header header
;
298 uint32_t starting_address
;
299 uint32_t ending_address
;
300 uint16_t memory_array_handle
;
301 uint8_t partition_width
;
302 uint64_t extended_starting_address
;
303 uint64_t extended_ending_address
;
306 /* SMBIOS type 32 - System Boot Information */
307 struct smbios_type_32
{
308 struct smbios_structure_header header
;
313 /* SMBIOS type 41 - Onboard Devices Extended Information */
314 struct smbios_type_41
{
315 struct smbios_structure_header header
;
316 uint8_t reference_designation_str
;
318 uint8_t device_type_instance
;
319 uint16_t segment_group_number
;
321 uint8_t device_number
;
324 /* SMBIOS type 127 -- End-of-table */
325 struct smbios_type_127
{
326 struct smbios_structure_header header
;
329 bool smbios_validate_table(SmbiosEntryPointType ep_type
, Error
**errp
);
330 void smbios_add_usr_blob_size(size_t size
);
331 void smbios_entry_add(QemuOpts
*opts
, Error
**errp
);
332 void smbios_set_cpuid(uint32_t version
, uint32_t features
);
333 void smbios_set_defaults(const char *manufacturer
, const char *product
,
334 const char *version
);
335 void smbios_set_default_processor_family(uint16_t processor_family
);
336 uint8_t *smbios_get_table_legacy(size_t *length
, Error
**errp
);
337 void smbios_get_tables(MachineState
*ms
,
338 SmbiosEntryPointType ep_type
,
339 const struct smbios_phys_mem_area
*mem_array
,
340 const unsigned int mem_array_size
,
341 uint8_t **tables
, size_t *tables_len
,
342 uint8_t **anchor
, size_t *anchor_len
,
344 #endif /* QEMU_SMBIOS_H */