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 <dun.tan@intel.com>
This commit is contained in:
Dun Tan 2024-06-13 17:28:10 +08:00 committed by mergify[bot]
parent 689f415a49
commit 92974e3d18
2 changed files with 7 additions and 7 deletions

View File

@ -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);

View File

@ -75,7 +75,6 @@
gEdkiiVariablePolicyProtocolGuid ## PRODUCES
[FeaturePcd]
gEfiMdeModulePkgTokenSpaceGuid.PcdEnableVariableRuntimeCache ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdVariableCollectStatistics ## CONSUMES
[Pcd]