StandaloneMmPkg: Support using gEfiSmmSmramMemoryGuid to get MMRAM range

Add the support using gEfiSmmSmramMemoryGuid to get MMRAM ranges.
If gEfiSmmSmramMemoryGuid HOB is not found, then try to get MMRAM ranges
from gEfiMmPeiMmramMemoryReserveGuid HOB.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Signed-off-by: Wei6 Xu <wei6.xu@intel.com>
This commit is contained in:
Wei6 Xu 2024-05-14 02:54:44 +08:00 committed by mergify[bot]
parent 487fa274c4
commit c8df60801f
6 changed files with 18 additions and 6 deletions

View File

@ -669,9 +669,12 @@ StandaloneMmMain (
//
// Extract the MMRAM ranges from the MMRAM descriptor HOB
//
MmramRangesHob = GetNextGuidHob (&gEfiMmPeiMmramMemoryReserveGuid, HobStart);
MmramRangesHob = GetNextGuidHob (&gEfiSmmSmramMemoryGuid, HobStart);
if (MmramRangesHob == NULL) {
return EFI_UNSUPPORTED;
MmramRangesHob = GetNextGuidHob (&gEfiMmPeiMmramMemoryReserveGuid, HobStart);
if (MmramRangesHob == NULL) {
return EFI_UNSUPPORTED;
}
}
MmramRangesHobData = GET_GUID_HOB_DATA (MmramRangesHob);

View File

@ -76,6 +76,7 @@
gEfiEventExitBootServicesGuid
gEfiEventReadyToBootGuid
gMmCommBufferHobGuid
gEfiSmmSmramMemoryGuid
[Pcd]
gStandaloneMmPkgTokenSpaceGuid.PcdFwVolMmMaxEncapsulationDepth ##CONSUMES

View File

@ -857,9 +857,12 @@ MemoryAllocationLibConstructor (
//
// Search for a Hob containing the MMRAM ranges
//
MmramRangesHob = GetNextGuidHob (&gEfiMmPeiMmramMemoryReserveGuid, HobStart);
MmramRangesHob = GetNextGuidHob (&gEfiSmmSmramMemoryGuid, HobStart);
if (MmramRangesHob == NULL) {
return EFI_UNSUPPORTED;
MmramRangesHob = GetNextGuidHob (&gEfiMmPeiMmramMemoryReserveGuid, HobStart);
if (MmramRangesHob == NULL) {
return EFI_UNSUPPORTED;
}
}
MmramRangesHobData = GET_GUID_HOB_DATA (MmramRangesHob);

View File

@ -42,3 +42,4 @@
[Guids]
gEfiMmPeiMmramMemoryReserveGuid
gEfiSmmSmramMemoryGuid

View File

@ -52,3 +52,4 @@
[Guids]
gEfiMmPeiMmramMemoryReserveGuid ## SOMETIMES_CONSUMES ## HOB
gEfiSmmSmramMemoryGuid ## SOMETIMES_CONSUMES ## HOB

View File

@ -96,9 +96,12 @@ MmMemLibInternalPopulateMmramRanges (
//
// Search for a Hob containing the MMRAM ranges
//
MmramRangesHob = GetFirstGuidHob (&gEfiMmPeiMmramMemoryReserveGuid);
MmramRangesHob = GetFirstGuidHob (&gEfiSmmSmramMemoryGuid);
if (MmramRangesHob == NULL) {
return EFI_UNSUPPORTED;
MmramRangesHob = GetFirstGuidHob (&gEfiMmPeiMmramMemoryReserveGuid);
if (MmramRangesHob == NULL) {
return EFI_UNSUPPORTED;
}
}
MmramRangesHobData = GET_GUID_HOB_DATA (MmramRangesHob);