From nobody Mon Nov 25 06:48:59 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+74390+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+74390+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1619177340; cv=none; d=zohomail.com; s=zohoarc; b=JERYJCL4bu87dGPa5qSSs+DqvAcND1Bzvn30ArNpieF2yAUtyRr7viXZfpq3sN1MxnuIZl1IDpRlw8ToH4W71+Xgb1Kb9TXmQ/w/B5mLakJ+D/5W9uF5qPHAJVYt4oJNx42i401h6u6ltffW2wkkPjvJOF6lzRkNMPKUczkSD7g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619177340; h=Cc:Date:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:Message-ID:Reply-To:Sender:Subject:To; bh=3zR4DwGnEVS4ugyvJFF4YN5xcxoEfv66h5PSjUOc3Kw=; b=nIuN0/qkHI0vD/X2b91pOCmJ8Kq/dX4lOnoDnFfJZkjdN+i1+B6lCmdbKbtkuKmtVVmorsBdlOn9qKo89OBEyOMtKN1gHzAdTfZiH8v85WALn9noETeqn0E8RSip89r0912oVjm4IQyrCD0qN6eMP9gEwcztdG5iVI1G2IoQ6X0= 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+74390+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 1619177340246175.37125942333626; Fri, 23 Apr 2021 04:29:00 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id lkHSYY1788612xAEAcAx2M13; Fri, 23 Apr 2021 04:28:59 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web12.8207.1619177334284548304 for ; Fri, 23 Apr 2021 04:28:54 -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 A956F11D4; Fri, 23 Apr 2021 04:28:52 -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 7CFD33F694; Fri, 23 Apr 2021 04:28:51 -0700 (PDT) From: "Sughosh Ganu" To: devel@edk2.groups.io Cc: Michal Simek , Sughosh Ganu Subject: [edk2-devel] [PATCH v2] BaseTools: Add support for version 3 of FMP Image Header structure Date: Fri, 23 Apr 2021 16:58:42 +0530 Message-Id: <20210423112842.10739-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: gSGQdlUanli3J1YvfshgQLL6x1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1619177339; bh=XwjFCF/zY7J8lbIhZP4EXoVhLkphY8s0deMUrWhXmmc=; h=Cc:Date:From:Reply-To:Subject:To; b=NLSTrFou/DJ7U7XY4nhdZJDcFAmBzwDneoQXK8LRVjoml6Wh1/upvXVGrQ5G+7ggtgB L4VugRu+Ak4qh4dp5yJ46iXvKpnMyRRZMIcT5BGVOCcWBkE7hQV+7AevSg4HV7jfhdAf1 OLBkW25a1jKfFx3k0I0gJwQzP2QD2SkHOFU= 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: Michael D Kinney > Reviewed-by: Michael D Kinney --- 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 (#74390): https://edk2.groups.io/g/devel/message/74390 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-