summaryrefslogtreecommitdiffstats
path: root/StandaloneMmPkg
diff options
context:
space:
mode:
authorWei6 Xu <wei6.xu@intel.com>2024-05-14 02:54:44 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-08-28 15:25:27 +0000
commitc8df60801fa20e3e1dc85acdf37d73ca5cca8206 (patch)
tree1f2b395d9da56e2bc248dabb96da0597c340b129 /StandaloneMmPkg
parent487fa274c48d5b77a25e13d6af1a9c7a4d3a7951 (diff)
downloadedk2-c8df60801fa20e3e1dc85acdf37d73ca5cca8206.tar.gz
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>
Diffstat (limited to 'StandaloneMmPkg')
-rw-r--r--StandaloneMmPkg/Core/StandaloneMmCore.c7
-rw-r--r--StandaloneMmPkg/Core/StandaloneMmCore.inf1
-rw-r--r--StandaloneMmPkg/Library/StandaloneMmCoreMemoryAllocationLib/StandaloneMmCoreMemoryAllocationLib.c7
-rw-r--r--StandaloneMmPkg/Library/StandaloneMmCoreMemoryAllocationLib/StandaloneMmCoreMemoryAllocationLib.inf1
-rw-r--r--StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMemLib.inf1
-rw-r--r--StandaloneMmPkg/Library/StandaloneMmMemLib/X86StandaloneMmMemLibInternal.c7
6 files changed, 18 insertions, 6 deletions
diff --git a/StandaloneMmPkg/Core/StandaloneMmCore.c b/StandaloneMmPkg/Core/StandaloneMmCore.c
index 6bdb30f954..c1281ca8d4 100644
--- a/StandaloneMmPkg/Core/StandaloneMmCore.c
+++ b/StandaloneMmPkg/Core/StandaloneMmCore.c
@@ -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);
diff --git a/StandaloneMmPkg/Core/StandaloneMmCore.inf b/StandaloneMmPkg/Core/StandaloneMmCore.inf
index 0073f51894..a6fafa5690 100644
--- a/StandaloneMmPkg/Core/StandaloneMmCore.inf
+++ b/StandaloneMmPkg/Core/StandaloneMmCore.inf
@@ -76,6 +76,7 @@
gEfiEventExitBootServicesGuid
gEfiEventReadyToBootGuid
gMmCommBufferHobGuid
+ gEfiSmmSmramMemoryGuid
[Pcd]
gStandaloneMmPkgTokenSpaceGuid.PcdFwVolMmMaxEncapsulationDepth ##CONSUMES
diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreMemoryAllocationLib/StandaloneMmCoreMemoryAllocationLib.c b/StandaloneMmPkg/Library/StandaloneMmCoreMemoryAllocationLib/StandaloneMmCoreMemoryAllocationLib.c
index afced78cde..cd27fc5965 100644
--- a/StandaloneMmPkg/Library/StandaloneMmCoreMemoryAllocationLib/StandaloneMmCoreMemoryAllocationLib.c
+++ b/StandaloneMmPkg/Library/StandaloneMmCoreMemoryAllocationLib/StandaloneMmCoreMemoryAllocationLib.c
@@ -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);
diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreMemoryAllocationLib/StandaloneMmCoreMemoryAllocationLib.inf b/StandaloneMmPkg/Library/StandaloneMmCoreMemoryAllocationLib/StandaloneMmCoreMemoryAllocationLib.inf
index bf7530bb74..2848c4b0c7 100644
--- a/StandaloneMmPkg/Library/StandaloneMmCoreMemoryAllocationLib/StandaloneMmCoreMemoryAllocationLib.inf
+++ b/StandaloneMmPkg/Library/StandaloneMmCoreMemoryAllocationLib/StandaloneMmCoreMemoryAllocationLib.inf
@@ -42,3 +42,4 @@
[Guids]
gEfiMmPeiMmramMemoryReserveGuid
+ gEfiSmmSmramMemoryGuid
diff --git a/StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMemLib.inf b/StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMemLib.inf
index 696b8e0689..a748af5ea5 100644
--- a/StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMemLib.inf
+++ b/StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMemLib.inf
@@ -52,3 +52,4 @@
[Guids]
gEfiMmPeiMmramMemoryReserveGuid ## SOMETIMES_CONSUMES ## HOB
+ gEfiSmmSmramMemoryGuid ## SOMETIMES_CONSUMES ## HOB
diff --git a/StandaloneMmPkg/Library/StandaloneMmMemLib/X86StandaloneMmMemLibInternal.c b/StandaloneMmPkg/Library/StandaloneMmMemLib/X86StandaloneMmMemLibInternal.c
index c8ffe43cd1..19e1736ae1 100644
--- a/StandaloneMmPkg/Library/StandaloneMmMemLib/X86StandaloneMmMemLibInternal.c
+++ b/StandaloneMmPkg/Library/StandaloneMmMemLib/X86StandaloneMmMemLibInternal.c
@@ -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);