From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 984CA1A1E86 for ; Wed, 26 Oct 2016 18:23:01 -0700 (PDT) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga104.jf.intel.com with ESMTP; 26 Oct 2016 18:23:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,551,1473145200"; d="scan'208,217";a="24520377" Received: from orsmsx109.amr.corp.intel.com ([10.22.240.7]) by orsmga004.jf.intel.com with ESMTP; 26 Oct 2016 18:23:01 -0700 Received: from orsmsx162.amr.corp.intel.com (10.22.240.85) by ORSMSX109.amr.corp.intel.com (10.22.240.7) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 26 Oct 2016 18:23:00 -0700 Received: from orsmsx113.amr.corp.intel.com ([169.254.9.50]) by ORSMSX162.amr.corp.intel.com ([10.22.240.85]) with mapi id 14.03.0248.002; Wed, 26 Oct 2016 18:22:51 -0700 From: "Kinney, Michael D" To: "Yao, Jiewen" , "edk2-devel@lists.01.org" , "Kinney, Michael D" CC: "Tian, Feng" , "Gao, Liming" , "Zeng, Star" , "Zhang, Chao B" , "Wei, David" Thread-Topic: [edk2] [PATCH V4 03/10] Vlv2TbltDevicePkg/SystemFirmwareDescriptor: Add Descriptor for capsule update. Thread-Index: AQHSLNXc8tvnczZPE0WhwvQYxPIIt6C7eP0ggACBwoD//4ygQA== Date: Thu, 27 Oct 2016 01:22:50 +0000 Message-ID: References: <1477189992-13152-1-git-send-email-jiewen.yao@intel.com> <1477189992-13152-4-git-send-email-jiewen.yao@intel.com> <74D8A39837DF1E4DA445A8C0B3885C50386B8197@shsmsx102.ccr.corp.intel.com> In-Reply-To: <74D8A39837DF1E4DA445A8C0B3885C50386B8197@shsmsx102.ccr.corp.intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_IC x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZTRhMjU3NzAtNmVmMi00MWY5LWI2ZTAtNDQ5MjJlZWYzMjdkIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6InVXd3RWbjVjdUZPUU1JZk1DenpXbkd2WlBtZEhzejUwTll1WjhmV0gzUHc9In0= x-originating-ip: [10.22.254.140] MIME-Version: 1.0 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 Subject: Re: [PATCH V4 03/10] Vlv2TbltDevicePkg/SystemFirmwareDescriptor: Add Descriptor for capsule update. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Oct 2016 01:23:01 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Jiewen, They why do we need the PCD? We should be able to find this section in current FLASH image and in new FL= ASH image. Right? Mike From: Yao, Jiewen Sent: Wednesday, October 26, 2016 6:15 PM To: Kinney, Michael D ; edk2-devel@lists.01.org Cc: Tian, Feng ; Gao, Liming ; Z= eng, Star ; Zhang, Chao B ; We= i, David Subject: RE: [edk2] [PATCH V4 03/10] Vlv2TbltDevicePkg/SystemFirmwareDescri= ptor: Add Descriptor for capsule update. Mike That is a good question. We create a standalone FFS SECTION to hold the descriptor purposely. The reason is that: the SystemFirmwareUpdate need to know the version of th= e *new image*. SystemFirmwareUpdate can know the version and lowest supported version of t= he current image by using PCD. SystemFirmwareUpdate also need to know the version of the new image, so tha= t it can compare them. There is not any inform on the new image, because no= code runs for the new image. The only way is to parse the image binary. Th= e SystemFirmwareUpdate will parse the FV and find the FFS Section to get th= e image descriptor. That is why we put a standalone FFS SECTION there. Thank you Yao Jiewen From: Kinney, Michael D Sent: Thursday, October 27, 2016 8:31 AM To: Yao, Jiewen >; edk2-d= evel@lists.01.org; Kinney, Michael D > Cc: Tian, Feng >; Gao, Limi= ng >; Zeng, Star >; Zhang, Chao B >; Wei, David > Subject: RE: [edk2] [PATCH V4 03/10] Vlv2TbltDevicePkg/SystemFirmwareDescri= ptor: Add Descriptor for capsule update. Jiewen, Why is .aslc file used in this PEIM. It is not an ACPI table. You are generating a C structure that is used to set the value of a PCD. The C structure could be a global variable in the PEIM that is initialized the same way the .aslc file does or you could initialize the fields in the PEIM entry point. Or some combination of the two. Thanks, Mike > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Ji= ewen Yao > Sent: Saturday, October 22, 2016 7:33 PM > To: edk2-devel@lists.01.org > Cc: Tian, Feng >; Gao, Li= ming >; Zeng, Star > >; Kinney, Michael D >; Zhang, Chao B > >; Wei, David > > Subject: [edk2] [PATCH V4 03/10] Vlv2TbltDevicePkg/SystemFirmwareDescript= or: Add > Descriptor for capsule update. > > Add SystemFirmwareDescriptor for capsule update. > The PEIM extracts SystemFirmwareDescriptor info from FFS and reports it v= ia PCD. > > Cc: David Wei > > Cc: Feng Tian > > Cc: Star Zeng > > Cc: Michael D Kinney > > Cc: Liming Gao > > Cc: Chao Zhang > > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Jiewen Yao > > Reviewed-by: David Wei > > --- > > Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirmware= Descriptor.asl > c | 89 ++++++++++++++++++++ > > Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirmware= Descriptor.inf > | 46 ++++++++++ > > Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirmware= DescriptorPei. > c | 66 +++++++++++++++ > 3 files changed, 201 insertions(+) > > diff --git > a/Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirmwa= reDescriptor.a > slc > b/Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirmwa= reDescriptor.a > slc > new file mode 100644 > index 0000000..4c9b63e > --- /dev/null > +++ > b/Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirmwa= reDescriptor.a > slc > @@ -0,0 +1,89 @@ > +/** @file > + System Firmware descriptor. > + > + Copyright (c) 2016, Intel Corporation. All rights reserved.
> + This program and the accompanying materials > + are licensed and made available under the terms and conditions of the = BSD License > + which accompanies this distribution. The full text of the license may= be found at > + http://opensource.org/licenses/bsd-license.php > + > + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, > + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR I= MPLIED. > + > +**/ > + > +#include > +#include > +#include > + > +#define PACKAGE_VERSION 0xFFFFFFFF > +#define PACKAGE_VERSION_STRING L"Unknown" > + > +#define CURRENT_FIRMWARE_VERSION 0x00000002 > +#define CURRENT_FIRMWARE_VERSION_STRING L"0x00000002" > +#define LOWEST_SUPPORTED_FIRMWARE_VERSION 0x00000001 > + > +#define IMAGE_ID SIGNATURE_64('V', 'L', 'V', = '2', '_', '_', > 'F', 'd') > +#define IMAGE_ID_STRING L"Vlv2Fd" > + > +// PcdSystemFmpCapsuleImageTypeIdGuid > +#define IMAGE_TYPE_ID_GUID { 0x4096267b, 0xda0a, 0x42eb= , { 0xb5, > 0xeb, 0xfe, 0xf3, 0x1d, 0x20, 0x7c, 0xb4 } } > + > +typedef struct { > + EDKII_SYSTEM_FIRMWARE_IMAGE_DESCRIPTOR Descriptor; > + // real string data > + CHAR16 ImageIdNameStr[16]; > + CHAR16 VersionNameStr[16]; > + CHAR16 PackageVersionNameStr[16]; > +} IMAGE_DESCRIPTOR; > + > +IMAGE_DESCRIPTOR mImageDescriptor =3D > +{ > + { > + EDKII_SYSTEM_FIRMWARE_IMAGE_DESCRIPTOR_SIGNATURE, > + sizeof(EDKII_SYSTEM_FIRMWARE_IMAGE_DESCRIPTOR), > + sizeof(IMAGE_DESCRIPTOR), > + PACKAGE_VERSION, // PackageVer= sion > + OFFSET_OF (IMAGE_DESCRIPTOR, PackageVersionNameStr), // PackageVer= sionName > + 1, // ImageIndex= ; > + {0x0}, // Reserved > + IMAGE_TYPE_ID_GUID, // ImageTypeI= d; > + IMAGE_ID, // ImageId; > + OFFSET_OF (IMAGE_DESCRIPTOR, ImageIdNameStr), // ImageIdNam= e; > + CURRENT_FIRMWARE_VERSION, // Version; > + OFFSET_OF (IMAGE_DESCRIPTOR, VersionNameStr), // VersionNam= e; > + {0x0}, // Reserved2 > + FixedPcdGet32(PcdFlashAreaSize), // Size; > + IMAGE_ATTRIBUTE_IMAGE_UPDATABLE | > + IMAGE_ATTRIBUTE_RESET_REQUIRED | > + IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED | > + IMAGE_ATTRIBUTE_IN_USE, // Attributes= Supported; > + IMAGE_ATTRIBUTE_IMAGE_UPDATABLE | > + IMAGE_ATTRIBUTE_RESET_REQUIRED | > + IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED | > + IMAGE_ATTRIBUTE_IN_USE, // Attributes= Setting; > + 0x0, // Compatibil= ities; > + LOWEST_SUPPORTED_FIRMWARE_VERSION, // > LowestSupportedImageVersion; > + 0x00000000, // LastAttemp= tVersion; > + 0, // LastAttemp= tStatus; > + {0x0}, // Reserved3 > + 0, // HardwareIn= stance; > + }, > + // real string data > + {IMAGE_ID_STRING}, > + {CURRENT_FIRMWARE_VERSION_STRING}, > + {PACKAGE_VERSION_STRING}, > +}; > + > + > +VOID* > +ReferenceAcpiTable ( > + VOID > + ) > +{ > + // > + // Reference the table being generated to prevent the optimizer from > + // removing the data structure from the executable > + // > + return (VOID*)&mImageDescriptor; > +} > diff --git > a/Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirmwa= reDescriptor.i > nf > b/Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirmwa= reDescriptor.i > nf > new file mode 100644 > index 0000000..2df1098 > --- /dev/null > +++ > b/Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirmwa= reDescriptor.i > nf > @@ -0,0 +1,46 @@ > +## @file > +# System Firmware descriptor. > +# > +# Copyright (c) 2016, Intel Corporation. All rights reserved.
> +# This program and the accompanying materials > +# are licensed and made available under the terms and conditions of the= BSD License > +# which accompanies this distribution. The full text of the license ma= y be found at > +# http://opensource.org/licenses/bsd-license.php > +# > +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, > +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR = IMPLIED. > +# > +## > + > +[Defines] > + INF_VERSION =3D 0x00010005 > + BASE_NAME =3D SystemFirmwareDescriptor > + FILE_GUID =3D 90B2B846-CA6D-4D6E-A8D3-C140A8E110A= C > + MODULE_TYPE =3D PEIM > + VERSION_STRING =3D 1.0 > + ENTRY_POINT =3D SystemFirmwareDescriptorPeimEntry > + > +[Sources] > + SystemFirmwareDescriptorPei.c > + SystemFirmwareDescriptor.aslc > + > +[Packages] > + MdePkg/MdePkg.dec > + MdeModulePkg/MdeModulePkg.dec > + SignedCapsulePkg/SignedCapsulePkg.dec > + Vlv2TbltDevicePkg/PlatformPkg.dec > + > +[LibraryClasses] > + PcdLib > + PeiServicesLib > + DebugLib > + PeimEntryPoint > + > +[FixedPcd] > + gPlatformModuleTokenSpaceGuid.PcdFlashAreaSize > + > +[Pcd] > + gEfiSignedCapsulePkgTokenSpaceGuid.PcdEdkiiSystemFirmwareImageDescript= or > + > +[Depex] > + TRUE > diff --git > a/Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirmwa= reDescriptorPe > i.c > b/Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirmwa= reDescriptorPe > i.c > new file mode 100644 > index 0000000..e6474e3 > --- /dev/null > +++ > b/Vlv2TbltDevicePkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirmwa= reDescriptorPe > i.c > @@ -0,0 +1,66 @@ > +/** @file > + System Firmware descriptor producer. > + > + Copyright (c) 2016, Intel Corporation. All rights reserved.
> + This program and the accompanying materials > + are licensed and made available under the terms and conditions of the = BSD License > + which accompanies this distribution. The full text of the license may= be found at > + http://opensource.org/licenses/bsd-license.php > + > + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, > + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR I= MPLIED. > + > +**/ > + > +#include > +#include > +#include > +#include > +#include > +#include > + > +/** > + Entrypoint for SystemFirmwareDescriptor PEIM. > + > + @param FileHandle Handle of the file being invoked. > + @param PeiServices Describes the list of possible PEI Services. > + > + @retval EFI_SUCCESS PPI successfully installed. > +**/ > +EFI_STATUS > +EFIAPI > +SystemFirmwareDescriptorPeimEntry( > + IN EFI_PEI_FILE_HANDLE FileHandle, > + IN CONST EFI_PEI_SERVICES **PeiServices > + ) > +{ > + EFI_STATUS Status; > + EDKII_SYSTEM_FIRMWARE_IMAGE_DESCRIPTOR *Descriptor; > + UINTN Size; > + UINTN Index; > + UINT32 AuthenticationStatus; > + > + // > + // Search RAW section. > + // > + Index =3D 0; > + while (TRUE) { > + Status =3D PeiServicesFfsFindSectionData3(EFI_SECTION_RAW, Index, Fi= leHandle, (VOID > **)&Descriptor, &AuthenticationStatus); > + if (EFI_ERROR(Status)) { > + // Should not happen, must something wrong in FDF. > + ASSERT(FALSE); > + return EFI_NOT_FOUND; > + } > + if (Descriptor->Signature =3D=3D EDKII_SYSTEM_FIRMWARE_IMAGE_DESCRIP= TOR_SIGNATURE) { > + break; > + } > + Index++; > + } > + > + DEBUG((EFI_D_INFO, "EDKII_SYSTEM_FIRMWARE_IMAGE_DESCRIPTOR size - 0x%x= \n", > Descriptor->Length)); > + > + Size =3D Descriptor->Length; > + PcdSetPtrS (PcdEdkiiSystemFirmwareImageDescriptor, &Size, Descriptor); > + > + return EFI_SUCCESS; > +} > -- > 2.7.4.windows.1 > > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel