From d7237b0124861e20d9558b39ca2a7ad5e3eb5700 Mon Sep 17 00:00:00 2001 From: Nate DeSimone Date: Tue, 24 Sep 2024 14:24:40 -0700 Subject: [PATCH 1/8] MinPlatformPkg: Case sensitive path names Correct case on AlderlakeOpenBoardPkg in build.cfg. Add better error handling for config files not being found. Signed-off-by: Nate DeSimone --- Platform/Intel/build.cfg | 2 +- Platform/Intel/build_bios.py | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Platform/Intel/build.cfg b/Platform/Intel/build.cfg index 6ab2ced1a54..eb83f2bef62 100644 --- a/Platform/Intel/build.cfg +++ b/Platform/Intel/build.cfg @@ -71,4 +71,4 @@ WilsonCityRvp = WhitleyOpenBoardPkg/WilsonCityRvp/build_config.cfg BoardTiogaPass = PurleyOpenBoardPkg/BoardTiogaPass/build_config.cfg JunctionCity = WhitleyOpenBoardPkg/JunctionCity/build_config.cfg Aowanda = WhitleyOpenBoardPkg/Aowanda/build_config.cfg -AlderLakePRvp = AlderLakeOpenBoardPkg/AlderLakePRvp/build_config.cfg +AlderlakePRvp = AlderlakeOpenBoardPkg/AlderlakePRvp/build_config.cfg diff --git a/Platform/Intel/build_bios.py b/Platform/Intel/build_bios.py index 3b2fbf59f02..ae5b670b661 100755 --- a/Platform/Intel/build_bios.py +++ b/Platform/Intel/build_bios.py @@ -924,9 +924,15 @@ def get_config(): :returns: The config defined in the the Build.cfg file :rtype: Dictionary """ + path = 'build.cfg' + if not os.path.isfile(path): + path = os.path.dirname(__file__) + path = os.path.join(path, 'build.cfg') + if not os.path.isfile(path): + raise IOError("Config file {} not found".format()) config_file = configparser.RawConfigParser() config_file.optionxform = str - config_file.read('build.cfg') + config_file.read(path) config_dictionary = {} for section in config_file.sections(): dictionary = dict(config_file.items(section)) @@ -949,6 +955,11 @@ def get_platform_config(platform_name, config_data): platform_data = config_data.get("PLATFORMS") path = platform_data.get(platform_name) + if not os.path.isfile(path): + path = os.path.dirname(__file__) + path = os.path.join(path, platform_data.get(platform_name)) + if not os.path.isfile(path): + raise IOError("Config file {} not found".format()) config_file = configparser.RawConfigParser() config_file.optionxform = str config_file.read(path) From a953fd0b637aad16ed8378e3bd0f64f8ed61fd1a Mon Sep 17 00:00:00 2001 From: Nate DeSimone Date: Tue, 24 Sep 2024 14:28:21 -0700 Subject: [PATCH 2/8] AlderlakeOpenBoardPkg: Remove unused variables Signed-off-by: Nate DeSimone --- .../Library/BoardInitLib/Pei/PeiInitPreMemLib.c | 4 +--- .../PeiPolicyUpdateLib/PeiCpuPolicyUpdatePreMem.c | 12 ------------ .../Library/PeiPolicyUpdateLib/PeiPchPolicyUpdate.c | 6 ------ .../Library/PeiPolicyUpdateLib/PeiSaPolicyUpdate.c | 2 -- .../PeiPolicyUpdateLib/PeiSaPolicyUpdatePreMem.c | 7 ------- 5 files changed, 1 insertion(+), 30 deletions(-) diff --git a/Platform/Intel/AlderlakeOpenBoardPkg/AlderlakePRvp/Library/BoardInitLib/Pei/PeiInitPreMemLib.c b/Platform/Intel/AlderlakeOpenBoardPkg/AlderlakePRvp/Library/BoardInitLib/Pei/PeiInitPreMemLib.c index 0b7db476a17..caa81d1b29c 100644 --- a/Platform/Intel/AlderlakeOpenBoardPkg/AlderlakePRvp/Library/BoardInitLib/Pei/PeiInitPreMemLib.c +++ b/Platform/Intel/AlderlakeOpenBoardPkg/AlderlakePRvp/Library/BoardInitLib/Pei/PeiInitPreMemLib.c @@ -146,8 +146,6 @@ AdlPBoardInitBeforeMemoryInit ( VOID ) { - EFI_STATUS Status; - DEBUG ((DEBUG_INFO, "AdlPBoardInitBeforeMemoryInit\n")); AdlPInitPreMem (); @@ -156,7 +154,7 @@ AdlPBoardInitBeforeMemoryInit ( AdlPMrcConfigInit (); AdlPSaMiscConfigInit (); - Status = AdlPRootPortClkInfoInit (); + AdlPRootPortClkInfoInit (); AdlPSaDisplayConfigInit (); if (PcdGetPtr (PcdBoardGpioTableEarlyPreMem) != 0) { GpioInit (PcdGetPtr (PcdBoardGpioTableEarlyPreMem)); diff --git a/Platform/Intel/AlderlakeOpenBoardPkg/Policy/Library/PeiPolicyUpdateLib/PeiCpuPolicyUpdatePreMem.c b/Platform/Intel/AlderlakeOpenBoardPkg/Policy/Library/PeiPolicyUpdateLib/PeiCpuPolicyUpdatePreMem.c index 1139277f9d8..174308d9bc6 100644 --- a/Platform/Intel/AlderlakeOpenBoardPkg/Policy/Library/PeiPolicyUpdateLib/PeiCpuPolicyUpdatePreMem.c +++ b/Platform/Intel/AlderlakeOpenBoardPkg/Policy/Library/PeiPolicyUpdateLib/PeiCpuPolicyUpdatePreMem.c @@ -42,25 +42,13 @@ UpdatePeiCpuPolicyPreMem ( CPU_CONFIG_LIB_PREMEM_CONFIG *CpuConfigLibPreMemConfig; SI_PREMEM_POLICY_PPI *SiPreMemPolicyPpi; UINT32 MaxLogicProcessors; - UINT16 BiosSize; - UINT16 BiosMemSizeInMb; - FW_BOOT_MEDIA_TYPE FwBootMediaType; MSR_CORE_THREAD_COUNT_REGISTER MsrCoreThreadCount; - UINT8 AllCoreCount; - UINT8 AllSmallCoreCount; - UINT32 DisablePerCoreMask; DEBUG ((DEBUG_INFO, "Update PeiCpuPolicyUpdate Pre-Mem Start\n")); SiPreMemPolicyPpi = NULL; CpuSecurityPreMemConfig = NULL; CpuConfigLibPreMemConfig = NULL; - BiosSize = 0; - BiosMemSizeInMb = 0; - FwBootMediaType = FwBootMediaMax; - AllCoreCount = 0; - AllSmallCoreCount = 0; - DisablePerCoreMask = 0; Status = PeiServicesLocatePpi (&gSiPreMemPolicyPpiGuid, 0, NULL, (VOID **) &SiPreMemPolicyPpi); ASSERT_EFI_ERROR (Status); diff --git a/Platform/Intel/AlderlakeOpenBoardPkg/Policy/Library/PeiPolicyUpdateLib/PeiPchPolicyUpdate.c b/Platform/Intel/AlderlakeOpenBoardPkg/Policy/Library/PeiPolicyUpdateLib/PeiPchPolicyUpdate.c index 1c0cf6bee0f..be5483e8efe 100644 --- a/Platform/Intel/AlderlakeOpenBoardPkg/Policy/Library/PeiPolicyUpdateLib/PeiPchPolicyUpdate.c +++ b/Platform/Intel/AlderlakeOpenBoardPkg/Policy/Library/PeiPolicyUpdateLib/PeiPchPolicyUpdate.c @@ -188,17 +188,11 @@ UpdatePeiPchPolicy ( EFI_STATUS Status; VOID *FspsUpd; SI_POLICY_PPI *SiPolicy; - VOID *FspmUpd; - SI_PREMEM_POLICY_PPI *SiPreMemPolicyPpi; - CPU_SECURITY_PREMEM_CONFIG *CpuSecurityPreMemConfig; DEBUG ((DEBUG_INFO, "Update PeiPchPolicyUpdate Pos-Mem Start\n")); FspsUpd = NULL; - FspmUpd = NULL; SiPolicy = NULL; - CpuSecurityPreMemConfig = NULL; - SiPreMemPolicyPpi = NULL; Status = PeiServicesLocatePpi (&gSiPolicyPpiGuid, 0, NULL, (VOID **) &SiPolicy); ASSERT_EFI_ERROR (Status); diff --git a/Platform/Intel/AlderlakeOpenBoardPkg/Policy/Library/PeiPolicyUpdateLib/PeiSaPolicyUpdate.c b/Platform/Intel/AlderlakeOpenBoardPkg/Policy/Library/PeiPolicyUpdateLib/PeiSaPolicyUpdate.c index c62b0a14efb..b5b99712de4 100644 --- a/Platform/Intel/AlderlakeOpenBoardPkg/Policy/Library/PeiPolicyUpdateLib/PeiSaPolicyUpdate.c +++ b/Platform/Intel/AlderlakeOpenBoardPkg/Policy/Library/PeiPolicyUpdateLib/PeiSaPolicyUpdate.c @@ -102,7 +102,6 @@ UpdatePeiSaPolicy ( VOID *VmdVariablePtr; GRAPHICS_PEI_CONFIG *GtConfig; SI_POLICY_PPI *SiPolicyPpi; - CPU_PCIE_CONFIG *CpuPcieRpConfig; VMD_PEI_CONFIG *VmdPeiConfig; EFI_PEI_PPI_DESCRIPTOR *ReadyForGopConfigPpiDesc; VOID *VbtPtr; @@ -119,7 +118,6 @@ UpdatePeiSaPolicy ( GtConfig = NULL; SiPolicyPpi = NULL; - CpuPcieRpConfig = NULL; VmdVariablePtr = NULL; Buffer = NULL; diff --git a/Platform/Intel/AlderlakeOpenBoardPkg/Policy/Library/PeiPolicyUpdateLib/PeiSaPolicyUpdatePreMem.c b/Platform/Intel/AlderlakeOpenBoardPkg/Policy/Library/PeiPolicyUpdateLib/PeiSaPolicyUpdatePreMem.c index a4ceda76c39..60ffbfc7f31 100644 --- a/Platform/Intel/AlderlakeOpenBoardPkg/Policy/Library/PeiPolicyUpdateLib/PeiSaPolicyUpdatePreMem.c +++ b/Platform/Intel/AlderlakeOpenBoardPkg/Policy/Library/PeiPolicyUpdateLib/PeiSaPolicyUpdatePreMem.c @@ -69,7 +69,6 @@ UpdatePeiSaPolicyPreMem ( UINT64 PlatformMemorySize; VOID *MemorySavedData; VOID *NullSpdPtr; - UINT32 RpEnabledMask; SI_PREMEM_POLICY_PPI *SiPreMemPolicyPpi; MEMORY_CONFIGURATION *MemConfig; SA_MISC_PEI_PREMEM_CONFIG *MiscPeiPreMemConfig; @@ -77,9 +76,7 @@ UpdatePeiSaPolicyPreMem ( EFI_PEI_PPI_DESCRIPTOR *FspmArchConfigPpiDesc; FSPM_ARCH_CONFIG_PPI *FspmArchConfigPpi; HOST_BRIDGE_PREMEM_CONFIG *HostBridgePreMemConfig; - UINT16 AdjustedMmioSize; UINT8 SaDisplayConfigTable[16]; - EFI_BOOT_MODE SysBootMode; UINT32 ProcessorTraceTotalMemSize; CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS_EBX Ebx; UINT32 CapsuleSupportMemSize; @@ -87,10 +84,8 @@ UpdatePeiSaPolicyPreMem ( DEBUG ((DEBUG_INFO, "Update PeiSaPolicyUpdate Pre-Mem Start\n")); ZeroMem ((VOID*) SaDisplayConfigTable, sizeof (SaDisplayConfigTable)); WdtTimeout = 0; - SysBootMode = 0; RcompData = NULL; PlatformMemorySize = 0; - RpEnabledMask = 0; SiPreMemPolicyPpi = NULL; MemConfig = NULL; MemConfigNoCrc = NULL; @@ -103,8 +98,6 @@ UpdatePeiSaPolicyPreMem ( ProcessorTraceTotalMemSize = 0; CapsuleSupportMemSize = 0; - AdjustedMmioSize = PcdGet16 (PcdSaMiscMmioSizeAdjustment); - Status = PeiServicesLocatePpi (&gSiPreMemPolicyPpiGuid, 0, NULL, (VOID **) &SiPreMemPolicyPpi); ASSERT_EFI_ERROR (Status); From 3e736bfdfacb610abc102b8dc5708aa629155d91 Mon Sep 17 00:00:00 2001 From: Nate DeSimone Date: Tue, 24 Sep 2024 14:29:20 -0700 Subject: [PATCH 3/8] AlderlakeOpenBoardPkg: Correct case sensitivity Signed-off-by: Nate DeSimone --- Platform/Intel/AlderlakeOpenBoardPkg/OpenBoardPkg.dec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Platform/Intel/AlderlakeOpenBoardPkg/OpenBoardPkg.dec b/Platform/Intel/AlderlakeOpenBoardPkg/OpenBoardPkg.dec index 0f0ed386f6a..e10e10f9665 100644 --- a/Platform/Intel/AlderlakeOpenBoardPkg/OpenBoardPkg.dec +++ b/Platform/Intel/AlderlakeOpenBoardPkg/OpenBoardPkg.dec @@ -297,7 +297,7 @@ gBoardModuleTokenSpaceGuid.PcdDisableVpdGpioTable|FALSE|BOOLEAN|0x50000015 MdePkg/MdePkg.dec AlderlakeSiliconPkg/SiPkg.dec - AlderLakeOpenBoardPkg/OpenBoardPkg.dec + AlderlakeOpenBoardPkg/OpenBoardPkg.dec } [PcdsDynamic, PcdsDynamicEx] From 0b8f0e3252245e42e327e67886882932e288685a Mon Sep 17 00:00:00 2001 From: Nate DeSimone Date: Tue, 24 Sep 2024 14:30:11 -0700 Subject: [PATCH 4/8] AlderlakeOpenBoardPkg: Fix FSP-T UPD initializer Initializer did not match the structure definition Signed-off-by: Nate DeSimone --- .../Library/SecFspWrapperPlatformSecLib/SecRamInitData.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Platform/Intel/AlderlakeOpenBoardPkg/FspWrapper/Library/SecFspWrapperPlatformSecLib/SecRamInitData.c b/Platform/Intel/AlderlakeOpenBoardPkg/FspWrapper/Library/SecFspWrapperPlatformSecLib/SecRamInitData.c index a3cc8741eeb..292780851de 100644 --- a/Platform/Intel/AlderlakeOpenBoardPkg/FspWrapper/Library/SecFspWrapperPlatformSecLib/SecRamInitData.c +++ b/Platform/Intel/AlderlakeOpenBoardPkg/FspWrapper/Library/SecFspWrapperPlatformSecLib/SecRamInitData.c @@ -46,10 +46,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED CONST FSPT_UPD FsptUpdDataPtr = { FixedPcdGet8 (PcdSerialIoUartMode), 0, FixedPcdGet32 (PcdSerialIoUartBaudRate), - FixedPcdGet64 (PcdPciExpressBaseAddress), - { - 0x00 - } + FixedPcdGet64 (PcdPciExpressBaseAddress) }, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, From 1a7caaa51633c774b46fc00727823868b4f2b72e Mon Sep 17 00:00:00 2001 From: Nate DeSimone Date: Tue, 24 Sep 2024 14:31:19 -0700 Subject: [PATCH 5/8] AlderlakeOpenBoardPkg: Fix void pointer cast Signed-off-by: Nate DeSimone --- .../Policy/Library/DxeSiliconPolicyUpdateLib/DxeSaPolicyInit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Platform/Intel/AlderlakeOpenBoardPkg/Policy/Library/DxeSiliconPolicyUpdateLib/DxeSaPolicyInit.c b/Platform/Intel/AlderlakeOpenBoardPkg/Policy/Library/DxeSiliconPolicyUpdateLib/DxeSaPolicyInit.c index fac1fb7a527..3edabac4290 100644 --- a/Platform/Intel/AlderlakeOpenBoardPkg/Policy/Library/DxeSiliconPolicyUpdateLib/DxeSaPolicyInit.c +++ b/Platform/Intel/AlderlakeOpenBoardPkg/Policy/Library/DxeSiliconPolicyUpdateLib/DxeSaPolicyInit.c @@ -74,7 +74,7 @@ SaPolicyInitDxe ( // Call CreateSaDxeConfigBlocks to create & initialize platform policy structure // and get all Intel default policy settings. // - Status = CreateSaDxeConfigBlocks (&SaPolicy); + Status = CreateSaDxeConfigBlocks ((VOID **) &SaPolicy); DEBUG ((DEBUG_INFO, "SaPolicy->TableHeader.NumberOfBlocks = 0x%x\n ", SaPolicy->TableHeader.NumberOfBlocks)); ASSERT_EFI_ERROR (Status); From f9ea479804038e5b8cd73cee6cce25c01d3e6076 Mon Sep 17 00:00:00 2001 From: Nate DeSimone Date: Tue, 24 Sep 2024 14:35:44 -0700 Subject: [PATCH 6/8] AlderlakeSiliconPkg: Remove unused functions Signed-off-by: Nate DeSimone --- .../PeiDxeSmmGpioLib/PeiDxeSmmGpioLib.inf | 3 + .../Spi/IncludePrivate/Library/SpiCommonLib.h | 11 ---- .../IpBlock/Spi/Library/PeiSpiLib/PchSpi.c | 14 ---- .../BaseSpiCommonLib/SpiCommon.c | 65 ------------------- .../AlderlakeSiliconPkg/IpBlock/Spi/Smm/Spi.c | 50 -------------- 5 files changed, 3 insertions(+), 140 deletions(-) diff --git a/Silicon/Intel/AlderlakeSiliconPkg/IpBlock/Gpio/Library/PeiDxeSmmGpioLib/PeiDxeSmmGpioLib.inf b/Silicon/Intel/AlderlakeSiliconPkg/IpBlock/Gpio/Library/PeiDxeSmmGpioLib/PeiDxeSmmGpioLib.inf index 21fb4417c13..3e68171e452 100644 --- a/Silicon/Intel/AlderlakeSiliconPkg/IpBlock/Gpio/Library/PeiDxeSmmGpioLib/PeiDxeSmmGpioLib.inf +++ b/Silicon/Intel/AlderlakeSiliconPkg/IpBlock/Gpio/Library/PeiDxeSmmGpioLib/PeiDxeSmmGpioLib.inf @@ -42,3 +42,6 @@ GpioLib.c GpioNativeLib.c GpioInit.c GpioLibrary.h + +[BuildOptions] + GCC:*_*_*_CC_FLAGS = -Wno-unused-function diff --git a/Silicon/Intel/AlderlakeSiliconPkg/IpBlock/Spi/IncludePrivate/Library/SpiCommonLib.h b/Silicon/Intel/AlderlakeSiliconPkg/IpBlock/Spi/IncludePrivate/Library/SpiCommonLib.h index dc663198144..e3d39a75901 100644 --- a/Silicon/Intel/AlderlakeSiliconPkg/IpBlock/Spi/IncludePrivate/Library/SpiCommonLib.h +++ b/Silicon/Intel/AlderlakeSiliconPkg/IpBlock/Spi/IncludePrivate/Library/SpiCommonLib.h @@ -143,17 +143,6 @@ IsSpiFlashWriteGranted ( VOID ); -/** - Check if a save and restore of the SPI controller state is necessary - - @retval TRUE It's necessary to save and restore SPI controller state - @retval FALSE It's not necessary to save and restore SPI controller state -**/ -BOOLEAN -IsSpiControllerSaveRestoreEnabled ( - VOID - ); - /** Read data from the flash part. diff --git a/Silicon/Intel/AlderlakeSiliconPkg/IpBlock/Spi/Library/PeiSpiLib/PchSpi.c b/Silicon/Intel/AlderlakeSiliconPkg/IpBlock/Spi/Library/PeiSpiLib/PchSpi.c index 68031b4a9db..8704950d387 100644 --- a/Silicon/Intel/AlderlakeSiliconPkg/IpBlock/Spi/Library/PeiSpiLib/PchSpi.c +++ b/Silicon/Intel/AlderlakeSiliconPkg/IpBlock/Spi/Library/PeiSpiLib/PchSpi.c @@ -193,17 +193,3 @@ IsSpiFlashWriteGranted ( { return TRUE; } - -/** - Check if a save and restore of the SPI controller state is necessary - - @retval TRUE It's necessary to save and restore SPI controller state - @retval FALSE It's not necessary to save and restore SPI controller state -**/ -BOOLEAN -IsSpiControllerSaveRestoreEnabled ( - VOID - ) -{ - return FALSE; -} diff --git a/Silicon/Intel/AlderlakeSiliconPkg/IpBlock/Spi/LibraryPrivate/BaseSpiCommonLib/SpiCommon.c b/Silicon/Intel/AlderlakeSiliconPkg/IpBlock/Spi/LibraryPrivate/BaseSpiCommonLib/SpiCommon.c index cd7523c3d5d..d04a5d501ce 100644 --- a/Silicon/Intel/AlderlakeSiliconPkg/IpBlock/Spi/LibraryPrivate/BaseSpiCommonLib/SpiCommon.c +++ b/Silicon/Intel/AlderlakeSiliconPkg/IpBlock/Spi/LibraryPrivate/BaseSpiCommonLib/SpiCommon.c @@ -433,45 +433,6 @@ WaitForSpiCycleComplete ( return FALSE; } -/** - This function waits for a pending SPI transaction to complete without clearing - status fields - - @param[in] This Pointer to the PCH_SPI2_PROTOCOL instance. - @param[in] PchSpiBar0 SPI MMIO address - - @retval TRUE SPI cycle completed on the interface. - @retval FALSE Time out while waiting the SPI cycle to complete. - It's not safe to program the next command on the SPI interface. -**/ -BOOLEAN -STATIC -WaitForScipNoClear ( - IN PCH_SPI2_PROTOCOL *This, - IN UINTN PchSpiBar0 - ) -{ - UINT64 WaitTicks; - UINT64 WaitCount; - SPI_INSTANCE *SpiInstance; - UINT32 Data32; - - SpiInstance = SPI_INSTANCE_FROM_SPIPROTOCOL (This); - - // - // Wait for the SPI cycle to complete. - // - WaitCount = SPI_WAIT_TIME / SPI_WAIT_PERIOD; - for (WaitTicks = 0; WaitTicks < WaitCount; WaitTicks++) { - Data32 = MmioRead32 (PchSpiBar0 + R_SPI_MEM_HSFSC); - if ((Data32 & B_SPI_MEM_HSFSC_SCIP) == 0) { - return TRUE; - } - PchPmTimerStallRuntimeSafe (SpiInstance->PchAcpiBase, SPI_WAIT_PERIOD); - } - return FALSE; -} - /** This function sends the programmed SPI command to the device. @@ -498,7 +459,6 @@ SendSpiCmd ( IN OUT UINT8 *Buffer ) { - UINT32 FdataSave[16]; EFI_STATUS Status; UINT32 Index; SPI_INSTANCE *SpiInstance; @@ -512,11 +472,6 @@ SendSpiCmd ( UINT32 SmiEnSave; UINT16 ABase; UINT32 HsfstsCtl; - UINT32 FaddrSave; - UINT32 HsfscSave; - BOOLEAN HsfscFdoneSave; - BOOLEAN HsfscFcerrSave; - BOOLEAN RestoreState; // // For flash write, there is a requirement that all CPU threads are in SMM @@ -532,7 +487,6 @@ SendSpiCmd ( SpiInstance = SPI_INSTANCE_FROM_SPIPROTOCOL (This); SpiBaseAddress = SpiInstance->PchSpiBase; ABase = SpiInstance->PchAcpiBase; - RestoreState = FALSE; // // Disable SMIs to make sure normal mode flash access is not interrupted by an SMI @@ -570,25 +524,6 @@ SendSpiCmd ( ); } - // - // Save current SPI controller state - // - if (IsSpiControllerSaveRestoreEnabled ()) { - if (!WaitForScipNoClear (This, PchSpiBar0)) { - Status = EFI_DEVICE_ERROR; - goto SendSpiCmdEnd; - } - HsfscSave = MmioRead32 (PchSpiBar0 + R_SPI_MEM_HSFSC); - HsfscFdoneSave = ((HsfscSave & B_SPI_MEM_HSFSC_FDONE) != 0) ? TRUE : FALSE; - HsfscFcerrSave = ((HsfscSave & B_SPI_MEM_HSFSC_FCERR) != 0) ? TRUE : FALSE; - HsfscSave &= B_SPI_MEM_HSFSC_SAVE_MASK; - FaddrSave = MmioRead32 (PchSpiBar0 + R_SPI_MEM_FADDR); - for (Index = 0; Index < 64; Index += sizeof (UINT32)) { - FdataSave[Index >> 2] = MmioRead32 (PchSpiBar0 + R_SPI_MEM_FDATA00 + Index); - } - RestoreState = TRUE; - } - // // Make sure it's safe to program the command. // diff --git a/Silicon/Intel/AlderlakeSiliconPkg/IpBlock/Spi/Smm/Spi.c b/Silicon/Intel/AlderlakeSiliconPkg/IpBlock/Spi/Smm/Spi.c index 68190b2b0c6..188b045b55a 100644 --- a/Silicon/Intel/AlderlakeSiliconPkg/IpBlock/Spi/Smm/Spi.c +++ b/Silicon/Intel/AlderlakeSiliconPkg/IpBlock/Spi/Smm/Spi.c @@ -50,28 +50,6 @@ GLOBAL_REMOVE_IF_UNREFERENCED UINT32 mPchSpiBar0RefCount; // state after finishing commands to the SPI controller. // GLOBAL_REMOVE_IF_UNREFERENCED UINT8 mPchSpiSavedPciCmdReg; -GLOBAL_REMOVE_IF_UNREFERENCED BOOLEAN mBootServiceExited; - -/** - This function is invoked at ExitBootServices() - - @param[in] Protocol Protocol unique ID. - @param[in] Interface Interface instance. - @param[in] Handle The handle on which the interface is installed.. - - @retval Status. -**/ -EFI_STATUS -EFIAPI -SpiExitBootServicesCallback ( - IN CONST EFI_GUID *Protocol, - IN VOID *Interface, - IN EFI_HANDLE Handle - ) -{ - mBootServiceExited = TRUE; - return EFI_SUCCESS; -} /** SPI Runtime SMM Module Entry Point\n @@ -115,7 +93,6 @@ InstallPchSpi ( ) { EFI_STATUS Status; - VOID *Registration; // // Init PCH spi reserved MMIO address. @@ -124,7 +101,6 @@ InstallPchSpi ( mSpiSavedMmioAddr = 0; mPchSpiBar0RefCount = 0; mPchSpiSavedPciCmdReg = 0; - mBootServiceExited = FALSE; /// /// Allocate pool for SPI protocol instance @@ -151,18 +127,6 @@ InstallPchSpi ( return Status; } - // - // Register ExitBootServices callback - // - Status = gSmst->SmmRegisterProtocolNotify ( - &gEdkiiSmmExitBootServicesProtocolGuid, - SpiExitBootServicesCallback, - &Registration - ); - if (EFI_ERROR (Status)) { - return Status; - } - // // Install the SMM PCH_SPI2_PROTOCOL interface // @@ -391,17 +355,3 @@ IsSpiFlashWriteGranted ( return TRUE; } - -/** - Check if a save and restore of the SPI controller state is necessary - - @retval TRUE It's necessary to save and restore SPI controller state - @retval FALSE It's not necessary to save and restore SPI controller state -**/ -BOOLEAN -IsSpiControllerSaveRestoreEnabled ( - VOID - ) -{ - return mBootServiceExited; -} From 7062f7b834c1724a4ba2d3bc968059e6779b65f9 Mon Sep 17 00:00:00 2001 From: Nate DeSimone Date: Tue, 24 Sep 2024 14:36:09 -0700 Subject: [PATCH 7/8] AlderlakeSiliconPkg: Remove unused variables Signed-off-by: Nate DeSimone --- .../BaseCpuInfoFruLib/BaseCpuInfoFruLib.c | 2 -- .../Pch/PchSmiDispatcher/Smm/PchSmmCore.c | 12 ------------ .../Pch/PchSmiDispatcher/Smm/PchSmmGpi.c | 2 -- 3 files changed, 16 deletions(-) diff --git a/Silicon/Intel/AlderlakeSiliconPkg/Fru/AdlCpu/LibraryPrivate/BaseCpuInfoFruLib/BaseCpuInfoFruLib.c b/Silicon/Intel/AlderlakeSiliconPkg/Fru/AdlCpu/LibraryPrivate/BaseCpuInfoFruLib/BaseCpuInfoFruLib.c index d93048eb6e3..70fbe23473d 100644 --- a/Silicon/Intel/AlderlakeSiliconPkg/Fru/AdlCpu/LibraryPrivate/BaseCpuInfoFruLib/BaseCpuInfoFruLib.c +++ b/Silicon/Intel/AlderlakeSiliconPkg/Fru/AdlCpu/LibraryPrivate/BaseCpuInfoFruLib/BaseCpuInfoFruLib.c @@ -19,8 +19,6 @@ #include #include - -STATIC CONST CHAR8 mAdlCpuFamilyString[] = "AlderLake"; typedef struct { UINT32 CPUID; UINT8 CpuSku; diff --git a/Silicon/Intel/AlderlakeSiliconPkg/Pch/PchSmiDispatcher/Smm/PchSmmCore.c b/Silicon/Intel/AlderlakeSiliconPkg/Pch/PchSmiDispatcher/Smm/PchSmmCore.c index cb889b5ce36..c56146a014d 100644 --- a/Silicon/Intel/AlderlakeSiliconPkg/Pch/PchSmiDispatcher/Smm/PchSmmCore.c +++ b/Silicon/Intel/AlderlakeSiliconPkg/Pch/PchSmiDispatcher/Smm/PchSmmCore.c @@ -690,7 +690,6 @@ PchSmmCoreDispatcher ( BOOLEAN ContextsMatch; BOOLEAN EosSet; - BOOLEAN SxChildWasDispatched; DATABASE_RECORD *RecordInDb; LIST_ENTRY *LinkInDb; @@ -718,7 +717,6 @@ PchSmmCoreDispatcher ( EscapeCount = 3; ContextsMatch = FALSE; EosSet = FALSE; - SxChildWasDispatched = FALSE; Status = EFI_SUCCESS; // @@ -769,13 +767,6 @@ PchSmmCoreDispatcher ( EosSet = PchSmmSetAndCheckEos (); } } else { - // - // We found a source. If this is a sleep type, we have to go to - // appropriate sleep state anyway.No matter there is sleep child or not - // - if (RecordInDb->ProtocolType == SxType) { - SxChildWasDispatched = TRUE; - } // // "cache" the source description and don't query I/O anymore // @@ -855,9 +846,6 @@ PchSmmCoreDispatcher ( PERF_START_EX (NULL, "SmmFunction", NULL, AsmReadTsc (), RecordToExhaust->ProtocolType); RecordToExhaust->Callback ((EFI_HANDLE) & RecordToExhaust->Link, &Context, CommBuffer, &CommBufferSize); PERF_END_EX (NULL, "SmmFunction", NULL, AsmReadTsc (), RecordToExhaust->ProtocolType); - if (RecordToExhaust->ProtocolType == SxType) { - SxChildWasDispatched = TRUE; - } } else { ASSERT (FALSE); } diff --git a/Silicon/Intel/AlderlakeSiliconPkg/Pch/PchSmiDispatcher/Smm/PchSmmGpi.c b/Silicon/Intel/AlderlakeSiliconPkg/Pch/PchSmiDispatcher/Smm/PchSmmGpi.c index 4c59c07bacb..4bfe0aae700 100644 --- a/Silicon/Intel/AlderlakeSiliconPkg/Pch/PchSmiDispatcher/Smm/PchSmmGpi.c +++ b/Silicon/Intel/AlderlakeSiliconPkg/Pch/PchSmiDispatcher/Smm/PchSmmGpi.c @@ -171,7 +171,6 @@ PchGpiSmiUnRegister ( UINT32 GpiHostSwOwnRegAddress; UINT32 GpiSmiStsRegAddress; UINT32 Data32Or; - UINT32 Data32And; BOOLEAN DisableGpiSmiSource; @@ -232,7 +231,6 @@ PchGpiSmiUnRegister ( ); Data32Or = 1u << GpiSmiBitOffset; - Data32And = 0xFFFFFFFF; MmioOr32 (GpiHostSwOwnRegAddress, Data32Or); } From 2e0cbf1ec5ac0ecce6790ba4dd540db7dbb8a27b Mon Sep 17 00:00:00 2001 From: Nate DeSimone Date: Tue, 24 Sep 2024 14:46:20 -0700 Subject: [PATCH 8/8] AlderlakeSiliconPkg: Remove unused protocol Signed-off-by: Nate DeSimone --- Silicon/Intel/AlderlakeSiliconPkg/IpBlock/Spi/Smm/SpiSmm.inf | 1 - 1 file changed, 1 deletion(-) diff --git a/Silicon/Intel/AlderlakeSiliconPkg/IpBlock/Spi/Smm/SpiSmm.inf b/Silicon/Intel/AlderlakeSiliconPkg/IpBlock/Spi/Smm/SpiSmm.inf index 445f4af8323..08292eac97a 100644 --- a/Silicon/Intel/AlderlakeSiliconPkg/IpBlock/Spi/Smm/SpiSmm.inf +++ b/Silicon/Intel/AlderlakeSiliconPkg/IpBlock/Spi/Smm/SpiSmm.inf @@ -39,7 +39,6 @@ Spi.c [Protocols] gPchSmmSpi2ProtocolGuid ## PRODUCES gEfiSmmCpuProtocolGuid ## CONSUMES -gEdkiiSmmExitBootServicesProtocolGuid ## CONSUMES [Depex]