blob: d4ae662c57cc666c4b2502b50f11af7b7cf32b8e [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
Benjamin Doronea13dc32023-06-20 12:21:27 -04009#define update_max(len, max_len, stmt) \
10 do { \
11 int tmp = stmt; \
12 \
13 max_len = MAX(max_len, tmp); \
14 len += tmp; \
15 } while (0)
16
Sven Schnelle164bcfd2011-08-14 20:56:34 +020017unsigned long smbios_write_tables(unsigned long start);
Konstantin Aladyshevd0df1d72017-08-01 15:52:46 +030018int smbios_add_string(u8 *start, const char *str);
19int smbios_string_table_len(u8 *start);
Sven Schnelle164bcfd2011-08-14 20:56:34 +020020
Angel Ponsa37701a2021-06-28 17:36:53 +020021struct smbios_header;
22int smbios_full_table_len(struct smbios_header *header, u8 *str_table_start);
Angel Ponsd62a5012021-06-28 17:18:06 +020023void *smbios_carve_table(unsigned long start, u8 type, u8 length, u16 handle);
24
Duncan Laurie21a78702013-05-23 14:17:05 -070025/* Used by mainboard to add an on-board device */
Lijian Zhaoe98a7512019-04-11 23:28:09 -070026enum misc_slot_type;
27enum misc_slot_length;
28enum misc_slot_usage;
29enum slot_data_bus_bandwidth;
30int smbios_write_type9(unsigned long *current, int *handle,
31 const char *name, const enum misc_slot_type type,
32 const enum slot_data_bus_bandwidth bandwidth,
33 const enum misc_slot_usage usage,
34 const enum misc_slot_length length,
Felix Heldd4594032024-01-11 21:50:36 +010035 const u16 id, u8 slot_char1, u8 slot_char2,
36 u8 segment_group, u8 bus, u8 dev_func);
Patrick Rudolphfe98e902018-03-27 16:17:12 +020037enum smbios_bmc_interface_type;
38int smbios_write_type38(unsigned long *current, int *handle,
39 const enum smbios_bmc_interface_type interface_type,
40 const u8 ipmi_rev, const u8 i2c_addr, const u8 nv_addr,
41 const u64 base_addr, const u8 base_modifier,
42 const u8 irq);
Duncan Laurie21a78702013-05-23 14:17:05 -070043int smbios_write_type41(unsigned long *current, int *handle,
Felix Held363ac8b2024-01-11 21:51:19 +010044 const char *name, u8 instance, u16 segment_group,
Christian Waltere6afab12019-05-21 17:22:49 +020045 u8 bus, u8 device, u8 function, u8 device_type);
Erik van den Bogaert93781522022-09-28 12:35:51 +020046enum smbios_temp_location;
47enum smbios_temp_status;
48int smbios_write_type28(unsigned long *current, int *handle,
49 const char *name,
50 const enum smbios_temp_location location,
51 const enum smbios_temp_status status,
52 u16 max_value, u16 min_value,
53 u16 resolution, u16 tolerance,
54 u16 accuracy,
55 u32 oem,
56 u16 nominal_value);
Duncan Laurie21a78702013-05-23 14:17:05 -070057
Michał Żygowskie7795232022-05-04 14:10:45 +020058int smbios_write_type43(unsigned long *current, int *handle, const u32 vendor_id,
59 const u8 major_spec_ver, const u8 minor_spec_ver,
60 const u32 fw_ver1, const u32 fw_ver2, const char *description,
61 const u64 characteristics, const u32 oem_defined);
62
Angel Pons6a73b242021-09-03 12:18:10 +020063struct device;
64int get_smbios_data(struct device *dev, int *handle, unsigned long *current);
65
Nico Huberebd8a4f2017-11-01 09:49:16 +010066const char *smbios_system_manufacturer(void);
67const char *smbios_system_product_name(void);
68const char *smbios_system_serial_number(void);
69const char *smbios_system_version(void);
70void smbios_system_set_uuid(u8 *uuid);
71const char *smbios_system_sku(void);
72
Andrey Petrov2e032f02019-10-23 15:31:51 -070073unsigned int smbios_cpu_get_max_speed_mhz(void);
74unsigned int smbios_cpu_get_current_speed_mhz(void);
Patrick Rudolphb01ac7e2020-07-26 14:23:37 +020075unsigned int smbios_cpu_get_voltage(void);
Andrey Petrov2e032f02019-10-23 15:31:51 -070076
Gerd Hoffmann06262742013-11-13 13:37:23 +010077const char *smbios_mainboard_manufacturer(void);
78const char *smbios_mainboard_product_name(void);
Christian Gmeinerac3aa092012-07-25 13:42:40 +020079const char *smbios_mainboard_serial_number(void);
80const char *smbios_mainboard_version(void);
Nico Huberebd8a4f2017-11-01 09:49:16 +010081
Vladimir Serbinenko63acd222014-06-01 00:26:48 +020082const char *smbios_mainboard_bios_version(void);
Julien Viard de Galbert9a31dfe2018-02-22 16:39:58 +010083const char *smbios_mainboard_asset_tag(void);
84u8 smbios_mainboard_feature_flags(void);
85const char *smbios_mainboard_location_in_chassis(void);
Johnny Lind3440542020-01-30 18:21:22 +080086const char *smbios_chassis_version(void);
87const char *smbios_chassis_serial_number(void);
88const char *smbios_processor_serial_number(void);
JingleHsuWiwynn4330b962021-01-28 09:13:42 +080089u8 smbios_chassis_power_cords(void);
Christian Gmeinerac3aa092012-07-25 13:42:40 +020090
Kyösti Mälkki0fcbd3a2020-12-20 08:27:21 +020091/* This string could be filled late in payload. */
92void smbios_type0_bios_version(uintptr_t address);
93
Tim Chuf2f53c42020-09-07 02:30:19 -070094void smbios_ec_revision(uint8_t *ec_major_revision, uint8_t *ec_minor_revision);
95
Morgan Jang92bcc4f2020-07-24 10:36:18 +080096unsigned int smbios_processor_external_clock(void);
97unsigned int smbios_processor_characteristics(void);
98struct cpuid_result;
99unsigned int smbios_processor_family(struct cpuid_result res);
100
Morgan Jang8ae391d2020-10-06 16:26:17 +0800101unsigned int smbios_cache_error_correction_type(u8 level);
102unsigned int smbios_cache_sram_type(void);
103unsigned int smbios_cache_conf_operation_mode(u8 level);
104
BryantOu4a8e58f2020-04-20 19:45:20 -0700105/* Used by mainboard to add port information of type 8 */
106struct port_information;
107int smbios_write_type8(unsigned long *current, int *handle,
108 const struct port_information *port,
109 size_t num_ports);
110
Elyes HAOUAS3233cf42019-02-14 17:46:02 +0100111#define BIOS_CHARACTERISTICS_PCI_SUPPORTED (1 << 7)
112#define BIOS_CHARACTERISTICS_PC_CARD (1 << 8)
113#define BIOS_CHARACTERISTICS_PNP (1 << 9)
114#define BIOS_CHARACTERISTICS_APM (1 << 10)
115#define BIOS_CHARACTERISTICS_UPGRADEABLE (1 << 11)
116#define BIOS_CHARACTERISTICS_SHADOW (1 << 12)
117#define BIOS_CHARACTERISTICS_BOOT_FROM_CD (1 << 15)
118#define BIOS_CHARACTERISTICS_SELECTABLE_BOOT (1 << 16)
119#define BIOS_CHARACTERISTICS_BIOS_SOCKETED (1 << 17)
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200120
Elyes HAOUAS3233cf42019-02-14 17:46:02 +0100121#define BIOS_EXT1_CHARACTERISTICS_ACPI (1 << 0)
122#define BIOS_EXT2_CHARACTERISTICS_TARGET (1 << 2)
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200123
Timothy Pearson821217b2015-03-27 22:47:25 -0500124#define BIOS_MEMORY_ECC_SINGLE_BIT_CORRECTING (1 << 3)
125#define BIOS_MEMORY_ECC_DOUBLE_BIT_CORRECTING (1 << 4)
126#define BIOS_MEMORY_ECC_SCRUBBING (1 << 5)
127
128#define MEMORY_TYPE_DETAIL_OTHER (1 << 1)
129#define MEMORY_TYPE_DETAIL_UNKNOWN (1 << 2)
130#define MEMORY_TYPE_DETAIL_FAST_PAGED (1 << 3)
131#define MEMORY_TYPE_DETAIL_STATIC_COLUMN (1 << 4)
132#define MEMORY_TYPE_DETAIL_PSEUDO_STATIC (1 << 5)
133#define MEMORY_TYPE_DETAIL_RAMBUS (1 << 6)
134#define MEMORY_TYPE_DETAIL_SYNCHRONOUS (1 << 7)
135#define MEMORY_TYPE_DETAIL_CMOS (1 << 8)
136#define MEMORY_TYPE_DETAIL_EDO (1 << 9)
137#define MEMORY_TYPE_DETAIL_WINDOW_DRAM (1 << 10)
138#define MEMORY_TYPE_DETAIL_CACHE_DRAM (1 << 11)
139#define MEMORY_TYPE_DETAIL_NON_VOLATILE (1 << 12)
140#define MEMORY_TYPE_DETAIL_REGISTERED (1 << 13)
141#define MEMORY_TYPE_DETAIL_UNBUFFERED (1 << 14)
Elyes HAOUAS1db23462019-02-14 17:49:47 +0100142#define MEMORY_TYPE_DETAIL_LRDIMM (1 << 15)
143
144#define MEMORY_TECHNOLOGY_OTHER 0x01
145#define MEMORY_TECHNOLOGY_UNKNOWN 0x02
146#define MEMORY_TECHNOLOGY_DRAM 0x03
147#define MEMORY_TECHNOLOGY_NVDIMM_N 0x04
148#define MEMORY_TECHNOLOGY_NVDIMM_F 0x05
149#define MEMORY_TECHNOLOGY_NVDIMM_P 0x06
150#define MEMORY_TECHNOLOGY_INTEL_PERSISTENT 0x07
151
152#define MEMORY_OPERATING_MODE_CAP_OTHER (1 << 1)
153#define MEMORY_OPERATING_MODE_CAP_UNKNOWN (1 << 2)
154#define MEMORY_OPERATING_MODE_CAP_VOLATILE (1 << 3)
155#define MEMORY_OPERATING_MODE_CAP_BYTE_ACCESS_PERSISTENT (1 << 4)
156#define MEMORY_OPERATING_MODE_CAP_BLOCK_ACCESS_PERSISTENT (1 << 5)
Timothy Pearson821217b2015-03-27 22:47:25 -0500157
Kane Chen33faac62014-07-27 12:54:44 -0700158typedef enum {
Lee Leahy0be6d932015-06-26 11:15:42 -0700159 MEMORY_BUS_WIDTH_8 = 0,
160 MEMORY_BUS_WIDTH_16 = 1,
161 MEMORY_BUS_WIDTH_32 = 2,
162 MEMORY_BUS_WIDTH_64 = 3,
163 MEMORY_BUS_WIDTH_128 = 4,
164 MEMORY_BUS_WIDTH_256 = 5,
165 MEMORY_BUS_WIDTH_512 = 6,
166 MEMORY_BUS_WIDTH_1024 = 7,
167 MEMORY_BUS_WIDTH_MAX = 7,
168} smbios_memory_bus_width;
169
170typedef enum {
Kane Chen33faac62014-07-27 12:54:44 -0700171 MEMORY_FORMFACTOR_OTHER = 0x01,
172 MEMORY_FORMFACTOR_UNKNOWN = 0x02,
173 MEMORY_FORMFACTOR_SIMM = 0x03,
174 MEMORY_FORMFACTOR_SIP = 0x04,
175 MEMORY_FORMFACTOR_CHIP = 0x05,
176 MEMORY_FORMFACTOR_DIP = 0x06,
177 MEMORY_FORMFACTOR_ZIP = 0x07,
178 MEMORY_FORMFACTOR_PROPRIETARY_CARD = 0x08,
179 MEMORY_FORMFACTOR_DIMM = 0x09,
180 MEMORY_FORMFACTOR_TSOP = 0x0a,
181 MEMORY_FORMFACTOR_ROC = 0x0b,
182 MEMORY_FORMFACTOR_RIMM = 0x0c,
183 MEMORY_FORMFACTOR_SODIMM = 0x0d,
184 MEMORY_FORMFACTOR_SRIMM = 0x0e,
185 MEMORY_FORMFACTOR_FBDIMM = 0x0f,
Elyes HAOUAS86b683a2019-10-08 16:30:43 +0200186 MEMORY_FORMFACTOR_DIE = 0x10,
Kane Chen33faac62014-07-27 12:54:44 -0700187} smbios_memory_form_factor;
188
Timothy Pearson821217b2015-03-27 22:47:25 -0500189typedef enum {
190 MEMORY_TYPE_OTHER = 0x01,
191 MEMORY_TYPE_UNKNOWN = 0x02,
192 MEMORY_TYPE_DRAM = 0x03,
193 MEMORY_TYPE_EDRAM = 0x04,
194 MEMORY_TYPE_VRAM = 0x05,
195 MEMORY_TYPE_SRAM = 0x06,
196 MEMORY_TYPE_RAM = 0x07,
197 MEMORY_TYPE_ROM = 0x08,
198 MEMORY_TYPE_FLASH = 0x09,
199 MEMORY_TYPE_EEPROM = 0x0a,
200 MEMORY_TYPE_FEPROM = 0x0b,
201 MEMORY_TYPE_EPROM = 0x0c,
202 MEMORY_TYPE_CDRAM = 0x0d,
203 MEMORY_TYPE_3DRAM = 0x0e,
204 MEMORY_TYPE_SDRAM = 0x0f,
205 MEMORY_TYPE_SGRAM = 0x10,
206 MEMORY_TYPE_RDRAM = 0x11,
207 MEMORY_TYPE_DDR = 0x12,
208 MEMORY_TYPE_DDR2 = 0x13,
209 MEMORY_TYPE_DDR2_FBDIMM = 0x14,
210 MEMORY_TYPE_DDR3 = 0x18,
211 MEMORY_TYPE_FBD2 = 0x19,
Elyes HAOUAS28114ae2018-11-14 17:51:00 +0100212 MEMORY_TYPE_DDR4 = 0x1a,
213 MEMORY_TYPE_LPDDR = 0x1b,
214 MEMORY_TYPE_LPDDR2 = 0x1c,
215 MEMORY_TYPE_LPDDR3 = 0x1d,
216 MEMORY_TYPE_LPDDR4 = 0x1e,
217 MEMORY_TYPE_LOGICAL_NON_VOLATILE_DEVICE = 0x1f,
Elyes HAOUAS86b683a2019-10-08 16:30:43 +0200218 MEMORY_TYPE_HBM = 0x20,
219 MEMORY_TYPE_HBM2 = 0x21,
Subrata Banik6cdc8382021-10-27 23:04:07 +0530220 MEMORY_TYPE_DDR5 = 0x22,
221 MEMORY_TYPE_LPDDR5 = 0x23,
Elyes Haouas5bbdb0c2022-06-23 13:38:26 +0200222 MEMORY_TYPE_HBM3 = 0x24,
Timothy Pearson821217b2015-03-27 22:47:25 -0500223} smbios_memory_type;
224
225typedef enum {
226 MEMORY_ARRAY_LOCATION_OTHER = 0x01,
227 MEMORY_ARRAY_LOCATION_UNKNOWN = 0x02,
228 MEMORY_ARRAY_LOCATION_SYSTEM_BOARD = 0x03,
229 MEMORY_ARRAY_LOCATION_ISA_ADD_ON = 0x04,
230 MEMORY_ARRAY_LOCATION_EISA_ADD_ON = 0x05,
231 MEMORY_ARRAY_LOCATION_PCI_ADD_ON = 0x06,
232 MEMORY_ARRAY_LOCATION_MCA_ADD_ON = 0x07,
233 MEMORY_ARRAY_LOCATION_PCMCIA_ADD_ON = 0x08,
234 MEMORY_ARRAY_LOCATION_PROPRIETARY_ADD_ON = 0x09,
235 MEMORY_ARRAY_LOCATION_NUBUS = 0x0a,
236 MEMORY_ARRAY_LOCATION_PC_98_C20_ADD_ON = 0xa0,
237 MEMORY_ARRAY_LOCATION_PC_98_C24_ADD_ON = 0xa1,
238 MEMORY_ARRAY_LOCATION_PC_98_E_ADD_ON = 0xa2,
239 MEMORY_ARRAY_LOCATION_PC_98_LOCAL_BUS_ADD_ON = 0xa3,
Elyes HAOUAS77fe2132019-10-29 08:42:03 +0100240 MEMORY_ARRAY_LOCATION_CXL_FLEXBUS_1_0_ADD_ON = 0xa4,
Timothy Pearson821217b2015-03-27 22:47:25 -0500241} smbios_memory_array_location;
242
243typedef enum {
244 MEMORY_ARRAY_USE_OTHER = 0x01,
245 MEMORY_ARRAY_USE_UNKNOWN = 0x02,
246 MEMORY_ARRAY_USE_SYSTEM = 0x03,
247 MEMORY_ARRAY_USE_VIDEO = 0x04,
248 MEMORY_ARRAY_USE_FLASH = 0x05,
249 MEMORY_ARRAY_USE_NVRAM = 0x06,
250 MEMORY_ARRAY_USE_CACHE = 0x07,
251} smbios_memory_array_use;
252
253typedef enum {
254 MEMORY_ARRAY_ECC_OTHER = 0x01,
255 MEMORY_ARRAY_ECC_UNKNOWN = 0x02,
256 MEMORY_ARRAY_ECC_NONE = 0x03,
257 MEMORY_ARRAY_ECC_PARITY = 0x04,
258 MEMORY_ARRAY_ECC_SINGLE_BIT = 0x05,
259 MEMORY_ARRAY_ECC_MULTI_BIT = 0x06,
260 MEMORY_ARRAY_ECC_CRC = 0x07,
261} smbios_memory_array_ecc;
262
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200263#define SMBIOS_STATE_SAFE 3
264typedef enum {
Elyes HAOUASa0fed372016-09-16 20:17:40 +0200265 SMBIOS_BIOS_INFORMATION = 0,
266 SMBIOS_SYSTEM_INFORMATION = 1,
267 SMBIOS_BOARD_INFORMATION = 2,
268 SMBIOS_SYSTEM_ENCLOSURE = 3,
269 SMBIOS_PROCESSOR_INFORMATION = 4,
270 SMBIOS_CACHE_INFORMATION = 7,
BryantOu4a8e58f2020-04-20 19:45:20 -0700271 SMBIOS_PORT_CONNECTOR_INFORMATION = 8,
Elyes HAOUASa0fed372016-09-16 20:17:40 +0200272 SMBIOS_SYSTEM_SLOTS = 9,
273 SMBIOS_OEM_STRINGS = 11,
274 SMBIOS_EVENT_LOG = 15,
275 SMBIOS_PHYS_MEMORY_ARRAY = 16,
276 SMBIOS_MEMORY_DEVICE = 17,
277 SMBIOS_MEMORY_ARRAY_MAPPED_ADDRESS = 19,
Matt DeVillierd1c1afd2016-09-02 21:41:26 -0500278 SMBIOS_MEMORY_DEVICE_MAPPED_ADDRESS = 20,
Erik van den Bogaert93781522022-09-28 12:35:51 +0200279 SMBIOS_TEMPERATURE_PROBE = 28,
Elyes HAOUASa0fed372016-09-16 20:17:40 +0200280 SMBIOS_SYSTEM_BOOT_INFORMATION = 32,
Patrick Rudolphfe98e902018-03-27 16:17:12 +0200281 SMBIOS_IPMI_DEVICE_INFORMATION = 38,
Jonathan Zhangd57b8212022-10-14 17:06:26 -0700282 SMBIOS_SYSTEM_POWER_SUPPLY = 39,
Elyes HAOUASa0fed372016-09-16 20:17:40 +0200283 SMBIOS_ONBOARD_DEVICES_EXTENDED_INFORMATION = 41,
Michał Żygowskie7795232022-05-04 14:10:45 +0200284 SMBIOS_TPM_DEVICE = 43,
Elyes HAOUASa0fed372016-09-16 20:17:40 +0200285 SMBIOS_END_OF_TABLE = 127,
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200286} smbios_struct_type_t;
287
288struct smbios_entry {
289 u8 anchor[4];
290 u8 checksum;
291 u8 length;
292 u8 major_version;
293 u8 minor_version;
294 u16 max_struct_size;
295 u8 entry_point_rev;
296 u8 formwatted_area[5];
297 u8 intermediate_anchor_string[5];
298 u8 intermediate_checksum;
299 u16 struct_table_length;
300 u32 struct_table_address;
301 u16 struct_count;
302 u8 smbios_bcd_revision;
Stefan Reinauer6a001132017-07-13 02:20:27 +0200303} __packed;
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200304
Patrick Rudolph7a835822020-07-22 16:00:53 +0200305struct smbios_entry30 {
306 u8 anchor[5];
307 u8 checksum;
308 u8 length;
309 u8 major_version;
310 u8 minor_version;
311 u8 smbios_doc_rev;
312 u8 entry_point_rev;
313 u8 reserved;
314 u32 struct_table_length;
315 u64 struct_table_address;
316} __packed;
317
Angel Ponsca01baa2021-06-28 16:06:28 +0200318struct smbios_header {
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200319 u8 type;
320 u8 length;
321 u16 handle;
Angel Ponsca01baa2021-06-28 16:06:28 +0200322} __packed;
323
324struct smbios_type0 {
Angel Ponsb554b7c2021-06-28 17:42:40 +0200325 struct smbios_header header;
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200326 u8 vendor;
327 u8 bios_version;
328 u16 bios_start_segment;
329 u8 bios_release_date;
330 u8 bios_rom_size;
331 u64 bios_characteristics;
332 u8 bios_characteristics_ext1;
333 u8 bios_characteristics_ext2;
334 u8 system_bios_major_release;
335 u8 system_bios_minor_release;
336 u8 ec_major_release;
337 u8 ec_minor_release;
Elyes HAOUAS358cbb32019-02-14 14:19:22 +0100338 u16 extended_bios_rom_size;
Konstantin Aladyshevd0df1d72017-08-01 15:52:46 +0300339 u8 eos[2];
Stefan Reinauer6a001132017-07-13 02:20:27 +0200340} __packed;
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200341
Tim Chu13ab1d72021-10-19 01:45:12 +0000342typedef enum {
343 SMBIOS_WAKEUP_TYPE_RESERVED = 0x00,
344 SMBIOS_WAKEUP_TYPE_OTHER = 0x01,
345 SMBIOS_WAKEUP_TYPE_UNKNOWN = 0x02,
346 SMBIOS_WAKEUP_TYPE_APM_TIMER = 0x03,
347 SMBIOS_WAKEUP_TYPE_MODEM_RING = 0x04,
348 SMBIOS_WAKEUP_TYPE_LAN_REMOTE = 0x05,
349 SMBIOS_WAKEUP_TYPE_POWER_SWITCH = 0x06,
350 SMBIOS_WAKEUP_TYPE_PCI_PME = 0x07,
351 SMBIOS_WAKEUP_TYPE_AC_POWER_RESTORED = 0x08,
352} smbios_wakeup_type;
353
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200354struct smbios_type1 {
Angel Ponsb554b7c2021-06-28 17:42:40 +0200355 struct smbios_header header;
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200356 u8 manufacturer;
357 u8 product_name;
358 u8 version;
359 u8 serial_number;
360 u8 uuid[16];
361 u8 wakeup_type;
362 u8 sku;
363 u8 family;
Konstantin Aladyshevd0df1d72017-08-01 15:52:46 +0300364 u8 eos[2];
Stefan Reinauer6a001132017-07-13 02:20:27 +0200365} __packed;
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200366
Tim Chue82aa222020-12-21 23:33:18 -0800367#define SMBIOS_FEATURE_FLAGS_HOSTING_BOARD (1 << 0)
368#define SMBIOS_FEATURE_FLAGS_REQUIRES_DAUGHTER_CARD (1 << 1)
369#define SMBIOS_FEATURE_FLAGS_REMOVABLE (1 << 2)
370#define SMBIOS_FEATURE_FLAGS_REPLACEABLE (1 << 3)
371#define SMBIOS_FEATURE_FLAGS_HOT_SWAPPABLE (1 << 4)
372
Julien Viard de Galbert9a31dfe2018-02-22 16:39:58 +0100373typedef enum {
374 SMBIOS_BOARD_TYPE_UNKNOWN = 0x01,
375 SMBIOS_BOARD_TYPE_OTHER = 0x02,
376 SMBIOS_BOARD_TYPE_SERVER_BLADE = 0x03,
377 SMBIOS_BOARD_TYPE_CONNECTIVITY_SWITCH = 0x04,
378 SMBIOS_BOARD_TYPE_SYSTEM_MANAGEMENT_MODULE = 0x05,
379 SMBIOS_BOARD_TYPE_PROCESSOR_MODULE = 0x06,
380 SMBIOS_BOARD_TYPE_IO_MODULE = 0x07,
381 SMBIOS_BOARD_TYPE_MEMORY_MODULE = 0x08,
382 SMBIOS_BOARD_TYPE_DAUGHTER_BOARD = 0x09,
383 SMBIOS_BOARD_TYPE_MOTHERBOARD = 0x0a,
384 SMBIOS_BOARD_TYPE_PROCESSOR_MEMORY_MODULE = 0x0b,
385 SMBIOS_BOARD_TYPE_PROCESSOR_IO_MODULE = 0x0c,
386 SMBIOS_BOARD_TYPE_INTERCONNECT_BOARD = 0x0d,
387} smbios_board_type;
388
Vladimir Serbinenko47089f22014-03-02 19:14:44 +0100389struct smbios_type2 {
Angel Ponsb554b7c2021-06-28 17:42:40 +0200390 struct smbios_header header;
Vladimir Serbinenko47089f22014-03-02 19:14:44 +0100391 u8 manufacturer;
392 u8 product_name;
393 u8 version;
394 u8 serial_number;
Julien Viard de Galbert9a31dfe2018-02-22 16:39:58 +0100395 u8 asset_tag;
396 u8 feature_flags;
397 u8 location_in_chassis;
398 u16 chassis_handle;
399 u8 board_type;
Konstantin Aladyshevd0df1d72017-08-01 15:52:46 +0300400 u8 eos[2];
Stefan Reinauer6a001132017-07-13 02:20:27 +0200401} __packed;
Vladimir Serbinenko47089f22014-03-02 19:14:44 +0100402
Mathew Kingbe820b32019-10-31 12:10:44 -0600403typedef enum {
Elyes HAOUAS25dbc172017-07-04 21:38:03 +0200404 SMBIOS_ENCLOSURE_OTHER = 0x01,
405 SMBIOS_ENCLOSURE_UNKNOWN = 0x02,
406 SMBIOS_ENCLOSURE_DESKTOP = 0x03,
407 SMBIOS_ENCLOSURE_LOW_PROFILE_DESKTOP = 0x04,
408 SMBIOS_ENCLOSURE_PIZZA_BOX = 0x05,
409 SMBIOS_ENCLOSURE_MINI_TOWER = 0x06,
410 SMBIOS_ENCLOSURE_TOWER = 0x07,
411 SMBIOS_ENCLOSURE_PORTABLE = 0x08,
412 SMBIOS_ENCLOSURE_LAPTOP = 0x09,
413 SMBIOS_ENCLOSURE_NOTEBOOK = 0x0a,
414 SMBIOS_ENCLOSURE_HAND_HELD = 0x0b,
415 SMBIOS_ENCLOSURE_DOCKING_STATION = 0x0c,
416 SMBIOS_ENCLOSURE_ALL_IN_ONE = 0x0d,
417 SMBIOS_ENCLOSURE_SUB_NOTEBOOK = 0x0e,
418 SMBIOS_ENCLOSURE_SPACE_SAVING = 0x0f,
419 SMBIOS_ENCLOSURE_LUNCH_BOX = 0x10,
420 SMBIOS_ENCLOSURE_MAIN_SERVER_CHASSIS = 0x11,
421 SMBIOS_ENCLOSURE_EXPANSION_CHASSIS = 0x12,
422 SMBIOS_ENCLOSURE_SUBCHASSIS = 0x13,
423 SMBIOS_ENCLOSURE_BUS_EXPANSION_CHASSIS = 0x14,
424 SMBIOS_ENCLOSURE_PERIPHERAL_CHASSIS = 0x15,
425 SMBIOS_ENCLOSURE_RAID_CHASSIS = 0x16,
426 SMBIOS_ENCLOSURE_RACK_MOUNT_CHASSIS = 0x17,
427 SMBIOS_ENCLOSURE_SEALED_CASE_PC = 0x18,
428 SMBIOS_ENCLOSURE_MULTI_SYSTEM_CHASSIS = 0x19,
429 SMBIOS_ENCLOSURE_COMPACT_PCI = 0x1a,
430 SMBIOS_ENCLOSURE_ADVANCED_TCA = 0x1b,
431 SMBIOS_ENCLOSURE_BLADE = 0x1c,
432 SMBIOS_ENCLOSURE_BLADE_ENCLOSURE = 0x1d,
433 SMBIOS_ENCLOSURE_TABLET = 0x1e,
434 SMBIOS_ENCLOSURE_CONVERTIBLE = 0x1f,
435 SMBIOS_ENCLOSURE_DETACHABLE = 0x20,
436 SMBIOS_ENCLOSURE_IOT_GATEWAY = 0x21,
437 SMBIOS_ENCLOSURE_EMBEDDED_PC = 0x22,
438 SMBIOS_ENCLOSURE_MINI_PC = 0x23,
439 SMBIOS_ENCLOSURE_STICK_PC = 0x24,
Mathew Kingbe820b32019-10-31 12:10:44 -0600440} smbios_enclosure_type;
Vladimir Serbinenko71c0bf62014-08-27 23:23:14 +0200441
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200442struct smbios_type3 {
Angel Ponsb554b7c2021-06-28 17:42:40 +0200443 struct smbios_header header;
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200444 u8 manufacturer;
445 u8 _type;
446 u8 version;
447 u8 serial_number;
448 u8 asset_tag_number;
449 u8 bootup_state;
450 u8 power_supply_state;
451 u8 thermal_state;
452 u8 security_status;
453 u32 oem_defined;
454 u8 height;
455 u8 number_of_power_cords;
456 u8 element_count;
457 u8 element_record_length;
Matt DeVillier4863cc42016-09-01 00:55:40 -0500458 u8 sku_number;
Konstantin Aladyshevd0df1d72017-08-01 15:52:46 +0300459 u8 eos[2];
Stefan Reinauer6a001132017-07-13 02:20:27 +0200460} __packed;
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200461
462struct smbios_type4 {
Angel Ponsb554b7c2021-06-28 17:42:40 +0200463 struct smbios_header header;
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200464 u8 socket_designation;
465 u8 processor_type;
466 u8 processor_family;
467 u8 processor_manufacturer;
468 u32 processor_id[2];
469 u8 processor_version;
470 u8 voltage;
471 u16 external_clock;
472 u16 max_speed;
473 u16 current_speed;
474 u8 status;
475 u8 processor_upgrade;
476 u16 l1_cache_handle;
477 u16 l2_cache_handle;
478 u16 l3_cache_handle;
479 u8 serial_number;
480 u8 asset_tag;
481 u8 part_number;
482 u8 core_count;
483 u8 core_enabled;
484 u8 thread_count;
485 u16 processor_characteristics;
486 u16 processor_family2;
Patrick Rudolph7a835822020-07-22 16:00:53 +0200487 u16 core_count2;
488 u16 core_enabled2;
489 u16 thread_count2;
Konstantin Aladyshevd0df1d72017-08-01 15:52:46 +0300490 u8 eos[2];
Stefan Reinauer6a001132017-07-13 02:20:27 +0200491} __packed;
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200492
Patrick Rudolph4aea6912020-07-22 07:28:26 +0200493/* defines for smbios_type4 */
494
495#define SMBIOS_PROCESSOR_STATUS_POPULATED (1 << 6)
496#define SMBIOS_PROCESSOR_STATUS_CPU_ENABLED (1 << 0)
497
Li, Jinchengaa990122023-01-03 15:43:40 +0800498/* enum for socket type */
499enum smbios_processor_upgrade_field {
500 PROCESSOR_UPGRADE_OTHER = 0x01,
501 PROCESSOR_UPGRADE_UNKNOWN = 0x02,
502 PROCESSOR_UPGRADE_DAUGHTER_BOARD = 0x03,
503 PROCESSOR_UPGRADE_ZIF_SOCKET = 0x04,
504 PROCESSOR_UPGRADE_REPLACEABLE_PIGGY_BACK = 0x05,
505 PROCESSOR_UPGRADE_NONE = 0x06,
506 PROCESSOR_UPGRADE_LIF_SOCKET = 0x07,
507 PROCESSOR_UPGRADE_SLOT_1 = 0x08,
508 PROCESSOR_UPGRADE_SLOT_2 = 0x09,
509 PROCESSOR_UPGRADE_370_PIN_SOCKET = 0x0a,
510 PROCESSOR_UPGRADE_SLOT_A = 0x0b,
511 PROCESSOR_UPGRADE_SLOT_M = 0x0c,
512 PROCESSOR_UPGRADE_SOCKET_423 = 0x0d,
513 PROCESSOR_UPGRADE_SOCKET_A = 0x0e,
514 PROCESSOR_UPGRADE_SOCKET_478 = 0x0f,
515 PROCESSOR_UPGRADE_SOCKET_754 = 0x10,
516 PROCESSOR_UPGRADE_SOCKET_940 = 0x11,
517 PROCESSOR_UPGRADE_SOCKET_939 = 0x12,
518 PROCESSOR_UPGRADE_SOCKET_MPGA604 = 0x13,
519 PROCESSOR_UPGRADE_SOCKET_LGA771 = 0x14,
520 PROCESSOR_UPGRADE_SOCKET_LGA775 = 0x15,
521 PROCESSOR_UPGRADE_SOCKET_S1 = 0x16,
522 PROCESSOR_UPGRADE_SOCKET_AM2 = 0x17,
523 PROCESSOR_UPGRADE_SOCKET_F = 0x18,
524 PROCESSOR_UPGRADE_SOCKET_LGA1366 = 0x19,
525 PROCESSOR_UPGRADE_SOCKET_G34 = 0x1a,
526 PROCESSOR_UPGRADE_SOCKET_AM3 = 0x1b,
527 PROCESSOR_UPGRADE_SOCKET_C32 = 0x1c,
528 PROCESSOR_UPGRADE_SOCKET_LGA1156 = 0x1d,
529 PROCESSOR_UPGRADE_SOCKET_LGA1567 = 0x1e,
530 PROCESSOR_UPGRADE_SOCKET_PGA988A = 0x1f,
531 PROCESSOR_UPGRADE_SOCKET_BGA1288 = 0x20,
532 PROCESSOR_UPGRADE_SOCKET_RPGA988B = 0x21,
533 PROCESSOR_UPGRADE_SOCKET_BGA1023 = 0x22,
534 PROCESSOR_UPGRADE_SOCKET_BGA1224 = 0x23,
535 PROCESSOR_UPGRADE_SOCKET_LGA1155 = 0x24,
536 PROCESSOR_UPGRADE_SOCKET_LGA1356 = 0x25,
537 PROCESSOR_UPGRADE_SOCKET_LGA2011 = 0x26,
538 PROCESSOR_UPGRADE_SOCKET_FS1 = 0x27,
539 PROCESSOR_UPGRADE_SOCKET_FS2 = 0x28,
540 PROCESSOR_UPGRADE_SOCKET_FM1 = 0x29,
541 PROCESSOR_UPGRADE_SOCKET_FM2 = 0x2a,
542 PROCESSOR_UPGRADE_SOCKET_LGA2011_3 = 0x2b,
543 PROCESSOR_UPGRADE_SOCKET_LGA1356_3 = 0x2c,
544 PROCESSOR_UPGRADE_SOCKET_LGA1150 = 0x2d,
545 PROCESSOR_UPGRADE_SOCKET_BGA1168 = 0x2e,
546 PROCESSOR_UPGRADE_SOCKET_BGA1234 = 0x2f,
547 PROCESSOR_UPGRADE_SOCKET_BGA1364 = 0x30,
548 PROCESSOR_UPGRADE_SOCKET_AM4 = 0x31,
549 PROCESSOR_UPGRADE_SOCKET_LGA1151 = 0x32,
550 PROCESSOR_UPGRADE_SOCKET_BGA1356 = 0x33,
551 PROCESSOR_UPGRADE_SOCKET_BGA1440 = 0x34,
552 PROCESSOR_UPGRADE_SOCKET_BGA1515 = 0x35,
553 PROCESSOR_UPGRADE_SOCKET_LGA3647_1 = 0x36,
554 PROCESSOR_UPGRADE_SOCKET_SP3 = 0x37,
555 PROCESSOR_UPGRADE_SOCKET_SP3R2 = 0x38,
556 PROCESSOR_UPGRADE_SOCKET_LGA2066 = 0x39,
557 PROCESSOR_UPGRADE_SOCKET_BGA1392 = 0x3a,
558 PROCESSOR_UPGRADE_SOCKET_BGA1510 = 0x3b,
559 PROCESSOR_UPGRADE_SOCKET_BGA1528 = 0x3c,
560 PROCESSOR_UPGRADE_SOCKET_LGA4189 = 0x3d,
561 PROCESSOR_UPGRADE_SOCKET_LGA1200 = 0x3e,
562 PROCESSOR_UPGRADE_SOCKET_LGA4677 = 0x3f,
563 PROCESSOR_UPGRADE_SOCKET_LGA1700 = 0x40,
564 PROCESSOR_UPGRADE_SOCKET_BGA1744 = 0x41,
565 PROCESSOR_UPGRADE_SOCKET_BGA1781 = 0x42,
566 PROCESSOR_UPGRADE_SOCKET_BGA1211 = 0x43,
567 PROCESSOR_UPGRADE_SOCKET_BGA2422 = 0x44,
568 PROCESSOR_UPGRADE_SOCKET_LGA1211 = 0x45,
569 PROCESSOR_UPGRADE_SOCKET_LGA2422 = 0x46,
570 PROCESSOR_UPGRADE_SOCKET_LGA5773 = 0x47,
571 PROCESSOR_UPGRADE_SOCKET_BGA5773 = 0x48,
572};
573
Tim Chu323e5a82022-10-27 03:03:59 +0000574/* defines for processor family */
575#define SMBIOS_PROCESSOR_FAMILY_OTHER 0x01
576#define SMBIOS_PROCESSOR_FAMILY_UNKNOWN 0x02
577#define SMBIOS_PROCESSOR_FAMILY_XEON 0xb3
578
579/* defines for processor characteristics */
580#define PROCESSOR_64BIT_CAPABLE (1 << 2)
581#define PROCESSOR_MULTI_CORE (1 << 3)
582#define PROCESSOR_POWER_PERFORMANCE_CONTROL (1 << 7)
583
Patrick Rudolphfc5b8092019-03-30 17:37:28 +0100584/* defines for supported_sram_type/current_sram_type */
585
586#define SMBIOS_CACHE_SRAM_TYPE_OTHER (1 << 0)
587#define SMBIOS_CACHE_SRAM_TYPE_UNKNOWN (1 << 1)
588#define SMBIOS_CACHE_SRAM_TYPE_NON_BURST (1 << 2)
589#define SMBIOS_CACHE_SRAM_TYPE_BURST (1 << 3)
590#define SMBIOS_CACHE_SRAM_TYPE_PIPELINE_BURST (1 << 4)
591#define SMBIOS_CACHE_SRAM_TYPE_SYNCHRONOUS (1 << 5)
592#define SMBIOS_CACHE_SRAM_TYPE_ASYNCHRONOUS (1 << 6)
593
594/* enum for error_correction_type */
595
596enum smbios_cache_error_corr {
597 SMBIOS_CACHE_ERROR_CORRECTION_OTHER = 1,
598 SMBIOS_CACHE_ERROR_CORRECTION_UNKNOWN,
599 SMBIOS_CACHE_ERROR_CORRECTION_NONE,
600 SMBIOS_CACHE_ERROR_CORRECTION_PARITY,
601 SMBIOS_CACHE_ERROR_CORRECTION_SINGLE_BIT,
602 SMBIOS_CACHE_ERROR_CORRECTION_MULTI_BIT,
603};
604
605/* enum for system_cache_type */
606
607enum smbios_cache_type {
608 SMBIOS_CACHE_TYPE_OTHER = 1,
609 SMBIOS_CACHE_TYPE_UNKNOWN,
610 SMBIOS_CACHE_TYPE_INSTRUCTION,
611 SMBIOS_CACHE_TYPE_DATA,
612 SMBIOS_CACHE_TYPE_UNIFIED,
613};
614
615/* enum for associativity */
616
617enum smbios_cache_associativity {
618 SMBIOS_CACHE_ASSOCIATIVITY_OTHER = 1,
619 SMBIOS_CACHE_ASSOCIATIVITY_UNKNOWN,
620 SMBIOS_CACHE_ASSOCIATIVITY_DIRECT,
621 SMBIOS_CACHE_ASSOCIATIVITY_2WAY,
622 SMBIOS_CACHE_ASSOCIATIVITY_4WAY,
623 SMBIOS_CACHE_ASSOCIATIVITY_FULL,
624 SMBIOS_CACHE_ASSOCIATIVITY_8WAY,
625 SMBIOS_CACHE_ASSOCIATIVITY_16WAY,
626 SMBIOS_CACHE_ASSOCIATIVITY_12WAY,
627 SMBIOS_CACHE_ASSOCIATIVITY_24WAY,
628 SMBIOS_CACHE_ASSOCIATIVITY_32WAY,
629 SMBIOS_CACHE_ASSOCIATIVITY_48WAY,
630 SMBIOS_CACHE_ASSOCIATIVITY_64WAY,
631 SMBIOS_CACHE_ASSOCIATIVITY_20WAY,
632};
633
634/* defines for cache_configuration */
635
636#define SMBIOS_CACHE_CONF_LEVEL(x) ((((x) - 1) & 0x7) << 0)
637#define SMBIOS_CACHE_CONF_LOCATION(x) (((x) & 0x3) << 5)
638#define SMBIOS_CACHE_CONF_ENABLED(x) (((x) & 0x1) << 7)
639#define SMBIOS_CACHE_CONF_OPERATION_MODE(x) (((x) & 0x3) << 8)
640
641/* defines for max_cache_size and installed_size */
642
643#define SMBIOS_CACHE_SIZE_UNIT_1KB (0 << 15)
644#define SMBIOS_CACHE_SIZE_UNIT_64KB (1 << 15)
645#define SMBIOS_CACHE_SIZE_MASK 0x7fff
646#define SMBIOS_CACHE_SIZE_OVERFLOW 0xffff
647
648#define SMBIOS_CACHE_SIZE2_UNIT_1KB (0 << 31)
649#define SMBIOS_CACHE_SIZE2_UNIT_64KB (1UL << 31)
650#define SMBIOS_CACHE_SIZE2_MASK 0x7fffffff
651
Morgan Jang8ae391d2020-10-06 16:26:17 +0800652/* define for cache operation mode */
653
654#define SMBIOS_CACHE_OP_MODE_WRITE_THROUGH 0
655#define SMBIOS_CACHE_OP_MODE_WRITE_BACK 1
656#define SMBIOS_CACHE_OP_MODE_VARIES_WITH_MEMORY_ADDRESS 2
657#define SMBIOS_CACHE_OP_MODE_UNKNOWN 3
658
Patrick Rudolphfc5b8092019-03-30 17:37:28 +0100659struct smbios_type7 {
Angel Ponsb554b7c2021-06-28 17:42:40 +0200660 struct smbios_header header;
Patrick Rudolphfc5b8092019-03-30 17:37:28 +0100661 u8 socket_designation;
662 u16 cache_configuration;
663 u16 max_cache_size;
664 u16 installed_size;
665 u16 supported_sram_type;
666 u16 current_sram_type;
667 u8 cache_speed;
668 u8 error_correction_type;
669 u8 system_cache_type;
670 u8 associativity;
671 u32 max_cache_size2;
672 u32 installed_size2;
673 u8 eos[2];
674} __packed;
675
BryantOu4a8e58f2020-04-20 19:45:20 -0700676/* enum for connector types */
677typedef enum {
678 CONN_NONE = 0x00,
679 CONN_CENTRONICS = 0x01,
680 CONN_MINI_CENTRONICS = 0x02,
681 CONN_PROPRIETARY = 0x03,
682 CONN_DB_25_PIN_MALE = 0x04,
683 CONN_DB_25_PIN_FEMALE = 0x05,
684 CONN_DB_15_PIN_MALE = 0x06,
685 CONN_DB_15_PIN_FEMALE = 0x07,
686 CONN_DB_9_PIN_MALE = 0x08,
687 CONN_DB_9_PIN_FEMALE = 0x09,
688 CONN_RJ_11 = 0x0A,
689 CONN_RJ_45 = 0x0B,
690 CONN_50_PIN_MINI_SCSI = 0x0C,
691 CONN_MINI_DIN = 0x0D,
692 CONN_MICRO_DIN = 0x0E,
693 CONN_PS_2 = 0x0F,
694 CONN_INFRARED = 0x10,
695 CONN_HP_HIL = 0x11,
696 CONN_ACCESS_BUS_USB = 0x12,
697 CONN_SSA_SCSI = 0x13,
698 CONN_CIRCULAR_DIN_8_MALE = 0x14,
699 CONN_CIRCULAR_DIN_8_FEMALE = 0x15,
700 CONN_ON_BOARD_IDE = 0x16,
701 CONN_ON_BOARD_FLOPPY = 0x17,
702 CONN_9_PIN_DUAL_INLINE = 0x18,
703 CONN_25_PIN_DUAL_INLINE = 0x19,
704 CONN_50_PIN_DUAL_INLINE = 0x1A,
705 CONN_68_PIN_DUAL_INLINE = 0x1B,
706 CONN_ON_BOARD_SOUND_INPUT_FROM_CD_ROM = 0x1C,
707 CONN_MINI_CENTRONICS_TYPE14 = 0x1D,
708 CONN_MINI_CENTRONICS_TYPE26 = 0x1E,
709 CONN_MINI_JACK_HEADPHONES = 0x1F,
710 CONN_BNC = 0x20,
711 CONN_1394 = 0x21,
712 CONN_SAS_SATA = 0x22,
713 CONN_USB_TYPE_C = 0x23,
714 CONN_PC_98 = 0xA0,
715 CONN_PC_98_HIRESO = 0xA1,
716 CONN_PC_H98 = 0xA2,
717 CONN_PC98_NOTE = 0xA3,
718 CONN_PC_98_FULL = 0xA4,
719 CONN_OTHER = 0xFF,
720} type8_connector_types;
721
722/* enum for port types */
723typedef enum {
Patrick Georgi54be3952020-07-04 21:22:25 +0200724 TYPE_NONE_PORT = 0x00,
BryantOu4a8e58f2020-04-20 19:45:20 -0700725 TYPE_PARALLEL_PORT_XT_AT_COMPATIBLE = 0x01,
726 TYPE_PARALLEL_PORT_PS_2 = 0x02,
727 TYPE_PARALLEL_PORT_ECP = 0x03,
728 TYPE_PARALLEL_PORT_EPP = 0x04,
729 TYPE_PARALLEL_PORT_ECP_EPP = 0x05,
730 TYPE_SERIAL_PORT_XT_AT_COMPATIBLE = 0x06,
731 TYPE_SERIAL_PORT_16450_COMPATIBLE = 0x07,
732 TYPE_SERIAL_PORT_16550_COMPATIBLE = 0x08,
733 TYPE_SERIAL_PORT_16550A_COMPATIBLE = 0x09,
734 TYPE_SCSI_PORT = 0x0A,
735 TYPE_MIDI_PORT = 0x0B,
736 TYPE_JOY_STICK_PORT = 0x0C,
737 TYPE_KEYBOARD_PORT = 0x0D,
738 TYPE_MOUSE_PORT = 0x0E,
739 TYPE_SSA_SCSI = 0x0F,
740 TYPE_USB = 0x10,
741 TYPE_FIREWIRE_IEEE_P1394 = 0x11,
742 TYPE_PCMCIA_TYPE_I = 0x12,
743 TYPE_PCMCIA_TYPE_II = 0x13,
744 TYPE_PCMCIA_TYPE_III = 0x14,
745 TYPE_CARDBUS = 0x15,
746 TYPE_ACCESS_BUS_PORT = 0x16,
747 TYPE_SCSI_II = 0x17,
748 TYPE_SCSI_WIDE = 0x18,
749 TYPE_PC_98 = 0x19,
750 TYPE_PC_98_HIRESO = 0x1A,
751 TYPE_PC_H98 = 0x1B,
752 TYPE_VIDEO_PORT = 0x1C,
753 TYPE_AUDIO_PORT = 0x1D,
754 TYPE_MODEM_PORT = 0x1E,
755 TYPE_NETWORK_PORT = 0x1F,
756 TYPE_SATA = 0x20,
757 TYPE_SAS = 0x21,
758 TYPE_MFDP = 0x22,
759 TYPE_THUNDERBOLT = 0x23,
760 TYPE_8251_COMPATIBLE = 0xA0,
761 TYPE_8251_FIFO_COMPATIBLE = 0xA1,
Patrick Georgi54be3952020-07-04 21:22:25 +0200762 TYPE_OTHER_PORT = 0xFF,
BryantOu4a8e58f2020-04-20 19:45:20 -0700763} type8_port_types;
764
765struct port_information {
766 const char *internal_reference_designator;
767 type8_connector_types internal_connector_type;
768 const char *external_reference_designator;
769 type8_connector_types external_connector_type;
770 type8_port_types port_type;
771};
772
773struct smbios_type8 {
Angel Ponsb554b7c2021-06-28 17:42:40 +0200774 struct smbios_header header;
BryantOu4a8e58f2020-04-20 19:45:20 -0700775 u8 internal_reference_designator;
776 u8 internal_connector_type;
777 u8 external_reference_designator;
778 u8 external_connector_type;
779 u8 port_type;
780 u8 eos[2];
781} __packed;
782
Lijian Zhaoe98a7512019-04-11 23:28:09 -0700783/* System Slots - Slot Type */
784enum misc_slot_type {
785 SlotTypeOther = 0x01,
786 SlotTypeUnknown = 0x02,
787 SlotTypeIsa = 0x03,
788 SlotTypeMca = 0x04,
789 SlotTypeEisa = 0x05,
790 SlotTypePci = 0x06,
791 SlotTypePcmcia = 0x07,
792 SlotTypeVlVesa = 0x08,
793 SlotTypeProprietary = 0x09,
794 SlotTypeProcessorCardSlot = 0x0A,
795 SlotTypeProprietaryMemoryCardSlot = 0x0B,
796 SlotTypeIORiserCardSlot = 0x0C,
797 SlotTypeNuBus = 0x0D,
798 SlotTypePci66MhzCapable = 0x0E,
799 SlotTypeAgp = 0x0F,
800 SlotTypeApg2X = 0x10,
801 SlotTypeAgp4X = 0x11,
802 SlotTypePciX = 0x12,
803 SlotTypeAgp8X = 0x13,
804 SlotTypeM2Socket1_DP = 0x14,
805 SlotTypeM2Socket1_SD = 0x15,
806 SlotTypeM2Socket2 = 0x16,
807 SlotTypeM2Socket3 = 0x17,
808 SlotTypeMxmTypeI = 0x18,
809 SlotTypeMxmTypeII = 0x19,
810 SlotTypeMxmTypeIIIStandard = 0x1A,
811 SlotTypeMxmTypeIIIHe = 0x1B,
812 SlotTypeMxmTypeIV = 0x1C,
813 SlotTypeMxm30TypeA = 0x1D,
814 SlotTypeMxm30TypeB = 0x1E,
815 SlotTypePciExpressGen2Sff_8639 = 0x1F,
816 SlotTypePciExpressGen3Sff_8639 = 0x20,
817 SlotTypePciExpressMini52pinWithBSKO = 0x21,
818 SlotTypePciExpressMini52pinWithoutBSKO = 0x22,
819 SlotTypePciExpressMini76pin = 0x23,
Tim Chu323e5a82022-10-27 03:03:59 +0000820 SlotTypePciExpressOCPNIC30SFF = 0x26,
Lijian Zhaoe98a7512019-04-11 23:28:09 -0700821 SlotTypePC98C20 = 0xA0,
822 SlotTypePC98C24 = 0xA1,
823 SlotTypePC98E = 0xA2,
824 SlotTypePC98LocalBus = 0xA3,
825 SlotTypePC98Card = 0xA4,
826 SlotTypePciExpress = 0xA5,
827 SlotTypePciExpressX1 = 0xA6,
828 SlotTypePciExpressX2 = 0xA7,
829 SlotTypePciExpressX4 = 0xA8,
830 SlotTypePciExpressX8 = 0xA9,
831 SlotTypePciExpressX16 = 0xAA,
832 SlotTypePciExpressGen2 = 0xAB,
833 SlotTypePciExpressGen2X1 = 0xAC,
834 SlotTypePciExpressGen2X2 = 0xAD,
835 SlotTypePciExpressGen2X4 = 0xAE,
836 SlotTypePciExpressGen2X8 = 0xAF,
837 SlotTypePciExpressGen2X16 = 0xB0,
838 SlotTypePciExpressGen3 = 0xB1,
839 SlotTypePciExpressGen3X1 = 0xB2,
840 SlotTypePciExpressGen3X2 = 0xB3,
841 SlotTypePciExpressGen3X4 = 0xB4,
842 SlotTypePciExpressGen3X8 = 0xB5,
Elyes HAOUAS5d0942b2019-10-08 16:13:34 +0200843 SlotTypePciExpressGen3X16 = 0xB6,
844 SlotTypePciExpressGen4 = 0xB8,
845 SlotTypePciExpressGen4x1 = 0xB9,
846 SlotTypePciExpressGen4x2 = 0xBA,
847 SlotTypePciExpressGen4x4 = 0xBB,
848 SlotTypePciExpressGen4x8 = 0xBC,
Elyes HAOUASf6c100f2021-12-12 09:04:38 +0100849 SlotTypePciExpressGen4x16 = 0xBD,
850 SlotTypePciExpressGen5 = 0xBE,
851 SlotTypePciExpressGen5x1 = 0xBF,
852 SlotTypePciExpressGen5x2 = 0xC0,
853 SlotTypePciExpressGen5x4 = 0xC1,
854 SlotTypePciExpressGen5x8 = 0xC2,
855 SlotTypePciExpressGen5x16 = 0xC3
Lijian Zhaoe98a7512019-04-11 23:28:09 -0700856};
857
858/* System Slots - Slot Data Bus Width. */
859enum slot_data_bus_bandwidth {
860 SlotDataBusWidthOther = 0x01,
861 SlotDataBusWidthUnknown = 0x02,
862 SlotDataBusWidth8Bit = 0x03,
863 SlotDataBusWidth16Bit = 0x04,
864 SlotDataBusWidth32Bit = 0x05,
865 SlotDataBusWidth64Bit = 0x06,
866 SlotDataBusWidth128Bit = 0x07,
867 SlotDataBusWidth1X = 0x08,
868 SlotDataBusWidth2X = 0x09,
869 SlotDataBusWidth4X = 0x0A,
870 SlotDataBusWidth8X = 0x0B,
871 SlotDataBusWidth12X = 0x0C,
872 SlotDataBusWidth16X = 0x0D,
873 SlotDataBusWidth32X = 0x0E
874};
875
876/* System Slots - Current Usage. */
877enum misc_slot_usage {
878 SlotUsageOther = 0x01,
879 SlotUsageUnknown = 0x02,
880 SlotUsageAvailable = 0x03,
881 SlotUsageInUse = 0x04,
882 SlotUsageUnavailable = 0x05
883};
884
885/* System Slots - Slot Length.*/
886enum misc_slot_length {
887 SlotLengthOther = 0x01,
888 SlotLengthUnknown = 0x02,
889 SlotLengthShort = 0x03,
890 SlotLengthLong = 0x04
891};
892
893/* System Slots - Slot Characteristics 1. */
894#define SMBIOS_SLOT_UNKNOWN (1 << 0)
895#define SMBIOS_SLOT_5V (1 << 1)
896#define SMBIOS_SLOT_3P3V (1 << 2)
897#define SMBIOS_SLOT_SHARED (1 << 3)
898#define SMBIOS_SLOT_PCCARD_16 (1 << 4)
899#define SMBIOS_SLOT_PCCARD_CARDBUS (1 << 5)
900#define SMBIOS_SLOT_PCCARD_ZOOM (1 << 6)
901#define SMBIOS_SLOT_PCCARD_MODEM_RING (1 << 7)
902/* System Slots - Slot Characteristics 2. */
903#define SMBIOS_SLOT_PME (1 << 0)
904#define SMBIOS_SLOT_HOTPLUG (1 << 1)
905#define SMBIOS_SLOT_SMBUS (1 << 2)
906#define SMBIOS_SLOT_BIFURCATION (1 << 3)
907
908struct slot_peer_groups {
909 u16 peer_seg_num;
910 u8 peer_bus_num;
911 u8 peer_dev_fn_num;
912 u8 peer_data_bus_width;
913} __packed;
914
915struct smbios_type9 {
Angel Ponsb554b7c2021-06-28 17:42:40 +0200916 struct smbios_header header;
Lijian Zhaoe98a7512019-04-11 23:28:09 -0700917 u8 slot_designation;
918 u8 slot_type;
919 u8 slot_data_bus_width;
920 u8 current_usage;
921 u8 slot_length;
922 u16 slot_id;
923 u8 slot_characteristics_1;
924 u8 slot_characteristics_2;
925 u16 segment_group_number;
926 u8 bus_number;
927 u8 device_function_number;
928 u8 data_bus_width;
929 u8 peer_group_count;
930 struct slot_peer_groups peer[0];
931 u8 eos[2];
932} __packed;
933
Peter Stugec392b642013-07-06 19:51:12 +0200934struct smbios_type11 {
Angel Ponsb554b7c2021-06-28 17:42:40 +0200935 struct smbios_header header;
Peter Stugec392b642013-07-06 19:51:12 +0200936 u8 count;
Konstantin Aladyshevd0df1d72017-08-01 15:52:46 +0300937 u8 eos[2];
Stefan Reinauer6a001132017-07-13 02:20:27 +0200938} __packed;
Peter Stugec392b642013-07-06 19:51:12 +0200939
Duncan Laurie472ec9c2012-06-23 16:13:42 -0700940struct smbios_type15 {
Angel Ponsb554b7c2021-06-28 17:42:40 +0200941 struct smbios_header header;
Duncan Laurie472ec9c2012-06-23 16:13:42 -0700942 u16 area_length;
943 u16 header_offset;
944 u16 data_offset;
945 u8 access_method;
946 u8 log_status;
947 u32 change_token;
948 u32 address;
949 u8 header_format;
950 u8 log_type_descriptors;
951 u8 log_type_descriptor_length;
Konstantin Aladyshevd0df1d72017-08-01 15:52:46 +0300952 u8 eos[2];
Stefan Reinauer6a001132017-07-13 02:20:27 +0200953} __packed;
Duncan Laurie472ec9c2012-06-23 16:13:42 -0700954
955enum {
956 SMBIOS_EVENTLOG_ACCESS_METHOD_IO8 = 0,
957 SMBIOS_EVENTLOG_ACCESS_METHOD_IO8X2,
958 SMBIOS_EVENTLOG_ACCESS_METHOD_IO16,
959 SMBIOS_EVENTLOG_ACCESS_METHOD_MMIO32,
960 SMBIOS_EVENTLOG_ACCESS_METHOD_GPNV,
961};
962
963enum {
964 SMBIOS_EVENTLOG_STATUS_VALID = 1, /* Bit 0 */
965 SMBIOS_EVENTLOG_STATUS_FULL = 2, /* Bit 1 */
966};
967
Jingle Hsu869e90a2021-09-09 14:24:25 +0800968#define SMBIOS_USE_EXTENDED_MAX_CAPACITY (1ULL << 31)
Tim Chu1ee8ddc2021-01-22 01:10:45 -0800969
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200970struct smbios_type16 {
Angel Ponsb554b7c2021-06-28 17:42:40 +0200971 struct smbios_header header;
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200972 u8 location;
973 u8 use;
974 u8 memory_error_correction;
975 u32 maximum_capacity;
976 u16 memory_error_information_handle;
977 u16 number_of_memory_devices;
978 u64 extended_maximum_capacity;
Konstantin Aladyshevd0df1d72017-08-01 15:52:46 +0300979 u8 eos[2];
Stefan Reinauer6a001132017-07-13 02:20:27 +0200980} __packed;
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200981
982struct smbios_type17 {
Angel Ponsb554b7c2021-06-28 17:42:40 +0200983 struct smbios_header header;
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200984 u16 phys_memory_array_handle;
985 u16 memory_error_information_handle;
986 u16 total_width;
987 u16 data_width;
988 u16 size;
989 u8 form_factor;
990 u8 device_set;
991 u8 device_locator;
992 u8 bank_locator;
993 u8 memory_type;
994 u16 type_detail;
995 u16 speed;
996 u8 manufacturer;
997 u8 serial_number;
998 u8 asset_tag;
999 u8 part_number;
1000 u8 attributes;
Timothy Pearson964aa832015-09-05 19:00:34 -05001001 u32 extended_size;
Sven Schnelle164bcfd2011-08-14 20:56:34 +02001002 u16 clock_speed;
Timothy Pearson964aa832015-09-05 19:00:34 -05001003 u16 minimum_voltage;
1004 u16 maximum_voltage;
1005 u16 configured_voltage;
Konstantin Aladyshevd0df1d72017-08-01 15:52:46 +03001006 u8 eos[2];
Stefan Reinauer6a001132017-07-13 02:20:27 +02001007} __packed;
Sven Schnelle164bcfd2011-08-14 20:56:34 +02001008
Patrick Rudolph604295e2020-07-21 14:53:37 +02001009struct smbios_type19 {
Angel Ponsb554b7c2021-06-28 17:42:40 +02001010 struct smbios_header header;
Patrick Rudolph604295e2020-07-21 14:53:37 +02001011 u32 starting_address;
1012 u32 ending_address;
1013 u16 memory_array_handle;
1014 u8 partition_width;
1015 u64 extended_starting_address;
1016 u64 extended_ending_address;
1017 u8 eos[2];
1018} __packed;
1019
Matt DeVillierd1c1afd2016-09-02 21:41:26 -05001020struct smbios_type20 {
1021 struct smbios_header header;
1022 u32 addr_start;
1023 u32 addr_end;
1024 u16 memory_device_handle;
1025 u16 memory_array_mapped_address_handle;
1026 u8 partition_row_pos;
1027 u8 interleave_pos;
1028 u8 interleave_depth;
1029 u64 ext_addr_start;
1030 u64 ext_addr_end;
1031 u8 eos[2];
1032} __packed;
1033
Erik van den Bogaert93781522022-09-28 12:35:51 +02001034/* Bit[7..5] = Temp status */
1035enum smbios_temp_status {
1036 SMBIOS_TEMP_STATUS_OTHER = 0x01,
1037 SMBIOS_TEMP_STATUS_UNKNOWN,
1038 SMBIOS_TEMP_STATUS_OK,
1039 SMBIOS_TEMP_STATUS_NONCRITICAL,
1040 SMBIOS_TEMP_STATUS_CRITICAL,
1041 SMBIOS_TEMP_STATUS_NONREC, // Non-Recoverable.
1042};
1043
1044/* Bit[4..0] = Temp location */
1045enum smbios_temp_location {
1046 SMBIOS_TEMP_LOCATION_OTHER = 0x01,
1047 SMBIOS_TEMP_LOCATION_UNKNOWN,
1048 SMBIOS_TEMP_LOCATION_PROCESSOR,
1049 SMBIOS_TEMP_LOCATION_DISK,
1050 SMBIOS_TEMP_LOCATION_BAY, // Peripheral Bay.
1051 SMBIOS_TEMP_LOCATION_SMM, // System Management Module.
1052 SMBIOS_TEMP_LOCATION_BOARD, // Motherboard.
1053 SMBIOS_TEMP_LOCATION_MM, // Memory.
1054 SMBIOS_TEMP_LOCATION_PM, // Processor Module.
1055 SMBIOS_TEMP_LOCATION_POW, // Power Unit.
1056 SMBIOS_TEMP_LOCATION_ADDCARD,
1057};
1058
1059struct smbios_type28 {
1060 struct smbios_header header;
1061 u8 description;
1062 u8 location_and_status;
1063 u16 maximum_value;
1064 u16 minimum_value;
1065 u16 resolution;
1066 u16 tolerance;
1067 u16 accuracy;
1068 u32 oem_defined;
1069 u16 nominal_value;
1070 u8 eos[2];
1071} __packed;
1072
1073
Sven Schnelle164bcfd2011-08-14 20:56:34 +02001074struct smbios_type32 {
Angel Ponsb554b7c2021-06-28 17:42:40 +02001075 struct smbios_header header;
Sven Schnelle164bcfd2011-08-14 20:56:34 +02001076 u8 reserved[6];
1077 u8 boot_status;
1078 u8 eos[2];
Stefan Reinauer6a001132017-07-13 02:20:27 +02001079} __packed;
Sven Schnelle164bcfd2011-08-14 20:56:34 +02001080
Sven Schnelle6d038762012-07-09 08:52:53 +02001081struct smbios_type38 {
Angel Ponsb554b7c2021-06-28 17:42:40 +02001082 struct smbios_header header;
Sven Schnelle6d038762012-07-09 08:52:53 +02001083 u8 interface_type;
1084 u8 ipmi_rev;
1085 u8 i2c_slave_addr;
1086 u8 nv_storage_addr;
1087 u64 base_address;
1088 u8 base_address_modifier;
1089 u8 irq;
Lukasz Siudut2352a502019-02-19 10:06:09 +00001090 u8 eos[2];
Stefan Reinauer6a001132017-07-13 02:20:27 +02001091} __packed;
Sven Schnelle6d038762012-07-09 08:52:53 +02001092
Patrick Rudolphfe98e902018-03-27 16:17:12 +02001093enum smbios_bmc_interface_type {
1094 SMBIOS_BMC_INTERFACE_UNKNOWN = 0,
1095 SMBIOS_BMC_INTERFACE_KCS,
1096 SMBIOS_BMC_INTERFACE_SMIC,
1097 SMBIOS_BMC_INTERFACE_BLOCK,
Elyes HAOUASa5cc0cf2019-02-14 16:48:08 +01001098 SMBIOS_BMC_INTERFACE_SMBUS,
Patrick Rudolphfe98e902018-03-27 16:17:12 +02001099};
1100
Stefan Reinauer3d7c6772012-04-02 13:30:10 -07001101typedef enum {
Jonathan Zhangd57b8212022-10-14 17:06:26 -07001102 PowerSupplyTypeOther = 1,
1103 PowerSupplyTypeUnknown = 2,
1104 PowerSupplyTypeLinear = 3,
1105 PowerSupplyTypeSwitching = 4,
1106 PowerSupplyTypeBattery = 5,
1107 PowerSupplyTypeUps = 6,
1108 PowerSupplyTypeConverter = 7,
1109 PowerSupplyTypeRegulator = 8
1110} power_supply_type;
1111
1112typedef enum {
1113 PowerSupplyStatusOther = 1,
1114 PowerSupplyStatusUnknown = 2,
1115 PowerSupplyStatusOk = 3,
1116 PowerSupplyStatusNonCritical = 4,
1117 PowerSupplyStatusCritical = 5
1118} power_supply_status;
1119
1120typedef enum {
1121 PowerSupplyInputVoltageRangeSwitchingOther = 1,
1122 PowerSupplyInputVoltageRangeSwitchingUnknown = 2,
1123 PowerSupplyInputVoltageRangeSwitchingManual = 3,
1124 PowerSupplyInputVoltageRangeSwitchingAutoSwitch = 4,
1125 PowerSupplyInputVoltageRangeSwitchingWideRange = 5,
1126 PowerSupplyInputVoltageRangeSwitchingNotApplicable = 6
1127} power_supply_input_voltage_range_switching;
1128
1129struct power_supply_ch {
1130 u16 reserved :2;
1131 u16 power_supply_type :4;
1132 u16 power_supply_status :3;
1133 u16 input_voltage_range_switch :4;
1134 u16 power_supply_unplugged :1;
1135 u16 power_supply_present :1;
1136 u16 power_supply_hot_replaceble :1;
1137};
1138
1139struct smbios_type39 {
1140 struct smbios_header header;
1141 u8 power_unit_group;
1142 u8 location;
1143 u8 device_name;
1144 u8 manufacturer;
1145 u8 serial_number;
1146 u8 asset_tag_number;
1147 u8 model_part_number;
1148 u8 revision_level;
1149 u16 max_power_capacity;
1150 u16 power_supply_characteristics;
1151 u16 input_voltage_probe_handle;
1152 u16 cooling_device_handle;
1153 u16 input_current_probe_handle;
1154 u8 eos[2];
1155} __packed;
1156
1157int smbios_write_type39(unsigned long *current, int *handle,
1158 u8 unit_group, const char *loc, const char *dev_name,
1159 const char *man, const char *serial_num,
1160 const char *tag_num, const char *part_num,
1161 const char *rev_lvl, u16 max_pow_cap,
1162 const struct power_supply_ch *ps_ch);
1163
1164typedef enum {
Stefan Reinauer3d7c6772012-04-02 13:30:10 -07001165 SMBIOS_DEVICE_TYPE_OTHER = 0x01,
1166 SMBIOS_DEVICE_TYPE_UNKNOWN,
1167 SMBIOS_DEVICE_TYPE_VIDEO,
1168 SMBIOS_DEVICE_TYPE_SCSI,
1169 SMBIOS_DEVICE_TYPE_ETHERNET,
1170 SMBIOS_DEVICE_TYPE_TOKEN_RING,
1171 SMBIOS_DEVICE_TYPE_SOUND,
1172 SMBIOS_DEVICE_TYPE_PATA,
1173 SMBIOS_DEVICE_TYPE_SATA,
1174 SMBIOS_DEVICE_TYPE_SAS,
Elyes HAOUASf6c100f2021-12-12 09:04:38 +01001175 SMBIOS_DEVICE_TYPE_WIRELESS_LAN,
1176 SMBIOS_DEVICE_TYPE_BLUETOOTH,
1177 SMBIOS_DEVICE_TYPE_WWAN,
1178 SMBIOS_DEVICE_TYPE_EMMC,
1179 SMBIOS_DEVICE_TYPE_NVME,
1180 SMBIOS_DEVICE_TYPE_UFS,
Stefan Reinauer3d7c6772012-04-02 13:30:10 -07001181} smbios_onboard_device_type;
1182
Christian Walter9e5b0622019-05-21 17:37:58 +02001183#define SMBIOS_DEVICE_TYPE_COUNT 10
1184
Stefan Reinauer3d7c6772012-04-02 13:30:10 -07001185struct smbios_type41 {
Angel Ponsb554b7c2021-06-28 17:42:40 +02001186 struct smbios_header header;
Stefan Reinauer3d7c6772012-04-02 13:30:10 -07001187 u8 reference_designation;
1188 u8 device_type: 7;
1189 u8 device_status: 1;
1190 u8 device_type_instance;
1191 u16 segment_group_number;
1192 u8 bus_number;
1193 u8 function_number: 3;
1194 u8 device_number: 5;
Konstantin Aladyshevd0df1d72017-08-01 15:52:46 +03001195 u8 eos[2];
Stefan Reinauer6a001132017-07-13 02:20:27 +02001196} __packed;
Stefan Reinauer3d7c6772012-04-02 13:30:10 -07001197
Michał Żygowskie7795232022-05-04 14:10:45 +02001198
1199#define SMBIOS_TPM_DEVICE_CHARACTERISTICS_NOT_SUPPORTED (1ULL << 2)
1200#define SMBIOS_TPM_DEVICE_FAMILY_CONFIGURABLE_VIA_FW_UPD (1ULL << 3)
1201#define SMBIOS_TPM_DEVICE_FAMILY_CONFIGURABLE_VIA_PLATFORM_SW_SUPPORT (1ULL << 4)
1202#define SMBIOS_TPM_DEVICE_FAMILY_CONFIGURABLE_VIA_OEM_PROPRIETARY (1ULL << 5)
1203
1204struct smbios_type43 {
1205 struct smbios_header header;
1206 u32 vendor_id;
1207 u8 major_spec_ver;
1208 u8 minor_spec_ver;
1209 u32 fw_ver1;
1210 u32 fw_ver2;
1211 u8 description;
1212 u64 characteristics;
1213 u32 oem_defined;
1214 u8 eos[2];
1215} __packed;
1216
Sven Schnelle164bcfd2011-08-14 20:56:34 +02001217struct smbios_type127 {
Angel Ponsb554b7c2021-06-28 17:42:40 +02001218 struct smbios_header header;
Sven Schnelle164bcfd2011-08-14 20:56:34 +02001219 u8 eos[2];
Stefan Reinauer6a001132017-07-13 02:20:27 +02001220} __packed;
Sven Schnelle164bcfd2011-08-14 20:56:34 +02001221
Benjamin Doronea13dc32023-06-20 12:21:27 -04001222/* Provided to help architecture code */
1223int smbios_write_type7(unsigned long *current,
1224 const int handle,
1225 const u8 level,
1226 const u8 sram_type,
1227 const enum smbios_cache_associativity associativity,
1228 const enum smbios_cache_type type,
1229 const size_t max_cache_size,
1230 const size_t cache_size);
1231enum smbios_cache_associativity smbios_cache_associativity(const u8 num);
1232
1233/* Must be defined by architecture code */
1234int smbios_write_type4(unsigned long *current, int handle);
1235int smbios_write_type7_cache_parameters(unsigned long *current,
1236 int *handle,
1237 int *max_struct_size,
1238 struct smbios_type4 *type4);
1239
Lee Leahy6a566d72017-03-07 17:45:12 -08001240void smbios_fill_dimm_manufacturer_from_id(uint16_t mod_id,
1241 struct smbios_type17 *t);
Tim Chu31b42092020-12-23 19:15:21 -08001242void smbios_fill_dimm_asset_tag(const struct dimm_info *dimm,
1243 struct smbios_type17 *t);
Lijian Zhao10ea93c2019-04-11 00:45:10 -07001244void smbios_fill_dimm_locator(const struct dimm_info *dimm,
1245 struct smbios_type17 *t);
Timothy Pearson4785f2a2015-03-27 23:05:36 -05001246
Tim Chu13ab1d72021-10-19 01:45:12 +00001247smbios_wakeup_type smbios_system_wakeup_type(void);
Julien Viard de Galbert9a31dfe2018-02-22 16:39:58 +01001248smbios_board_type smbios_mainboard_board_type(void);
Mathew Kingbe820b32019-10-31 12:10:44 -06001249smbios_enclosure_type smbios_mainboard_enclosure_type(void);
Julien Viard de Galbert9a31dfe2018-02-22 16:39:58 +01001250
Sven Schnelle164bcfd2011-08-14 20:56:34 +02001251#endif