VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/FirmwareNew/IntelFsp2Pkg/FspNotifyPhase/FspNotifyPhasePeim.c@ 99396

Last change on this file since 99396 was 80721, checked in by vboxsync, 6 years ago

Devices/EFI/FirmwareNew: Start upgrade process to edk2-stable201908 (compiles on Windows and works to some extent), bugref:4643

  • Property svn:eol-style set to native
File size: 3.7 KB
Line 
1/** @file
2 Source file for FSP notify phase PEI module
3
4 Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6**/
7
8#include "FspNotifyPhasePeim.h"
9
10/**
11
12 This function waits for FSP notify.
13
14 @param This Entry point for DXE IPL PPI.
15 @param PeiServices General purpose services available to every PEIM.
16 @param HobList Address to the Pei HOB list.
17
18 @return EFI_SUCCESS This function never returns.
19
20**/
21EFI_STATUS
22EFIAPI
23WaitForNotify (
24 IN CONST EFI_DXE_IPL_PPI *This,
25 IN EFI_PEI_SERVICES **PeiServices,
26 IN EFI_PEI_HOB_POINTERS HobList
27 );
28
29CONST EFI_DXE_IPL_PPI mDxeIplPpi = {
30 WaitForNotify
31};
32
33CONST EFI_PEI_PPI_DESCRIPTOR mInstallDxeIplPpi = {
34 EFI_PEI_PPI_DESCRIPTOR_PPI,
35 &gEfiDxeIplPpiGuid,
36 (VOID *) &mDxeIplPpi
37};
38
39CONST EFI_PEI_PPI_DESCRIPTOR gEndOfPeiSignalPpi = {
40 (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
41 &gEfiEndOfPeiSignalPpiGuid,
42 NULL
43};
44
45CONST EFI_PEI_PPI_DESCRIPTOR gFspReadyForNotifyPhasePpi = {
46 (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
47 &gFspReadyForNotifyPhasePpiGuid,
48 NULL
49};
50
51/**
52
53 This function waits for FSP notify.
54
55 @param This Entry point for DXE IPL PPI.
56 @param PeiServices General purpose services available to every PEIM.
57 @param HobList Address to the Pei HOB list.
58
59 @return EFI_SUCCESS This function never returns.
60
61**/
62EFI_STATUS
63EFIAPI
64WaitForNotify (
65 IN CONST EFI_DXE_IPL_PPI *This,
66 IN EFI_PEI_SERVICES **PeiServices,
67 IN EFI_PEI_HOB_POINTERS HobList
68 )
69{
70 EFI_STATUS Status;
71
72 DEBUG ((DEBUG_INFO | DEBUG_INIT, "FSP HOB is located at 0x%08X\n", HobList));
73
74 //
75 // End of PEI phase signal
76 //
77 Status = PeiServicesInstallPpi (&gEndOfPeiSignalPpi);
78 ASSERT_EFI_ERROR (Status);
79
80 //
81 // Give control back to BootLoader after FspSiliconInit
82 //
83 DEBUG ((DEBUG_INFO | DEBUG_INIT, "FSP is waiting for NOTIFY\n"));
84 FspSiliconInitDone2 (EFI_SUCCESS);
85
86 //
87 // BootLoader called FSP again through NotifyPhase
88 //
89 FspWaitForNotify ();
90
91 if (GetFspGlobalDataPointer ()->FspMode == FSP_IN_API_MODE) {
92 //
93 // Should not come here
94 //
95 while (TRUE) {
96 DEBUG ((DEBUG_ERROR, "No FSP API should be called after FSP is DONE!\n"));
97 SetFspApiReturnStatus (EFI_UNSUPPORTED);
98 Pei2LoaderSwitchStack ();
99 }
100 }
101
102 return EFI_SUCCESS;
103}
104
105/**
106 FSP notify phase PEI module entry point
107
108 @param[in] FileHandle Not used.
109 @param[in] PeiServices General purpose services available to every PEIM.
110
111 @retval EFI_SUCCESS The function completes successfully
112 @retval EFI_OUT_OF_RESOURCES Insufficient resources to create database
113**/
114EFI_STATUS
115FspNotifyPhasePeimEntryPoint (
116 IN EFI_PEI_FILE_HANDLE FileHandle,
117 IN CONST EFI_PEI_SERVICES **PeiServices
118 )
119{
120 EFI_STATUS Status;
121 VOID *OldDxeIplPpi;
122 EFI_PEI_PPI_DESCRIPTOR *OldDescriptor;
123
124 DEBUG ((DEBUG_INFO | DEBUG_INIT, "The entry of FspNotificationPeim\n"));
125
126 if (GetFspGlobalDataPointer ()->FspMode == FSP_IN_API_MODE) {
127 //
128 // Locate old DXE IPL PPI
129 //
130 Status = PeiServicesLocatePpi (
131 &gEfiDxeIplPpiGuid,
132 0,
133 &OldDescriptor,
134 &OldDxeIplPpi
135 );
136 ASSERT_EFI_ERROR (Status);
137
138 //
139 // Re-install the DXE IPL PPI to wait for notify
140 //
141 Status = PeiServicesReInstallPpi (OldDescriptor, &mInstallDxeIplPpi);
142 ASSERT_EFI_ERROR (Status);
143 } else {
144 Status = PeiServicesInstallPpi (&gFspReadyForNotifyPhasePpi);
145 ASSERT_EFI_ERROR (Status);
146 }
147
148 return EFI_SUCCESS;
149}
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette