From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.126, mailfrom: star.zeng@intel.com) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by groups.io with SMTP; Mon, 15 Apr 2019 02:34:38 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Apr 2019 02:34:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,353,1549958400"; d="scan'208";a="142819860" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga003.jf.intel.com with ESMTP; 15 Apr 2019 02:34:36 -0700 Received: from fmsmsx118.amr.corp.intel.com (10.18.116.18) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 15 Apr 2019 02:34:36 -0700 Received: from shsmsx107.ccr.corp.intel.com (10.239.4.96) by fmsmsx118.amr.corp.intel.com (10.18.116.18) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 15 Apr 2019 02:34:35 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.206]) by SHSMSX107.ccr.corp.intel.com ([169.254.9.153]) with mapi id 14.03.0415.000; Mon, 15 Apr 2019 17:34:34 +0800 From: "Zeng, Star" To: "Chiu, Chasel" , "devel@edk2.groups.io" CC: "Desimone, Nathaniel L" , "Zeng, Star" Subject: Re: [PATCH v2] IntelFsp2WrapperPkg: Perform post FSP-S process. Thread-Topic: [PATCH v2] IntelFsp2WrapperPkg: Perform post FSP-S process. Thread-Index: AQHU810z5B6hQ3ou60GmG9oH9M1EW6Y89HXg Date: Mon, 15 Apr 2019 09:34:33 +0000 Message-ID: <0C09AFA07DD0434D9E2A0C6AEB048310402B7093@shsmsx102.ccr.corp.intel.com> References: <20190415060914.5644-1-chasel.chiu@intel.com> In-Reply-To: <20190415060914.5644-1-chasel.chiu@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZjFjNzY1YzAtZmI5Ni00NWNmLWExYWItZTA1OGM3NjU2YjcxIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiMitEcGtxWHJjSUtqWFwvd1FISWdVOUZyTUh4UGl4XC9GbmppQzViV25ZZWZMd2lYSzNoYURwelZOcjlLRjE0SGVYIn0= dlp-product: dlpe-windows dlp-version: 11.0.600.7 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: star.zeng@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Small comments are added inline. With them handled, Reviewed-by: Star Zeng = . You do not need to send an extra patch for them specifically if no other co= mment will be received from other. > -----Original Message----- > From: Chiu, Chasel > Sent: Monday, April 15, 2019 2:09 PM > To: devel@edk2.groups.io > Cc: Chiu, Chasel ; Desimone, Nathaniel L > ; Zeng, Star > Subject: [PATCH v2] IntelFsp2WrapperPkg: Perform post FSP-S process. >=20 > From: "Chasel, Chiu" >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1716 >=20 > In API mode FSP wrapper will perform some post > FSP-S process but such process was skipped in Dispatch > mode which may impact some of the boot loaders. > To align behavior between API and Dispatch, an > End-of-Pei callback is introduced to perform same process > in Dispatch mode. >=20 > Note: If boot loader implemented its own > PostFspsHobProcess (), it has to check > PcdFspModeSelection and support each mode > properly. >=20 > Test: Verified on internal platform and both > FSP API and Dispatch modes booted successfully. >=20 > Cc: Nate DeSimone > Cc: Star Zeng > Signed-off-by: Chasel Chiu > --- > IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.c > | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- > -- >=20 > IntelFsp2WrapperPkg/Library/PeiFspWrapperHobProcessLibSample/FspWrap > perHobProcessLibSample.c | 18 +++++++++++++++--- >=20 > IntelFsp2WrapperPkg/Library/PeiFspWrapperHobProcessLibSample/PeiFspWr > apperHobProcessLibSample.inf | 3 ++- > 3 files changed, 77 insertions(+), 7 deletions(-) >=20 > diff --git a/IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.c > b/IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.c > index bb126797ae..441233dfda 100644 > --- a/IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.c > +++ b/IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.c > @@ -3,7 +3,7 @@ > register TemporaryRamDonePpi to call TempRamExit API, and register > MemoryDiscoveredPpi > notify to call FspSiliconInit API. >=20 > - Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.
> + Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.
> SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > **/ > @@ -130,7 +130,7 @@ S3EndOfPeiNotify( > @param[in] This The pointer to this instance of this PPI. > @param[out] FspHobList The pointer to Hob list produced by FSP. >=20 > - @return EFI_SUCCESS FReturn Hob list produced by FSP successfully. > + @return EFI_SUCCESS Return Hob list produced by FSP successfully. > **/ > EFI_STATUS > EFIAPI > @@ -157,7 +157,7 @@ EFI_PEI_PPI_DESCRIPTOR > mPeiFspSiliconInitDonePpi =3D { > @param[in] This The pointer to this instance of this PPI. > @param[out] FspHobList The pointer to Hob list produced by FSP. >=20 > - @return EFI_SUCCESS FReturn Hob list produced by FSP successfully. > + @return EFI_SUCCESS Return Hob list produced by FSP successfully. > **/ > EFI_STATUS > EFIAPI > @@ -179,6 +179,49 @@ FspSiliconInitDoneGetFspHobList ( > } >=20 > /** > + This function is for FSP dispatch mode to perform post FSP-S process. > + > + @param[in] PeiServices Pointer to PEI Services Table. > + @param[in] NotifyDesc Pointer to the descriptor for the Notificati= on > event that > + caused this function to execute. > + @param[in] Ppi Pointer to the PPI data associated with this > function. > + > + @retval EFI_STATUS Status returned by PeiServicesInstallPpi () > +**/ > +EFI_STATUS > +EFIAPI > +FspsWrapperEndOfPeiNotify ( > + IN EFI_PEI_SERVICES **PeiServices, > + IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc, > + IN VOID *Ppi > + ) > +{ > + EFI_STATUS Status; > + > + // > + // This step may include platform specific process in some boot loader= s so > + // aligning the same behavior between API and Dispatch modes. > + // Note: In Dispatch mode no FspHobList so passing NULL to function an= d > + // expecting function will handle it. > + // > + PostFspsHobProcess (NULL); > + > + // > + // Install FspSiliconInitDonePpi so that any other driver can consume = this > info. > + // > + Status =3D PeiServicesInstallPpi (&mPeiFspSiliconInitDonePpi); > + ASSERT_EFI_ERROR(Status); > + > + return Status; > +} > + > +EFI_PEI_NOTIFY_DESCRIPTOR mFspsWrapperEndOfPeiNotifyDesc =3D { > + (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | > EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST), > + &gEfiEndOfPeiSignalPpiGuid, > + FspsWrapperEndOfPeiNotify > +}; > + > +/** > This function is called after PEI core discover memory and finish migr= ation. >=20 > @param[in] PeiServices Pointer to PEI Services Table. > @@ -341,11 +384,19 @@ FspsWrapperPeimEntryPoint ( > IN CONST EFI_PEI_SERVICES **PeiServices > ) > { > + EFI_STATUS Status; > + > DEBUG ((DEBUG_INFO, "FspsWrapperPeimEntryPoint\n")); >=20 > if (PcdGet8 (PcdFspModeSelection) =3D=3D 1) { > + // > + // FSP-S Wrapper running in API mode and calls to FSP API entry poin= t. > + // > FspsWrapperInit (); Suggest updating this function name to FspsWrapperInitApiMode() and add the= new comments to the FspsWrapperInitApiMode() function header. > } else { > + // > + // FSP-S Wrapper running in Dispatch mode and reports FSP-S FV to PE= I > dispatcher. > + // > PeiServicesInstallFvInfoPpi ( > NULL, > (VOID *)(UINTN) PcdGet32 (PcdFspsBaseAddress), > @@ -353,6 +404,12 @@ FspsWrapperPeimEntryPoint ( > NULL, > NULL > ); > + > + // > + // Register EndOfPei Nofity to run post FSP-S process. > + // > + Status =3D PeiServicesNotifyPpi (&mFspsWrapperEndOfPeiNotifyDesc); > + ASSERT_EFI_ERROR (Status); Suggest abstracting this code block to a new function FspsWrapperInitDispat= chMode(). Then the code will be more clear for code symmetry, function name and funct= ion header. :) Thanks, Star > } >=20 > return EFI_SUCCESS; > diff --git > a/IntelFsp2WrapperPkg/Library/PeiFspWrapperHobProcessLibSample/FspWr > apperHobProcessLibSample.c > b/IntelFsp2WrapperPkg/Library/PeiFspWrapperHobProcessLibSample/FspWr > apperHobProcessLibSample.c > index 1c7f661c47..54cebe127c 100644 > --- > a/IntelFsp2WrapperPkg/Library/PeiFspWrapperHobProcessLibSample/FspWr > apperHobProcessLibSample.c > +++ > b/IntelFsp2WrapperPkg/Library/PeiFspWrapperHobProcessLibSample/FspWr > apperHobProcessLibSample.c > @@ -1,7 +1,7 @@ > /** @file > Sample to provide FSP wrapper hob process related function. >=20 > - Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.
> + Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.
> SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > **/ > @@ -378,7 +378,19 @@ PostFspsHobProcess ( > IN VOID *FspHobList > ) > { > - ProcessFspHobList (FspHobList); > - > + // > + // PostFspsHobProcess () will be called in both FSP API and Dispatch > modes to > + // align the same behavior and support a variety of boot loader > implementations. > + // Boot loader provided library function is recommended to support bot= h > API and > + // Dispatch modes by checking PcdFspModeSelection. > + // > + if (PcdGet8 (PcdFspModeSelection) =3D=3D 1) { > + // > + // Only in FSP API mode the wrapper has to build hobs basing on FSP > output data. > + // In this case FspHobList cannot be NULL. > + // > + ASSERT (FspHobList !=3D NULL); > + ProcessFspHobList (FspHobList); > + } > return EFI_SUCCESS; > } > diff --git > a/IntelFsp2WrapperPkg/Library/PeiFspWrapperHobProcessLibSample/PeiFsp > WrapperHobProcessLibSample.inf > b/IntelFsp2WrapperPkg/Library/PeiFspWrapperHobProcessLibSample/PeiFsp > WrapperHobProcessLibSample.inf > index 938ffae494..6d9e306313 100644 > --- > a/IntelFsp2WrapperPkg/Library/PeiFspWrapperHobProcessLibSample/PeiFsp > WrapperHobProcessLibSample.inf > +++ > b/IntelFsp2WrapperPkg/Library/PeiFspWrapperHobProcessLibSample/PeiFsp > WrapperHobProcessLibSample.inf > @@ -1,7 +1,7 @@ > ## @file > # Sample to provide FSP wrapper hob process related function. > # > -# Copyright (c) 2014 - 2016, Intel Corporation. All rights reserved. > +# Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved. > # > # SPDX-License-Identifier: BSD-2-Clause-Patent > # > @@ -61,6 +61,7 @@ > [Pcd] > gIntelFsp2WrapperTokenSpaceGuid.PcdPeiMinMemSize ## > CONSUMES > gIntelFsp2WrapperTokenSpaceGuid.PcdPeiRecoveryMinMemSize ## > CONSUMES > + gIntelFsp2WrapperTokenSpaceGuid.PcdFspModeSelection ## > CONSUMES >=20 > [Guids] > gFspReservedMemoryResourceHobGuid ## CONSUMES ## > HOB > -- > 2.13.3.windows.1