Xeon-SP boards: Factor out OCP VPD `get_cxl_mode()` impl
[coreboot2.git] / src / lib / smbios_defaults.c
blob0ad6442a4f42b8f00c050d3251755e0461c73240
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <memory_info.h>
4 #include <smbios.h>
5 #include <stdint.h>
6 #include <stdio.h>
8 /* this function will fill the corresponding locator */
9 __weak void smbios_fill_dimm_locator(const struct dimm_info *dimm, struct smbios_type17 *t)
11 char locator[40];
13 snprintf(locator, sizeof(locator), "Channel-%d-DIMM-%d",
14 dimm->channel_num, dimm->dimm_num);
15 t->device_locator = smbios_add_string(t->eos, locator);
17 snprintf(locator, sizeof(locator), "BANK %d", dimm->bank_locator);
18 t->bank_locator = smbios_add_string(t->eos, locator);
21 __weak void smbios_fill_dimm_asset_tag(const struct dimm_info *dimm, struct smbios_type17 *t)
23 char buf[40];
25 snprintf(buf, sizeof(buf), "Channel-%d-DIMM-%d-AssetTag",
26 dimm->channel_num, dimm->dimm_num);
27 t->asset_tag = smbios_add_string(t->eos, buf);
30 __weak smbios_wakeup_type smbios_system_wakeup_type(void)
32 return SMBIOS_WAKEUP_TYPE_RESERVED;
35 __weak const char *smbios_mainboard_bios_version(void)
37 return NULL;
40 __weak const char *smbios_mainboard_serial_number(void)
42 return CONFIG_MAINBOARD_SERIAL_NUMBER;
45 __weak const char *smbios_mainboard_version(void)
47 return CONFIG_MAINBOARD_VERSION;
50 __weak const char *smbios_mainboard_manufacturer(void)
52 return CONFIG_MAINBOARD_SMBIOS_MANUFACTURER;
55 __weak const char *smbios_mainboard_product_name(void)
57 return CONFIG_MAINBOARD_SMBIOS_PRODUCT_NAME;
60 __weak const char *smbios_mainboard_asset_tag(void)
62 return "";
65 __weak u8 smbios_mainboard_feature_flags(void)
67 return 0;
70 __weak const char *smbios_mainboard_location_in_chassis(void)
72 return "";
75 __weak smbios_board_type smbios_mainboard_board_type(void)
77 return SMBIOS_BOARD_TYPE_MOTHERBOARD;
80 __weak void smbios_ec_revision(uint8_t *ec_major_revision, uint8_t *ec_minor_revision)
82 *ec_major_revision = 0x0;
83 *ec_minor_revision = 0x0;
87 * System Enclosure or Chassis Types as defined in SMBIOS specification.
88 * The default value is SMBIOS_ENCLOSURE_DESKTOP (0x03) but laptop,
89 * convertible, or tablet enclosure will be used if the appropriate
90 * system type is selected.
92 __weak smbios_enclosure_type smbios_mainboard_enclosure_type(void)
94 if (CONFIG(SYSTEM_TYPE_LAPTOP))
95 return SMBIOS_ENCLOSURE_LAPTOP;
96 else if (CONFIG(SYSTEM_TYPE_TABLET))
97 return SMBIOS_ENCLOSURE_TABLET;
98 else if (CONFIG(SYSTEM_TYPE_CONVERTIBLE))
99 return SMBIOS_ENCLOSURE_CONVERTIBLE;
100 else if (CONFIG(SYSTEM_TYPE_DETACHABLE))
101 return SMBIOS_ENCLOSURE_DETACHABLE;
102 else
103 return SMBIOS_ENCLOSURE_DESKTOP;
106 __weak const char *smbios_system_serial_number(void)
108 return smbios_mainboard_serial_number();
111 __weak const char *smbios_system_version(void)
113 return smbios_mainboard_version();
116 __weak const char *smbios_system_manufacturer(void)
118 return smbios_mainboard_manufacturer();
121 __weak const char *smbios_system_product_name(void)
123 return smbios_mainboard_product_name();
126 __weak void smbios_system_set_uuid(u8 *uuid)
128 /* leave all zero */
131 __weak unsigned int smbios_cpu_get_max_speed_mhz(void)
133 return 0; /* Unknown */
136 __weak unsigned int smbios_cpu_get_current_speed_mhz(void)
138 return 0; /* Unknown */
141 __weak const char *smbios_system_sku(void)
143 return "";
146 __weak const char *smbios_chassis_version(void)
148 return "";
151 __weak const char *smbios_chassis_serial_number(void)
153 return "";
156 __weak const char *smbios_processor_serial_number(void)
158 return "";
161 __weak u8 smbios_chassis_power_cords(void)
163 return 1;