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