From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mx.groups.io with SMTP id smtpd.web08.5677.1635833507496877830 for ; Mon, 01 Nov 2021 23:11:47 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=YNlU5S8v; spf=pass (domain: intel.com, ip: 192.55.52.88, mailfrom: jian.j.wang@intel.com) X-IronPort-AV: E=McAfee;i="6200,9189,10155"; a="254800093" X-IronPort-AV: E=Sophos;i="5.87,201,1631602800"; d="scan'208";a="254800093" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Nov 2021 23:11:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,201,1631602800"; d="scan'208";a="496814962" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by fmsmga007.fm.intel.com with ESMTP; 01 Nov 2021 23:11:46 -0700 Received: from orsmsx605.amr.corp.intel.com (10.22.229.18) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Mon, 1 Nov 2021 23:11:45 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx605.amr.corp.intel.com (10.22.229.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Mon, 1 Nov 2021 23:11:45 -0700 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (104.47.51.43) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.12; Mon, 1 Nov 2021 23:11:45 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Pv6WXs0QIxp63130pi8OI/gx/dq/0L/mKCNU68ChrHJQN8NIMcPiX7X/zOnXw3Y2yh0F1EVn6KUF4uZw8DL/tulECHhUwU3NwQd5E4yQTsZMWLXnmo+shASxmRhYGWBCVU4aBXCXvtT3zwNbDn+Dqrg7ufr1WnbQZ2DG+M9E/u7OOqMLmwr7R+eNC6ILxxrGpWo35sjGQAyw7Ur4U6675yJQHWYpIp04F5ecbZfyJDfHwertRI42cj8GPPFWPlocxiR0cZsUO2cf9GhNEaCBMLHPZUi45YyHvXrKNc7lH9b+OQ09+lfPppKo0m7vuJ5q6+teQq6b1JeDin2+OETepg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=MdwPZzQ+s+i6jm+rixEWxAwKrPLVnp4iHqq8u2XerBg=; b=Himf01cPXxNhgIbvIg9jI6iYACrxq1oROFZqqS7r6r0sVgTnD/pC0bqVLJq+ivN3r4ugYIfbjcSfcbDsXKx6pbyp5Q2pnpjh37pwLxx6LXmIHtKE5WmC+TEXx/GLaJPces0BJ7wX/s18PwQlIdRcIVTXe2ShAdBbvs6CRiq5aG1eIDVW0EL5/Q6NY9f6YsbX/83FumI9pFv0O02NomLCKqiEkJxFstuGCEjwTk5iNw3xcjUFUvYHjhEAxxywB//WYjUWgh942HCBJw0ao/y8AVfjiiS2a7GWLNKX+EuDNvKjMRZpsGzrFSlGNlgOsEYj/xCIPiFBo2/8hcLb4Tpbsg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MdwPZzQ+s+i6jm+rixEWxAwKrPLVnp4iHqq8u2XerBg=; b=YNlU5S8v0po9GMxzRlT3zHMQnsenhYNp9xD4uKqYlo2vp4ixcvDXJbPkqXV17mF/AFicM9B2nYRqiWZRDc7TwXTn6cB7toWIvhFCBsd56kmabmx+1RTNvVlsRLMNhxmFQ3kVc6zVkFJZz1jRHYcIS4bhQqfWj7LCiF8AV5C3EOk= Received: from CO1PR11MB4945.namprd11.prod.outlook.com (2603:10b6:303:9c::8) by MWHPR1101MB2190.namprd11.prod.outlook.com (2603:10b6:301:5b::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.15; Tue, 2 Nov 2021 06:11:43 +0000 Received: from CO1PR11MB4945.namprd11.prod.outlook.com ([fe80::496e:9075:27c3:25f5]) by CO1PR11MB4945.namprd11.prod.outlook.com ([fe80::496e:9075:27c3:25f5%2]) with mapi id 15.20.4649.020; Tue, 2 Nov 2021 06:11:43 +0000 From: "Wang, Jian J" To: "devel@edk2.groups.io" , "Yang, Jie" CC: "Jiang, Guomin" , "gaoliming@byosoft.com.cn" Subject: Re: [edk2-devel][PATCH v4] MdeModulePkg/DxeCapsuleLibFmp: Use new Variable Lock interface Thread-Topic: [edk2-devel][PATCH v4] MdeModulePkg/DxeCapsuleLibFmp: Use new Variable Lock interface Thread-Index: AQHXzHKKauCkoWWjAkuJEtFj5QZ/lKvvx4iA Date: Tue, 2 Nov 2021 06:11:43 +0000 Message-ID: References: <20211029031017.1284-1-jie.yang@intel.com> In-Reply-To: <20211029031017.1284-1-jie.yang@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-reaction: no-action dlp-version: 11.6.200.16 dlp-product: dlpe-windows authentication-results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 7674ecd4-cc34-4a33-08bd-08d99dc7a4b2 x-ms-traffictypediagnostic: MWHPR1101MB2190: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: wxTH0M0Xjx+3OrH3R7EzK0XMywo1N3mfmuMR/ZRx5wI1AN0wnXFChlGmMzaITDbvR3nvDjiuHZ1mcaGJnBdNDFmUjJIW/eo4a3gnHHh79qzVQ2KHVSfptwIKkwQbtAmdRD2GAXDcnK0LkWFq4hSjliQEg/YAdvKkFNn5Vfc/GHuvSKB0XqK8OE9i2GrBuLb/t9gx9Yj4x/xPsShS/c2QM2t+D4Qk2f0l2rijpv6nFFO/79RHJ8FDNDoZxbbT86zeHo31PRC5Tu5kMALV3gptK2uwKujuqI4ctM1LO+5DueFEbfgr4AnaryubMsWpD7Kx1UA2U9piNOVzZ6UILLehGCl8JcpEzwum9jIpaLKN3Ta+GDzHOqqwyNosBSvD/wCcw+BXCVPN9tSekG1CYBxd/ixlRrDOk7e65QzOurK2yxOa4s+ljb2dAm73Mpe1UvWjb0cafVQPA90N7M/TfgOXdLntI70D0fahTGU7E82WLhSo4W5lHxoKlFd4scxZzhkaRtfYVuqB4C+fhFkWGJRV5UNiG4MYJbxgy3nizFgJzN9Ka04UfFu5z76KSFdTZ+6iS7uHugCzXpktD4FLAZXj2jkedg9VhJTA7g+KRN8r+CNwP51pCYyIFinoR2xa4bnChRpnlymoIMwtNTwYO0Mj0556lO/2XOfjLaXkgfPGg8ITkDggC/x/zInNcbO1UJ2I3k+lNCoddQYfLtfV7kknqV/WhWzn1oVLkv2KmC09ewj9rzngKoNSR1y4E18YM8GXgU8da3ibtIoR5MlRmV2xjoCFmXpBWSqUx2j+XpHHBOvglsVzEROmDeUrmJtS6gYxvMGCH3yFLu0y8THBFTG4Yw== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CO1PR11MB4945.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(6636002)(86362001)(26005)(33656002)(186003)(2906002)(82960400001)(55016002)(9686003)(8936002)(66946007)(83380400001)(508600001)(316002)(64756008)(966005)(5660300002)(66556008)(66446008)(122000001)(110136005)(38070700005)(52536014)(54906003)(71200400001)(53546011)(8676002)(6506007)(38100700002)(7696005)(76116006)(66476007)(4326008);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?jhrcfDBkLUMSdz6MUAoMX8t6FNVDeDFow6eE1SlutGVronETonhbAzNoyGgd?= =?us-ascii?Q?83qRhQ34tNb8t+s9RpBwIZsi1iSy+vlk5Xz5Quh1IG4DsLy+msVhaYkZ5JX1?= =?us-ascii?Q?R+PNAENcaLnTbFwgrQe4aidxoNxvBR6MNwRRQnwm7Y6QBdDIcznsSKPcV4nD?= =?us-ascii?Q?M37Mef7mtNC0dtqBSXtCPjpOREVNxpk5TgjUaeRvncFw2swccRksVrVf1rq+?= =?us-ascii?Q?DBgX5ODrTy6QA305xdFyKZI2Y7tbLfxtlQ1P+pr/3b+Nywan3JN0Z+M+QD6n?= =?us-ascii?Q?XB+pQ2CbdQ4WT/799CQB2iAJrmZqTAdYmwk0k1BEl/cbEuPo+pNdnJzbv/a1?= =?us-ascii?Q?imG7NDca3EPAf1HDJ/+0kIfg5+QS1Wc+QQ4m/LKPDDIlmyeKRXUSp9BQv6mH?= =?us-ascii?Q?3mAS9mi4iO8/7PlFz8al1bum4eyiAUDZHImF3DPv2cOIXVLCUK0tOVqn55ZC?= =?us-ascii?Q?F10J8Wev2FMtcV5z5eOHBfcWMuchGCy/XQieiqwM4vpG93hFBcqhsBTPEkF3?= =?us-ascii?Q?XklnCZgFDwfnzSEo6vcweFdjsEO07g0bU3rmwPVlySfPKqNcrXd9DoTJWwut?= =?us-ascii?Q?YAd7F6ckoQQaywuadiQpbi/8sCLxttnWkUXfOM591/8Lo5m0KVASipD/TBz0?= =?us-ascii?Q?4owWCXShm4mViqucNrATHHn3LXamhp8u/AJjwhvU0TjuhHhzuQKFCr08c0cX?= =?us-ascii?Q?PBILJFVUobZ47OnDxSrTkF8Feaj9/9LwgJAymGdEyq+Un8vatE7fw+eggWhU?= =?us-ascii?Q?4kA9rq8gtV5I0U/BfjIM//LX6bZpyB5fLBK4pnQp0Njmv4arXrO3Ilqy5oDZ?= =?us-ascii?Q?QdX2qKD0IVAoxTgzaw/BxqKrAHgSJj6/PDsrnheBqYavo5ALTGN8wHUlkQCF?= =?us-ascii?Q?fBlAH9CAHm5hWpG6eGv9jhQ9vWONKu7DsJApAN3q55Gl/PcZjc15JN/WCymu?= =?us-ascii?Q?Ojv11xF75iMTaTiUWs5XfgBQoQELaldh5xWOLZJCzFxgiLkiYv7GN/HmPZj8?= =?us-ascii?Q?0vqtuNw63HqWP5rLfbZ1iOjzXxU7w/E2zpnIsKDkigNOvPU0N2Z3RMKdgiC4?= =?us-ascii?Q?cz3Ym4Fy/0zh5wdnSRou4iShpcCUyxnSlX4VUkuqZirtsVeRqXXlMIgn/tUG?= =?us-ascii?Q?RmfGG68OFhZfj2M6etn+Zm22OQNs1r4gIuJqJL+lq+CojxGkC4Z4vXymarD0?= =?us-ascii?Q?PmqNY/JMjqE4y5EXFnUikWcYToJ9A6GbrsfLVgvRyT0ZO0BUAWYgoQRmxwrd?= =?us-ascii?Q?yMYnebo3/gsGEl2VN5GIC5KqwN1JC0/XKTwUkVaFQnxRaQb0o0XdQAVs5Gk3?= =?us-ascii?Q?HmqkZ8BIgOvScD7+pILYmj55YwYBcDkzmk6iXABh0Kl/3gxnV4H/Ae77PN9l?= =?us-ascii?Q?nVh2MITcZgimHJw7kLa6wRue0MtK5kXflpO4EEqnzg2f7ZPhefLTRRFG4bOe?= =?us-ascii?Q?EL54cVdrLYEMKvNtx4G+GpLxXUVfnus2Wd5UnQOIcJoF3vV0Isvde4CHKK6a?= =?us-ascii?Q?QxVbVhrKRfxUrQJnQWvfwxNn8S6di+pH+J0pVWk+/8vvldAfpY2HA5WHH0Er?= =?us-ascii?Q?FiSv7p7k1PitSWd3MMXFQlgfDRPf4zxFd2vm5XYysoihfonlHnvwDiXcrjPy?= =?us-ascii?Q?eisGYTZTUhCBvcd32C+iG3k=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CO1PR11MB4945.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7674ecd4-cc34-4a33-08bd-08d99dc7a4b2 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Nov 2021 06:11:43.5863 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: SnkMcAl6w3Zkzsl5Dk0RE3hZjgdYF1DKqDZb9jEJBLdpZfocqsRSRiDQmjcfyrTNWW9u0ryJkshsX4/EfwQx7g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR1101MB2190 Return-Path: jian.j.wang@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Just a format issue (see inline comment). With it addressed, Reviewed-by: Jian J Wang Regards, Jian > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Yang Jie > Sent: Friday, October 29, 2021 11:10 AM > To: devel@edk2.groups.io > Cc: Wang, Jian J ; Jiang, Guomin > ; gaoliming@byosoft.com.cn; Yang, Jie > > Subject: [edk2-devel][PATCH v4] MdeModulePkg/DxeCapsuleLibFmp: Use new > Variable Lock interface >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3699 > The code in MdeModulePkg\Library\DxeCapsuleLibFmp call the deprecated > interface VariableLockRequestToLock.c. So I changed the code in > FmpDevicePkg using RegisterBasicVariablePolicy, instead of the > deprecated interface. >=20 > Signed-off-by: Yang Jie > Cc: Guomin Jiang > Cc: Liming Gao > Cc: Jian J Wang > --- > .../DxeCapsuleLibFmp/DxeCapsuleLib.inf | 5 +- > .../DxeCapsuleLibFmp/DxeCapsuleReportLib.c | 87 +++++++++++++------ > 2 files changed, 62 insertions(+), 30 deletions(-) >=20 > diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf > b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf > index 05de4299fb..9212c81d68 100644 > --- a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf > +++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf > @@ -3,7 +3,7 @@ > # >=20 > # Capsule library instance for DXE_DRIVER module types. >=20 > # >=20 > -# Copyright (c) 2016 - 2019, Intel Corporation. All rights reserved. >=20 > +# Copyright (c) 2016 - 2021, Intel Corporation. All rights reserved. >=20 > # SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > # >=20 > ## >=20 > @@ -51,6 +51,7 @@ > DisplayUpdateProgressLib >=20 > FileHandleLib >=20 > UefiBootManagerLib >=20 > + VariablePolicyHelperLib >=20 >=20 >=20 > [Pcd] >=20 > gEfiMdeModulePkgTokenSpaceGuid.PcdCapsuleMax = ## > CONSUMES >=20 > @@ -71,11 +72,11 @@ > [Protocols] >=20 > gEsrtManagementProtocolGuid ## CONSUMES >=20 > gEfiFirmwareManagementProtocolGuid ## CONSUMES >=20 > - gEdkiiVariableLockProtocolGuid ## SOMETIMES_CONSUMES >=20 > gEdkiiFirmwareManagementProgressProtocolGuid ## > SOMETIMES_CONSUMES >=20 > gEfiSimpleFileSystemProtocolGuid ## SOMETIMES_CONSUMES >=20 > gEfiBlockIoProtocolGuid ## CONSUMES >=20 > gEfiDiskIoProtocolGuid ## CONSUMES >=20 > + gEdkiiVariablePolicyProtocolGuid ## CONSUMES >=20 >=20 >=20 > [Guids] >=20 > gEfiFmpCapsuleGuid ## SOMETIMES_CONSUMES ## GUID >=20 > diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLib.c > b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLib.c > index 0ec5f20676..d90f131879 100644 > --- a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLib.c > +++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLib.c > @@ -1,14 +1,13 @@ > /** @file >=20 > DXE capsule report related function. >=20 >=20 >=20 > - Copyright (c) 2016 - 2019, Intel Corporation. All rights reserved.
>=20 > + Copyright (c) 2016 - 2021, Intel Corporation. All rights reserved.
>=20 > SPDX-License-Identifier: BSD-2-Clause-Patent >=20 >=20 >=20 > **/ >=20 >=20 >=20 > #include >=20 > #include >=20 > -#include >=20 > #include >=20 > #include >=20 > #include >=20 > @@ -26,6 +25,7 @@ > #include >=20 > #include >=20 > #include >=20 > +#include >=20 >=20 >=20 > #include >=20 >=20 >=20 > @@ -94,6 +94,39 @@ GetNewCapsuleResultIndex ( > return CurrentIndex + 1; >=20 > } >=20 >=20 >=20 > +/** >=20 > + Lock Variable by variable policy >=20 > + >=20 > + @param[in] VariableGuid The Guid of the variable to be locked >=20 > + @param[in] VariableName The name of the variable to be locked >=20 > + @param[in] VariablePolicy The pointer of variable lock policy >=20 > +**/ >=20 > +VOID LockVaraible ( >=20 > + IN CONST EFI_GUID VariableGuid, >=20 > + IN CHAR16 *VariableName, >=20 > + IN EDKII_VARIABLE_POLICY_PROTOCOL *VariablePolicy >=20 The alignment in above lines are not correct (four spaces, should be two sp= aces here). > + ) >=20 > +{ >=20 > + EFI_STATUS Status; >=20 > + >=20 > + // Set the policies to protect the target variables >=20 > + Status =3D RegisterBasicVariablePolicy (VariablePolicy, >=20 > + &VariableGuid, >=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, "DxeCapsuleLibFmp: Failed to lock variable %g %= s. > Status =3D %r\n", >=20 > + &VariableGuid, >=20 > + VariableName, >=20 > + Status)); >=20 > + ASSERT_EFI_ERROR (Status); >=20 > + } >=20 > +} >=20 > + >=20 > /** >=20 > Write a new capsule status variable. >=20 >=20 >=20 > @@ -269,16 +302,17 @@ RecordFmpCapsuleStatusVariable ( >=20 >=20 > /** >=20 > Initialize CapsuleMax variables. >=20 > + >=20 > + @param[in] VariablePolicy The pointer of variable lock policy >=20 > **/ >=20 > VOID >=20 > InitCapsuleMaxVariable ( >=20 > - VOID >=20 > + EDKII_VARIABLE_POLICY_PROTOCOL *VariablePolicy >=20 > ) >=20 > { >=20 > EFI_STATUS Status; >=20 > UINTN Size; >=20 > CHAR16 CapsuleMaxStr[sizeof("Capsule####")]; >=20 > - EDKII_VARIABLE_LOCK_PROTOCOL *VariableLock; >=20 >=20 >=20 > UnicodeSPrint( >=20 > CapsuleMaxStr, >=20 > @@ -297,25 +331,22 @@ InitCapsuleMaxVariable ( > ); >=20 > if (!EFI_ERROR(Status)) { >=20 > // Lock it per UEFI spec. >=20 > - Status =3D gBS->LocateProtocol(&gEdkiiVariableLockProtocolGuid, NULL= , > (VOID **)&VariableLock); >=20 > - if (!EFI_ERROR(Status)) { >=20 > - Status =3D VariableLock->RequestToLock(VariableLock, L"CapsuleMax"= , > &gEfiCapsuleReportGuid); >=20 > - ASSERT_EFI_ERROR(Status); >=20 > - } >=20 > + LockVaraible (gEfiCapsuleReportGuid, L"CapsuleMax", VariablePolicy); >=20 > } >=20 > } >=20 >=20 >=20 > /** >=20 > Initialize CapsuleLast variables. >=20 > + >=20 > + @param[in] VariablePolicy The pointer of variable lock policy >=20 > **/ >=20 > VOID >=20 > InitCapsuleLastVariable ( >=20 > - VOID >=20 > + EDKII_VARIABLE_POLICY_PROTOCOL *VariablePolicy >=20 > ) >=20 > { >=20 > EFI_STATUS Status; >=20 > EFI_BOOT_MODE BootMode; >=20 > - EDKII_VARIABLE_LOCK_PROTOCOL *VariableLock; >=20 > VOID *CapsuleResult; >=20 > UINTN Size; >=20 > CHAR16 CapsuleLastStr[sizeof("Capsule####")]= ; >=20 > @@ -372,11 +403,7 @@ InitCapsuleLastVariable ( > } >=20 >=20 >=20 > // Lock it in normal boot path per UEFI spec. >=20 > - Status =3D gBS->LocateProtocol(&gEdkiiVariableLockProtocolGuid, NULL= , > (VOID **)&VariableLock); >=20 > - if (!EFI_ERROR(Status)) { >=20 > - Status =3D VariableLock->RequestToLock(VariableLock, L"CapsuleLast= ", > &gEfiCapsuleReportGuid); >=20 > - ASSERT_EFI_ERROR(Status); >=20 > - } >=20 > + LockVaraible (gEfiCapsuleReportGuid, L"CapsuleLast", VariablePolicy)= ; >=20 > } >=20 > } >=20 >=20 >=20 > @@ -430,26 +457,21 @@ InitCapsuleUpdateVariable ( >=20 >=20 > /** >=20 > Initialize capsule relocation info variable. >=20 > + >=20 > + @param[in] VariablePolicy The pointer of variable lock policy >=20 > **/ >=20 > VOID >=20 > InitCapsuleRelocationInfo ( >=20 > - VOID >=20 > + EDKII_VARIABLE_POLICY_PROTOCOL *VariablePolicy >=20 > ) >=20 > { >=20 > - EFI_STATUS Status; >=20 > - EDKII_VARIABLE_LOCK_PROTOCOL *VariableLock; >=20 > - >=20 > CoDClearCapsuleRelocationInfo(); >=20 >=20 >=20 > // >=20 > // Unlock Capsule On Disk relocation Info variable only when Capsule O= n Disk > flag is enabled >=20 > // >=20 > if (!CoDCheckCapsuleOnDiskFlag()) { >=20 > - Status =3D gBS->LocateProtocol (&gEdkiiVariableLockProtocolGuid, NUL= L, > (VOID **) &VariableLock); >=20 > - if (!EFI_ERROR (Status)) { >=20 > - Status =3D VariableLock->RequestToLock (VariableLock, > COD_RELOCATION_INFO_VAR_NAME, &gEfiCapsuleVendorGuid); >=20 > - ASSERT_EFI_ERROR (Status); >=20 > - } >=20 > + LockVaraible (gEfiCapsuleVendorGuid, COD_RELOCATION_INFO_VAR_NAME, > VariablePolicy); >=20 > } >=20 > } >=20 >=20 >=20 > @@ -461,10 +483,19 @@ InitCapsuleVariable ( > VOID >=20 > ) >=20 > { >=20 > + EFI_STATUS Status; >=20 > + EDKII_VARIABLE_POLICY_PROTOCOL *VariablePolicy; >=20 > + >=20 > + // Locate the VariablePolicy protocol >=20 > + Status =3D gBS->LocateProtocol (&gEdkiiVariablePolicyProtocolGuid, NUL= L, > (VOID**)&VariablePolicy); >=20 > + if (EFI_ERROR (Status)) { >=20 > + DEBUG ((DEBUG_ERROR, "DxeCapsuleReportLib %a - Could not locate > VariablePolicy protocol! %r\n", __FUNCTION__, Status)); >=20 > + ASSERT_EFI_ERROR (Status); >=20 > + } >=20 > InitCapsuleUpdateVariable(); >=20 > - InitCapsuleMaxVariable(); >=20 > - InitCapsuleLastVariable(); >=20 > - InitCapsuleRelocationInfo(); >=20 > + InitCapsuleMaxVariable (VariablePolicy); >=20 > + InitCapsuleLastVariable (VariablePolicy); >=20 > + InitCapsuleRelocationInfo (VariablePolicy); >=20 >=20 >=20 > // >=20 > // No need to clear L"Capsule####", because OS/APP should refer > L"CapsuleLast" >=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 (#82904): https://edk2.groups.io/g/devel/message/82904 > Mute This Topic: https://groups.io/mt/86669161/1768734 > Group Owner: devel+owner@edk2.groups.io > Unsubscribe: https://edk2.groups.io/g/devel/unsub [jian.j.wang@intel.com] > -=3D-=3D-=3D-=3D-=3D-=3D >=20