From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lucky1.263xmail.com (lucky1.263xmail.com [211.157.147.132]) by mx.groups.io with SMTP id smtpd.web09.22305.1643246147093864712 for ; Wed, 26 Jan 2022 17:15:48 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: byosoft.net, ip: 211.157.147.132, mailfrom: byomail@byosoft.net) Received: from localhost (unknown [192.168.167.70]) by lucky1.263xmail.com (Postfix) with ESMTP id EB8EDFE8F8 for ; Thu, 27 Jan 2022 09:15:41 +0800 (CST) X-MAIL-GRAY: 1 X-MAIL-DELIVERY: 0 X-ADDR-CHECKED4: 1 X-SKE-CHECKED: 1 X-ABS-CHECKED: 1 X-ANTISPAM-LEVEL: 2 Received: from mail.byosoft.com.cn (unknown [58.240.74.242]) by smtp.263.net (postfix) whith ESMTP id P16386T140043404060416S1643246140955450_; Thu, 27 Jan 2022 09:15:41 +0800 (CST) X-IP-DOMAINF: 1 X-RL-SENDER: byomail@byosoft.net X-SENDER: byomail@byosoft.net X-LOGIN-NAME: byomail@byosoft.net X-FST-TO: devel@edk2.groups.io X-RCPT-COUNT: 1 X-LOCAL-RCPT-COUNT: 0 X-MUTI-DOMAIN-COUNT: 0 X-SENDER-IP: 58.240.74.242 X-ATTACHMENT-NUM: 0 X-UNIQUE-TAG: X-System-Flag: 0 Received: from DESKTOPS6D0PVI ([58.246.60.130]) (envelope-sender ) by 192.168.6.13 with ESMTP for ; Thu, 27 Jan 2022 09:14:47 +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: "'Rebecca Cran'" , Cc: "'Jian J Wang'" , "'Zhichao Gao'" , "'Ray Ni'" References: <16CBC7B9F156E53A.7993@groups.io> <522e1720-5f37-44c2-8d0a-d4a5e37827e2@quicinc.com> In-Reply-To: <522e1720-5f37-44c2-8d0a-d4a5e37827e2@quicinc.com> Subject: =?UTF-8?B?5Zue5aSNOiBbZWRrMi1kZXZlbF0gW1BBVENIIDEvMV0gTWRlTW9kdWxlUGtnL1VlZmlCb290TWFuYWdlckxpYjogQ29udmVydCBCbUxvYWRPcHRpb24gdG8gVmFyaWFibGUgUG9saWN5?= Date: Thu, 27 Jan 2022 09:14:50 +0800 Message-ID: <000d01d8131b$4898fc60$d9caf520$@byosoft.com.cn> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQEr0Sb5XG50nVfLm8aDpXMcDrUoFwGFEE2drcJrvjA= Sender: "gaoliming" Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Language: zh-cn Reviewed-by: Liming Gao > -----=E9=82=AE=E4=BB=B6=E5=8E=9F=E4=BB=B6----- > =E5=8F=91=E4=BB=B6=E4=BA=BA: Rebecca Cran > =E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: = 2022=E5=B9=B41=E6=9C=8827=E6=97=A5 7:23 > =E6=94=B6=E4=BB=B6=E4=BA=BA: devel@edk2.groups.io > =E6=8A=84=E9=80=81: Jian J Wang ; Liming Gao > ; Zhichao Gao ; Ray = Ni > > =E4=B8=BB=E9=A2=98: Re: [edk2-devel] [PATCH 1/1] = MdeModulePkg/UefiBootManagerLib: > Convert BmLoadOption to Variable Policy >=20 > It's been a week since I sent this out: could someone review it = please? >=20 >=20 > Thanks. > Rebecca Cran >=20 > On 1/19/22 14:01, Rebecca Cran wrote: > > Since the Variable Lock protocol is deprecated, convert locking of > > PlatformRecovery#### in EfiBootManagerLoadOptionToVariable to use = the > > Variable Policy protocol. > > > > Cc: Jian J Wang > > Cc: Liming Gao > > Cc: Zhichao Gao > > Cc: Ray Ni > > > > Signed-off-by: Rebecca Cran > > --- > > MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c > | 33 +++++++++++++------- > > MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h > | 1 - > > MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf | > 3 +- > > 3 files changed, 24 insertions(+), 13 deletions(-) > > > > diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c > b/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c > > index 32a9cbb425fa..2087f0b91df7 100644 > > --- a/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c > > +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c > > @@ -9,6 +9,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent > > > > #include "InternalBm.h" > > > > +#include > > + > > GLOBAL_REMOVE_IF_UNREFERENCED > > CHAR16 *mBmLoadOptionName[] =3D { > > L"Driver", > > @@ -169,15 +171,15 @@ EfiBootManagerLoadOptionToVariable ( > > IN CONST EFI_BOOT_MANAGER_LOAD_OPTION *Option > > ) > > { > > - EFI_STATUS Status; > > - UINTN VariableSize; > > - UINT8 *Variable; > > - UINT8 *Ptr; > > - CHAR16 > OptionName[BM_OPTION_NAME_LEN]; > > - CHAR16 *Description; > > - CHAR16 NullChar; > > - EDKII_VARIABLE_LOCK_PROTOCOL *VariableLock; > > - UINT32 VariableAttributes; > > + EFI_STATUS Status; > > + UINTN VariableSize; > > + UINT8 *Variable; > > + UINT8 *Ptr; > > + CHAR16 > OptionName[BM_OPTION_NAME_LEN]; > > + CHAR16 *Description; > > + CHAR16 NullChar; > > + EDKII_VARIABLE_POLICY_PROTOCOL *VariablePolicy; > > + UINT32 VariableAttributes; > > > > if ((Option->OptionNumber =3D=3D LoadOptionNumberUnassigned) || > > (Option->FilePath =3D=3D NULL) || > > @@ -242,9 +244,18 @@ structure. > > // > > // Lock the PlatformRecovery#### > > // > > - Status =3D gBS->LocateProtocol = (&gEdkiiVariableLockProtocolGuid, NULL, > (VOID **)&VariableLock); > > + Status =3D gBS->LocateProtocol = (&gEdkiiVariablePolicyProtocolGuid, > NULL, (VOID **)&VariablePolicy); > > if (!EFI_ERROR (Status)) { > > - Status =3D VariableLock->RequestToLock (VariableLock, = OptionName, > &gEfiGlobalVariableGuid); > > + Status =3D RegisterBasicVariablePolicy ( > > + VariablePolicy, > > + &gEfiGlobalVariableGuid, > > + OptionName, > > + 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); > > } > > > > diff --git a/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h > b/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h > > index a9b0d485cace..b7dfe2a7e0bd 100644 > > --- a/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h > > +++ b/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h > > @@ -39,7 +39,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent > > #include > > #include > > #include > > -#include > > #include > > #include > > #include > > diff --git > a/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf > b/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf > > index cf5908692fa7..fe05d5f1cc9d 100644 > > --- a/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf > > +++ > b/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf > > @@ -62,6 +62,7 @@ > > PerformanceLib > > HiiLib > > SortLib > > + VariablePolicyHelperLib > > > > [Guids] > > ## SOMETIMES_CONSUMES ## SystemTable (The identifier of > memory type information type in system table) > > @@ -99,7 +100,7 @@ > > gEfiDevicePathProtocolGuid ## > SOMETIMES_CONSUMES > > gEfiBootLogoProtocolGuid ## > SOMETIMES_CONSUMES > > gEfiSimpleTextInputExProtocolGuid ## > SOMETIMES_CONSUMES > > - gEdkiiVariableLockProtocolGuid ## > SOMETIMES_CONSUMES > > + gEdkiiVariablePolicyProtocolGuid ## > SOMETIMES_CONSUMES > > gEfiGraphicsOutputProtocolGuid ## > SOMETIMES_CONSUMES > > gEfiUsbIoProtocolGuid ## > SOMETIMES_CONSUMES > > gEfiNvmExpressPassThruProtocolGuid ## > SOMETIMES_CONSUMES