soc/intel/cnl: Allow setting PCIe subsystem IDs after FSP-S

Prevent the FSP from writing its default SVID SDID values of 8086:7270
for internal devices as this locks most of the registers. Allows the
subsystemid values set in devicetree to be used.

A description of this SSID table override behavior, along with example
code, is provided in the TigerLake FSP Integration Guide, section
15.178 ("SI_CONFIG Struct Reference").

The xHCI and HDA devices have RW/L registers rather than RW/O registers.
They can be written to multiple times but cannot be modified after
being locked, which happens during FspSiliconInit. Because coreboot
populates subsystem IDs after SiliconInit, these devices specifically
must be written beforehand or will otherwise be locked with their
default values of 0:0.

Tested by checking lspci output on System76 galp3-c (WHL), oryp5 (CFL),
and oryp6 (CML).

References:
- TigerLake FSP Integration Guide
- Intel Document Number 337868-002

Change-Id: Ieaa45ef7fa8e0da4a25b9174ded1ea0c5d9c4b4e
Signed-off-by: Jeremy Soller <jeremy@system76.com>
Signed-off-by: Tim Crawford <tcrawford@system76.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/49104
Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Jeremy Soller 2020-12-29 11:18:01 -07:00 committed by Patrick Georgi
parent 3ba2c1a63e
commit b1fa231d76
1 changed files with 47 additions and 0 deletions

View File

@ -524,6 +524,53 @@ void platform_fsp_silicon_init_params_cb(FSPS_UPD *supd)
params->PeiGraphicsPeimInit = 0;
params->PavpEnable = CONFIG(PAVP);
/*
* Prevent FSP from programming write-once subsystem IDs by providing
* a custom SSID table. Must have at least one entry for the FSP to
* use the table.
*/
struct svid_ssid_init_entry {
union {
struct {
uint64_t reg:12; /* Register offset */
uint64_t function:3;
uint64_t device:5;
uint64_t bus:8;
uint64_t :4;
uint64_t segment:16;
uint64_t :16;
};
uint64_t segbusdevfuncregister;
};
struct {
uint16_t svid;
uint16_t ssid;
};
uint32_t reserved;
};
/*
* The xHCI and HDA devices have RW/L rather than RW/O registers for
* subsystem IDs and so must be written before FspSiliconInit locks
* them with their default values.
*/
const pci_devfn_t devfn_table[] = { PCH_DEVFN_XHCI, PCH_DEVFN_HDA };
static struct svid_ssid_init_entry ssid_table[ARRAY_SIZE(devfn_table)];
for (i = 0; i < ARRAY_SIZE(devfn_table); i++) {
ssid_table[i].reg = PCI_SUBSYSTEM_VENDOR_ID;
ssid_table[i].device = PCI_SLOT(devfn_table[i]);
ssid_table[i].function = PCI_FUNC(devfn_table[i]);
dev = pcidev_path_on_root(devfn_table[i]);
if (dev) {
ssid_table[i].svid = dev->subsystem_vendor;
ssid_table[i].ssid = dev->subsystem_device;
}
}
params->SiSsidTablePtr = (uintptr_t)ssid_table;
params->SiNumberOfSsidTableEntry = ARRAY_SIZE(ssid_table);
}
/* Mainboard GPIO Configuration */