StandaloneMmPkg/MmIpl : Add EFI_HOB_HANDOFF_INFO_TABLE to MM HOB list

GetBootModeHob function need to add EFI_HOB_HANDOFF_INFO_TABLE
in MM hob data base.

Signed-off-by: Hongbin1 Zhang <hongbin1.zhang@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Wei6 Xu <wei6.xu@intel.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
This commit is contained in:
Hongbin1 Zhang
2025-01-02 09:54:30 +08:00
committed by Ray Ni
parent 1428b94fc0
commit de29ae677a
3 changed files with 58 additions and 5 deletions

View File

@ -1029,3 +1029,33 @@ CreateMmFoundationHobList (
*FoundationHobSize = UsedSize;
return Status;
}
/**
Builds a Handoff Information Table HOB.
@param Hob - Pointer to handoff information table HOB.
@param HobEnd - End of the HOB list.
**/
VOID
CreateMmHobHandoffInfoTable (
IN EFI_HOB_HANDOFF_INFO_TABLE *Hob,
IN VOID *HobEnd
)
{
ASSERT ((Hob != NULL) && (HobEnd != NULL));
Hob->Header.HobType = EFI_HOB_TYPE_HANDOFF;
Hob->Header.HobLength = (UINT16)sizeof (EFI_HOB_HANDOFF_INFO_TABLE);
Hob->Header.Reserved = 0;
Hob->Version = EFI_HOB_HANDOFF_TABLE_VERSION;
Hob->BootMode = GetBootModeHob ();
Hob->EfiMemoryTop = 0;
Hob->EfiMemoryBottom = 0;
Hob->EfiFreeMemoryTop = 0;
Hob->EfiFreeMemoryBottom = 0;
Hob->EfiEndOfHobList = (EFI_PHYSICAL_ADDRESS)(UINTN)HobEnd;
}

View File

@ -280,6 +280,8 @@ CreatMmHobList (
UINTN BufferSize;
UINTN FoundationHobSize;
EFI_HOB_MEMORY_ALLOCATION *MmProfileDataHob;
UINTN PhitHobSize;
VOID *HobEnd;
//
// Get platform HOBs
@ -336,10 +338,11 @@ CreatMmHobList (
ASSERT (Status == RETURN_BUFFER_TOO_SMALL);
ASSERT (FoundationHobSize != 0);
PhitHobSize = sizeof (EFI_HOB_HANDOFF_INFO_TABLE);
//
// Final result includes platform HOBs, foundation HOBs and a END node.
// Final result includes: PHIT HOB, Platform HOBs, Foundation HOBs and an END node.
//
*HobSize = PlatformHobSize + FoundationHobSize + sizeof (EFI_HOB_GENERIC_HEADER);
*HobSize = PhitHobSize + PlatformHobSize + FoundationHobSize + sizeof (EFI_HOB_GENERIC_HEADER);
HobList = AllocatePages (EFI_SIZE_TO_PAGES (*HobSize));
ASSERT (HobList != NULL);
if (HobList == NULL) {
@ -347,17 +350,23 @@ CreatMmHobList (
CpuDeadLoop ();
}
HobEnd = (UINT8 *)(UINTN)HobList + PhitHobSize + PlatformHobSize + FoundationHobSize;
//
// Create MmHobHandoffInfoTable
//
CreateMmHobHandoffInfoTable (HobList, HobEnd);
//
// Get platform HOBs
//
Status = CreateMmPlatformHob (HobList, &PlatformHobSize);
Status = CreateMmPlatformHob ((UINT8 *)HobList + PhitHobSize, &PlatformHobSize);
ASSERT_EFI_ERROR (Status);
//
// Get foundation HOBs
//
Status = CreateMmFoundationHobList (
(UINT8 *)HobList + PlatformHobSize,
(UINT8 *)HobList + PhitHobSize + PlatformHobSize,
&FoundationHobSize,
HobList,
PlatformHobSize,
@ -375,7 +384,7 @@ CreatMmHobList (
//
// Create MM HOB list end.
//
MmIplCreateHob ((UINT8 *)HobList + PlatformHobSize + FoundationHobSize, EFI_HOB_TYPE_END_OF_HOB_LIST, sizeof (EFI_HOB_GENERIC_HEADER));
MmIplCreateHob (HobEnd, EFI_HOB_TYPE_END_OF_HOB_LIST, sizeof (EFI_HOB_GENERIC_HEADER));
return HobList;
}

View File

@ -143,4 +143,18 @@ BuildMmProfileDataHobInPeiHobList (
VOID
);
/**
Builds a Handoff Information Table HOB.
@param Hob - Pointer to handoff information table HOB.
@param HobEnd - End of the HOB list.
**/
VOID
CreateMmHobHandoffInfoTable (
IN EFI_HOB_HANDOFF_INFO_TABLE *Hob,
IN VOID *HobEnd
);
#endif