From nobody Mon Feb 9 16:34:44 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+59475+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+59475+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1589409637; cv=none; d=zohomail.com; s=zohoarc; b=oB/AeVdcGSBiXdGoIgAE13wSwjYk9C7u9OOD5cONI4WHl/ZDu9EJrTz8LLn5TLj/H2yH4fxnOxsibq8tH9j96tphw0tioT+G7l2AciPPqHn1Q/Rbo16BJjdeQGDJCFtqwluycDEB+1TSgXM/pekz7KK99RXzNiSncmAH7NObvFM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589409637; h=Content-Type:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=I/w4GlFZ2VkK0N2Yg691EpO+MqJUG75elzjffAyPvwg=; b=GYWFVgNKp1PeaIOy4CjRdfBx3bhY+pxdNxAy8mBtVt+803WHewyWDmpjvNnrWGML88MwS1BZbq0Skds1ZoxWyK4K2kBAzcIjZIwY1+wThNeIRsoHWLLLkwyWTmRlPUZCF3yCjJGeAxCT8BKTKCh1Ep7TO31009BoWbPNrYmAl+w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+59475+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1589409637402162.5791546933749; Wed, 13 May 2020 15:40:37 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id aDerYY1788612xbPlAFf6beO; Wed, 13 May 2020 15:40:37 -0700 X-Received: from atlmailgw1.ami.com (atlmailgw1.ami.com []) by mx.groups.io with SMTP id smtpd.web10.1805.1589409633621215795 for ; Wed, 13 May 2020 15:40:36 -0700 X-AuditID: ac1060b2-0e1ff700000018d4-99-5ebc77639752 X-Received: from atlms1.us.megatrends.com (atlms1.us.megatrends.com [172.16.96.144]) (using TLS with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (Client did not present a certificate) by atlmailgw1.ami.com (Symantec Messaging Gateway) with SMTP id 11.45.06356.3677CBE5; Wed, 13 May 2020 18:40:36 -0400 (EDT) X-Received: from Oleksiy77.us.megatrends.com (172.16.97.158) by atlms1.us.megatrends.com (172.16.96.144) with Microsoft SMTP Server id 14.3.468.0; Wed, 13 May 2020 18:39:53 -0400 From: "Oleksiy Yakovlev" To: CC: , , , , , , , Subject: [edk2-devel] [PATCH V6 5/6] MdeModulePkg: Add FMP Capsule Image Header extension Date: Wed, 13 May 2020 18:39:46 -0400 Message-ID: <20200513223947.56560-6-oleksiyy@ami.com> In-Reply-To: <20200513223947.56560-1-oleksiyy@ami.com> References: <20200513223947.56560-1-oleksiyy@ami.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrIIsWRmVeSWpSXmKPExsWyRiBhgm5K+Z44g45LrBbz31ZbtE+YzWZx 9dYvJot532awWqz76GGx4t4GdouOjn9MDuwe279fYPRYvOclUwBTVAOjTWJeXn5JYkmqQkpq cbKtUkBRZllicqWSQmaKrZKhkkJBTmJyam5qXomtUmJBQWpeipIdlwIGsAEqy8xTSM1Lzk/J zEu3VfIM9te1sDC11DVUsgvJSFXIzEvLL8pNLMnMz1NIzs8rAapOTQGKKiR0c2Z8P7SasWCJ ZsWCPZOYGxh3KXUxcnJICJhIdE45ytTFyMUhJLCLSWLr34fMIAkhgS2MEjev6IPYbAKaEgeO TWEEsUUEpCSmHJjJBGIzCxxmlOj4BBYXFvCReL3gMBuIzSKgKrHi7wawObwCphLt5y8xQyzT kJi25i5YL6eAmcSmBb0sELtMJba+OMoOUS8ocXLmExaI+RISB1+8gLpHVqLt+HP2CYz8s5CU zUJStoCRaRWjUGJJTm5iZk56uaFeYm6mXnJ+7iZGSPxt2sHYctH8ECMTB+MhRgkOZiURXr/1 u+OEeFMSK6tSi/Lji0pzUosPMToBPTCRWYobFIDAGIk3NjCQEoVxDE3MTMyNzA0tTcyNjZXE eSevXRMnJJAOjNns1NSC1CKYIUwcnFINjOY/Q9b/eXrJfiLf+YMMEzL3if6NcdS1mz9pTtxj 2V6LAueLn+dJfQ5UaLBu39tT0el5Qv/Xn4ubs65ean4cuv+63uRsw6aevLlvmj3XPLJjvfhm jXDGte/hLsKP+6trL/zcKar1V2CrZrGz4Jplsb/tQk5teiB0yUUnxP3mUsVJ5WpV/OLzC5VY ijMSDbWYi4oTAVT8OnjUAgAA Precedence: Bulk List-Unsubscribe: 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,oleksiyy@ami.com X-Gm-Message-State: LjNEtmKCRd7bLrFMPiHnFmQ4x1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1589409637; bh=jOTJaTjFqeTtBY/42Mky78CKGIVJFi0AgtSD6n7VjpM=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=TQfZC+yLFlR7nPZ1Aj7f9PJSQaUmsbwlN8bNjZAW9YU93IcHcDghy7p/acM3owu3Vw9 AF67PM9sgzYhLskdLLGFR7jnvAzeNdbIO3Dc167w/Mt2Tp2iMV+nvdeT7ZwEXt9gZogwr /ydvqGZTa3WBbK++a9s84sRJoU1TXdhlZq8= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add bitmask to structure which gives a binary-inspectable mechanism to determine if a capsule contains an authentication section or depex section. (UEFI 2.8 errata a, mantis 2026) Signed-off-by: Oleksiy Yakovlev Reviewed-by: Wei6 Xu --- MdeModulePkg/Application/CapsuleApp/CapsuleDump.c | 7 ++++-- .../Library/DxeCapsuleLibFmp/DxeCapsuleLib.c | 26 +++++++++++++++++-= ---- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/MdeModulePkg/Application/CapsuleApp/CapsuleDump.c b/MdeModuleP= kg/Application/CapsuleApp/CapsuleDump.c index 7e3e072..057bfa8 100644 --- a/MdeModulePkg/Application/CapsuleApp/CapsuleDump.c +++ b/MdeModulePkg/Application/CapsuleApp/CapsuleDump.c @@ -96,8 +96,11 @@ DumpFmpCapsule ( Print(L" UpdateImageIndex - 0x%x\n", FmpImageHeader->UpdateImag= eIndex); Print(L" UpdateImageSize - 0x%x\n", FmpImageHeader->UpdateImag= eSize); Print(L" UpdateVendorCodeSize - 0x%x\n", FmpImageHeader->UpdateVend= orCodeSize); - if (FmpImageHeader->Version >=3D EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE= _HEADER_INIT_VERSION) { - Print(L" UpdateHardwareInstance - 0x%lx\n", FmpImageHeader->UpdateH= ardwareInstance); + if (ImageHeader->Version >=3D 1) { + DEBUG((DEBUG_VERBOSE, " UpdateHardwareInstance - 0x%lx\n", ImageHea= der->UpdateHardwareInstance)); + if (ImageHeader->Version >=3D EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_= HEADER_INIT_VERSION) { + DEBUG((DEBUG_VERBOSE, " ImageCapsuleSupport - 0x%lx\n", ImageH= eader->ImageCapsuleSupport)); + } } } } diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c b/MdeMod= ulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c index 5dda561..68cece6 100644 --- a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c +++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c @@ -285,8 +285,10 @@ ValidateFmpCapsule ( DEBUG((DEBUG_ERROR, "ImageHeader->Version(0x%x) Unknown\n", ImageHea= der->Version)); return EFI_INVALID_PARAMETER; } - if (ImageHeader->Version < EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADE= R_INIT_VERSION) { + if (ImageHeader->Version =3D=3D 1) { FmpImageHeaderSize =3D OFFSET_OF(EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMA= GE_HEADER, UpdateHardwareInstance); + } else { + FmpImageHeaderSize =3D OFFSET_OF(EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMA= GE_HEADER, ImageCapsuleSupport); } if (FmpImageSize < FmpImageHeaderSize) { DEBUG((DEBUG_ERROR, "FmpImageSize(0x%lx) < FmpImageHeaderSize(0x%x)\= n", FmpImageSize, FmpImageHeaderSize)); @@ -519,8 +521,11 @@ DumpFmpCapsule ( DEBUG((DEBUG_VERBOSE, " UpdateImageIndex - 0x%x\n", ImageHead= er->UpdateImageIndex)); DEBUG((DEBUG_VERBOSE, " UpdateImageSize - 0x%x\n", ImageHead= er->UpdateImageSize)); DEBUG((DEBUG_VERBOSE, " UpdateVendorCodeSize - 0x%x\n", ImageHead= er->UpdateVendorCodeSize)); - if (ImageHeader->Version >=3D EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HE= ADER_INIT_VERSION) { - DEBUG((DEBUG_VERBOSE, " UpdateHardwareInstance - 0x%lx\n", ImageH= eader->UpdateHardwareInstance)); + if (ImageHeader->Version >=3D 1) { + DEBUG((DEBUG_INFO, "(UpdateHardwareInstance - 0x%x)", ImageHeader->U= pdateHardwareInstance)); + if (ImageHeader->Version >=3D EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_= HEADER_INIT_VERSION) { + DEBUG((DEBUG_INFO, "(ImageCapsuleSupport - 0x%x)", ImageHeader->I= mageCapsuleSupport)); + } } } } @@ -928,9 +933,14 @@ SetFmpImageData ( } else { // // If the EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER is version 1, - // Header should exclude UpdateHardwareInstance field + // Header should exclude UpdateHardwareInstance field, and + // ImageCapsuleSupport field if version is 2. // - Image =3D (UINT8 *)ImageHeader + OFFSET_OF(EFI_FIRMWARE_MANAGEMENT_CAP= SULE_IMAGE_HEADER, UpdateHardwareInstance); + if (ImageHeader->Version =3D=3D 1) { + Image =3D (UINT8 *)ImageHeader + OFFSET_OF(EFI_FIRMWARE_MANAGEMENT_C= APSULE_IMAGE_HEADER, UpdateHardwareInstance); + } else { + Image =3D (UINT8 *)ImageHeader + OFFSET_OF(EFI_FIRMWARE_MANAGEMENT_C= APSULE_IMAGE_HEADER, ImageCapsuleSupport); + } } =20 if (ImageHeader->UpdateVendorCodeSize =3D=3D 0) { @@ -945,6 +955,7 @@ SetFmpImageData ( DEBUG((DEBUG_INFO, "ImageIndex - 0x%x ", ImageHeader->UpdateImageIndex)); if (ImageHeader->Version >=3D EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEAD= ER_INIT_VERSION) { DEBUG((DEBUG_INFO, "(UpdateHardwareInstance - 0x%x)", ImageHeader->Upd= ateHardwareInstance)); + DEBUG((DEBUG_INFO, "(ImageCapsuleSupport - 0x%x)", ImageHeader->ImageC= apsuleSupport)); } DEBUG((DEBUG_INFO, "\n")); =20 @@ -1239,7 +1250,10 @@ ProcessFmpCapsuleImage ( ImageHeader =3D (EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER *)((UIN= T8 *)FmpCapsuleHeader + ItemOffsetList[Index]); =20 UpdateHardwareInstance =3D 0; - if (ImageHeader->Version >=3D EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HE= ADER_INIT_VERSION) { + /// + /// UpdateHardwareInstance field was added in Version 2 + /// + if (ImageHeader->Version >=3D 2) { UpdateHardwareInstance =3D ImageHeader->UpdateHardwareInstance; } =20 --=20 2.9.0.windows.1 Please consider the environment before printing this email. The information contained in this message may be confidential and proprieta= ry to American Megatrends (AMI). This communication is intended to be read= only by the individual or entity to whom it is addressed or by their desig= nee. If the reader of this message is not the intended recipient, you are o= n notice that any distribution of this message, in any form, is strictly pr= ohibited. Please promptly notify the sender by reply e-mail or by telephon= e at 770-246-8600, and then delete or destroy all copies of the transmissio= n. -=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 (#59475): https://edk2.groups.io/g/devel/message/59475 Mute This Topic: https://groups.io/mt/74193809/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-