Add IntelFspWrapper to support boot EDKII on FSP bin.
[mirror_edk2.git] / IntelFspWrapperPkg / FspInitPei / FspNotifyS3.c
CommitLineData
a33a2f62
JY
1/** @file\r
2 In EndOfPei notify, it will call FspNotifyPhase API.\r
3\r
4 Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>\r
5 This program and the accompanying materials\r
6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php.\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15\r
16#include "FspInitPei.h"\r
17\r
18/**\r
19 This function handles S3 resume task at the end of PEI\r
20\r
21 @param[in] PeiServices Pointer to PEI Services Table.\r
22 @param[in] NotifyDesc Pointer to the descriptor for the Notification event that\r
23 caused this function to execute.\r
24 @param[in] Ppi Pointer to the PPI data associated with this function.\r
25\r
26 @retval EFI_STATUS Always return EFI_SUCCESS\r
27**/\r
28EFI_STATUS\r
29EFIAPI\r
30S3EndOfPeiNotify (\r
31 IN EFI_PEI_SERVICES **PeiServices,\r
32 IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc,\r
33 IN VOID *Ppi\r
34 );\r
35\r
36EFI_PEI_NOTIFY_DESCRIPTOR mS3EndOfPeiNotifyDesc = {\r
37 (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r
38 &gEfiEndOfPeiSignalPpiGuid,\r
39 S3EndOfPeiNotify\r
40};\r
41\r
42/**\r
43 This function handles S3 resume task at the end of PEI\r
44\r
45 @param[in] PeiServices Pointer to PEI Services Table.\r
46 @param[in] NotifyDesc Pointer to the descriptor for the Notification event that\r
47 caused this function to execute.\r
48 @param[in] Ppi Pointer to the PPI data associated with this function.\r
49\r
50 @retval EFI_STATUS Always return EFI_SUCCESS\r
51**/\r
52EFI_STATUS\r
53EFIAPI\r
54S3EndOfPeiNotify (\r
55 IN EFI_PEI_SERVICES **PeiServices,\r
56 IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc,\r
57 IN VOID *Ppi\r
58 )\r
59{\r
60 NOTIFY_PHASE_PARAMS NotifyPhaseParams;\r
61 FSP_STATUS FspStatus;\r
62 FSP_INFO_HEADER *FspHeader;\r
63\r
64 FspHeader = FspFindFspHeader (PcdGet32 (PcdFlashFvFspBase));\r
65 if (FspHeader == NULL) {\r
66 return EFI_DEVICE_ERROR;\r
67 }\r
68\r
69 NotifyPhaseParams.Phase = EnumInitPhaseAfterPciEnumeration;\r
70 FspStatus = CallFspNotifyPhase (FspHeader, &NotifyPhaseParams);\r
71 if (FspStatus != FSP_SUCCESS) {\r
72 DEBUG((DEBUG_ERROR, "FSP S3NotifyPhase AfterPciEnumeration failed, status: 0x%x\n", FspStatus));\r
73 } else {\r
74 DEBUG((DEBUG_INFO, "FSP S3NotifyPhase AfterPciEnumeration Success.\n"));\r
75 }\r
76\r
77 NotifyPhaseParams.Phase = EnumInitPhaseReadyToBoot;\r
78 FspStatus = CallFspNotifyPhase (FspHeader, &NotifyPhaseParams);\r
79 if (FspStatus != FSP_SUCCESS) {\r
80 DEBUG((DEBUG_ERROR, "FSP S3NotifyPhase ReadyToBoot failed, status: 0x%x\n", FspStatus));\r
81 } else {\r
82 DEBUG((DEBUG_INFO, "FSP S3NotifyPhase ReadyToBoot Success.\n"));\r
83 }\r
84\r
85 return EFI_SUCCESS;\r
86}\r