From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f171.google.com (mail-pf1-f171.google.com [209.85.210.171]) by mx.groups.io with SMTP id smtpd.web08.1863.1623946005737834729 for ; Thu, 17 Jun 2021 09:06:45 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Vj4ziuot; spf=pass (domain: gmail.com, ip: 209.85.210.171, mailfrom: kenlautner3@gmail.com) Received: by mail-pf1-f171.google.com with SMTP id u18so17078pfk.11 for ; Thu, 17 Jun 2021 09:06:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=SaCa8871CBy3CyNYpiw9DoRgr4VhkVPDb4kPCfm6C5U=; b=Vj4ziuotAcU9qjqJrsKFkSjhoXfqLTFwfEvnJQO81zVvFtozd4yUX3REObz9r5q7bR 38b7mlcI9Bc1I6HetJvlWMg6/UzTz0Lujjdb6xnCV3TFQ1yuHRPH6PVm1dZLv7HVxZ95 IUZmJUMvEXM2EPanQAeMfBe9SIARxS96XduQIOt/CB/42N+/pgMlzalwVG3JbGRfzrMH 2dNP1zO8mPlGZ0gLYG195z6Wo5ROMD1J0OGyd/VrB+IguUJWBhIJbALjZcTMNydHT0Jp kkD9iNp/isIh9NGQ6uxFjYvZC1VWoVp3SapD7FltVNkj9tCiOP0AYi6Du+Xm0FwzeNgg 8RvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=SaCa8871CBy3CyNYpiw9DoRgr4VhkVPDb4kPCfm6C5U=; b=n3W5mNWK9HalLxW8osqKYj/HxgF4IoMzoxePrTx656UgEysaUWtp9BT6FNmZebQGDU LpOS0qWmSJKsdMYV3FZ5BGQp9qNzjVUG/T0KyWsi88cVOF+EJChZGFN2zgIGeHmlKrYy jz5BanMRp26e9UZoAKi3yc/1rAPlP1lSX1EOc2GmqfmHPXzwRZB6wrLHBNDkuelVBrvU taW2mX+rHNC51jgMdsmlcPmbKvpCT8a3d8sUrNs4/BHVIcQNMDDHARTmND9wpXRZguZH IZIcq8go6QkWLKyzjMoiQ0j64hAPfnwF6p2jhgxKhwltb42cvmMB1w2UGzpBrF3lGo1D 9vBQ== X-Gm-Message-State: AOAM532SPj3pYBk+VrP5M8fLupY1zA+s4s2kZfapftA4uCn2IvevW3WN 1yKYfx3Er/eMrK50b0/LbGjQI+ToU/g= X-Google-Smtp-Source: ABdhPJyyh2XV8MqQesUq3MJos4NpH14siNKqDk2yigdBcE/XQhFGUTI5qejoG/arziUnVRushFmweQ== X-Received: by 2002:aa7:8244:0:b029:2ec:968d:c1b4 with SMTP id e4-20020aa782440000b02902ec968dc1b4mr555502pfn.32.1623946004952; Thu, 17 Jun 2021 09:06:44 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([12.157.155.61]) by smtp.gmail.com with ESMTPSA id j4sm5425260pfj.111.2021.06.17.09.06.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Jun 2021 09:06:44 -0700 (PDT) From: "Kenneth Lautner" To: devel@edk2.groups.io Cc: Jian J Wang , Hao A Wu , Zhichao Gao , Ray Ni , Liming Gao Subject: [PATCH v1 1/1] MdeModulePkg/BdsDxe: Update BdsEntry to use Variable Policy Date: Thu, 17 Jun 2021 09:06:32 -0700 Message-Id: <20210617160632.1977-1-kenlautner3@gmail.com> X-Mailer: git-send-email 2.31.1.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Ken Lautner Changed BdsEntry.c to use Variable Policy instead of Variable Lock as Variable Lock will be Deprecated eventually Cc: Jian J Wang Cc: Hao A Wu Cc: Zhichao Gao Cc: Ray Ni Cc: Liming Gao Signed-off-by: Kenneth Lautner Reviewed-by: Liming Gao --- MdeModulePkg/Universal/BdsDxe/Bds.h | 1 - MdeModulePkg/Universal/BdsDxe/BdsDxe.inf | 4 +++- MdeModulePkg/Universal/BdsDxe/BdsEntry.c | 20 +++++++++++++++----- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/MdeModulePkg/Universal/BdsDxe/Bds.h b/MdeModulePkg/Universal/B= dsDxe/Bds.h index e7a9b5b4b7cb..84548041e861 100644 --- a/MdeModulePkg/Universal/BdsDxe/Bds.h +++ b/MdeModulePkg/Universal/BdsDxe/Bds.h @@ -17,7 +17,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent =0D #include =0D #include =0D -#include =0D #include =0D =0D #include =0D diff --git a/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf b/MdeModulePkg/Univer= sal/BdsDxe/BdsDxe.inf index 9310b4dccb18..76ff6a0f5fc3 100644 --- a/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf +++ b/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf @@ -50,6 +50,8 @@ BaseMemoryLib=0D DebugLib=0D UefiBootManagerLib=0D + VariablePolicyLib=0D + VariablePolicyHelperLib=0D PlatformBootManagerLib=0D PcdLib=0D PrintLib=0D @@ -77,7 +79,7 @@ [Protocols]=0D gEfiBdsArchProtocolGuid ## PRODUCES=0D gEfiSimpleTextInputExProtocolGuid ## CONSUMES=0D - gEdkiiVariableLockProtocolGuid ## SOMETIMES_CONSUMES=0D + gEdkiiVariablePolicyProtocolGuid ## SOMETIMES_CONSUMES=0D gEfiDeferredImageLoadProtocolGuid ## CONSUMES=0D =0D [FeaturePcd]=0D diff --git a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c b/MdeModulePkg/Univer= sal/BdsDxe/BdsEntry.c index 83b773a2fa5f..13c10bdc5bf8 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"=0D #include "Language.h"=0D #include "HwErrRecSupport.h"=0D +#include =0D =0D #define SET_BOOT_OPTION_SUPPORT_KEY_COUNT(a, c) { \=0D (a) =3D ((a) & ~EFI_BOOT_OPTION_SUPPORT_COUNT) | (((c) << LowBitSet3= 2 (EFI_BOOT_OPTION_SUPPORT_COUNT)) & EFI_BOOT_OPTION_SUPPORT_COUNT); \=0D @@ -670,7 +671,7 @@ BdsEntry ( EFI_STATUS Status;=0D UINT32 BootOptionSupport;=0D UINT16 BootTimeOut;=0D - EDKII_VARIABLE_LOCK_PROTOCOL *VariableLock;=0D + EDKII_VARIABLE_POLICY_PROTOCOL *VariablePolicy;=0D UINTN Index;=0D EFI_BOOT_MANAGER_LOAD_OPTION LoadOption;=0D UINT16 *BootNext;=0D @@ -716,12 +717,21 @@ BdsEntry ( //=0D // Mark the read-only variables if the Variable Lock protocol exists=0D //=0D - Status =3D gBS->LocateProtocol (&gEdkiiVariableLockProtocolGuid, NULL, (= VOID **) &VariableLock);=0D - DEBUG ((EFI_D_INFO, "[BdsDxe] Locate Variable Lock protocol - %r\n", Sta= tus));=0D + Status =3D gBS->LocateProtocol(&gEdkiiVariablePolicyProtocolGuid, NULL, = (VOID**)&VariablePolicy);=0D + DEBUG((DEBUG_INFO, "[BdsDxe] Locate Variable Policy protocol - %r\n", St= atus));=0D if (!EFI_ERROR (Status)) {=0D for (Index =3D 0; Index < ARRAY_SIZE (mReadOnlyVariables); Index++) {= =0D - Status =3D VariableLock->RequestToLock (VariableLock, mReadOnlyVaria= bles[Index], &gEfiGlobalVariableGuid);=0D - ASSERT_EFI_ERROR (Status);=0D + Status =3D RegisterBasicVariablePolicy(=0D + VariablePolicy,=0D + &gEfiGlobalVariableGuid,=0D + mReadOnlyVariables[Index],=0D + VARIABLE_POLICY_NO_MIN_SIZE,=0D + VARIABLE_POLICY_NO_MAX_SIZE,=0D + VARIABLE_POLICY_NO_MUST_ATTR,=0D + VARIABLE_POLICY_NO_CANT_ATTR,=0D + VARIABLE_POLICY_TYPE_LOCK_NOW=0D + );=0D + ASSERT_EFI_ERROR(Status);=0D }=0D }=0D =0D --=20 2.31.1.windows.1