Jonathan Zhang | 826523b | 2020-04-09 10:42:19 -0700 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
Johnny Lin | 9da0279 | 2020-08-18 19:09:10 +0800 | [diff] [blame] | 3 | #include <assert.h> |
Elyes Haouas | 9efe34a | 2022-10-10 11:27:56 +0200 | [diff] [blame] | 4 | #include <commonlib/bsd/helpers.h> |
Johnny Lin | 407b35a | 2020-05-12 10:05:27 +0800 | [diff] [blame] | 5 | #include <console/console.h> |
Elyes Haouas | 9efe34a | 2022-10-10 11:27:56 +0200 | [diff] [blame] | 6 | #include <cpu/cpu.h> |
Patrick Rudolph | 7a593ab | 2024-01-25 15:15:00 +0100 | [diff] [blame^] | 7 | #include <cpu/x86/smm.h> |
Elyes Haouas | 9efe34a | 2022-10-10 11:27:56 +0200 | [diff] [blame] | 8 | #include <cpxsp_dl_gpio.h> |
| 9 | #include <device/device.h> |
| 10 | #include <device/pci_def.h> |
| 11 | #include <device/pci_ops.h> |
Johnny Lin | 407b35a | 2020-05-12 10:05:27 +0800 | [diff] [blame] | 12 | #include <drivers/ipmi/ipmi_ops.h> |
| 13 | #include <drivers/ocp/dmi/ocp_dmi.h> |
Arthur Heymans | 8c6ee91 | 2021-02-02 19:16:08 +0100 | [diff] [blame] | 14 | #include <drivers/vpd/vpd.h> |
Morgan Jang | 9862138 | 2020-06-11 16:32:16 +0800 | [diff] [blame] | 15 | #include <hob_iiouds.h> |
Johnny Lin | 9da0279 | 2020-08-18 19:09:10 +0800 | [diff] [blame] | 16 | #include <hob_memmap.h> |
Elyes Haouas | 9efe34a | 2022-10-10 11:27:56 +0200 | [diff] [blame] | 17 | #include <security/intel/txt/txt.h> |
| 18 | #include <smbios.h> |
| 19 | #include <soc/ramstage.h> |
Patrick Rudolph | 7a593ab | 2024-01-25 15:15:00 +0100 | [diff] [blame^] | 20 | #include <soc/smmrelocate.h> |
Elyes Haouas | 9efe34a | 2022-10-10 11:27:56 +0200 | [diff] [blame] | 21 | #include <soc/soc_util.h> |
| 22 | #include <soc/util.h> |
| 23 | #include <stdio.h> |
| 24 | #include <string.h> |
| 25 | #include <types.h> |
Jonathan Zhang | 826523b | 2020-04-09 10:42:19 -0700 | [diff] [blame] | 26 | |
Johnny Lin | 407b35a | 2020-05-12 10:05:27 +0800 | [diff] [blame] | 27 | #include "ipmi.h" |
Arthur Heymans | 8c6ee91 | 2021-02-02 19:16:08 +0100 | [diff] [blame] | 28 | #include "vpd.h" |
Johnny Lin | 407b35a | 2020-05-12 10:05:27 +0800 | [diff] [blame] | 29 | |
Johnny Lin | 5e8709f | 2020-06-11 15:25:37 +0800 | [diff] [blame] | 30 | #define SLOT_ID_LEN 2 |
| 31 | |
Johnny Lin | 407b35a | 2020-05-12 10:05:27 +0800 | [diff] [blame] | 32 | extern struct fru_info_str fru_strings; |
Johnny Lin | 5e8709f | 2020-06-11 15:25:37 +0800 | [diff] [blame] | 33 | static char slot_id_str[SLOT_ID_LEN]; |
| 34 | |
| 35 | /* Override SMBIOS 2 Location In Chassis from BMC */ |
| 36 | const char *smbios_mainboard_location_in_chassis(void) |
| 37 | { |
| 38 | uint8_t slot_id = 0; |
| 39 | |
| 40 | if (ipmi_get_slot_id(&slot_id) != CB_SUCCESS) { |
| 41 | printk(BIOS_ERR, "IPMI get slot_id failed\n"); |
| 42 | return ""; |
| 43 | } |
| 44 | /* Sanity check, slot_id can only be 1~4 since there are 4 slots in YV3 */ |
| 45 | if (slot_id < PCIE_CONFIG_A || slot_id > PCIE_CONFIG_D) { |
| 46 | printk(BIOS_ERR, "slot_id %d is not between 1~4\n", slot_id); |
| 47 | return ""; |
| 48 | } |
| 49 | snprintf(slot_id_str, SLOT_ID_LEN, "%d", slot_id); |
| 50 | return slot_id_str; |
| 51 | } |
Johnny Lin | 407b35a | 2020-05-12 10:05:27 +0800 | [diff] [blame] | 52 | |
Tim Chu | e82aa22 | 2020-12-21 23:33:18 -0800 | [diff] [blame] | 53 | /* Override SMBIOS type 2 Feature Flags */ |
| 54 | u8 smbios_mainboard_feature_flags(void) |
| 55 | { |
| 56 | return SMBIOS_FEATURE_FLAGS_HOSTING_BOARD | SMBIOS_FEATURE_FLAGS_REPLACEABLE; |
| 57 | } |
| 58 | |
Tim Chu | be34afa | 2020-11-13 03:04:54 -0800 | [diff] [blame] | 59 | /* |
| 60 | * Override SMBIOS type 4 cpu voltage. |
| 61 | * BIT7 will set to 1 after value return. If BIT7 is set to 1, the remaining seven |
| 62 | * bits of this field are set to contain the processor's current voltage times 10. |
| 63 | */ |
| 64 | unsigned int smbios_cpu_get_voltage(void) |
| 65 | { |
| 66 | /* This will return 1.6V which is expected value for Delta Lake |
| 67 | 10h = (1.6 * 10) = 16 */ |
| 68 | return 0x10; |
| 69 | } |
| 70 | |
Morgan Jang | 9862138 | 2020-06-11 16:32:16 +0800 | [diff] [blame] | 71 | /* System Slot Socket, Stack, Type and Data bus width Information */ |
| 72 | typedef struct { |
| 73 | u8 stack; |
| 74 | u8 slot_type; |
| 75 | u8 slot_data_bus_width; |
| 76 | u8 dev_func; |
| 77 | const char *slot_designator; |
| 78 | } slot_info; |
| 79 | |
JingleHsuWiwynn | 20fa59f | 2021-01-26 09:55:34 +0800 | [diff] [blame] | 80 | /* Array index + 1 would be used as Slot ID */ |
Morgan Jang | 9862138 | 2020-06-11 16:32:16 +0800 | [diff] [blame] | 81 | slot_info slotinfo[] = { |
Jingle Hsu | 5b24c6d | 2020-10-07 16:02:51 +0800 | [diff] [blame] | 82 | {CSTACK, SlotTypePciExpressGen3X4, SlotDataBusWidth4X, 0xE8, "SSD1_M2_Data_Drive"}, |
| 83 | {PSTACK1, SlotTypePciExpressGen3X4, SlotDataBusWidth4X, 0x10, "SSD0_M2_Boot_Drive"}, |
| 84 | {PSTACK1, SlotTypePciExpressGen3X4, SlotDataBusWidth4X, 0x18, "BB_OCP_NIC"}, |
Johnny Lin | c8ea212 | 2021-03-10 11:15:53 +0800 | [diff] [blame] | 85 | {PSTACK2, SlotTypePciExpressGen3X16, SlotDataBusWidth16X, 0x00, "1OU_OCP_NIC"}, |
Jingle Hsu | 5b24c6d | 2020-10-07 16:02:51 +0800 | [diff] [blame] | 86 | {PSTACK0, SlotTypePciExpressGen3X4, SlotDataBusWidth4X, 0x00, "2OU_JD1_M2_0"}, |
| 87 | {PSTACK0, SlotTypePciExpressGen3X4, SlotDataBusWidth4X, 0x08, "2OU_JD1_M2_1"}, |
Johnny Lin | c8ea212 | 2021-03-10 11:15:53 +0800 | [diff] [blame] | 88 | {PSTACK1, SlotTypePciExpressGen3X4, SlotDataBusWidth4X, 0x08, "2OU_JD2_M2_2"}, |
| 89 | {PSTACK1, SlotTypePciExpressGen3X4, SlotDataBusWidth4X, 0x00, "2OU_JD2_M2_3"}, |
Jingle Hsu | 5b24c6d | 2020-10-07 16:02:51 +0800 | [diff] [blame] | 90 | {PSTACK0, SlotTypePciExpressGen3X4, SlotDataBusWidth4X, 0x10, "2OU_JD3_M2_4"}, |
| 91 | {PSTACK0, SlotTypePciExpressGen3X4, SlotDataBusWidth4X, 0x18, "2OU_JD3_M2_5"}, |
Johnny Lin | c8ea212 | 2021-03-10 11:15:53 +0800 | [diff] [blame] | 92 | {PSTACK2, SlotTypePciExpressGen3X4, SlotDataBusWidth4X, 0x18, "1OU_JD1_M2_0"}, |
| 93 | {PSTACK2, SlotTypePciExpressGen3X4, SlotDataBusWidth4X, 0x10, "1OU_JD1_M2_1"}, |
| 94 | {PSTACK2, SlotTypePciExpressGen3X4, SlotDataBusWidth4X, 0x08, "1OU_JD2_M2_2"}, |
| 95 | {PSTACK2, SlotTypePciExpressGen3X4, SlotDataBusWidth4X, 0x00, "1OU_JD2_M2_3"}, |
Morgan Jang | 9862138 | 2020-06-11 16:32:16 +0800 | [diff] [blame] | 96 | }; |
| 97 | |
Johnny Lin | 9da0279 | 2020-08-18 19:09:10 +0800 | [diff] [blame] | 98 | #define SPD_REGVID_LEN 6 |
| 99 | /* A 4-digit long number plus a space */ |
| 100 | static void write_oem_word(uint16_t val, char *str) |
| 101 | { |
| 102 | snprintf(str, SPD_REGVID_LEN, "%04x ", val); |
| 103 | } |
| 104 | |
Johnny Lin | 407b35a | 2020-05-12 10:05:27 +0800 | [diff] [blame] | 105 | static void dl_oem_smbios_strings(struct device *dev, struct smbios_type11 *t) |
| 106 | { |
| 107 | uint8_t pcie_config = 0; |
Johnny Lin | 9da0279 | 2020-08-18 19:09:10 +0800 | [diff] [blame] | 108 | const struct SystemMemoryMapHob *hob; |
| 109 | char spd_reg_vid[SPD_REGVID_LEN]; |
| 110 | char empty[1] = ""; |
| 111 | char *oem_str7 = empty; |
Johnny Lin | 407b35a | 2020-05-12 10:05:27 +0800 | [diff] [blame] | 112 | |
| 113 | /* OEM string 1 to 6 */ |
| 114 | ocp_oem_smbios_strings(dev, t); |
| 115 | |
Johnny Lin | 9da0279 | 2020-08-18 19:09:10 +0800 | [diff] [blame] | 116 | /* OEM string 7 is the register vendor ID in SPD for each DIMM strung together */ |
| 117 | hob = get_system_memory_map(); |
Elyes Haouas | 3de1253 | 2022-09-13 10:14:27 +0200 | [diff] [blame] | 118 | assert(hob); |
Johnny Lin | 9da0279 | 2020-08-18 19:09:10 +0800 | [diff] [blame] | 119 | /* There are at most 6 channels and 2 DIMMs per channel, but Delta Lake has 6 DIMMs, |
| 120 | e.g. b300 0000 b300 0000 b300 0000 b300 0000 b300 0000 b300 0000 */ |
| 121 | for (int ch = 0; ch < MAX_CH; ch++) { |
| 122 | for (int dimm = 0; dimm < MAX_IMC; dimm++) { |
| 123 | write_oem_word(hob->Socket[0].ChannelInfo[ch].DimmInfo[dimm].SPDRegVen, |
| 124 | spd_reg_vid); |
| 125 | oem_str7 = strconcat(oem_str7, spd_reg_vid); |
| 126 | } |
| 127 | } |
| 128 | t->count = smbios_add_oem_string(t->eos, oem_str7); |
Johnny Lin | 407b35a | 2020-05-12 10:05:27 +0800 | [diff] [blame] | 129 | |
| 130 | /* Add OEM string 8 */ |
| 131 | if (ipmi_get_pcie_config(&pcie_config) == CB_SUCCESS) { |
| 132 | switch (pcie_config) { |
| 133 | case PCIE_CONFIG_UNKNOWN: |
| 134 | t->count = smbios_add_oem_string(t->eos, "0x0: Unknown"); |
| 135 | break; |
| 136 | case PCIE_CONFIG_A: |
| 137 | t->count = smbios_add_oem_string(t->eos, "0x1: YV3 Config-A"); |
| 138 | break; |
| 139 | case PCIE_CONFIG_B: |
| 140 | t->count = smbios_add_oem_string(t->eos, "0x2: YV3 Config-B"); |
| 141 | break; |
| 142 | case PCIE_CONFIG_C: |
| 143 | t->count = smbios_add_oem_string(t->eos, "0x3: YV3 Config-C"); |
| 144 | break; |
| 145 | case PCIE_CONFIG_D: |
| 146 | t->count = smbios_add_oem_string(t->eos, "0x4: YV3 Config-D"); |
| 147 | break; |
| 148 | default: |
| 149 | t->count = smbios_add_oem_string(t->eos, "Check BMC return data"); |
| 150 | } |
| 151 | } else { |
| 152 | printk(BIOS_ERR, "Failed to get IPMI PCIe config\n"); |
| 153 | } |
| 154 | } |
| 155 | |
Tim Chu | 39ea223 | 2020-11-23 21:24:20 -0800 | [diff] [blame] | 156 | static const struct port_information smbios_type8_info[] = { |
| 157 | { |
| 158 | .internal_reference_designator = "JCN18 - CPU MIPI60", |
| 159 | .internal_connector_type = CONN_OTHER, |
| 160 | .external_reference_designator = "", |
| 161 | .external_connector_type = CONN_NONE, |
| 162 | .port_type = TYPE_OTHER_PORT |
| 163 | }, |
| 164 | { |
| 165 | .internal_reference_designator = "JCN32 - TPM_CONN", |
| 166 | .internal_connector_type = CONN_OTHER, |
| 167 | .external_reference_designator = "", |
| 168 | .external_connector_type = CONN_NONE, |
| 169 | .port_type = TYPE_OTHER_PORT |
| 170 | }, |
| 171 | { |
| 172 | .internal_reference_designator = "JCN7 - USB type C", |
| 173 | .internal_connector_type = CONN_USB_TYPE_C, |
| 174 | .external_reference_designator = "", |
| 175 | .external_connector_type = CONN_NONE, |
| 176 | .port_type = TYPE_USB |
| 177 | }, |
| 178 | }; |
| 179 | |
Morgan Jang | 9862138 | 2020-06-11 16:32:16 +0800 | [diff] [blame] | 180 | static int create_smbios_type9(int *handle, unsigned long *current) |
| 181 | { |
| 182 | int index; |
| 183 | int length = 0; |
| 184 | uint8_t slot_length; |
| 185 | uint8_t sec_bus; |
| 186 | uint8_t slot_usage; |
| 187 | uint8_t pcie_config = 0; |
Morgan Jang | 9862138 | 2020-06-11 16:32:16 +0800 | [diff] [blame] | 188 | uint32_t vendor_device_id; |
Maxim Polyakov | 91a4512 | 2021-01-14 01:37:26 +0300 | [diff] [blame] | 189 | uint8_t stack_busnos[MAX_IIO_STACK]; |
Johnny Lin | cfe15a2 | 2021-10-05 08:33:08 +0800 | [diff] [blame] | 190 | pci_devfn_t pci_dev_slot, pci_dev = 0; |
Morgan Jang | 9862138 | 2020-06-11 16:32:16 +0800 | [diff] [blame] | 191 | unsigned int cap; |
| 192 | uint16_t sltcap; |
| 193 | |
| 194 | if (ipmi_get_pcie_config(&pcie_config) != CB_SUCCESS) |
| 195 | printk(BIOS_ERR, "Failed to get IPMI PCIe config\n"); |
| 196 | |
Maxim Polyakov | 91a4512 | 2021-01-14 01:37:26 +0300 | [diff] [blame] | 197 | for (index = 0; index < ARRAY_SIZE(stack_busnos); index++) |
| 198 | stack_busnos[index] = get_stack_busno(index); |
Morgan Jang | 9862138 | 2020-06-11 16:32:16 +0800 | [diff] [blame] | 199 | |
| 200 | for (index = 0; index < ARRAY_SIZE(slotinfo); index++) { |
Johnny Lin | cfe15a2 | 2021-10-05 08:33:08 +0800 | [diff] [blame] | 201 | uint8_t characteristics_1 = 0; |
| 202 | uint8_t characteristics_2 = 0; |
| 203 | |
Morgan Jang | 9862138 | 2020-06-11 16:32:16 +0800 | [diff] [blame] | 204 | if (pcie_config == PCIE_CONFIG_A) { |
Jingle Hsu | 5b24c6d | 2020-10-07 16:02:51 +0800 | [diff] [blame] | 205 | if (index == 0 || index == 1 || index == 2) |
Morgan Jang | 9862138 | 2020-06-11 16:32:16 +0800 | [diff] [blame] | 206 | printk(BIOS_INFO, "Find Config-A slot: %s\n", |
| 207 | slotinfo[index].slot_designator); |
| 208 | else |
| 209 | continue; |
| 210 | } |
| 211 | if (pcie_config == PCIE_CONFIG_B) { |
Johnny Lin | c8ea212 | 2021-03-10 11:15:53 +0800 | [diff] [blame] | 212 | switch (index) { |
| 213 | case 0 ... 2: |
| 214 | case 10 ... 13: |
Morgan Jang | 9862138 | 2020-06-11 16:32:16 +0800 | [diff] [blame] | 215 | printk(BIOS_INFO, "Find Config-B slot: %s\n", |
| 216 | slotinfo[index].slot_designator); |
Johnny Lin | c8ea212 | 2021-03-10 11:15:53 +0800 | [diff] [blame] | 217 | break; |
| 218 | default: |
Morgan Jang | 9862138 | 2020-06-11 16:32:16 +0800 | [diff] [blame] | 219 | continue; |
Johnny Lin | c8ea212 | 2021-03-10 11:15:53 +0800 | [diff] [blame] | 220 | } |
Morgan Jang | 9862138 | 2020-06-11 16:32:16 +0800 | [diff] [blame] | 221 | } |
| 222 | if (pcie_config == PCIE_CONFIG_C) { |
Johnny Lin | c8ea212 | 2021-03-10 11:15:53 +0800 | [diff] [blame] | 223 | switch (index) { |
| 224 | case 0 ... 1: |
| 225 | case 3 ... 9: |
Morgan Jang | 9862138 | 2020-06-11 16:32:16 +0800 | [diff] [blame] | 226 | printk(BIOS_INFO, "Find Config-C slot: %s\n", |
| 227 | slotinfo[index].slot_designator); |
Johnny Lin | c8ea212 | 2021-03-10 11:15:53 +0800 | [diff] [blame] | 228 | break; |
| 229 | default: |
Morgan Jang | 9862138 | 2020-06-11 16:32:16 +0800 | [diff] [blame] | 230 | continue; |
Johnny Lin | c8ea212 | 2021-03-10 11:15:53 +0800 | [diff] [blame] | 231 | } |
Morgan Jang | 9862138 | 2020-06-11 16:32:16 +0800 | [diff] [blame] | 232 | } |
| 233 | if (pcie_config == PCIE_CONFIG_D) { |
Johnny Lin | c8ea212 | 2021-03-10 11:15:53 +0800 | [diff] [blame] | 234 | if (index != 3) |
Morgan Jang | 9862138 | 2020-06-11 16:32:16 +0800 | [diff] [blame] | 235 | printk(BIOS_INFO, "Find Config-D slot: %s\n", |
| 236 | slotinfo[index].slot_designator); |
| 237 | else |
| 238 | continue; |
| 239 | } |
| 240 | |
| 241 | if (slotinfo[index].slot_data_bus_width == SlotDataBusWidth16X) |
| 242 | slot_length = SlotLengthLong; |
| 243 | else |
| 244 | slot_length = SlotLengthShort; |
| 245 | |
Johnny Lin | cfe15a2 | 2021-10-05 08:33:08 +0800 | [diff] [blame] | 246 | pci_dev_slot = PCI_DEV(stack_busnos[slotinfo[index].stack], |
Morgan Jang | 9862138 | 2020-06-11 16:32:16 +0800 | [diff] [blame] | 247 | slotinfo[index].dev_func >> 3, slotinfo[index].dev_func & 0x7); |
Johnny Lin | cfe15a2 | 2021-10-05 08:33:08 +0800 | [diff] [blame] | 248 | sec_bus = pci_s_read_config8(pci_dev_slot, PCI_SECONDARY_BUS); |
Morgan Jang | 9862138 | 2020-06-11 16:32:16 +0800 | [diff] [blame] | 249 | |
| 250 | if (sec_bus == 0xFF) { |
| 251 | slot_usage = SlotUsageUnknown; |
| 252 | } else { |
Johnny Lin | cfe15a2 | 2021-10-05 08:33:08 +0800 | [diff] [blame] | 253 | /* Checking for downstream device availability */ |
Morgan Jang | 9862138 | 2020-06-11 16:32:16 +0800 | [diff] [blame] | 254 | pci_dev = PCI_DEV(sec_bus, 0, 0); |
| 255 | vendor_device_id = pci_s_read_config32(pci_dev, 0); |
| 256 | if (vendor_device_id == 0xFFFFFFFF) |
| 257 | slot_usage = SlotUsageAvailable; |
| 258 | else |
| 259 | slot_usage = SlotUsageInUse; |
| 260 | } |
| 261 | |
| 262 | characteristics_1 |= SMBIOS_SLOT_3P3V; // Provides33Volts |
| 263 | characteristics_2 |= SMBIOS_SLOT_PME; // PmeSiganalSupported |
Johnny Lin | cfe15a2 | 2021-10-05 08:33:08 +0800 | [diff] [blame] | 264 | /* Read IIO root port device CSR for slot capabilities */ |
| 265 | cap = pci_s_find_capability(pci_dev_slot, PCI_CAP_ID_PCIE); |
| 266 | sltcap = pci_s_read_config16(pci_dev_slot, cap + PCI_EXP_SLTCAP); |
Morgan Jang | 9862138 | 2020-06-11 16:32:16 +0800 | [diff] [blame] | 267 | if (sltcap & PCI_EXP_SLTCAP_HPC) |
| 268 | characteristics_2 |= SMBIOS_SLOT_HOTPLUG; |
| 269 | |
JingleHsuWiwynn | 20fa59f | 2021-01-26 09:55:34 +0800 | [diff] [blame] | 270 | const uint16_t slot_id = index + 1; |
Johnny Lin | cfe15a2 | 2021-10-05 08:33:08 +0800 | [diff] [blame] | 271 | /* According to SMBIOS spec, the BDF number should be the end |
| 272 | point on the slot, for now we keep using the root port's BDF to |
| 273 | be aligned with our UEFI reference BIOS. */ |
Morgan Jang | 9862138 | 2020-06-11 16:32:16 +0800 | [diff] [blame] | 274 | length += smbios_write_type9(current, handle, |
| 275 | slotinfo[index].slot_designator, |
| 276 | slotinfo[index].slot_type, |
| 277 | slotinfo[index].slot_data_bus_width, |
| 278 | slot_usage, |
| 279 | slot_length, |
JingleHsuWiwynn | 20fa59f | 2021-01-26 09:55:34 +0800 | [diff] [blame] | 280 | slot_id, |
Morgan Jang | 9862138 | 2020-06-11 16:32:16 +0800 | [diff] [blame] | 281 | characteristics_1, |
| 282 | characteristics_2, |
Felix Held | d459403 | 2024-01-11 21:50:36 +0100 | [diff] [blame] | 283 | 0, /* segment group */ |
Morgan Jang | 9862138 | 2020-06-11 16:32:16 +0800 | [diff] [blame] | 284 | stack_busnos[slotinfo[index].stack], |
| 285 | slotinfo[index].dev_func); |
| 286 | } |
| 287 | |
| 288 | return length; |
| 289 | } |
| 290 | |
| 291 | static int mainboard_smbios_data(struct device *dev, int *handle, unsigned long *current) |
| 292 | { |
| 293 | int len = 0; |
| 294 | |
Tim Chu | 39ea223 | 2020-11-23 21:24:20 -0800 | [diff] [blame] | 295 | // add port information |
| 296 | len += smbios_write_type8( |
| 297 | current, handle, |
| 298 | smbios_type8_info, |
| 299 | ARRAY_SIZE(smbios_type8_info) |
| 300 | ); |
| 301 | |
Morgan Jang | 9862138 | 2020-06-11 16:32:16 +0800 | [diff] [blame] | 302 | len += create_smbios_type9(handle, current); |
| 303 | |
| 304 | return len; |
| 305 | } |
Johnny Lin | 1d28668 | 2020-09-28 22:44:48 +0800 | [diff] [blame] | 306 | |
| 307 | void smbios_fill_dimm_locator(const struct dimm_info *dimm, struct smbios_type17 *t) |
| 308 | { |
| 309 | char buf[40]; |
| 310 | |
Johnny Lin | 38cb7c1 | 2021-01-25 15:45:06 +0800 | [diff] [blame] | 311 | snprintf(buf, sizeof(buf), "DIMM_%c0", 'A' + dimm->channel_num); |
Johnny Lin | 1d28668 | 2020-09-28 22:44:48 +0800 | [diff] [blame] | 312 | t->device_locator = smbios_add_string(t->eos, buf); |
| 313 | |
| 314 | snprintf(buf, sizeof(buf), "_Node0_Channel%d_Dimm0", dimm->channel_num); |
| 315 | t->bank_locator = smbios_add_string(t->eos, buf); |
| 316 | } |
Morgan Jang | 9862138 | 2020-06-11 16:32:16 +0800 | [diff] [blame] | 317 | |
Johnny Lin | 407b35a | 2020-05-12 10:05:27 +0800 | [diff] [blame] | 318 | static void mainboard_enable(struct device *dev) |
| 319 | { |
Elyes Haouas | 7ac796c | 2022-09-29 12:46:46 +0200 | [diff] [blame] | 320 | dev->ops->get_smbios_strings = dl_oem_smbios_strings; |
Johnny Lin | 407b35a | 2020-05-12 10:05:27 +0800 | [diff] [blame] | 321 | read_fru_areas(CONFIG_BMC_KCS_BASE, CONFIG_FRU_DEVICE_ID, 0, &fru_strings); |
Morgan Jang | 9862138 | 2020-06-11 16:32:16 +0800 | [diff] [blame] | 322 | dev->ops->get_smbios_data = mainboard_smbios_data; |
Johnny Lin | 407b35a | 2020-05-12 10:05:27 +0800 | [diff] [blame] | 323 | } |
| 324 | |
Jonathan Zhang | 826523b | 2020-04-09 10:42:19 -0700 | [diff] [blame] | 325 | void mainboard_silicon_init_params(FSPS_UPD *params) |
| 326 | { |
Bryant Ou | 9ccd311 | 2020-07-16 20:19:17 -0700 | [diff] [blame] | 327 | /* configure Lewisburg PCH GPIO controller after FSP-M */ |
| 328 | gpio_configure_pads(gpio_table, ARRAY_SIZE(gpio_table)); |
Jonathan Zhang | 826523b | 2020-04-09 10:42:19 -0700 | [diff] [blame] | 329 | } |
Johnny Lin | 407b35a | 2020-05-12 10:05:27 +0800 | [diff] [blame] | 330 | |
| 331 | static void mainboard_final(void *chip_info) |
| 332 | { |
Johnny Lin | 407b35a | 2020-05-12 10:05:27 +0800 | [diff] [blame] | 333 | } |
| 334 | |
| 335 | struct chip_operations mainboard_ops = { |
| 336 | .enable_dev = mainboard_enable, |
| 337 | .final = mainboard_final, |
| 338 | }; |
Arthur Heymans | 8c6ee91 | 2021-02-02 19:16:08 +0100 | [diff] [blame] | 339 | |
Patrick Rudolph | 7a593ab | 2024-01-25 15:15:00 +0100 | [diff] [blame^] | 340 | void smm_mainboard_pci_resource_store_init(struct smm_pci_resource_info *slots, size_t size) |
| 341 | { |
| 342 | soc_ubox_store_resources(slots, size); |
| 343 | } |
| 344 | |
Arthur Heymans | 8c6ee91 | 2021-02-02 19:16:08 +0100 | [diff] [blame] | 345 | bool skip_intel_txt_lockdown(void) |
| 346 | { |
| 347 | static bool fetched_vpd = 0; |
| 348 | static uint8_t skip_txt = SKIP_INTEL_TXT_LOCKDOWN_DEFAULT; |
| 349 | |
| 350 | if (fetched_vpd) |
| 351 | return (bool)skip_txt; |
| 352 | |
| 353 | if (!vpd_get_bool(SKIP_INTEL_TXT_LOCKDOWN, VPD_RW_THEN_RO, &skip_txt)) |
| 354 | printk(BIOS_INFO, "%s: not able to get VPD %s, default set to %d\n", |
| 355 | __func__, SKIP_INTEL_TXT_LOCKDOWN, SKIP_INTEL_TXT_LOCKDOWN_DEFAULT); |
| 356 | else |
| 357 | printk(BIOS_DEBUG, "%s: VPD %s, got %d\n", __func__, SKIP_INTEL_TXT_LOCKDOWN, |
| 358 | skip_txt); |
| 359 | |
| 360 | fetched_vpd = 1; |
| 361 | |
| 362 | return (bool)skip_txt; |
| 363 | } |