From nobody Wed May 1 23:17:41 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+82359+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 16346598496683.2887865917326735; Tue, 19 Oct 2021 09:10:49 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id R7VxYY1788612xH1J6pyWbXE; Tue, 19 Oct 2021 09:10:49 -0700 X-Received: from NAM04-MW2-obe.outbound.protection.outlook.com (NAM04-MW2-obe.outbound.protection.outlook.com [40.107.101.83]) by mx.groups.io with SMTP id smtpd.web11.11904.1634659848267426694 for ; Tue, 19 Oct 2021 09:10:48 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NdWFINjm7doxTQaQPyhBAr8nQPCZ/zcwSt2eOMAD6ufZnLg5dgslSMU0lQeMiNNyzu7ZjYC6HbMIPg1kHg0DIY3updL6duurbeC/7+NLHrvqhRe1MVIxRiQTBteil9my1Qsgsv0ejum4f7ntt0BxDpr2yzrAJn86xPHsW2NEAs9h8qBLAHLoZKtqnCaXfk/CBqkkOotTofc7b1fonV1a4y33eVWSTM2vrubACREBnw/PSiLvUDbXdQKVTvuL71uQ08foKXHrtJ13UwX9NM2wf/dhMi4W7t139Sx/JJDvrIUvtj/uDAkqud9fAiuO/wUIqjkQo6fkljaduTj7knBS7g== 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=2vjc70X4kv3n+t2cPRKOlphAojxuPRGX0QElIEibQYc=; b=V25BdpbFBGNUBFp/VZQOd8WtmTzE4zD5hMXnBg/XqfaLuV+j9X9PMZL1/vJSwLG9W9SIK5aKmfXrK3mjS8OoiqhBQE8pwxRLowTBDEidFVTm4z4hTRSIa4mb6gj5h6k9Uqi8N8y9QIFIo08bPDIp7PulvAYhd069DfxBEn++YctnA6novwxO1woDrOMYr03ZtYYA9/V0BYUr5Epph/fm5WfxOEh7gOALpbWFnnRcBT0mS6oBX9T10cR/WIJPQe7u7X8AgI9Umql8jTZwmEdK+Yg1tWiYJH3RK0fcMEVb4gJV6OlpcVj5NOj0u1k0DT8ahkMErbOIcJ0vciLg5xVapQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.36) smtp.rcpttodomain=byosoft.com.cn 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 BN0PR10CA0012.namprd10.prod.outlook.com (2603:10b6:408:143::10) by MW3PR12MB4473.namprd12.prod.outlook.com (2603:10b6:303:56::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16; Tue, 19 Oct 2021 16:10:45 +0000 X-Received: from BN8NAM11FT035.eop-nam11.prod.protection.outlook.com (2603:10b6:408:143:cafe::8e) by BN0PR10CA0012.outlook.office365.com (2603:10b6:408:143::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.15 via Frontend Transport; Tue, 19 Oct 2021 16:10:45 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.36) smtp.mailfrom=nvidia.com; byosoft.com.cn; dkim=none (message not signed) header.d=none;byosoft.com.cn; 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+82359+1787277+3901457@groups.io; helo=mail02.groups.io; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.36 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.36; helo=mail.nvidia.com; X-Received: from mail.nvidia.com (216.228.112.36) by BN8NAM11FT035.mail.protection.outlook.com (10.13.177.116) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 16:10:44 +0000 X-Received: from HQMAIL107.nvidia.com (172.20.187.13) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 19 Oct 2021 16:10:43 +0000 X-Received: from localhost.localdomain (172.20.187.5) by mail.nvidia.com (172.20.187.13) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Tue, 19 Oct 2021 16:10:43 +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, 19 Oct 2021 10:10:38 -0600 Message-ID: <080edab00472546ae5170e23059b38aaf19de716.1634659687.git.bobm@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6484400d-b2f1-4eeb-5dda-08d9931b0172 X-MS-TrafficTypeDiagnostic: MW3PR12MB4473: X-Microsoft-Antispam-PRVS: X-MS-Exchange-Transport-Forked: True X-MS-Oob-TLC-OOBClassifiers: OLM:83; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: f4aVW/foAOdAuA8EfsPmtg9BVy4z+Ff4nftj0U26snPwDN95j60+fduW1xgAbg/uoij2vglwi1W5BJ82p5hWsrkeIkirn7I5WmmXozSMc5enDtHlpMkwYCIQmEh5BfIoPgGSVNFp2qDuicz2bQy+lr0t/stajDD5uD8CtOBuOXwcYnLjsHviqFlM+6YL+lyhMXhV9wyspR9m3pJSmrrOSiXFHC69O7BWi52U/OFkBArSQFkOV5WGaosIFwL99eERPGXNTot3iQDQU02L56JUiKDfBfUXF+AdsFWnrfQ7ACrs7QEkl1Y8OMFjNKufOetW7Wg4dPUOorl0/BdwFWV55O0s3AKYperyWLEYJ417dRjzUpwzbCcNyAjNl4L6LDi4SJphRPGTG45VncHgukzKsVcq2gIeaF6nuCDdcWKAphilVA2QWteeeP9VMYt/Nxc18/PUt7jFtY2pTNaUF4JeU99HIguubLlAyYLIVT5+YDhk35hAVTJhHfh7oxBOrYsraABzkoZNErtZXaAVl9bCVS3CCzRcvW68ITMmn5ZywqhjUARNHwoAbcH/UQQD6I8z3xaK3kG4PneHZqApa6LXsyoLaxssAuQfmAh1g1QC0omTb1er0sUbYOnmC6LOatoNnb5uON6moCOvPAJrHQmUIwXGzJk47Jtz+1kzb2DadtCWRDfLGCB4yBji+5v5/dq3CKL1Fh0UsjlH5DcrizNVTw== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 16:10:44.5629 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6484400d-b2f1-4eeb-5dda-08d9931b0172 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.36];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT035.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4473 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: HzSFQYTn8ujVxBwgUySVzmWnx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1634659849; bh=NiwwBozAVH3JTfIMDIWGchTB3Oz37hdTZoZqSumdNEQ=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=AFTFRp/vroPE4FLxiQp1u+d9rmPES1jyopqOoX1wV93IqxtpezFZPp3yrBR0G9ENF2I llulAIxRDn8iYZw0B2WSXSrXdrHgSlNr3zzRMRtmLZIvz4QwKav6At1OgH+pclbjkTXL5 N4HOSz9Ge+JGLvX3MRBRiGunMxnw67Jvrt4= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1634659852059100001 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 --- .../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..e65e335585 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 BuildSg; + } + 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); +BuildSg: + 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 (#82359): https://edk2.groups.io/g/devel/message/82359 Mute This Topic: https://groups.io/mt/86443578/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-