Add qemu 2.4.0
[kvmfornfv.git] / qemu / include / hw / i386 / smbios.h
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
16 #include "qemu/option.h"
17
18 #define SMBIOS_MAX_TYPE 127
19
20 void smbios_entry_add(QemuOpts *opts);
21 void smbios_set_cpuid(uint32_t version, uint32_t features);
22 void smbios_set_defaults(const char *manufacturer, const char *product,
23                          const char *version, bool legacy_mode,
24                          bool uuid_encoded);
25 uint8_t *smbios_get_table_legacy(size_t *length);
26 void smbios_get_tables(uint8_t **tables, size_t *tables_len,
27                        uint8_t **anchor, size_t *anchor_len);
28
29 /*
30  * SMBIOS spec defined tables
31  */
32
33 /* SMBIOS entry point (anchor).
34  * BIOS must place this at a 16-bit-aligned address between 0xf0000 and 0xfffff.
35  */
36 struct smbios_entry_point {
37     uint8_t anchor_string[4];
38     uint8_t checksum;
39     uint8_t length;
40     uint8_t smbios_major_version;
41     uint8_t smbios_minor_version;
42     uint16_t max_structure_size;
43     uint8_t entry_point_revision;
44     uint8_t formatted_area[5];
45     uint8_t intermediate_anchor_string[5];
46     uint8_t intermediate_checksum;
47     uint16_t structure_table_length;
48     uint32_t structure_table_address;
49     uint16_t number_of_structures;
50     uint8_t smbios_bcd_revision;
51 } QEMU_PACKED;
52
53 /* This goes at the beginning of every SMBIOS structure. */
54 struct smbios_structure_header {
55     uint8_t type;
56     uint8_t length;
57     uint16_t handle;
58 } QEMU_PACKED;
59
60 /* SMBIOS type 0 - BIOS Information */
61 struct smbios_type_0 {
62     struct smbios_structure_header header;
63     uint8_t vendor_str;
64     uint8_t bios_version_str;
65     uint16_t bios_starting_address_segment;
66     uint8_t bios_release_date_str;
67     uint8_t bios_rom_size;
68     uint64_t bios_characteristics;
69     uint8_t bios_characteristics_extension_bytes[2];
70     uint8_t system_bios_major_release;
71     uint8_t system_bios_minor_release;
72     uint8_t embedded_controller_major_release;
73     uint8_t embedded_controller_minor_release;
74 } QEMU_PACKED;
75
76 /* UUID encoding. The time_* fields are little-endian, as specified by SMBIOS
77  * version 2.6.
78  */
79 struct smbios_uuid {
80     uint32_t time_low;
81     uint16_t time_mid;
82     uint16_t time_hi_and_version;
83     uint8_t clock_seq_hi_and_reserved;
84     uint8_t clock_seq_low;
85     uint8_t node[6];
86 } QEMU_PACKED;
87
88 /* SMBIOS type 1 - System Information */
89 struct smbios_type_1 {
90     struct smbios_structure_header header;
91     uint8_t manufacturer_str;
92     uint8_t product_name_str;
93     uint8_t version_str;
94     uint8_t serial_number_str;
95     struct smbios_uuid uuid;
96     uint8_t wake_up_type;
97     uint8_t sku_number_str;
98     uint8_t family_str;
99 } QEMU_PACKED;
100
101 /* SMBIOS type 2 - Base Board */
102 struct smbios_type_2 {
103     struct smbios_structure_header header;
104     uint8_t manufacturer_str;
105     uint8_t product_str;
106     uint8_t version_str;
107     uint8_t serial_number_str;
108     uint8_t asset_tag_number_str;
109     uint8_t feature_flags;
110     uint8_t location_str;
111     uint16_t chassis_handle;
112     uint8_t board_type;
113     uint8_t contained_element_count;
114     /* contained elements follow */
115 } QEMU_PACKED;
116
117 /* SMBIOS type 3 - System Enclosure (v2.7) */
118 struct smbios_type_3 {
119     struct smbios_structure_header header;
120     uint8_t manufacturer_str;
121     uint8_t type;
122     uint8_t version_str;
123     uint8_t serial_number_str;
124     uint8_t asset_tag_number_str;
125     uint8_t boot_up_state;
126     uint8_t power_supply_state;
127     uint8_t thermal_state;
128     uint8_t security_status;
129     uint32_t oem_defined;
130     uint8_t height;
131     uint8_t number_of_power_cords;
132     uint8_t contained_element_count;
133     uint8_t sku_number_str;
134     /* contained elements follow */
135 } QEMU_PACKED;
136
137 /* SMBIOS type 4 - Processor Information (v2.6) */
138 struct smbios_type_4 {
139     struct smbios_structure_header header;
140     uint8_t socket_designation_str;
141     uint8_t processor_type;
142     uint8_t processor_family;
143     uint8_t processor_manufacturer_str;
144     uint32_t processor_id[2];
145     uint8_t processor_version_str;
146     uint8_t voltage;
147     uint16_t external_clock;
148     uint16_t max_speed;
149     uint16_t current_speed;
150     uint8_t status;
151     uint8_t processor_upgrade;
152     uint16_t l1_cache_handle;
153     uint16_t l2_cache_handle;
154     uint16_t l3_cache_handle;
155     uint8_t serial_number_str;
156     uint8_t asset_tag_number_str;
157     uint8_t part_number_str;
158     uint8_t core_count;
159     uint8_t core_enabled;
160     uint8_t thread_count;
161     uint16_t processor_characteristics;
162     uint16_t processor_family2;
163 } QEMU_PACKED;
164
165 /* SMBIOS type 16 - Physical Memory Array (v2.7) */
166 struct smbios_type_16 {
167     struct smbios_structure_header header;
168     uint8_t location;
169     uint8_t use;
170     uint8_t error_correction;
171     uint32_t maximum_capacity;
172     uint16_t memory_error_information_handle;
173     uint16_t number_of_memory_devices;
174     uint64_t extended_maximum_capacity;
175 } QEMU_PACKED;
176
177 /* SMBIOS type 17 - Memory Device (v2.8) */
178 struct smbios_type_17 {
179     struct smbios_structure_header header;
180     uint16_t physical_memory_array_handle;
181     uint16_t memory_error_information_handle;
182     uint16_t total_width;
183     uint16_t data_width;
184     uint16_t size;
185     uint8_t form_factor;
186     uint8_t device_set;
187     uint8_t device_locator_str;
188     uint8_t bank_locator_str;
189     uint8_t memory_type;
190     uint16_t type_detail;
191     uint16_t speed;
192     uint8_t manufacturer_str;
193     uint8_t serial_number_str;
194     uint8_t asset_tag_number_str;
195     uint8_t part_number_str;
196     uint8_t attributes;
197     uint32_t extended_size;
198     uint16_t configured_clock_speed;
199     uint16_t minimum_voltage;
200     uint16_t maximum_voltage;
201     uint16_t configured_voltage;
202 } QEMU_PACKED;
203
204 /* SMBIOS type 19 - Memory Array Mapped Address (v2.7) */
205 struct smbios_type_19 {
206     struct smbios_structure_header header;
207     uint32_t starting_address;
208     uint32_t ending_address;
209     uint16_t memory_array_handle;
210     uint8_t partition_width;
211     uint64_t extended_starting_address;
212     uint64_t extended_ending_address;
213 } QEMU_PACKED;
214
215 /* SMBIOS type 32 - System Boot Information */
216 struct smbios_type_32 {
217     struct smbios_structure_header header;
218     uint8_t reserved[6];
219     uint8_t boot_status;
220 } QEMU_PACKED;
221
222 /* SMBIOS type 127 -- End-of-table */
223 struct smbios_type_127 {
224     struct smbios_structure_header header;
225 } QEMU_PACKED;
226
227 #endif /*QEMU_SMBIOS_H */