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.2481.1634694915135005296 for ; Tue, 19 Oct 2021 18:55:16 -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 ; Wed, 20 Oct 2021 09:55:13 +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: , , References: <20211019031104.3110-1-jie.yang@intel.com> In-Reply-To: <20211019031104.3110-1-jie.yang@intel.com> Subject: =?UTF-8?B?5Zue5aSNOiBbZWRrMi1kZXZlbF1bUEFUQ0ggdjJdIEZtcERldmljZVBrZy9GbXBEeGU6IFVzZSBuZXcgVmFyaWFibGUgTG9jayBpbnRlcmZhY2U=?= Date: Wed, 20 Oct 2021 09:55:13 +0800 Message-ID: <009101d7c555$85f00270$91d00750$@byosoft.com.cn> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQDFcb1vDdcqONugBLKFgqCGEjVHLK3/xyzQ Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: quoted-printable Content-Language: zh-cn Jie: Thanks for your update. I also miss this typo. Reviewed-by: Liming Gao Thanks Liming > -----=D3=CA=BC=FE=D4=AD=BC=FE----- > =B7=A2=BC=FE=C8=CB: devel@edk2.groups.io = =B4=FA=B1=ED Yang Jie > =B7=A2=CB=CD=CA=B1=BC=E4: 2021=C4=EA10=D4=C219=C8=D5 11:11 > =CA=D5=BC=FE=C8=CB: devel@edk2.groups.io > =B3=AD=CB=CD: gaoliming@byosoft.com.cn; michael.d.kinney@intel.com; > guomin.jiang@intel.com; wei6.xu@intel.com; Yang Jie = > =D6=F7=CC=E2: [edk2-devel][PATCH v2] FmpDevicePkg/FmpDxe: Use new = Variable > Lock interface >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3655 > The code in FmpDevicePkg call the deprecated interface > VariableLockRequestToLockc. So I changed the code in > FmpDevicePkg using RegisterBasicVariablePolicy, instead > of the deprecated interface. >=20 >=20 > Signed-off-by: Yang Jie > Cc: Liming Gao > Cc: Michael D Kinney > Cc: Guomin Jiang > Cc: Wei6 Xu > --- > FmpDevicePkg/FmpDevicePkg.dsc | 1 + > FmpDevicePkg/FmpDxe/FmpDxe.h | 4 +- > FmpDevicePkg/FmpDxe/FmpDxe.inf | 5 +- > FmpDevicePkg/FmpDxe/VariableSupport.c | 69 = +++++++++++++-------------- > 4 files changed, 39 insertions(+), 40 deletions(-) >=20 > diff --git a/FmpDevicePkg/FmpDevicePkg.dsc > b/FmpDevicePkg/FmpDevicePkg.dsc > index b420f52a08..7b1af285dd 100644 > --- a/FmpDevicePkg/FmpDevicePkg.dsc > +++ b/FmpDevicePkg/FmpDevicePkg.dsc > @@ -53,6 +53,7 @@ > DebugLib|MdePkg/Library/UefiDebugLibStdErr/UefiDebugLibStdErr.inf >=20 >=20 > = DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/Base > DebugPrintErrorLevelLib.inf >=20 > PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf >=20 > + > = VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/Vari= > ablePolicyHelperLib.inf >=20 > !ifdef CONTINUOUS_INTEGRATION >=20 > = BaseCryptLib|CryptoPkg/Library/BaseCryptLibNull/BaseCryptLibNull.inf >=20 > !else >=20 > diff --git a/FmpDevicePkg/FmpDxe/FmpDxe.h > b/FmpDevicePkg/FmpDxe/FmpDxe.h > index 1177b1828e..4d94a925b6 100644 > --- a/FmpDevicePkg/FmpDxe/FmpDxe.h > +++ b/FmpDevicePkg/FmpDxe/FmpDxe.h > @@ -4,7 +4,7 @@ > information provided through PCDs and libraries. >=20 >=20 >=20 > Copyright (c) Microsoft Corporation.
>=20 > - Copyright (c) 2018 - 2019, Intel Corporation. All rights = reserved.
>=20 > + Copyright (c) 2018 - 2021, Intel Corporation. All rights = reserved.
>=20 >=20 >=20 > SPDX-License-Identifier: BSD-2-Clause-Patent >=20 >=20 >=20 > @@ -33,11 +33,11 @@ > #include >=20 > #include >=20 > #include >=20 > -#include >=20 > #include >=20 > #include >=20 > #include >=20 > #include >=20 > +#include >=20 >=20 >=20 > #define VERSION_STRING_NOT_SUPPORTED L"VERSION STRING NOT > SUPPORTED" >=20 > #define VERSION_STRING_NOT_AVAILABLE L"VERSION STRING NOT > AVAILABLE" >=20 > diff --git a/FmpDevicePkg/FmpDxe/FmpDxe.inf > b/FmpDevicePkg/FmpDxe/FmpDxe.inf > index eeb904a091..1c296388b0 100644 > --- a/FmpDevicePkg/FmpDxe/FmpDxe.inf > +++ b/FmpDevicePkg/FmpDxe/FmpDxe.inf > @@ -4,7 +4,7 @@ > # information provided through PCDs and libraries. >=20 > # >=20 > # Copyright (c) 2016, Microsoft Corporation. All rights = reserved.
>=20 > -# Copyright (c) 2018 - 2020, Intel Corporation. All rights = reserved.
>=20 > +# Copyright (c) 2018 - 2021, Intel Corporation. All rights = reserved.
>=20 > # >=20 > # SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > ## >=20 > @@ -55,14 +55,15 @@ > FmpDependencyLib >=20 > FmpDependencyCheckLib >=20 > FmpDependencyDeviceLib >=20 > + VariablePolicyHelperLib >=20 >=20 >=20 > [Guids] >=20 > gEfiEndOfDxeEventGroupGuid >=20 >=20 >=20 > [Protocols] >=20 > - gEdkiiVariableLockProtocolGuid ## CONSUMES >=20 > gEfiFirmwareManagementProtocolGuid ## PRODUCES >=20 > gEdkiiFirmwareManagementProgressProtocolGuid ## PRODUCES >=20 > + gEdkiiVariablePolicyProtocolGuid ## CONSUMES >=20 >=20 >=20 > [Pcd] >=20 > gFmpDevicePkgTokenSpaceGuid.PcdFmpDeviceStorageAccessEnable > ## CONSUMES >=20 > diff --git a/FmpDevicePkg/FmpDxe/VariableSupport.c > b/FmpDevicePkg/FmpDxe/VariableSupport.c > index 86dd5b203b..c4b72a2ff9 100644 > --- a/FmpDevicePkg/FmpDxe/VariableSupport.c > +++ b/FmpDevicePkg/FmpDxe/VariableSupport.c > @@ -3,7 +3,7 @@ > firmware updates. >=20 >=20 >=20 > Copyright (c) 2016, Microsoft Corporation. All rights reserved.
>=20 > - Copyright (c) 2018 - 2019, Intel Corporation. All rights = reserved.
>=20 > + Copyright (c) 2018 - 2021, Intel Corporation. All rights = reserved.
>=20 >=20 >=20 > SPDX-License-Identifier: BSD-2-Clause-Patent >=20 >=20 >=20 > @@ -729,29 +729,30 @@ SetLastAttemptVersionInVariable ( > static >=20 > EFI_STATUS >=20 > LockFmpVariable ( >=20 > - IN EFI_STATUS PreviousStatus, >=20 > - IN EDKII_VARIABLE_LOCK_PROTOCOL *VariableLock, >=20 > - IN CHAR16 *VariableName >=20 > + IN EFI_STATUS PreviousStatus, >=20 > + IN EDKII_VARIABLE_POLICY_PROTOCOL *VariablePolicy, >=20 > + IN CHAR16 *VariableName >=20 > ) >=20 > { >=20 > EFI_STATUS Status; >=20 >=20 >=20 > - Status =3D VariableLock->RequestToLock ( >=20 > - VariableLock, >=20 > - VariableName, >=20 > - &gEfiCallerIdGuid >=20 > - ); >=20 > - if (!EFI_ERROR (Status)) { >=20 > - return PreviousStatus; >=20 > + // If success, go ahead and set the policies to protect the target variables. >=20 > + Status =3D RegisterBasicVariablePolicy (VariablePolicy, >=20 > + &gEfiCallerIdGuid, >=20 > + VariableName, >=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 > + if (EFI_ERROR (Status)) { >=20 > + DEBUG ((DEBUG_ERROR, "FmpDxe(%s): Failed to lock variable %g %s. > Status =3D %r\n", >=20 > + mImageIdName, >=20 > + &gEfiCallerIdGuid, >=20 > + VariableName, >=20 > + Status >=20 > + )); >=20 > } >=20 > - >=20 > - DEBUG ((DEBUG_ERROR, "FmpDxe(%s): Failed to lock variable %g %s. > Status =3D %r\n", >=20 > - mImageIdName, >=20 > - &gEfiCallerIdGuid, >=20 > - VariableName, >=20 > - Status >=20 > - )); >=20 > - >=20 > if (EFI_ERROR (PreviousStatus)) { >=20 > return PreviousStatus; >=20 > } >=20 > @@ -773,26 +774,22 @@ LockAllFmpVariables ( > FIRMWARE_MANAGEMENT_PRIVATE_DATA *Private >=20 > ) >=20 > { >=20 > - EFI_STATUS Status; >=20 > - EDKII_VARIABLE_LOCK_PROTOCOL *VariableLock; >=20 > - >=20 > - VariableLock =3D NULL; >=20 > - Status =3D gBS->LocateProtocol ( >=20 > - &gEdkiiVariableLockProtocolGuid, >=20 > - NULL, >=20 > - (VOID **)&VariableLock >=20 > - ); >=20 > - if (EFI_ERROR (Status) || VariableLock =3D=3D NULL) { >=20 > - DEBUG ((DEBUG_ERROR, "FmpDxe(%s): Failed to locate Variable Lock > Protocol (%r).\n", mImageIdName, Status)); >=20 > - return EFI_UNSUPPORTED; >=20 > + EFI_STATUS Status; >=20 > + EDKII_VARIABLE_POLICY_PROTOCOL *VariablePolicy; >=20 > + >=20 > + // Locate the VariablePolicy protocol. >=20 > + Status =3D gBS->LocateProtocol (&gEdkiiVariablePolicyProtocolGuid, = NULL, > (VOID**)&VariablePolicy ); >=20 > + if (EFI_ERROR (Status)) { >=20 > + DEBUG ((DEBUG_ERROR, "FmpDxe %a - Could not locate VariablePolicy > protocol! %r\n", __FUNCTION__, Status)); >=20 > + return Status; >=20 > } >=20 >=20 >=20 > Status =3D EFI_SUCCESS; >=20 > - Status =3D LockFmpVariable (Status, VariableLock, > Private->VersionVariableName); >=20 > - Status =3D LockFmpVariable (Status, VariableLock, > Private->LsvVariableName); >=20 > - Status =3D LockFmpVariable (Status, VariableLock, > Private->LastAttemptStatusVariableName); >=20 > - Status =3D LockFmpVariable (Status, VariableLock, > Private->LastAttemptVersionVariableName); >=20 > - Status =3D LockFmpVariable (Status, VariableLock, > Private->FmpStateVariableName); >=20 > + Status =3D LockFmpVariable (Status, VariablePolicy, > Private->VersionVariableName); >=20 > + Status =3D LockFmpVariable (Status, VariablePolicy, > Private->LsvVariableName); >=20 > + Status =3D LockFmpVariable (Status, VariablePolicy, > Private->LastAttemptStatusVariableName); >=20 > + Status =3D LockFmpVariable (Status, VariablePolicy, > Private->LastAttemptVersionVariableName); >=20 > + Status =3D LockFmpVariable (Status, VariablePolicy, > Private->FmpStateVariableName); >=20 >=20 >=20 > return Status; >=20 > } >=20 > -- > 2.26.2.windows.1 >=20 >=20 >=20 > -=3D-=3D-=3D-=3D-=3D-=3D > Groups.io Links: You receive all messages sent to this group. > View/Reply Online (#82268): = https://edk2.groups.io/g/devel/message/82268 > Mute This Topic: https://groups.io/mt/86431736/4905953 > Group Owner: devel+owner@edk2.groups.io > Unsubscribe: https://edk2.groups.io/g/devel/unsub > [gaoliming@byosoft.com.cn] > -=3D-=3D-=3D-=3D-=3D-=3D >=20