]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFsp2Pkg/FspNotifyPhase/FspNotifyPhasePeim.c
EmbeddedPkg: Extend NvVarStoreFormattedLib LIBRARY_CLASS
[mirror_edk2.git] / IntelFsp2Pkg / FspNotifyPhase / FspNotifyPhasePeim.c
index 52435fa0b2d82715d76f733ca6d50933bfbcf50a..48030080124f38382cf69c8c5bde19ef26ac2f2a 100644 (file)
@@ -2,13 +2,7 @@
   Source file for FSP notify phase PEI module\r
 \r
   Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.\r
-  This program and the accompanying materials\r
-  are licensed and made available under the terms and conditions of the BSD License\r
-  which accompanies this distribution.  The full text of the license may be found at\r
-  http://opensource.org/licenses/bsd-license.php.\r
-\r
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
 **/\r
 \r
 #include "FspNotifyPhasePeim.h"\r
@@ -48,6 +42,12 @@ CONST EFI_PEI_PPI_DESCRIPTOR gEndOfPeiSignalPpi = {
   NULL\r
 };\r
 \r
+CONST EFI_PEI_PPI_DESCRIPTOR gFspReadyForNotifyPhasePpi = {\r
+  (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r
+  &gFspReadyForNotifyPhasePpiGuid,\r
+  NULL\r
+};\r
+\r
 /**\r
 \r
    This function waits for FSP notify.\r
@@ -88,13 +88,15 @@ WaitForNotify (
   //\r
   FspWaitForNotify ();\r
 \r
-  //\r
-  // Should not come here\r
-  //\r
-  while (TRUE) {\r
-    DEBUG ((DEBUG_ERROR, "No FSP API should be called after FSP is DONE!\n"));\r
-    SetFspApiReturnStatus (EFI_UNSUPPORTED);\r
-    Pei2LoaderSwitchStack ();\r
+  if (GetFspGlobalDataPointer ()->FspMode == FSP_IN_API_MODE) {\r
+    //\r
+    // Should not come here\r
+    //\r
+    while (TRUE) {\r
+      DEBUG ((DEBUG_ERROR, "No FSP API should be called after FSP is DONE!\n"));\r
+      SetFspApiReturnStatus (EFI_UNSUPPORTED);\r
+      Pei2LoaderSwitchStack ();\r
+    }\r
   }\r
 \r
   return EFI_SUCCESS;\r
@@ -121,22 +123,27 @@ FspNotifyPhasePeimEntryPoint (
 \r
   DEBUG ((DEBUG_INFO | DEBUG_INIT, "The entry of FspNotificationPeim\n"));\r
 \r
-  //\r
-  // Locate old DXE IPL PPI\r
-  //\r
-  Status = PeiServicesLocatePpi (\r
-            &gEfiDxeIplPpiGuid,\r
-            0,\r
-            &OldDescriptor,\r
-            &OldDxeIplPpi\r
-            );\r
-  ASSERT_EFI_ERROR (Status);\r
-\r
-  //\r
-  // Re-install the DXE IPL PPI to wait for notify\r
-  //\r
-  Status = PeiServicesReInstallPpi (OldDescriptor, &mInstallDxeIplPpi);\r
-  ASSERT_EFI_ERROR (Status);\r
+  if (GetFspGlobalDataPointer ()->FspMode == FSP_IN_API_MODE) {\r
+    //\r
+    // Locate old DXE IPL PPI\r
+    //\r
+    Status = PeiServicesLocatePpi (\r
+              &gEfiDxeIplPpiGuid,\r
+              0,\r
+              &OldDescriptor,\r
+              &OldDxeIplPpi\r
+              );\r
+    ASSERT_EFI_ERROR (Status);\r
+\r
+    //\r
+    // Re-install the DXE IPL PPI to wait for notify\r
+    //\r
+    Status = PeiServicesReInstallPpi (OldDescriptor, &mInstallDxeIplPpi);\r
+    ASSERT_EFI_ERROR (Status);\r
+  } else {\r
+    Status = PeiServicesInstallPpi (&gFspReadyForNotifyPhasePpi);\r
+    ASSERT_EFI_ERROR (Status);\r
+  }\r
 \r
   return EFI_SUCCESS;\r
 }\r