blob: 9217f5eaa04135e540107f2963443842e075bd97 [file] [log] [blame]
Angel Pons32859fc2020-04-02 23:48:27 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Timothy Pearson821217b2015-03-27 22:47:25 -05002
Sven Schnelle164bcfd2011-08-14 20:56:34 +02003#ifndef SMBIOS_H
4#define SMBIOS_H
5
6#include <types.h>
Lijian Zhao10ea93c2019-04-11 00:45:10 -07007#include <memory_info.h>
Sven Schnelle164bcfd2011-08-14 20:56:34 +02008
9unsigned long smbios_write_tables(unsigned long start);
Konstantin Aladyshevd0df1d72017-08-01 15:52:46 +030010int smbios_add_string(u8 *start, const char *str);
11int smbios_string_table_len(u8 *start);
Sven Schnelle164bcfd2011-08-14 20:56:34 +020012
Angel Ponsa37701a2021-06-28 17:36:53 +020013struct smbios_header;
14int smbios_full_table_len(struct smbios_header *header, u8 *str_table_start);
Angel Ponsd62a5012021-06-28 17:18:06 +020015void *smbios_carve_table(unsigned long start, u8 type, u8 length, u16 handle);
16
Duncan Laurie21a78702013-05-23 14:17:05 -070017/* Used by mainboard to add an on-board device */
Lijian Zhaoe98a7512019-04-11 23:28:09 -070018enum misc_slot_type;
19enum misc_slot_length;
20enum misc_slot_usage;
21enum slot_data_bus_bandwidth;
22int smbios_write_type9(unsigned long *current, int *handle,
23 const char *name, const enum misc_slot_type type,
24 const enum slot_data_bus_bandwidth bandwidth,
25 const enum misc_slot_usage usage,
26 const enum misc_slot_length length,
JingleHsuWiwynn20fa59f2021-01-26 09:55:34 +080027 const u16 id, u8 slot_char1, u8 slot_char2, u8 bus, u8 dev_func);
Patrick Rudolphfe98e902018-03-27 16:17:12 +020028enum smbios_bmc_interface_type;
29int smbios_write_type38(unsigned long *current, int *handle,
30 const enum smbios_bmc_interface_type interface_type,
31 const u8 ipmi_rev, const u8 i2c_addr, const u8 nv_addr,
32 const u64 base_addr, const u8 base_modifier,
33 const u8 irq);
Duncan Laurie21a78702013-05-23 14:17:05 -070034int smbios_write_type41(unsigned long *current, int *handle,
35 const char *name, u8 instance, u16 segment,
Christian Waltere6afab12019-05-21 17:22:49 +020036 u8 bus, u8 device, u8 function, u8 device_type);
Erik van den Bogaert93781522022-09-28 12:35:51 +020037enum smbios_temp_location;
38enum smbios_temp_status;
39int smbios_write_type28(unsigned long *current, int *handle,
40 const char *name,
41 const enum smbios_temp_location location,
42 const enum smbios_temp_status status,
43 u16 max_value, u16 min_value,
44 u16 resolution, u16 tolerance,
45 u16 accuracy,
46 u32 oem,
47 u16 nominal_value);
Duncan Laurie21a78702013-05-23 14:17:05 -070048
Michał Żygowskie7795232022-05-04 14:10:45 +020049int smbios_write_type43(unsigned long *current, int *handle, const u32 vendor_id,
50 const u8 major_spec_ver, const u8 minor_spec_ver,
51 const u32 fw_ver1, const u32 fw_ver2, const char *description,
52 const u64 characteristics, const u32 oem_defined);
53
Angel Pons6a73b242021-09-03 12:18:10 +020054struct device;
55int get_smbios_data(struct device *dev, int *handle, unsigned long *current);
56
Nico Huberebd8a4f2017-11-01 09:49:16 +010057const char *smbios_system_manufacturer(void);
58const char *smbios_system_product_name(void);
59const char *smbios_system_serial_number(void);
60const char *smbios_system_version(void);
61void smbios_system_set_uuid(u8 *uuid);
62const char *smbios_system_sku(void);
63
Andrey Petrov2e032f02019-10-23 15:31:51 -070064unsigned int smbios_cpu_get_max_speed_mhz(void);
65unsigned int smbios_cpu_get_current_speed_mhz(void);
Patrick Rudolphb01ac7e2020-07-26 14:23:37 +020066unsigned int smbios_cpu_get_voltage(void);
Andrey Petrov2e032f02019-10-23 15:31:51 -070067
Gerd Hoffmann06262742013-11-13 13:37:23 +010068const char *smbios_mainboard_manufacturer(void);
69const char *smbios_mainboard_product_name(void);
Christian Gmeinerac3aa092012-07-25 13:42:40 +020070const char *smbios_mainboard_serial_number(void);
71const char *smbios_mainboard_version(void);
Nico Huberebd8a4f2017-11-01 09:49:16 +010072
Vladimir Serbinenko63acd222014-06-01 00:26:48 +020073const char *smbios_mainboard_bios_version(void);
Julien Viard de Galbert9a31dfe2018-02-22 16:39:58 +010074const char *smbios_mainboard_asset_tag(void);
75u8 smbios_mainboard_feature_flags(void);
76const char *smbios_mainboard_location_in_chassis(void);
Johnny Lind3440542020-01-30 18:21:22 +080077const char *smbios_chassis_version(void);
78const char *smbios_chassis_serial_number(void);
79const char *smbios_processor_serial_number(void);
JingleHsuWiwynn4330b962021-01-28 09:13:42 +080080u8 smbios_chassis_power_cords(void);
Christian Gmeinerac3aa092012-07-25 13:42:40 +020081
Kyösti Mälkki0fcbd3a2020-12-20 08:27:21 +020082/* This string could be filled late in payload. */
83void smbios_type0_bios_version(uintptr_t address);
84
Tim Chuf2f53c42020-09-07 02:30:19 -070085void smbios_ec_revision(uint8_t *ec_major_revision, uint8_t *ec_minor_revision);
86
Morgan Jang92bcc4f2020-07-24 10:36:18 +080087unsigned int smbios_processor_external_clock(void);
88unsigned int smbios_processor_characteristics(void);
89struct cpuid_result;
90unsigned int smbios_processor_family(struct cpuid_result res);
91
Morgan Jang8ae391d2020-10-06 16:26:17 +080092unsigned int smbios_cache_error_correction_type(u8 level);
93unsigned int smbios_cache_sram_type(void);
94unsigned int smbios_cache_conf_operation_mode(u8 level);
95
BryantOu4a8e58f2020-04-20 19:45:20 -070096/* Used by mainboard to add port information of type 8 */
97struct port_information;
98int smbios_write_type8(unsigned long *current, int *handle,
99 const struct port_information *port,
100 size_t num_ports);
101
Elyes HAOUAS3233cf42019-02-14 17:46:02 +0100102#define BIOS_CHARACTERISTICS_PCI_SUPPORTED (1 << 7)
103#define BIOS_CHARACTERISTICS_PC_CARD (1 << 8)
104#define BIOS_CHARACTERISTICS_PNP (1 << 9)
105#define BIOS_CHARACTERISTICS_APM (1 << 10)
106#define BIOS_CHARACTERISTICS_UPGRADEABLE (1 << 11)
107#define BIOS_CHARACTERISTICS_SHADOW (1 << 12)
108#define BIOS_CHARACTERISTICS_BOOT_FROM_CD (1 << 15)
109#define BIOS_CHARACTERISTICS_SELECTABLE_BOOT (1 << 16)
110#define BIOS_CHARACTERISTICS_BIOS_SOCKETED (1 << 17)
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200111
Elyes HAOUAS3233cf42019-02-14 17:46:02 +0100112#define BIOS_EXT1_CHARACTERISTICS_ACPI (1 << 0)
113#define BIOS_EXT2_CHARACTERISTICS_TARGET (1 << 2)
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200114
Timothy Pearson821217b2015-03-27 22:47:25 -0500115#define BIOS_MEMORY_ECC_SINGLE_BIT_CORRECTING (1 << 3)
116#define BIOS_MEMORY_ECC_DOUBLE_BIT_CORRECTING (1 << 4)
117#define BIOS_MEMORY_ECC_SCRUBBING (1 << 5)
118
119#define MEMORY_TYPE_DETAIL_OTHER (1 << 1)
120#define MEMORY_TYPE_DETAIL_UNKNOWN (1 << 2)
121#define MEMORY_TYPE_DETAIL_FAST_PAGED (1 << 3)
122#define MEMORY_TYPE_DETAIL_STATIC_COLUMN (1 << 4)
123#define MEMORY_TYPE_DETAIL_PSEUDO_STATIC (1 << 5)
124#define MEMORY_TYPE_DETAIL_RAMBUS (1 << 6)
125#define MEMORY_TYPE_DETAIL_SYNCHRONOUS (1 << 7)
126#define MEMORY_TYPE_DETAIL_CMOS (1 << 8)
127#define MEMORY_TYPE_DETAIL_EDO (1 << 9)
128#define MEMORY_TYPE_DETAIL_WINDOW_DRAM (1 << 10)
129#define MEMORY_TYPE_DETAIL_CACHE_DRAM (1 << 11)
130#define MEMORY_TYPE_DETAIL_NON_VOLATILE (1 << 12)
131#define MEMORY_TYPE_DETAIL_REGISTERED (1 << 13)
132#define MEMORY_TYPE_DETAIL_UNBUFFERED (1 << 14)
Elyes HAOUAS1db23462019-02-14 17:49:47 +0100133#define MEMORY_TYPE_DETAIL_LRDIMM (1 << 15)
134
135#define MEMORY_TECHNOLOGY_OTHER 0x01
136#define MEMORY_TECHNOLOGY_UNKNOWN 0x02
137#define MEMORY_TECHNOLOGY_DRAM 0x03
138#define MEMORY_TECHNOLOGY_NVDIMM_N 0x04
139#define MEMORY_TECHNOLOGY_NVDIMM_F 0x05
140#define MEMORY_TECHNOLOGY_NVDIMM_P 0x06
141#define MEMORY_TECHNOLOGY_INTEL_PERSISTENT 0x07
142
143#define MEMORY_OPERATING_MODE_CAP_OTHER (1 << 1)
144#define MEMORY_OPERATING_MODE_CAP_UNKNOWN (1 << 2)
145#define MEMORY_OPERATING_MODE_CAP_VOLATILE (1 << 3)
146#define MEMORY_OPERATING_MODE_CAP_BYTE_ACCESS_PERSISTENT (1 << 4)
147#define MEMORY_OPERATING_MODE_CAP_BLOCK_ACCESS_PERSISTENT (1 << 5)
Timothy Pearson821217b2015-03-27 22:47:25 -0500148
Kane Chen33faac62014-07-27 12:54:44 -0700149typedef enum {
Lee Leahy0be6d932015-06-26 11:15:42 -0700150 MEMORY_BUS_WIDTH_8 = 0,
151 MEMORY_BUS_WIDTH_16 = 1,
152 MEMORY_BUS_WIDTH_32 = 2,
153 MEMORY_BUS_WIDTH_64 = 3,
154 MEMORY_BUS_WIDTH_128 = 4,
155 MEMORY_BUS_WIDTH_256 = 5,
156 MEMORY_BUS_WIDTH_512 = 6,
157 MEMORY_BUS_WIDTH_1024 = 7,
158 MEMORY_BUS_WIDTH_MAX = 7,
159} smbios_memory_bus_width;
160
161typedef enum {
Kane Chen33faac62014-07-27 12:54:44 -0700162 MEMORY_FORMFACTOR_OTHER = 0x01,
163 MEMORY_FORMFACTOR_UNKNOWN = 0x02,
164 MEMORY_FORMFACTOR_SIMM = 0x03,
165 MEMORY_FORMFACTOR_SIP = 0x04,
166 MEMORY_FORMFACTOR_CHIP = 0x05,
167 MEMORY_FORMFACTOR_DIP = 0x06,
168 MEMORY_FORMFACTOR_ZIP = 0x07,
169 MEMORY_FORMFACTOR_PROPRIETARY_CARD = 0x08,
170 MEMORY_FORMFACTOR_DIMM = 0x09,
171 MEMORY_FORMFACTOR_TSOP = 0x0a,
172 MEMORY_FORMFACTOR_ROC = 0x0b,
173 MEMORY_FORMFACTOR_RIMM = 0x0c,
174 MEMORY_FORMFACTOR_SODIMM = 0x0d,
175 MEMORY_FORMFACTOR_SRIMM = 0x0e,
176 MEMORY_FORMFACTOR_FBDIMM = 0x0f,
Elyes HAOUAS86b683a2019-10-08 16:30:43 +0200177 MEMORY_FORMFACTOR_DIE = 0x10,
Kane Chen33faac62014-07-27 12:54:44 -0700178} smbios_memory_form_factor;
179
Timothy Pearson821217b2015-03-27 22:47:25 -0500180typedef enum {
181 MEMORY_TYPE_OTHER = 0x01,
182 MEMORY_TYPE_UNKNOWN = 0x02,
183 MEMORY_TYPE_DRAM = 0x03,
184 MEMORY_TYPE_EDRAM = 0x04,
185 MEMORY_TYPE_VRAM = 0x05,
186 MEMORY_TYPE_SRAM = 0x06,
187 MEMORY_TYPE_RAM = 0x07,
188 MEMORY_TYPE_ROM = 0x08,
189 MEMORY_TYPE_FLASH = 0x09,
190 MEMORY_TYPE_EEPROM = 0x0a,
191 MEMORY_TYPE_FEPROM = 0x0b,
192 MEMORY_TYPE_EPROM = 0x0c,
193 MEMORY_TYPE_CDRAM = 0x0d,
194 MEMORY_TYPE_3DRAM = 0x0e,
195 MEMORY_TYPE_SDRAM = 0x0f,
196 MEMORY_TYPE_SGRAM = 0x10,
197 MEMORY_TYPE_RDRAM = 0x11,
198 MEMORY_TYPE_DDR = 0x12,
199 MEMORY_TYPE_DDR2 = 0x13,
200 MEMORY_TYPE_DDR2_FBDIMM = 0x14,
201 MEMORY_TYPE_DDR3 = 0x18,
202 MEMORY_TYPE_FBD2 = 0x19,
Elyes HAOUAS28114ae2018-11-14 17:51:00 +0100203 MEMORY_TYPE_DDR4 = 0x1a,
204 MEMORY_TYPE_LPDDR = 0x1b,
205 MEMORY_TYPE_LPDDR2 = 0x1c,
206 MEMORY_TYPE_LPDDR3 = 0x1d,
207 MEMORY_TYPE_LPDDR4 = 0x1e,
208 MEMORY_TYPE_LOGICAL_NON_VOLATILE_DEVICE = 0x1f,
Elyes HAOUAS86b683a2019-10-08 16:30:43 +0200209 MEMORY_TYPE_HBM = 0x20,
210 MEMORY_TYPE_HBM2 = 0x21,
Subrata Banik6cdc8382021-10-27 23:04:07 +0530211 MEMORY_TYPE_DDR5 = 0x22,
212 MEMORY_TYPE_LPDDR5 = 0x23,
Elyes Haouas5bbdb0c2022-06-23 13:38:26 +0200213 MEMORY_TYPE_HBM3 = 0x24,
Timothy Pearson821217b2015-03-27 22:47:25 -0500214} smbios_memory_type;
215
216typedef enum {
217 MEMORY_ARRAY_LOCATION_OTHER = 0x01,
218 MEMORY_ARRAY_LOCATION_UNKNOWN = 0x02,
219 MEMORY_ARRAY_LOCATION_SYSTEM_BOARD = 0x03,
220 MEMORY_ARRAY_LOCATION_ISA_ADD_ON = 0x04,
221 MEMORY_ARRAY_LOCATION_EISA_ADD_ON = 0x05,
222 MEMORY_ARRAY_LOCATION_PCI_ADD_ON = 0x06,
223 MEMORY_ARRAY_LOCATION_MCA_ADD_ON = 0x07,
224 MEMORY_ARRAY_LOCATION_PCMCIA_ADD_ON = 0x08,
225 MEMORY_ARRAY_LOCATION_PROPRIETARY_ADD_ON = 0x09,
226 MEMORY_ARRAY_LOCATION_NUBUS = 0x0a,
227 MEMORY_ARRAY_LOCATION_PC_98_C20_ADD_ON = 0xa0,
228 MEMORY_ARRAY_LOCATION_PC_98_C24_ADD_ON = 0xa1,
229 MEMORY_ARRAY_LOCATION_PC_98_E_ADD_ON = 0xa2,
230 MEMORY_ARRAY_LOCATION_PC_98_LOCAL_BUS_ADD_ON = 0xa3,
Elyes HAOUAS77fe2132019-10-29 08:42:03 +0100231 MEMORY_ARRAY_LOCATION_CXL_FLEXBUS_1_0_ADD_ON = 0xa4,
Timothy Pearson821217b2015-03-27 22:47:25 -0500232} smbios_memory_array_location;
233
234typedef enum {
235 MEMORY_ARRAY_USE_OTHER = 0x01,
236 MEMORY_ARRAY_USE_UNKNOWN = 0x02,
237 MEMORY_ARRAY_USE_SYSTEM = 0x03,
238 MEMORY_ARRAY_USE_VIDEO = 0x04,
239 MEMORY_ARRAY_USE_FLASH = 0x05,
240 MEMORY_ARRAY_USE_NVRAM = 0x06,
241 MEMORY_ARRAY_USE_CACHE = 0x07,
242} smbios_memory_array_use;
243
244typedef enum {
245 MEMORY_ARRAY_ECC_OTHER = 0x01,
246 MEMORY_ARRAY_ECC_UNKNOWN = 0x02,
247 MEMORY_ARRAY_ECC_NONE = 0x03,
248 MEMORY_ARRAY_ECC_PARITY = 0x04,
249 MEMORY_ARRAY_ECC_SINGLE_BIT = 0x05,
250 MEMORY_ARRAY_ECC_MULTI_BIT = 0x06,
251 MEMORY_ARRAY_ECC_CRC = 0x07,
252} smbios_memory_array_ecc;
253
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200254#define SMBIOS_STATE_SAFE 3
255typedef enum {
Elyes HAOUASa0fed372016-09-16 20:17:40 +0200256 SMBIOS_BIOS_INFORMATION = 0,
257 SMBIOS_SYSTEM_INFORMATION = 1,
258 SMBIOS_BOARD_INFORMATION = 2,
259 SMBIOS_SYSTEM_ENCLOSURE = 3,
260 SMBIOS_PROCESSOR_INFORMATION = 4,
261 SMBIOS_CACHE_INFORMATION = 7,
BryantOu4a8e58f2020-04-20 19:45:20 -0700262 SMBIOS_PORT_CONNECTOR_INFORMATION = 8,
Elyes HAOUASa0fed372016-09-16 20:17:40 +0200263 SMBIOS_SYSTEM_SLOTS = 9,
264 SMBIOS_OEM_STRINGS = 11,
265 SMBIOS_EVENT_LOG = 15,
266 SMBIOS_PHYS_MEMORY_ARRAY = 16,
267 SMBIOS_MEMORY_DEVICE = 17,
268 SMBIOS_MEMORY_ARRAY_MAPPED_ADDRESS = 19,
Matt DeVillierd1c1afd2016-09-02 21:41:26 -0500269 SMBIOS_MEMORY_DEVICE_MAPPED_ADDRESS = 20,
Erik van den Bogaert93781522022-09-28 12:35:51 +0200270 SMBIOS_TEMPERATURE_PROBE = 28,
Elyes HAOUASa0fed372016-09-16 20:17:40 +0200271 SMBIOS_SYSTEM_BOOT_INFORMATION = 32,
Patrick Rudolphfe98e902018-03-27 16:17:12 +0200272 SMBIOS_IPMI_DEVICE_INFORMATION = 38,
Jonathan Zhangd57b8212022-10-14 17:06:26 -0700273 SMBIOS_SYSTEM_POWER_SUPPLY = 39,
Elyes HAOUASa0fed372016-09-16 20:17:40 +0200274 SMBIOS_ONBOARD_DEVICES_EXTENDED_INFORMATION = 41,
Michał Żygowskie7795232022-05-04 14:10:45 +0200275 SMBIOS_TPM_DEVICE = 43,
Elyes HAOUASa0fed372016-09-16 20:17:40 +0200276 SMBIOS_END_OF_TABLE = 127,
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200277} smbios_struct_type_t;
278
279struct smbios_entry {
280 u8 anchor[4];
281 u8 checksum;
282 u8 length;
283 u8 major_version;
284 u8 minor_version;
285 u16 max_struct_size;
286 u8 entry_point_rev;
287 u8 formwatted_area[5];
288 u8 intermediate_anchor_string[5];
289 u8 intermediate_checksum;
290 u16 struct_table_length;
291 u32 struct_table_address;
292 u16 struct_count;
293 u8 smbios_bcd_revision;
Stefan Reinauer6a001132017-07-13 02:20:27 +0200294} __packed;
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200295
Patrick Rudolph7a835822020-07-22 16:00:53 +0200296struct smbios_entry30 {
297 u8 anchor[5];
298 u8 checksum;
299 u8 length;
300 u8 major_version;
301 u8 minor_version;
302 u8 smbios_doc_rev;
303 u8 entry_point_rev;
304 u8 reserved;
305 u32 struct_table_length;
306 u64 struct_table_address;
307} __packed;
308
Angel Ponsca01baa2021-06-28 16:06:28 +0200309struct smbios_header {
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200310 u8 type;
311 u8 length;
312 u16 handle;
Angel Ponsca01baa2021-06-28 16:06:28 +0200313} __packed;
314
315struct smbios_type0 {
Angel Ponsb554b7c2021-06-28 17:42:40 +0200316 struct smbios_header header;
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200317 u8 vendor;
318 u8 bios_version;
319 u16 bios_start_segment;
320 u8 bios_release_date;
321 u8 bios_rom_size;
322 u64 bios_characteristics;
323 u8 bios_characteristics_ext1;
324 u8 bios_characteristics_ext2;
325 u8 system_bios_major_release;
326 u8 system_bios_minor_release;
327 u8 ec_major_release;
328 u8 ec_minor_release;
Elyes HAOUAS358cbb32019-02-14 14:19:22 +0100329 u16 extended_bios_rom_size;
Konstantin Aladyshevd0df1d72017-08-01 15:52:46 +0300330 u8 eos[2];
Stefan Reinauer6a001132017-07-13 02:20:27 +0200331} __packed;
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200332
Tim Chu13ab1d72021-10-19 01:45:12 +0000333typedef enum {
334 SMBIOS_WAKEUP_TYPE_RESERVED = 0x00,
335 SMBIOS_WAKEUP_TYPE_OTHER = 0x01,
336 SMBIOS_WAKEUP_TYPE_UNKNOWN = 0x02,
337 SMBIOS_WAKEUP_TYPE_APM_TIMER = 0x03,
338 SMBIOS_WAKEUP_TYPE_MODEM_RING = 0x04,
339 SMBIOS_WAKEUP_TYPE_LAN_REMOTE = 0x05,
340 SMBIOS_WAKEUP_TYPE_POWER_SWITCH = 0x06,
341 SMBIOS_WAKEUP_TYPE_PCI_PME = 0x07,
342 SMBIOS_WAKEUP_TYPE_AC_POWER_RESTORED = 0x08,
343} smbios_wakeup_type;
344
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200345struct smbios_type1 {
Angel Ponsb554b7c2021-06-28 17:42:40 +0200346 struct smbios_header header;
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200347 u8 manufacturer;
348 u8 product_name;
349 u8 version;
350 u8 serial_number;
351 u8 uuid[16];
352 u8 wakeup_type;
353 u8 sku;
354 u8 family;
Konstantin Aladyshevd0df1d72017-08-01 15:52:46 +0300355 u8 eos[2];
Stefan Reinauer6a001132017-07-13 02:20:27 +0200356} __packed;
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200357
Tim Chue82aa222020-12-21 23:33:18 -0800358#define SMBIOS_FEATURE_FLAGS_HOSTING_BOARD (1 << 0)
359#define SMBIOS_FEATURE_FLAGS_REQUIRES_DAUGHTER_CARD (1 << 1)
360#define SMBIOS_FEATURE_FLAGS_REMOVABLE (1 << 2)
361#define SMBIOS_FEATURE_FLAGS_REPLACEABLE (1 << 3)
362#define SMBIOS_FEATURE_FLAGS_HOT_SWAPPABLE (1 << 4)
363
Julien Viard de Galbert9a31dfe2018-02-22 16:39:58 +0100364typedef enum {
365 SMBIOS_BOARD_TYPE_UNKNOWN = 0x01,
366 SMBIOS_BOARD_TYPE_OTHER = 0x02,
367 SMBIOS_BOARD_TYPE_SERVER_BLADE = 0x03,
368 SMBIOS_BOARD_TYPE_CONNECTIVITY_SWITCH = 0x04,
369 SMBIOS_BOARD_TYPE_SYSTEM_MANAGEMENT_MODULE = 0x05,
370 SMBIOS_BOARD_TYPE_PROCESSOR_MODULE = 0x06,
371 SMBIOS_BOARD_TYPE_IO_MODULE = 0x07,
372 SMBIOS_BOARD_TYPE_MEMORY_MODULE = 0x08,
373 SMBIOS_BOARD_TYPE_DAUGHTER_BOARD = 0x09,
374 SMBIOS_BOARD_TYPE_MOTHERBOARD = 0x0a,
375 SMBIOS_BOARD_TYPE_PROCESSOR_MEMORY_MODULE = 0x0b,
376 SMBIOS_BOARD_TYPE_PROCESSOR_IO_MODULE = 0x0c,
377 SMBIOS_BOARD_TYPE_INTERCONNECT_BOARD = 0x0d,
378} smbios_board_type;
379
Vladimir Serbinenko47089f22014-03-02 19:14:44 +0100380struct smbios_type2 {
Angel Ponsb554b7c2021-06-28 17:42:40 +0200381 struct smbios_header header;
Vladimir Serbinenko47089f22014-03-02 19:14:44 +0100382 u8 manufacturer;
383 u8 product_name;
384 u8 version;
385 u8 serial_number;
Julien Viard de Galbert9a31dfe2018-02-22 16:39:58 +0100386 u8 asset_tag;
387 u8 feature_flags;
388 u8 location_in_chassis;
389 u16 chassis_handle;
390 u8 board_type;
Konstantin Aladyshevd0df1d72017-08-01 15:52:46 +0300391 u8 eos[2];
Stefan Reinauer6a001132017-07-13 02:20:27 +0200392} __packed;
Vladimir Serbinenko47089f22014-03-02 19:14:44 +0100393
Mathew Kingbe820b32019-10-31 12:10:44 -0600394typedef enum {
Elyes HAOUAS25dbc172017-07-04 21:38:03 +0200395 SMBIOS_ENCLOSURE_OTHER = 0x01,
396 SMBIOS_ENCLOSURE_UNKNOWN = 0x02,
397 SMBIOS_ENCLOSURE_DESKTOP = 0x03,
398 SMBIOS_ENCLOSURE_LOW_PROFILE_DESKTOP = 0x04,
399 SMBIOS_ENCLOSURE_PIZZA_BOX = 0x05,
400 SMBIOS_ENCLOSURE_MINI_TOWER = 0x06,
401 SMBIOS_ENCLOSURE_TOWER = 0x07,
402 SMBIOS_ENCLOSURE_PORTABLE = 0x08,
403 SMBIOS_ENCLOSURE_LAPTOP = 0x09,
404 SMBIOS_ENCLOSURE_NOTEBOOK = 0x0a,
405 SMBIOS_ENCLOSURE_HAND_HELD = 0x0b,
406 SMBIOS_ENCLOSURE_DOCKING_STATION = 0x0c,
407 SMBIOS_ENCLOSURE_ALL_IN_ONE = 0x0d,
408 SMBIOS_ENCLOSURE_SUB_NOTEBOOK = 0x0e,
409 SMBIOS_ENCLOSURE_SPACE_SAVING = 0x0f,
410 SMBIOS_ENCLOSURE_LUNCH_BOX = 0x10,
411 SMBIOS_ENCLOSURE_MAIN_SERVER_CHASSIS = 0x11,
412 SMBIOS_ENCLOSURE_EXPANSION_CHASSIS = 0x12,
413 SMBIOS_ENCLOSURE_SUBCHASSIS = 0x13,
414 SMBIOS_ENCLOSURE_BUS_EXPANSION_CHASSIS = 0x14,
415 SMBIOS_ENCLOSURE_PERIPHERAL_CHASSIS = 0x15,
416 SMBIOS_ENCLOSURE_RAID_CHASSIS = 0x16,
417 SMBIOS_ENCLOSURE_RACK_MOUNT_CHASSIS = 0x17,
418 SMBIOS_ENCLOSURE_SEALED_CASE_PC = 0x18,
419 SMBIOS_ENCLOSURE_MULTI_SYSTEM_CHASSIS = 0x19,
420 SMBIOS_ENCLOSURE_COMPACT_PCI = 0x1a,
421 SMBIOS_ENCLOSURE_ADVANCED_TCA = 0x1b,
422 SMBIOS_ENCLOSURE_BLADE = 0x1c,
423 SMBIOS_ENCLOSURE_BLADE_ENCLOSURE = 0x1d,
424 SMBIOS_ENCLOSURE_TABLET = 0x1e,
425 SMBIOS_ENCLOSURE_CONVERTIBLE = 0x1f,
426 SMBIOS_ENCLOSURE_DETACHABLE = 0x20,
427 SMBIOS_ENCLOSURE_IOT_GATEWAY = 0x21,
428 SMBIOS_ENCLOSURE_EMBEDDED_PC = 0x22,
429 SMBIOS_ENCLOSURE_MINI_PC = 0x23,
430 SMBIOS_ENCLOSURE_STICK_PC = 0x24,
Mathew Kingbe820b32019-10-31 12:10:44 -0600431} smbios_enclosure_type;
Vladimir Serbinenko71c0bf62014-08-27 23:23:14 +0200432
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200433struct smbios_type3 {
Angel Ponsb554b7c2021-06-28 17:42:40 +0200434 struct smbios_header header;
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200435 u8 manufacturer;
436 u8 _type;
437 u8 version;
438 u8 serial_number;
439 u8 asset_tag_number;
440 u8 bootup_state;
441 u8 power_supply_state;
442 u8 thermal_state;
443 u8 security_status;
444 u32 oem_defined;
445 u8 height;
446 u8 number_of_power_cords;
447 u8 element_count;
448 u8 element_record_length;
Matt DeVillier4863cc42016-09-01 00:55:40 -0500449 u8 sku_number;
Konstantin Aladyshevd0df1d72017-08-01 15:52:46 +0300450 u8 eos[2];
Stefan Reinauer6a001132017-07-13 02:20:27 +0200451} __packed;
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200452
453struct smbios_type4 {
Angel Ponsb554b7c2021-06-28 17:42:40 +0200454 struct smbios_header header;
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200455 u8 socket_designation;
456 u8 processor_type;
457 u8 processor_family;
458 u8 processor_manufacturer;
459 u32 processor_id[2];
460 u8 processor_version;
461 u8 voltage;
462 u16 external_clock;
463 u16 max_speed;
464 u16 current_speed;
465 u8 status;
466 u8 processor_upgrade;
467 u16 l1_cache_handle;
468 u16 l2_cache_handle;
469 u16 l3_cache_handle;
470 u8 serial_number;
471 u8 asset_tag;
472 u8 part_number;
473 u8 core_count;
474 u8 core_enabled;
475 u8 thread_count;
476 u16 processor_characteristics;
477 u16 processor_family2;
Patrick Rudolph7a835822020-07-22 16:00:53 +0200478 u16 core_count2;
479 u16 core_enabled2;
480 u16 thread_count2;
Konstantin Aladyshevd0df1d72017-08-01 15:52:46 +0300481 u8 eos[2];
Stefan Reinauer6a001132017-07-13 02:20:27 +0200482} __packed;
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200483
Patrick Rudolph4aea6912020-07-22 07:28:26 +0200484/* defines for smbios_type4 */
485
486#define SMBIOS_PROCESSOR_STATUS_POPULATED (1 << 6)
487#define SMBIOS_PROCESSOR_STATUS_CPU_ENABLED (1 << 0)
488
Tim Chu323e5a82022-10-27 03:03:59 +0000489/* defines for processor family */
490#define SMBIOS_PROCESSOR_FAMILY_OTHER 0x01
491#define SMBIOS_PROCESSOR_FAMILY_UNKNOWN 0x02
492#define SMBIOS_PROCESSOR_FAMILY_XEON 0xb3
493
494/* defines for processor characteristics */
495#define PROCESSOR_64BIT_CAPABLE (1 << 2)
496#define PROCESSOR_MULTI_CORE (1 << 3)
497#define PROCESSOR_POWER_PERFORMANCE_CONTROL (1 << 7)
498
Patrick Rudolphfc5b8092019-03-30 17:37:28 +0100499/* defines for supported_sram_type/current_sram_type */
500
501#define SMBIOS_CACHE_SRAM_TYPE_OTHER (1 << 0)
502#define SMBIOS_CACHE_SRAM_TYPE_UNKNOWN (1 << 1)
503#define SMBIOS_CACHE_SRAM_TYPE_NON_BURST (1 << 2)
504#define SMBIOS_CACHE_SRAM_TYPE_BURST (1 << 3)
505#define SMBIOS_CACHE_SRAM_TYPE_PIPELINE_BURST (1 << 4)
506#define SMBIOS_CACHE_SRAM_TYPE_SYNCHRONOUS (1 << 5)
507#define SMBIOS_CACHE_SRAM_TYPE_ASYNCHRONOUS (1 << 6)
508
509/* enum for error_correction_type */
510
511enum smbios_cache_error_corr {
512 SMBIOS_CACHE_ERROR_CORRECTION_OTHER = 1,
513 SMBIOS_CACHE_ERROR_CORRECTION_UNKNOWN,
514 SMBIOS_CACHE_ERROR_CORRECTION_NONE,
515 SMBIOS_CACHE_ERROR_CORRECTION_PARITY,
516 SMBIOS_CACHE_ERROR_CORRECTION_SINGLE_BIT,
517 SMBIOS_CACHE_ERROR_CORRECTION_MULTI_BIT,
518};
519
520/* enum for system_cache_type */
521
522enum smbios_cache_type {
523 SMBIOS_CACHE_TYPE_OTHER = 1,
524 SMBIOS_CACHE_TYPE_UNKNOWN,
525 SMBIOS_CACHE_TYPE_INSTRUCTION,
526 SMBIOS_CACHE_TYPE_DATA,
527 SMBIOS_CACHE_TYPE_UNIFIED,
528};
529
530/* enum for associativity */
531
532enum smbios_cache_associativity {
533 SMBIOS_CACHE_ASSOCIATIVITY_OTHER = 1,
534 SMBIOS_CACHE_ASSOCIATIVITY_UNKNOWN,
535 SMBIOS_CACHE_ASSOCIATIVITY_DIRECT,
536 SMBIOS_CACHE_ASSOCIATIVITY_2WAY,
537 SMBIOS_CACHE_ASSOCIATIVITY_4WAY,
538 SMBIOS_CACHE_ASSOCIATIVITY_FULL,
539 SMBIOS_CACHE_ASSOCIATIVITY_8WAY,
540 SMBIOS_CACHE_ASSOCIATIVITY_16WAY,
541 SMBIOS_CACHE_ASSOCIATIVITY_12WAY,
542 SMBIOS_CACHE_ASSOCIATIVITY_24WAY,
543 SMBIOS_CACHE_ASSOCIATIVITY_32WAY,
544 SMBIOS_CACHE_ASSOCIATIVITY_48WAY,
545 SMBIOS_CACHE_ASSOCIATIVITY_64WAY,
546 SMBIOS_CACHE_ASSOCIATIVITY_20WAY,
547};
548
549/* defines for cache_configuration */
550
551#define SMBIOS_CACHE_CONF_LEVEL(x) ((((x) - 1) & 0x7) << 0)
552#define SMBIOS_CACHE_CONF_LOCATION(x) (((x) & 0x3) << 5)
553#define SMBIOS_CACHE_CONF_ENABLED(x) (((x) & 0x1) << 7)
554#define SMBIOS_CACHE_CONF_OPERATION_MODE(x) (((x) & 0x3) << 8)
555
556/* defines for max_cache_size and installed_size */
557
558#define SMBIOS_CACHE_SIZE_UNIT_1KB (0 << 15)
559#define SMBIOS_CACHE_SIZE_UNIT_64KB (1 << 15)
560#define SMBIOS_CACHE_SIZE_MASK 0x7fff
561#define SMBIOS_CACHE_SIZE_OVERFLOW 0xffff
562
563#define SMBIOS_CACHE_SIZE2_UNIT_1KB (0 << 31)
564#define SMBIOS_CACHE_SIZE2_UNIT_64KB (1UL << 31)
565#define SMBIOS_CACHE_SIZE2_MASK 0x7fffffff
566
Morgan Jang8ae391d2020-10-06 16:26:17 +0800567/* define for cache operation mode */
568
569#define SMBIOS_CACHE_OP_MODE_WRITE_THROUGH 0
570#define SMBIOS_CACHE_OP_MODE_WRITE_BACK 1
571#define SMBIOS_CACHE_OP_MODE_VARIES_WITH_MEMORY_ADDRESS 2
572#define SMBIOS_CACHE_OP_MODE_UNKNOWN 3
573
Patrick Rudolphfc5b8092019-03-30 17:37:28 +0100574struct smbios_type7 {
Angel Ponsb554b7c2021-06-28 17:42:40 +0200575 struct smbios_header header;
Patrick Rudolphfc5b8092019-03-30 17:37:28 +0100576 u8 socket_designation;
577 u16 cache_configuration;
578 u16 max_cache_size;
579 u16 installed_size;
580 u16 supported_sram_type;
581 u16 current_sram_type;
582 u8 cache_speed;
583 u8 error_correction_type;
584 u8 system_cache_type;
585 u8 associativity;
586 u32 max_cache_size2;
587 u32 installed_size2;
588 u8 eos[2];
589} __packed;
590
BryantOu4a8e58f2020-04-20 19:45:20 -0700591/* enum for connector types */
592typedef enum {
593 CONN_NONE = 0x00,
594 CONN_CENTRONICS = 0x01,
595 CONN_MINI_CENTRONICS = 0x02,
596 CONN_PROPRIETARY = 0x03,
597 CONN_DB_25_PIN_MALE = 0x04,
598 CONN_DB_25_PIN_FEMALE = 0x05,
599 CONN_DB_15_PIN_MALE = 0x06,
600 CONN_DB_15_PIN_FEMALE = 0x07,
601 CONN_DB_9_PIN_MALE = 0x08,
602 CONN_DB_9_PIN_FEMALE = 0x09,
603 CONN_RJ_11 = 0x0A,
604 CONN_RJ_45 = 0x0B,
605 CONN_50_PIN_MINI_SCSI = 0x0C,
606 CONN_MINI_DIN = 0x0D,
607 CONN_MICRO_DIN = 0x0E,
608 CONN_PS_2 = 0x0F,
609 CONN_INFRARED = 0x10,
610 CONN_HP_HIL = 0x11,
611 CONN_ACCESS_BUS_USB = 0x12,
612 CONN_SSA_SCSI = 0x13,
613 CONN_CIRCULAR_DIN_8_MALE = 0x14,
614 CONN_CIRCULAR_DIN_8_FEMALE = 0x15,
615 CONN_ON_BOARD_IDE = 0x16,
616 CONN_ON_BOARD_FLOPPY = 0x17,
617 CONN_9_PIN_DUAL_INLINE = 0x18,
618 CONN_25_PIN_DUAL_INLINE = 0x19,
619 CONN_50_PIN_DUAL_INLINE = 0x1A,
620 CONN_68_PIN_DUAL_INLINE = 0x1B,
621 CONN_ON_BOARD_SOUND_INPUT_FROM_CD_ROM = 0x1C,
622 CONN_MINI_CENTRONICS_TYPE14 = 0x1D,
623 CONN_MINI_CENTRONICS_TYPE26 = 0x1E,
624 CONN_MINI_JACK_HEADPHONES = 0x1F,
625 CONN_BNC = 0x20,
626 CONN_1394 = 0x21,
627 CONN_SAS_SATA = 0x22,
628 CONN_USB_TYPE_C = 0x23,
629 CONN_PC_98 = 0xA0,
630 CONN_PC_98_HIRESO = 0xA1,
631 CONN_PC_H98 = 0xA2,
632 CONN_PC98_NOTE = 0xA3,
633 CONN_PC_98_FULL = 0xA4,
634 CONN_OTHER = 0xFF,
635} type8_connector_types;
636
637/* enum for port types */
638typedef enum {
Patrick Georgi54be3952020-07-04 21:22:25 +0200639 TYPE_NONE_PORT = 0x00,
BryantOu4a8e58f2020-04-20 19:45:20 -0700640 TYPE_PARALLEL_PORT_XT_AT_COMPATIBLE = 0x01,
641 TYPE_PARALLEL_PORT_PS_2 = 0x02,
642 TYPE_PARALLEL_PORT_ECP = 0x03,
643 TYPE_PARALLEL_PORT_EPP = 0x04,
644 TYPE_PARALLEL_PORT_ECP_EPP = 0x05,
645 TYPE_SERIAL_PORT_XT_AT_COMPATIBLE = 0x06,
646 TYPE_SERIAL_PORT_16450_COMPATIBLE = 0x07,
647 TYPE_SERIAL_PORT_16550_COMPATIBLE = 0x08,
648 TYPE_SERIAL_PORT_16550A_COMPATIBLE = 0x09,
649 TYPE_SCSI_PORT = 0x0A,
650 TYPE_MIDI_PORT = 0x0B,
651 TYPE_JOY_STICK_PORT = 0x0C,
652 TYPE_KEYBOARD_PORT = 0x0D,
653 TYPE_MOUSE_PORT = 0x0E,
654 TYPE_SSA_SCSI = 0x0F,
655 TYPE_USB = 0x10,
656 TYPE_FIREWIRE_IEEE_P1394 = 0x11,
657 TYPE_PCMCIA_TYPE_I = 0x12,
658 TYPE_PCMCIA_TYPE_II = 0x13,
659 TYPE_PCMCIA_TYPE_III = 0x14,
660 TYPE_CARDBUS = 0x15,
661 TYPE_ACCESS_BUS_PORT = 0x16,
662 TYPE_SCSI_II = 0x17,
663 TYPE_SCSI_WIDE = 0x18,
664 TYPE_PC_98 = 0x19,
665 TYPE_PC_98_HIRESO = 0x1A,
666 TYPE_PC_H98 = 0x1B,
667 TYPE_VIDEO_PORT = 0x1C,
668 TYPE_AUDIO_PORT = 0x1D,
669 TYPE_MODEM_PORT = 0x1E,
670 TYPE_NETWORK_PORT = 0x1F,
671 TYPE_SATA = 0x20,
672 TYPE_SAS = 0x21,
673 TYPE_MFDP = 0x22,
674 TYPE_THUNDERBOLT = 0x23,
675 TYPE_8251_COMPATIBLE = 0xA0,
676 TYPE_8251_FIFO_COMPATIBLE = 0xA1,
Patrick Georgi54be3952020-07-04 21:22:25 +0200677 TYPE_OTHER_PORT = 0xFF,
BryantOu4a8e58f2020-04-20 19:45:20 -0700678} type8_port_types;
679
680struct port_information {
681 const char *internal_reference_designator;
682 type8_connector_types internal_connector_type;
683 const char *external_reference_designator;
684 type8_connector_types external_connector_type;
685 type8_port_types port_type;
686};
687
688struct smbios_type8 {
Angel Ponsb554b7c2021-06-28 17:42:40 +0200689 struct smbios_header header;
BryantOu4a8e58f2020-04-20 19:45:20 -0700690 u8 internal_reference_designator;
691 u8 internal_connector_type;
692 u8 external_reference_designator;
693 u8 external_connector_type;
694 u8 port_type;
695 u8 eos[2];
696} __packed;
697
Lijian Zhaoe98a7512019-04-11 23:28:09 -0700698/* System Slots - Slot Type */
699enum misc_slot_type {
700 SlotTypeOther = 0x01,
701 SlotTypeUnknown = 0x02,
702 SlotTypeIsa = 0x03,
703 SlotTypeMca = 0x04,
704 SlotTypeEisa = 0x05,
705 SlotTypePci = 0x06,
706 SlotTypePcmcia = 0x07,
707 SlotTypeVlVesa = 0x08,
708 SlotTypeProprietary = 0x09,
709 SlotTypeProcessorCardSlot = 0x0A,
710 SlotTypeProprietaryMemoryCardSlot = 0x0B,
711 SlotTypeIORiserCardSlot = 0x0C,
712 SlotTypeNuBus = 0x0D,
713 SlotTypePci66MhzCapable = 0x0E,
714 SlotTypeAgp = 0x0F,
715 SlotTypeApg2X = 0x10,
716 SlotTypeAgp4X = 0x11,
717 SlotTypePciX = 0x12,
718 SlotTypeAgp8X = 0x13,
719 SlotTypeM2Socket1_DP = 0x14,
720 SlotTypeM2Socket1_SD = 0x15,
721 SlotTypeM2Socket2 = 0x16,
722 SlotTypeM2Socket3 = 0x17,
723 SlotTypeMxmTypeI = 0x18,
724 SlotTypeMxmTypeII = 0x19,
725 SlotTypeMxmTypeIIIStandard = 0x1A,
726 SlotTypeMxmTypeIIIHe = 0x1B,
727 SlotTypeMxmTypeIV = 0x1C,
728 SlotTypeMxm30TypeA = 0x1D,
729 SlotTypeMxm30TypeB = 0x1E,
730 SlotTypePciExpressGen2Sff_8639 = 0x1F,
731 SlotTypePciExpressGen3Sff_8639 = 0x20,
732 SlotTypePciExpressMini52pinWithBSKO = 0x21,
733 SlotTypePciExpressMini52pinWithoutBSKO = 0x22,
734 SlotTypePciExpressMini76pin = 0x23,
Tim Chu323e5a82022-10-27 03:03:59 +0000735 SlotTypePciExpressOCPNIC30SFF = 0x26,
Lijian Zhaoe98a7512019-04-11 23:28:09 -0700736 SlotTypePC98C20 = 0xA0,
737 SlotTypePC98C24 = 0xA1,
738 SlotTypePC98E = 0xA2,
739 SlotTypePC98LocalBus = 0xA3,
740 SlotTypePC98Card = 0xA4,
741 SlotTypePciExpress = 0xA5,
742 SlotTypePciExpressX1 = 0xA6,
743 SlotTypePciExpressX2 = 0xA7,
744 SlotTypePciExpressX4 = 0xA8,
745 SlotTypePciExpressX8 = 0xA9,
746 SlotTypePciExpressX16 = 0xAA,
747 SlotTypePciExpressGen2 = 0xAB,
748 SlotTypePciExpressGen2X1 = 0xAC,
749 SlotTypePciExpressGen2X2 = 0xAD,
750 SlotTypePciExpressGen2X4 = 0xAE,
751 SlotTypePciExpressGen2X8 = 0xAF,
752 SlotTypePciExpressGen2X16 = 0xB0,
753 SlotTypePciExpressGen3 = 0xB1,
754 SlotTypePciExpressGen3X1 = 0xB2,
755 SlotTypePciExpressGen3X2 = 0xB3,
756 SlotTypePciExpressGen3X4 = 0xB4,
757 SlotTypePciExpressGen3X8 = 0xB5,
Elyes HAOUAS5d0942b2019-10-08 16:13:34 +0200758 SlotTypePciExpressGen3X16 = 0xB6,
759 SlotTypePciExpressGen4 = 0xB8,
760 SlotTypePciExpressGen4x1 = 0xB9,
761 SlotTypePciExpressGen4x2 = 0xBA,
762 SlotTypePciExpressGen4x4 = 0xBB,
763 SlotTypePciExpressGen4x8 = 0xBC,
Elyes HAOUASf6c100f2021-12-12 09:04:38 +0100764 SlotTypePciExpressGen4x16 = 0xBD,
765 SlotTypePciExpressGen5 = 0xBE,
766 SlotTypePciExpressGen5x1 = 0xBF,
767 SlotTypePciExpressGen5x2 = 0xC0,
768 SlotTypePciExpressGen5x4 = 0xC1,
769 SlotTypePciExpressGen5x8 = 0xC2,
770 SlotTypePciExpressGen5x16 = 0xC3
Lijian Zhaoe98a7512019-04-11 23:28:09 -0700771};
772
773/* System Slots - Slot Data Bus Width. */
774enum slot_data_bus_bandwidth {
775 SlotDataBusWidthOther = 0x01,
776 SlotDataBusWidthUnknown = 0x02,
777 SlotDataBusWidth8Bit = 0x03,
778 SlotDataBusWidth16Bit = 0x04,
779 SlotDataBusWidth32Bit = 0x05,
780 SlotDataBusWidth64Bit = 0x06,
781 SlotDataBusWidth128Bit = 0x07,
782 SlotDataBusWidth1X = 0x08,
783 SlotDataBusWidth2X = 0x09,
784 SlotDataBusWidth4X = 0x0A,
785 SlotDataBusWidth8X = 0x0B,
786 SlotDataBusWidth12X = 0x0C,
787 SlotDataBusWidth16X = 0x0D,
788 SlotDataBusWidth32X = 0x0E
789};
790
791/* System Slots - Current Usage. */
792enum misc_slot_usage {
793 SlotUsageOther = 0x01,
794 SlotUsageUnknown = 0x02,
795 SlotUsageAvailable = 0x03,
796 SlotUsageInUse = 0x04,
797 SlotUsageUnavailable = 0x05
798};
799
800/* System Slots - Slot Length.*/
801enum misc_slot_length {
802 SlotLengthOther = 0x01,
803 SlotLengthUnknown = 0x02,
804 SlotLengthShort = 0x03,
805 SlotLengthLong = 0x04
806};
807
808/* System Slots - Slot Characteristics 1. */
809#define SMBIOS_SLOT_UNKNOWN (1 << 0)
810#define SMBIOS_SLOT_5V (1 << 1)
811#define SMBIOS_SLOT_3P3V (1 << 2)
812#define SMBIOS_SLOT_SHARED (1 << 3)
813#define SMBIOS_SLOT_PCCARD_16 (1 << 4)
814#define SMBIOS_SLOT_PCCARD_CARDBUS (1 << 5)
815#define SMBIOS_SLOT_PCCARD_ZOOM (1 << 6)
816#define SMBIOS_SLOT_PCCARD_MODEM_RING (1 << 7)
817/* System Slots - Slot Characteristics 2. */
818#define SMBIOS_SLOT_PME (1 << 0)
819#define SMBIOS_SLOT_HOTPLUG (1 << 1)
820#define SMBIOS_SLOT_SMBUS (1 << 2)
821#define SMBIOS_SLOT_BIFURCATION (1 << 3)
822
823struct slot_peer_groups {
824 u16 peer_seg_num;
825 u8 peer_bus_num;
826 u8 peer_dev_fn_num;
827 u8 peer_data_bus_width;
828} __packed;
829
830struct smbios_type9 {
Angel Ponsb554b7c2021-06-28 17:42:40 +0200831 struct smbios_header header;
Lijian Zhaoe98a7512019-04-11 23:28:09 -0700832 u8 slot_designation;
833 u8 slot_type;
834 u8 slot_data_bus_width;
835 u8 current_usage;
836 u8 slot_length;
837 u16 slot_id;
838 u8 slot_characteristics_1;
839 u8 slot_characteristics_2;
840 u16 segment_group_number;
841 u8 bus_number;
842 u8 device_function_number;
843 u8 data_bus_width;
844 u8 peer_group_count;
845 struct slot_peer_groups peer[0];
846 u8 eos[2];
847} __packed;
848
Peter Stugec392b642013-07-06 19:51:12 +0200849struct smbios_type11 {
Angel Ponsb554b7c2021-06-28 17:42:40 +0200850 struct smbios_header header;
Peter Stugec392b642013-07-06 19:51:12 +0200851 u8 count;
Konstantin Aladyshevd0df1d72017-08-01 15:52:46 +0300852 u8 eos[2];
Stefan Reinauer6a001132017-07-13 02:20:27 +0200853} __packed;
Peter Stugec392b642013-07-06 19:51:12 +0200854
Duncan Laurie472ec9c2012-06-23 16:13:42 -0700855struct smbios_type15 {
Angel Ponsb554b7c2021-06-28 17:42:40 +0200856 struct smbios_header header;
Duncan Laurie472ec9c2012-06-23 16:13:42 -0700857 u16 area_length;
858 u16 header_offset;
859 u16 data_offset;
860 u8 access_method;
861 u8 log_status;
862 u32 change_token;
863 u32 address;
864 u8 header_format;
865 u8 log_type_descriptors;
866 u8 log_type_descriptor_length;
Konstantin Aladyshevd0df1d72017-08-01 15:52:46 +0300867 u8 eos[2];
Stefan Reinauer6a001132017-07-13 02:20:27 +0200868} __packed;
Duncan Laurie472ec9c2012-06-23 16:13:42 -0700869
870enum {
871 SMBIOS_EVENTLOG_ACCESS_METHOD_IO8 = 0,
872 SMBIOS_EVENTLOG_ACCESS_METHOD_IO8X2,
873 SMBIOS_EVENTLOG_ACCESS_METHOD_IO16,
874 SMBIOS_EVENTLOG_ACCESS_METHOD_MMIO32,
875 SMBIOS_EVENTLOG_ACCESS_METHOD_GPNV,
876};
877
878enum {
879 SMBIOS_EVENTLOG_STATUS_VALID = 1, /* Bit 0 */
880 SMBIOS_EVENTLOG_STATUS_FULL = 2, /* Bit 1 */
881};
882
Jingle Hsu869e90a2021-09-09 14:24:25 +0800883#define SMBIOS_USE_EXTENDED_MAX_CAPACITY (1ULL << 31)
Tim Chu1ee8ddc2021-01-22 01:10:45 -0800884
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200885struct smbios_type16 {
Angel Ponsb554b7c2021-06-28 17:42:40 +0200886 struct smbios_header header;
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200887 u8 location;
888 u8 use;
889 u8 memory_error_correction;
890 u32 maximum_capacity;
891 u16 memory_error_information_handle;
892 u16 number_of_memory_devices;
893 u64 extended_maximum_capacity;
Konstantin Aladyshevd0df1d72017-08-01 15:52:46 +0300894 u8 eos[2];
Stefan Reinauer6a001132017-07-13 02:20:27 +0200895} __packed;
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200896
897struct smbios_type17 {
Angel Ponsb554b7c2021-06-28 17:42:40 +0200898 struct smbios_header header;
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200899 u16 phys_memory_array_handle;
900 u16 memory_error_information_handle;
901 u16 total_width;
902 u16 data_width;
903 u16 size;
904 u8 form_factor;
905 u8 device_set;
906 u8 device_locator;
907 u8 bank_locator;
908 u8 memory_type;
909 u16 type_detail;
910 u16 speed;
911 u8 manufacturer;
912 u8 serial_number;
913 u8 asset_tag;
914 u8 part_number;
915 u8 attributes;
Timothy Pearson964aa832015-09-05 19:00:34 -0500916 u32 extended_size;
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200917 u16 clock_speed;
Timothy Pearson964aa832015-09-05 19:00:34 -0500918 u16 minimum_voltage;
919 u16 maximum_voltage;
920 u16 configured_voltage;
Konstantin Aladyshevd0df1d72017-08-01 15:52:46 +0300921 u8 eos[2];
Stefan Reinauer6a001132017-07-13 02:20:27 +0200922} __packed;
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200923
Patrick Rudolph604295e2020-07-21 14:53:37 +0200924struct smbios_type19 {
Angel Ponsb554b7c2021-06-28 17:42:40 +0200925 struct smbios_header header;
Patrick Rudolph604295e2020-07-21 14:53:37 +0200926 u32 starting_address;
927 u32 ending_address;
928 u16 memory_array_handle;
929 u8 partition_width;
930 u64 extended_starting_address;
931 u64 extended_ending_address;
932 u8 eos[2];
933} __packed;
934
Matt DeVillierd1c1afd2016-09-02 21:41:26 -0500935struct smbios_type20 {
936 struct smbios_header header;
937 u32 addr_start;
938 u32 addr_end;
939 u16 memory_device_handle;
940 u16 memory_array_mapped_address_handle;
941 u8 partition_row_pos;
942 u8 interleave_pos;
943 u8 interleave_depth;
944 u64 ext_addr_start;
945 u64 ext_addr_end;
946 u8 eos[2];
947} __packed;
948
Erik van den Bogaert93781522022-09-28 12:35:51 +0200949/* Bit[7..5] = Temp status */
950enum smbios_temp_status {
951 SMBIOS_TEMP_STATUS_OTHER = 0x01,
952 SMBIOS_TEMP_STATUS_UNKNOWN,
953 SMBIOS_TEMP_STATUS_OK,
954 SMBIOS_TEMP_STATUS_NONCRITICAL,
955 SMBIOS_TEMP_STATUS_CRITICAL,
956 SMBIOS_TEMP_STATUS_NONREC, // Non-Recoverable.
957};
958
959/* Bit[4..0] = Temp location */
960enum smbios_temp_location {
961 SMBIOS_TEMP_LOCATION_OTHER = 0x01,
962 SMBIOS_TEMP_LOCATION_UNKNOWN,
963 SMBIOS_TEMP_LOCATION_PROCESSOR,
964 SMBIOS_TEMP_LOCATION_DISK,
965 SMBIOS_TEMP_LOCATION_BAY, // Peripheral Bay.
966 SMBIOS_TEMP_LOCATION_SMM, // System Management Module.
967 SMBIOS_TEMP_LOCATION_BOARD, // Motherboard.
968 SMBIOS_TEMP_LOCATION_MM, // Memory.
969 SMBIOS_TEMP_LOCATION_PM, // Processor Module.
970 SMBIOS_TEMP_LOCATION_POW, // Power Unit.
971 SMBIOS_TEMP_LOCATION_ADDCARD,
972};
973
974struct smbios_type28 {
975 struct smbios_header header;
976 u8 description;
977 u8 location_and_status;
978 u16 maximum_value;
979 u16 minimum_value;
980 u16 resolution;
981 u16 tolerance;
982 u16 accuracy;
983 u32 oem_defined;
984 u16 nominal_value;
985 u8 eos[2];
986} __packed;
987
988
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200989struct smbios_type32 {
Angel Ponsb554b7c2021-06-28 17:42:40 +0200990 struct smbios_header header;
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200991 u8 reserved[6];
992 u8 boot_status;
993 u8 eos[2];
Stefan Reinauer6a001132017-07-13 02:20:27 +0200994} __packed;
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200995
Sven Schnelle6d038762012-07-09 08:52:53 +0200996struct smbios_type38 {
Angel Ponsb554b7c2021-06-28 17:42:40 +0200997 struct smbios_header header;
Sven Schnelle6d038762012-07-09 08:52:53 +0200998 u8 interface_type;
999 u8 ipmi_rev;
1000 u8 i2c_slave_addr;
1001 u8 nv_storage_addr;
1002 u64 base_address;
1003 u8 base_address_modifier;
1004 u8 irq;
Lukasz Siudut2352a502019-02-19 10:06:09 +00001005 u8 eos[2];
Stefan Reinauer6a001132017-07-13 02:20:27 +02001006} __packed;
Sven Schnelle6d038762012-07-09 08:52:53 +02001007
Patrick Rudolphfe98e902018-03-27 16:17:12 +02001008enum smbios_bmc_interface_type {
1009 SMBIOS_BMC_INTERFACE_UNKNOWN = 0,
1010 SMBIOS_BMC_INTERFACE_KCS,
1011 SMBIOS_BMC_INTERFACE_SMIC,
1012 SMBIOS_BMC_INTERFACE_BLOCK,
Elyes HAOUASa5cc0cf2019-02-14 16:48:08 +01001013 SMBIOS_BMC_INTERFACE_SMBUS,
Patrick Rudolphfe98e902018-03-27 16:17:12 +02001014};
1015
Stefan Reinauer3d7c6772012-04-02 13:30:10 -07001016typedef enum {
Jonathan Zhangd57b8212022-10-14 17:06:26 -07001017 PowerSupplyTypeOther = 1,
1018 PowerSupplyTypeUnknown = 2,
1019 PowerSupplyTypeLinear = 3,
1020 PowerSupplyTypeSwitching = 4,
1021 PowerSupplyTypeBattery = 5,
1022 PowerSupplyTypeUps = 6,
1023 PowerSupplyTypeConverter = 7,
1024 PowerSupplyTypeRegulator = 8
1025} power_supply_type;
1026
1027typedef enum {
1028 PowerSupplyStatusOther = 1,
1029 PowerSupplyStatusUnknown = 2,
1030 PowerSupplyStatusOk = 3,
1031 PowerSupplyStatusNonCritical = 4,
1032 PowerSupplyStatusCritical = 5
1033} power_supply_status;
1034
1035typedef enum {
1036 PowerSupplyInputVoltageRangeSwitchingOther = 1,
1037 PowerSupplyInputVoltageRangeSwitchingUnknown = 2,
1038 PowerSupplyInputVoltageRangeSwitchingManual = 3,
1039 PowerSupplyInputVoltageRangeSwitchingAutoSwitch = 4,
1040 PowerSupplyInputVoltageRangeSwitchingWideRange = 5,
1041 PowerSupplyInputVoltageRangeSwitchingNotApplicable = 6
1042} power_supply_input_voltage_range_switching;
1043
1044struct power_supply_ch {
1045 u16 reserved :2;
1046 u16 power_supply_type :4;
1047 u16 power_supply_status :3;
1048 u16 input_voltage_range_switch :4;
1049 u16 power_supply_unplugged :1;
1050 u16 power_supply_present :1;
1051 u16 power_supply_hot_replaceble :1;
1052};
1053
1054struct smbios_type39 {
1055 struct smbios_header header;
1056 u8 power_unit_group;
1057 u8 location;
1058 u8 device_name;
1059 u8 manufacturer;
1060 u8 serial_number;
1061 u8 asset_tag_number;
1062 u8 model_part_number;
1063 u8 revision_level;
1064 u16 max_power_capacity;
1065 u16 power_supply_characteristics;
1066 u16 input_voltage_probe_handle;
1067 u16 cooling_device_handle;
1068 u16 input_current_probe_handle;
1069 u8 eos[2];
1070} __packed;
1071
1072int smbios_write_type39(unsigned long *current, int *handle,
1073 u8 unit_group, const char *loc, const char *dev_name,
1074 const char *man, const char *serial_num,
1075 const char *tag_num, const char *part_num,
1076 const char *rev_lvl, u16 max_pow_cap,
1077 const struct power_supply_ch *ps_ch);
1078
1079typedef enum {
Stefan Reinauer3d7c6772012-04-02 13:30:10 -07001080 SMBIOS_DEVICE_TYPE_OTHER = 0x01,
1081 SMBIOS_DEVICE_TYPE_UNKNOWN,
1082 SMBIOS_DEVICE_TYPE_VIDEO,
1083 SMBIOS_DEVICE_TYPE_SCSI,
1084 SMBIOS_DEVICE_TYPE_ETHERNET,
1085 SMBIOS_DEVICE_TYPE_TOKEN_RING,
1086 SMBIOS_DEVICE_TYPE_SOUND,
1087 SMBIOS_DEVICE_TYPE_PATA,
1088 SMBIOS_DEVICE_TYPE_SATA,
1089 SMBIOS_DEVICE_TYPE_SAS,
Elyes HAOUASf6c100f2021-12-12 09:04:38 +01001090 SMBIOS_DEVICE_TYPE_WIRELESS_LAN,
1091 SMBIOS_DEVICE_TYPE_BLUETOOTH,
1092 SMBIOS_DEVICE_TYPE_WWAN,
1093 SMBIOS_DEVICE_TYPE_EMMC,
1094 SMBIOS_DEVICE_TYPE_NVME,
1095 SMBIOS_DEVICE_TYPE_UFS,
Stefan Reinauer3d7c6772012-04-02 13:30:10 -07001096} smbios_onboard_device_type;
1097
Christian Walter9e5b0622019-05-21 17:37:58 +02001098#define SMBIOS_DEVICE_TYPE_COUNT 10
1099
Stefan Reinauer3d7c6772012-04-02 13:30:10 -07001100struct smbios_type41 {
Angel Ponsb554b7c2021-06-28 17:42:40 +02001101 struct smbios_header header;
Stefan Reinauer3d7c6772012-04-02 13:30:10 -07001102 u8 reference_designation;
1103 u8 device_type: 7;
1104 u8 device_status: 1;
1105 u8 device_type_instance;
1106 u16 segment_group_number;
1107 u8 bus_number;
1108 u8 function_number: 3;
1109 u8 device_number: 5;
Konstantin Aladyshevd0df1d72017-08-01 15:52:46 +03001110 u8 eos[2];
Stefan Reinauer6a001132017-07-13 02:20:27 +02001111} __packed;
Stefan Reinauer3d7c6772012-04-02 13:30:10 -07001112
Michał Żygowskie7795232022-05-04 14:10:45 +02001113
1114#define SMBIOS_TPM_DEVICE_CHARACTERISTICS_NOT_SUPPORTED (1ULL << 2)
1115#define SMBIOS_TPM_DEVICE_FAMILY_CONFIGURABLE_VIA_FW_UPD (1ULL << 3)
1116#define SMBIOS_TPM_DEVICE_FAMILY_CONFIGURABLE_VIA_PLATFORM_SW_SUPPORT (1ULL << 4)
1117#define SMBIOS_TPM_DEVICE_FAMILY_CONFIGURABLE_VIA_OEM_PROPRIETARY (1ULL << 5)
1118
1119struct smbios_type43 {
1120 struct smbios_header header;
1121 u32 vendor_id;
1122 u8 major_spec_ver;
1123 u8 minor_spec_ver;
1124 u32 fw_ver1;
1125 u32 fw_ver2;
1126 u8 description;
1127 u64 characteristics;
1128 u32 oem_defined;
1129 u8 eos[2];
1130} __packed;
1131
Sven Schnelle164bcfd2011-08-14 20:56:34 +02001132struct smbios_type127 {
Angel Ponsb554b7c2021-06-28 17:42:40 +02001133 struct smbios_header header;
Sven Schnelle164bcfd2011-08-14 20:56:34 +02001134 u8 eos[2];
Stefan Reinauer6a001132017-07-13 02:20:27 +02001135} __packed;
Sven Schnelle164bcfd2011-08-14 20:56:34 +02001136
Lee Leahy6a566d72017-03-07 17:45:12 -08001137void smbios_fill_dimm_manufacturer_from_id(uint16_t mod_id,
1138 struct smbios_type17 *t);
Tim Chu31b42092020-12-23 19:15:21 -08001139void smbios_fill_dimm_asset_tag(const struct dimm_info *dimm,
1140 struct smbios_type17 *t);
Lijian Zhao10ea93c2019-04-11 00:45:10 -07001141void smbios_fill_dimm_locator(const struct dimm_info *dimm,
1142 struct smbios_type17 *t);
Timothy Pearson4785f2a2015-03-27 23:05:36 -05001143
Tim Chu13ab1d72021-10-19 01:45:12 +00001144smbios_wakeup_type smbios_system_wakeup_type(void);
Julien Viard de Galbert9a31dfe2018-02-22 16:39:58 +01001145smbios_board_type smbios_mainboard_board_type(void);
Mathew Kingbe820b32019-10-31 12:10:44 -06001146smbios_enclosure_type smbios_mainboard_enclosure_type(void);
Julien Viard de Galbert9a31dfe2018-02-22 16:39:58 +01001147
Sven Schnelle164bcfd2011-08-14 20:56:34 +02001148#endif