From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (using TLSv1 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id C6FE71A1E43 for ; Wed, 26 Oct 2016 18:27:37 -0700 (PDT) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga103.jf.intel.com with ESMTP; 26 Oct 2016 18:27:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,551,1473145200"; d="scan'208,217";a="24156034" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by fmsmga005.fm.intel.com with ESMTP; 26 Oct 2016 18:27:37 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 26 Oct 2016 18:27:36 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.206]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.104]) with mapi id 14.03.0248.002; Thu, 27 Oct 2016 09:27:34 +0800 From: "Yao, Jiewen" To: "Kinney, Michael D" , "edk2-devel@lists.01.org" 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: AQHSLNXcCHVVY6RWQUmNKsDqeXyjpKC68u0AgACQqVD//33lAIAAhkQQ Date: Thu, 27 Oct 2016 01:27:33 +0000 Message-ID: <74D8A39837DF1E4DA445A8C0B3885C50386B81EF@shsmsx102.ccr.corp.intel.com> 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: Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] 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:27:38 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Good question again. That is because the platform PEI phase does not report all FV information t= o DXE. I did use this way in my early version. I give up later, because I realize = if so we need update all platforms to let it report all FV information. It = is a burden. Using PCD is a standalone solution and much simpler. Also, if there is some= other components need to know the information, they can just use PCD, inst= ead of scanning FV/FD. Thank you Yao Jiewen From: Kinney, Michael D Sent: Thursday, October 27, 2016 9:23 AM To: Yao, Jiewen ; edk2-devel@lists.01.org; Kinney, Mi= chael D 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. 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, Limi= ng >; Zeng, Star >; Zhang, Chao B >; Wei, 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