From nobody Fri Apr 19 07:44:40 2024 Delivered-To: importer@patchew.org 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+74349+1787277+3901457@groups.io; helo=mail02.groups.io; 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+74349+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1619077879; cv=none; d=zohomail.com; s=zohoarc; b=iGfkfG/aUbbgJZxfeIaDiTqgo7h1KteXkhVu+hCYIA+PYye3002WlM5m9wYFWCkkey8eDMJNhGOVFyZPhGPsRH4wRbuY48yQaX+QTOMPnS4YyA7wbea7h+kGpuPgSLU0cL8F/+dO4l55Vry0nqsIAF2Mri/fLyENZXSGcd6pEqY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619077879; h=Cc:Date:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:Message-ID:Reply-To:Sender:Subject:To; bh=tawvtnRCcTaNUIv2lxWIGFgnRX5UUtp54bNyE5f0wO0=; b=FhezH8DMQwaQoJdehBbKdrxhhqAc/kWc8CUjQpwG8hPwoxizfUcQ38Hny2kC8eQuHmgb7HagPlYqZv4dDokdceRgfTbKS6I5SAdQTCv9an5dO9iNpukFSTwKbE/+IrXY5+lysg8jlWjkdcdZLd2SG/b6/Lf19YLoe3C8bYQSE5E= ARC-Authentication-Results: i=1; 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+74349+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1619077879305563.7109790032408; Thu, 22 Apr 2021 00:51:19 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 1hB9YY1788612xiCJjk1ISxN; Thu, 22 Apr 2021 00:51:18 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web12.9338.1619077878155972429 for ; Thu, 22 Apr 2021 00:51:18 -0700 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3F35C11D4; Thu, 22 Apr 2021 00:51:17 -0700 (PDT) X-Received: from a076522.blr.arm.com (a076522.blr.arm.com [10.162.16.44]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4063E3F774; Thu, 22 Apr 2021 00:51:15 -0700 (PDT) From: "Sughosh Ganu" To: devel@edk2.groups.io Cc: Michael Kinney , Bob Feng , Liming Gao , Yuwei Chen , Sughosh Ganu Subject: [edk2-devel] [PATCH v2] BaseTools: Add support for version 3 of FMP Image Header structure Date: Thu, 22 Apr 2021 13:20:59 +0530 Message-Id: <20210422075059.26799-1-sughosh.ganu@linaro.org> 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,sughosh.ganu@linaro.org X-Gm-Message-State: s5Pz33Mv1Z5Pid6Ny36WmY34x1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1619077878; bh=N3uexTIBWb5v59Iv/at/FDZVSFVKH22FhNDMYSOtJ+8=; h=Cc:Date:From:Reply-To:Subject:To; b=lH1O/nNvLZiVaXxvON0TP4Zd24Gp9EvxZ1ziFwJL9A2p9whCUsp6KHoD9U7SbUKMAAs bos/Od4Ggixor5boJJ5W65gWRWY1QxJfYkb9TeKdLd6LF/BZRqpXmbuX6acGL0trVE7hr as+eBh316UUmYYs4AGWkmoEFSCMoqUXtcYg= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Add support for the ImageCapsuleSupport field, introduced in version 3 of the EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER structure. This structure member is used to indicate if the corresponding payload has support for authentication and dependency. Signed-off-by: Sughosh Ganu Reviewed-by: Bob Feng --- Changes since v1: - Reword the patch header to get rid of the PatchCheck warning - Make passing of ImageCapsuleSupport parameter to the AddPayload function as an optional parameter to maintain backward compatibility - Declare the values of CAPSULE_SUPPORT_DEPENDENCY and CAPSULE_SUPPORT_AUTHENTICATION in the FmpCapsuleHeaderClass and use those in the GenerateCapsule script .../Source/Python/Capsule/GenerateCapsule.py | 5 +++- .../Common/Uefi/Capsule/FmpCapsuleHeader.py | 28 +++++++++++++------ 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/BaseTools/Source/Python/Capsule/GenerateCapsule.py b/BaseTools= /Source/Python/Capsule/GenerateCapsule.py index a8de988253..b8039db878 100644 --- a/BaseTools/Source/Python/Capsule/GenerateCapsule.py +++ b/BaseTools/Source/Python/Capsule/GenerateCapsule.py @@ -561,6 +561,7 @@ if __name__ =3D=3D '__main__': print ('GenerateCapsule: error:' + str(Msg)) sys.exit (1) for SinglePayloadDescriptor in PayloadDescriptorList: + ImageCapsuleSupport =3D 0x0000000000000000 Result =3D SinglePayloadDescriptor.Payload try: FmpPayloadHeader.FwVersion =3D SinglePayloadD= escriptor.FwVersion @@ -575,6 +576,7 @@ if __name__ =3D=3D '__main__': if SinglePayloadDescriptor.UseDependency: CapsuleDependency.Payload =3D Result CapsuleDependency.DepexExp =3D SinglePayloadDescriptor.Dep= exExp + ImageCapsuleSupport |=3D FmpCapsuleHeader.CAPSULE_S= UPPORT_DEPENDENCY Result =3D CapsuleDependency.Encode () if args.Verbose: CapsuleDependency.DumpInfo () @@ -607,13 +609,14 @@ if __name__ =3D=3D '__main__': FmpAuthHeader.MonotonicCount =3D SinglePayloadDescript= or.MonotonicCount FmpAuthHeader.CertData =3D CertData FmpAuthHeader.Payload =3D Result + ImageCapsuleSupport |=3D FmpCapsuleHeader.CAP= SULE_SUPPORT_AUTHENTICATION Result =3D FmpAuthHeader.Encode () if args.Verbose: FmpAuthHeader.DumpInfo () except: print ('GenerateCapsule: error: can not encode FMP Aut= h Header') sys.exit (1) - FmpCapsuleHeader.AddPayload (SinglePayloadDescriptor.Guid, Res= ult, HardwareInstance =3D SinglePayloadDescriptor.HardwareInstance, UpdateI= mageIndex =3D SinglePayloadDescriptor.UpdateImageIndex) + FmpCapsuleHeader.AddPayload (SinglePayloadDescriptor.Guid, Res= ult, HardwareInstance =3D SinglePayloadDescriptor.HardwareInstance, UpdateI= mageIndex =3D SinglePayloadDescriptor.UpdateImageIndex, CapsuleSupport =3D = ImageCapsuleSupport) try: for EmbeddedDriver in EmbeddedDriverDescriptorList: FmpCapsuleHeader.AddEmbeddedDriver(EmbeddedDriver) diff --git a/BaseTools/Source/Python/Common/Uefi/Capsule/FmpCapsuleHeader.p= y b/BaseTools/Source/Python/Common/Uefi/Capsule/FmpCapsuleHeader.py index 91d24919c4..8abb449c6f 100644 --- a/BaseTools/Source/Python/Common/Uefi/Capsule/FmpCapsuleHeader.py +++ b/BaseTools/Source/Python/Common/Uefi/Capsule/FmpCapsuleHeader.py @@ -47,14 +47,19 @@ class FmpCapsuleImageHeaderClass (object): # /// therefore can be modified without changing the Auth data. # /// # UINT64 UpdateHardwareInstance; + # + # /// + # /// Bits which indicate authentication and depex information for t= he image that follows this structure + # /// + # UINT64 ImageCapsuleSupport # } EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER; # - # #define EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER_INIT_VERSION 0= x00000002 + # #define EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER_INIT_VERSION 0= x00000003 =20 - _StructFormat =3D '=3D len (self._FmpCapsuleImageHeaderList): @@ -198,13 +209,14 @@ class FmpCapsuleHeaderClass (object): self._ItemOffsetList.append (Offset) Offset =3D Offset + len (EmbeddedDriver) Index =3D 1 - for (UpdateImageTypeId, Payload, VendorCodeBytes, HardwareInstance= , UpdateImageIndex) in self._PayloadList: + for (UpdateImageTypeId, Payload, VendorCodeBytes, HardwareInstance= , UpdateImageIndex, CapsuleSupport) in self._PayloadList: FmpCapsuleImageHeader =3D FmpCapsuleImageHeaderClass () FmpCapsuleImageHeader.UpdateImageTypeId =3D UpdateImageTy= peId FmpCapsuleImageHeader.UpdateImageIndex =3D UpdateImageIn= dex FmpCapsuleImageHeader.Payload =3D Payload FmpCapsuleImageHeader.VendorCodeBytes =3D VendorCodeByt= es FmpCapsuleImageHeader.UpdateHardwareInstance =3D HardwareInsta= nce + FmpCapsuleImageHeader.ImageCapsuleSupport =3D CapsuleSupport FmpCapsuleImage =3D FmpCapsuleImageHeader.Encode () FmpCapsuleData =3D FmpCapsuleData + FmpCapsuleImage =20 --=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 (#74349): https://edk2.groups.io/g/devel/message/74349 Mute This Topic: https://groups.io/mt/82280704/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-