From nobody Mon Apr 29 23:19:00 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+83178+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one); dmarc=pass(p=none dis=none) header.from=groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1635885744147522.8191908982926; Tue, 2 Nov 2021 13:42:24 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id scriYY1788612x8G8pzlHy9y; Tue, 02 Nov 2021 13:42:23 -0700 X-Received: from NAM10-MW2-obe.outbound.protection.outlook.com (NAM10-MW2-obe.outbound.protection.outlook.com [40.107.94.52]) by mx.groups.io with SMTP id smtpd.web12.1186.1635885742946367977 for ; Tue, 02 Nov 2021 13:42:23 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=P1Ile6SjwykyW9zZH7a3dO8morvB1aFi+5hliuenWFtqEpbxR6Mv5XoBPLnDjJRXcpF8kkkRAaCaxGs1QTKF1SwV0CuxFQuyIKIj7DY4t7l9lWIKWZyQP4xunSnXkz5gMBw+5Yg/wYkmii9tPnYFp84c72JZpeT2e+jLom1QsHNBH3PPSOqi0urTUqEB0bDbJDExWi4SFd09jZU8PKZf//XVVavIjt8g61Uxrs+I8fNh4pOoqeG7eG53zwwE6uJqJLZt3wl5sWw/4gltqAzgJmlzyv5SAMZtWkQ35Y425MBoIDzm7cKP6J1DdxNW5UhpLcI85LlYoV1GZRZd/VV84w== 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=087sQf4pqkT8/nIBggndbtIUXlmVblbL/yEqNVaIwew=; b=Eik0tq2Y4J7ZVUyO2tsq6SEUgXW//fc4A4qwjTlZjyGo14LES5bQvVMRzB5al6AO/zBxjygM6J0glmKQ6XYyWQVHEQk0UKc45/PhL5bxL1e5skWj7PlJYleb0E56l6kDxROeDSmaK2SoHPLwy0zeQ8f50hVI/QGNfdhNhr7F54gool1LPkBBrAkf0Z+Qhbbr5CCPT2dbcKgQiQZZQMMQYCWuJ5wou0ZHZaU93QYM/ZMoXZP/CTXiDW5jBOlAOIJYNt5hkVETgtDbvnN+IAlrfep9np+x5GxbxKgQzphPMiQUmHTasrLVcIke6gMPacQEvlQyfHc1d3ZQuoYC8cZ6Og== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.32) smtp.rcpttodomain=intel.com smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none X-Received: from DM6PR04CA0016.namprd04.prod.outlook.com (2603:10b6:5:334::21) by BL1PR12MB5032.namprd12.prod.outlook.com (2603:10b6:208:30a::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.14; Tue, 2 Nov 2021 20:42:21 +0000 X-Received: from DM6NAM11FT020.eop-nam11.prod.protection.outlook.com (2603:10b6:5:334:cafe::e) by DM6PR04CA0016.outlook.office365.com (2603:10b6:5:334::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.15 via Frontend Transport; Tue, 2 Nov 2021 20:42:21 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.32) smtp.mailfrom=nvidia.com; intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=pass action=none header.from=nvidia.com; Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+83178+1787277+3901457@groups.io; helo=mail02.groups.io; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.32 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.32; helo=mail.nvidia.com; X-Received: from mail.nvidia.com (216.228.112.32) by DM6NAM11FT020.mail.protection.outlook.com (10.13.172.224) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4649.14 via Frontend Transport; Tue, 2 Nov 2021 20:42:20 +0000 X-Received: from HQMAIL105.nvidia.com (172.20.187.12) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 2 Nov 2021 13:42:20 -0700 X-Received: from HQMAIL111.nvidia.com (172.20.187.18) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 2 Nov 2021 20:41:35 +0000 X-Received: from localhost.localdomain (172.20.187.5) by mail.nvidia.com (172.20.187.18) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Tue, 2 Nov 2021 20:41:35 +0000 From: "Bob Morgan via groups.io" To: CC: Bob Morgan , Jian J Wang , "Liming Gao" , Guomin Jiang Subject: [edk2-devel] [PATCH v2] MdeModulePkg/DxeCapsuleLibFmp: Capsule on Disk file name capsule Date: Tue, 2 Nov 2021 14:40:23 -0600 Message-ID: X-NVConfidentiality: public MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: dbd3345c-9a73-486b-0fc0-08d99e414489 X-MS-TrafficTypeDiagnostic: BL1PR12MB5032: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:83; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: m8tz50ECgveGcReD1xdYF9rt1KguKSw/xHzIaMwyJw3QzhFVC9f3UXzEd/RJvm8tj/mTg9xr5VBgYFmn6Mlj5kwyHwkbtnM8jLtByk9ZFT3yQXgeGy0Yj5XSC79DvlJCOFS9FuNH/bmEsMQyIDT5n3MjbSW9pkREkNkVJ1XaKcs94cc69qubVCCHqi2L2hLyPtLkNLDVaoVGfU+PNVADfrCG3W7BKHT8zLWE2u4zEUJuhGR8TO2EAhYNDjiXFpwO3/C8s0pgs8/K/bGs/HmcUUw75oOBppYI6xBovuSofjuOtyZC33FmY9le0f1fVyk+e1GbLJKLjLIU3MMDInfUTYMQKgoJZxjJlhXTZ/sQ/Ci0S34uaiOAxtJAklcjpGdmEWQpCL6uWKj+fxmguZXLqbmSOaLVcdcqX67kmTSAzlLqW8XTGEH4FK3GM1WFjAInCkUYt/AB0mqBnmAM9MQuoMhKOjP+5JQjRsKRLIEoHXKSKcWvq0pxXpEBRYiC0XExqtE3ctdU9dUWuLPh6RXS4xLYWzPIOI5o4xsMxHYhEvdQInLKNbVl/RRBo+ReWosGsaecWtjp6QHSE5pc35rk+YFNbUyGzs3+Xqm7K9YsqzltNGmoiVOKSbyGSJW5GvvMFxHgv//Yx27X3+WnTC3PNjmWTwntZyB5qFNYc2sKEabwhWPtYaQQWcpmlrteQWHcnygqmvcF8dL3CkPuhLhlJw== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Nov 2021 20:42:20.8412 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dbd3345c-9a73-486b-0fc0-08d99e414489 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.112.32];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT020.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5032 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,bobm@nvidia.com X-Gm-Message-State: dnOIQTZ2EhMnajsdV5EYAoBTx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1635885743; bh=JgFu5taunRuT2s/jZFAM38MdsHpFsbP9iINh5fPfkEY=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=GUTXqRoFmNzyG77xs16PclLNx5rZvpcGBSvhVDG1wwMJ/cvKSvPGpOUPlcNnD0T6sYz mswh129levlLJWEwjbsVQkd9r2KyOZRx9kejFTHR3aBVuUabrfh0QMOEKprM0S0aYQFHv dCxwOw9gPVCH/x+/fYX2RmFpmKZ7S3EmRps= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1635885745951100002 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Enhance RelocateCapsuleToRam() to skip creation of the Capsule on Disk file name capsule if PcdSupportUpdateCapsuleReset feature is not enabled. This avoids an EFI_UNSUPPORTED return status from UpdateCapsule() when the file name capsule is encountered and PcdSupportUpdateCapsuleReset is FALSE. Cc: Jian J Wang Cc: Liming Gao Cc: Guomin Jiang Signed-off-by: Bob Morgan Reviewed-by: Liming Gao --- .../Library/DxeCapsuleLibFmp/CapsuleOnDisk.c | 19 ++++++++++++++++--- .../DxeCapsuleLibFmp/DxeCapsuleLib.inf | 3 +++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/CapsuleOnDisk.c b/MdeMod= ulePkg/Library/DxeCapsuleLibFmp/CapsuleOnDisk.c index 4c32c6cdcf..814c5400fe 100644 --- a/MdeModulePkg/Library/DxeCapsuleLibFmp/CapsuleOnDisk.c +++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/CapsuleOnDisk.c @@ -1739,6 +1739,7 @@ RelocateCapsuleToRam ( UINT8 *StringBuf; UINTN StringSize; UINTN TotalStringSize; + UINTN CapsulesToProcess; =20 CapsuleOnDiskBuf =3D NULL; BlockDescriptors =3D NULL; @@ -1778,6 +1779,13 @@ RelocateCapsuleToRam ( TotalStringSize +=3D StrSize (CapsuleOnDiskBuf[Index].FileInfo->FileNa= me); } =20 + // If Persist Across Reset isn't supported, skip the file name strings c= apsule + if (!FeaturePcdGet (PcdSupportUpdateCapsuleReset)) { + CapsulesToProcess =3D CapsuleOnDiskNum; + goto BuildGather; + } + CapsulesToProcess =3D CapsuleOnDiskNum + 1; + FileNameCapsule =3D AllocateZeroPool (sizeof (EFI_CAPSULE_HEADER) + Tota= lStringSize); if (FileNameCapsule =3D=3D NULL) { DEBUG ((DEBUG_ERROR, "Fail to allocate memory for name capsule.\n")); @@ -1804,18 +1812,23 @@ RelocateCapsuleToRam ( // // 3. Build Gather list for the capsules // - Status =3D BuildGatherList (CapsuleBuffer, CapsuleSize, CapsuleOnDiskNum= + 1, &BlockDescriptors); +BuildGather: + Status =3D BuildGatherList (CapsuleBuffer, CapsuleSize, CapsulesToProces= s, &BlockDescriptors); if (EFI_ERROR (Status) || BlockDescriptors =3D=3D NULL) { FreePool (CapsuleBuffer); FreePool (CapsuleSize); - FreePool (FileNameCapsule); + if (FileNameCapsule !=3D NULL) { + FreePool (FileNameCapsule); + } return EFI_OUT_OF_RESOURCES; } =20 // // 4. Call UpdateCapsule() service // - Status =3D gRT->UpdateCapsule((EFI_CAPSULE_HEADER **) CapsuleBuffer, Cap= suleOnDiskNum + 1, (UINTN) BlockDescriptors); + Status =3D gRT->UpdateCapsule ((EFI_CAPSULE_HEADER **) CapsuleBuffer, + CapsulesToProcess, + (UINTN) BlockDescriptors); =20 return Status; } diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf b/MdeM= odulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf index 05de4299fb..4932479d42 100644 --- a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf +++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf @@ -68,6 +68,9 @@ gEfiMdeModulePkgTokenSpaceGuid.PcdCodRelocationDevPath = ## SOMETIMES_CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdCoDRelocationFileName = ## CONSUMES =20 +[FeaturePcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdSupportUpdateCapsuleReset ## CONSUMES + [Protocols] gEsrtManagementProtocolGuid ## CONSUMES gEfiFirmwareManagementProtocolGuid ## CONSUMES --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#83178): https://edk2.groups.io/g/devel/message/83178 Mute This Topic: https://groups.io/mt/86776499/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-