]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFspWrapperPkg/FspInitPei/FspNotifyS3.c
Add IntelFspWrapper to support boot EDKII on FSP bin.
[mirror_edk2.git] / IntelFspWrapperPkg / FspInitPei / FspNotifyS3.c
diff --git a/IntelFspWrapperPkg/FspInitPei/FspNotifyS3.c b/IntelFspWrapperPkg/FspInitPei/FspNotifyS3.c
new file mode 100644 (file)
index 0000000..6fd2b77
--- /dev/null
@@ -0,0 +1,86 @@
+/** @file\r
+  In EndOfPei notify, it will call FspNotifyPhase API.\r
+\r
+  Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>\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
+\r
+**/\r
+\r
+\r
+#include "FspInitPei.h"\r
+\r
+/**\r
+  This function handles S3 resume task at the end of PEI\r
+\r
+  @param[in] PeiServices    Pointer to PEI Services Table.\r
+  @param[in] NotifyDesc     Pointer to the descriptor for the Notification event that\r
+                            caused this function to execute.\r
+  @param[in] Ppi            Pointer to the PPI data associated with this function.\r
+\r
+  @retval EFI_STATUS        Always return EFI_SUCCESS\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+S3EndOfPeiNotify (\r
+  IN EFI_PEI_SERVICES          **PeiServices,\r
+  IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc,\r
+  IN VOID                      *Ppi\r
+  );\r
+\r
+EFI_PEI_NOTIFY_DESCRIPTOR mS3EndOfPeiNotifyDesc = {\r
+  (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r
+  &gEfiEndOfPeiSignalPpiGuid,\r
+  S3EndOfPeiNotify\r
+};\r
+\r
+/**\r
+  This function handles S3 resume task at the end of PEI\r
+\r
+  @param[in] PeiServices    Pointer to PEI Services Table.\r
+  @param[in] NotifyDesc     Pointer to the descriptor for the Notification event that\r
+                            caused this function to execute.\r
+  @param[in] Ppi            Pointer to the PPI data associated with this function.\r
+\r
+  @retval EFI_STATUS        Always return EFI_SUCCESS\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+S3EndOfPeiNotify (\r
+  IN EFI_PEI_SERVICES          **PeiServices,\r
+  IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc,\r
+  IN VOID                      *Ppi\r
+  )\r
+{\r
+  NOTIFY_PHASE_PARAMS NotifyPhaseParams;\r
+  FSP_STATUS          FspStatus;\r
+  FSP_INFO_HEADER     *FspHeader;\r
+\r
+  FspHeader = FspFindFspHeader (PcdGet32 (PcdFlashFvFspBase));\r
+  if (FspHeader == NULL) {\r
+    return EFI_DEVICE_ERROR;\r
+  }\r
+\r
+  NotifyPhaseParams.Phase = EnumInitPhaseAfterPciEnumeration;\r
+  FspStatus = CallFspNotifyPhase (FspHeader, &NotifyPhaseParams);\r
+  if (FspStatus != FSP_SUCCESS) {\r
+    DEBUG((DEBUG_ERROR, "FSP S3NotifyPhase AfterPciEnumeration failed, status: 0x%x\n", FspStatus));\r
+  } else {\r
+    DEBUG((DEBUG_INFO, "FSP S3NotifyPhase AfterPciEnumeration Success.\n"));\r
+  }\r
+\r
+  NotifyPhaseParams.Phase = EnumInitPhaseReadyToBoot;\r
+  FspStatus = CallFspNotifyPhase (FspHeader, &NotifyPhaseParams);\r
+  if (FspStatus != FSP_SUCCESS) {\r
+    DEBUG((DEBUG_ERROR, "FSP S3NotifyPhase ReadyToBoot failed, status: 0x%x\n", FspStatus));\r
+  } else {\r
+    DEBUG((DEBUG_INFO, "FSP S3NotifyPhase ReadyToBoot Success.\n"));\r
+  }\r
+\r
+  return EFI_SUCCESS;\r
+}\r