From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f174.google.com (mail-pg1-f174.google.com [209.85.215.174]) by mx.groups.io with SMTP id smtpd.web09.4364.1622837619165698230 for ; Fri, 04 Jun 2021 13:13:39 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20161025 header.b=feRlnjOK; spf=pass (domain: gmail.com, ip: 209.85.215.174, mailfrom: kenlautner3@gmail.com) Received: by mail-pg1-f174.google.com with SMTP id y11so591709pgp.11 for ; Fri, 04 Jun 2021 13:13:39 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=YdySFnv0xVOjA/Z01xSgU1TuzJlkyw0F2bwblFbeXDU=; b=feRlnjOKw1bfsiPnwPTtj/4UpQY9at/UssQp7FDvM7x6R6FO5hpfEDeBVgkh7hY22A 2AEkcPGIvAbqw0CeP68vtxkghUgQSGxJ90Jz+kyqZ/NJvX+cPPI7qvQP0AXgf1WBuGmb m4yz+K4sSSEsuIpjCLKBDJu9BK8jw49IiJxumlb+cNlGvkJXG24MuMGUgxleLqUHiaEx kdDVjGsza0nLRBISfg3fAzyY+fAehAiYkhUKqtzxMxgSix1IOd3PGFTxHeW0pyusb4qP HkIzxIM4fUQF1moxnSr6EZrOwwKcl2W6fZukix9L7yOVc6//xnsy47mxvn0bGKlPQiEK NESA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=YdySFnv0xVOjA/Z01xSgU1TuzJlkyw0F2bwblFbeXDU=; b=Ar9yK3SySFjlJkulME9xpoAZWmv37zxxB5lAzxtlR0jtZSG5jIOUxnTL+fMA/ANQjn uP+YO0VNj65L7mCq6q4oEWFm6y9P9x0c70HQvNKhkuhGWAOPYio5Yk1AtaYWZtPr6ao5 qZ9+sfU7dptn0OeDLP48oJ/lmyxsLymaSDvd/Srtj1GOT9a9Q5Mssip2U8frl1bTb1C8 qhpqdNXyVqCjoy6Yc8mC2R1tTONe5zbmSHGgLqCFw54dMNIFCBdK6TMA5vl5L+ipOhyq id5fSdk9JuBZUCE8ayUuU6DyvgDUwNLGtK4EVgYZKej6CZqBX6IbZrNceAu9zT9qpXBJ ARwQ== X-Gm-Message-State: AOAM533LpkE4NgUsrgHWEBZDqjrbJNlGfVssFUX/jEvLG4ooHSxQS20n BdbXORUd6jZUWFJmjn48crREdTH+QWg= X-Google-Smtp-Source: ABdhPJyzawvNi/nn7TqBa4t/jUkRrqW0uBDCKIsxATMhFXtwDnx/rB/8+kcE7dRViY2Bf4nvADuM3Q== X-Received: by 2002:a63:b40d:: with SMTP id s13mr6600929pgf.271.1622837618469; Fri, 04 Jun 2021 13:13:38 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([12.157.155.61]) by smtp.gmail.com with ESMTPSA id j12sm2689403pgs.83.2021.06.04.13.13.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Jun 2021 13:13:38 -0700 (PDT) From: kenlautner3@gmail.com To: devel@edk2.groups.io Cc: Jian J Wang , Hao A Wu , Zhichao Gao , Ray Ni Subject: [PATCH v1 1/1] MdeModulePkg/BdsDxe: Update BdsEntry to use Variable Policy Date: Fri, 4 Jun 2021 13:13:26 -0700 Message-Id: <20210604201326.1383-2-kenlautner3@gmail.com> X-Mailer: git-send-email 2.31.1.windows.1 In-Reply-To: <20210604201326.1383-1-kenlautner3@gmail.com> References: <20210604201326.1383-1-kenlautner3@gmail.com> 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 Signed-off-by: Kenneth Lautner --- MdeModulePkg/Universal/BdsDxe/BdsDxe.inf | 4 +++- MdeModulePkg/Universal/BdsDxe/BdsEntry.c | 20 +++++++++++++++----- 2 files changed, 18 insertions(+), 6 deletions(-) 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..13723bee299b 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 "library/VariablePolicyHelperLib.h"=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.25.1.windows.1