From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-io1-f53.google.com (mail-io1-f53.google.com [209.85.166.53]) by mx.groups.io with SMTP id smtpd.web08.10817.1620728485787384793 for ; Tue, 11 May 2021 03:21:26 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=osloqKId; spf=pass (domain: linaro.org, ip: 209.85.166.53, mailfrom: sughosh.ganu@linaro.org) Received: by mail-io1-f53.google.com with SMTP id a11so17640749ioo.0 for ; Tue, 11 May 2021 03:21:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=kXbrgHxkDA/0Xap4DNxERE7kZSt8oo99+iz2SPsWQKI=; b=osloqKId9nU0ouh8hOGeQ1ClQeqtQX6+aDJVElPFxUFlGReKXmt2ybYBeilW47nH/C Rc4leH36TM225C5nV2X30b6eCFGa9toyjVXOY46VERTMlpm32US7/IHlgFG/JQkmV6lM 92ShPxe6H9ME5F6li3iDzsBF9Lx1lZAtlcO4KCN+5KOeXkO6JCIdFEVn2esSVuevJBph yTjkke2UQmvNvSiQ+ho+bRxpnynYM2Yl39ukIz3AWkrKTFMTw8esECzQ8kar8MWApP9t EnSrPEenIs+/9Ub2K+4GaUvgFJMrylgXz9kBQuEZcmes3T0W+0wuBWEW12QJMi3GzfFZ HoaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=kXbrgHxkDA/0Xap4DNxERE7kZSt8oo99+iz2SPsWQKI=; b=gWokLgDNUG0+PsyXFroKuIgwhaYMcn/VkESFgF7pYWoisBMkx0hRMIqGJCqyhWO0Ws gQH6vQc69Ew+Nx2DSBvB5n+F+j61d7/u2k8WjJRyg3AqYDntnpSjPVy26YQT4ahfkVYa T1jbUE9+E2YhBFu8ukHRxNhlyxrdxuR3DT1OCyoNJ8OIHQ/+HoMzLhlsUxEWfLySdCvE lWVsxS145uVd+vzJlSWPj1Ry4Ome4oGfr7SlHLuIDrItNOfc00h4E2OfMrxAn1gF5VOX vChc6emC0kMf5QIgA4YlWzqcD05haqBbEnCKtjIWYJCOflK8hXX6SvxzE9n5t+XiZ3sJ YA+A== X-Gm-Message-State: AOAM533EFfetISIlU0NcxUOVXYyms15Oxoo6xp7rQZZS2LbsirsGFeyY evcBGZPJYRU7sMFN0CQiaaKnrJqhmT9Ycg454xFBMw== X-Google-Smtp-Source: ABdhPJxXP8I4nlPIMGigCuAAycAWsyHjyVg945zJY7W1P+xmXMcO+pqHjjchAgRkq9qA/vwJRz5NfBczemcqEM0iuGA= X-Received: by 2002:a5d:9598:: with SMTP id a24mr21445194ioo.24.1620728485000; Tue, 11 May 2021 03:21:25 -0700 (PDT) MIME-Version: 1.0 References: <20210423112842.10739-1-sughosh.ganu@linaro.org> In-Reply-To: From: "Sughosh Ganu" Date: Tue, 11 May 2021 15:51:13 +0530 Message-ID: Subject: Re: [edk2-devel] [PATCH v2] BaseTools: Add support for version 3 of FMP Image Header structure To: "Kinney, Michael D" , Bob Feng , Liming Gao , Yuwei Chen Cc: "devel@edk2.groups.io" Content-Type: multipart/alternative; boundary="000000000000a055d405c20b4175" --000000000000a055d405c20b4175 Content-Type: text/plain; charset="UTF-8" hi, Can this patch be merged. Thanks. -sughosh On Mon, 26 Apr 2021 at 21:27, Kinney, Michael D wrote: > Reviewed-by: Michael D Kinney > > Mike > > > -----Original Message----- > > From: devel@edk2.groups.io On Behalf Of Sughosh > Ganu > > Sent: Friday, April 23, 2021 4:29 AM > > To: devel@edk2.groups.io > > Cc: Michal Simek ; Sughosh Ganu < > sughosh.ganu@linaro.org> > > Subject: [edk2-devel] [PATCH v2] BaseTools: Add support for version 3 of > FMP Image Header structure > > > > 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 > > --- > > > > 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__ == '__main__': > > print ('GenerateCapsule: error:' + str(Msg)) > > sys.exit (1) > > for SinglePayloadDescriptor in PayloadDescriptorList: > > + ImageCapsuleSupport = 0x0000000000000000 > > Result = SinglePayloadDescriptor.Payload > > try: > > FmpPayloadHeader.FwVersion = > SinglePayloadDescriptor.FwVersion > > @@ -575,6 +576,7 @@ if __name__ == '__main__': > > if SinglePayloadDescriptor.UseDependency: > > CapsuleDependency.Payload = Result > > CapsuleDependency.DepexExp = > SinglePayloadDescriptor.DepexExp > > + ImageCapsuleSupport |= > FmpCapsuleHeader.CAPSULE_SUPPORT_DEPENDENCY > > Result = CapsuleDependency.Encode () > > if args.Verbose: > > CapsuleDependency.DumpInfo () > > @@ -607,13 +609,14 @@ if __name__ == '__main__': > > FmpAuthHeader.MonotonicCount = > SinglePayloadDescriptor.MonotonicCount > > FmpAuthHeader.CertData = CertData > > FmpAuthHeader.Payload = Result > > + ImageCapsuleSupport |= > FmpCapsuleHeader.CAPSULE_SUPPORT_AUTHENTICATION > > Result = FmpAuthHeader.Encode () > > if args.Verbose: > > FmpAuthHeader.DumpInfo () > > except: > > print ('GenerateCapsule: error: can not encode FMP > Auth Header') > > sys.exit (1) > > - FmpCapsuleHeader.AddPayload (SinglePayloadDescriptor.Guid, > Result, HardwareInstance = > > SinglePayloadDescriptor.HardwareInstance, UpdateImageIndex = > SinglePayloadDescriptor.UpdateImageIndex) > > + FmpCapsuleHeader.AddPayload (SinglePayloadDescriptor.Guid, > Result, HardwareInstance = > > SinglePayloadDescriptor.HardwareInstance, UpdateImageIndex = > SinglePayloadDescriptor.UpdateImageIndex, CapsuleSupport = > > ImageCapsuleSupport) > > try: > > for EmbeddedDriver in EmbeddedDriverDescriptorList: > > FmpCapsuleHeader.AddEmbeddedDriver(EmbeddedDriver) > > diff --git > a/BaseTools/Source/Python/Common/Uefi/Capsule/FmpCapsuleHeader.py > > 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 the image that follows this structure > > + # /// > > + # UINT64 ImageCapsuleSupport > > # } EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER; > > # > > - # #define > EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER_INIT_VERSION 0x00000002 > > + # #define > EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER_INIT_VERSION 0x00000003 > > > > - _StructFormat = ' > + _StructFormat = ' > _StructSize = struct.calcsize (_StructFormat) > > > > - EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER_INIT_VERSION = > 0x00000002 > > + EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER_INIT_VERSION = > 0x00000003 > > > > def __init__ (self): > > self._Valid = False > > @@ -64,6 +69,7 @@ class FmpCapsuleImageHeaderClass (object): > > self.UpdateImageSize = 0 > > self.UpdateVendorCodeSize = 0 > > self.UpdateHardwareInstance = 0x0000000000000000 > > + self.ImageCapsuleSupport = 0x0000000000000000 > > self.Payload = b'' > > self.VendorCodeBytes = b'' > > > > @@ -78,7 +84,8 @@ class FmpCapsuleImageHeaderClass (object): > > 0,0,0, > > self.UpdateImageSize, > > self.UpdateVendorCodeSize, > > - self.UpdateHardwareInstance > > + self.UpdateHardwareInstance, > > + self.ImageCapsuleSupport > > ) > > self._Valid = True > > return FmpCapsuleImageHeader + self.Payload + > self.VendorCodeBytes > > @@ -86,7 +93,7 @@ class FmpCapsuleImageHeaderClass (object): > > def Decode (self, Buffer): > > if len (Buffer) < self._StructSize: > > raise ValueError > > - (Version, UpdateImageTypeId, UpdateImageIndex, r0, r1, r2, > UpdateImageSize, UpdateVendorCodeSize, > > UpdateHardwareInstance) = \ > > + (Version, UpdateImageTypeId, UpdateImageIndex, r0, r1, r2, > UpdateImageSize, UpdateVendorCodeSize, > > UpdateHardwareInstance, ImageCapsuleSupport) = \ > > struct.unpack ( > > self._StructFormat, > > Buffer[0:self._StructSize] > > @@ -105,6 +112,7 @@ class FmpCapsuleImageHeaderClass (object): > > self.UpdateImageSize = UpdateImageSize > > self.UpdateVendorCodeSize = UpdateVendorCodeSize > > self.UpdateHardwareInstance = UpdateHardwareInstance > > + self.ImageCapsuleSupport = ImageCapsuleSupport > > self.Payload = > Buffer[self._StructSize:self._StructSize + UpdateImageSize] > > self.VendorCodeBytes = Buffer[self._StructSize + > UpdateImageSize:] > > self._Valid = True > > @@ -119,6 +127,7 @@ class FmpCapsuleImageHeaderClass (object): > > print > ('EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER.UpdateImageSize = > {UpdateImageSize:08X}'.format > > (UpdateImageSize = self.UpdateImageSize)) > > print > ('EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER.UpdateVendorCodeSize = > {UpdateVendorCodeSize:08X}'.format > > (UpdateVendorCodeSize = self.UpdateVendorCodeSize)) > > print > ('EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER.UpdateHardwareInstance = > > {UpdateHardwareInstance:016X}'.format (UpdateHardwareInstance = > self.UpdateHardwareInstance)) > > + print > ('EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER.ImageCapsuleSupport = > {ImageCapsuleSupport:016X}'.format > > (ImageCapsuleSupport = self.ImageCapsuleSupport)) > > print ('sizeof (Payload) > = {Size:08X}'.format (Size = len > > (self.Payload))) > > print ('sizeof (VendorCodeBytes) > = {Size:08X}'.format (Size = len > > (self.VendorCodeBytes))) > > > > @@ -153,6 +162,8 @@ class FmpCapsuleHeaderClass (object): > > _ItemOffsetSize = struct.calcsize (_ItemOffsetFormat) > > > > EFI_FIRMWARE_MANAGEMENT_CAPSULE_HEADER_INIT_VERSION = 0x00000001 > > + CAPSULE_SUPPORT_AUTHENTICATION = 0x0000000000000001 > > + CAPSULE_SUPPORT_DEPENDENCY = 0x0000000000000002 > > > > def __init__ (self): > > self._Valid = False > > @@ -172,8 +183,8 @@ class FmpCapsuleHeaderClass (object): > > raise ValueError > > return self._EmbeddedDriverList[Index] > > > > - def AddPayload (self, UpdateImageTypeId, Payload = b'', > VendorCodeBytes = b'', HardwareInstance = 0, UpdateImageIndex > > = 1): > > - self._PayloadList.append ((UpdateImageTypeId, Payload, > VendorCodeBytes, HardwareInstance, UpdateImageIndex)) > > + def AddPayload (self, UpdateImageTypeId, Payload = b'', > VendorCodeBytes = b'', HardwareInstance = 0, UpdateImageIndex > > = 1, CapsuleSupport = 0): > > + self._PayloadList.append ((UpdateImageTypeId, Payload, > VendorCodeBytes, HardwareInstance, UpdateImageIndex, > > CapsuleSupport)) > > > > def GetFmpCapsuleImageHeader (self, Index): > > if Index >= len (self._FmpCapsuleImageHeaderList): > > @@ -198,13 +209,14 @@ class FmpCapsuleHeaderClass (object): > > self._ItemOffsetList.append (Offset) > > Offset = Offset + len (EmbeddedDriver) > > Index = 1 > > - for (UpdateImageTypeId, Payload, VendorCodeBytes, > HardwareInstance, UpdateImageIndex) in self._PayloadList: > > + for (UpdateImageTypeId, Payload, VendorCodeBytes, > HardwareInstance, UpdateImageIndex, CapsuleSupport) in > > self._PayloadList: > > FmpCapsuleImageHeader = FmpCapsuleImageHeaderClass () > > FmpCapsuleImageHeader.UpdateImageTypeId = > UpdateImageTypeId > > FmpCapsuleImageHeader.UpdateImageIndex = > UpdateImageIndex > > FmpCapsuleImageHeader.Payload = Payload > > FmpCapsuleImageHeader.VendorCodeBytes = > VendorCodeBytes > > FmpCapsuleImageHeader.UpdateHardwareInstance = > HardwareInstance > > + FmpCapsuleImageHeader.ImageCapsuleSupport = > CapsuleSupport > > FmpCapsuleImage = FmpCapsuleImageHeader.Encode () > > FmpCapsuleData = FmpCapsuleData + FmpCapsuleImage > > > > -- > > 2.17.1 > > > > > > > > > > > > --000000000000a055d405c20b4175 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
hi,
Can this patch be merged. Thanks.=

