sync with latest
[sdk/emulator/qemu.git] / hw / 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 int smbios_entry_add(const char *t);
17 void smbios_add_field(int type, int offset, int len, void *data);
18 uint8_t *smbios_get_table(size_t *length);
19
20 /*
21  * SMBIOS spec defined tables
22  */
23
24 /* This goes at the beginning of every SMBIOS structure. */
25 struct smbios_structure_header {
26     uint8_t type;
27     uint8_t length;
28     uint16_t handle;
29 } QEMU_PACKED;
30
31 /* SMBIOS type 0 - BIOS Information */
32 struct smbios_type_0 {
33     struct smbios_structure_header header;
34     uint8_t vendor_str;
35     uint8_t bios_version_str;
36     uint16_t bios_starting_address_segment;
37     uint8_t bios_release_date_str;
38     uint8_t bios_rom_size;
39     uint8_t bios_characteristics[8];
40     uint8_t bios_characteristics_extension_bytes[2];
41     uint8_t system_bios_major_release;
42     uint8_t system_bios_minor_release;
43     uint8_t embedded_controller_major_release;
44     uint8_t embedded_controller_minor_release;
45 } QEMU_PACKED;
46
47 /* SMBIOS type 1 - System Information */
48 struct smbios_type_1 {
49     struct smbios_structure_header header;
50     uint8_t manufacturer_str;
51     uint8_t product_name_str;
52     uint8_t version_str;
53     uint8_t serial_number_str;
54     uint8_t uuid[16];
55     uint8_t wake_up_type;
56     uint8_t sku_number_str;
57     uint8_t family_str;
58 } QEMU_PACKED;
59
60 /* SMBIOS type 3 - System Enclosure (v2.3) */
61 struct smbios_type_3 {
62     struct smbios_structure_header header;
63     uint8_t manufacturer_str;
64     uint8_t type;
65     uint8_t version_str;
66     uint8_t serial_number_str;
67     uint8_t asset_tag_number_str;
68     uint8_t boot_up_state;
69     uint8_t power_supply_state;
70     uint8_t thermal_state;
71     uint8_t security_status;
72     uint32_t oem_defined;
73     uint8_t height;
74     uint8_t number_of_power_cords;
75     uint8_t contained_element_count;
76     // contained elements follow
77 } QEMU_PACKED;
78
79 /* SMBIOS type 4 - Processor Information (v2.0) */
80 struct smbios_type_4 {
81     struct smbios_structure_header header;
82     uint8_t socket_designation_str;
83     uint8_t processor_type;
84     uint8_t processor_family;
85     uint8_t processor_manufacturer_str;
86     uint32_t processor_id[2];
87     uint8_t processor_version_str;
88     uint8_t voltage;
89     uint16_t external_clock;
90     uint16_t max_speed;
91     uint16_t current_speed;
92     uint8_t status;
93     uint8_t processor_upgrade;
94     uint16_t l1_cache_handle;
95     uint16_t l2_cache_handle;
96     uint16_t l3_cache_handle;
97 } QEMU_PACKED;
98
99 /* SMBIOS type 16 - Physical Memory Array
100  *   Associated with one type 17 (Memory Device).
101  */
102 struct smbios_type_16 {
103     struct smbios_structure_header header;
104     uint8_t location;
105     uint8_t use;
106     uint8_t error_correction;
107     uint32_t maximum_capacity;
108     uint16_t memory_error_information_handle;
109     uint16_t number_of_memory_devices;
110 } QEMU_PACKED;
111 /* SMBIOS type 17 - Memory Device
112  *   Associated with one type 19
113  */
114 struct smbios_type_17 {
115     struct smbios_structure_header header;
116     uint16_t physical_memory_array_handle;
117     uint16_t memory_error_information_handle;
118     uint16_t total_width;
119     uint16_t data_width;
120     uint16_t size;
121     uint8_t form_factor;
122     uint8_t device_set;
123     uint8_t device_locator_str;
124     uint8_t bank_locator_str;
125     uint8_t memory_type;
126     uint16_t type_detail;
127 } QEMU_PACKED;
128
129 /* SMBIOS type 19 - Memory Array Mapped Address */
130 struct smbios_type_19 {
131     struct smbios_structure_header header;
132     uint32_t starting_address;
133     uint32_t ending_address;
134     uint16_t memory_array_handle;
135     uint8_t partition_width;
136 } QEMU_PACKED;
137
138 /* SMBIOS type 20 - Memory Device Mapped Address */
139 struct smbios_type_20 {
140     struct smbios_structure_header header;
141     uint32_t starting_address;
142     uint32_t ending_address;
143     uint16_t memory_device_handle;
144     uint16_t memory_array_mapped_address_handle;
145     uint8_t partition_row_position;
146     uint8_t interleave_position;
147     uint8_t interleaved_data_depth;
148 } QEMU_PACKED;
149
150 /* SMBIOS type 32 - System Boot Information */
151 struct smbios_type_32 {
152     struct smbios_structure_header header;
153     uint8_t reserved[6];
154     uint8_t boot_status;
155 } QEMU_PACKED;
156
157 /* SMBIOS type 127 -- End-of-table */
158 struct smbios_type_127 {
159     struct smbios_structure_header header;
160 } QEMU_PACKED;
161
162 #endif /*QEMU_SMBIOS_H */