From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) by mx.groups.io with SMTP id smtpd.web08.133.1623883362380390552 for ; Wed, 16 Jun 2021 15:42:42 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20161025 header.b=mUPKDWva; spf=pass (domain: gmail.com, ip: 209.85.167.50, mailfrom: kenlautner3@gmail.com) Received: by mail-lf1-f50.google.com with SMTP id x24so6891345lfr.10 for ; Wed, 16 Jun 2021 15:42:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=p+Vu6Mb/44urJqbsqsvDEunUz8C0qNifUeQIVBdLE4I=; b=mUPKDWvaE77MZJp7+JJY/b7ayob0cRQ1VTM8PdfZWsXrD6PMwZIncsHvX99uz2T34i ms1OP1BhSKR/UvE2k7eob5/LgYlPJA7oaQRczr/aEls/6NbXGTe3bTzNBGj7W20GIaDU UUrjno1E3+HZb1yXVa5oJ/DnMi+4/6zyiNtH6AoCw5FLWsc77i9zar1Ul+mw0tO7d913 hJnWGdCg+f9getZSLuPFUp9XVTuBx65fvM4Nm4i3zDOS2u7ro6CTAsi+GSMbFLbzPltm Tk0ZEJiEeaTiTHECyIaoQTEsdjRHyxgjbp0xdll82H3kJ5yHZxiTgLWUFaw+TeK7yxfe 7lvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=p+Vu6Mb/44urJqbsqsvDEunUz8C0qNifUeQIVBdLE4I=; b=Yy1kh2WExu3Od+VpWs8HuDiPmFzFQbXCj6vfXdOOjEkBzSrNkaMalP5JdXlB45sHm9 wSFJiVHosVrsNJdW5yDTBybhrCTJRyIJY2Hqdm5cu3f83e5w+bnLFtWKWFuS9IgTvJTm rPUUzl29ZqIplWmCy2ihYMlEv7JYllvgGQyblYjHJM0Bu9ojaI38bx6f6WR0BJNxPI5r ayPwGSg3dD+jCYpV8YuV0z62lJsa4OpJVDZe736VjMm6O+JfF3EaejG/3656oedhFTn3 mV2NV55woTokvEtba5BzFWIYV036miPaopSntb23SnfOf1smxKuy4B4ULzJ1qLX2ICZm uW9g== X-Gm-Message-State: AOAM532cwUdP9ky+aWMtA+t6cfF1WLrNutfLyKDjv8VISOvNkQoSgjwv YxG9A1+EqyMnPRiFjSBtC2xpXj3XOaAQq4AKmS6NPQ3+ X-Google-Smtp-Source: ABdhPJzik3Qvkgq30iwLaxhPh8U+IAATdjz5x0JrOtDwkZ9hq5OUeAu+STRvF9+CGO0g//vunH/AiZ8dLLTjwBGqm84= X-Received: by 2002:ac2:5cd6:: with SMTP id f22mr1569256lfq.73.1623883360401; Wed, 16 Jun 2021 15:42:40 -0700 (PDT) MIME-Version: 1.0 References: <1689208912383FDD.3893@groups.io> In-Reply-To: <1689208912383FDD.3893@groups.io> From: "Kenneth Lautner" Date: Wed, 16 Jun 2021 15:42:29 -0700 Message-ID: Subject: Re: [edk2-devel] [PATCH v1 1/1] MdeModulePkg/BdsDxe: Update BdsEntry to use Variable Policy To: devel@edk2.groups.io, kenlautner3@gmail.com Cc: Jian J Wang , Hao A Wu , Zhichao Gao , Ray Ni , Liming Gao Content-Type: multipart/alternative; boundary="000000000000da7cc405c4e9ce39" --000000000000da7cc405c4e9ce39 Content-Type: text/plain; charset="UTF-8" This needs more editorial changes so disregard for now and I'll resend it when it's better. Sorry about that. On Wed, Jun 16, 2021 at 10:35 AM Kenneth Lautner via groups.io wrote: > 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 > > Fixed Library References > > Quick revert > > MdeModulePkg/BdsDxe: Fixed Library References > > Fixed incorrect library reference in BdsEntry.c > > Cc: Jian J Wang > Cc: Hao A Wu > Cc: Zhichao Gao > Cc: Ray Ni > Cc: Liming Gao > 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/Universal/BdsDxe/BdsDxe.inf > index 9310b4dccb18..76ff6a0f5fc3 100644 > --- a/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf > +++ b/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf > @@ -50,6 +50,8 @@ > BaseMemoryLib > DebugLib > UefiBootManagerLib > + VariablePolicyLib > + VariablePolicyHelperLib > PlatformBootManagerLib > PcdLib > PrintLib > @@ -77,7 +79,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 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" > #include "Language.h" > #include "HwErrRecSupport.h" > +#include > > #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); > } > } > > -- > 2.31.1.windows.1 > > > > ------------ > Groups.io Links: You receive all messages sent to this group. > View/Reply Online (#76602): https://edk2.groups.io/g/devel/message/76602 > Mute This Topic: https://groups.io/mt/83586104/6193780 > Group Owner: devel+owner@edk2.groups.io > Unsubscribe: https://edk2.groups.io/g/devel/unsub [kenlautner3@gmail.com] > ------------ > > > --000000000000da7cc405c4e9ce39 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
This needs more editorial changes so disregard for now and= I'll resend it when it's better.=C2=A0 Sorry about that.

=
On Wed, Ju= n 16, 2021 at 10:35 AM Kenneth Lautner via gro= ups.io <kenlautner3=3Dgmail.c= om@groups.io> wrote:
From: Ken Lautner <klautner@microsoft.com>

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 <ha= o.a.wu@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Cc: Ray Ni <ray.ni= @intel.com>
Signed-off-by: Kenneth Lautner <kenlautner3@gmail.com>

