From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mx.groups.io with SMTP id smtpd.web12.65141.1597756036669032868 for ; Tue, 18 Aug 2020 06:07:16 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=kzBEhbOA; spf=pass (domain: intel.com, ip: 134.134.136.20, mailfrom: chasel.chiu@intel.com) IronPort-SDR: nDpGNaMjSdaEoacTm37rbLIqjAKC0CpDpLsF2t8vux32ynJ56dmmgLk57VpnVh7LKVlHZVHYYa 37mrwYZdDq8w== X-IronPort-AV: E=McAfee;i="6000,8403,9716"; a="142720348" X-IronPort-AV: E=Sophos;i="5.76,327,1592895600"; d="scan'208";a="142720348" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Aug 2020 06:07:16 -0700 IronPort-SDR: qtUGXjA1UKHjyWBdP0kpmbGJquKIFuVe78DJgrFEw/qJvtOE/miT4zFNLLP/A3CPQ9r0y8Znea 7MnixjReSCWA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,327,1592895600"; d="scan'208";a="441215365" Received: from unknown (HELO fmsmsx604.amr.corp.intel.com) ([10.18.84.214]) by orsmga004.jf.intel.com with ESMTP; 18 Aug 2020 06:07:16 -0700 Received: from fmsmsx604.amr.corp.intel.com (10.18.126.84) by fmsmsx604.amr.corp.intel.com (10.18.126.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Tue, 18 Aug 2020 06:07:15 -0700 Received: from fmsmsx105.amr.corp.intel.com (10.18.124.203) by fmsmsx604.amr.corp.intel.com (10.18.126.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Tue, 18 Aug 2020 06:07:15 -0700 Received: from FMSEDG002.ED.cps.intel.com (10.1.192.134) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 18 Aug 2020 06:07:15 -0700 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.175) by edgegateway.intel.com (192.55.55.69) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 18 Aug 2020 06:07:14 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NAKsd4qde0g1u0niKr7tRawSayTs+GGJCZp/r4aAil5UbTRnNKFFK1CNZUaDiO7h0g/zCud58WxN94zMh1CqQJwkHqBx7BGlqIZRfLtmm9Nbftgy8nUgU1YMP8T9RsSmo/AnUqPALtDvjyh6YSXbJ/Hr6WMfJjFsGsuTxfaOdBHRvblN+aj2i46g/uBTtFZwaC3f55sgkOSIOuQi+xilV7wERsb47jkpeSNUgpa0Tj196OeTABLcoVZ4R6xfVTRQvbBexE3un2Rjjkoc8X4FzZJosusGRd6KSW+/2LTsaIOpd3Aa3Rkb1yy4BulCKd6kmC8Zzkc2S3EOkE6nY/WZCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vECuxGVub8KVxegyvFAml3GQU9NDXW8Hf7kNwLPrtuA=; b=NVKTiHHMhrc96bVJIV1KvrtVrX6ldA6rYOwDWTImat+fVuixqHxYYSLpaI4DzHnBbNl8WFzMuPWM6RPrieDCFdSRsZbb6hwkwyPNBofP9k/Za4IUULlyNzRCaj+rzunnWm2HzBpA6d1PW9TQC7ejpOQ/rFUmYaXU6gRgLepWiN0GG3SLPG00M01xKeH7k1iHfTGDe58dCK100oWC94/X3hxZh9sk0iiPqbp7NprsuXc0HQqgkG43Nu97zbxQluY4dvUkFz6N7/s//QLwIAvK8D/iOc5jfaqdPv46hekXNos0uWTSl3IiaLUzWrI4u/LEC1XSUlza+Nqdk8rMGM9UnA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vECuxGVub8KVxegyvFAml3GQU9NDXW8Hf7kNwLPrtuA=; b=kzBEhbOA7P6i3s8h07IYdqyTWTdn4YhgZzVhMz5ezYPa4lF1QmZcq0zDbw2dgNz/OQnYmaYW7aywQb19fzy+5tqz1hZx47I8+B5wzil7QFvjW9f1BsqEbgYTNwPx8O75CxiBTuUOb+RPd9E4UzhSp0GiUSCqhOJNw9AjjAIGKVg= Received: from SN6PR11MB2814.namprd11.prod.outlook.com (2603:10b6:805:55::15) by SN6PR11MB2559.namprd11.prod.outlook.com (2603:10b6:805:57::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.25; Tue, 18 Aug 2020 13:07:11 +0000 Received: from SN6PR11MB2814.namprd11.prod.outlook.com ([fe80::4843:7aba:799b:326]) by SN6PR11MB2814.namprd11.prod.outlook.com ([fe80::4843:7aba:799b:326%5]) with mapi id 15.20.3305.024; Tue, 18 Aug 2020 13:07:11 +0000 From: "Chiu, Chasel" To: "Zhang, Qi1" , "devel@edk2.groups.io" CC: "Yao, Jiewen" , "Desimone, Nathaniel L" , "Zeng, Star" Subject: Re: [PATCH v4 4/8] IntelFsp2WraperPkg/Fsp{m|s}WrapperPeim: Add FspBin measurement. Thread-Topic: [PATCH v4 4/8] IntelFsp2WraperPkg/Fsp{m|s}WrapperPeim: Add FspBin measurement. Thread-Index: AQHWdSiKT1hipVgkY0eYE86/vQZHCak91p3A Date: Tue, 18 Aug 2020 13:07:11 +0000 Message-ID: References: <20200818062618.3698-1-qi1.zhang@intel.com> <20200818062618.3698-5-qi1.zhang@intel.com> In-Reply-To: <20200818062618.3698-5-qi1.zhang@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.5.1.3 authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [220.129.108.102] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: f109063e-ec25-409f-91e7-08d843779eb3 x-ms-traffictypediagnostic: SN6PR11MB2559: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: rQOrZANm+Da91uqNtSvaDoN58s3a3wkbb7+viSnj2kkcW9mOmThk4s/lqz6FQCIlXAFs+i0nXH3oYslpADdKLf6Yrdn+2Q7Uh4gM7ClQmNCvxQ7088KNV/j0jUHf0T31jQb7jHzzZCR6Ixl2WekQawi0x3UXCp2g/vmiWjj2bieQmXJrZtoAPBQb4BzD/e48bpDoqPdV4B4Mn8AjGst+WN4HFzCQUhqMHgJX+mczx1sUEF+LJLkhGHjpQGiNk1iK0VGybIy4UQu8nHh6CeoGqSnR2V8HwFt98AeqJ0OnQjBMfmYnzssrY72d3CLBG1eNRl523tz2Ox6ahoYSSmrwI5qbkLFr/otdlwImWwdJinFRy4FboNeEEz0XyZwdXMD9EqNbcaJrV03PnPTviWZaPw== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR11MB2814.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(346002)(136003)(396003)(39860400002)(366004)(376002)(966005)(4326008)(30864003)(186003)(8936002)(478600001)(26005)(64756008)(83380400001)(33656002)(19627235002)(66946007)(66476007)(71200400001)(76116006)(66556008)(66446008)(107886003)(86362001)(5660300002)(9686003)(54906003)(53546011)(8676002)(7696005)(6506007)(110136005)(55016002)(52536014)(316002)(2906002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: YSWxcuEbvPJyeP0AJ/L2+BvZrNQRYCDdXv5emR7mQ8MxnGg0DLsaFe86YcV4eY/ZUDvz9uOPCl15MeC9meAsaCgfP/49KGbL0n5jZatJxHkqGLUtp2onoP3wdLMyJwIf8r+nqJo+xV3xe2iOq+TnpevjUyOxv9ReTyYUWUQIrZpMmmHCN4zb8DjMwpUpCYO+BERzAlOIc7wBVLAAK/CeLT+LDZM5MoShITJAux4l2+k//QAlJ6vcBMMORAhD4shh20tBAGPzJovIVIs999rc5KtcV/roNQfdXgOiJExDzYG5KAnKyaICJzbyN+e2EFaygep7GUFYuB32m80rj/C5+bYTiUu7figLFp/+tfm0E3y8hvo8shppu+Mgh4A8YQP/TdmRK+jSAwUkXkxZwWJV4EwzoK2WMceI/eGz/n1HjHmBn2tq0S21oImLprHKL+x4pF8b9pz6D+OTKgrrfOH3QORAchhCV5KUycKyph1YF9XchGjb3Wg0MRV/IY5al0ZOGQbQmAr/K1gtZiU8FtUTQXCk9F8yklsAlhIW3xuQMDCTFVj6Ei8NmMXwV98JhdFpF6efcm1bvIuRfxTyqe8bo9KODHjwpkcx/3m5ZNIoLo1WN8VbK9LGCAUUmElitv3F3Up5HwKk0bYVjXQgTg16Og== MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SN6PR11MB2814.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f109063e-ec25-409f-91e7-08d843779eb3 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Aug 2020 13:07:11.2934 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: b5vFk6+Re+pSDNwStd9U4Y9DdoulUts37Zxnr99VAsLAH/Ams71Sn57xuXMXR6DEJKjwqt7TZIxmKwhqw/Ek0Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR11MB2559 Return-Path: chasel.chiu@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Chasel Chiu > -----Original Message----- > From: Zhang, Qi1 > Sent: Tuesday, August 18, 2020 2:26 PM > To: devel@edk2.groups.io > Cc: Yao, Jiewen ; Chiu, Chasel > ; Desimone, Nathaniel L > ; Zeng, Star ; Zhang= , > Qi1 > Subject: [PATCH v4 4/8] IntelFsp2WraperPkg/Fsp{m|s}WrapperPeim: Add > FspBin measurement. >=20 > From: Jiewen Yao >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2376 >=20 > Cc: Jiewen Yao > Cc: Chasel Chiu > Cc: Nate DeSimone > Cc: Star Zeng > Cc: Qi Zhang > Signed-off-by: Jiewen Yao > --- > .../FspmWrapperPeim/FspmWrapperPeim.c | 90 > ++++++++++++++++++- > .../FspmWrapperPeim/FspmWrapperPeim.inf | 20 +++-- > .../FspsWrapperPeim/FspsWrapperPeim.c | 86 > +++++++++++++++++- > .../FspsWrapperPeim/FspsWrapperPeim.inf | 27 +++--- > 4 files changed, 204 insertions(+), 19 deletions(-) >=20 > diff --git a/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c > b/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c > index 265b77ed60..24ab534620 100644 > --- a/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c > +++ b/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c > @@ -3,7 +3,7 @@ > register TemporaryRamDonePpi to call TempRamExit API, and register > MemoryDiscoveredPpi >=20 > notify to call FspSiliconInit API. >=20 >=20 >=20 > - Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.
>=20 > + Copyright (c) 2014 - 2020, Intel Corporation. All rights reserved.
>=20 > SPDX-License-Identifier: BSD-2-Clause-Patent >=20 >=20 >=20 > **/ >=20 > @@ -25,11 +25,14 @@ > #include >=20 > #include >=20 > #include >=20 > +#include >=20 >=20 >=20 > #include >=20 > #include >=20 > #include >=20 > #include >=20 > +#include >=20 > +#include >=20 > #include >=20 > #include >=20 > #include >=20 > @@ -147,7 +150,21 @@ FspmWrapperInit ( > VOID >=20 > ) >=20 > { >=20 > - EFI_STATUS Status; >=20 > + EFI_STATUS Status; >=20 > + EFI_PEI_FIRMWARE_VOLUME_INFO_MEASUREMENT_EXCLUDED_PPI > *MeasurementExcludedFvPpi; >=20 > + EFI_PEI_PPI_DESCRIPTOR > *MeasurementExcludedPpiList; >=20 > + >=20 > + MeasurementExcludedFvPpi =3D AllocatePool > (sizeof(*MeasurementExcludedFvPpi)); >=20 > + ASSERT(MeasurementExcludedFvPpi !=3D NULL); >=20 > + MeasurementExcludedFvPpi->Count =3D 1; >=20 > + MeasurementExcludedFvPpi->Fv[0].FvBase =3D PcdGet32 > (PcdFspmBaseAddress); >=20 > + MeasurementExcludedFvPpi->Fv[0].FvLength =3D > ((EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) PcdGet32 > (PcdFspmBaseAddress))->FvLength; >=20 > + >=20 > + MeasurementExcludedPpiList =3D AllocatePool > (sizeof(*MeasurementExcludedPpiList)); >=20 > + ASSERT(MeasurementExcludedPpiList !=3D NULL); >=20 > + MeasurementExcludedPpiList->Flags =3D EFI_PEI_PPI_DESCRIPTOR_PPI | > EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST; >=20 > + MeasurementExcludedPpiList->Guid =3D > &gEfiPeiFirmwareVolumeInfoMeasurementExcludedPpiGuid; >=20 > + MeasurementExcludedPpiList->Ppi =3D MeasurementExcludedFvPpi; >=20 >=20 >=20 > Status =3D EFI_SUCCESS; >=20 >=20 >=20 > @@ -155,6 +172,9 @@ FspmWrapperInit ( > Status =3D PeiFspMemoryInit (); >=20 > ASSERT_EFI_ERROR (Status); >=20 > } else { >=20 > + Status =3D PeiServicesInstallPpi (MeasurementExcludedPpiList); >=20 > + ASSERT_EFI_ERROR (Status); >=20 > + >=20 > PeiServicesInstallFvInfoPpi ( >=20 > NULL, >=20 > (VOID *)(UINTN) PcdGet32 (PcdFspmBaseAddress), >=20 > @@ -167,6 +187,67 @@ FspmWrapperInit ( > return Status; >=20 > } >=20 >=20 >=20 > +/** >=20 > + This function is called after TCG installed PPI. >=20 > + >=20 > + @param[in] PeiServices Pointer to PEI Services Table. >=20 > + @param[in] NotifyDesc Pointer to the descriptor for the > Notification event that >=20 > + caused this function to execute. >=20 > + @param[in] Ppi Pointer to the PPI data associated with this > function. >=20 > + >=20 > + @retval EFI_STATUS Always return EFI_SUCCESS >=20 > +**/ >=20 > +EFI_STATUS >=20 > +EFIAPI >=20 > +TcgPpiNotify ( >=20 > + IN EFI_PEI_SERVICES **PeiServices, >=20 > + IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc, >=20 > + IN VOID *Ppi >=20 > + ); >=20 > + >=20 > +EFI_PEI_NOTIFY_DESCRIPTOR mTcgPpiNotifyDesc =3D { >=20 > + (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | > EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST), >=20 > + &gEdkiiTcgPpiGuid, >=20 > + TcgPpiNotify >=20 > +}; >=20 > + >=20 > +/** >=20 > + This function is called after TCG installed PPI. >=20 > + >=20 > + @param[in] PeiServices Pointer to PEI Services Table. >=20 > + @param[in] NotifyDesc Pointer to the descriptor for the > Notification event that >=20 > + caused this function to execute. >=20 > + @param[in] Ppi Pointer to the PPI data associated with this > function. >=20 > + >=20 > + @retval EFI_STATUS Always return EFI_SUCCESS >=20 > +**/ >=20 > +EFI_STATUS >=20 > +EFIAPI >=20 > +TcgPpiNotify ( >=20 > + IN EFI_PEI_SERVICES **PeiServices, >=20 > + IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc, >=20 > + IN VOID *Ppi >=20 > + ) >=20 > +{ >=20 > + UINT32 FspMeasureMask; >=20 > + >=20 > + DEBUG ((DEBUG_INFO, "TcgPpiNotify FSPM\n")); >=20 > + >=20 > + FspMeasureMask =3D PcdGet32 (PcdFspMeasurementConfig); >=20 > + >=20 > + if ((FspMeasureMask & FSP_MEASURE_FSPT) !=3D 0) { >=20 > + MeasureFspFirmwareBlob (0, "FSPT", PcdGet32(PcdFsptBaseAddress), >=20 > + > (UINT32)((EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) PcdGet32 > (PcdFsptBaseAddress))->FvLength); >=20 > + } >=20 > + >=20 > + if ((FspMeasureMask & FSP_MEASURE_FSPM) !=3D 0) { >=20 > + MeasureFspFirmwareBlob (0, "FSPM", > PcdGet32(PcdFspmBaseAddress), >=20 > + > (UINT32)((EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) PcdGet32 > (PcdFspmBaseAddress))->FvLength); >=20 > + } >=20 > + >=20 > + return EFI_SUCCESS; >=20 > +} >=20 > + >=20 > /** >=20 > This is the entrypoint of PEIM >=20 >=20 >=20 > @@ -182,8 +263,13 @@ FspmWrapperPeimEntryPoint ( > IN CONST EFI_PEI_SERVICES **PeiServices >=20 > ) >=20 > { >=20 > + EFI_STATUS Status; >=20 > + >=20 > DEBUG((DEBUG_INFO, "FspmWrapperPeimEntryPoint\n")); >=20 >=20 >=20 > + Status =3D PeiServicesNotifyPpi (&mTcgPpiNotifyDesc); >=20 > + ASSERT_EFI_ERROR (Status); >=20 > + >=20 > FspmWrapperInit (); >=20 >=20 >=20 > return EFI_SUCCESS; >=20 > diff --git a/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.inf > b/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.inf > index dce7ef3d0b..c3578397b6 100644 > --- a/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.inf > +++ b/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.inf > @@ -6,7 +6,7 @@ > # register TemporaryRamDonePpi to call TempRamExit API, and register > MemoryDiscoveredPpi >=20 > # notify to call FspSiliconInit API. >=20 > # >=20 > -# Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved. >=20 > +# Copyright (c) 2014 - 2020, Intel Corporation. All rights reserved. >=20 > # >=20 > # SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > # >=20 > @@ -44,17 +44,22 @@ > TimerLib >=20 > FspWrapperApiLib >=20 > FspWrapperApiTestLib >=20 > + FspMeasurementLib >=20 >=20 >=20 > [Packages] >=20 > MdePkg/MdePkg.dec >=20 > + MdeModulePkg/MdeModulePkg.dec >=20 > UefiCpuPkg/UefiCpuPkg.dec >=20 > + SecurityPkg/SecurityPkg.dec >=20 > IntelFsp2Pkg/IntelFsp2Pkg.dec >=20 > IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dec >=20 >=20 >=20 > [Pcd] >=20 > - gIntelFsp2WrapperTokenSpaceGuid.PcdFspmBaseAddress ## > CONSUMES >=20 > - gIntelFsp2WrapperTokenSpaceGuid.PcdFspmUpdDataAddress ## > CONSUMES >=20 > - gIntelFsp2WrapperTokenSpaceGuid.PcdFspModeSelection ## > CONSUMES >=20 > + gIntelFsp2WrapperTokenSpaceGuid.PcdFspmBaseAddress ## > CONSUMES >=20 > + gIntelFsp2WrapperTokenSpaceGuid.PcdFspmUpdDataAddress ## > CONSUMES >=20 > + gIntelFsp2WrapperTokenSpaceGuid.PcdFspModeSelection ## > CONSUMES >=20 > + gIntelFsp2WrapperTokenSpaceGuid.PcdFsptBaseAddress ## > CONSUMES >=20 > + gIntelFsp2WrapperTokenSpaceGuid.PcdFspMeasurementConfig ## > CONSUMES >=20 >=20 >=20 > [Sources] >=20 > FspmWrapperPeim.c >=20 > @@ -63,5 +68,10 @@ > gFspHobGuid ## PRODUCES ## HOB >=20 > gFspApiPerformanceGuid ## SOMETIMES_CONSUMES > ## GUID >=20 >=20 >=20 > +[Ppis] >=20 > + gEdkiiTcgPpiGuid ## > NOTIFY >=20 > + gEfiPeiFirmwareVolumeInfoMeasurementExcludedPpiGuid ## > PRODUCES >=20 > + >=20 > [Depex] >=20 > - gEfiPeiMasterBootModePpiGuid >=20 > + gEfiPeiMasterBootModePpiGuid AND >=20 > + gPeiTpmInitializationDonePpiGuid >=20 > diff --git a/IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.c > b/IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.c > index b20f0805a0..9d4f279e81 100644 > --- a/IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.c > +++ b/IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.c > @@ -3,7 +3,7 @@ > register TemporaryRamDonePpi to call TempRamExit API, and register > MemoryDiscoveredPpi >=20 > notify to call FspSiliconInit API. >=20 >=20 >=20 > - Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.
>=20 > + Copyright (c) 2014 - 2020, Intel Corporation. All rights reserved.
>=20 > SPDX-License-Identifier: BSD-2-Clause-Patent >=20 >=20 >=20 > **/ >=20 > @@ -24,12 +24,15 @@ > #include >=20 > #include >=20 > #include >=20 > +#include >=20 >=20 >=20 > #include >=20 > #include >=20 > #include >=20 > #include >=20 > #include >=20 > +#include >=20 > +#include >=20 > #include >=20 > #include >=20 > #include >=20 > @@ -379,7 +382,25 @@ FspsWrapperInitDispatchMode ( > VOID >=20 > ) >=20 > { >=20 > - EFI_STATUS Status; >=20 > + EFI_STATUS Status; >=20 > + EFI_PEI_FIRMWARE_VOLUME_INFO_MEASUREMENT_EXCLUDED_PPI > *MeasurementExcludedFvPpi; >=20 > + EFI_PEI_PPI_DESCRIPTOR > *MeasurementExcludedPpiList; >=20 > + >=20 > + MeasurementExcludedFvPpi =3D AllocatePool > (sizeof(*MeasurementExcludedFvPpi)); >=20 > + ASSERT(MeasurementExcludedFvPpi !=3D NULL); >=20 > + MeasurementExcludedFvPpi->Count =3D 1; >=20 > + MeasurementExcludedFvPpi->Fv[0].FvBase =3D PcdGet32 > (PcdFspsBaseAddress); >=20 > + MeasurementExcludedFvPpi->Fv[0].FvLength =3D > ((EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) PcdGet32 > (PcdFspsBaseAddress))->FvLength; >=20 > + >=20 > + MeasurementExcludedPpiList =3D AllocatePool > (sizeof(*MeasurementExcludedPpiList)); >=20 > + ASSERT(MeasurementExcludedPpiList !=3D NULL); >=20 > + MeasurementExcludedPpiList->Flags =3D EFI_PEI_PPI_DESCRIPTOR_PPI | > EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST; >=20 > + MeasurementExcludedPpiList->Guid =3D > &gEfiPeiFirmwareVolumeInfoMeasurementExcludedPpiGuid; >=20 > + MeasurementExcludedPpiList->Ppi =3D MeasurementExcludedFvPpi; >=20 > + >=20 > + Status =3D PeiServicesInstallPpi (MeasurementExcludedPpiList); >=20 > + ASSERT_EFI_ERROR (Status); >=20 > + >=20 > // >=20 > // FSP-S Wrapper running in Dispatch mode and reports FSP-S FV to PEI > dispatcher. >=20 > // >=20 > @@ -398,6 +419,62 @@ FspsWrapperInitDispatchMode ( > return Status; >=20 > } >=20 >=20 >=20 > +/** >=20 > + This function is called after TCG installed PPI. >=20 > + >=20 > + @param[in] PeiServices Pointer to PEI Services Table. >=20 > + @param[in] NotifyDesc Pointer to the descriptor for the > Notification event that >=20 > + caused this function to execute. >=20 > + @param[in] Ppi Pointer to the PPI data associated with this > function. >=20 > + >=20 > + @retval EFI_STATUS Always return EFI_SUCCESS >=20 > +**/ >=20 > +EFI_STATUS >=20 > +EFIAPI >=20 > +TcgPpiNotify ( >=20 > + IN EFI_PEI_SERVICES **PeiServices, >=20 > + IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc, >=20 > + IN VOID *Ppi >=20 > + ); >=20 > + >=20 > +EFI_PEI_NOTIFY_DESCRIPTOR mTcgPpiNotifyDesc =3D { >=20 > + (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | > EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST), >=20 > + &gEdkiiTcgPpiGuid, >=20 > + TcgPpiNotify >=20 > +}; >=20 > + >=20 > +/** >=20 > + This function is called after TCG installed PPI. >=20 > + >=20 > + @param[in] PeiServices Pointer to PEI Services Table. >=20 > + @param[in] NotifyDesc Pointer to the descriptor for the > Notification event that >=20 > + caused this function to execute. >=20 > + @param[in] Ppi Pointer to the PPI data associated with this > function. >=20 > + >=20 > + @retval EFI_STATUS Always return EFI_SUCCESS >=20 > +**/ >=20 > +EFI_STATUS >=20 > +EFIAPI >=20 > +TcgPpiNotify ( >=20 > + IN EFI_PEI_SERVICES **PeiServices, >=20 > + IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc, >=20 > + IN VOID *Ppi >=20 > + ) >=20 > +{ >=20 > + UINT32 FspMeasureMask; >=20 > + >=20 > + DEBUG ((DEBUG_INFO, "TcgPpiNotify FSPS\n")); >=20 > + >=20 > + FspMeasureMask =3D PcdGet32 (PcdFspMeasurementConfig); >=20 > + >=20 > + if ((FspMeasureMask & FSP_MEASURE_FSPS) !=3D 0) { >=20 > + MeasureFspFirmwareBlob (0, "FSPS", PcdGet32(PcdFspsBaseAddress), >=20 > + > (UINT32)((EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) PcdGet32 > (PcdFspsBaseAddress))->FvLength); >=20 > + } >=20 > + >=20 > + return EFI_SUCCESS; >=20 > +} >=20 > + >=20 > /** >=20 > This is the entrypoint of PEIM. >=20 >=20 >=20 > @@ -413,8 +490,13 @@ FspsWrapperPeimEntryPoint ( > IN CONST EFI_PEI_SERVICES **PeiServices >=20 > ) >=20 > { >=20 > + EFI_STATUS Status; >=20 > + >=20 > DEBUG ((DEBUG_INFO, "FspsWrapperPeimEntryPoint\n")); >=20 >=20 >=20 > + Status =3D PeiServicesNotifyPpi (&mTcgPpiNotifyDesc); >=20 > + ASSERT_EFI_ERROR (Status); >=20 > + >=20 > if (PcdGet8 (PcdFspModeSelection) =3D=3D 1) { >=20 > FspsWrapperInitApiMode (); >=20 > } else { >=20 > diff --git a/IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.inf > b/IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.inf > index 7da92991c8..884514747f 100644 > --- a/IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.inf > +++ b/IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.inf > @@ -6,7 +6,7 @@ > # register TemporaryRamDonePpi to call TempRamExit API, and register > MemoryDiscoveredPpi >=20 > # notify to call FspSiliconInit API. >=20 > # >=20 > -# Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved. >=20 > +# Copyright (c) 2014 - 2020, Intel Corporation. All rights reserved. >=20 > # >=20 > # SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > # >=20 > @@ -44,24 +44,30 @@ > PerformanceLib >=20 > FspWrapperApiLib >=20 > FspWrapperApiTestLib >=20 > + FspMeasurementLib >=20 >=20 >=20 > [Packages] >=20 > MdePkg/MdePkg.dec >=20 > + MdeModulePkg/MdeModulePkg.dec >=20 > UefiCpuPkg/UefiCpuPkg.dec >=20 > + SecurityPkg/SecurityPkg.dec >=20 > IntelFsp2Pkg/IntelFsp2Pkg.dec >=20 > IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dec >=20 >=20 >=20 > [Ppis] >=20 > - gTopOfTemporaryRamPpiGuid ## PRODUCES >=20 > - gFspSiliconInitDonePpiGuid ## PRODUCES >=20 > - gEfiEndOfPeiSignalPpiGuid ## PRODUCES >=20 > - gEfiTemporaryRamDonePpiGuid ## PRODUCES >=20 > - gEfiPeiMemoryDiscoveredPpiGuid ## NOTIFY >=20 > + gTopOfTemporaryRamPpiGuid ## > PRODUCES >=20 > + gFspSiliconInitDonePpiGuid ## > PRODUCES >=20 > + gEfiEndOfPeiSignalPpiGuid ## > PRODUCES >=20 > + gEfiTemporaryRamDonePpiGuid ## > PRODUCES >=20 > + gEfiPeiMemoryDiscoveredPpiGuid ## > NOTIFY >=20 > + gEdkiiTcgPpiGuid ## > NOTIFY >=20 > + gEfiPeiFirmwareVolumeInfoMeasurementExcludedPpiGuid ## > PRODUCES >=20 >=20 >=20 > [Pcd] >=20 > - gIntelFsp2WrapperTokenSpaceGuid.PcdFspsBaseAddress ## > CONSUMES >=20 > - gIntelFsp2WrapperTokenSpaceGuid.PcdFspsUpdDataAddress ## > CONSUMES >=20 > - gIntelFsp2WrapperTokenSpaceGuid.PcdFspModeSelection ## > CONSUMES >=20 > + gIntelFsp2WrapperTokenSpaceGuid.PcdFspsBaseAddress ## > CONSUMES >=20 > + gIntelFsp2WrapperTokenSpaceGuid.PcdFspsUpdDataAddress ## > CONSUMES >=20 > + gIntelFsp2WrapperTokenSpaceGuid.PcdFspModeSelection ## > CONSUMES >=20 > + gIntelFsp2WrapperTokenSpaceGuid.PcdFspMeasurementConfig ## > CONSUMES >=20 >=20 >=20 > [Guids] >=20 > gFspHobGuid ## CONSUMES ## HOB >=20 > @@ -71,4 +77,5 @@ > FspsWrapperPeim.c >=20 >=20 >=20 > [Depex] >=20 > - gEfiPeiMemoryDiscoveredPpiGuid >=20 > + gEfiPeiMemoryDiscoveredPpiGuid AND >=20 > + gPeiTpmInitializationDonePpiGuid >=20 > -- > 2.26.2.windows.1