From 92974e3d189156f46c8f78390eec33d3e0e0c26e Mon Sep 17 00:00:00 2001 From: Dun Tan Date: Thu, 13 Jun 2024 17:28:10 +0800 Subject: MdeModulePkg:Remove the usage of PcdEnableVariableRuntimeCache Remove the usage of PcdEnableVariableRuntimeCache. We can use the existence of gEdkiiVariableRuntimeCacheInfoHobGuid to indicate if variable runtime cache is enabled or not. Signed-off-by: Dun Tan --- .../Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c | 13 +++++++------ .../Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf | 1 - 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'MdeModulePkg') diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c index aedcae6383..9bbf484645 100644 --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c @@ -63,6 +63,7 @@ BOOLEAN *mHobFlushComplete; EFI_LOCK mVariableServicesLock; EDKII_VARIABLE_LOCK_PROTOCOL mVariableLock; EDKII_VAR_CHECK_PROTOCOL mVarCheck; +BOOLEAN mIsRuntimeCacheEnabled = FALSE; /** The logic to initialize the VariablePolicy engine is in its own file. @@ -840,7 +841,7 @@ RuntimeServiceGetVariable ( } AcquireLockOnlyAtBootTime (&mVariableServicesLock); - if (FeaturePcdGet (PcdEnableVariableRuntimeCache)) { + if (mIsRuntimeCacheEnabled) { Status = FindVariableInRuntimeCache (VariableName, VendorGuid, Attributes, DataSize, Data); } else { Status = FindVariableInSmm (VariableName, VendorGuid, Attributes, DataSize, Data); @@ -1106,7 +1107,7 @@ RuntimeServiceGetNextVariableName ( } AcquireLockOnlyAtBootTime (&mVariableServicesLock); - if (FeaturePcdGet (PcdEnableVariableRuntimeCache)) { + if (mIsRuntimeCacheEnabled) { Status = GetNextVariableNameInRuntimeCache (VariableNameSize, VariableName, VendorGuid); } else { Status = GetNextVariableNameInSmm (VariableNameSize, VariableName, VendorGuid); @@ -1358,7 +1359,7 @@ OnReadyToBoot ( // // Install the system configuration table for variable info data captured // - if (FeaturePcdGet (PcdEnableVariableRuntimeCache) && FeaturePcdGet (PcdVariableCollectStatistics)) { + if (mIsRuntimeCacheEnabled && FeaturePcdGet (PcdVariableCollectStatistics)) { if (mVariableAuthFormat) { gBS->InstallConfigurationTable (&gEfiAuthenticatedVariableGuid, mVariableInfo); } else { @@ -1670,7 +1671,9 @@ SmmVariableReady ( // mVariableBufferPhysical = mVariableBuffer; - if (FeaturePcdGet (PcdEnableVariableRuntimeCache)) { + GuidHob = GetFirstGuidHob (&gEdkiiVariableRuntimeCacheInfoHobGuid); + if (GuidHob != NULL) { + mIsRuntimeCacheEnabled = TRUE; DEBUG ((DEBUG_INFO, "Variable driver runtime cache is enabled.\n")); // // Get needed runtime cache buffer size and check if auth variables are to be used from SMM @@ -1682,8 +1685,6 @@ SmmVariableReady ( &mVariableAuthFormat ); if (!EFI_ERROR (Status)) { - GuidHob = GetFirstGuidHob (&gEdkiiVariableRuntimeCacheInfoHobGuid); - ASSERT (GuidHob != NULL); VariableRuntimeCacheInfo = GET_GUID_HOB_DATA (GuidHob); AllocatedHobCacheSize = EFI_PAGES_TO_SIZE ((UINTN)VariableRuntimeCacheInfo->RuntimeHobCachePages); AllocatedNvCacheSize = EFI_PAGES_TO_SIZE ((UINTN)VariableRuntimeCacheInfo->RuntimeNvCachePages); diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf index 2d16f28674..d984a3637d 100644 --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf @@ -75,7 +75,6 @@ gEdkiiVariablePolicyProtocolGuid ## PRODUCES [FeaturePcd] - gEfiMdeModulePkgTokenSpaceGuid.PcdEnableVariableRuntimeCache ## CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdVariableCollectStatistics ## CONSUMES [Pcd] -- cgit v1.2.3