blob: c6132ec0faab4444b2d0bccfc318c87556da294a [file] [log] [blame]
Timothy Pearson821217b2015-03-27 22:47:25 -05001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2015 Timothy Pearson <tpearson@raptorengineeringinc.com>, Raptor Engineering
5 * Copyright (C) various authors, the coreboot project
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
Sven Schnelle164bcfd2011-08-14 20:56:34 +020021#ifndef SMBIOS_H
22#define SMBIOS_H
23
24#include <types.h>
25
26unsigned long smbios_write_tables(unsigned long start);
27int smbios_add_string(char *start, const char *str);
28int smbios_string_table_len(char *start);
29
Duncan Laurie21a78702013-05-23 14:17:05 -070030/* Used by mainboard to add an on-board device */
31int smbios_write_type41(unsigned long *current, int *handle,
32 const char *name, u8 instance, u16 segment,
33 u8 bus, u8 device, u8 function);
34
Gerd Hoffmann06262742013-11-13 13:37:23 +010035const char *smbios_mainboard_manufacturer(void);
36const char *smbios_mainboard_product_name(void);
Duncan Laurie21a78702013-05-23 14:17:05 -070037
Christian Gmeinerac3aa092012-07-25 13:42:40 +020038const char *smbios_mainboard_serial_number(void);
39const char *smbios_mainboard_version(void);
Gerd Hoffmann06262742013-11-13 13:37:23 +010040void smbios_mainboard_set_uuid(u8 *uuid);
Vladimir Serbinenko63acd222014-06-01 00:26:48 +020041const char *smbios_mainboard_bios_version(void);
Vladimir Serbinenkoa71bdc32014-08-30 00:35:39 +020042u8 smbios_mainboard_enclosure_type(void);
Kane Chen51bdc472014-09-08 18:40:30 -070043#ifdef CONFIG_MAINBOARD_FAMILY
44const char *smbios_mainboard_family(void);
45#endif
Christian Gmeinerac3aa092012-07-25 13:42:40 +020046
Sven Schnelle164bcfd2011-08-14 20:56:34 +020047#define BIOS_CHARACTERISTICS_PCI_SUPPORTED (1 << 7)
48#define BIOS_CHARACTERISTICS_PC_CARD (1 << 8)
49#define BIOS_CHARACTERISTICS_PNP (1 << 9)
50#define BIOS_CHARACTERISTICS_APM (1 << 10)
51#define BIOS_CHARACTERISTICS_UPGRADEABLE (1 << 11)
52#define BIOS_CHARACTERISTICS_SHADOW (1 << 12)
53#define BIOS_CHARACTERISTICS_BOOT_FROM_CD (1 << 15)
54#define BIOS_CHARACTERISTICS_SELECTABLE_BOOT (1 << 16)
55#define BIOS_CHARACTERISTICS_BIOS_SOCKETED (1 << 17)
56
57#define BIOS_EXT1_CHARACTERISTICS_ACPI (1 << 0)
58#define BIOS_EXT2_CHARACTERISTICS_TARGET (1 << 2)
59
Timothy Pearson821217b2015-03-27 22:47:25 -050060#define BIOS_MEMORY_ECC_SINGLE_BIT_CORRECTING (1 << 3)
61#define BIOS_MEMORY_ECC_DOUBLE_BIT_CORRECTING (1 << 4)
62#define BIOS_MEMORY_ECC_SCRUBBING (1 << 5)
63
64#define MEMORY_TYPE_DETAIL_OTHER (1 << 1)
65#define MEMORY_TYPE_DETAIL_UNKNOWN (1 << 2)
66#define MEMORY_TYPE_DETAIL_FAST_PAGED (1 << 3)
67#define MEMORY_TYPE_DETAIL_STATIC_COLUMN (1 << 4)
68#define MEMORY_TYPE_DETAIL_PSEUDO_STATIC (1 << 5)
69#define MEMORY_TYPE_DETAIL_RAMBUS (1 << 6)
70#define MEMORY_TYPE_DETAIL_SYNCHRONOUS (1 << 7)
71#define MEMORY_TYPE_DETAIL_CMOS (1 << 8)
72#define MEMORY_TYPE_DETAIL_EDO (1 << 9)
73#define MEMORY_TYPE_DETAIL_WINDOW_DRAM (1 << 10)
74#define MEMORY_TYPE_DETAIL_CACHE_DRAM (1 << 11)
75#define MEMORY_TYPE_DETAIL_NON_VOLATILE (1 << 12)
76#define MEMORY_TYPE_DETAIL_REGISTERED (1 << 13)
77#define MEMORY_TYPE_DETAIL_UNBUFFERED (1 << 14)
78
Kane Chen33faac62014-07-27 12:54:44 -070079typedef enum {
80 MEMORY_FORMFACTOR_OTHER = 0x01,
81 MEMORY_FORMFACTOR_UNKNOWN = 0x02,
82 MEMORY_FORMFACTOR_SIMM = 0x03,
83 MEMORY_FORMFACTOR_SIP = 0x04,
84 MEMORY_FORMFACTOR_CHIP = 0x05,
85 MEMORY_FORMFACTOR_DIP = 0x06,
86 MEMORY_FORMFACTOR_ZIP = 0x07,
87 MEMORY_FORMFACTOR_PROPRIETARY_CARD = 0x08,
88 MEMORY_FORMFACTOR_DIMM = 0x09,
89 MEMORY_FORMFACTOR_TSOP = 0x0a,
90 MEMORY_FORMFACTOR_ROC = 0x0b,
91 MEMORY_FORMFACTOR_RIMM = 0x0c,
92 MEMORY_FORMFACTOR_SODIMM = 0x0d,
93 MEMORY_FORMFACTOR_SRIMM = 0x0e,
94 MEMORY_FORMFACTOR_FBDIMM = 0x0f,
95} smbios_memory_form_factor;
96
Timothy Pearson821217b2015-03-27 22:47:25 -050097typedef enum {
98 MEMORY_TYPE_OTHER = 0x01,
99 MEMORY_TYPE_UNKNOWN = 0x02,
100 MEMORY_TYPE_DRAM = 0x03,
101 MEMORY_TYPE_EDRAM = 0x04,
102 MEMORY_TYPE_VRAM = 0x05,
103 MEMORY_TYPE_SRAM = 0x06,
104 MEMORY_TYPE_RAM = 0x07,
105 MEMORY_TYPE_ROM = 0x08,
106 MEMORY_TYPE_FLASH = 0x09,
107 MEMORY_TYPE_EEPROM = 0x0a,
108 MEMORY_TYPE_FEPROM = 0x0b,
109 MEMORY_TYPE_EPROM = 0x0c,
110 MEMORY_TYPE_CDRAM = 0x0d,
111 MEMORY_TYPE_3DRAM = 0x0e,
112 MEMORY_TYPE_SDRAM = 0x0f,
113 MEMORY_TYPE_SGRAM = 0x10,
114 MEMORY_TYPE_RDRAM = 0x11,
115 MEMORY_TYPE_DDR = 0x12,
116 MEMORY_TYPE_DDR2 = 0x13,
117 MEMORY_TYPE_DDR2_FBDIMM = 0x14,
118 MEMORY_TYPE_DDR3 = 0x18,
119 MEMORY_TYPE_FBD2 = 0x19,
120} smbios_memory_type;
121
122typedef enum {
123 MEMORY_ARRAY_LOCATION_OTHER = 0x01,
124 MEMORY_ARRAY_LOCATION_UNKNOWN = 0x02,
125 MEMORY_ARRAY_LOCATION_SYSTEM_BOARD = 0x03,
126 MEMORY_ARRAY_LOCATION_ISA_ADD_ON = 0x04,
127 MEMORY_ARRAY_LOCATION_EISA_ADD_ON = 0x05,
128 MEMORY_ARRAY_LOCATION_PCI_ADD_ON = 0x06,
129 MEMORY_ARRAY_LOCATION_MCA_ADD_ON = 0x07,
130 MEMORY_ARRAY_LOCATION_PCMCIA_ADD_ON = 0x08,
131 MEMORY_ARRAY_LOCATION_PROPRIETARY_ADD_ON = 0x09,
132 MEMORY_ARRAY_LOCATION_NUBUS = 0x0a,
133 MEMORY_ARRAY_LOCATION_PC_98_C20_ADD_ON = 0xa0,
134 MEMORY_ARRAY_LOCATION_PC_98_C24_ADD_ON = 0xa1,
135 MEMORY_ARRAY_LOCATION_PC_98_E_ADD_ON = 0xa2,
136 MEMORY_ARRAY_LOCATION_PC_98_LOCAL_BUS_ADD_ON = 0xa3,
137} smbios_memory_array_location;
138
139typedef enum {
140 MEMORY_ARRAY_USE_OTHER = 0x01,
141 MEMORY_ARRAY_USE_UNKNOWN = 0x02,
142 MEMORY_ARRAY_USE_SYSTEM = 0x03,
143 MEMORY_ARRAY_USE_VIDEO = 0x04,
144 MEMORY_ARRAY_USE_FLASH = 0x05,
145 MEMORY_ARRAY_USE_NVRAM = 0x06,
146 MEMORY_ARRAY_USE_CACHE = 0x07,
147} smbios_memory_array_use;
148
149typedef enum {
150 MEMORY_ARRAY_ECC_OTHER = 0x01,
151 MEMORY_ARRAY_ECC_UNKNOWN = 0x02,
152 MEMORY_ARRAY_ECC_NONE = 0x03,
153 MEMORY_ARRAY_ECC_PARITY = 0x04,
154 MEMORY_ARRAY_ECC_SINGLE_BIT = 0x05,
155 MEMORY_ARRAY_ECC_MULTI_BIT = 0x06,
156 MEMORY_ARRAY_ECC_CRC = 0x07,
157} smbios_memory_array_ecc;
158
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200159#define SMBIOS_STATE_SAFE 3
160typedef enum {
161 SMBIOS_BIOS_INFORMATION=0,
162 SMBIOS_SYSTEM_INFORMATION=1,
Vladimir Serbinenko47089f22014-03-02 19:14:44 +0100163 SMBIOS_BOARD_INFORMATION=2,
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200164 SMBIOS_SYSTEM_ENCLOSURE=3,
165 SMBIOS_PROCESSOR_INFORMATION=4,
166 SMBIOS_CACHE_INFORMATION=7,
167 SMBIOS_SYSTEM_SLOTS=9,
Peter Stugec392b642013-07-06 19:51:12 +0200168 SMBIOS_OEM_STRINGS=11,
Duncan Laurie472ec9c2012-06-23 16:13:42 -0700169 SMBIOS_EVENT_LOG=15,
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200170 SMBIOS_PHYS_MEMORY_ARRAY=16,
171 SMBIOS_MEMORY_DEVICE=17,
172 SMBIOS_MEMORY_ARRAY_MAPPED_ADDRESS=19,
173 SMBIOS_SYSTEM_BOOT_INFORMATION=32,
Stefan Reinauer3d7c6772012-04-02 13:30:10 -0700174 SMBIOS_ONBOARD_DEVICES_EXTENDED_INFORMATION=41,
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200175 SMBIOS_END_OF_TABLE=127,
176} smbios_struct_type_t;
177
178struct smbios_entry {
179 u8 anchor[4];
180 u8 checksum;
181 u8 length;
182 u8 major_version;
183 u8 minor_version;
184 u16 max_struct_size;
185 u8 entry_point_rev;
186 u8 formwatted_area[5];
187 u8 intermediate_anchor_string[5];
188 u8 intermediate_checksum;
189 u16 struct_table_length;
190 u32 struct_table_address;
191 u16 struct_count;
192 u8 smbios_bcd_revision;
193} __attribute__((packed));
194
195struct smbios_type0 {
196 u8 type;
197 u8 length;
198 u16 handle;
199 u8 vendor;
200 u8 bios_version;
201 u16 bios_start_segment;
202 u8 bios_release_date;
203 u8 bios_rom_size;
204 u64 bios_characteristics;
205 u8 bios_characteristics_ext1;
206 u8 bios_characteristics_ext2;
207 u8 system_bios_major_release;
208 u8 system_bios_minor_release;
209 u8 ec_major_release;
210 u8 ec_minor_release;
211 char eos[2];
212} __attribute__((packed));
213
214struct smbios_type1 {
215 u8 type;
216 u8 length;
217 u16 handle;
218 u8 manufacturer;
219 u8 product_name;
220 u8 version;
221 u8 serial_number;
222 u8 uuid[16];
223 u8 wakeup_type;
224 u8 sku;
225 u8 family;
226 char eos[2];
227} __attribute__((packed));
228
Vladimir Serbinenko47089f22014-03-02 19:14:44 +0100229struct smbios_type2 {
230 u8 type;
231 u8 length;
232 u16 handle;
233 u8 manufacturer;
234 u8 product_name;
235 u8 version;
236 u8 serial_number;
237 char eos[2];
238} __attribute__((packed));
239
Vladimir Serbinenko71c0bf62014-08-27 23:23:14 +0200240enum
241{
242 SMBIOS_ENCLOSURE_DESKTOP = 3,
243 SMBIOS_ENCLOSURE_NOTEBOOK = 9,
244};
245
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200246struct smbios_type3 {
247 u8 type;
248 u8 length;
249 u16 handle;
250 u8 manufacturer;
251 u8 _type;
252 u8 version;
253 u8 serial_number;
254 u8 asset_tag_number;
255 u8 bootup_state;
256 u8 power_supply_state;
257 u8 thermal_state;
258 u8 security_status;
259 u32 oem_defined;
260 u8 height;
261 u8 number_of_power_cords;
262 u8 element_count;
263 u8 element_record_length;
264 char eos[2];
265} __attribute__((packed));
266
267struct smbios_type4 {
268 u8 type;
269 u8 length;
270 u16 handle;
271 u8 socket_designation;
272 u8 processor_type;
273 u8 processor_family;
274 u8 processor_manufacturer;
275 u32 processor_id[2];
276 u8 processor_version;
277 u8 voltage;
278 u16 external_clock;
279 u16 max_speed;
280 u16 current_speed;
281 u8 status;
282 u8 processor_upgrade;
283 u16 l1_cache_handle;
284 u16 l2_cache_handle;
285 u16 l3_cache_handle;
286 u8 serial_number;
287 u8 asset_tag;
288 u8 part_number;
289 u8 core_count;
290 u8 core_enabled;
291 u8 thread_count;
292 u16 processor_characteristics;
293 u16 processor_family2;
294 char eos[2];
295} __attribute__((packed));
296
Peter Stugec392b642013-07-06 19:51:12 +0200297struct smbios_type11 {
298 u8 type;
299 u8 length;
300 u16 handle;
301 u8 count;
302 char eos[2];
303} __attribute__((packed));
304
Duncan Laurie472ec9c2012-06-23 16:13:42 -0700305struct smbios_type15 {
306 u8 type;
307 u8 length;
308 u16 handle;
309 u16 area_length;
310 u16 header_offset;
311 u16 data_offset;
312 u8 access_method;
313 u8 log_status;
314 u32 change_token;
315 u32 address;
316 u8 header_format;
317 u8 log_type_descriptors;
318 u8 log_type_descriptor_length;
319 char eos[2];
320} __attribute__((packed));
321
322enum {
323 SMBIOS_EVENTLOG_ACCESS_METHOD_IO8 = 0,
324 SMBIOS_EVENTLOG_ACCESS_METHOD_IO8X2,
325 SMBIOS_EVENTLOG_ACCESS_METHOD_IO16,
326 SMBIOS_EVENTLOG_ACCESS_METHOD_MMIO32,
327 SMBIOS_EVENTLOG_ACCESS_METHOD_GPNV,
328};
329
330enum {
331 SMBIOS_EVENTLOG_STATUS_VALID = 1, /* Bit 0 */
332 SMBIOS_EVENTLOG_STATUS_FULL = 2, /* Bit 1 */
333};
334
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200335struct smbios_type16 {
336 u8 type;
337 u8 length;
338 u16 handle;
339 u8 location;
340 u8 use;
341 u8 memory_error_correction;
342 u32 maximum_capacity;
343 u16 memory_error_information_handle;
344 u16 number_of_memory_devices;
345 u64 extended_maximum_capacity;
346 char eos[2];
347} __attribute__((packed));
348
349struct smbios_type17 {
350 u8 type;
351 u8 length;
352 u16 handle;
353 u16 phys_memory_array_handle;
354 u16 memory_error_information_handle;
355 u16 total_width;
356 u16 data_width;
357 u16 size;
358 u8 form_factor;
359 u8 device_set;
360 u8 device_locator;
361 u8 bank_locator;
362 u8 memory_type;
363 u16 type_detail;
364 u16 speed;
365 u8 manufacturer;
366 u8 serial_number;
367 u8 asset_tag;
368 u8 part_number;
369 u8 attributes;
370 u16 extended_size;
371 u16 clock_speed;
372
373 char eos[2];
374} __attribute__((packed));
375
376struct smbios_type32 {
377 u8 type;
378 u8 length;
379 u16 handle;
380 u8 reserved[6];
381 u8 boot_status;
382 u8 eos[2];
383} __attribute__((packed));
384
Sven Schnelle6d038762012-07-09 08:52:53 +0200385struct smbios_type38 {
386 u8 type;
387 u8 length;
388 u16 handle;
389 u8 interface_type;
390 u8 ipmi_rev;
391 u8 i2c_slave_addr;
392 u8 nv_storage_addr;
393 u64 base_address;
394 u8 base_address_modifier;
395 u8 irq;
396} __attribute__((packed));
397
Stefan Reinauer3d7c6772012-04-02 13:30:10 -0700398typedef enum {
399 SMBIOS_DEVICE_TYPE_OTHER = 0x01,
400 SMBIOS_DEVICE_TYPE_UNKNOWN,
401 SMBIOS_DEVICE_TYPE_VIDEO,
402 SMBIOS_DEVICE_TYPE_SCSI,
403 SMBIOS_DEVICE_TYPE_ETHERNET,
404 SMBIOS_DEVICE_TYPE_TOKEN_RING,
405 SMBIOS_DEVICE_TYPE_SOUND,
406 SMBIOS_DEVICE_TYPE_PATA,
407 SMBIOS_DEVICE_TYPE_SATA,
408 SMBIOS_DEVICE_TYPE_SAS,
409} smbios_onboard_device_type;
410
411struct smbios_type41 {
412 u8 type;
413 u8 length;
414 u16 handle;
415 u8 reference_designation;
416 u8 device_type: 7;
417 u8 device_status: 1;
418 u8 device_type_instance;
419 u16 segment_group_number;
420 u8 bus_number;
421 u8 function_number: 3;
422 u8 device_number: 5;
423 char eos[2];
424} __attribute__((packed));
425
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200426struct smbios_type127 {
427 u8 type;
428 u8 length;
429 u16 handle;
430 u8 eos[2];
431} __attribute__((packed));
432
Timothy Pearson4785f2a2015-03-27 23:05:36 -0500433void smbios_fill_dimm_manufacturer_from_id(uint16_t mod_id, struct smbios_type17 *t);
434
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200435#endif