stoneyridge: Enable legacy IO
[coreboot.git] / src / include / smbios.h
blob8fe507ea5382a5e3473bc45df47d76e41fb59f1e
1 /*
2 * This file is part of the coreboot project.
4 * Copyright (C) 2015 Timothy Pearson <tpearson@raptorengineeringinc.com>,
5 * Raptor Engineering
6 * Copyright (C) various authors, the coreboot project
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 2 of the License.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
18 #ifndef SMBIOS_H
19 #define SMBIOS_H
21 #include <types.h>
22 #include <compiler.h>
24 unsigned long smbios_write_tables(unsigned long start);
25 int smbios_add_string(u8 *start, const char *str);
26 int smbios_string_table_len(u8 *start);
28 /* Used by mainboard to add an on-board device */
29 int smbios_write_type41(unsigned long *current, int *handle,
30 const char *name, u8 instance, u16 segment,
31 u8 bus, u8 device, u8 function);
33 const char *smbios_mainboard_manufacturer(void);
34 const char *smbios_mainboard_product_name(void);
36 const char *smbios_mainboard_serial_number(void);
37 const char *smbios_mainboard_version(void);
38 void smbios_mainboard_set_uuid(u8 *uuid);
39 const char *smbios_mainboard_bios_version(void);
40 const char *smbios_mainboard_asset_tag(void);
41 u8 smbios_mainboard_feature_flags(void);
42 const char *smbios_mainboard_location_in_chassis(void);
44 const char *smbios_mainboard_sku(void);
45 u8 smbios_mainboard_enclosure_type(void);
46 #ifdef CONFIG_MAINBOARD_FAMILY
47 const char *smbios_mainboard_family(void);
48 #endif
50 #define BIOS_CHARACTERISTICS_PCI_SUPPORTED (1 << 7)
51 #define BIOS_CHARACTERISTICS_PC_CARD (1 << 8)
52 #define BIOS_CHARACTERISTICS_PNP (1 << 9)
53 #define BIOS_CHARACTERISTICS_APM (1 << 10)
54 #define BIOS_CHARACTERISTICS_UPGRADEABLE (1 << 11)
55 #define BIOS_CHARACTERISTICS_SHADOW (1 << 12)
56 #define BIOS_CHARACTERISTICS_BOOT_FROM_CD (1 << 15)
57 #define BIOS_CHARACTERISTICS_SELECTABLE_BOOT (1 << 16)
58 #define BIOS_CHARACTERISTICS_BIOS_SOCKETED (1 << 17)
60 #define BIOS_EXT1_CHARACTERISTICS_ACPI (1 << 0)
61 #define BIOS_EXT2_CHARACTERISTICS_TARGET (1 << 2)
63 #define BIOS_MEMORY_ECC_SINGLE_BIT_CORRECTING (1 << 3)
64 #define BIOS_MEMORY_ECC_DOUBLE_BIT_CORRECTING (1 << 4)
65 #define BIOS_MEMORY_ECC_SCRUBBING (1 << 5)
67 #define MEMORY_TYPE_DETAIL_OTHER (1 << 1)
68 #define MEMORY_TYPE_DETAIL_UNKNOWN (1 << 2)
69 #define MEMORY_TYPE_DETAIL_FAST_PAGED (1 << 3)
70 #define MEMORY_TYPE_DETAIL_STATIC_COLUMN (1 << 4)
71 #define MEMORY_TYPE_DETAIL_PSEUDO_STATIC (1 << 5)
72 #define MEMORY_TYPE_DETAIL_RAMBUS (1 << 6)
73 #define MEMORY_TYPE_DETAIL_SYNCHRONOUS (1 << 7)
74 #define MEMORY_TYPE_DETAIL_CMOS (1 << 8)
75 #define MEMORY_TYPE_DETAIL_EDO (1 << 9)
76 #define MEMORY_TYPE_DETAIL_WINDOW_DRAM (1 << 10)
77 #define MEMORY_TYPE_DETAIL_CACHE_DRAM (1 << 11)
78 #define MEMORY_TYPE_DETAIL_NON_VOLATILE (1 << 12)
79 #define MEMORY_TYPE_DETAIL_REGISTERED (1 << 13)
80 #define MEMORY_TYPE_DETAIL_UNBUFFERED (1 << 14)
82 typedef enum {
83 MEMORY_BUS_WIDTH_8 = 0,
84 MEMORY_BUS_WIDTH_16 = 1,
85 MEMORY_BUS_WIDTH_32 = 2,
86 MEMORY_BUS_WIDTH_64 = 3,
87 MEMORY_BUS_WIDTH_128 = 4,
88 MEMORY_BUS_WIDTH_256 = 5,
89 MEMORY_BUS_WIDTH_512 = 6,
90 MEMORY_BUS_WIDTH_1024 = 7,
91 MEMORY_BUS_WIDTH_MAX = 7,
92 } smbios_memory_bus_width;
94 typedef enum {
95 MEMORY_DEVICE_OTHER = 0x01,
96 MEMORY_DEVICE_UNKNOWN = 0x02,
97 MEMORY_DEVICE_DRAM = 0x03,
98 MEMORY_DEVICE_EDRAM = 0x04,
99 MEMORY_DEVICE_VRAM = 0x05,
100 MEMORY_DEVICE_SRAM = 0x06,
101 MEMORY_DEVICE_RAM = 0x07,
102 MEMORY_DEVICE_ROM = 0x08,
103 MEMORY_DEVICE_FLASH = 0x09,
104 MEMORY_DEVICE_EEPROM = 0x0A,
105 MEMORY_DEVICE_FEPROM = 0x0B,
106 MEMORY_DEVICE_EPROM = 0x0C,
107 MEMORY_DEVICE_CDRAM = 0x0D,
108 MEMORY_DEVICE_3DRAM = 0x0E,
109 MEMORY_DEVICE_SDRAM = 0x0F,
110 MEMORY_DEVICE_SGRAM = 0x10,
111 MEMORY_DEVICE_RDRAM = 0x11,
112 MEMORY_DEVICE_DDR = 0x12,
113 MEMORY_DEVICE_DDR2 = 0x13,
114 MEMORY_DEVICE_DDR2_FB_DIMM = 0x14,
115 MEMORY_DEVICE_DDR3 = 0x18,
116 MEMORY_DEVICE_DBD2 = 0x19,
117 MEMORY_DEVICE_DDR4 = 0x1A,
118 MEMORY_DEVICE_LPDDR = 0x1B,
119 MEMORY_DEVICE_LPDDR2 = 0x1C,
120 MEMORY_DEVICE_LPDDR3 = 0x1D,
121 MEMORY_DEVICE_LPDDR4 = 0x1E,
122 } smbios_memory_device_type;
124 typedef enum {
125 MEMORY_FORMFACTOR_OTHER = 0x01,
126 MEMORY_FORMFACTOR_UNKNOWN = 0x02,
127 MEMORY_FORMFACTOR_SIMM = 0x03,
128 MEMORY_FORMFACTOR_SIP = 0x04,
129 MEMORY_FORMFACTOR_CHIP = 0x05,
130 MEMORY_FORMFACTOR_DIP = 0x06,
131 MEMORY_FORMFACTOR_ZIP = 0x07,
132 MEMORY_FORMFACTOR_PROPRIETARY_CARD = 0x08,
133 MEMORY_FORMFACTOR_DIMM = 0x09,
134 MEMORY_FORMFACTOR_TSOP = 0x0a,
135 MEMORY_FORMFACTOR_ROC = 0x0b,
136 MEMORY_FORMFACTOR_RIMM = 0x0c,
137 MEMORY_FORMFACTOR_SODIMM = 0x0d,
138 MEMORY_FORMFACTOR_SRIMM = 0x0e,
139 MEMORY_FORMFACTOR_FBDIMM = 0x0f,
140 } smbios_memory_form_factor;
142 typedef enum {
143 MEMORY_TYPE_OTHER = 0x01,
144 MEMORY_TYPE_UNKNOWN = 0x02,
145 MEMORY_TYPE_DRAM = 0x03,
146 MEMORY_TYPE_EDRAM = 0x04,
147 MEMORY_TYPE_VRAM = 0x05,
148 MEMORY_TYPE_SRAM = 0x06,
149 MEMORY_TYPE_RAM = 0x07,
150 MEMORY_TYPE_ROM = 0x08,
151 MEMORY_TYPE_FLASH = 0x09,
152 MEMORY_TYPE_EEPROM = 0x0a,
153 MEMORY_TYPE_FEPROM = 0x0b,
154 MEMORY_TYPE_EPROM = 0x0c,
155 MEMORY_TYPE_CDRAM = 0x0d,
156 MEMORY_TYPE_3DRAM = 0x0e,
157 MEMORY_TYPE_SDRAM = 0x0f,
158 MEMORY_TYPE_SGRAM = 0x10,
159 MEMORY_TYPE_RDRAM = 0x11,
160 MEMORY_TYPE_DDR = 0x12,
161 MEMORY_TYPE_DDR2 = 0x13,
162 MEMORY_TYPE_DDR2_FBDIMM = 0x14,
163 MEMORY_TYPE_DDR3 = 0x18,
164 MEMORY_TYPE_FBD2 = 0x19,
165 } smbios_memory_type;
167 typedef enum {
168 MEMORY_ARRAY_LOCATION_OTHER = 0x01,
169 MEMORY_ARRAY_LOCATION_UNKNOWN = 0x02,
170 MEMORY_ARRAY_LOCATION_SYSTEM_BOARD = 0x03,
171 MEMORY_ARRAY_LOCATION_ISA_ADD_ON = 0x04,
172 MEMORY_ARRAY_LOCATION_EISA_ADD_ON = 0x05,
173 MEMORY_ARRAY_LOCATION_PCI_ADD_ON = 0x06,
174 MEMORY_ARRAY_LOCATION_MCA_ADD_ON = 0x07,
175 MEMORY_ARRAY_LOCATION_PCMCIA_ADD_ON = 0x08,
176 MEMORY_ARRAY_LOCATION_PROPRIETARY_ADD_ON = 0x09,
177 MEMORY_ARRAY_LOCATION_NUBUS = 0x0a,
178 MEMORY_ARRAY_LOCATION_PC_98_C20_ADD_ON = 0xa0,
179 MEMORY_ARRAY_LOCATION_PC_98_C24_ADD_ON = 0xa1,
180 MEMORY_ARRAY_LOCATION_PC_98_E_ADD_ON = 0xa2,
181 MEMORY_ARRAY_LOCATION_PC_98_LOCAL_BUS_ADD_ON = 0xa3,
182 } smbios_memory_array_location;
184 typedef enum {
185 MEMORY_ARRAY_USE_OTHER = 0x01,
186 MEMORY_ARRAY_USE_UNKNOWN = 0x02,
187 MEMORY_ARRAY_USE_SYSTEM = 0x03,
188 MEMORY_ARRAY_USE_VIDEO = 0x04,
189 MEMORY_ARRAY_USE_FLASH = 0x05,
190 MEMORY_ARRAY_USE_NVRAM = 0x06,
191 MEMORY_ARRAY_USE_CACHE = 0x07,
192 } smbios_memory_array_use;
194 typedef enum {
195 MEMORY_ARRAY_ECC_OTHER = 0x01,
196 MEMORY_ARRAY_ECC_UNKNOWN = 0x02,
197 MEMORY_ARRAY_ECC_NONE = 0x03,
198 MEMORY_ARRAY_ECC_PARITY = 0x04,
199 MEMORY_ARRAY_ECC_SINGLE_BIT = 0x05,
200 MEMORY_ARRAY_ECC_MULTI_BIT = 0x06,
201 MEMORY_ARRAY_ECC_CRC = 0x07,
202 } smbios_memory_array_ecc;
204 #define SMBIOS_STATE_SAFE 3
205 typedef enum {
206 SMBIOS_BIOS_INFORMATION = 0,
207 SMBIOS_SYSTEM_INFORMATION = 1,
208 SMBIOS_BOARD_INFORMATION = 2,
209 SMBIOS_SYSTEM_ENCLOSURE = 3,
210 SMBIOS_PROCESSOR_INFORMATION = 4,
211 SMBIOS_CACHE_INFORMATION = 7,
212 SMBIOS_SYSTEM_SLOTS = 9,
213 SMBIOS_OEM_STRINGS = 11,
214 SMBIOS_EVENT_LOG = 15,
215 SMBIOS_PHYS_MEMORY_ARRAY = 16,
216 SMBIOS_MEMORY_DEVICE = 17,
217 SMBIOS_MEMORY_ARRAY_MAPPED_ADDRESS = 19,
218 SMBIOS_SYSTEM_BOOT_INFORMATION = 32,
219 SMBIOS_ONBOARD_DEVICES_EXTENDED_INFORMATION = 41,
220 SMBIOS_END_OF_TABLE = 127,
221 } smbios_struct_type_t;
223 struct smbios_entry {
224 u8 anchor[4];
225 u8 checksum;
226 u8 length;
227 u8 major_version;
228 u8 minor_version;
229 u16 max_struct_size;
230 u8 entry_point_rev;
231 u8 formwatted_area[5];
232 u8 intermediate_anchor_string[5];
233 u8 intermediate_checksum;
234 u16 struct_table_length;
235 u32 struct_table_address;
236 u16 struct_count;
237 u8 smbios_bcd_revision;
238 } __packed;
240 struct smbios_type0 {
241 u8 type;
242 u8 length;
243 u16 handle;
244 u8 vendor;
245 u8 bios_version;
246 u16 bios_start_segment;
247 u8 bios_release_date;
248 u8 bios_rom_size;
249 u64 bios_characteristics;
250 u8 bios_characteristics_ext1;
251 u8 bios_characteristics_ext2;
252 u8 system_bios_major_release;
253 u8 system_bios_minor_release;
254 u8 ec_major_release;
255 u8 ec_minor_release;
256 u8 eos[2];
257 } __packed;
259 struct smbios_type1 {
260 u8 type;
261 u8 length;
262 u16 handle;
263 u8 manufacturer;
264 u8 product_name;
265 u8 version;
266 u8 serial_number;
267 u8 uuid[16];
268 u8 wakeup_type;
269 u8 sku;
270 u8 family;
271 u8 eos[2];
272 } __packed;
274 typedef enum {
275 SMBIOS_BOARD_TYPE_UNKNOWN = 0x01,
276 SMBIOS_BOARD_TYPE_OTHER = 0x02,
277 SMBIOS_BOARD_TYPE_SERVER_BLADE = 0x03,
278 SMBIOS_BOARD_TYPE_CONNECTIVITY_SWITCH = 0x04,
279 SMBIOS_BOARD_TYPE_SYSTEM_MANAGEMENT_MODULE = 0x05,
280 SMBIOS_BOARD_TYPE_PROCESSOR_MODULE = 0x06,
281 SMBIOS_BOARD_TYPE_IO_MODULE = 0x07,
282 SMBIOS_BOARD_TYPE_MEMORY_MODULE = 0x08,
283 SMBIOS_BOARD_TYPE_DAUGHTER_BOARD = 0x09,
284 SMBIOS_BOARD_TYPE_MOTHERBOARD = 0x0a,
285 SMBIOS_BOARD_TYPE_PROCESSOR_MEMORY_MODULE = 0x0b,
286 SMBIOS_BOARD_TYPE_PROCESSOR_IO_MODULE = 0x0c,
287 SMBIOS_BOARD_TYPE_INTERCONNECT_BOARD = 0x0d,
288 } smbios_board_type;
290 struct smbios_type2 {
291 u8 type;
292 u8 length;
293 u16 handle;
294 u8 manufacturer;
295 u8 product_name;
296 u8 version;
297 u8 serial_number;
298 u8 asset_tag;
299 u8 feature_flags;
300 u8 location_in_chassis;
301 u16 chassis_handle;
302 u8 board_type;
303 u8 eos[2];
304 } __packed;
306 enum {
307 SMBIOS_ENCLOSURE_OTHER = 0x01,
308 SMBIOS_ENCLOSURE_UNKNOWN = 0x02,
309 SMBIOS_ENCLOSURE_DESKTOP = 0x03,
310 SMBIOS_ENCLOSURE_LOW_PROFILE_DESKTOP = 0x04,
311 SMBIOS_ENCLOSURE_PIZZA_BOX = 0x05,
312 SMBIOS_ENCLOSURE_MINI_TOWER = 0x06,
313 SMBIOS_ENCLOSURE_TOWER = 0x07,
314 SMBIOS_ENCLOSURE_PORTABLE = 0x08,
315 SMBIOS_ENCLOSURE_LAPTOP = 0x09,
316 SMBIOS_ENCLOSURE_NOTEBOOK = 0x0a,
317 SMBIOS_ENCLOSURE_HAND_HELD = 0x0b,
318 SMBIOS_ENCLOSURE_DOCKING_STATION = 0x0c,
319 SMBIOS_ENCLOSURE_ALL_IN_ONE = 0x0d,
320 SMBIOS_ENCLOSURE_SUB_NOTEBOOK = 0x0e,
321 SMBIOS_ENCLOSURE_SPACE_SAVING = 0x0f,
322 SMBIOS_ENCLOSURE_LUNCH_BOX = 0x10,
323 SMBIOS_ENCLOSURE_MAIN_SERVER_CHASSIS = 0x11,
324 SMBIOS_ENCLOSURE_EXPANSION_CHASSIS = 0x12,
325 SMBIOS_ENCLOSURE_SUBCHASSIS = 0x13,
326 SMBIOS_ENCLOSURE_BUS_EXPANSION_CHASSIS = 0x14,
327 SMBIOS_ENCLOSURE_PERIPHERAL_CHASSIS = 0x15,
328 SMBIOS_ENCLOSURE_RAID_CHASSIS = 0x16,
329 SMBIOS_ENCLOSURE_RACK_MOUNT_CHASSIS = 0x17,
330 SMBIOS_ENCLOSURE_SEALED_CASE_PC = 0x18,
331 SMBIOS_ENCLOSURE_MULTI_SYSTEM_CHASSIS = 0x19,
332 SMBIOS_ENCLOSURE_COMPACT_PCI = 0x1a,
333 SMBIOS_ENCLOSURE_ADVANCED_TCA = 0x1b,
334 SMBIOS_ENCLOSURE_BLADE = 0x1c,
335 SMBIOS_ENCLOSURE_BLADE_ENCLOSURE = 0x1d,
336 SMBIOS_ENCLOSURE_TABLET = 0x1e,
337 SMBIOS_ENCLOSURE_CONVERTIBLE = 0x1f,
338 SMBIOS_ENCLOSURE_DETACHABLE = 0x20,
339 SMBIOS_ENCLOSURE_IOT_GATEWAY = 0x21,
340 SMBIOS_ENCLOSURE_EMBEDDED_PC = 0x22,
341 SMBIOS_ENCLOSURE_MINI_PC = 0x23,
342 SMBIOS_ENCLOSURE_STICK_PC = 0x24,
345 struct smbios_type3 {
346 u8 type;
347 u8 length;
348 u16 handle;
349 u8 manufacturer;
350 u8 _type;
351 u8 version;
352 u8 serial_number;
353 u8 asset_tag_number;
354 u8 bootup_state;
355 u8 power_supply_state;
356 u8 thermal_state;
357 u8 security_status;
358 u32 oem_defined;
359 u8 height;
360 u8 number_of_power_cords;
361 u8 element_count;
362 u8 element_record_length;
363 u8 sku_number;
364 u8 eos[2];
365 } __packed;
367 struct smbios_type4 {
368 u8 type;
369 u8 length;
370 u16 handle;
371 u8 socket_designation;
372 u8 processor_type;
373 u8 processor_family;
374 u8 processor_manufacturer;
375 u32 processor_id[2];
376 u8 processor_version;
377 u8 voltage;
378 u16 external_clock;
379 u16 max_speed;
380 u16 current_speed;
381 u8 status;
382 u8 processor_upgrade;
383 u16 l1_cache_handle;
384 u16 l2_cache_handle;
385 u16 l3_cache_handle;
386 u8 serial_number;
387 u8 asset_tag;
388 u8 part_number;
389 u8 core_count;
390 u8 core_enabled;
391 u8 thread_count;
392 u16 processor_characteristics;
393 u16 processor_family2;
394 u8 eos[2];
395 } __packed;
397 struct smbios_type11 {
398 u8 type;
399 u8 length;
400 u16 handle;
401 u8 count;
402 u8 eos[2];
403 } __packed;
405 struct smbios_type15 {
406 u8 type;
407 u8 length;
408 u16 handle;
409 u16 area_length;
410 u16 header_offset;
411 u16 data_offset;
412 u8 access_method;
413 u8 log_status;
414 u32 change_token;
415 u32 address;
416 u8 header_format;
417 u8 log_type_descriptors;
418 u8 log_type_descriptor_length;
419 u8 eos[2];
420 } __packed;
422 enum {
423 SMBIOS_EVENTLOG_ACCESS_METHOD_IO8 = 0,
424 SMBIOS_EVENTLOG_ACCESS_METHOD_IO8X2,
425 SMBIOS_EVENTLOG_ACCESS_METHOD_IO16,
426 SMBIOS_EVENTLOG_ACCESS_METHOD_MMIO32,
427 SMBIOS_EVENTLOG_ACCESS_METHOD_GPNV,
430 enum {
431 SMBIOS_EVENTLOG_STATUS_VALID = 1, /* Bit 0 */
432 SMBIOS_EVENTLOG_STATUS_FULL = 2, /* Bit 1 */
435 struct smbios_type16 {
436 u8 type;
437 u8 length;
438 u16 handle;
439 u8 location;
440 u8 use;
441 u8 memory_error_correction;
442 u32 maximum_capacity;
443 u16 memory_error_information_handle;
444 u16 number_of_memory_devices;
445 u64 extended_maximum_capacity;
446 u8 eos[2];
447 } __packed;
449 struct smbios_type17 {
450 u8 type;
451 u8 length;
452 u16 handle;
453 u16 phys_memory_array_handle;
454 u16 memory_error_information_handle;
455 u16 total_width;
456 u16 data_width;
457 u16 size;
458 u8 form_factor;
459 u8 device_set;
460 u8 device_locator;
461 u8 bank_locator;
462 u8 memory_type;
463 u16 type_detail;
464 u16 speed;
465 u8 manufacturer;
466 u8 serial_number;
467 u8 asset_tag;
468 u8 part_number;
469 u8 attributes;
470 u32 extended_size;
471 u16 clock_speed;
472 u16 minimum_voltage;
473 u16 maximum_voltage;
474 u16 configured_voltage;
475 u8 eos[2];
476 } __packed;
478 struct smbios_type32 {
479 u8 type;
480 u8 length;
481 u16 handle;
482 u8 reserved[6];
483 u8 boot_status;
484 u8 eos[2];
485 } __packed;
487 struct smbios_type38 {
488 u8 type;
489 u8 length;
490 u16 handle;
491 u8 interface_type;
492 u8 ipmi_rev;
493 u8 i2c_slave_addr;
494 u8 nv_storage_addr;
495 u64 base_address;
496 u8 base_address_modifier;
497 u8 irq;
498 } __packed;
500 typedef enum {
501 SMBIOS_DEVICE_TYPE_OTHER = 0x01,
502 SMBIOS_DEVICE_TYPE_UNKNOWN,
503 SMBIOS_DEVICE_TYPE_VIDEO,
504 SMBIOS_DEVICE_TYPE_SCSI,
505 SMBIOS_DEVICE_TYPE_ETHERNET,
506 SMBIOS_DEVICE_TYPE_TOKEN_RING,
507 SMBIOS_DEVICE_TYPE_SOUND,
508 SMBIOS_DEVICE_TYPE_PATA,
509 SMBIOS_DEVICE_TYPE_SATA,
510 SMBIOS_DEVICE_TYPE_SAS,
511 } smbios_onboard_device_type;
513 struct smbios_type41 {
514 u8 type;
515 u8 length;
516 u16 handle;
517 u8 reference_designation;
518 u8 device_type: 7;
519 u8 device_status: 1;
520 u8 device_type_instance;
521 u16 segment_group_number;
522 u8 bus_number;
523 u8 function_number: 3;
524 u8 device_number: 5;
525 u8 eos[2];
526 } __packed;
528 struct smbios_type127 {
529 u8 type;
530 u8 length;
531 u16 handle;
532 u8 eos[2];
533 } __packed;
535 void smbios_fill_dimm_manufacturer_from_id(uint16_t mod_id,
536 struct smbios_type17 *t);
538 smbios_board_type smbios_mainboard_board_type(void);
540 #endif