1 /*
2  * smbios_types.h - data structure definitions for Xen HVM SMBIOS support
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; If not, see <http://www.gnu.org/licenses/>.
16  *
17  * Copyright (C) IBM Corporation, 2006
18  *
19  * Authors: Andrew D. Ball <aball@us.ibm.com>
20  *
21  * See the SMBIOS 2.4 spec for more detail:
22  *   http://www.dmtf.org/standards/smbios/
23  */
24 
25 #ifndef SMBIOS_TYPES_H
26 #define SMBIOS_TYPES_H
27 
28 #include <stdint.h>
29 
30 /* SMBIOS entry point -- must be written to a 16-bit aligned address
31    between 0xf0000 and 0xfffff.
32  */
33 struct smbios_entry_point {
34     char anchor_string[4];
35     uint8_t checksum;
36     uint8_t length;
37     uint8_t smbios_major_version;
38     uint8_t smbios_minor_version;
39     uint16_t max_structure_size;
40     uint8_t entry_point_revision;
41     uint8_t formatted_area[5];
42     char intermediate_anchor_string[5];
43     uint8_t intermediate_checksum;
44     uint16_t structure_table_length;
45     uint32_t structure_table_address;
46     uint16_t number_of_structures;
47     uint8_t smbios_bcd_revision;
48 } __attribute__ ((packed));
49 
50 /* This goes at the beginning of every SMBIOS structure. */
51 struct smbios_structure_header {
52     uint8_t type;
53     uint8_t length;
54     uint16_t handle;
55 } __attribute__ ((packed));
56 
57 /* SMBIOS type 0 - BIOS Information */
58 struct smbios_type_0 {
59     struct smbios_structure_header header;
60     uint8_t vendor_str;
61     uint8_t version_str;
62     uint16_t starting_address_segment;
63     uint8_t release_date_str;
64     uint8_t rom_size;
65     uint8_t characteristics[8];
66     uint8_t characteristics_extension_bytes[2];
67     uint8_t major_release;
68     uint8_t minor_release;
69     uint8_t embedded_controller_major;
70     uint8_t embedded_controller_minor;
71 } __attribute__ ((packed));
72 
73 /* SMBIOS type 1 - System Information */
74 struct smbios_type_1 {
75     struct smbios_structure_header header;
76     uint8_t manufacturer_str;
77     uint8_t product_name_str;
78     uint8_t version_str;
79     uint8_t serial_number_str;
80     uint8_t uuid[16];
81     uint8_t wake_up_type;
82     uint8_t sku_str;
83     uint8_t family_str;
84 } __attribute__ ((packed));
85 
86 /* SMBIOS type 2 - Base Board Information */
87 struct smbios_type_2 {
88     struct smbios_structure_header header;
89     uint8_t manufacturer_str;
90     uint8_t product_name_str;
91     uint8_t version_str;
92     uint8_t serial_number_str;
93     uint8_t asset_tag_str;
94     uint8_t feature_flags;
95     uint8_t location_in_chassis_str;
96     uint16_t chassis_handle;
97     uint8_t board_type;
98     uint8_t contained_handle_count;
99     uint16_t contained_handles[];
100 } __attribute__ ((packed));
101 
102 /* System Enclosure - Contained Elements */
103 struct smbios_contained_element {
104         uint8_t type;
105         uint8_t minimum;
106         uint8_t maximum;
107 } __attribute__ ((packed));
108 
109 /* SMBIOS type 3 - System Enclosure */
110 struct smbios_type_3 {
111     struct smbios_structure_header header;
112     uint8_t manufacturer_str;
113     uint8_t type;
114     uint8_t version_str;
115     uint8_t serial_number_str;
116     uint8_t asset_tag_str;
117     uint8_t boot_up_state;
118     uint8_t power_supply_state;
119     uint8_t thermal_state;
120     uint8_t security_status;
121     uint32_t oem_specific;
122     uint8_t height;
123     uint8_t number_of_power_cords;
124     uint8_t contained_element_count;
125     uint8_t contained_element_length;
126     struct smbios_contained_element contained_elements[];
127 } __attribute__ ((packed));
128 
129 /* SMBIOS type 4 - Processor Information */
130 struct smbios_type_4 {
131     struct smbios_structure_header header;
132     uint8_t socket_designation_str;
133     uint8_t processor_type;
134     uint8_t processor_family;
135     uint8_t manufacturer_str;
136     uint32_t cpuid[2];
137     uint8_t version_str;
138     uint8_t voltage;
139     uint16_t external_clock;
140     uint16_t max_speed;
141     uint16_t current_speed;
142     uint8_t status;
143     uint8_t upgrade;
144     uint16_t l1_cache_handle;
145     uint16_t l2_cache_handle;
146     uint16_t l3_cache_handle;
147     uint8_t serial_number_str;
148     uint8_t asset_tag_str;
149     uint8_t part_number_str;
150 } __attribute__ ((packed));
151 
152 /* SMBIOS type 11 - OEM Strings */
153 struct smbios_type_11 {
154     struct smbios_structure_header header;
155     uint8_t count;
156 } __attribute__ ((packed));
157 
158 /* SMBIOS type 16 - Physical Memory Array
159  *   Associated with one type 17 (Memory Device).
160  */
161 struct smbios_type_16 {
162     struct smbios_structure_header header;
163     uint8_t location;
164     uint8_t use;
165     uint8_t error_correction;
166     uint32_t maximum_capacity;
167     uint16_t memory_error_information_handle;
168     uint16_t number_of_memory_devices;
169 } __attribute__ ((packed));
170 
171 /* SMBIOS type 17 - Memory Device
172  *   Associated with one type 19
173  */
174 struct smbios_type_17 {
175     struct smbios_structure_header header;
176     uint16_t physical_memory_array_handle;
177     uint16_t memory_error_information_handle;
178     uint16_t total_width;
179     uint16_t data_width;
180     uint16_t size;
181     uint8_t form_factor;
182     uint8_t device_set;
183     uint8_t device_locator_str;
184     uint8_t bank_locator_str;
185     uint8_t memory_type;
186     uint16_t type_detail;
187     uint16_t speed;
188     uint8_t manufacturer_str;
189     uint8_t serial_number_str;
190     uint8_t asset_tag_str;
191     uint8_t part_number_str;
192 } __attribute__ ((packed));
193 
194 /* SMBIOS type 19 - Memory Array Mapped Address */
195 struct smbios_type_19 {
196     struct smbios_structure_header header;
197     uint32_t starting_address;
198     uint32_t ending_address;
199     uint16_t memory_array_handle;
200     uint8_t partition_width;
201 } __attribute__ ((packed));
202 
203 /* SMBIOS type 20 - Memory Device Mapped Address */
204 struct smbios_type_20 {
205     struct smbios_structure_header header;
206     uint32_t starting_address;
207     uint32_t ending_address;
208     uint16_t memory_device_handle;
209     uint16_t memory_array_mapped_address_handle;
210     uint8_t partition_row_position;
211     uint8_t interleave_position;
212     uint8_t interleaved_data_depth;
213 } __attribute__ ((packed));
214 
215 /* SMBIOS type 22 - Portable battery */
216 struct smbios_type_22 {
217     struct smbios_structure_header header;
218     uint8_t location_str;
219     uint8_t manufacturer_str;
220     uint8_t manufacturer_date_str;
221     uint8_t serial_number_str;
222     uint8_t device_name_str;
223     uint8_t device_chemistry;
224     uint16_t device_capacity;
225     uint16_t device_voltage;
226     uint8_t sbds_version_number;
227     uint8_t max_error;
228     uint16_t sbds_serial_number;
229     uint16_t sbds_manufacturer_date;
230     uint8_t sbds_device_chemistry;
231     uint8_t design_capacity_multiplier;
232     uint32_t oem_specific;
233 } __attribute__ ((packed));
234 
235 /* SMBIOS type 32 - System Boot Information */
236 struct smbios_type_32 {
237     struct smbios_structure_header header;
238     uint8_t reserved[6];
239     uint8_t boot_status;
240 } __attribute__ ((packed));
241 
242 /* SMBIOS type 39 - Power Supply */
243 struct smbios_type_39 {
244     struct smbios_structure_header header;
245     uint8_t power_unit_group;
246     uint8_t location_str;
247     uint8_t device_name_str;
248     uint8_t manufacturer_str;
249     uint8_t serial_number_str;
250     uint8_t asset_tag_number_str;
251     uint8_t model_part_number_str;
252     uint8_t revision_level_str;
253     uint16_t max_capacity;
254     uint16_t characteristics;
255     uint16_t input_voltage_probe_handle;
256     uint16_t cooling_device_handle;
257     uint16_t input_current_probe_handle;
258 } __attribute__ ((packed));
259 
260 /* SMBIOS type 127 -- End-of-table */
261 struct smbios_type_127 {
262     struct smbios_structure_header header;
263 } __attribute__ ((packed));
264 
265 #endif /* SMBIOS_TYPES_H */
266 
267 /*
268  * Local variables:
269  * mode: C
270  * c-file-style: "BSD"
271  * c-basic-offset: 4
272  * tab-width: 4
273  * indent-tabs-mode: nil
274  * End:
275  */
276