blob: da38419f67c26fa30ec88fe17d4335eb1ebec652 [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);
Christian Gmeinerac3aa092012-07-25 13:42:40 +020043
Sven Schnelle164bcfd2011-08-14 20:56:34 +020044#define BIOS_CHARACTERISTICS_PCI_SUPPORTED (1 << 7)
45#define BIOS_CHARACTERISTICS_PC_CARD (1 << 8)
46#define BIOS_CHARACTERISTICS_PNP (1 << 9)
47#define BIOS_CHARACTERISTICS_APM (1 << 10)
48#define BIOS_CHARACTERISTICS_UPGRADEABLE (1 << 11)
49#define BIOS_CHARACTERISTICS_SHADOW (1 << 12)
50#define BIOS_CHARACTERISTICS_BOOT_FROM_CD (1 << 15)
51#define BIOS_CHARACTERISTICS_SELECTABLE_BOOT (1 << 16)
52#define BIOS_CHARACTERISTICS_BIOS_SOCKETED (1 << 17)
53
54#define BIOS_EXT1_CHARACTERISTICS_ACPI (1 << 0)
55#define BIOS_EXT2_CHARACTERISTICS_TARGET (1 << 2)
56
Timothy Pearson821217b2015-03-27 22:47:25 -050057#define BIOS_MEMORY_ECC_SINGLE_BIT_CORRECTING (1 << 3)
58#define BIOS_MEMORY_ECC_DOUBLE_BIT_CORRECTING (1 << 4)
59#define BIOS_MEMORY_ECC_SCRUBBING (1 << 5)
60
61#define MEMORY_TYPE_DETAIL_OTHER (1 << 1)
62#define MEMORY_TYPE_DETAIL_UNKNOWN (1 << 2)
63#define MEMORY_TYPE_DETAIL_FAST_PAGED (1 << 3)
64#define MEMORY_TYPE_DETAIL_STATIC_COLUMN (1 << 4)
65#define MEMORY_TYPE_DETAIL_PSEUDO_STATIC (1 << 5)
66#define MEMORY_TYPE_DETAIL_RAMBUS (1 << 6)
67#define MEMORY_TYPE_DETAIL_SYNCHRONOUS (1 << 7)
68#define MEMORY_TYPE_DETAIL_CMOS (1 << 8)
69#define MEMORY_TYPE_DETAIL_EDO (1 << 9)
70#define MEMORY_TYPE_DETAIL_WINDOW_DRAM (1 << 10)
71#define MEMORY_TYPE_DETAIL_CACHE_DRAM (1 << 11)
72#define MEMORY_TYPE_DETAIL_NON_VOLATILE (1 << 12)
73#define MEMORY_TYPE_DETAIL_REGISTERED (1 << 13)
74#define MEMORY_TYPE_DETAIL_UNBUFFERED (1 << 14)
75
Kane Chen33faac62014-07-27 12:54:44 -070076typedef enum {
77 MEMORY_FORMFACTOR_OTHER = 0x01,
78 MEMORY_FORMFACTOR_UNKNOWN = 0x02,
79 MEMORY_FORMFACTOR_SIMM = 0x03,
80 MEMORY_FORMFACTOR_SIP = 0x04,
81 MEMORY_FORMFACTOR_CHIP = 0x05,
82 MEMORY_FORMFACTOR_DIP = 0x06,
83 MEMORY_FORMFACTOR_ZIP = 0x07,
84 MEMORY_FORMFACTOR_PROPRIETARY_CARD = 0x08,
85 MEMORY_FORMFACTOR_DIMM = 0x09,
86 MEMORY_FORMFACTOR_TSOP = 0x0a,
87 MEMORY_FORMFACTOR_ROC = 0x0b,
88 MEMORY_FORMFACTOR_RIMM = 0x0c,
89 MEMORY_FORMFACTOR_SODIMM = 0x0d,
90 MEMORY_FORMFACTOR_SRIMM = 0x0e,
91 MEMORY_FORMFACTOR_FBDIMM = 0x0f,
92} smbios_memory_form_factor;
93
Timothy Pearson821217b2015-03-27 22:47:25 -050094typedef enum {
95 MEMORY_TYPE_OTHER = 0x01,
96 MEMORY_TYPE_UNKNOWN = 0x02,
97 MEMORY_TYPE_DRAM = 0x03,
98 MEMORY_TYPE_EDRAM = 0x04,
99 MEMORY_TYPE_VRAM = 0x05,
100 MEMORY_TYPE_SRAM = 0x06,
101 MEMORY_TYPE_RAM = 0x07,
102 MEMORY_TYPE_ROM = 0x08,
103 MEMORY_TYPE_FLASH = 0x09,
104 MEMORY_TYPE_EEPROM = 0x0a,
105 MEMORY_TYPE_FEPROM = 0x0b,
106 MEMORY_TYPE_EPROM = 0x0c,
107 MEMORY_TYPE_CDRAM = 0x0d,
108 MEMORY_TYPE_3DRAM = 0x0e,
109 MEMORY_TYPE_SDRAM = 0x0f,
110 MEMORY_TYPE_SGRAM = 0x10,
111 MEMORY_TYPE_RDRAM = 0x11,
112 MEMORY_TYPE_DDR = 0x12,
113 MEMORY_TYPE_DDR2 = 0x13,
114 MEMORY_TYPE_DDR2_FBDIMM = 0x14,
115 MEMORY_TYPE_DDR3 = 0x18,
116 MEMORY_TYPE_FBD2 = 0x19,
117} smbios_memory_type;
118
119typedef enum {
120 MEMORY_ARRAY_LOCATION_OTHER = 0x01,
121 MEMORY_ARRAY_LOCATION_UNKNOWN = 0x02,
122 MEMORY_ARRAY_LOCATION_SYSTEM_BOARD = 0x03,
123 MEMORY_ARRAY_LOCATION_ISA_ADD_ON = 0x04,
124 MEMORY_ARRAY_LOCATION_EISA_ADD_ON = 0x05,
125 MEMORY_ARRAY_LOCATION_PCI_ADD_ON = 0x06,
126 MEMORY_ARRAY_LOCATION_MCA_ADD_ON = 0x07,
127 MEMORY_ARRAY_LOCATION_PCMCIA_ADD_ON = 0x08,
128 MEMORY_ARRAY_LOCATION_PROPRIETARY_ADD_ON = 0x09,
129 MEMORY_ARRAY_LOCATION_NUBUS = 0x0a,
130 MEMORY_ARRAY_LOCATION_PC_98_C20_ADD_ON = 0xa0,
131 MEMORY_ARRAY_LOCATION_PC_98_C24_ADD_ON = 0xa1,
132 MEMORY_ARRAY_LOCATION_PC_98_E_ADD_ON = 0xa2,
133 MEMORY_ARRAY_LOCATION_PC_98_LOCAL_BUS_ADD_ON = 0xa3,
134} smbios_memory_array_location;
135
136typedef enum {
137 MEMORY_ARRAY_USE_OTHER = 0x01,
138 MEMORY_ARRAY_USE_UNKNOWN = 0x02,
139 MEMORY_ARRAY_USE_SYSTEM = 0x03,
140 MEMORY_ARRAY_USE_VIDEO = 0x04,
141 MEMORY_ARRAY_USE_FLASH = 0x05,
142 MEMORY_ARRAY_USE_NVRAM = 0x06,
143 MEMORY_ARRAY_USE_CACHE = 0x07,
144} smbios_memory_array_use;
145
146typedef enum {
147 MEMORY_ARRAY_ECC_OTHER = 0x01,
148 MEMORY_ARRAY_ECC_UNKNOWN = 0x02,
149 MEMORY_ARRAY_ECC_NONE = 0x03,
150 MEMORY_ARRAY_ECC_PARITY = 0x04,
151 MEMORY_ARRAY_ECC_SINGLE_BIT = 0x05,
152 MEMORY_ARRAY_ECC_MULTI_BIT = 0x06,
153 MEMORY_ARRAY_ECC_CRC = 0x07,
154} smbios_memory_array_ecc;
155
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200156#define SMBIOS_STATE_SAFE 3
157typedef enum {
158 SMBIOS_BIOS_INFORMATION=0,
159 SMBIOS_SYSTEM_INFORMATION=1,
Vladimir Serbinenko47089f22014-03-02 19:14:44 +0100160 SMBIOS_BOARD_INFORMATION=2,
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200161 SMBIOS_SYSTEM_ENCLOSURE=3,
162 SMBIOS_PROCESSOR_INFORMATION=4,
163 SMBIOS_CACHE_INFORMATION=7,
164 SMBIOS_SYSTEM_SLOTS=9,
Peter Stugec392b642013-07-06 19:51:12 +0200165 SMBIOS_OEM_STRINGS=11,
Duncan Laurie472ec9c2012-06-23 16:13:42 -0700166 SMBIOS_EVENT_LOG=15,
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200167 SMBIOS_PHYS_MEMORY_ARRAY=16,
168 SMBIOS_MEMORY_DEVICE=17,
169 SMBIOS_MEMORY_ARRAY_MAPPED_ADDRESS=19,
170 SMBIOS_SYSTEM_BOOT_INFORMATION=32,
Stefan Reinauer3d7c6772012-04-02 13:30:10 -0700171 SMBIOS_ONBOARD_DEVICES_EXTENDED_INFORMATION=41,
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200172 SMBIOS_END_OF_TABLE=127,
173} smbios_struct_type_t;
174
175struct smbios_entry {
176 u8 anchor[4];
177 u8 checksum;
178 u8 length;
179 u8 major_version;
180 u8 minor_version;
181 u16 max_struct_size;
182 u8 entry_point_rev;
183 u8 formwatted_area[5];
184 u8 intermediate_anchor_string[5];
185 u8 intermediate_checksum;
186 u16 struct_table_length;
187 u32 struct_table_address;
188 u16 struct_count;
189 u8 smbios_bcd_revision;
190} __attribute__((packed));
191
192struct smbios_type0 {
193 u8 type;
194 u8 length;
195 u16 handle;
196 u8 vendor;
197 u8 bios_version;
198 u16 bios_start_segment;
199 u8 bios_release_date;
200 u8 bios_rom_size;
201 u64 bios_characteristics;
202 u8 bios_characteristics_ext1;
203 u8 bios_characteristics_ext2;
204 u8 system_bios_major_release;
205 u8 system_bios_minor_release;
206 u8 ec_major_release;
207 u8 ec_minor_release;
208 char eos[2];
209} __attribute__((packed));
210
211struct smbios_type1 {
212 u8 type;
213 u8 length;
214 u16 handle;
215 u8 manufacturer;
216 u8 product_name;
217 u8 version;
218 u8 serial_number;
219 u8 uuid[16];
220 u8 wakeup_type;
221 u8 sku;
222 u8 family;
223 char eos[2];
224} __attribute__((packed));
225
Vladimir Serbinenko47089f22014-03-02 19:14:44 +0100226struct smbios_type2 {
227 u8 type;
228 u8 length;
229 u16 handle;
230 u8 manufacturer;
231 u8 product_name;
232 u8 version;
233 u8 serial_number;
234 char eos[2];
235} __attribute__((packed));
236
Vladimir Serbinenko71c0bf62014-08-27 23:23:14 +0200237enum
238{
239 SMBIOS_ENCLOSURE_DESKTOP = 3,
240 SMBIOS_ENCLOSURE_NOTEBOOK = 9,
241};
242
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200243struct smbios_type3 {
244 u8 type;
245 u8 length;
246 u16 handle;
247 u8 manufacturer;
248 u8 _type;
249 u8 version;
250 u8 serial_number;
251 u8 asset_tag_number;
252 u8 bootup_state;
253 u8 power_supply_state;
254 u8 thermal_state;
255 u8 security_status;
256 u32 oem_defined;
257 u8 height;
258 u8 number_of_power_cords;
259 u8 element_count;
260 u8 element_record_length;
261 char eos[2];
262} __attribute__((packed));
263
264struct smbios_type4 {
265 u8 type;
266 u8 length;
267 u16 handle;
268 u8 socket_designation;
269 u8 processor_type;
270 u8 processor_family;
271 u8 processor_manufacturer;
272 u32 processor_id[2];
273 u8 processor_version;
274 u8 voltage;
275 u16 external_clock;
276 u16 max_speed;
277 u16 current_speed;
278 u8 status;
279 u8 processor_upgrade;
280 u16 l1_cache_handle;
281 u16 l2_cache_handle;
282 u16 l3_cache_handle;
283 u8 serial_number;
284 u8 asset_tag;
285 u8 part_number;
286 u8 core_count;
287 u8 core_enabled;
288 u8 thread_count;
289 u16 processor_characteristics;
290 u16 processor_family2;
291 char eos[2];
292} __attribute__((packed));
293
Peter Stugec392b642013-07-06 19:51:12 +0200294struct smbios_type11 {
295 u8 type;
296 u8 length;
297 u16 handle;
298 u8 count;
299 char eos[2];
300} __attribute__((packed));
301
Duncan Laurie472ec9c2012-06-23 16:13:42 -0700302struct smbios_type15 {
303 u8 type;
304 u8 length;
305 u16 handle;
306 u16 area_length;
307 u16 header_offset;
308 u16 data_offset;
309 u8 access_method;
310 u8 log_status;
311 u32 change_token;
312 u32 address;
313 u8 header_format;
314 u8 log_type_descriptors;
315 u8 log_type_descriptor_length;
316 char eos[2];
317} __attribute__((packed));
318
319enum {
320 SMBIOS_EVENTLOG_ACCESS_METHOD_IO8 = 0,
321 SMBIOS_EVENTLOG_ACCESS_METHOD_IO8X2,
322 SMBIOS_EVENTLOG_ACCESS_METHOD_IO16,
323 SMBIOS_EVENTLOG_ACCESS_METHOD_MMIO32,
324 SMBIOS_EVENTLOG_ACCESS_METHOD_GPNV,
325};
326
327enum {
328 SMBIOS_EVENTLOG_STATUS_VALID = 1, /* Bit 0 */
329 SMBIOS_EVENTLOG_STATUS_FULL = 2, /* Bit 1 */
330};
331
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200332struct smbios_type16 {
333 u8 type;
334 u8 length;
335 u16 handle;
336 u8 location;
337 u8 use;
338 u8 memory_error_correction;
339 u32 maximum_capacity;
340 u16 memory_error_information_handle;
341 u16 number_of_memory_devices;
342 u64 extended_maximum_capacity;
343 char eos[2];
344} __attribute__((packed));
345
346struct smbios_type17 {
347 u8 type;
348 u8 length;
349 u16 handle;
350 u16 phys_memory_array_handle;
351 u16 memory_error_information_handle;
352 u16 total_width;
353 u16 data_width;
354 u16 size;
355 u8 form_factor;
356 u8 device_set;
357 u8 device_locator;
358 u8 bank_locator;
359 u8 memory_type;
360 u16 type_detail;
361 u16 speed;
362 u8 manufacturer;
363 u8 serial_number;
364 u8 asset_tag;
365 u8 part_number;
366 u8 attributes;
367 u16 extended_size;
368 u16 clock_speed;
369
370 char eos[2];
371} __attribute__((packed));
372
373struct smbios_type32 {
374 u8 type;
375 u8 length;
376 u16 handle;
377 u8 reserved[6];
378 u8 boot_status;
379 u8 eos[2];
380} __attribute__((packed));
381
Sven Schnelle6d038762012-07-09 08:52:53 +0200382struct smbios_type38 {
383 u8 type;
384 u8 length;
385 u16 handle;
386 u8 interface_type;
387 u8 ipmi_rev;
388 u8 i2c_slave_addr;
389 u8 nv_storage_addr;
390 u64 base_address;
391 u8 base_address_modifier;
392 u8 irq;
393} __attribute__((packed));
394
Stefan Reinauer3d7c6772012-04-02 13:30:10 -0700395typedef enum {
396 SMBIOS_DEVICE_TYPE_OTHER = 0x01,
397 SMBIOS_DEVICE_TYPE_UNKNOWN,
398 SMBIOS_DEVICE_TYPE_VIDEO,
399 SMBIOS_DEVICE_TYPE_SCSI,
400 SMBIOS_DEVICE_TYPE_ETHERNET,
401 SMBIOS_DEVICE_TYPE_TOKEN_RING,
402 SMBIOS_DEVICE_TYPE_SOUND,
403 SMBIOS_DEVICE_TYPE_PATA,
404 SMBIOS_DEVICE_TYPE_SATA,
405 SMBIOS_DEVICE_TYPE_SAS,
406} smbios_onboard_device_type;
407
408struct smbios_type41 {
409 u8 type;
410 u8 length;
411 u16 handle;
412 u8 reference_designation;
413 u8 device_type: 7;
414 u8 device_status: 1;
415 u8 device_type_instance;
416 u16 segment_group_number;
417 u8 bus_number;
418 u8 function_number: 3;
419 u8 device_number: 5;
420 char eos[2];
421} __attribute__((packed));
422
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200423struct smbios_type127 {
424 u8 type;
425 u8 length;
426 u16 handle;
427 u8 eos[2];
428} __attribute__((packed));
429
430#endif