Fixed Library References

Quick revert

MdeModulePkg/BdsDxe: Fixed Library References

Fixed incorrect library reference in BdsEntry.c

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <ha= o.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>
---
=C2=A0MdeModulePkg/Universal/BdsDxe/BdsDxe.inf |=C2=A0 4 +++-
=C2=A0MdeModulePkg/Universal/BdsDxe/BdsEntry.c | 20 +++++++++++++++----- =C2=A02 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 @@
=C2=A0 =C2=A0BaseMemoryLib
=C2=A0 =C2=A0DebugLib
=C2=A0 =C2=A0UefiBootManagerLib
+=C2=A0 VariablePolicyLib
+=C2=A0 VariablePolicyHelperLib
=C2=A0 =C2=A0PlatformBootManagerLib
=C2=A0 =C2=A0PcdLib
=C2=A0 =C2=A0PrintLib
@@ -77,7 +79,7 @@
=C2=A0[Protocols]
=C2=A0 =C2=A0gEfiBdsArchProtocolGuid=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0## PRODUCES
=C2=A0 =C2=A0gEfiSimpleTextInputExProtocolGuid=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0## CONSUMES
-=C2=A0 gEdkiiVariableLockProtocolGuid=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 ## SOMETIMES_CONSUMES
+=C2=A0 gEdkiiVariablePolicyProtocolGuid=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 ## SOMETIMES_CONSUMES
=C2=A0 =C2=A0gEfiDeferredImageLoadProtocolGuid=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0## CONSUMES

=C2=A0[FeaturePcd]
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
=C2=A0#include "Bds.h"
=C2=A0#include "Language.h"
=C2=A0#include "HwErrRecSupport.h"
+#include <Library/VariablePolicyHelperLib.h>

=C2=A0#define SET_BOOT_OPTION_SUPPORT_KEY_COUNT(a, c) {=C2=A0 \
=C2=A0 =C2=A0 =C2=A0 =C2=A0(a) =3D ((a) & ~EFI_BOOT_OPTION_SUPPORT_COUN= T) | (((c) << LowBitSet32 (EFI_BOOT_OPTION_SUPPORT_COUNT)) & EFI_= BOOT_OPTION_SUPPORT_COUNT); \
@@ -670,7 +671,7 @@ BdsEntry (
=C2=A0 =C2=A0EFI_STATUS=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 Status;
=C2=A0 =C2=A0UINT32=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 BootOptionSupport;
=C2=A0 =C2=A0UINT16=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 BootTimeOut;
-=C2=A0 EDKII_VARIABLE_LOCK_PROTOCOL=C2=A0 =C2=A0 *VariableLock;
+=C2=A0 EDKII_VARIABLE_POLICY_PROTOCOL=C2=A0 *VariablePolicy;
=C2=A0 =C2=A0UINTN=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Index;
=C2=A0 =C2=A0EFI_BOOT_MANAGER_LOAD_OPTION=C2=A0 =C2=A0 LoadOption;
=C2=A0 =C2=A0UINT16=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 *BootNext;
@@ -716,12 +717,21 @@ BdsEntry (
=C2=A0 =C2=A0//
=C2=A0 =C2=A0// Mark the read-only variables if the Variable Lock protocol = exists
=C2=A0 =C2=A0//
-=C2=A0 Status =3D gBS->LocateProtocol (&gEdkiiVariableLockProtocolG= uid, NULL, (VOID **) &VariableLock);
-=C2=A0 DEBUG ((EFI_D_INFO, "[BdsDxe] Locate Variable Lock protocol - = %r\n", Status));
+=C2=A0 Status =3D gBS->LocateProtocol(&gEdkiiVariablePolicyProtocol= Guid, NULL, (VOID**)&VariablePolicy);
+=C2=A0 DEBUG((DEBUG_INFO, "[BdsDxe] Locate Variable Policy protocol -= %r\n", Status));
=C2=A0 =C2=A0if (!EFI_ERROR (Status)) {
=C2=A0 =C2=A0 =C2=A0for (Index =3D 0; Index < ARRAY_SIZE (mReadOnlyVaria= bles); Index++) {
-=C2=A0 =C2=A0 =C2=A0 Status =3D VariableLock->RequestToLock (VariableLo= ck, mReadOnlyVariables[Index], &gEfiGlobalVariableGuid);
-=C2=A0 =C2=A0 =C2=A0 ASSERT_EFI_ERROR (Status);
+=C2=A0 =C2=A0 =C2=A0 Status =3D RegisterBasicVariablePolicy(
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0VariablePoli= cy,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&gEfiGlo= balVariableGuid,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0mReadOnlyVar= iables[Index],
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0VARIABLE_POL= ICY_NO_MIN_SIZE,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0VARIABLE_POL= ICY_NO_MAX_SIZE,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0VARIABLE_POL= ICY_NO_MUST_ATTR,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0VARIABLE_POL= ICY_NO_CANT_ATTR,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0VARIABLE_POL= ICY_TYPE_LOCK_NOW
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0);
+=C2=A0 =C2=A0 =C2=A0 ASSERT_EFI_ERROR(Status);
=C2=A0 =C2=A0 =C2=A0}
=C2=A0 =C2=A0}

--
2.31.1.windows.1



------------
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#76602): https://edk2.groups.io/g/dev= el/message/76602
Mute This Topic: https://groups.io/mt/83586104/6193780
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [kenlautner3@gmail.com]
------------


--000000000000da7cc405c4e9ce39--