From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.byosoft.com.cn (mail.byosoft.com.cn [58.240.74.242]) by mx.groups.io with SMTP id smtpd.web10.1832.1623977605238283779 for ; Thu, 17 Jun 2021 17:53:26 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=none, err=permanent DNS error (domain: byosoft.com.cn, ip: 58.240.74.242, mailfrom: gaoliming@byosoft.com.cn) Received: from DESKTOPS6D0PVI ([58.246.60.130]) (envelope-sender ) by 192.168.6.13 with ESMTP for ; Fri, 18 Jun 2021 08:53:18 +0800 X-WM-Sender: gaoliming@byosoft.com.cn X-Originating-IP: 58.246.60.130 X-WM-AuthFlag: YES X-WM-AuthUser: gaoliming@byosoft.com.cn From: "gaoliming" To: , Cc: "'Jian J Wang'" , "'Hao A Wu'" , "'Zhichao Gao'" , "'Ray Ni'" References: <20210617160632.1977-1-kenlautner3@gmail.com> In-Reply-To: <20210617160632.1977-1-kenlautner3@gmail.com> Subject: =?UTF-8?B?5Zue5aSNOiBbUEFUQ0ggdjEgMS8xXSBNZGVNb2R1bGVQa2cvQmRzRHhlOiBVcGRhdGUgQmRzRW50cnkgdG8gdXNlIFZhcmlhYmxlIFBvbGljeQ==?= Date: Fri, 18 Jun 2021 08:53:19 +0800 Message-ID: <009b01d763dc$54807a60$fd816f20$@byosoft.com.cn> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQGcZD0QoXHD+gjaOvNL3KYT8ZNYrKuO8Aag Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: quoted-printable Content-Language: zh-cn Ken: This version looks good to me. If no other comment is got, I will = merge it.=20 Thanks Liming > -----=D3=CA=BC=FE=D4=AD=BC=FE----- > =B7=A2=BC=FE=C8=CB: kenlautner3@gmail.com > =B7=A2=CB=CD=CA=B1=BC=E4: 2021=C4=EA6=D4=C218=C8=D5 0:07 > =CA=D5=BC=FE=C8=CB: devel@edk2.groups.io > =B3=AD=CB=CD: Jian J Wang ; Hao A Wu > ; Zhichao Gao ; Ray Ni > ; Liming Gao > =D6=F7=CC=E2: [PATCH v1 1/1] MdeModulePkg/BdsDxe: Update BdsEntry to = use > Variable Policy >=20 > From: Ken Lautner >=20 > Changed BdsEntry.c to use Variable Policy instead of Variable Lock > as Variable Lock will be Deprecated eventually >=20 > Cc: Jian J Wang > Cc: Hao A Wu > Cc: Zhichao Gao > Cc: Ray Ni > Cc: Liming Gao >=20 > 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(-) >=20 > diff --git a/MdeModulePkg/Universal/BdsDxe/Bds.h > b/MdeModulePkg/Universal/BdsDxe/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 >=20 >=20 > #include >=20 > #include >=20 > -#include >=20 > #include >=20 >=20 >=20 > #include >=20 > 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 >=20 > DebugLib >=20 > UefiBootManagerLib >=20 > + VariablePolicyLib >=20 > + VariablePolicyHelperLib >=20 > PlatformBootManagerLib >=20 > PcdLib >=20 > PrintLib >=20 > @@ -77,7 +79,7 @@ > [Protocols] >=20 > gEfiBdsArchProtocolGuid ## PRODUCES >=20 > gEfiSimpleTextInputExProtocolGuid ## CONSUMES >=20 > - gEdkiiVariableLockProtocolGuid ## > SOMETIMES_CONSUMES >=20 > + gEdkiiVariablePolicyProtocolGuid ## > SOMETIMES_CONSUMES >=20 > gEfiDeferredImageLoadProtocolGuid ## CONSUMES >=20 >=20 >=20 > [FeaturePcd] >=20 > 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" >=20 > #include "Language.h" >=20 > #include "HwErrRecSupport.h" >=20 > +#include >=20 >=20 >=20 > #define SET_BOOT_OPTION_SUPPORT_KEY_COUNT(a, c) { \ >=20 > (a) =3D ((a) & ~EFI_BOOT_OPTION_SUPPORT_COUNT) | (((c) << > LowBitSet32 (EFI_BOOT_OPTION_SUPPORT_COUNT)) & > EFI_BOOT_OPTION_SUPPORT_COUNT); \ >=20 > @@ -670,7 +671,7 @@ BdsEntry ( > EFI_STATUS Status; >=20 > UINT32 BootOptionSupport; >=20 > UINT16 BootTimeOut; >=20 > - EDKII_VARIABLE_LOCK_PROTOCOL *VariableLock; >=20 > + EDKII_VARIABLE_POLICY_PROTOCOL *VariablePolicy; >=20 > UINTN Index; >=20 > EFI_BOOT_MANAGER_LOAD_OPTION LoadOption; >=20 > UINT16 *BootNext; >=20 > @@ -716,12 +717,21 @@ BdsEntry ( > // >=20 > // Mark the read-only variables if the Variable Lock protocol = exists >=20 > // >=20 > - Status =3D gBS->LocateProtocol (&gEdkiiVariableLockProtocolGuid, = NULL, > (VOID **) &VariableLock); >=20 > - DEBUG ((EFI_D_INFO, "[BdsDxe] Locate Variable Lock protocol - = %r\n", > Status)); >=20 > + Status =3D gBS->LocateProtocol(&gEdkiiVariablePolicyProtocolGuid, = NULL, > (VOID**)&VariablePolicy); >=20 > + DEBUG((DEBUG_INFO, "[BdsDxe] Locate Variable Policy protocol - = %r\n", > Status)); >=20 > if (!EFI_ERROR (Status)) { >=20 > for (Index =3D 0; Index < ARRAY_SIZE (mReadOnlyVariables); = Index++) { >=20 > - Status =3D VariableLock->RequestToLock (VariableLock, > mReadOnlyVariables[Index], &gEfiGlobalVariableGuid); >=20 > - ASSERT_EFI_ERROR (Status); >=20 > + Status =3D RegisterBasicVariablePolicy( >=20 > + VariablePolicy, >=20 > + &gEfiGlobalVariableGuid, >=20 > + mReadOnlyVariables[Index], >=20 > + VARIABLE_POLICY_NO_MIN_SIZE, >=20 > + VARIABLE_POLICY_NO_MAX_SIZE, >=20 > + VARIABLE_POLICY_NO_MUST_ATTR, >=20 > + VARIABLE_POLICY_NO_CANT_ATTR, >=20 > + VARIABLE_POLICY_TYPE_LOCK_NOW >=20 > + ); >=20 > + ASSERT_EFI_ERROR(Status); >=20 > } >=20 > } >=20 >=20 >=20 > -- > 2.31.1.windows.1