-sughosh

On Mon, 26 Apr 2021 at 21:27, Kinne= y, Michael D <michael.d.ki= nney@intel.com> wrote:
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>

Mike

> -----Original Message-----
> From: devel= @edk2.groups.io <devel@edk2.groups.io> On Behalf Of Sughosh Ganu
> Sent: Friday, April 23, 2021 4:29 AM
> To: devel@e= dk2.groups.io
> Cc: Michal Simek <michal.simek@xilinx.com>; Sughosh Ganu <sughosh.ganu@linaro.org>
> Subject: [edk2-devel] [PATCH v2] BaseTools: Add support for version 3= of FMP Image Header structure
>
> 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 <
sughosh.ganu@linaro.org>
> ---
>
> Changes since v1:
> - Reword the patch header to get rid of the PatchCheck warning
> - Make passing of ImageCapsuleSupport parameter to the AddPayload
>=C2=A0 =C2=A0function as an optional parameter to maintain backward co= mpatibility
> - Declare the values of CAPSULE_SUPPORT_DEPENDENCY and
>=C2=A0 =C2=A0CAPSULE_SUPPORT_AUTHENTICATION in the FmpCapsuleHeaderCla= ss and use
>=C2=A0 =C2=A0those in the GenerateCapsule script
>
>=C2=A0 .../Source/Python/Capsule/GenerateCapsule.py=C2=A0 |=C2=A0 5 ++= +-
>=C2=A0 .../Common/Uefi/Capsule/FmpCapsuleHeader.py=C2=A0 =C2=A0| 28 ++= +++++++++++------
>=C2=A0 2 files changed, 24 insertions(+), 9 deletions(-)
>
> diff --git a/BaseTools/Source/Python/Capsule/GenerateCapsule.py b/Bas= eTools/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__':
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 print (= 'GenerateCapsule: error:' + str(Msg))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 sys.exi= t (1)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 for SinglePayloadDescriptor in Payl= oadDescriptorList:
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ImageCapsuleSupport =3D 0x= 0000000000000000
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Result =3D SinglePayl= oadDescriptor.Payload
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 try:
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 FmpPayl= oadHeader.FwVersion=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D Sin= glePayloadDescriptor.FwVersion
> @@ -575,6 +576,7 @@ if __name__ =3D=3D '__main__':
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if SinglePayloadDescr= iptor.UseDependency:
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Capsule= Dependency.Payload =3D Result
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Capsule= Dependency.DepexExp =3D SinglePayloadDescriptor.DepexExp
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ImageCapsule= Support=C2=A0 =C2=A0 =C2=A0 =C2=A0 |=3D FmpCapsuleHeader.CAPSULE_SUPPORT_DE= PENDENCY
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Result = = =3D CapsuleDependency.Encode ()
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if args= .Verbose:
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = = =C2=A0 CapsuleDependency.DumpInfo ()
> @@ -607,13 +609,14 @@ if __name__ =3D=3D '__main__':
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = = =C2=A0 FmpAuthHeader.MonotonicCount =3D SinglePayloadDescriptor.MonotonicC= ount
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = = =C2=A0 FmpAuthHeader.CertData=C2=A0 =C2=A0 =C2=A0 =C2=A0=3D CertData
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = = =C2=A0 FmpAuthHeader.Payload=C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D Result
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 ImageCapsuleSupport=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=3D FmpCapsuleH= eader.CAPSULE_SUPPORT_AUTHENTICATION
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = = =C2=A0 Result =3D FmpAuthHeader.Encode ()
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = = =C2=A0 if args.Verbose:
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = = =C2=A0 =C2=A0 =C2=A0 FmpAuthHeader.DumpInfo ()
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 except:=
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = = =C2=A0 print ('GenerateCapsule: error: can not encode FMP Auth Header&= #39;)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = = =C2=A0 sys.exit (1)
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 FmpCapsuleHeader.AddPayloa= d (SinglePayloadDescriptor.Guid, Result, HardwareInstance =3D
> SinglePayloadDescriptor.HardwareInstance, UpdateImageIndex =3D Single= PayloadDescriptor.UpdateImageIndex)
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 FmpCapsuleHeader.AddPayloa= d (SinglePayloadDescriptor.Guid, Result, HardwareInstance =3D
> SinglePayloadDescriptor.HardwareInstance, UpdateImageIndex =3D Single= PayloadDescriptor.UpdateImageIndex, CapsuleSupport =3D
> ImageCapsuleSupport)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 try:
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 for EmbeddedDriver in= EmbeddedDriverDescriptorList:
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 FmpCaps= uleHeader.AddEmbeddedDriver(EmbeddedDriver)
> diff --git a/BaseTools/Source/Python/Common/Uefi/Capsule/FmpCapsuleHe= ader.py
> 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):
>=C2=A0 =C2=A0 =C2=A0 #=C2=A0 =C2=A0/// therefore can be modified witho= ut changing the Auth data.
>=C2=A0 =C2=A0 =C2=A0 #=C2=A0 =C2=A0///
>=C2=A0 =C2=A0 =C2=A0 #=C2=A0 =C2=A0UINT64=C2=A0 =C2=A0UpdateHardwareIn= stance;
> +=C2=A0 =C2=A0 #
> +=C2=A0 =C2=A0 #=C2=A0 =C2=A0///
> +=C2=A0 =C2=A0 #=C2=A0 =C2=A0/// Bits which indicate authentication a= nd depex information for the image that follows this structure
> +=C2=A0 =C2=A0 #=C2=A0 =C2=A0///
> +=C2=A0 =C2=A0 #=C2=A0 =C2=A0UINT64=C2=A0 =C2=A0ImageCapsuleSupport >=C2=A0 =C2=A0 =C2=A0 # } EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER;=
>=C2=A0 =C2=A0 =C2=A0 #
> -=C2=A0 =C2=A0 #=C2=A0 #define EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_= HEADER_INIT_VERSION 0x00000002
> +=C2=A0 =C2=A0 #=C2=A0 #define EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_= HEADER_INIT_VERSION 0x00000003
>
> -=C2=A0 =C2=A0 _StructFormat =3D '<I16sB3BIIQ'
> +=C2=A0 =C2=A0 _StructFormat =3D '<I16sB3BIIQQ'
>=C2=A0 =C2=A0 =C2=A0 _StructSize=C2=A0 =C2=A0=3D struct.calcsize (_Str= uctFormat)
>
> -=C2=A0 =C2=A0 EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER_INIT_VERS= ION =3D 0x00000002
> +=C2=A0 =C2=A0 EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER_INIT_VERS= ION =3D 0x00000003
>
>=C2=A0 =C2=A0 =C2=A0 def __init__ (self):
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 self._Valid=C2=A0 =C2=A0 =C2=A0 =C2= = =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=3D False
> @@ -64,6 +69,7 @@ class FmpCapsuleImageHeaderClass (object):
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 self.UpdateImageSize=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =3D 0
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 self.UpdateVendorCodeSize=C2=A0 =C2= = =A0=3D 0
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 self.UpdateHardwareInstance =3D 0x0= 000000000000000
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 self.ImageCapsuleSupport=C2=A0 =C2=A0 = =3D 0x0000000000000000
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 self.Payload=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D b''
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 self.VendorCodeBytes=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =3D b''
>
> @@ -78,7 +84,8 @@ class FmpCapsuleImageHeaderClass (object):
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A00,0,0,
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0self.UpdateImageSize,
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0self.UpdateVendorCodeSize,
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = = =C2=A0self.UpdateHardwareInstance
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = = =C2=A0self.UpdateHardwareInstance,
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = = =C2=A0self.ImageCapsuleSupport
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 self._Valid =3D True
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return FmpCapsuleImageHeader + self= .Payload + self.VendorCodeBytes
> @@ -86,7 +93,7 @@ class FmpCapsuleImageHeaderClass (object):
>=C2=A0 =C2=A0 =C2=A0 def Decode (self, Buffer):
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if len (Buffer) < self._StructSi= ze:
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 raise ValueError
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 (Version, UpdateImageTypeId, UpdateImage= Index, r0, r1, r2, UpdateImageSize, UpdateVendorCodeSize,
> UpdateHardwareInstance) =3D \
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 (Version, UpdateImageTypeId, UpdateImage= Index, r0, r1, r2, UpdateImageSize, UpdateVendorCodeSize,
> UpdateHardwareInstance, ImageCapsuleSupport) =3D \
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 struct.unpack (
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = = =C2=A0 =C2=A0self._StructFormat,
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = = =C2=A0 =C2=A0Buffer[0:self._StructSize]
> @@ -105,6 +112,7 @@ class FmpCapsuleImageHeaderClass (object):
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 self.UpdateImageSize=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =3D UpdateImageSize
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 self.UpdateVendorCodeSize=C2=A0 =C2= = =A0=3D UpdateVendorCodeSize
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 self.UpdateHardwareInstance =3D Upd= ateHardwareInstance
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 self.ImageCapsuleSupport=C2=A0 =C2=A0 = =3D ImageCapsuleSupport
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 self.Payload=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D Buffer[self._StructSize:self._Struc= tSize + UpdateImageSize]
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 self.VendorCodeBytes=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =3D Buffer[self._StructSize + UpdateImageSize:]
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 self._Valid=C2=A0 =C2=A0 =C2=A0 =C2= = =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=3D True
> @@ -119,6 +127,7 @@ class FmpCapsuleImageHeaderClass (object):
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 print ('EFI_FIRMWARE_MANAGEMENT= _CAPSULE_IMAGE_HEADER.UpdateImageSize=C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D {Updat= eImageSize:08X}'.format
> (UpdateImageSize =3D self.UpdateImageSize))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 print ('EFI_FIRMWARE_MANAGEMENT= _CAPSULE_IMAGE_HEADER.UpdateVendorCodeSize=C2=A0 =C2=A0=3D {UpdateVendorCod= eSize:08X}'.format
> (UpdateVendorCodeSize =3D self.UpdateVendorCodeSize))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 print ('EFI_FIRMWARE_MANAGEMENT= _CAPSULE_IMAGE_HEADER.UpdateHardwareInstance =3D
> {UpdateHardwareInstance:016X}'.format (UpdateHardwareInstance =3D= self.UpdateHardwareInstance))
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 print ('EFI_FIRMWARE_MANAGEMENT_CAPS= ULE_IMAGE_HEADER.ImageCapsuleSupport=C2=A0 =C2=A0 =3D {ImageCapsuleSupport:= 016X}'.format
> (ImageCapsuleSupport =3D self.ImageCapsuleSupport))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 print ('sizeof (Payload)=C2=A0 = = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D {Size:08X}'.format (Size =3D len
> (self.Payload)))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 print ('sizeof (VendorCodeBytes= )=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = = =C2=A0 =3D {Size:08X}'.format (Size =3D len
> (self.VendorCodeBytes)))
>
> @@ -153,6 +162,8 @@ class FmpCapsuleHeaderClass (object):
>=C2=A0 =C2=A0 =C2=A0 _ItemOffsetSize=C2=A0 =C2=A0=3D struct.calcsize (= _ItemOffsetFormat)
>
>=C2=A0 =C2=A0 =C2=A0 EFI_FIRMWARE_MANAGEMENT_CAPSULE_HEADER_INIT_VERSI= ON =3D 0x00000001
> +=C2=A0 =C2=A0 CAPSULE_SUPPORT_AUTHENTICATION =3D 0x0000000000000001<= br> > +=C2=A0 =C2=A0 CAPSULE_SUPPORT_DEPENDENCY=C2=A0 =C2=A0 =C2=A0=3D 0x00= 00000000000002
>
>=C2=A0 =C2=A0 =C2=A0 def __init__ (self):
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 self._Valid=C2=A0 =C2=A0 =C2=A0 =C2= = =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=3D False
> @@ -172,8 +183,8 @@ class FmpCapsuleHeaderClass (object):
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 raise ValueError
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return self._EmbeddedDriverList[Ind= ex]
>
> -=C2=A0 =C2=A0 def AddPayload (self, UpdateImageTypeId, Payload =3D b= '', VendorCodeBytes =3D b'', HardwareInstance =3D 0, Update= ImageIndex
> =3D 1):
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 self._PayloadList.append ((UpdateImageTy= peId, Payload, VendorCodeBytes, HardwareInstance, UpdateImageIndex))
> +=C2=A0 =C2=A0 def AddPayload (self, UpdateImageTypeId, Payload =3D b= '', VendorCodeBytes =3D b'', HardwareInstance =3D 0, Update= ImageIndex
> =3D 1, CapsuleSupport =3D 0):
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 self._PayloadList.append ((UpdateImageTy= peId, Payload, VendorCodeBytes, HardwareInstance, UpdateImageIndex,
> CapsuleSupport))
>
>=C2=A0 =C2=A0 =C2=A0 def GetFmpCapsuleImageHeader (self, Index):
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if Index >=3D len (self._FmpCaps= uleImageHeaderList):
> @@ -198,13 +209,14 @@ class FmpCapsuleHeaderClass (object):
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 self._ItemOffsetList.= append (Offset)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Offset =3D Offset + l= en (EmbeddedDriver)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Index =3D 1
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 for (UpdateImageTypeId, Payload, VendorC= odeBytes, HardwareInstance, UpdateImageIndex) in self._PayloadList:
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 for (UpdateImageTypeId, Payload, VendorC= odeBytes, HardwareInstance, UpdateImageIndex, CapsuleSupport) in
> self._PayloadList:
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 FmpCapsuleImageHeader= =3D FmpCapsuleImageHeaderClass ()
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 FmpCapsuleImageHeader= .UpdateImageTypeId=C2=A0 =C2=A0 =C2=A0 =3D UpdateImageTypeId
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 FmpCapsuleImageHeader= .UpdateImageIndex=C2=A0 =C2=A0 =C2=A0 =C2=A0=3D UpdateImageIndex
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 FmpCapsuleImageHeader= .Payload=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D Payload=
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 FmpCapsuleImageHeader= .VendorCodeBytes=C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D VendorCodeBytes
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 FmpCapsuleImageHeader= .UpdateHardwareInstance =3D HardwareInstance
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 FmpCapsuleImageHeader.Imag= eCapsuleSupport=C2=A0 =C2=A0 =3D CapsuleSupport
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 FmpCapsuleImage =3D F= mpCapsuleImageHeader.Encode ()
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 FmpCapsuleData =3D Fm= pCapsuleData + FmpCapsuleImage
>
> --
> 2.17.1
>
>
>
>
>

--000000000000a055d405c20b4175--