Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StandaloneMmPkg/MmIpl : Check if MM FV HOB was built #6549

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 52 additions & 4 deletions StandaloneMmPkg/Drivers/StandaloneMmIplPei/MmFoundationHob.c
Original file line number Diff line number Diff line change
Expand Up @@ -803,6 +803,49 @@ GetRemainingHobSize (
}
}

/**
Check if FV HOB was created.

Check if FV HOB was created on HOB list,
if yes, skip building MM Core FV HOB,
if No, continue to build MM Core FV HOB

@param[in] HobList HOB list.
@param[in] HobSize HOB size.

@retval TRUE Skip building MM Core FV HOB.
FALSE Continue to build MM Core FV HOB.
**/
BOOLEAN
IsFvHobExist (
IN UINT8 *HobList,
IN UINTN HobSize
)
{
EFI_PEI_HOB_POINTERS Hob;
UINTN HobLength;

if ((HobList == NULL) || (HobSize == 0)) {
return FALSE;
}

Hob.Raw = (UINT8 *)HobList;
HobLength = GET_HOB_LENGTH (Hob);
//
// Parse the HOB list until end of list or matching type is found.
//
while (HobLength <= HobSize) {
if (Hob.Header->HobType == EFI_HOB_TYPE_FV) {
return TRUE;
}

Hob.Raw = GET_NEXT_HOB (Hob);
HobLength += GET_HOB_LENGTH (Hob);
}

return FALSE;
}

/**
Create the MM foundation specific HOB list which StandaloneMm Core needed.

Expand Down Expand Up @@ -892,11 +935,16 @@ CreateMmFoundationHobList (
UsedSize += HobLength;

//
// BFV address for StandaloneMm Core
// Skip to report FV that contains MmCore when Platform reports FV
//
HobLength = GetRemainingHobSize (*FoundationHobSize, UsedSize);
MmIplBuildFvHob (FoundationHobList + UsedSize, &HobLength, MmFvBase, MmFvSize);
UsedSize += HobLength;
if (!IsFvHobExist (PlatformHobList, PlatformHobSize)) {
//
// BFV address for StandaloneMm Core
//
HobLength = GetRemainingHobSize (*FoundationHobSize, UsedSize);
MmIplBuildFvHob (FoundationHobList + UsedSize, &HobLength, MmFvBase, MmFvSize);
UsedSize += HobLength;
}

//
// Build MM ACPI S3 Enable HOB
Expand Down
Loading