fix: FSP 2.4 issues (#2171)

1) Some FSP 2.4 implementations are non-conforming and use FSPM_ARCH_UPD
instead of FSPM_ARCH2_UPD as indicated by the specification. Logic is
changed to check FSPM UPD header revision for structure version instead
of FSP spec revision.

2) MultiPhase FSP PhaseIndex is one-based so loop comparisons need to take
this into account. Side effect is that the last phase may be missed. No
current platform FSP is utilizing this.

Signed-off-by: Bejean Mosher <bejean.mosher@intel.com>
This commit is contained in:
bejeanmo 2024-05-03 08:26:03 -04:00 committed by GitHub
parent ae47908c84
commit 6a1da85c9f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View File

@ -57,9 +57,9 @@ CallFspMemoryInit (
DefaultMemoryInitUpd = (UINT8 *)(UINTN)(FspHeader->ImageBase + FspHeader->CfgRegionOffset);
CopyMem (&FspmUpd, DefaultMemoryInitUpd, FspHeader->CfgRegionSize);
FspmUpdCommon = (FSPM_UPD_COMMON *)FspmUpd;
/* Update architectural UPD fields */
if (FspHeader->SpecVersion < 0x24) {
FspmUpdCommon = (FSPM_UPD_COMMON *)FspmUpd;
if (FspmUpdCommon->FspUpdHeader.Revision < FSP_HEADER_REVISION_3) {
FspmUpdCommon->FspmArchUpd.BootLoaderTolumSize = 0;
FspmUpdCommon->FspmArchUpd.BootMode = (UINT32)GetBootMode();
FspmUpdCommon->FspmArchUpd.NvsBufferPtr = (UINT32)(UINTN)FindNvsData();
@ -142,7 +142,7 @@ FspMultiPhaseMemInitHandler(VOID)
// Loop through all phases. Break on error status or FSP_STATUS_* not
// handled by variable services handler
for (MultiPhaseInitParams.PhaseIndex = 1;
MultiPhaseInitParams.PhaseIndex < GetNumPhasesParams.NumberOfPhases &&
MultiPhaseInitParams.PhaseIndex <= GetNumPhasesParams.NumberOfPhases &&
!EFI_ERROR(Status) &&
!(Status & ENCODE_RESET_REQUEST(0));
MultiPhaseInitParams.PhaseIndex++)

View File

@ -96,7 +96,7 @@ FspMultiPhaseSiliconInitHandler(VOID)
// Loop through all phases. Break on error status or FSP_STATUS_* not
// handled by variable services handler
for (MultiPhaseInitParams.PhaseIndex = 1;
MultiPhaseInitParams.PhaseIndex < GetNumPhasesParams.NumberOfPhases &&
MultiPhaseInitParams.PhaseIndex <= GetNumPhasesParams.NumberOfPhases &&
!EFI_ERROR(Status) &&
!(Status & ENCODE_RESET_REQUEST(0));
MultiPhaseInitParams.PhaseIndex++)