summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDun Tan <dun.tan@intel.com>2024-06-13 17:28:10 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-06-17 13:42:43 +0000
commit92974e3d189156f46c8f78390eec33d3e0e0c26e (patch)
tree5ce594cc4cab1e00db745db22fcce87d7c67de2c
parent689f415a494b859453c5ebec7aa8c94d310a0b25 (diff)
downloadedk2-92974e3d189156f46c8f78390eec33d3e0e0c26e.zip
edk2-92974e3d189156f46c8f78390eec33d3e0e0c26e.tar.gz
edk2-92974e3d189156f46c8f78390eec33d3e0e0c26e.tar.bz2
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>
-rw-r--r--MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c13
-rw-r--r--MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf1
2 files changed, 7 insertions, 7 deletions
diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c
index aedcae6..9bbf484 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 2d16f28..d984a36 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]