]>
Commit | Line | Data |
---|---|---|
b6f6e3d3 AL |
1 | #ifndef QEMU_SMBIOS_H |
2 | #define QEMU_SMBIOS_H | |
175de524 | 3 | |
b6f6e3d3 AL |
4 | /* |
5 | * SMBIOS Support | |
6 | * | |
7 | * Copyright (C) 2009 Hewlett-Packard Development Company, L.P. | |
8 | * | |
9 | * Authors: | |
10 | * Alex Williamson <alex.williamson@hp.com> | |
11 | * | |
12 | * This work is licensed under the terms of the GNU GPL, version 2. See | |
13 | * the COPYING file in the top-level directory. | |
14 | * | |
15 | */ | |
16 | ||
4f953d2f | 17 | |
2e6e8d7a GS |
18 | #define SMBIOS_MAX_TYPE 127 |
19 | ||
89cc4a27 WH |
20 | /* memory area description, used by type 19 table */ |
21 | struct smbios_phys_mem_area { | |
22 | uint64_t address; | |
23 | uint64_t length; | |
24 | }; | |
25 | ||
b6f6e3d3 AL |
26 | /* |
27 | * SMBIOS spec defined tables | |
28 | */ | |
86299120 WH |
29 | typedef enum SmbiosEntryPointType { |
30 | SMBIOS_ENTRY_POINT_21, | |
31 | SMBIOS_ENTRY_POINT_30, | |
32 | } SmbiosEntryPointType; | |
33 | ||
34 | /* SMBIOS Entry Point | |
35 | * There are two types of entry points defined in the SMBIOS specification | |
cc2324d0 | 36 | * (see below). BIOS must place the entry point(s) at a 16-byte-aligned |
86299120 WH |
37 | * address between 0xf0000 and 0xfffff. Note that either entry point type |
38 | * can be used in a 64-bit target system, except that SMBIOS 2.1 entry point | |
39 | * only allows the SMBIOS struct table to reside below 4GB address space. | |
40 | */ | |
b6f6e3d3 | 41 | |
86299120 WH |
42 | /* SMBIOS 2.1 (32-bit) Entry Point |
43 | * - introduced since SMBIOS 2.1 | |
44 | * - supports structure table below 4GB only | |
e41fca3d | 45 | */ |
86299120 | 46 | struct smbios_21_entry_point { |
e41fca3d GS |
47 | uint8_t anchor_string[4]; |
48 | uint8_t checksum; | |
49 | uint8_t length; | |
50 | uint8_t smbios_major_version; | |
51 | uint8_t smbios_minor_version; | |
52 | uint16_t max_structure_size; | |
53 | uint8_t entry_point_revision; | |
54 | uint8_t formatted_area[5]; | |
55 | uint8_t intermediate_anchor_string[5]; | |
56 | uint8_t intermediate_checksum; | |
57 | uint16_t structure_table_length; | |
58 | uint32_t structure_table_address; | |
59 | uint16_t number_of_structures; | |
60 | uint8_t smbios_bcd_revision; | |
61 | } QEMU_PACKED; | |
62 | ||
86299120 WH |
63 | /* SMBIOS 3.0 (64-bit) Entry Point |
64 | * - introduced since SMBIOS 3.0 | |
65 | * - supports structure table at 64-bit address space | |
66 | */ | |
67 | struct smbios_30_entry_point { | |
68 | uint8_t anchor_string[5]; | |
69 | uint8_t checksum; | |
70 | uint8_t length; | |
71 | uint8_t smbios_major_version; | |
72 | uint8_t smbios_minor_version; | |
73 | uint8_t smbios_doc_rev; | |
74 | uint8_t entry_point_revision; | |
75 | uint8_t reserved; | |
76 | uint32_t structure_table_max_size; | |
77 | uint64_t structure_table_address; | |
78 | } QEMU_PACKED; | |
79 | ||
80 | typedef union { | |
81 | struct smbios_21_entry_point ep21; | |
82 | struct smbios_30_entry_point ep30; | |
83 | } QEMU_PACKED SmbiosEntryPoint; | |
84 | ||
b6f6e3d3 AL |
85 | /* This goes at the beginning of every SMBIOS structure. */ |
86 | struct smbios_structure_header { | |
87 | uint8_t type; | |
88 | uint8_t length; | |
89 | uint16_t handle; | |
541dc0d4 | 90 | } QEMU_PACKED; |
b6f6e3d3 AL |
91 | |
92 | /* SMBIOS type 0 - BIOS Information */ | |
93 | struct smbios_type_0 { | |
94 | struct smbios_structure_header header; | |
95 | uint8_t vendor_str; | |
96 | uint8_t bios_version_str; | |
97 | uint16_t bios_starting_address_segment; | |
98 | uint8_t bios_release_date_str; | |
99 | uint8_t bios_rom_size; | |
84351843 | 100 | uint64_t bios_characteristics; |
b6f6e3d3 AL |
101 | uint8_t bios_characteristics_extension_bytes[2]; |
102 | uint8_t system_bios_major_release; | |
103 | uint8_t system_bios_minor_release; | |
104 | uint8_t embedded_controller_major_release; | |
105 | uint8_t embedded_controller_minor_release; | |
541dc0d4 | 106 | } QEMU_PACKED; |
b6f6e3d3 | 107 | |
caad057b EH |
108 | /* UUID encoding. The time_* fields are little-endian, as specified by SMBIOS |
109 | * version 2.6. | |
110 | */ | |
111 | struct smbios_uuid { | |
112 | uint32_t time_low; | |
113 | uint16_t time_mid; | |
114 | uint16_t time_hi_and_version; | |
115 | uint8_t clock_seq_hi_and_reserved; | |
116 | uint8_t clock_seq_low; | |
117 | uint8_t node[6]; | |
118 | } QEMU_PACKED; | |
119 | ||
b6f6e3d3 AL |
120 | /* SMBIOS type 1 - System Information */ |
121 | struct smbios_type_1 { | |
122 | struct smbios_structure_header header; | |
123 | uint8_t manufacturer_str; | |
124 | uint8_t product_name_str; | |
125 | uint8_t version_str; | |
126 | uint8_t serial_number_str; | |
caad057b | 127 | struct smbios_uuid uuid; |
b6f6e3d3 AL |
128 | uint8_t wake_up_type; |
129 | uint8_t sku_number_str; | |
130 | uint8_t family_str; | |
541dc0d4 | 131 | } QEMU_PACKED; |
b6f6e3d3 | 132 | |
e41fca3d GS |
133 | /* SMBIOS type 2 - Base Board */ |
134 | struct smbios_type_2 { | |
135 | struct smbios_structure_header header; | |
136 | uint8_t manufacturer_str; | |
137 | uint8_t product_str; | |
138 | uint8_t version_str; | |
139 | uint8_t serial_number_str; | |
140 | uint8_t asset_tag_number_str; | |
141 | uint8_t feature_flags; | |
142 | uint8_t location_str; | |
143 | uint16_t chassis_handle; | |
144 | uint8_t board_type; | |
145 | uint8_t contained_element_count; | |
146 | /* contained elements follow */ | |
147 | } QEMU_PACKED; | |
148 | ||
149 | /* SMBIOS type 3 - System Enclosure (v2.7) */ | |
b6f6e3d3 AL |
150 | struct smbios_type_3 { |
151 | struct smbios_structure_header header; | |
152 | uint8_t manufacturer_str; | |
153 | uint8_t type; | |
154 | uint8_t version_str; | |
155 | uint8_t serial_number_str; | |
156 | uint8_t asset_tag_number_str; | |
157 | uint8_t boot_up_state; | |
158 | uint8_t power_supply_state; | |
159 | uint8_t thermal_state; | |
160 | uint8_t security_status; | |
161 | uint32_t oem_defined; | |
162 | uint8_t height; | |
163 | uint8_t number_of_power_cords; | |
164 | uint8_t contained_element_count; | |
b81a5f94 | 165 | uint8_t contained_element_record_length; |
e41fca3d GS |
166 | uint8_t sku_number_str; |
167 | /* contained elements follow */ | |
541dc0d4 | 168 | } QEMU_PACKED; |
b6f6e3d3 | 169 | |
e41fca3d | 170 | /* SMBIOS type 4 - Processor Information (v2.6) */ |
b6f6e3d3 AL |
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; | |
179 | uint8_t voltage; | |
180 | uint16_t external_clock; | |
181 | uint16_t max_speed; | |
182 | uint16_t current_speed; | |
183 | uint8_t status; | |
184 | uint8_t processor_upgrade; | |
185 | uint16_t l1_cache_handle; | |
186 | uint16_t l2_cache_handle; | |
187 | uint16_t l3_cache_handle; | |
e41fca3d GS |
188 | uint8_t serial_number_str; |
189 | uint8_t asset_tag_number_str; | |
190 | uint8_t part_number_str; | |
191 | uint8_t core_count; | |
192 | uint8_t core_enabled; | |
193 | uint8_t thread_count; | |
194 | uint16_t processor_characteristics; | |
195 | uint16_t processor_family2; | |
541dc0d4 | 196 | } QEMU_PACKED; |
b6f6e3d3 | 197 | |
2d6dcbf9 DB |
198 | /* SMBIOS type 11 - OEM strings */ |
199 | struct smbios_type_11 { | |
200 | struct smbios_structure_header header; | |
201 | uint8_t count; | |
202 | } QEMU_PACKED; | |
203 | ||
e41fca3d | 204 | /* SMBIOS type 16 - Physical Memory Array (v2.7) */ |
b6f6e3d3 AL |
205 | struct smbios_type_16 { |
206 | struct smbios_structure_header header; | |
207 | uint8_t location; | |
208 | uint8_t use; | |
209 | uint8_t error_correction; | |
210 | uint32_t maximum_capacity; | |
211 | uint16_t memory_error_information_handle; | |
212 | uint16_t number_of_memory_devices; | |
e41fca3d | 213 | uint64_t extended_maximum_capacity; |
541dc0d4 | 214 | } QEMU_PACKED; |
e41fca3d GS |
215 | |
216 | /* SMBIOS type 17 - Memory Device (v2.8) */ | |
b6f6e3d3 AL |
217 | struct smbios_type_17 { |
218 | struct smbios_structure_header header; | |
219 | uint16_t physical_memory_array_handle; | |
220 | uint16_t memory_error_information_handle; | |
221 | uint16_t total_width; | |
222 | uint16_t data_width; | |
223 | uint16_t size; | |
224 | uint8_t form_factor; | |
225 | uint8_t device_set; | |
226 | uint8_t device_locator_str; | |
227 | uint8_t bank_locator_str; | |
228 | uint8_t memory_type; | |
229 | uint16_t type_detail; | |
e41fca3d GS |
230 | uint16_t speed; |
231 | uint8_t manufacturer_str; | |
232 | uint8_t serial_number_str; | |
233 | uint8_t asset_tag_number_str; | |
234 | uint8_t part_number_str; | |
235 | uint8_t attributes; | |
236 | uint32_t extended_size; | |
0d73394a GS |
237 | uint16_t configured_clock_speed; |
238 | uint16_t minimum_voltage; | |
239 | uint16_t maximum_voltage; | |
240 | uint16_t configured_voltage; | |
541dc0d4 | 241 | } QEMU_PACKED; |
b6f6e3d3 | 242 | |
e41fca3d | 243 | /* SMBIOS type 19 - Memory Array Mapped Address (v2.7) */ |
b6f6e3d3 AL |
244 | struct smbios_type_19 { |
245 | struct smbios_structure_header header; | |
246 | uint32_t starting_address; | |
247 | uint32_t ending_address; | |
248 | uint16_t memory_array_handle; | |
249 | uint8_t partition_width; | |
e41fca3d GS |
250 | uint64_t extended_starting_address; |
251 | uint64_t extended_ending_address; | |
541dc0d4 | 252 | } QEMU_PACKED; |
b6f6e3d3 AL |
253 | |
254 | /* SMBIOS type 32 - System Boot Information */ | |
255 | struct smbios_type_32 { | |
256 | struct smbios_structure_header header; | |
257 | uint8_t reserved[6]; | |
258 | uint8_t boot_status; | |
541dc0d4 | 259 | } QEMU_PACKED; |
b6f6e3d3 AL |
260 | |
261 | /* SMBIOS type 127 -- End-of-table */ | |
262 | struct smbios_type_127 { | |
263 | struct smbios_structure_header header; | |
541dc0d4 | 264 | } QEMU_PACKED; |
b6f6e3d3 | 265 | |
1007a37e | 266 | void smbios_entry_add(QemuOpts *opts, Error **errp); |
86299120 WH |
267 | void smbios_set_cpuid(uint32_t version, uint32_t features); |
268 | void smbios_set_defaults(const char *manufacturer, const char *product, | |
269 | const char *version, bool legacy_mode, | |
270 | bool uuid_encoded, SmbiosEntryPointType ep_type); | |
a0628599 LX |
271 | uint8_t *smbios_get_table_legacy(MachineState *ms, size_t *length); |
272 | void smbios_get_tables(MachineState *ms, | |
273 | const struct smbios_phys_mem_area *mem_array, | |
86299120 WH |
274 | const unsigned int mem_array_size, |
275 | uint8_t **tables, size_t *tables_len, | |
276 | uint8_t **anchor, size_t *anchor_len); | |
175de524 | 277 | #endif /* QEMU_SMBIOS_H */ |