2 Source file for FSP notify phase PEI module
4 Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php.
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14 #include "FspNotifyPhasePeim.h"
18 This function waits for FSP notify.
20 @param This Entry point for DXE IPL PPI.
21 @param PeiServices General purpose services available to every PEIM.
22 @param HobList Address to the Pei HOB list.
24 @return EFI_SUCCESS This function never returns.
30 IN CONST EFI_DXE_IPL_PPI
*This
,
31 IN EFI_PEI_SERVICES
**PeiServices
,
32 IN EFI_PEI_HOB_POINTERS HobList
35 CONST EFI_DXE_IPL_PPI mDxeIplPpi
= {
39 CONST EFI_PEI_PPI_DESCRIPTOR mInstallDxeIplPpi
= {
40 EFI_PEI_PPI_DESCRIPTOR_PPI
,
45 CONST EFI_PEI_PPI_DESCRIPTOR gEndOfPeiSignalPpi
= {
46 (EFI_PEI_PPI_DESCRIPTOR_PPI
| EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST
),
47 &gEfiEndOfPeiSignalPpiGuid
,
51 CONST EFI_PEI_PPI_DESCRIPTOR gFspReadyForNotifyPhasePpi
= {
52 (EFI_PEI_PPI_DESCRIPTOR_PPI
| EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST
),
53 &gFspReadyForNotifyPhasePpiGuid
,
59 This function waits for FSP notify.
61 @param This Entry point for DXE IPL PPI.
62 @param PeiServices General purpose services available to every PEIM.
63 @param HobList Address to the Pei HOB list.
65 @return EFI_SUCCESS This function never returns.
71 IN CONST EFI_DXE_IPL_PPI
*This
,
72 IN EFI_PEI_SERVICES
**PeiServices
,
73 IN EFI_PEI_HOB_POINTERS HobList
78 DEBUG ((DEBUG_INFO
| DEBUG_INIT
, "FSP HOB is located at 0x%08X\n", HobList
));
81 // End of PEI phase signal
83 Status
= PeiServicesInstallPpi (&gEndOfPeiSignalPpi
);
84 ASSERT_EFI_ERROR (Status
);
87 // Give control back to BootLoader after FspSiliconInit
89 DEBUG ((DEBUG_INFO
| DEBUG_INIT
, "FSP is waiting for NOTIFY\n"));
90 FspSiliconInitDone2 (EFI_SUCCESS
);
93 // BootLoader called FSP again through NotifyPhase
97 if (GetFspGlobalDataPointer ()->FspMode
== FSP_IN_API_MODE
) {
99 // Should not come here
102 DEBUG ((DEBUG_ERROR
, "No FSP API should be called after FSP is DONE!\n"));
103 SetFspApiReturnStatus (EFI_UNSUPPORTED
);
104 Pei2LoaderSwitchStack ();
112 FSP notify phase PEI module entry point
114 @param[in] FileHandle Not used.
115 @param[in] PeiServices General purpose services available to every PEIM.
117 @retval EFI_SUCCESS The function completes successfully
118 @retval EFI_OUT_OF_RESOURCES Insufficient resources to create database
121 FspNotifyPhasePeimEntryPoint (
122 IN EFI_PEI_FILE_HANDLE FileHandle
,
123 IN CONST EFI_PEI_SERVICES
**PeiServices
128 EFI_PEI_PPI_DESCRIPTOR
*OldDescriptor
;
130 DEBUG ((DEBUG_INFO
| DEBUG_INIT
, "The entry of FspNotificationPeim\n"));
132 if (GetFspGlobalDataPointer ()->FspMode
== FSP_IN_API_MODE
) {
134 // Locate old DXE IPL PPI
136 Status
= PeiServicesLocatePpi (
142 ASSERT_EFI_ERROR (Status
);
145 // Re-install the DXE IPL PPI to wait for notify
147 Status
= PeiServicesReInstallPpi (OldDescriptor
, &mInstallDxeIplPpi
);
148 ASSERT_EFI_ERROR (Status
);
150 Status
= PeiServicesInstallPpi (&gFspReadyForNotifyPhasePpi
);
151 ASSERT_EFI_ERROR (Status
);