]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFsp2Pkg/FspNotifyPhase/FspNotifyPhasePeim.c
IntelFsp2Pkg: Support FSP Dispatch mode
[mirror_edk2.git] / IntelFsp2Pkg / FspNotifyPhase / FspNotifyPhasePeim.c
index 52435fa0b2d82715d76f733ca6d50933bfbcf50a..cbea3a7eaa8ff1a5349fa18f1345c40b70666a43 100644 (file)
@@ -48,6 +48,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 +94,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 +129,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