From f13b4ca2853ee691a19073054565b68d65703f89 Mon Sep 17 00:00:00 2001 From: Patrick Rudolph Date: Mon, 30 Dec 2024 11:27:44 +0100 Subject: [PATCH] soc/intel/xeon_sp/skx: Enable x86_64 On Xeon Skylake-SP with dual sockets the platforms make use of 46bit of the address space. Most of the PCI BARs reside in high MMIO, not reachable by x86_32 coreboot. Add support for x86_64 coreboot and confirm that all supported boards are booting without errors. This is done by: - converting all occurrences of VOID * to UINT32 to make sure that FSP UPDs do not change when pointers are 8byte wide. - Drop SetupStructPtr as it's unused within FSP and coreboot TEST: Booted on ocp/tiogapass to Linux. No errors were observed. Change-Id: I8adac99e7600a708b596fd74b00669f4cb4e041b Signed-off-by: Patrick Rudolph Reviewed-on: https://review.coreboot.org/c/coreboot/+/85805 Tested-by: build bot (Jenkins) Reviewed-by: Angel Pons Reviewed-by: Shuo Liu --- src/mainboard/ocp/tiogapass/romstage.c | 20 ++++---- src/soc/intel/xeon_sp/skx/Kconfig | 2 + .../intel/fsp/fsp2_0/skylake_sp/FspmUpd.h | 47 +++++++++---------- 3 files changed, 36 insertions(+), 33 deletions(-) diff --git a/src/mainboard/ocp/tiogapass/romstage.c b/src/mainboard/ocp/tiogapass/romstage.c index 276285ae03..ca54aba9c3 100644 --- a/src/mainboard/ocp/tiogapass/romstage.c +++ b/src/mainboard/ocp/tiogapass/romstage.c @@ -20,6 +20,9 @@ static uint8_t iio_table_buf[sizeof(tp_iio_bifur_table)]; static void oem_update_iio(FSPM_UPD *mupd) { + UPD_IIO_BIFURCATION_DATA_ENTRY *entry = + (void *)(uintptr_t)mupd->FspmConfig.IioBifurcationConfig.IIoBifurcationTablePtr; + /* Read GPIO to decide IIO bifurcation at run-time. */ int slot_config0 = gpio_get(GPP_C15); int slot_config1 = gpio_get(GPP_C16); @@ -28,25 +31,24 @@ static void oem_update_iio(FSPM_UPD *mupd) reading the GPIO expander PCA9555 via SMBUS, and then configure the bifurcation accordingly is left for future work. */ if (!slot_config0 && slot_config1) - mupd->FspmConfig.IioBifurcationConfig.IIoBifurcationTable[Skt0_Iou0].Bifurcation - = IIO_BIFURCATE_xxx8xxx8; + entry[Skt0_Iou0].Bifurcation = IIO_BIFURCATE_xxx8xxx8; } static void mainboard_config_iio(FSPM_UPD *mupd) { memcpy(iio_table_buf, tp_iio_bifur_table, sizeof(tp_iio_bifur_table)); - mupd->FspmConfig.IioBifurcationConfig.IIoBifurcationTable = - (UPD_IIO_BIFURCATION_DATA_ENTRY *)iio_table_buf; + mupd->FspmConfig.IioBifurcationConfig.IIoBifurcationTablePtr = + (uintptr_t)(UPD_IIO_BIFURCATION_DATA_ENTRY *)iio_table_buf; mupd->FspmConfig.IioBifurcationConfig.NumberOfEntries = ARRAY_SIZE(tp_iio_bifur_table); - mupd->FspmConfig.IioPciConfig.ConfigurationTable = - (UPD_PCI_PORT_CONFIG *)tp_iio_pci_port_skt0; + mupd->FspmConfig.IioPciConfig.ConfigurationTablePtr = + (uintptr_t)(UPD_PCI_PORT_CONFIG *)tp_iio_pci_port_skt0; mupd->FspmConfig.IioPciConfig.NumberOfEntries = ARRAY_SIZE(tp_iio_pci_port_skt0); - mupd->FspmConfig.PchPciConfig.PciPortConfig = - (UPD_PCH_PCIE_PORT *)tp_pch_pci_port_skt0; + mupd->FspmConfig.PchPciConfig.PciPortConfigPtr = + (uintptr_t)(UPD_PCH_PCIE_PORT *)tp_pch_pci_port_skt0; mupd->FspmConfig.PchPciConfig.NumberOfEntries = ARRAY_SIZE(tp_pch_pci_port_skt0); @@ -88,7 +90,7 @@ void mainboard_memory_init_params(FSPM_UPD *mupd) mainboard_config_iio(mupd); /* do not configure GPIO controller inside FSP-M */ - mupd->FspmConfig.GpioConfig.GpioTable = NULL; + mupd->FspmConfig.GpioConfig.GpioTablePtr = 0; mupd->FspmConfig.GpioConfig.NumberOfEntries = 0; } diff --git a/src/soc/intel/xeon_sp/skx/Kconfig b/src/soc/intel/xeon_sp/skx/Kconfig index 970dba3d1b..acbc31fcad 100644 --- a/src/soc/intel/xeon_sp/skx/Kconfig +++ b/src/soc/intel/xeon_sp/skx/Kconfig @@ -6,6 +6,8 @@ config SOC_INTEL_SKYLAKE_SP select PLATFORM_USES_FSP2_0 select NO_FSP_TEMP_RAM_EXIT select UDK_202005_BINDING + select HAVE_X86_64_SUPPORT + select USE_X86_64_SUPPORT help Intel Skylake-SP support diff --git a/src/vendorcode/intel/fsp/fsp2_0/skylake_sp/FspmUpd.h b/src/vendorcode/intel/fsp/fsp2_0/skylake_sp/FspmUpd.h index f81e218634..2049716ccb 100644 --- a/src/vendorcode/intel/fsp/fsp2_0/skylake_sp/FspmUpd.h +++ b/src/vendorcode/intel/fsp/fsp2_0/skylake_sp/FspmUpd.h @@ -37,6 +37,9 @@ are permitted provided that the following conditions are met: #pragma pack(1) +/* Must not use VOID * since that would break x86_64 coreboot support! */ +#define PTR_32B(type) UINT32 + /** FSP Header Version Number **/ @@ -261,7 +264,7 @@ typedef struct { /** GPIOTABLE_CONFIG: GpioTable - Base Address of the Gpio Table declared by the - bootloader. + bootloader. Pointer to UPD_GPIO_INIT_CONFIG. Default: NULL NumberofEntries - Number of Entries in the GPIO Table provided Default: 0 @@ -269,8 +272,8 @@ typedef struct { configuration using default GPIO_INIT_CONFIG tables **/ typedef struct { - UPD_GPIO_INIT_CONFIG *GpioTable; - UINT32 NumberOfEntries; + PTR_32B(UPD_GPIO_INIT_CONFIG) GpioTablePtr; + UINT32 NumberOfEntries; } GPIOTABLE_CONFIG; /** @@ -293,7 +296,7 @@ typedef struct { /** IIOBIFURCATION_CONFIG: IIoBifurcationTable - Base Address of the IIO Bifurcation table - declared by the bootloader + declared by the bootloader. Pointer to UPD_IIO_BIFURCATION_DATA_ENTRY. Default: NULL NumberofEntries - Number of Entries in the IIO Bifurcation Table Default: 0 @@ -301,8 +304,8 @@ typedef struct { bifurcation using default IIO_BIFURCATION_DATA_ENTRY tables **/ typedef struct { - UPD_IIO_BIFURCATION_DATA_ENTRY *IIoBifurcationTable; - UINT32 NumberOfEntries; + PTR_32B(UPD_IIO_BIFURCATION_DATA_ENTRY) IIoBifurcationTablePtr; + UINT32 NumberOfEntries; } IIOBIFURCATION_CONFIG; /** @@ -381,13 +384,12 @@ typedef struct { /** PCIEPORT_CONFIG: PciePortConfiguration - Pointer to an array of PCIe port configuration structures - as declared above + as declared above. Pointer to UPD_PCI_PORT_CONFIG. NumberOfEntries - Number of elements in the PciePortConfiguration Array **/ typedef struct { - UPD_PCI_PORT_CONFIG *ConfigurationTable; - - UINT16 NumberOfEntries; + PTR_32B(UPD_PCI_PORT_CONFIG) ConfigurationTablePtr; + UINT16 NumberOfEntries; } IIOPCIPORT_CONFIG; /** @@ -412,12 +414,13 @@ typedef struct { /** IIORESOURCE_CONFIG: - ResourceConfigTable - Pointer to an Iio Stack Resource Configuration Structure Array + ResourceConfigTable - Pointer to an Iio Stack Resource Configuration Structure Array. + Pointer to UPD_IIO_STACK_RESOURCE_CONFIG. NumberOfEntries - Number of Entries in the Iio Stack Resource Configuration Array **/ typedef struct { - UPD_IIO_STACK_RESOURCE_CONFIG *ResourceTable; - UINT16 NumberOfEntries; + PTR_32B(UPD_IIO_STACK_RESOURCE_CONFIG) ResourceTablePtr; + UINT16 NumberOfEntries; } IIORESOURCE_CONFIG; /** @@ -436,6 +439,7 @@ typedef struct { /** PCHPCIPORT_CONFIG: PciPortConfig - Pointer to an array of PCH PCI Ports to be configured + Pointer to UPD_PCH_PCIE_PORT. RootPortFunctionSwapping - Disable root port swapping based on device connection status PciePllSsc - Specifies the Pcie Pll Spread Spectrum Percentage @@ -446,10 +450,10 @@ typedef struct { NumberOfEntries - Number of entries in the PCH PCI Port configuration **/ typedef struct { - UPD_PCH_PCIE_PORT *PciPortConfig; - UINT8 RootPortFunctionSwapping; - UINT8 PciePllSsc; - UINT16 NumberOfEntries; + PTR_32B(UPD_PCH_PCIE_PORT) PciPortConfigPtr; + UINT8 RootPortFunctionSwapping; + UINT8 PciePllSsc; + UINT16 NumberOfEntries; } PCHPCIPORT_CONFIG; /** FSP-M Configuration @@ -507,12 +511,7 @@ typedef struct { **/ UINT8 BoardId; - UINT8 reserved2[24]; - -/** Offset 0x00C2 **/ - VOID *SetupStructPtr; - - UINT8 reserved3[20]; + UINT8 reserved2[48]; /** Offset 0x00DA - IioPciConfig IIO Pci Port Config Struct. Defaults: All pointers are NULL. All values are set to zero. @@ -529,7 +528,7 @@ typedef struct { **/ IIORESOURCE_CONFIG IioResourceConfig; - UINT8 reserved4[3]; + UINT8 reserved3[3]; /** Offset 0x00F1 - DCI Enable Enable / Disable DCI