blob: 0ab074df0740a0cfb99a29b053c1eddb094fddd0 [file] [log] [blame]
Sven Schnelle164bcfd2011-08-14 20:56:34 +02001#ifndef SMBIOS_H
2#define SMBIOS_H
3
4#include <types.h>
5
Peter Stugec392b642013-07-06 19:51:12 +02006int smbios_write_type11(unsigned long *current, int handle, const char **oem_strings, int count);
Sven Schnelle164bcfd2011-08-14 20:56:34 +02007unsigned long smbios_write_tables(unsigned long start);
8int smbios_add_string(char *start, const char *str);
9int smbios_string_table_len(char *start);
10
Duncan Laurie21a78702013-05-23 14:17:05 -070011/* Used by mainboard to add an on-board device */
12int smbios_write_type41(unsigned long *current, int *handle,
13 const char *name, u8 instance, u16 segment,
14 u8 bus, u8 device, u8 function);
15
Gerd Hoffmann06262742013-11-13 13:37:23 +010016const char *smbios_mainboard_manufacturer(void);
17const char *smbios_mainboard_product_name(void);
Duncan Laurie21a78702013-05-23 14:17:05 -070018
Christian Gmeinerac3aa092012-07-25 13:42:40 +020019const char *smbios_mainboard_serial_number(void);
20const char *smbios_mainboard_version(void);
Gerd Hoffmann06262742013-11-13 13:37:23 +010021void smbios_mainboard_set_uuid(u8 *uuid);
Christian Gmeinerac3aa092012-07-25 13:42:40 +020022
Sven Schnelle164bcfd2011-08-14 20:56:34 +020023#define BIOS_CHARACTERISTICS_PCI_SUPPORTED (1 << 7)
24#define BIOS_CHARACTERISTICS_PC_CARD (1 << 8)
25#define BIOS_CHARACTERISTICS_PNP (1 << 9)
26#define BIOS_CHARACTERISTICS_APM (1 << 10)
27#define BIOS_CHARACTERISTICS_UPGRADEABLE (1 << 11)
28#define BIOS_CHARACTERISTICS_SHADOW (1 << 12)
29#define BIOS_CHARACTERISTICS_BOOT_FROM_CD (1 << 15)
30#define BIOS_CHARACTERISTICS_SELECTABLE_BOOT (1 << 16)
31#define BIOS_CHARACTERISTICS_BIOS_SOCKETED (1 << 17)
32
33#define BIOS_EXT1_CHARACTERISTICS_ACPI (1 << 0)
34#define BIOS_EXT2_CHARACTERISTICS_TARGET (1 << 2)
35
36#define SMBIOS_STATE_SAFE 3
37typedef enum {
38 SMBIOS_BIOS_INFORMATION=0,
39 SMBIOS_SYSTEM_INFORMATION=1,
Vladimir Serbinenko47089f22014-03-02 19:14:44 +010040 SMBIOS_BOARD_INFORMATION=2,
Sven Schnelle164bcfd2011-08-14 20:56:34 +020041 SMBIOS_SYSTEM_ENCLOSURE=3,
42 SMBIOS_PROCESSOR_INFORMATION=4,
43 SMBIOS_CACHE_INFORMATION=7,
44 SMBIOS_SYSTEM_SLOTS=9,
Peter Stugec392b642013-07-06 19:51:12 +020045 SMBIOS_OEM_STRINGS=11,
Duncan Laurie472ec9c2012-06-23 16:13:42 -070046 SMBIOS_EVENT_LOG=15,
Sven Schnelle164bcfd2011-08-14 20:56:34 +020047 SMBIOS_PHYS_MEMORY_ARRAY=16,
48 SMBIOS_MEMORY_DEVICE=17,
49 SMBIOS_MEMORY_ARRAY_MAPPED_ADDRESS=19,
50 SMBIOS_SYSTEM_BOOT_INFORMATION=32,
Stefan Reinauer3d7c6772012-04-02 13:30:10 -070051 SMBIOS_ONBOARD_DEVICES_EXTENDED_INFORMATION=41,
Sven Schnelle164bcfd2011-08-14 20:56:34 +020052 SMBIOS_END_OF_TABLE=127,
53} smbios_struct_type_t;
54
55struct smbios_entry {
56 u8 anchor[4];
57 u8 checksum;
58 u8 length;
59 u8 major_version;
60 u8 minor_version;
61 u16 max_struct_size;
62 u8 entry_point_rev;
63 u8 formwatted_area[5];
64 u8 intermediate_anchor_string[5];
65 u8 intermediate_checksum;
66 u16 struct_table_length;
67 u32 struct_table_address;
68 u16 struct_count;
69 u8 smbios_bcd_revision;
70} __attribute__((packed));
71
72struct smbios_type0 {
73 u8 type;
74 u8 length;
75 u16 handle;
76 u8 vendor;
77 u8 bios_version;
78 u16 bios_start_segment;
79 u8 bios_release_date;
80 u8 bios_rom_size;
81 u64 bios_characteristics;
82 u8 bios_characteristics_ext1;
83 u8 bios_characteristics_ext2;
84 u8 system_bios_major_release;
85 u8 system_bios_minor_release;
86 u8 ec_major_release;
87 u8 ec_minor_release;
88 char eos[2];
89} __attribute__((packed));
90
91struct smbios_type1 {
92 u8 type;
93 u8 length;
94 u16 handle;
95 u8 manufacturer;
96 u8 product_name;
97 u8 version;
98 u8 serial_number;
99 u8 uuid[16];
100 u8 wakeup_type;
101 u8 sku;
102 u8 family;
103 char eos[2];
104} __attribute__((packed));
105
Vladimir Serbinenko47089f22014-03-02 19:14:44 +0100106struct smbios_type2 {
107 u8 type;
108 u8 length;
109 u16 handle;
110 u8 manufacturer;
111 u8 product_name;
112 u8 version;
113 u8 serial_number;
114 char eos[2];
115} __attribute__((packed));
116
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200117struct smbios_type3 {
118 u8 type;
119 u8 length;
120 u16 handle;
121 u8 manufacturer;
122 u8 _type;
123 u8 version;
124 u8 serial_number;
125 u8 asset_tag_number;
126 u8 bootup_state;
127 u8 power_supply_state;
128 u8 thermal_state;
129 u8 security_status;
130 u32 oem_defined;
131 u8 height;
132 u8 number_of_power_cords;
133 u8 element_count;
134 u8 element_record_length;
135 char eos[2];
136} __attribute__((packed));
137
138struct smbios_type4 {
139 u8 type;
140 u8 length;
141 u16 handle;
142 u8 socket_designation;
143 u8 processor_type;
144 u8 processor_family;
145 u8 processor_manufacturer;
146 u32 processor_id[2];
147 u8 processor_version;
148 u8 voltage;
149 u16 external_clock;
150 u16 max_speed;
151 u16 current_speed;
152 u8 status;
153 u8 processor_upgrade;
154 u16 l1_cache_handle;
155 u16 l2_cache_handle;
156 u16 l3_cache_handle;
157 u8 serial_number;
158 u8 asset_tag;
159 u8 part_number;
160 u8 core_count;
161 u8 core_enabled;
162 u8 thread_count;
163 u16 processor_characteristics;
164 u16 processor_family2;
165 char eos[2];
166} __attribute__((packed));
167
Peter Stugec392b642013-07-06 19:51:12 +0200168struct smbios_type11 {
169 u8 type;
170 u8 length;
171 u16 handle;
172 u8 count;
173 char eos[2];
174} __attribute__((packed));
175
Duncan Laurie472ec9c2012-06-23 16:13:42 -0700176struct smbios_type15 {
177 u8 type;
178 u8 length;
179 u16 handle;
180 u16 area_length;
181 u16 header_offset;
182 u16 data_offset;
183 u8 access_method;
184 u8 log_status;
185 u32 change_token;
186 u32 address;
187 u8 header_format;
188 u8 log_type_descriptors;
189 u8 log_type_descriptor_length;
190 char eos[2];
191} __attribute__((packed));
192
193enum {
194 SMBIOS_EVENTLOG_ACCESS_METHOD_IO8 = 0,
195 SMBIOS_EVENTLOG_ACCESS_METHOD_IO8X2,
196 SMBIOS_EVENTLOG_ACCESS_METHOD_IO16,
197 SMBIOS_EVENTLOG_ACCESS_METHOD_MMIO32,
198 SMBIOS_EVENTLOG_ACCESS_METHOD_GPNV,
199};
200
201enum {
202 SMBIOS_EVENTLOG_STATUS_VALID = 1, /* Bit 0 */
203 SMBIOS_EVENTLOG_STATUS_FULL = 2, /* Bit 1 */
204};
205
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200206struct smbios_type16 {
207 u8 type;
208 u8 length;
209 u16 handle;
210 u8 location;
211 u8 use;
212 u8 memory_error_correction;
213 u32 maximum_capacity;
214 u16 memory_error_information_handle;
215 u16 number_of_memory_devices;
216 u64 extended_maximum_capacity;
217 char eos[2];
218} __attribute__((packed));
219
220struct smbios_type17 {
221 u8 type;
222 u8 length;
223 u16 handle;
224 u16 phys_memory_array_handle;
225 u16 memory_error_information_handle;
226 u16 total_width;
227 u16 data_width;
228 u16 size;
229 u8 form_factor;
230 u8 device_set;
231 u8 device_locator;
232 u8 bank_locator;
233 u8 memory_type;
234 u16 type_detail;
235 u16 speed;
236 u8 manufacturer;
237 u8 serial_number;
238 u8 asset_tag;
239 u8 part_number;
240 u8 attributes;
241 u16 extended_size;
242 u16 clock_speed;
243
244 char eos[2];
245} __attribute__((packed));
246
247struct smbios_type32 {
248 u8 type;
249 u8 length;
250 u16 handle;
251 u8 reserved[6];
252 u8 boot_status;
253 u8 eos[2];
254} __attribute__((packed));
255
Sven Schnelle6d038762012-07-09 08:52:53 +0200256struct smbios_type38 {
257 u8 type;
258 u8 length;
259 u16 handle;
260 u8 interface_type;
261 u8 ipmi_rev;
262 u8 i2c_slave_addr;
263 u8 nv_storage_addr;
264 u64 base_address;
265 u8 base_address_modifier;
266 u8 irq;
267} __attribute__((packed));
268
Stefan Reinauer3d7c6772012-04-02 13:30:10 -0700269typedef enum {
270 SMBIOS_DEVICE_TYPE_OTHER = 0x01,
271 SMBIOS_DEVICE_TYPE_UNKNOWN,
272 SMBIOS_DEVICE_TYPE_VIDEO,
273 SMBIOS_DEVICE_TYPE_SCSI,
274 SMBIOS_DEVICE_TYPE_ETHERNET,
275 SMBIOS_DEVICE_TYPE_TOKEN_RING,
276 SMBIOS_DEVICE_TYPE_SOUND,
277 SMBIOS_DEVICE_TYPE_PATA,
278 SMBIOS_DEVICE_TYPE_SATA,
279 SMBIOS_DEVICE_TYPE_SAS,
280} smbios_onboard_device_type;
281
282struct smbios_type41 {
283 u8 type;
284 u8 length;
285 u16 handle;
286 u8 reference_designation;
287 u8 device_type: 7;
288 u8 device_status: 1;
289 u8 device_type_instance;
290 u16 segment_group_number;
291 u8 bus_number;
292 u8 function_number: 3;
293 u8 device_number: 5;
294 char eos[2];
295} __attribute__((packed));
296
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200297struct smbios_type127 {
298 u8 type;
299 u8 length;
300 u16 handle;
301 u8 eos[2];
302} __attribute__((packed));
303
304#endif