public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Nate DeSimone" <nathaniel.l.desimone@intel.com>
To: "Chiu, Chasel" <chasel.chiu@intel.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Zeng, Star" <star.zeng@intel.com>
Subject: Re: [PATCH v2] IntelFsp2WrapperPkg: Perform post FSP-S process.
Date: Mon, 15 Apr 2019 16:50:19 +0000	[thread overview]
Message-ID: <02A34F284D1DA44BB705E61F7180EF0AAEA3BAD9@ORSMSX114.amr.corp.intel.com> (raw)
In-Reply-To: <20190415060914.5644-1-chasel.chiu@intel.com>

Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>

-----Original Message-----
From: Chiu, Chasel 
Sent: Sunday, April 14, 2019 11:09 PM
To: devel@edk2.groups.io
Cc: Chiu, Chasel <chasel.chiu@intel.com>; Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>; Zeng, Star <star.zeng@intel.com>
Subject: [PATCH v2] IntelFsp2WrapperPkg: Perform post FSP-S process.

From: "Chasel, Chiu" <chasel.chiu@intel.com>

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1716

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.

Note: If boot loader implemented its own
      PostFspsHobProcess (), it has to check
      PcdFspModeSelection and support each mode
      properly.

Test: Verified on internal platform and both
      FSP API and Dispatch modes booted successfully.

Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
---
 IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.c                                             | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
 IntelFsp2WrapperPkg/Library/PeiFspWrapperHobProcessLibSample/FspWrapperHobProcessLibSample.c      | 18 +++++++++++++++---
 IntelFsp2WrapperPkg/Library/PeiFspWrapperHobProcessLibSample/PeiFspWrapperHobProcessLibSample.inf |  3 ++-
 3 files changed, 77 insertions(+), 7 deletions(-)

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.
 
-  Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2014 - 2019, Intel Corporation. All rights 
+ reserved.<BR>
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -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.
 
-  @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 = {
   @param[in]  This         The pointer to this instance of this PPI.
   @param[out] FspHobList   The pointer to Hob list produced by FSP.
 
-  @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 (  }
 
 /**
+  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 Notification 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 
+ loaders so  // aligning the same behavior between API and Dispatch modes.
+  // Note: In Dispatch mode no FspHobList so passing NULL to function and
+  //       expecting function will handle it.
+  //
+  PostFspsHobProcess (NULL);
+
+  //
+  // Install FspSiliconInitDonePpi so that any other driver can consume this info.
+  //
+  Status = PeiServicesInstallPpi (&mPeiFspSiliconInitDonePpi);  
+ ASSERT_EFI_ERROR(Status);
+
+  return Status;
+}
+
+EFI_PEI_NOTIFY_DESCRIPTOR mFspsWrapperEndOfPeiNotifyDesc = {
+  (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 migration.
 
   @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"));
 
   if (PcdGet8 (PcdFspModeSelection) == 1) {
+    //
+    // FSP-S Wrapper running in API mode and calls to FSP API entry point.
+    //
     FspsWrapperInit ();
   } else {
+    //
+    // FSP-S Wrapper running in Dispatch mode and reports FSP-S FV to PEI dispatcher.
+    //
     PeiServicesInstallFvInfoPpi (
       NULL,
       (VOID *)(UINTN) PcdGet32 (PcdFspsBaseAddress), @@ -353,6 +404,12 @@ FspsWrapperPeimEntryPoint (
       NULL,
       NULL
       );
+
+    //
+    // Register EndOfPei Nofity to run post FSP-S process.
+    //
+    Status = PeiServicesNotifyPpi (&mFspsWrapperEndOfPeiNotifyDesc);
+    ASSERT_EFI_ERROR (Status);
   }
 
   return EFI_SUCCESS;
diff --git a/IntelFsp2WrapperPkg/Library/PeiFspWrapperHobProcessLibSample/FspWrapperHobProcessLibSample.c b/IntelFsp2WrapperPkg/Library/PeiFspWrapperHobProcessLibSample/FspWrapperHobProcessLibSample.c
index 1c7f661c47..54cebe127c 100644
--- a/IntelFsp2WrapperPkg/Library/PeiFspWrapperHobProcessLibSample/FspWrapperHobProcessLibSample.c
+++ b/IntelFsp2WrapperPkg/Library/PeiFspWrapperHobProcessLibSample/FspWr
+++ apperHobProcessLibSample.c
@@ -1,7 +1,7 @@
 /** @file
   Sample to provide FSP wrapper hob process related function.
 
-  Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2014 - 2019, Intel Corporation. All rights 
+ reserved.<BR>
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -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 
+ both API and  // Dispatch modes by checking PcdFspModeSelection.
+  //
+  if (PcdGet8 (PcdFspModeSelection) == 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 != NULL);
+    ProcessFspHobList (FspHobList);
+  }
   return EFI_SUCCESS;
 }
diff --git a/IntelFsp2WrapperPkg/Library/PeiFspWrapperHobProcessLibSample/PeiFspWrapperHobProcessLibSample.inf b/IntelFsp2WrapperPkg/Library/PeiFspWrapperHobProcessLibSample/PeiFspWrapperHobProcessLibSample.inf
index 938ffae494..6d9e306313 100644
--- a/IntelFsp2WrapperPkg/Library/PeiFspWrapperHobProcessLibSample/PeiFspWrapperHobProcessLibSample.inf
+++ b/IntelFsp2WrapperPkg/Library/PeiFspWrapperHobProcessLibSample/PeiFs
+++ pWrapperHobProcessLibSample.inf
@@ -1,7 +1,7 @@
 ## @file
 #  Sample to provide FSP wrapper hob process related function.
 #
-#  Copyright (c) 2014 - 2016, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2014 - 2019, Intel Corporation. All rights 
+reserved.<BR>
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent  # @@ -61,6 +61,7 @@  [Pcd]
   gIntelFsp2WrapperTokenSpaceGuid.PcdPeiMinMemSize          ## CONSUMES
   gIntelFsp2WrapperTokenSpaceGuid.PcdPeiRecoveryMinMemSize  ## CONSUMES
+  gIntelFsp2WrapperTokenSpaceGuid.PcdFspModeSelection       ## CONSUMES
 
 [Guids]
   gFspReservedMemoryResourceHobGuid                       ## CONSUMES ## HOB
--
2.13.3.windows.1


      parent reply	other threads:[~2019-04-15 16:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-15  6:09 [PATCH v2] IntelFsp2WrapperPkg: Perform post FSP-S process Chiu, Chasel
2019-04-15  9:34 ` Zeng, Star
2019-04-15 16:50 ` Nate DeSimone [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=02A34F284D1DA44BB705E61F7180EF0AAEA3BAD9@ORSMSX114.amr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox