Update FSP to follow:
https://firmware.intel.com/sites/default/files/FSP_EAS_v2.0_Draft%20External.pdf

Add FspGetResourceDescriptorByOwner/FspMemoryInitDone/FspTempRamExitDone API
Get/Set FSP configuration data according to FSP2.0 API.
Add EnumInitPhaseEndOfFirmware support.
Add report status code for FSP progress.

The FSP1.1 compatibility is NOT maintained.

The new Intel platform will follow FSP2.0.
The old platform can either use an old EDK branch,
or move FSP1.1 support to platform directory.

Cc: Giri P Mudusuru <giri.p.mudus...@intel.com>
Cc: Maurice Ma <maurice...@intel.com>
Cc: Ravi P Rangarajan <ravi.p.rangara...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen....@intel.com>
Reviewed-by: Giri P Mudusuru <giri.p.mudus...@intel.com>
Reviewed-by: Maurice Ma <maurice...@intel.com>
Reviewed-by: Ravi P Rangarajan <ravi.p.rangara...@intel.com>
---
 IntelFspPkg/Include/Library/FspPlatformLib.h                  |  33 +++-
 IntelFspPkg/Library/BaseFspPlatformLib/BaseFspPlatformLib.inf |   7 +-
 IntelFspPkg/Library/BaseFspPlatformLib/FspPlatformMemory.c    | 103 
++++++------
 IntelFspPkg/Library/BaseFspPlatformLib/FspPlatformNotify.c    | 171 
++++++++++++++------
 4 files changed, 210 insertions(+), 104 deletions(-)

diff --git a/IntelFspPkg/Include/Library/FspPlatformLib.h 
b/IntelFspPkg/Include/Library/FspPlatformLib.h
index 2346098..061bd79 100644
--- a/IntelFspPkg/Include/Library/FspPlatformLib.h
+++ b/IntelFspPkg/Include/Library/FspPlatformLib.h
@@ -1,6 +1,6 @@
 /** @file
 
-  Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2014 - 2016, Intel Corporation. All rights reserved.<BR>
   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
@@ -15,6 +15,17 @@
 #define _FSP_PLATFORM_LIB_H_
 
 /**
+  Get system memory resource descriptor by owner.
+
+  @param[in] OwnerGuid   resource owner guid
+**/
+EFI_HOB_RESOURCE_DESCRIPTOR *
+EFIAPI
+FspGetResourceDescriptorByOwner (
+  IN EFI_GUID   *OwnerGuid
+);
+
+/**
   Get system memory from HOB.
 
   @param[in,out] LowMemoryLength   less than 4G memory length
@@ -59,6 +70,26 @@ FspInitDone (
   );
 
 /**
+  This function returns control to BootLoader after MemoryInitApi.
+
+**/
+VOID
+EFIAPI
+FspMemoryInitDone (
+  IN VOID   **HobListPtr
+  );
+
+/**
+  This function returns control to BootLoader after TempRamExitApi.
+
+**/
+VOID
+EFIAPI
+FspTempRamExitDone (
+  VOID
+  );
+
+/**
   This function handle NotifyPhase API call from the BootLoader.
   It gives control back to the BootLoader after it is handled. If the
   Notification code is a ReadyToBoot event, this function will return
diff --git a/IntelFspPkg/Library/BaseFspPlatformLib/BaseFspPlatformLib.inf 
b/IntelFspPkg/Library/BaseFspPlatformLib/BaseFspPlatformLib.inf
index 1ec6e4e..7d985f8 100644
--- a/IntelFspPkg/Library/BaseFspPlatformLib/BaseFspPlatformLib.inf
+++ b/IntelFspPkg/Library/BaseFspPlatformLib/BaseFspPlatformLib.inf
@@ -1,7 +1,7 @@
 ## @file
 # Instance of FspPlatformLib
 #
-#  Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2014 - 2016, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD 
License
@@ -31,6 +31,9 @@
 [LibraryClasses]
   BaseMemoryLib
   MemoryAllocationLib
+  FspCommonLib
+  PerformanceLib
+  ReportStatusCodeLib
 
 [Pcd]
   gIntelFspPkgTokenSpaceGuid.PcdGlobalDataPointerAddress    ## CONSUMES
@@ -40,6 +43,8 @@
 
 [Guids]
   gFspBootLoaderTemporaryMemoryGuid                         ## PRODUCES ## HOB
+  gFspPerformanceDataGuid                                   ## CONSUMES ## GUID
+  gFspEventEndOfFirmwareGuid                                ## PRODUCES ## GUID
 
 [FixedPcd]
   gIntelFspPkgTokenSpaceGuid.PcdFspMaxPatchEntry        ## CONSUMES
diff --git a/IntelFspPkg/Library/BaseFspPlatformLib/FspPlatformMemory.c 
b/IntelFspPkg/Library/BaseFspPlatformLib/FspPlatformMemory.c
index ed5db93..1d22bf2 100644
--- a/IntelFspPkg/Library/BaseFspPlatformLib/FspPlatformMemory.c
+++ b/IntelFspPkg/Library/BaseFspPlatformLib/FspPlatformMemory.c
@@ -1,6 +1,6 @@
 /** @file
 
-  Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2014 - 2016, Intel Corporation. All rights reserved.<BR>
   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
@@ -25,6 +25,40 @@
 #include <FspApi.h>
 
 /**
+  Get system memory resource descriptor by owner.
+
+  @param[in] OwnerGuid   resource owner guid
+**/
+EFI_HOB_RESOURCE_DESCRIPTOR *
+EFIAPI
+FspGetResourceDescriptorByOwner (
+  IN EFI_GUID   *OwnerGuid
+  )
+{
+  EFI_PEI_HOB_POINTERS    Hob;
+
+  //
+  // Get the HOB list for processing
+  //
+  Hob.Raw = GetHobList ();
+
+  //
+  // Collect memory ranges
+  //
+  while (!END_OF_HOB_LIST (Hob)) {
+    if (Hob.Header->HobType == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) {
+      if ((Hob.ResourceDescriptor->ResourceType == 
EFI_RESOURCE_MEMORY_RESERVED) && \
+          (CompareGuid (&Hob.ResourceDescriptor->Owner, OwnerGuid))) {
+        return  Hob.ResourceDescriptor;                     
+      }
+    }
+    Hob.Raw = GET_NEXT_HOB (Hob);
+  }
+  
+  return NULL;
+}
+
+/**
   Get system memory from HOB.
 
   @param[in,out] LowMemoryLength   less than 4G memory length
@@ -77,54 +111,37 @@ FspMigrateTemporaryMemory (
   VOID
  )
 {
-  FSP_INIT_RT_COMMON_BUFFER *FspInitRtBuffer;
   UINT32                    BootLoaderTempRamStart;
   UINT32                    BootLoaderTempRamEnd;
   UINT32                    BootLoaderTempRamSize;
   UINT32                    OffsetGap;
   UINT32                    FspParamPtr;
-  FSP_INIT_PARAMS           *FspInitParams;
-  UINT32                    *NewStackTop;
   VOID                      *BootLoaderTempRamHob;
-  UINT32                    UpdDataRgnPtr;
   UINT32                    MemoryInitUpdPtr;
-  UINT32                    SiliconInitUpdPtr;
   VOID                      *PlatformDataPtr;
-  UINT8                      ApiMode;
-    
-  ApiMode = GetFspApiCallingMode ();
 
   //
   // Get the temporary memory range used by the BootLoader
   //
-  BootLoaderTempRamStart = PcdGet32(PcdTemporaryRamBase);
-  BootLoaderTempRamSize  = PcdGet32(PcdTemporaryRamSize) - 
PcdGet32(PcdFspTemporaryRamSize);
+  BootLoaderTempRamStart = GetFspCarBase ();
+  BootLoaderTempRamSize  = GetFspCarSize () - PcdGet32(PcdFspTemporaryRamSize);
+
   BootLoaderTempRamEnd   = BootLoaderTempRamStart +  BootLoaderTempRamSize;
 
   //
   // Build a Boot Loader Temporary Memory GUID HOB
   //
-  if (ApiMode == 0) {
-    BootLoaderTempRamHob = BuildGuidHob (&gFspBootLoaderTemporaryMemoryGuid, 
BootLoaderTempRamSize);
-  } else {
-    BootLoaderTempRamHob = (VOID *)AllocatePages (EFI_SIZE_TO_PAGES 
(BootLoaderTempRamSize));
-  }
+  BootLoaderTempRamHob = (VOID *)AllocatePages (EFI_SIZE_TO_PAGES 
(BootLoaderTempRamSize));
   ASSERT(BootLoaderTempRamHob != NULL);
 
+  DEBUG ((DEBUG_INFO, "FSP_BOOT_LOADER_TEMPORARY_MEMORY_HOB\n"));
+  DEBUG ((DEBUG_INFO, "FspBootLoaderTemporaryMemory Base : %x\n", 
BootLoaderTempRamStart));
+  DEBUG ((DEBUG_INFO, "FspBootLoaderTemporaryMemory Size : %x\n", 
BootLoaderTempRamSize));
+
   CopyMem (BootLoaderTempRamHob, (VOID *)BootLoaderTempRamStart, 
BootLoaderTempRamSize);
   OffsetGap = (UINT32)BootLoaderTempRamHob - BootLoaderTempRamStart;
 
   //
-  // Set a new stack frame for the continuation function
-  //
-  if (ApiMode == 0) {
-    FspInitParams   = (FSP_INIT_PARAMS *)GetFspApiParameter ();
-    FspInitRtBuffer = (FSP_INIT_RT_COMMON_BUFFER *)FspInitParams->RtBufferPtr;
-    NewStackTop     = (UINT32 *)FspInitRtBuffer->StackTop - 1;
-    SetFspCoreStackPointer (NewStackTop);
-  }
-
-  //
   // Fix the FspInit Parameter Pointers to the new location.
   //
   FspParamPtr = GetFspApiParameter ();
@@ -132,40 +149,12 @@ FspMigrateTemporaryMemory (
     SetFspApiParameter(FspParamPtr + OffsetGap);
   }
 
-  FspInitParams = (FSP_INIT_PARAMS *)GetFspApiParameter ();
-  if ((UINT32)(FspInitParams->RtBufferPtr) >= BootLoaderTempRamStart &&
-      (UINT32)(FspInitParams->RtBufferPtr) <  BootLoaderTempRamEnd) {
-    FspInitParams->RtBufferPtr = (VOID *)((UINT32)(FspInitParams->RtBufferPtr) 
+ OffsetGap);
-  }
-
-  if ((UINT32)(FspInitParams->NvsBufferPtr) >= BootLoaderTempRamStart &&
-      (UINT32)(FspInitParams->NvsBufferPtr) <  BootLoaderTempRamEnd) {
-    FspInitParams->NvsBufferPtr = (VOID 
*)((UINT32)(FspInitParams->NvsBufferPtr) + OffsetGap);
-  }
-
-  if ((UINT32)(((FSP_INIT_RT_COMMON_BUFFER 
*)(FspInitParams->RtBufferPtr))->UpdDataRgnPtr) >= BootLoaderTempRamStart &&
-      (UINT32)(((FSP_INIT_RT_COMMON_BUFFER 
*)(FspInitParams->RtBufferPtr))->UpdDataRgnPtr) <  BootLoaderTempRamEnd) {
-    ((FSP_INIT_RT_COMMON_BUFFER *)(FspInitParams->RtBufferPtr))->UpdDataRgnPtr 
= \
-           (VOID *)((UINT32)(((FSP_INIT_RT_COMMON_BUFFER 
*)(FspInitParams->RtBufferPtr))->UpdDataRgnPtr) + OffsetGap);
-  }
-
   //
   // Update UPD pointer in FSP Global Data
   //
-  if (ApiMode == 0) {
-    UpdDataRgnPtr = (UINT32)((UINT32 *)GetFspUpdDataPointer ());
-    if (UpdDataRgnPtr >= BootLoaderTempRamStart && UpdDataRgnPtr < 
BootLoaderTempRamEnd) {
-      MemoryInitUpdPtr = (UINT32)((UINT32 *)GetFspMemoryInitUpdDataPointer ());
-      SiliconInitUpdPtr = (UINT32)((UINT32 *)GetFspSiliconInitUpdDataPointer 
());
-      SetFspUpdDataPointer ((VOID *)(UpdDataRgnPtr + OffsetGap));
-      SetFspMemoryInitUpdDataPointer ((VOID *)(MemoryInitUpdPtr + OffsetGap));
-      SetFspSiliconInitUpdDataPointer ((VOID *)(SiliconInitUpdPtr + 
OffsetGap));
-    }
-  } else {
-    MemoryInitUpdPtr = (UINT32)((UINT32 *)GetFspMemoryInitUpdDataPointer ());
-    if (MemoryInitUpdPtr >= BootLoaderTempRamStart && MemoryInitUpdPtr < 
BootLoaderTempRamEnd) {
-      SetFspMemoryInitUpdDataPointer ((VOID *)(MemoryInitUpdPtr + OffsetGap));
-    }
+  MemoryInitUpdPtr = (UINT32)((UINT32 *)GetFspMemoryInitUpdDataPointer ());
+  if (MemoryInitUpdPtr >= BootLoaderTempRamStart && MemoryInitUpdPtr < 
BootLoaderTempRamEnd) {
+    SetFspMemoryInitUpdDataPointer ((VOID *)(MemoryInitUpdPtr + OffsetGap));
   }
 
   //
diff --git a/IntelFspPkg/Library/BaseFspPlatformLib/FspPlatformNotify.c 
b/IntelFspPkg/Library/BaseFspPlatformLib/FspPlatformNotify.c
index e6f5fe8..51d7af4 100644
--- a/IntelFspPkg/Library/BaseFspPlatformLib/FspPlatformNotify.c
+++ b/IntelFspPkg/Library/BaseFspPlatformLib/FspPlatformNotify.c
@@ -1,6 +1,6 @@
 /** @file
 
-  Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2014 - 2016, Intel Corporation. All rights reserved.<BR>
   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
@@ -23,7 +23,11 @@
 #include <Library/FspCommonLib.h>
 #include <Guid/EventGroup.h>
 #include <FspApi.h>
+#include <FspStatusCode.h>
 #include <Protocol/PciEnumerationComplete.h>
+#include <Library/ReportStatusCodeLib.h>
+#include <Library/PerformanceLib.h>
+extern EFI_GUID gFspPerformanceDataGuid;
 
 EFI_PEI_PPI_DESCRIPTOR      mPeiPostPciEnumerationPpi = {
   (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
@@ -37,10 +41,16 @@ EFI_PEI_PPI_DESCRIPTOR      mPeiReadyToBootPpi = {
   NULL
 };
 
+EFI_PEI_PPI_DESCRIPTOR      mPeiEndOfFirmwarePpi = {
+  (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
+  &gFspEventEndOfFirmwareGuid,
+  NULL
+};
 
 UINT32  mFspNotifySequence[] = {
   EnumInitPhaseAfterPciEnumeration,
-  EnumInitPhaseReadyToBoot
+  EnumInitPhaseReadyToBoot,
+  EnumInitPhaseEndOfFirmware
 };
 
 /**
@@ -79,6 +89,14 @@ FspNotificationHandler (
     PeiServicesInstallPpi (&mPeiReadyToBootPpi);
     break;
 
+  case EnumInitPhaseEndOfFirmware:
+    //
+    // End of Firmware
+    //
+    DEBUG ((DEBUG_INFO| DEBUG_INIT, "FSP End of Firmware ...\n"));
+    PeiServicesInstallPpi (&mPeiEndOfFirmwarePpi);
+    break;
+
   default:
     Status = EFI_INVALID_PARAMETER;
     break;
@@ -98,44 +116,91 @@ FspInitDone (
   VOID
   )
 {
-  FSP_INIT_PARAMS        *FspInitParams;
+  //
+  // This is the end of the FspSiliconInit API
+  // Give control back to the boot loader
+  //
+  DEBUG ((DEBUG_INFO | DEBUG_INIT, "FspSiliconInitApi() - End\n"));
 
-  if (GetFspApiCallingMode() == 0) {
-    //
-    // FspInit API is used, so jump into the ContinuationFunc
-    //
-    FspInitParams   = (FSP_INIT_PARAMS *)GetFspApiParameter ();
-  
-    //
-    // Modify the parameters for ContinuationFunc
-    //
-    SetFspContinuationFuncParameter(EFI_SUCCESS, 0);
-    SetFspContinuationFuncParameter((UINT32)GetHobList(), 1);
-  
-    //
-    // Modify the return address to ContinuationFunc
-    //
-    SetFspApiReturnAddress((UINT32)FspInitParams->ContinuationFunc);
-  
-    //
-    // Give control back to the boot loader framework caller after FspInit is 
done
-    // It is done throught the continuation function
-    //
-    SetFspMeasurePoint (FSP_PERF_ID_API_FSPINIT_EXIT);
-  } else {
-    //
-    // FspMemoryInit API is used, so return directly
-    //
+  PERF_END_EX (&gFspPerformanceDataGuid, "EventRec", NULL, 0, 0x907F);
 
-    //
-    // This is the end of the FspSiliconInit API
-    // Give control back to the boot loader
-    //
-    DEBUG ((DEBUG_INFO | DEBUG_INIT, "FspSiliconInitApi() - End\n"));
-    SetFspApiReturnStatus (EFI_SUCCESS);
-  }
+  REPORT_STATUS_CODE (EFI_PROGRESS_CODE, FSP_STATUS_CODE_COMMON_CODE | 
FSP_STATUS_CODE_API_EXIT);
+  SetFspApiReturnStatus (EFI_SUCCESS);
 
   Pei2LoaderSwitchStack();
+
+  PERF_START_EX (&gFspPerformanceDataGuid, "EventRec", NULL, 0, 0x6000);
+}
+
+/**
+  This function returns control to BootLoader after MemoryInitApi.
+
+**/
+VOID
+EFIAPI
+FspMemoryInitDone (
+  IN VOID   **HobListPtr
+  )
+{
+  //
+  // Calling use FspMemoryInit API
+  // Update HOB and return the control directly
+  //
+  if (HobListPtr != NULL) {
+    *HobListPtr = (VOID *) GetHobList ();
+  }
+
+  //
+  // This is the end of the FspMemoryInit API
+  // Give control back to the boot loader
+  //
+  // SetFspMeasurePoint (FSP_PERF_ID_API_MEMORYINIT_EXIT); // @todo: Use Perf 
macro instead
+  DEBUG ((DEBUG_INFO | DEBUG_INIT, "FspMemoryInitApi() - End\n"));
+  REPORT_STATUS_CODE (EFI_PROGRESS_CODE, FSP_STATUS_CODE_MEMORY_INIT | 
FSP_STATUS_CODE_COMMON_CODE | FSP_STATUS_CODE_API_EXIT);
+  SetFspApiReturnStatus (EFI_SUCCESS);
+  Pei2LoaderSwitchStack ();
+
+  //
+  // The TempRamExitApi is called
+  //
+  if (GetFspApiCallingIndex () == TempRamExitApiIndex) {
+    SetPhaseStatusCode (FSP_STATUS_CODE_TEMP_RAM_EXIT);
+    REPORT_STATUS_CODE (EFI_PROGRESS_CODE, FSP_STATUS_CODE_TEMP_RAM_EXIT | 
FSP_STATUS_CODE_COMMON_CODE | FSP_STATUS_CODE_API_ENTRY);
+    // SetFspMeasurePoint (FSP_PERF_ID_API_TMPRAMEXIT_ENTRY); // @todo: Use 
Perf macro instead
+    DEBUG ((DEBUG_INFO | DEBUG_INIT, "TempRamExitApi() - Begin\n"));
+  } else {
+    // SetFspMeasurePoint (FSP_PERF_ID_API_SILICONINIT_ENTRY); // @todo: Use 
Perf macro instead
+    DEBUG ((DEBUG_INFO | DEBUG_INIT, "FspSiliconInitApi() - Begin\n"));
+    SetPhaseStatusCode (FSP_STATUS_CODE_SILICON_INIT);
+    REPORT_STATUS_CODE (EFI_PROGRESS_CODE, FSP_STATUS_CODE_SILICON_INIT | 
FSP_STATUS_CODE_COMMON_CODE | FSP_STATUS_CODE_API_ENTRY);
+  }
+}
+
+/**
+  This function returns control to BootLoader after TempRamExitApi.
+
+**/
+VOID
+EFIAPI
+FspTempRamExitDone (
+  VOID
+  )
+{
+
+  //
+  // This is the end of the TempRamExit API
+  // Give control back to the boot loader
+  //
+  // SetFspMeasurePoint (FSP_PERF_ID_API_TMPRAMEXIT_EXIT); // @todo: Use Perf 
macro instead
+  DEBUG ((DEBUG_INFO | DEBUG_INIT, "TempRamExitApi() - End\n"));
+  REPORT_STATUS_CODE (EFI_PROGRESS_CODE, FSP_STATUS_CODE_TEMP_RAM_EXIT | 
FSP_STATUS_CODE_COMMON_CODE | FSP_STATUS_CODE_API_EXIT);
+  SetFspApiReturnStatus (EFI_SUCCESS);
+  Pei2LoaderSwitchStack ();
+
+  SetPhaseStatusCode (FSP_STATUS_CODE_SILICON_INIT);
+  // SetFspMeasurePoint (FSP_PERF_ID_API_SILICONINIT_ENTRY); // @todo: Use 
Perf macro instead
+  DEBUG ((DEBUG_INFO | DEBUG_INIT, "SiliconInitApi() - Begin\n"));
+  REPORT_STATUS_CODE (EFI_PROGRESS_CODE, FSP_STATUS_CODE_SILICON_INIT | 
FSP_STATUS_CODE_COMMON_CODE | FSP_STATUS_CODE_API_ENTRY);
 }
 
 /**
@@ -161,31 +226,47 @@ FspWaitForNotify (
     Count = (UINT8)((NotificationCount << 1) & 0x07);
     SetFspMeasurePoint (FSP_PERF_ID_API_NOTIFY_POSTPCI_ENTRY + Count);
 
-    NotificationValue = ((NOTIFY_PHASE_PARAMS *)(UINTN)GetFspApiParameter 
())->Phase;
-    DEBUG ((DEBUG_INFO, "FSP Got Notification. Notification Value : 0x%08X\n", 
NotificationValue));
+    if (NotificationCount == 0) {
+      SetPhaseStatusCode (FSP_STATUS_CODE_POST_PCIE_ENUM_NOTIFICATION);
+      REPORT_STATUS_CODE (EFI_PROGRESS_CODE, 
FSP_STATUS_CODE_POST_PCIE_ENUM_NOTIFICATION | FSP_STATUS_CODE_COMMON_CODE | 
FSP_STATUS_CODE_API_ENTRY);
+    } else if (NotificationCount == 1) {
+      SetPhaseStatusCode (FSP_STATUS_CODE_READY_TO_BOOT_NOTIFICATION);
+      REPORT_STATUS_CODE (EFI_PROGRESS_CODE, 
FSP_STATUS_CODE_READY_TO_BOOT_NOTIFICATION | FSP_STATUS_CODE_COMMON_CODE | 
FSP_STATUS_CODE_API_ENTRY);
+    } else if (NotificationCount == 2) {
+      SetPhaseStatusCode (FSP_STATUS_CODE_END_OF_FIRMWARE_NOTIFICATION);
+      REPORT_STATUS_CODE (EFI_PROGRESS_CODE, 
FSP_STATUS_CODE_END_OF_FIRMWARE_NOTIFICATION | FSP_STATUS_CODE_COMMON_CODE | 
FSP_STATUS_CODE_API_ENTRY);
+    }
 
+    NotificationValue = ((NOTIFY_PHASE_PARAMS *)(UINTN)GetFspApiParameter 
())->Phase;
+    DEBUG ((DEBUG_INFO | DEBUG_INIT, "NotifyPhaseApi() - Begin  [Phase: 
%08X]\n", NotificationValue));
     if (mFspNotifySequence[NotificationCount] != NotificationValue) {
       //
       // Notify code does not follow the predefined order
       //
       DEBUG ((DEBUG_INFO, "Unsupported FSP Notification Value\n"));
-      SetFspApiReturnStatus(EFI_UNSUPPORTED);
+      Status = EFI_UNSUPPORTED;
     } else {
       //
       // Process Notification and Give control back to the boot loader 
framework caller
       //
       Status = FspNotificationHandler (NotificationValue);
-      DEBUG ((DEBUG_INFO, "FSP Notification Handler Returns : 0x%08X\n", 
Status));
-      SetFspApiReturnStatus(Status);
       if (!EFI_ERROR(Status)) {
         NotificationCount++;
-        SetFspApiReturnStatus(EFI_SUCCESS);
-        if (NotificationValue == EnumInitPhaseReadyToBoot) {
-          break;
-        }
       }
     }
+
+    SetFspApiReturnStatus(Status);
+    DEBUG ((DEBUG_INFO | DEBUG_INIT, "NotifyPhaseApi() - End  [Status: 
0x%08X]\n", Status));
+
     SetFspMeasurePoint (FSP_PERF_ID_API_NOTIFY_POSTPCI_EXIT + Count);
+
+    if ((NotificationCount - 1) == 0) {
+      REPORT_STATUS_CODE (EFI_PROGRESS_CODE, 
FSP_STATUS_CODE_POST_PCIE_ENUM_NOTIFICATION | FSP_STATUS_CODE_COMMON_CODE | 
FSP_STATUS_CODE_API_EXIT);
+    } else if ((NotificationCount - 1) == 1) {
+      REPORT_STATUS_CODE (EFI_PROGRESS_CODE, 
FSP_STATUS_CODE_READY_TO_BOOT_NOTIFICATION | FSP_STATUS_CODE_COMMON_CODE | 
FSP_STATUS_CODE_API_EXIT);
+    } else if ((NotificationCount - 1) == 2) {
+      REPORT_STATUS_CODE (EFI_PROGRESS_CODE, 
FSP_STATUS_CODE_END_OF_FIRMWARE_NOTIFICATION | FSP_STATUS_CODE_COMMON_CODE | 
FSP_STATUS_CODE_API_EXIT);
+    }
     Pei2LoaderSwitchStack();
   }
 
-- 
2.7.4.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to