Skip to content

Commit

Permalink
StandaloneMmPkg/Core: Remove unneeded check
Browse files Browse the repository at this point in the history
Remove unneeded check MmIsBufferOutsideMmValid() when
StandaloneMmCore checks if the BS data memory described
by a memory allocation HOB needs to be migrated to Mmram.

Previously, the API MmIsBufferOutsideMmValid() return TRUE
when input memory range belongs to non-Mmram memory. Now
the API has been changed in previous 5 commits to return
TRUE when a memory range belongs to non-Mmram memroy and
the memory is inside a range described by resource HOB.

To solve this gap and align with previous code logic,
considering we can have assumption that the memory range
in a memory allocation HOB should be non-Mmram memory, we
can directly remove the check MmIsBufferOutsideMmValid()
and always migrate the BS data memory described by a memory
allocation HOB to Mmram.

Signed-off-by: Dun Tan <[email protected]>
  • Loading branch information
td36 committed Nov 4, 2024
1 parent 33c59b2 commit e6f1a2f
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions StandaloneMmPkg/Core/StandaloneMmCore.c
Original file line number Diff line number Diff line change
Expand Up @@ -665,13 +665,7 @@ MigrateMemoryAllocationHobs (
Hob.Raw = GetNextHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, HobStart);
while (Hob.Raw != NULL) {
MemoryAllocationHob = (EFI_HOB_MEMORY_ALLOCATION *)Hob.Raw;
if ((MemoryAllocationHob->AllocDescriptor.MemoryType == EfiBootServicesData) &&
(MmIsBufferOutsideMmValid (
MemoryAllocationHob->AllocDescriptor.MemoryBaseAddress,
MemoryAllocationHob->AllocDescriptor.MemoryLength
))
)
{
if (MemoryAllocationHob->AllocDescriptor.MemoryType == EfiBootServicesData) {
if (!IsZeroGuid (&MemoryAllocationHob->AllocDescriptor.Name)) {
MemoryInMmram = AllocatePages (EFI_SIZE_TO_PAGES (MemoryAllocationHob->AllocDescriptor.MemoryLength));
if (MemoryInMmram != NULL) {
Expand Down

0 comments on commit e6f1a2f

Please sign in to comment.