Debian Codegraph @

src/include/smbios.h

raw symbols SCIP
1 /* SPDX-License-Identifier: GPL-2.0-only */
2
3 #ifndef SMBIOS_H
4 #define SMBIOS_H
5
6 #include <types.h>
7 #include <memory_info.h>
8
9 #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
17 unsigned long smbios_write_tables(unsigned long start);
18 int smbios_add_string(u8 *start, const char *str);
19 int smbios_string_table_len(u8 *start);
20
21 struct smbios_header;
22 int smbios_full_table_len(struct smbios_header *header, u8 *str_table_start);
23 void *smbios_carve_table(unsigned long start, u8 type, u8 length, u16 handle);
24
25 /* Used by mainboard to add an on-board device */
26 enum misc_slot_type;
27 enum misc_slot_length;
28 enum misc_slot_usage;
29 enum slot_data_bus_bandwidth;
30 int 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,
35 const u16 id, u8 slot_char1, u8 slot_char2,
36 u8 segment_group, u8 bus, u8 dev_func);
37 enum smbios_bmc_interface_type;
38 int 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);
43 int smbios_write_type41(unsigned long *current, int *handle,
44 const char *name, u8 instance, u16 segment_group,
45 u8 bus, u8 device, u8 function, u8 device_type);
46 enum smbios_temp_location;
47 enum smbios_temp_status;
48 int 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);
57
58 int 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
63 struct device;
64 int get_smbios_data(struct device *dev, int *handle, unsigned long *current);
65
66 const char *smbios_system_manufacturer(void);
67 const char *smbios_system_product_name(void);
68 const char *smbios_system_serial_number(void);
69 const char *smbios_system_version(void);
70 void smbios_system_set_uuid(u8 *uuid);
71 const char *smbios_system_sku(void);
72
73 void smbios_cpu_get_core_counts(u16 *core_count, u16 *thread_count);
74 unsigned int smbios_cpu_get_max_speed_mhz(void);
75 unsigned int smbios_cpu_get_current_speed_mhz(void);
76 unsigned int smbios_cpu_get_voltage(void);
77 unsigned int smbios_get_max_sockets(void);
78 unsigned int smbios_soc_get_max_sockets(void);
79
80 const char *smbios_mainboard_manufacturer(void);
81 const char *smbios_mainboard_product_name(void);
82 const char *smbios_mainboard_serial_number(void);
83 const char *smbios_mainboard_version(void);
84
85 const char *smbios_mainboard_bios_version(void);
86 const char *smbios_mainboard_asset_tag(void);
87 u8 smbios_mainboard_feature_flags(void);
88 const char *smbios_mainboard_location_in_chassis(void);
89 const char *smbios_chassis_version(void);
90 const char *smbios_chassis_serial_number(void);
91 const char *smbios_processor_serial_number(void);
92 u8 smbios_chassis_power_cords(void);
93
94 /* This string could be filled late in payload. */
95 void smbios_type0_bios_version(uintptr_t address);
96
97 void smbios_ec_revision(uint8_t *ec_major_revision, uint8_t *ec_minor_revision);
98
99 unsigned int smbios_processor_external_clock(void);
100 unsigned int smbios_processor_characteristics(void);
101 struct cpuid_result;
102 unsigned int smbios_processor_family(struct cpuid_result res);
103
104 unsigned int smbios_cache_error_correction_type(u8 level);
105 unsigned int smbios_cache_sram_type(void);
106 unsigned int smbios_cache_conf_operation_mode(u8 level);
107
108 /* Used by mainboard to add port information of type 8 */
109 struct port_information;
110 int smbios_write_type8(unsigned long *current, int *handle,
111 const struct port_information *port,
112 size_t num_ports);
113
114 #define BIOS_CHARACTERISTICS_PCI_SUPPORTED (1 << 7)
115 #define BIOS_CHARACTERISTICS_PC_CARD (1 << 8)
116 #define BIOS_CHARACTERISTICS_PNP (1 << 9)
117 #define BIOS_CHARACTERISTICS_APM (1 << 10)
118 #define BIOS_CHARACTERISTICS_UPGRADEABLE (1 << 11)
119 #define BIOS_CHARACTERISTICS_SHADOW (1 << 12)
120 #define BIOS_CHARACTERISTICS_BOOT_FROM_CD (1 << 15)
121 #define BIOS_CHARACTERISTICS_SELECTABLE_BOOT (1 << 16)
122 #define BIOS_CHARACTERISTICS_BIOS_SOCKETED (1 << 17)
123
124 #define BIOS_EXT1_CHARACTERISTICS_ACPI (1 << 0)
125 #define BIOS_EXT2_CHARACTERISTICS_TARGET (1 << 2)
126
127 #define BIOS_MEMORY_ECC_SINGLE_BIT_CORRECTING (1 << 3)
128 #define BIOS_MEMORY_ECC_DOUBLE_BIT_CORRECTING (1 << 4)
129 #define BIOS_MEMORY_ECC_SCRUBBING (1 << 5)
130
131 #define MEMORY_TYPE_DETAIL_OTHER (1 << 1)
132 #define MEMORY_TYPE_DETAIL_UNKNOWN (1 << 2)
133 #define MEMORY_TYPE_DETAIL_FAST_PAGED (1 << 3)
134 #define MEMORY_TYPE_DETAIL_STATIC_COLUMN (1 << 4)
135 #define MEMORY_TYPE_DETAIL_PSEUDO_STATIC (1 << 5)
136 #define MEMORY_TYPE_DETAIL_RAMBUS (1 << 6)
137 #define MEMORY_TYPE_DETAIL_SYNCHRONOUS (1 << 7)
138 #define MEMORY_TYPE_DETAIL_CMOS (1 << 8)
139 #define MEMORY_TYPE_DETAIL_EDO (1 << 9)
140 #define MEMORY_TYPE_DETAIL_WINDOW_DRAM (1 << 10)
141 #define MEMORY_TYPE_DETAIL_CACHE_DRAM (1 << 11)
142 #define MEMORY_TYPE_DETAIL_NON_VOLATILE (1 << 12)
143 #define MEMORY_TYPE_DETAIL_REGISTERED (1 << 13)
144 #define MEMORY_TYPE_DETAIL_UNBUFFERED (1 << 14)
145 #define MEMORY_TYPE_DETAIL_LRDIMM (1 << 15)
146
147 #define MEMORY_TECHNOLOGY_OTHER 0x01
148 #define MEMORY_TECHNOLOGY_UNKNOWN 0x02
149 #define MEMORY_TECHNOLOGY_DRAM 0x03
150 #define MEMORY_TECHNOLOGY_NVDIMM_N 0x04
151 #define MEMORY_TECHNOLOGY_NVDIMM_F 0x05
152 #define MEMORY_TECHNOLOGY_NVDIMM_P 0x06
153 #define MEMORY_TECHNOLOGY_INTEL_PERSISTENT 0x07
154
155 #define MEMORY_OPERATING_MODE_CAP_OTHER (1 << 1)
156 #define MEMORY_OPERATING_MODE_CAP_UNKNOWN (1 << 2)
157 #define MEMORY_OPERATING_MODE_CAP_VOLATILE (1 << 3)
158 #define MEMORY_OPERATING_MODE_CAP_BYTE_ACCESS_PERSISTENT (1 << 4)
159 #define MEMORY_OPERATING_MODE_CAP_BLOCK_ACCESS_PERSISTENT (1 << 5)
160
161 typedef enum {
162 MEMORY_BUS_WIDTH_8 = 0,
163 MEMORY_BUS_WIDTH_16 = 1,
164 MEMORY_BUS_WIDTH_32 = 2,
165 MEMORY_BUS_WIDTH_64 = 3,
166 MEMORY_BUS_WIDTH_128 = 4,
167 MEMORY_BUS_WIDTH_256 = 5,
168 MEMORY_BUS_WIDTH_512 = 6,
169 MEMORY_BUS_WIDTH_1024 = 7,
170 MEMORY_BUS_WIDTH_MAX = 7,
171 } smbios_memory_bus_width;
172
173 typedef enum {
174 MEMORY_FORMFACTOR_OTHER = 0x01,
175 MEMORY_FORMFACTOR_UNKNOWN = 0x02,
176 MEMORY_FORMFACTOR_SIMM = 0x03,
177 MEMORY_FORMFACTOR_SIP = 0x04,
178 MEMORY_FORMFACTOR_CHIP = 0x05,
179 MEMORY_FORMFACTOR_DIP = 0x06,
180 MEMORY_FORMFACTOR_ZIP = 0x07,
181 MEMORY_FORMFACTOR_PROPRIETARY_CARD = 0x08,
182 MEMORY_FORMFACTOR_DIMM = 0x09,
183 MEMORY_FORMFACTOR_TSOP = 0x0a,
184 MEMORY_FORMFACTOR_ROC = 0x0b,
185 MEMORY_FORMFACTOR_RIMM = 0x0c,
186 MEMORY_FORMFACTOR_SODIMM = 0x0d,
187 MEMORY_FORMFACTOR_SRIMM = 0x0e,
188 MEMORY_FORMFACTOR_FBDIMM = 0x0f,
189 MEMORY_FORMFACTOR_DIE = 0x10,
190 MEMORY_FORMFACTOR_CAMM = 0x11,
191 MEMORY_FORMFACTOR_CUDIMM = 0x12,
192 MEMORY_FORMFACTOR_CSODIMM = 0x13,
193 } smbios_memory_form_factor;
194
195 typedef enum {
196 MEMORY_TYPE_OTHER = 0x01,
197 MEMORY_TYPE_UNKNOWN = 0x02,
198 MEMORY_TYPE_DRAM = 0x03,
199 MEMORY_TYPE_EDRAM = 0x04,
200 MEMORY_TYPE_VRAM = 0x05,
201 MEMORY_TYPE_SRAM = 0x06,
202 MEMORY_TYPE_RAM = 0x07,
203 MEMORY_TYPE_ROM = 0x08,
204 MEMORY_TYPE_FLASH = 0x09,
205 MEMORY_TYPE_EEPROM = 0x0a,
206 MEMORY_TYPE_FEPROM = 0x0b,
207 MEMORY_TYPE_EPROM = 0x0c,
208 MEMORY_TYPE_CDRAM = 0x0d,
209 MEMORY_TYPE_3DRAM = 0x0e,
210 MEMORY_TYPE_SDRAM = 0x0f,
211 MEMORY_TYPE_SGRAM = 0x10,
212 MEMORY_TYPE_RDRAM = 0x11,
213 MEMORY_TYPE_DDR = 0x12,
214 MEMORY_TYPE_DDR2 = 0x13,
215 MEMORY_TYPE_DDR2_FBDIMM = 0x14,
216 MEMORY_TYPE_DDR3 = 0x18,
217 MEMORY_TYPE_FBD2 = 0x19,
218 MEMORY_TYPE_DDR4 = 0x1a,
219 MEMORY_TYPE_LPDDR = 0x1b,
220 MEMORY_TYPE_LPDDR2 = 0x1c,
221 MEMORY_TYPE_LPDDR3 = 0x1d,
222 MEMORY_TYPE_LPDDR4 = 0x1e,
223 MEMORY_TYPE_LOGICAL_NON_VOLATILE_DEVICE = 0x1f,
224 MEMORY_TYPE_HBM = 0x20,
225 MEMORY_TYPE_HBM2 = 0x21,
226 MEMORY_TYPE_DDR5 = 0x22,
227 MEMORY_TYPE_LPDDR5 = 0x23,
228 MEMORY_TYPE_HBM3 = 0x24,
229 MEMORY_TYPE_MRDIMM = 0x25,
230 } smbios_memory_type;
231
232 typedef enum {
233 MEMORY_ARRAY_LOCATION_OTHER = 0x01,
234 MEMORY_ARRAY_LOCATION_UNKNOWN = 0x02,
235 MEMORY_ARRAY_LOCATION_SYSTEM_BOARD = 0x03,
236 MEMORY_ARRAY_LOCATION_ISA_ADD_ON = 0x04,
237 MEMORY_ARRAY_LOCATION_EISA_ADD_ON = 0x05,
238 MEMORY_ARRAY_LOCATION_PCI_ADD_ON = 0x06,
239 MEMORY_ARRAY_LOCATION_MCA_ADD_ON = 0x07,
240 MEMORY_ARRAY_LOCATION_PCMCIA_ADD_ON = 0x08,
241 MEMORY_ARRAY_LOCATION_PROPRIETARY_ADD_ON = 0x09,
242 MEMORY_ARRAY_LOCATION_NUBUS = 0x0a,
243 MEMORY_ARRAY_LOCATION_PC_98_C20_ADD_ON = 0xa0,
244 MEMORY_ARRAY_LOCATION_PC_98_C24_ADD_ON = 0xa1,
245 MEMORY_ARRAY_LOCATION_PC_98_E_ADD_ON = 0xa2,
246 MEMORY_ARRAY_LOCATION_PC_98_LOCAL_BUS_ADD_ON = 0xa3,
247 MEMORY_ARRAY_LOCATION_CXL_FLEXBUS_1_0_ADD_ON = 0xa4,
248 } smbios_memory_array_location;
249
250 typedef enum {
251 MEMORY_ARRAY_USE_OTHER = 0x01,
252 MEMORY_ARRAY_USE_UNKNOWN = 0x02,
253 MEMORY_ARRAY_USE_SYSTEM = 0x03,
254 MEMORY_ARRAY_USE_VIDEO = 0x04,
255 MEMORY_ARRAY_USE_FLASH = 0x05,
256 MEMORY_ARRAY_USE_NVRAM = 0x06,
257 MEMORY_ARRAY_USE_CACHE = 0x07,
258 } smbios_memory_array_use;
259
260 typedef enum {
261 MEMORY_ARRAY_ECC_OTHER = 0x01,
262 MEMORY_ARRAY_ECC_UNKNOWN = 0x02,
263 MEMORY_ARRAY_ECC_NONE = 0x03,
264 MEMORY_ARRAY_ECC_PARITY = 0x04,
265 MEMORY_ARRAY_ECC_SINGLE_BIT = 0x05,
266 MEMORY_ARRAY_ECC_MULTI_BIT = 0x06,
267 MEMORY_ARRAY_ECC_CRC = 0x07,
268 } smbios_memory_array_ecc;
269
270 #define SMBIOS_STATE_SAFE 3
271 typedef enum {
272 SMBIOS_BIOS_INFORMATION = 0,
273 SMBIOS_SYSTEM_INFORMATION = 1,
274 SMBIOS_BOARD_INFORMATION = 2,
275 SMBIOS_SYSTEM_ENCLOSURE = 3,
276 SMBIOS_PROCESSOR_INFORMATION = 4,
277 SMBIOS_CACHE_INFORMATION = 7,
278 SMBIOS_PORT_CONNECTOR_INFORMATION = 8,
279 SMBIOS_SYSTEM_SLOTS = 9,
280 SMBIOS_OEM_STRINGS = 11,
281 SMBIOS_EVENT_LOG = 15,
282 SMBIOS_PHYS_MEMORY_ARRAY = 16,
283 SMBIOS_MEMORY_DEVICE = 17,
284 SMBIOS_MEMORY_ARRAY_MAPPED_ADDRESS = 19,
285 SMBIOS_MEMORY_DEVICE_MAPPED_ADDRESS = 20,
286 SMBIOS_TEMPERATURE_PROBE = 28,
287 SMBIOS_SYSTEM_BOOT_INFORMATION = 32,
288 SMBIOS_IPMI_DEVICE_INFORMATION = 38,
289 SMBIOS_SYSTEM_POWER_SUPPLY = 39,
290 SMBIOS_ONBOARD_DEVICES_EXTENDED_INFORMATION = 41,
291 SMBIOS_TPM_DEVICE = 43,
292 SMBIOS_END_OF_TABLE = 127,
293 } smbios_struct_type_t;
294
295 struct smbios_entry {
296 u8 anchor[4];
297 u8 checksum;
298 u8 length;
299 u8 major_version;
300 u8 minor_version;
301 u16 max_struct_size;
302 u8 entry_point_rev;
303 u8 formwatted_area[5];
304 u8 intermediate_anchor_string[5];
305 u8 intermediate_checksum;
306 u16 struct_table_length;
307 u32 struct_table_address;
308 u16 struct_count;
309 u8 smbios_bcd_revision;
310 } __packed;
311
312 struct smbios_entry30 {
313 u8 anchor[5];
314 u8 checksum;
315 u8 length;
316 u8 major_version;
317 u8 minor_version;
318 u8 smbios_doc_rev;
319 u8 entry_point_rev;
320 u8 reserved;
321 u32 struct_table_length;
322 u64 struct_table_address;
323 } __packed;
324
325 struct smbios_header {
326 u8 type;
327 u8 length;
328 u16 handle;
329 } __packed;
330
331 struct smbios_type0 {
332 struct smbios_header header;
333 u8 vendor;
334 u8 bios_version;
335 u16 bios_start_segment;
336 u8 bios_release_date;
337 u8 bios_rom_size;
338 u64 bios_characteristics;
339 u8 bios_characteristics_ext1;
340 u8 bios_characteristics_ext2;
341 u8 system_bios_major_release;
342 u8 system_bios_minor_release;
343 u8 ec_major_release;
344 u8 ec_minor_release;
345 u16 extended_bios_rom_size;
346 u8 eos[2];
347 } __packed;
348
349 typedef enum {
350 SMBIOS_WAKEUP_TYPE_RESERVED = 0x00,
351 SMBIOS_WAKEUP_TYPE_OTHER = 0x01,
352 SMBIOS_WAKEUP_TYPE_UNKNOWN = 0x02,
353 SMBIOS_WAKEUP_TYPE_APM_TIMER = 0x03,
354 SMBIOS_WAKEUP_TYPE_MODEM_RING = 0x04,
355 SMBIOS_WAKEUP_TYPE_LAN_REMOTE = 0x05,
356 SMBIOS_WAKEUP_TYPE_POWER_SWITCH = 0x06,
357 SMBIOS_WAKEUP_TYPE_PCI_PME = 0x07,
358 SMBIOS_WAKEUP_TYPE_AC_POWER_RESTORED = 0x08,
359 } smbios_wakeup_type;
360
361 struct smbios_type1 {
362 struct smbios_header header;
363 u8 manufacturer;
364 u8 product_name;
365 u8 version;
366 u8 serial_number;
367 u8 uuid[16];
368 u8 wakeup_type;
369 u8 sku;
370 u8 family;
371 u8 eos[2];
372 } __packed;
373
374 #define SMBIOS_FEATURE_FLAGS_HOSTING_BOARD (1 << 0)
375 #define SMBIOS_FEATURE_FLAGS_REQUIRES_DAUGHTER_CARD (1 << 1)
376 #define SMBIOS_FEATURE_FLAGS_REMOVABLE (1 << 2)
377 #define SMBIOS_FEATURE_FLAGS_REPLACEABLE (1 << 3)
378 #define SMBIOS_FEATURE_FLAGS_HOT_SWAPPABLE (1 << 4)
379
380 typedef enum {
381 SMBIOS_BOARD_TYPE_UNKNOWN = 0x01,
382 SMBIOS_BOARD_TYPE_OTHER = 0x02,
383 SMBIOS_BOARD_TYPE_SERVER_BLADE = 0x03,
384 SMBIOS_BOARD_TYPE_CONNECTIVITY_SWITCH = 0x04,
385 SMBIOS_BOARD_TYPE_SYSTEM_MANAGEMENT_MODULE = 0x05,
386 SMBIOS_BOARD_TYPE_PROCESSOR_MODULE = 0x06,
387 SMBIOS_BOARD_TYPE_IO_MODULE = 0x07,
388 SMBIOS_BOARD_TYPE_MEMORY_MODULE = 0x08,
389 SMBIOS_BOARD_TYPE_DAUGHTER_BOARD = 0x09,
390 SMBIOS_BOARD_TYPE_MOTHERBOARD = 0x0a,
391 SMBIOS_BOARD_TYPE_PROCESSOR_MEMORY_MODULE = 0x0b,
392 SMBIOS_BOARD_TYPE_PROCESSOR_IO_MODULE = 0x0c,
393 SMBIOS_BOARD_TYPE_INTERCONNECT_BOARD = 0x0d,
394 } smbios_board_type;
395
396 struct smbios_type2 {
397 struct smbios_header header;
398 u8 manufacturer;
399 u8 product_name;
400 u8 version;
401 u8 serial_number;
402 u8 asset_tag;
403 u8 feature_flags;
404 u8 location_in_chassis;
405 u16 chassis_handle;
406 u8 board_type;
407 u8 eos[2];
408 } __packed;
409
410 typedef enum {
411 SMBIOS_ENCLOSURE_OTHER = 0x01,
412 SMBIOS_ENCLOSURE_UNKNOWN = 0x02,
413 SMBIOS_ENCLOSURE_DESKTOP = 0x03,
414 SMBIOS_ENCLOSURE_LOW_PROFILE_DESKTOP = 0x04,
415 SMBIOS_ENCLOSURE_PIZZA_BOX = 0x05,
416 SMBIOS_ENCLOSURE_MINI_TOWER = 0x06,
417 SMBIOS_ENCLOSURE_TOWER = 0x07,
418 SMBIOS_ENCLOSURE_PORTABLE = 0x08,
419 SMBIOS_ENCLOSURE_LAPTOP = 0x09,
420 SMBIOS_ENCLOSURE_NOTEBOOK = 0x0a,
421 SMBIOS_ENCLOSURE_HAND_HELD = 0x0b,
422 SMBIOS_ENCLOSURE_DOCKING_STATION = 0x0c,
423 SMBIOS_ENCLOSURE_ALL_IN_ONE = 0x0d,
424 SMBIOS_ENCLOSURE_SUB_NOTEBOOK = 0x0e,
425 SMBIOS_ENCLOSURE_SPACE_SAVING = 0x0f,
426 SMBIOS_ENCLOSURE_LUNCH_BOX = 0x10,
427 SMBIOS_ENCLOSURE_MAIN_SERVER_CHASSIS = 0x11,
428 SMBIOS_ENCLOSURE_EXPANSION_CHASSIS = 0x12,
429 SMBIOS_ENCLOSURE_SUBCHASSIS = 0x13,
430 SMBIOS_ENCLOSURE_BUS_EXPANSION_CHASSIS = 0x14,
431 SMBIOS_ENCLOSURE_PERIPHERAL_CHASSIS = 0x15,
432 SMBIOS_ENCLOSURE_RAID_CHASSIS = 0x16,
433 SMBIOS_ENCLOSURE_RACK_MOUNT_CHASSIS = 0x17,
434 SMBIOS_ENCLOSURE_SEALED_CASE_PC = 0x18,
435 SMBIOS_ENCLOSURE_MULTI_SYSTEM_CHASSIS = 0x19,
436 SMBIOS_ENCLOSURE_COMPACT_PCI = 0x1a,
437 SMBIOS_ENCLOSURE_ADVANCED_TCA = 0x1b,
438 SMBIOS_ENCLOSURE_BLADE = 0x1c,
439 SMBIOS_ENCLOSURE_BLADE_ENCLOSURE = 0x1d,
440 SMBIOS_ENCLOSURE_TABLET = 0x1e,
441 SMBIOS_ENCLOSURE_CONVERTIBLE = 0x1f,
442 SMBIOS_ENCLOSURE_DETACHABLE = 0x20,
443 SMBIOS_ENCLOSURE_IOT_GATEWAY = 0x21,
444 SMBIOS_ENCLOSURE_EMBEDDED_PC = 0x22,
445 SMBIOS_ENCLOSURE_MINI_PC = 0x23,
446 SMBIOS_ENCLOSURE_STICK_PC = 0x24,
447 } smbios_enclosure_type;
448
449 struct smbios_type3 {
450 struct smbios_header header;
451 u8 manufacturer;
452 u8 _type;
453 u8 version;
454 u8 serial_number;
455 u8 asset_tag_number;
456 u8 bootup_state;
457 u8 power_supply_state;
458 u8 thermal_state;
459 u8 security_status;
460 u32 oem_defined;
461 u8 height;
462 u8 number_of_power_cords;
463 u8 element_count;
464 u8 element_record_length;
465 u8 sku_number;
466 u8 eos[2];
467 } __packed;
468
469 struct smbios_type4 {
470 struct smbios_header header;
471 u8 socket_designation;
472 u8 processor_type;
473 u8 processor_family;
474 u8 processor_manufacturer;
475 u32 processor_id[2];
476 u8 processor_version;
477 u8 voltage;
478 u16 external_clock;
479 u16 max_speed;
480 u16 current_speed;
481 u8 status;
482 u8 processor_upgrade;
483 u16 l1_cache_handle;
484 u16 l2_cache_handle;
485 u16 l3_cache_handle;
486 u8 serial_number;
487 u8 asset_tag;
488 u8 part_number;
489 u8 core_count;
490 u8 core_enabled;
491 u8 thread_count;
492 u16 processor_characteristics;
493 u16 processor_family2;
494 u16 core_count2;
495 u16 core_enabled2;
496 u16 thread_count2;
497 u8 eos[2];
498 } __packed;
499
500 /* defines for smbios_type4 */
501
502 #define SMBIOS_PROCESSOR_STATUS_POPULATED (1 << 6)
503 #define SMBIOS_PROCESSOR_STATUS_CPU_ENABLED (1 << 0)
504
505 enum smbios_processor_type {
506 SMBIOS_PROCESSOR_TYPE_OTHER = 0x01,
507 SMBIOS_PROCESSOR_TYPE_UNKNOWN = 0x02,
508 SMBIOS_PROCESSOR_TYPE_CENTRAL = 0x03,
509 SMBIOS_PROCESSOR_TYPE_MATH = 0x04,
510 SMBIOS_PROCESSOR_TYPE_DSP = 0x05,
511 SMBIOS_PROCESSOR_TYPE_VIDEO = 0x06,
512 };
513
514 /* enum for socket type */
515 enum smbios_processor_upgrade_field {
516 PROCESSOR_UPGRADE_OTHER = 0x01,
517 PROCESSOR_UPGRADE_UNKNOWN = 0x02,
518 PROCESSOR_UPGRADE_DAUGHTER_BOARD = 0x03,
519 PROCESSOR_UPGRADE_ZIF_SOCKET = 0x04,
520 PROCESSOR_UPGRADE_REPLACEABLE_PIGGY_BACK = 0x05,
521 PROCESSOR_UPGRADE_NONE = 0x06,
522 PROCESSOR_UPGRADE_LIF_SOCKET = 0x07,
523 PROCESSOR_UPGRADE_SLOT_1 = 0x08,
524 PROCESSOR_UPGRADE_SLOT_2 = 0x09,
525 PROCESSOR_UPGRADE_370_PIN_SOCKET = 0x0a,
526 PROCESSOR_UPGRADE_SLOT_A = 0x0b,
527 PROCESSOR_UPGRADE_SLOT_M = 0x0c,
528 PROCESSOR_UPGRADE_SOCKET_423 = 0x0d,
529 PROCESSOR_UPGRADE_SOCKET_A = 0x0e,
530 PROCESSOR_UPGRADE_SOCKET_478 = 0x0f,
531 PROCESSOR_UPGRADE_SOCKET_754 = 0x10,
532 PROCESSOR_UPGRADE_SOCKET_940 = 0x11,
533 PROCESSOR_UPGRADE_SOCKET_939 = 0x12,
534 PROCESSOR_UPGRADE_SOCKET_MPGA604 = 0x13,
535 PROCESSOR_UPGRADE_SOCKET_LGA771 = 0x14,
536 PROCESSOR_UPGRADE_SOCKET_LGA775 = 0x15,
537 PROCESSOR_UPGRADE_SOCKET_S1 = 0x16,
538 PROCESSOR_UPGRADE_SOCKET_AM2 = 0x17,
539 PROCESSOR_UPGRADE_SOCKET_F = 0x18,
540 PROCESSOR_UPGRADE_SOCKET_LGA1366 = 0x19,
541 PROCESSOR_UPGRADE_SOCKET_G34 = 0x1a,
542 PROCESSOR_UPGRADE_SOCKET_AM3 = 0x1b,
543 PROCESSOR_UPGRADE_SOCKET_C32 = 0x1c,
544 PROCESSOR_UPGRADE_SOCKET_LGA1156 = 0x1d,
545 PROCESSOR_UPGRADE_SOCKET_LGA1567 = 0x1e,
546 PROCESSOR_UPGRADE_SOCKET_PGA988A = 0x1f,
547 PROCESSOR_UPGRADE_SOCKET_BGA1288 = 0x20,
548 PROCESSOR_UPGRADE_SOCKET_RPGA988B = 0x21,
549 PROCESSOR_UPGRADE_SOCKET_BGA1023 = 0x22,
550 PROCESSOR_UPGRADE_SOCKET_BGA1224 = 0x23,
551 PROCESSOR_UPGRADE_SOCKET_LGA1155 = 0x24,
552 PROCESSOR_UPGRADE_SOCKET_LGA1356 = 0x25,
553 PROCESSOR_UPGRADE_SOCKET_LGA2011 = 0x26,
554 PROCESSOR_UPGRADE_SOCKET_FS1 = 0x27,
555 PROCESSOR_UPGRADE_SOCKET_FS2 = 0x28,
556 PROCESSOR_UPGRADE_SOCKET_FM1 = 0x29,
557 PROCESSOR_UPGRADE_SOCKET_FM2 = 0x2a,
558 PROCESSOR_UPGRADE_SOCKET_LGA2011_3 = 0x2b,
559 PROCESSOR_UPGRADE_SOCKET_LGA1356_3 = 0x2c,
560 PROCESSOR_UPGRADE_SOCKET_LGA1150 = 0x2d,
561 PROCESSOR_UPGRADE_SOCKET_BGA1168 = 0x2e,
562 PROCESSOR_UPGRADE_SOCKET_BGA1234 = 0x2f,
563 PROCESSOR_UPGRADE_SOCKET_BGA1364 = 0x30,
564 PROCESSOR_UPGRADE_SOCKET_AM4 = 0x31,
565 PROCESSOR_UPGRADE_SOCKET_LGA1151 = 0x32,
566 PROCESSOR_UPGRADE_SOCKET_BGA1356 = 0x33,
567 PROCESSOR_UPGRADE_SOCKET_BGA1440 = 0x34,
568 PROCESSOR_UPGRADE_SOCKET_BGA1515 = 0x35,
569 PROCESSOR_UPGRADE_SOCKET_LGA3647_1 = 0x36,
570 PROCESSOR_UPGRADE_SOCKET_SP3 = 0x37,
571 PROCESSOR_UPGRADE_SOCKET_SP3R2 = 0x38,
572 PROCESSOR_UPGRADE_SOCKET_LGA2066 = 0x39,
573 PROCESSOR_UPGRADE_SOCKET_BGA1392 = 0x3a,
574 PROCESSOR_UPGRADE_SOCKET_BGA1510 = 0x3b,
575 PROCESSOR_UPGRADE_SOCKET_BGA1528 = 0x3c,
576 PROCESSOR_UPGRADE_SOCKET_LGA4189 = 0x3d,
577 PROCESSOR_UPGRADE_SOCKET_LGA1200 = 0x3e,
578 PROCESSOR_UPGRADE_SOCKET_LGA4677 = 0x3f,
579 PROCESSOR_UPGRADE_SOCKET_LGA1700 = 0x40,
580 PROCESSOR_UPGRADE_SOCKET_BGA1744 = 0x41,
581 PROCESSOR_UPGRADE_SOCKET_BGA1781 = 0x42,
582 PROCESSOR_UPGRADE_SOCKET_BGA1211 = 0x43,
583 PROCESSOR_UPGRADE_SOCKET_BGA2422 = 0x44,
584 PROCESSOR_UPGRADE_SOCKET_LGA1211 = 0x45,
585 PROCESSOR_UPGRADE_SOCKET_LGA2422 = 0x46,
586 PROCESSOR_UPGRADE_SOCKET_LGA5773 = 0x47,
587 PROCESSOR_UPGRADE_SOCKET_BGA5773 = 0x48,
588 };
589
590 /* defines for processor family */
591 #define SMBIOS_PROCESSOR_FAMILY_OTHER 0x01
592 #define SMBIOS_PROCESSOR_FAMILY_UNKNOWN 0x02
593 #define SMBIOS_PROCESSOR_FAMILY_INTEL486 0x06
594 #define SMBIOS_PROCESSOR_FAMILY_PENTIUM_PRO 0x0c
595 #define SMBIOS_PROCESSOR_FAMILY_XEON 0xb3
596 #define SMBIOS_PROCESSOR_FAMILY_FROM_FAMILY2 0xfe
597
598 /* defines for processor family 2 */
599 #define SMBIOS_PROCESSOR_FAMILY2_ARMV8 0x101
600
601 /* defines for processor characteristics */
602 #define PROCESSOR_64BIT_CAPABLE (1 << 2)
603 #define PROCESSOR_MULTI_CORE (1 << 3)
604 #define PROCESSOR_HARDWARE_THREAD (1 << 4)
605 #define PROCESSOR_EXECUTE_PROTECTION (1 << 5)
606 #define PROCESSOR_ENHANCED_VIRTUALIZATION (1 << 6)
607 #define PROCESSOR_POWER_PERFORMANCE_CONTROL (1 << 7)
608
609 /* defines for supported_sram_type/current_sram_type */
610
611 #define SMBIOS_CACHE_SRAM_TYPE_OTHER (1 << 0)
612 #define SMBIOS_CACHE_SRAM_TYPE_UNKNOWN (1 << 1)
613 #define SMBIOS_CACHE_SRAM_TYPE_NON_BURST (1 << 2)
614 #define SMBIOS_CACHE_SRAM_TYPE_BURST (1 << 3)
615 #define SMBIOS_CACHE_SRAM_TYPE_PIPELINE_BURST (1 << 4)
616 #define SMBIOS_CACHE_SRAM_TYPE_SYNCHRONOUS (1 << 5)
617 #define SMBIOS_CACHE_SRAM_TYPE_ASYNCHRONOUS (1 << 6)
618
619 /* enum for error_correction_type */
620
621 enum smbios_cache_error_corr {
622 SMBIOS_CACHE_ERROR_CORRECTION_OTHER = 1,
623 SMBIOS_CACHE_ERROR_CORRECTION_UNKNOWN,
624 SMBIOS_CACHE_ERROR_CORRECTION_NONE,
625 SMBIOS_CACHE_ERROR_CORRECTION_PARITY,
626 SMBIOS_CACHE_ERROR_CORRECTION_SINGLE_BIT,
627 SMBIOS_CACHE_ERROR_CORRECTION_MULTI_BIT,
628 };
629
630 /* enum for system_cache_type */
631
632 enum smbios_cache_type {
633 SMBIOS_CACHE_TYPE_OTHER = 1,
634 SMBIOS_CACHE_TYPE_UNKNOWN,
635 SMBIOS_CACHE_TYPE_INSTRUCTION,
636 SMBIOS_CACHE_TYPE_DATA,
637 SMBIOS_CACHE_TYPE_UNIFIED,
638 };
639
640 /* enum for associativity */
641
642 enum smbios_cache_associativity {
643 SMBIOS_CACHE_ASSOCIATIVITY_OTHER = 1,
644 SMBIOS_CACHE_ASSOCIATIVITY_UNKNOWN,
645 SMBIOS_CACHE_ASSOCIATIVITY_DIRECT,
646 SMBIOS_CACHE_ASSOCIATIVITY_2WAY,
647 SMBIOS_CACHE_ASSOCIATIVITY_4WAY,
648 SMBIOS_CACHE_ASSOCIATIVITY_FULL,
649 SMBIOS_CACHE_ASSOCIATIVITY_8WAY,
650 SMBIOS_CACHE_ASSOCIATIVITY_16WAY,
651 SMBIOS_CACHE_ASSOCIATIVITY_12WAY,
652 SMBIOS_CACHE_ASSOCIATIVITY_24WAY,
653 SMBIOS_CACHE_ASSOCIATIVITY_32WAY,
654 SMBIOS_CACHE_ASSOCIATIVITY_48WAY,
655 SMBIOS_CACHE_ASSOCIATIVITY_64WAY,
656 SMBIOS_CACHE_ASSOCIATIVITY_20WAY,
657 };
658
659 /* defines for cache_configuration */
660
661 #define SMBIOS_CACHE_CONF_LEVEL(x) ((((x) - 1) & 0x7) << 0)
662 #define SMBIOS_CACHE_CONF_LOCATION(x) (((x) & 0x3) << 5)
663 #define SMBIOS_CACHE_CONF_ENABLED(x) (((x) & 0x1) << 7)
664 #define SMBIOS_CACHE_CONF_OPERATION_MODE(x) (((x) & 0x3) << 8)
665
666 /* defines for max_cache_size and installed_size */
667
668 #define SMBIOS_CACHE_SIZE_UNIT_1KB (0 << 15)
669 #define SMBIOS_CACHE_SIZE_UNIT_64KB (1 << 15)
670 #define SMBIOS_CACHE_SIZE_MASK 0x7fff
671 #define SMBIOS_CACHE_SIZE_OVERFLOW 0xffff
672
673 #define SMBIOS_CACHE_SIZE2_UNIT_1KB (0 << 31)
674 #define SMBIOS_CACHE_SIZE2_UNIT_64KB (1UL << 31)
675 #define SMBIOS_CACHE_SIZE2_MASK 0x7fffffff
676
677 /* define for cache operation mode */
678
679 #define SMBIOS_CACHE_OP_MODE_WRITE_THROUGH 0
680 #define SMBIOS_CACHE_OP_MODE_WRITE_BACK 1
681 #define SMBIOS_CACHE_OP_MODE_VARIES_WITH_MEMORY_ADDRESS 2
682 #define SMBIOS_CACHE_OP_MODE_UNKNOWN 3
683
684 struct smbios_type7 {
685 struct smbios_header header;
686 u8 socket_designation;
687 u16 cache_configuration;
688 u16 max_cache_size;
689 u16 installed_size;
690 u16 supported_sram_type;
691 u16 current_sram_type;
692 u8 cache_speed;
693 u8 error_correction_type;
694 u8 system_cache_type;
695 u8 associativity;
696 u32 max_cache_size2;
697 u32 installed_size2;
698 u8 eos[2];
699 } __packed;
700
701 /* enum for connector types */
702 typedef enum {
703 CONN_NONE = 0x00,
704 CONN_CENTRONICS = 0x01,
705 CONN_MINI_CENTRONICS = 0x02,
706 CONN_PROPRIETARY = 0x03,
707 CONN_DB_25_PIN_MALE = 0x04,
708 CONN_DB_25_PIN_FEMALE = 0x05,
709 CONN_DB_15_PIN_MALE = 0x06,
710 CONN_DB_15_PIN_FEMALE = 0x07,
711 CONN_DB_9_PIN_MALE = 0x08,
712 CONN_DB_9_PIN_FEMALE = 0x09,
713 CONN_RJ_11 = 0x0A,
714 CONN_RJ_45 = 0x0B,
715 CONN_50_PIN_MINI_SCSI = 0x0C,
716 CONN_MINI_DIN = 0x0D,
717 CONN_MICRO_DIN = 0x0E,
718 CONN_PS_2 = 0x0F,
719 CONN_INFRARED = 0x10,
720 CONN_HP_HIL = 0x11,
721 CONN_ACCESS_BUS_USB = 0x12,
722 CONN_SSA_SCSI = 0x13,
723 CONN_CIRCULAR_DIN_8_MALE = 0x14,
724 CONN_CIRCULAR_DIN_8_FEMALE = 0x15,
725 CONN_ON_BOARD_IDE = 0x16,
726 CONN_ON_BOARD_FLOPPY = 0x17,
727 CONN_9_PIN_DUAL_INLINE = 0x18,
728 CONN_25_PIN_DUAL_INLINE = 0x19,
729 CONN_50_PIN_DUAL_INLINE = 0x1A,
730 CONN_68_PIN_DUAL_INLINE = 0x1B,
731 CONN_ON_BOARD_SOUND_INPUT_FROM_CD_ROM = 0x1C,
732 CONN_MINI_CENTRONICS_TYPE14 = 0x1D,
733 CONN_MINI_CENTRONICS_TYPE26 = 0x1E,
734 CONN_MINI_JACK_HEADPHONES = 0x1F,
735 CONN_BNC = 0x20,
736 CONN_1394 = 0x21,
737 CONN_SAS_SATA = 0x22,
738 CONN_USB_TYPE_C = 0x23,
739 CONN_PC_98 = 0xA0,
740 CONN_PC_98_HIRESO = 0xA1,
741 CONN_PC_H98 = 0xA2,
742 CONN_PC98_NOTE = 0xA3,
743 CONN_PC_98_FULL = 0xA4,
744 CONN_OTHER = 0xFF,
745 } type8_connector_types;
746
747 /* enum for port types */
748 typedef enum {
749 TYPE_NONE_PORT = 0x00,
750 TYPE_PARALLEL_PORT_XT_AT_COMPATIBLE = 0x01,
751 TYPE_PARALLEL_PORT_PS_2 = 0x02,
752 TYPE_PARALLEL_PORT_ECP = 0x03,
753 TYPE_PARALLEL_PORT_EPP = 0x04,
754 TYPE_PARALLEL_PORT_ECP_EPP = 0x05,
755 TYPE_SERIAL_PORT_XT_AT_COMPATIBLE = 0x06,
756 TYPE_SERIAL_PORT_16450_COMPATIBLE = 0x07,
757 TYPE_SERIAL_PORT_16550_COMPATIBLE = 0x08,
758 TYPE_SERIAL_PORT_16550A_COMPATIBLE = 0x09,
759 TYPE_SCSI_PORT = 0x0A,
760 TYPE_MIDI_PORT = 0x0B,
761 TYPE_JOY_STICK_PORT = 0x0C,
762 TYPE_KEYBOARD_PORT = 0x0D,
763 TYPE_MOUSE_PORT = 0x0E,
764 TYPE_SSA_SCSI = 0x0F,
765 TYPE_USB = 0x10,
766 TYPE_FIREWIRE_IEEE_P1394 = 0x11,
767 TYPE_PCMCIA_TYPE_I = 0x12,
768 TYPE_PCMCIA_TYPE_II = 0x13,
769 TYPE_PCMCIA_TYPE_III = 0x14,
770 TYPE_CARDBUS = 0x15,
771 TYPE_ACCESS_BUS_PORT = 0x16,
772 TYPE_SCSI_II = 0x17,
773 TYPE_SCSI_WIDE = 0x18,
774 TYPE_PC_98 = 0x19,
775 TYPE_PC_98_HIRESO = 0x1A,
776 TYPE_PC_H98 = 0x1B,
777 TYPE_VIDEO_PORT = 0x1C,
778 TYPE_AUDIO_PORT = 0x1D,
779 TYPE_MODEM_PORT = 0x1E,
780 TYPE_NETWORK_PORT = 0x1F,
781 TYPE_SATA = 0x20,
782 TYPE_SAS = 0x21,
783 TYPE_MFDP = 0x22,
784 TYPE_THUNDERBOLT = 0x23,
785 TYPE_8251_COMPATIBLE = 0xA0,
786 TYPE_8251_FIFO_COMPATIBLE = 0xA1,
787 TYPE_OTHER_PORT = 0xFF,
788 } type8_port_types;
789
790 struct port_information {
791 const char *internal_reference_designator;
792 type8_connector_types internal_connector_type;
793 const char *external_reference_designator;
794 type8_connector_types external_connector_type;
795 type8_port_types port_type;
796 };
797
798 struct smbios_type8 {
799 struct smbios_header header;
800 u8 internal_reference_designator;
801 u8 internal_connector_type;
802 u8 external_reference_designator;
803 u8 external_connector_type;
804 u8 port_type;
805 u8 eos[2];
806 } __packed;
807
808 /* System Slots - Slot Type */
809 enum misc_slot_type {
810 SlotTypeOther = 0x01,
811 SlotTypeUnknown = 0x02,
812 SlotTypeIsa = 0x03,
813 SlotTypeMca = 0x04,
814 SlotTypeEisa = 0x05,
815 SlotTypePci = 0x06,
816 SlotTypePcmcia = 0x07,
817 SlotTypeVlVesa = 0x08,
818 SlotTypeProprietary = 0x09,
819 SlotTypeProcessorCardSlot = 0x0A,
820 SlotTypeProprietaryMemoryCardSlot = 0x0B,
821 SlotTypeIORiserCardSlot = 0x0C,
822 SlotTypeNuBus = 0x0D,
823 SlotTypePci66MhzCapable = 0x0E,
824 SlotTypeAgp = 0x0F,
825 SlotTypeApg2X = 0x10,
826 SlotTypeAgp4X = 0x11,
827 SlotTypePciX = 0x12,
828 SlotTypeAgp8X = 0x13,
829 SlotTypeM2Socket1_DP = 0x14,
830 SlotTypeM2Socket1_SD = 0x15,
831 SlotTypeM2Socket2 = 0x16,
832 SlotTypeM2Socket3 = 0x17,
833 SlotTypeMxmTypeI = 0x18,
834 SlotTypeMxmTypeII = 0x19,
835 SlotTypeMxmTypeIIIStandard = 0x1A,
836 SlotTypeMxmTypeIIIHe = 0x1B,
837 SlotTypeMxmTypeIV = 0x1C,
838 SlotTypeMxm30TypeA = 0x1D,
839 SlotTypeMxm30TypeB = 0x1E,
840 SlotTypePciExpressGen2Sff_8639 = 0x1F,
841 SlotTypePciExpressGen3Sff_8639 = 0x20,
842 SlotTypePciExpressMini52pinWithBSKO = 0x21,
843 SlotTypePciExpressMini52pinWithoutBSKO = 0x22,
844 SlotTypePciExpressMini76pin = 0x23,
845 SlotTypePciExpressOCPNIC30SFF = 0x26,
846 SlotTypePC98C20 = 0xA0,
847 SlotTypePC98C24 = 0xA1,
848 SlotTypePC98E = 0xA2,
849 SlotTypePC98LocalBus = 0xA3,
850 SlotTypePC98Card = 0xA4,
851 SlotTypePciExpress = 0xA5,
852 SlotTypePciExpressX1 = 0xA6,
853 SlotTypePciExpressX2 = 0xA7,
854 SlotTypePciExpressX4 = 0xA8,
855 SlotTypePciExpressX8 = 0xA9,
856 SlotTypePciExpressX16 = 0xAA,
857 SlotTypePciExpressGen2 = 0xAB,
858 SlotTypePciExpressGen2X1 = 0xAC,
859 SlotTypePciExpressGen2X2 = 0xAD,
860 SlotTypePciExpressGen2X4 = 0xAE,
861 SlotTypePciExpressGen2X8 = 0xAF,
862 SlotTypePciExpressGen2X16 = 0xB0,
863 SlotTypePciExpressGen3 = 0xB1,
864 SlotTypePciExpressGen3X1 = 0xB2,
865 SlotTypePciExpressGen3X2 = 0xB3,
866 SlotTypePciExpressGen3X4 = 0xB4,
867 SlotTypePciExpressGen3X8 = 0xB5,
868 SlotTypePciExpressGen3X16 = 0xB6,
869 SlotTypePciExpressGen4 = 0xB8,
870 SlotTypePciExpressGen4x1 = 0xB9,
871 SlotTypePciExpressGen4x2 = 0xBA,
872 SlotTypePciExpressGen4x4 = 0xBB,
873 SlotTypePciExpressGen4x8 = 0xBC,
874 SlotTypePciExpressGen4x16 = 0xBD,
875 SlotTypePciExpressGen5 = 0xBE,
876 SlotTypePciExpressGen5x1 = 0xBF,
877 SlotTypePciExpressGen5x2 = 0xC0,
878 SlotTypePciExpressGen5x4 = 0xC1,
879 SlotTypePciExpressGen5x8 = 0xC2,
880 SlotTypePciExpressGen5x16 = 0xC3,
881 SlotTypePciExpressGen6AndBeyond = 0xC4,
882 SlotTypeEDSFF_E1 = 0xC5,
883 SlotTypeEDSFF_E3 = 0xC6,
884 };
885
886 /* System Slots - Slot Data Bus Width. */
887 enum slot_data_bus_bandwidth {
888 SlotDataBusWidthOther = 0x01,
889 SlotDataBusWidthUnknown = 0x02,
890 SlotDataBusWidth8Bit = 0x03,
891 SlotDataBusWidth16Bit = 0x04,
892 SlotDataBusWidth32Bit = 0x05,
893 SlotDataBusWidth64Bit = 0x06,
894 SlotDataBusWidth128Bit = 0x07,
895 SlotDataBusWidth1X = 0x08,
896 SlotDataBusWidth2X = 0x09,
897 SlotDataBusWidth4X = 0x0A,
898 SlotDataBusWidth8X = 0x0B,
899 SlotDataBusWidth12X = 0x0C,
900 SlotDataBusWidth16X = 0x0D,
901 SlotDataBusWidth32X = 0x0E
902 };
903
904 /* System Slots - Current Usage. */
905 enum misc_slot_usage {
906 SlotUsageOther = 0x01,
907 SlotUsageUnknown = 0x02,
908 SlotUsageAvailable = 0x03,
909 SlotUsageInUse = 0x04,
910 SlotUsageUnavailable = 0x05
911 };
912
913 /* System Slots - Slot Length.*/
914 enum misc_slot_length {
915 SlotLengthOther = 0x01,
916 SlotLengthUnknown = 0x02,
917 SlotLengthShort = 0x03,
918 SlotLengthLong = 0x04
919 };
920
921 /* System Slots - Slot Characteristics 1. */
922 #define SMBIOS_SLOT_UNKNOWN (1 << 0)
923 #define SMBIOS_SLOT_5V (1 << 1)
924 #define SMBIOS_SLOT_3P3V (1 << 2)
925 #define SMBIOS_SLOT_SHARED (1 << 3)
926 #define SMBIOS_SLOT_PCCARD_16 (1 << 4)
927 #define SMBIOS_SLOT_PCCARD_CARDBUS (1 << 5)
928 #define SMBIOS_SLOT_PCCARD_ZOOM (1 << 6)
929 #define SMBIOS_SLOT_PCCARD_MODEM_RING (1 << 7)
930 /* System Slots - Slot Characteristics 2. */
931 #define SMBIOS_SLOT_PME (1 << 0)
932 #define SMBIOS_SLOT_HOTPLUG (1 << 1)
933 #define SMBIOS_SLOT_SMBUS (1 << 2)
934 #define SMBIOS_SLOT_BIFURCATION (1 << 3)
935
936 struct slot_peer_groups {
937 u16 peer_seg_num;
938 u8 peer_bus_num;
939 u8 peer_dev_fn_num;
940 u8 peer_data_bus_width;
941 } __packed;
942
943 struct smbios_type9 {
944 struct smbios_header header;
945 u8 slot_designation;
946 u8 slot_type;
947 u8 slot_data_bus_width;
948 u8 current_usage;
949 u8 slot_length;
950 u16 slot_id;
951 u8 slot_characteristics_1;
952 u8 slot_characteristics_2;
953 u16 segment_group_number;
954 u8 bus_number;
955 u8 device_function_number;
956 u8 data_bus_width;
957 u8 peer_group_count;
958 struct slot_peer_groups peer[0];
959 u8 eos[2];
960 } __packed;
961
962 struct smbios_type11 {
963 struct smbios_header header;
964 u8 count;
965 u8 eos[2];
966 } __packed;
967
968 struct smbios_type15 {
969 struct smbios_header header;
970 u16 area_length;
971 u16 header_offset;
972 u16 data_offset;
973 u8 access_method;
974 u8 log_status;
975 u32 change_token;
976 u32 address;
977 u8 header_format;
978 u8 log_type_descriptors;
979 u8 log_type_descriptor_length;
980 u8 eos[2];
981 } __packed;
982
983 enum {
984 SMBIOS_EVENTLOG_ACCESS_METHOD_IO8 = 0,
985 SMBIOS_EVENTLOG_ACCESS_METHOD_IO8X2,
986 SMBIOS_EVENTLOG_ACCESS_METHOD_IO16,
987 SMBIOS_EVENTLOG_ACCESS_METHOD_MMIO32,
988 SMBIOS_EVENTLOG_ACCESS_METHOD_GPNV,
989 };
990
991 enum {
992 SMBIOS_EVENTLOG_STATUS_VALID = 1, /* Bit 0 */
993 SMBIOS_EVENTLOG_STATUS_FULL = 2, /* Bit 1 */
994 };
995
996 #define SMBIOS_USE_EXTENDED_MAX_CAPACITY (1ULL << 31)
997
998 struct smbios_type16 {
999 struct smbios_header header;
1000 u8 location;
1001 u8 use;
1002 u8 memory_error_correction;
1003 u32 maximum_capacity;
1004 u16 memory_error_information_handle;
1005 u16 number_of_memory_devices;
1006 u64 extended_maximum_capacity;
1007 u8 eos[2];
1008 } __packed;
1009
1010 struct smbios_type17 {
1011 struct smbios_header header;
1012 u16 phys_memory_array_handle;
1013 u16 memory_error_information_handle;
1014 u16 total_width;
1015 u16 data_width;
1016 u16 size;
1017 u8 form_factor;
1018 u8 device_set;
1019 u8 device_locator;
1020 u8 bank_locator;
1021 u8 memory_type;
1022 u16 type_detail;
1023 u16 speed;
1024 u8 manufacturer;
1025 u8 serial_number;
1026 u8 asset_tag;
1027 u8 part_number;
1028 u8 attributes;
1029 u32 extended_size;
1030 u16 clock_speed;
1031 u16 minimum_voltage;
1032 u16 maximum_voltage;
1033 u16 configured_voltage;
1034 u8 eos[2];
1035 } __packed;
1036
1037 struct smbios_type19 {
1038 struct smbios_header header;
1039 u32 starting_address;
1040 u32 ending_address;
1041 u16 memory_array_handle;
1042 u8 partition_width;
1043 u64 extended_starting_address;
1044 u64 extended_ending_address;
1045 u8 eos[2];
1046 } __packed;
1047
1048 struct smbios_type20 {
1049 struct smbios_header header;
1050 u32 addr_start;
1051 u32 addr_end;
1052 u16 memory_device_handle;
1053 u16 memory_array_mapped_address_handle;
1054 u8 partition_row_pos;
1055 u8 interleave_pos;
1056 u8 interleave_depth;
1057 u64 ext_addr_start;
1058 u64 ext_addr_end;
1059 u8 eos[2];
1060 } __packed;
1061
1062 /* Bit[7..5] = Temp status */
1063 enum smbios_temp_status {
1064 SMBIOS_TEMP_STATUS_OTHER = 0x01,
1065 SMBIOS_TEMP_STATUS_UNKNOWN,
1066 SMBIOS_TEMP_STATUS_OK,
1067 SMBIOS_TEMP_STATUS_NONCRITICAL,
1068 SMBIOS_TEMP_STATUS_CRITICAL,
1069 SMBIOS_TEMP_STATUS_NONREC, // Non-Recoverable.
1070 };
1071
1072 /* Bit[4..0] = Temp location */
1073 enum smbios_temp_location {
1074 SMBIOS_TEMP_LOCATION_OTHER = 0x01,
1075 SMBIOS_TEMP_LOCATION_UNKNOWN,
1076 SMBIOS_TEMP_LOCATION_PROCESSOR,
1077 SMBIOS_TEMP_LOCATION_DISK,
1078 SMBIOS_TEMP_LOCATION_BAY, // Peripheral Bay.
1079 SMBIOS_TEMP_LOCATION_SMM, // System Management Module.
1080 SMBIOS_TEMP_LOCATION_BOARD, // Motherboard.
1081 SMBIOS_TEMP_LOCATION_MM, // Memory.
1082 SMBIOS_TEMP_LOCATION_PM, // Processor Module.
1083 SMBIOS_TEMP_LOCATION_POW, // Power Unit.
1084 SMBIOS_TEMP_LOCATION_ADDCARD,
1085 };
1086
1087 struct smbios_type28 {
1088 struct smbios_header header;
1089 u8 description;
1090 u8 location_and_status;
1091 u16 maximum_value;
1092 u16 minimum_value;
1093 u16 resolution;
1094 u16 tolerance;
1095 u16 accuracy;
1096 u32 oem_defined;
1097 u16 nominal_value;
1098 u8 eos[2];
1099 } __packed;
1100
1101
1102 struct smbios_type32 {
1103 struct smbios_header header;
1104 u8 reserved[6];
1105 u8 boot_status;
1106 u8 eos[2];
1107 } __packed;
1108
1109 struct smbios_type38 {
1110 struct smbios_header header;
1111 u8 interface_type;
1112 u8 ipmi_rev;
1113 u8 i2c_slave_addr;
1114 u8 nv_storage_addr;
1115 u64 base_address;
1116 u8 base_address_modifier;
1117 u8 irq;
1118 u8 eos[2];
1119 } __packed;
1120
1121 enum smbios_bmc_interface_type {
1122 SMBIOS_BMC_INTERFACE_UNKNOWN = 0,
1123 SMBIOS_BMC_INTERFACE_KCS,
1124 SMBIOS_BMC_INTERFACE_SMIC,
1125 SMBIOS_BMC_INTERFACE_BLOCK,
1126 SMBIOS_BMC_INTERFACE_SMBUS,
1127 };
1128
1129 typedef enum {
1130 PowerSupplyTypeOther = 1,
1131 PowerSupplyTypeUnknown = 2,
1132 PowerSupplyTypeLinear = 3,
1133 PowerSupplyTypeSwitching = 4,
1134 PowerSupplyTypeBattery = 5,
1135 PowerSupplyTypeUps = 6,
1136 PowerSupplyTypeConverter = 7,
1137 PowerSupplyTypeRegulator = 8
1138 } power_supply_type;
1139
1140 typedef enum {
1141 PowerSupplyStatusOther = 1,
1142 PowerSupplyStatusUnknown = 2,
1143 PowerSupplyStatusOk = 3,
1144 PowerSupplyStatusNonCritical = 4,
1145 PowerSupplyStatusCritical = 5
1146 } power_supply_status;
1147
1148 typedef enum {
1149 PowerSupplyInputVoltageRangeSwitchingOther = 1,
1150 PowerSupplyInputVoltageRangeSwitchingUnknown = 2,
1151 PowerSupplyInputVoltageRangeSwitchingManual = 3,
1152 PowerSupplyInputVoltageRangeSwitchingAutoSwitch = 4,
1153 PowerSupplyInputVoltageRangeSwitchingWideRange = 5,
1154 PowerSupplyInputVoltageRangeSwitchingNotApplicable = 6
1155 } power_supply_input_voltage_range_switching;
1156
1157 struct power_supply_ch {
1158 u16 reserved :2;
1159 u16 power_supply_type :4;
1160 u16 power_supply_status :3;
1161 u16 input_voltage_range_switch :4;
1162 u16 power_supply_unplugged :1;
1163 u16 power_supply_present :1;
1164 u16 power_supply_hot_replaceble :1;
1165 };
1166
1167 struct smbios_type39 {
1168 struct smbios_header header;
1169 u8 power_unit_group;
1170 u8 location;
1171 u8 device_name;
1172 u8 manufacturer;
1173 u8 serial_number;
1174 u8 asset_tag_number;
1175 u8 model_part_number;
1176 u8 revision_level;
1177 u16 max_power_capacity;
1178 u16 power_supply_characteristics;
1179 u16 input_voltage_probe_handle;
1180 u16 cooling_device_handle;
1181 u16 input_current_probe_handle;
1182 u8 eos[2];
1183 } __packed;
1184
1185 int smbios_write_type39(unsigned long *current, int *handle,
1186 u8 unit_group, const char *loc, const char *dev_name,
1187 const char *man, const char *serial_num,
1188 const char *tag_num, const char *part_num,
1189 const char *rev_lvl, u16 max_pow_cap,
1190 const struct power_supply_ch *ps_ch);
1191
1192 typedef enum {
1193 SMBIOS_DEVICE_TYPE_OTHER = 0x01,
1194 SMBIOS_DEVICE_TYPE_UNKNOWN,
1195 SMBIOS_DEVICE_TYPE_VIDEO,
1196 SMBIOS_DEVICE_TYPE_SCSI,
1197 SMBIOS_DEVICE_TYPE_ETHERNET,
1198 SMBIOS_DEVICE_TYPE_TOKEN_RING,
1199 SMBIOS_DEVICE_TYPE_SOUND,
1200 SMBIOS_DEVICE_TYPE_PATA,
1201 SMBIOS_DEVICE_TYPE_SATA,
1202 SMBIOS_DEVICE_TYPE_SAS,
1203 SMBIOS_DEVICE_TYPE_WIRELESS_LAN,
1204 SMBIOS_DEVICE_TYPE_BLUETOOTH,
1205 SMBIOS_DEVICE_TYPE_WWAN,
1206 SMBIOS_DEVICE_TYPE_EMMC,
1207 SMBIOS_DEVICE_TYPE_NVME,
1208 SMBIOS_DEVICE_TYPE_UFS,
1209 } smbios_onboard_device_type;
1210
1211 #define SMBIOS_DEVICE_TYPE_COUNT 10
1212
1213 struct smbios_type41 {
1214 struct smbios_header header;
1215 u8 reference_designation;
1216 u8 device_type: 7;
1217 u8 device_status: 1;
1218 u8 device_type_instance;
1219 u16 segment_group_number;
1220 u8 bus_number;
1221 u8 function_number: 3;
1222 u8 device_number: 5;
1223 u8 eos[2];
1224 } __packed;
1225
1226
1227 #define SMBIOS_TPM_DEVICE_CHARACTERISTICS_NOT_SUPPORTED (1ULL << 2)
1228 #define SMBIOS_TPM_DEVICE_FAMILY_CONFIGURABLE_VIA_FW_UPD (1ULL << 3)
1229 #define SMBIOS_TPM_DEVICE_FAMILY_CONFIGURABLE_VIA_PLATFORM_SW_SUPPORT (1ULL << 4)
1230 #define SMBIOS_TPM_DEVICE_FAMILY_CONFIGURABLE_VIA_OEM_PROPRIETARY (1ULL << 5)
1231
1232 struct smbios_type43 {
1233 struct smbios_header header;
1234 u32 vendor_id;
1235 u8 major_spec_ver;
1236 u8 minor_spec_ver;
1237 u32 fw_ver1;
1238 u32 fw_ver2;
1239 u8 description;
1240 u64 characteristics;
1241 u32 oem_defined;
1242 u8 eos[2];
1243 } __packed;
1244
1245 struct smbios_type127 {
1246 struct smbios_header header;
1247 u8 eos[2];
1248 } __packed;
1249
1250 /* Provided to help architecture code */
1251 int smbios_write_type7(unsigned long *current,
1252 const int handle,
1253 const u8 level,
1254 const u8 sram_type,
1255 const enum smbios_cache_associativity associativity,
1256 const enum smbios_cache_type type,
1257 const size_t max_cache_size,
1258 const size_t cache_size);
1259 enum smbios_cache_associativity smbios_cache_associativity(const u8 num);
1260
1261 /* Must be defined by architecture code */
1262 int smbios_write_type4(unsigned long *current, int handle);
1263 int smbios_write_type7_cache_parameters(unsigned long *current,
1264 int *handle,
1265 int *max_struct_size,
1266 struct smbios_type4 *type4);
1267
1268 void smbios_fill_dimm_manufacturer_from_id(uint16_t mod_id,
1269 struct smbios_type17 *t);
1270 void smbios_fill_dimm_asset_tag(const struct dimm_info *dimm,
1271 struct smbios_type17 *t);
1272 void smbios_fill_dimm_locator(const struct dimm_info *dimm,
1273 struct smbios_type17 *t);
1274
1275 smbios_wakeup_type smbios_system_wakeup_type(void);
1276 smbios_board_type smbios_mainboard_board_type(void);
1277 smbios_enclosure_type smbios_mainboard_enclosure_type(void);
1278
1279 #endif