diff options
author | Ken Lautner <klautner@microsoft.com> | 2021-06-22 03:59:54 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2021-06-22 08:21:09 +0000 |
commit | d9a7612f8d1da197883bd1cb9f91f229522d39b1 (patch) | |
tree | 44b8d2d525fe3c4162286ace975ea8ef7f03462c | |
parent | 6cfeeb71c43173d657d86d4a38ed655b0fc5f277 (diff) | |
download | edk2-d9a7612f8d1da197883bd1cb9f91f229522d39b1.zip edk2-d9a7612f8d1da197883bd1cb9f91f229522d39b1.tar.gz edk2-d9a7612f8d1da197883bd1cb9f91f229522d39b1.tar.bz2 |
MdeModulePkg/BdsDxe: Update BdsEntry to use Variable Policy
Changed BdsEntry.c to use Variable Policy instead of Variable Lock
as Variable Lock will be Deprecated eventually
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Kenneth Lautner <kenlautner3@gmail.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
-rw-r--r-- | MdeModulePkg/Universal/BdsDxe/Bds.h | 1 | ||||
-rw-r--r-- | MdeModulePkg/Universal/BdsDxe/BdsDxe.inf | 3 | ||||
-rw-r--r-- | MdeModulePkg/Universal/BdsDxe/BdsEntry.c | 20 |
3 files changed, 17 insertions, 7 deletions
diff --git a/MdeModulePkg/Universal/BdsDxe/Bds.h b/MdeModulePkg/Universal/BdsDxe/Bds.h index e7a9b5b..8454804 100644 --- a/MdeModulePkg/Universal/BdsDxe/Bds.h +++ b/MdeModulePkg/Universal/BdsDxe/Bds.h @@ -17,7 +17,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include <Protocol/Bds.h>
#include <Protocol/LoadedImage.h>
-#include <Protocol/VariableLock.h>
#include <Protocol/DeferredImageLoad.h>
#include <Library/UefiDriverEntryPoint.h>
diff --git a/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf b/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf index 9310b4d..5bac635 100644 --- a/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf +++ b/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf @@ -50,6 +50,7 @@ BaseMemoryLib
DebugLib
UefiBootManagerLib
+ VariablePolicyHelperLib
PlatformBootManagerLib
PcdLib
PrintLib
@@ -77,7 +78,7 @@ [Protocols]
gEfiBdsArchProtocolGuid ## PRODUCES
gEfiSimpleTextInputExProtocolGuid ## CONSUMES
- gEdkiiVariableLockProtocolGuid ## SOMETIMES_CONSUMES
+ gEdkiiVariablePolicyProtocolGuid ## SOMETIMES_CONSUMES
gEfiDeferredImageLoadProtocolGuid ## CONSUMES
[FeaturePcd]
diff --git a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c index 83b773a..13c10bd 100644 --- a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c +++ b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c @@ -15,6 +15,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include "Bds.h"
#include "Language.h"
#include "HwErrRecSupport.h"
+#include <Library/VariablePolicyHelperLib.h>
#define SET_BOOT_OPTION_SUPPORT_KEY_COUNT(a, c) { \
(a) = ((a) & ~EFI_BOOT_OPTION_SUPPORT_COUNT) | (((c) << LowBitSet32 (EFI_BOOT_OPTION_SUPPORT_COUNT)) & EFI_BOOT_OPTION_SUPPORT_COUNT); \
@@ -670,7 +671,7 @@ BdsEntry ( EFI_STATUS Status;
UINT32 BootOptionSupport;
UINT16 BootTimeOut;
- EDKII_VARIABLE_LOCK_PROTOCOL *VariableLock;
+ EDKII_VARIABLE_POLICY_PROTOCOL *VariablePolicy;
UINTN Index;
EFI_BOOT_MANAGER_LOAD_OPTION LoadOption;
UINT16 *BootNext;
@@ -716,12 +717,21 @@ BdsEntry ( //
// Mark the read-only variables if the Variable Lock protocol exists
//
- Status = gBS->LocateProtocol (&gEdkiiVariableLockProtocolGuid, NULL, (VOID **) &VariableLock);
- DEBUG ((EFI_D_INFO, "[BdsDxe] Locate Variable Lock protocol - %r\n", Status));
+ Status = gBS->LocateProtocol(&gEdkiiVariablePolicyProtocolGuid, NULL, (VOID**)&VariablePolicy);
+ DEBUG((DEBUG_INFO, "[BdsDxe] Locate Variable Policy protocol - %r\n", Status));
if (!EFI_ERROR (Status)) {
for (Index = 0; Index < ARRAY_SIZE (mReadOnlyVariables); Index++) {
- Status = VariableLock->RequestToLock (VariableLock, mReadOnlyVariables[Index], &gEfiGlobalVariableGuid);
- ASSERT_EFI_ERROR (Status);
+ Status = RegisterBasicVariablePolicy(
+ VariablePolicy,
+ &gEfiGlobalVariableGuid,
+ mReadOnlyVariables[Index],
+ VARIABLE_POLICY_NO_MIN_SIZE,
+ VARIABLE_POLICY_NO_MAX_SIZE,
+ VARIABLE_POLICY_NO_MUST_ATTR,
+ VARIABLE_POLICY_NO_CANT_ATTR,
+ VARIABLE_POLICY_TYPE_LOCK_NOW
+ );
+ ASSERT_EFI_ERROR(Status);
}
}
|