From 07d9dc83f469161153de8bfbdd1eb5504dd6f653 Mon Sep 17 00:00:00 2001 From: rsun3 Date: Wed, 3 Nov 2010 01:14:51 +0000 Subject: Remove PI SMM IPL's dependency on CPU AP so that PI SMM IPL can be dispatched before the CPU AP is installed. If PI SMM IPL will be dispatched before the CPU AP is installed for a platform, the platform developer is expected to set cache-ability of SMRAM to WB earlier to improve performance of SMM initialization. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10998 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c | 27 +++++++++++++++++---------- MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf | 4 ++-- 2 files changed, 19 insertions(+), 12 deletions(-) (limited to 'MdeModulePkg/Core') diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c b/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c index 61ed062d27..5cdb5bdeab 100644 --- a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c +++ b/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -963,8 +964,9 @@ SmmIplEntry ( EFI_SMM_RESERVED_SMRAM_REGION *SmramResRegion; UINT64 MaxSize; VOID *Registration; - UINT64 SmmCodeSize; + UINT64 SmmCodeSize; EFI_LOAD_FIXED_ADDRESS_CONFIGURATION_TABLE *LMFAConfigurationTable; + EFI_CPU_ARCH_PROTOCOL *CpuArch; // // Fill in the image handle of the SMM IPL so the SMM Core can use this as the @@ -1063,16 +1065,21 @@ SmmIplEntry ( GetSmramCacheRange (mCurrentSmramRange, &mSmramCacheBase, &mSmramCacheSize); // - // Attempt to set SMRAM cacheability to WB + // If CPU AP is present, attempt to set SMRAM cacheability to WB + // Note that it is expected that cacheability of SMRAM has been set to WB if CPU AP + // is not available here. // - Status = gDS->SetMemorySpaceAttributes( - mSmramCacheBase, - mSmramCacheSize, - EFI_MEMORY_WB - ); - if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_WARN, "SMM IPL failed to set SMRAM window to EFI_MEMORY_WB\n")); - } + Status = gBS->LocateProtocol (&gEfiCpuArchProtocolGuid, NULL, (VOID **)&CpuArch); + if (!EFI_ERROR (Status)) { + Status = gDS->SetMemorySpaceAttributes( + mSmramCacheBase, + mSmramCacheSize, + EFI_MEMORY_WB + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_WARN, "SMM IPL failed to set SMRAM window to EFI_MEMORY_WB\n")); + } + } // // if Loading module at Fixed Address feature is enabled, save the SMRAM base to Load // Modules At Fixed Address Configuration Table. diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf b/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf index 8cbaf8d5d3..73507cd239 100644 --- a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf +++ b/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf @@ -56,7 +56,7 @@ gEfiSmmConfigurationProtocolGuid # PROTOCOL ALWAYS_CONSUMED gEfiSmmControl2ProtocolGuid # PROTOCOL ALWAYS_CONSUMED gEfiDxeSmmReadyToLockProtocolGuid # PROTOCOL ALWAYS_CONSUMED - gEfiCpuArchProtocolGuid # PROTOCOL ALWAYS_CONSUMED + gEfiCpuArchProtocolGuid # PROTOCOL SIMETIMES_CONSUMED [Guids] gEfiEventDxeDispatchGuid # ALWAYS_CONSUMED @@ -71,4 +71,4 @@ [Depex] - gEfiSmmAccess2ProtocolGuid AND gEfiSmmControl2ProtocolGuid AND gEfiCpuArchProtocolGuid + gEfiSmmAccess2ProtocolGuid AND gEfiSmmControl2ProtocolGuid -- cgit v1.2.3