67 IN VOID *FspMultiPhaseParams,
68 IN OUT VOID **FspHobListPtr,
69 IN UINT8 ComponentIndex
76 UINTN FspMultiPhaseApiEntry;
77 UINTN FspMultiPhaseApiOffset;
79 BOOLEAN InterruptState;
80 BOOLEAN IsVariableServiceRequest;
83 FspMultiPhaseApiOffset = 0;
85 IsVariableServiceRequest =
FALSE;
86 if ((FspMultiPhaseParamsPtr->MultiPhaseAction == EnumMultiPhaseGetVariableRequestInfo) ||
87 (FspMultiPhaseParamsPtr->MultiPhaseAction == EnumMultiPhaseCompleteVariableRequest))
89 IsVariableServiceRequest =
TRUE;
92 if (ComponentIndex == FspMultiPhaseMemInitApiIndex) {
94 if (FspHeader ==
NULL) {
95 return EFI_DEVICE_ERROR;
97 return EFI_UNSUPPORTED;
101 }
else if (ComponentIndex == FspMultiPhaseSiInitApiIndex) {
103 if (FspHeader ==
NULL) {
104 return EFI_DEVICE_ERROR;
106 return EFI_UNSUPPORTED;
107 }
else if ((FspHeader->
SpecVersion < 0x24) && (IsVariableServiceRequest ==
TRUE)) {
108 return EFI_UNSUPPORTED;
114 if (FspMultiPhaseApiOffset == 0) {
115 return EFI_UNSUPPORTED;
118 FspMultiPhaseApiEntry = FspHeader->
ImageBase + FspMultiPhaseApiOffset;
129 DEBUG ((DEBUG_ERROR,
"CallFspMultiPhaseEntry return Status %r \n", Status));
148 IN OUT VOID **FspHobListPtr,
149 IN UINT8 ComponentIndex
157 BOOLEAN WriteVariableSupport;
160 WriteVariableSupport =
TRUE;
162 &gEdkiiPeiVariablePpiGuid,
165 (VOID **)&VariablePpi
167 if (EFI_ERROR (Status)) {
168 WriteVariableSupport =
FALSE;
170 &gEfiPeiReadOnlyVariable2PpiGuid,
173 (VOID **)&ReadOnlyVariablePpi
176 if (EFI_ERROR (Status)) {
177 return EFI_UNSUPPORTED;
181 Status = FSP_STATUS_VARIABLE_REQUEST;
182 while (Status == FSP_STATUS_VARIABLE_REQUEST) {
186 FspMultiPhaseParams.MultiPhaseAction = EnumMultiPhaseGetVariableRequestInfo;
187 FspMultiPhaseParams.PhaseIndex = 0;
194 switch (FspVariableRequestParams->VariableRequest) {
195 case EnumFspVariableRequestGetVariable:
196 if (WriteVariableSupport) {
197 Status = VariablePpi->GetVariable (
199 FspVariableRequestParams->VariableName,
200 FspVariableRequestParams->VariableGuid,
201 FspVariableRequestParams->Attributes,
202 (
UINTN *)FspVariableRequestParams->DataSize,
203 FspVariableRequestParams->Data
206 Status = ReadOnlyVariablePpi->GetVariable (
208 FspVariableRequestParams->VariableName,
209 FspVariableRequestParams->VariableGuid,
210 FspVariableRequestParams->Attributes,
211 (
UINTN *)FspVariableRequestParams->DataSize,
212 FspVariableRequestParams->Data
216 CompleteVariableRequestParams.VariableRequestStatus = Status;
217 FspMultiPhaseParams.MultiPhaseParamPtr = (VOID *)&CompleteVariableRequestParams;
218 FspMultiPhaseParams.MultiPhaseAction = EnumMultiPhaseCompleteVariableRequest;
222 case EnumFspVariableRequestSetVariable:
223 if (WriteVariableSupport) {
224 Status = VariablePpi->SetVariable (
226 FspVariableRequestParams->VariableName,
227 FspVariableRequestParams->VariableGuid,
228 *FspVariableRequestParams->Attributes,
229 (
UINTN)*FspVariableRequestParams->DataSize,
230 FspVariableRequestParams->Data
233 Status = EFI_UNSUPPORTED;
236 CompleteVariableRequestParams.VariableRequestStatus = Status;
237 FspMultiPhaseParams.MultiPhaseParamPtr = (VOID *)&CompleteVariableRequestParams;
238 FspMultiPhaseParams.MultiPhaseAction = EnumMultiPhaseCompleteVariableRequest;
242 case EnumFspVariableRequestGetNextVariableName:
243 if (WriteVariableSupport) {
244 Status = VariablePpi->GetNextVariableName (
246 (
UINTN *)FspVariableRequestParams->VariableNameSize,
247 FspVariableRequestParams->VariableName,
248 FspVariableRequestParams->VariableGuid
251 Status = ReadOnlyVariablePpi->NextVariableName (
253 (
UINTN *)FspVariableRequestParams->VariableNameSize,
254 FspVariableRequestParams->VariableName,
255 FspVariableRequestParams->VariableGuid
259 CompleteVariableRequestParams.VariableRequestStatus = Status;
260 FspMultiPhaseParams.MultiPhaseParamPtr = (VOID *)&CompleteVariableRequestParams;
261 FspMultiPhaseParams.MultiPhaseAction = EnumMultiPhaseCompleteVariableRequest;
265 case EnumFspVariableRequestQueryVariableInfo:
266 if (WriteVariableSupport) {
267 Status = VariablePpi->QueryVariableInfo (
269 *FspVariableRequestParams->Attributes,
270 FspVariableRequestParams->MaximumVariableStorageSize,
271 FspVariableRequestParams->RemainingVariableStorageSize,
272 FspVariableRequestParams->MaximumVariableSize
275 Status = EFI_UNSUPPORTED;
278 CompleteVariableRequestParams.VariableRequestStatus = Status;
279 FspMultiPhaseParams.MultiPhaseParamPtr = (VOID *)&CompleteVariableRequestParams;
280 FspMultiPhaseParams.MultiPhaseAction = EnumMultiPhaseCompleteVariableRequest;
285 DEBUG ((DEBUG_ERROR,
"Unknown VariableRequest type!\n"));
286 Status = EFI_UNSUPPORTED;
294 if ((Status >= FSP_STATUS_RESET_REQUIRED_COLD) && (Status <= FSP_STATUS_RESET_REQUIRED_8)) {
295 DEBUG ((DEBUG_INFO,
"FspMultiPhaseApi-0x%x requested reset %r\n", ComponentIndex, Status));
315 IN OUT VOID **FspHobListPtr,
316 IN UINT8 ComponentIndex
328 FspMultiPhaseParams.MultiPhaseAction = EnumMultiPhaseGetNumberOfPhases;
329 FspMultiPhaseParams.PhaseIndex = 0;
330 FspMultiPhaseParams.MultiPhaseParamPtr = (VOID *)&FspMultiPhaseGetNumber;
332 if (Status == EFI_UNSUPPORTED) {
341 NumOfPhases = FspMultiPhaseGetNumber.NumberOfPhases;
343 for (Index = 1; Index <= NumOfPhases; Index++) {
344 DEBUG ((DEBUG_ERROR,
"MultiPhase Index/NumOfPhases = %d of %d\n", Index, NumOfPhases));
350 FspMultiPhaseParams.MultiPhaseAction = EnumMultiPhaseExecutePhase;
351 FspMultiPhaseParams.PhaseIndex = Index;
352 FspMultiPhaseParams.MultiPhaseParamPtr =
NULL;
355 if (Status == FSP_STATUS_VARIABLE_REQUEST) {
365 if ((Status >= FSP_STATUS_RESET_REQUIRED_COLD) && (Status <= FSP_STATUS_RESET_REQUIRED_8)) {
366 DEBUG ((DEBUG_INFO,
"FspMultiPhaseApi-0x%x requested reset %r\n", ComponentIndex, Status));
BOOLEAN EFIAPI SetInterruptState(IN BOOLEAN InterruptState)
BOOLEAN EFIAPI SaveAndDisableInterrupts(VOID)
EFI_STATUS EFIAPI PeiServicesLocatePpi(IN CONST EFI_GUID *Guid, IN UINTN Instance, IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor, IN OUT VOID **Ppi)
FSP_INFO_HEADER *EFIAPI FspFindFspHeader(IN EFI_PHYSICAL_ADDRESS FlashFvFspBase)
#define ASSERT_EFI_ERROR(StatusParameter)
#define DEBUG(Expression)
#define PcdGet32(TokenName)
EFI_STATUS Execute32BitCode(IN UINT64 Function, IN UINT64 Param1, IN UINT64 Param2)
EFI_STATUS EFIAPI FspWrapperVariableRequestHandler(IN OUT VOID **FspHobListPtr, IN UINT8 ComponentIndex)
EFI_STATUS EFIAPI CallFspMultiPhaseEntry(IN VOID *FspMultiPhaseParams, IN OUT VOID **FspHobListPtr, IN UINT8 ComponentIndex)
EFI_STATUS Execute64BitCode(IN UINT64 Function, IN UINT64 Param1, IN UINT64 Param2)
EFI_STATUS EFIAPI FspWrapperMultiPhaseHandler(IN OUT VOID **FspHobListPtr, IN UINT8 ComponentIndex)
UINT32 FspMultiPhaseSiInitEntryOffset
UINT32 FspMultiPhaseMemInitEntryOffset