From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (using TLSv1 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 4824E1A1E73 for ; Wed, 26 Oct 2016 17:30:27 -0700 (PDT) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP; 26 Oct 2016 17:30:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,551,1473145200"; d="scan'208";a="1076345511" Received: from orsmsx109.amr.corp.intel.com ([10.22.240.7]) by fmsmga002.fm.intel.com with ESMTP; 26 Oct 2016 17:30:27 -0700 Received: from orsmsx116.amr.corp.intel.com (10.22.240.14) by ORSMSX109.amr.corp.intel.com (10.22.240.7) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 26 Oct 2016 17:30:26 -0700 Received: from orsmsx113.amr.corp.intel.com ([169.254.9.50]) by ORSMSX116.amr.corp.intel.com ([10.22.240.14]) with mapi id 14.03.0248.002; Wed, 26 Oct 2016 17:30:26 -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" Thread-Topic: [edk2] [PATCH V4 3/8] QuarkPlatformPkg/SystemFirmwareDescriptor: Add Descriptor for capsule update. Thread-Index: AQHSLNWmMVIj4OF4UkK7skyl2Udm3aC7eElg Date: Thu, 27 Oct 2016 00:30:25 +0000 Message-ID: References: <1477189908-8336-1-git-send-email-jiewen.yao@intel.com> <1477189908-8336-4-git-send-email-jiewen.yao@intel.com> In-Reply-To: <1477189908-8336-4-git-send-email-jiewen.yao@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_IC x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZDQ2MTk5YTItZDZlYS00ZTA1LWI2Y2EtYzdhYTIwZjU0ODE4IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6ImwzMGJcL2FZWXBOMmdhd2hnNXVnXC93Wko5K3RlZFFBQlRybklqZDVnODBZTT0ifQ== x-originating-ip: [10.22.254.140] MIME-Version: 1.0 Subject: Re: [PATCH V4 3/8] QuarkPlatformPkg/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 00:30:27 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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:32 PM > To: edk2-devel@lists.01.org > Cc: Tian, Feng ; Gao, Liming ;= Zeng, Star > ; Kinney, Michael D ; Zh= ang, Chao B > > Subject: [edk2] [PATCH V4 3/8] QuarkPlatformPkg/SystemFirmwareDescriptor:= Add > Descriptor for capsule update. >=20 > Add SystemFirmwareDescriptor for capsule update. > The PEIM extracts SystemFirmwareDescriptor info from FFS and reports it v= ia PCD. >=20 > Cc: Michael D Kinney > Cc: Kelly Steele > Cc: Feng Tian > Cc: Star Zeng > Cc: Liming Gao > Cc: Chao Zhang > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Jiewen Yao > --- >=20 > QuarkPlatformPkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirmwareD= escriptor.aslc > | 89 ++++++++++++++++++++ > QuarkPlatformPkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirmware= Descriptor.inf > | 46 ++++++++++ >=20 > QuarkPlatformPkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirmwareD= escriptorPei.c > | 66 +++++++++++++++ > 3 files changed, 201 insertions(+) >=20 > diff --git > a/QuarkPlatformPkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirmwar= eDescriptor.as > lc > b/QuarkPlatformPkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirmwar= eDescriptor.as > lc > new file mode 100644 > index 0000000..693a632 > --- /dev/null > +++ > b/QuarkPlatformPkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirmwar= eDescriptor.as > lc > @@ -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('Q', 'U', 'A', = 'R', 'K', '_', > 'F', 'd') > +#define IMAGE_ID_STRING L"QuarkPlatformFd" > + > +// PcdSystemFmpCapsuleImageTypeIdGuid > +#define IMAGE_TYPE_ID_GUID { 0x62af20c0, 0x7016, 0x424a= , { 0x9b, > 0xf8, 0x9c, 0xcc, 0x86, 0x58, 0x40, 0x90 } } > + > +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/QuarkPlatformPkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirmwar= eDescriptor.in > f > b/QuarkPlatformPkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirmwar= eDescriptor.in > f > new file mode 100644 > index 0000000..3134a58 > --- /dev/null > +++ > b/QuarkPlatformPkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirmwar= eDescriptor.in > f > @@ -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 > + QuarkPlatformPkg/QuarkPlatformPkg.dec > + > +[LibraryClasses] > + PcdLib > + PeiServicesLib > + DebugLib > + PeimEntryPoint > + > +[FixedPcd] > + gQuarkPlatformTokenSpaceGuid.PcdFlashAreaSize > + > +[Pcd] > + gEfiSignedCapsulePkgTokenSpaceGuid.PcdEdkiiSystemFirmwareImageDescript= or > + > +[Depex] > + TRUE > diff --git > a/QuarkPlatformPkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirmwar= eDescriptorPei > .c > b/QuarkPlatformPkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirmwar= eDescriptorPei > .c > new file mode 100644 > index 0000000..e6474e3 > --- /dev/null > +++ > b/QuarkPlatformPkg/Feature/Capsule/SystemFirmwareDescriptor/SystemFirmwar= eDescriptorPei > .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 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel