From 189398dcf8652efcd54de71f1f1395813d903c5e Mon Sep 17 00:00:00 2001 From: Wei6 Xu Date: Tue, 14 May 2024 01:20:38 +0800 Subject: StandaloneMmCoreMemoryAllocationLib: Drop MM_CORE_PRIVATE_DATA MM_CORE_PRIVATE_DATA is not used as shared structures between MM IPL and MM Core, therefore clean up the code related to gMmCorePrivate. Cc: Ard Biesheuvel Cc: Sami Mujawar Cc: Ray Ni Cc: Jiaxin Wu Signed-off-by: Wei6 Xu --- .../StandaloneMmCoreMemoryAllocationLib.c | 44 ++++++++-------------- .../StandaloneMmCoreMemoryAllocationServices.h | 2 - 2 files changed, 16 insertions(+), 30 deletions(-) diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreMemoryAllocationLib/StandaloneMmCoreMemoryAllocationLib.c b/StandaloneMmPkg/Library/StandaloneMmCoreMemoryAllocationLib/StandaloneMmCoreMemoryAllocationLib.c index 2246823886..afced78cde 100644 --- a/StandaloneMmPkg/Library/StandaloneMmCoreMemoryAllocationLib/StandaloneMmCoreMemoryAllocationLib.c +++ b/StandaloneMmPkg/Library/StandaloneMmCoreMemoryAllocationLib/StandaloneMmCoreMemoryAllocationLib.c @@ -845,9 +845,6 @@ MemoryAllocationLibConstructor ( IN EFI_MM_SYSTEM_TABLE *MmSystemTable ) { - MM_CORE_PRIVATE_DATA *MmCorePrivate; - EFI_HOB_GUID_TYPE *GuidHob; - MM_CORE_DATA_HOB_DATA *DataInHob; VOID *HobStart; EFI_MMRAM_HOB_DESCRIPTOR_BLOCK *MmramRangesHobData; EFI_MMRAM_DESCRIPTOR *MmramRanges; @@ -858,35 +855,26 @@ MemoryAllocationLibConstructor ( DEBUG ((DEBUG_INFO, "StandaloneMmCoreMemoryAllocationLibConstructor - 0x%x\n", HobStart)); // - // Extract MM Core Private context from the Hob. If absent search for - // a Hob containing the MMRAM ranges + // Search for a Hob containing the MMRAM ranges // - GuidHob = GetNextGuidHob (&gMmCoreDataHobGuid, HobStart); - if (GuidHob == NULL) { - MmramRangesHob = GetNextGuidHob (&gEfiMmPeiMmramMemoryReserveGuid, HobStart); - if (MmramRangesHob == NULL) { - return EFI_UNSUPPORTED; - } + MmramRangesHob = GetNextGuidHob (&gEfiMmPeiMmramMemoryReserveGuid, HobStart); + if (MmramRangesHob == NULL) { + return EFI_UNSUPPORTED; + } - MmramRangesHobData = GET_GUID_HOB_DATA (MmramRangesHob); - if (MmramRangesHobData == NULL) { - return EFI_UNSUPPORTED; - } + MmramRangesHobData = GET_GUID_HOB_DATA (MmramRangesHob); + if (MmramRangesHobData == NULL) { + return EFI_UNSUPPORTED; + } - MmramRanges = MmramRangesHobData->Descriptor; - if (MmramRanges == NULL) { - return EFI_UNSUPPORTED; - } + MmramRanges = MmramRangesHobData->Descriptor; + if (MmramRanges == NULL) { + return EFI_UNSUPPORTED; + } - MmramRangeCount = (UINTN)MmramRangesHobData->NumberOfMmReservedRegions; - if (MmramRanges == NULL) { - return EFI_UNSUPPORTED; - } - } else { - DataInHob = GET_GUID_HOB_DATA (GuidHob); - MmCorePrivate = (MM_CORE_PRIVATE_DATA *)(UINTN)DataInHob->Address; - MmramRanges = (EFI_MMRAM_DESCRIPTOR *)(UINTN)MmCorePrivate->MmramRanges; - MmramRangeCount = (UINTN)MmCorePrivate->MmramRangeCount; + MmramRangeCount = (UINTN)MmramRangesHobData->NumberOfMmReservedRegions; + if (MmramRanges == NULL) { + return EFI_UNSUPPORTED; } { diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreMemoryAllocationLib/StandaloneMmCoreMemoryAllocationServices.h b/StandaloneMmPkg/Library/StandaloneMmCoreMemoryAllocationLib/StandaloneMmCoreMemoryAllocationServices.h index 833ab0d177..1fd0478707 100644 --- a/StandaloneMmPkg/Library/StandaloneMmCoreMemoryAllocationLib/StandaloneMmCoreMemoryAllocationServices.h +++ b/StandaloneMmPkg/Library/StandaloneMmCoreMemoryAllocationLib/StandaloneMmCoreMemoryAllocationServices.h @@ -14,8 +14,6 @@ #ifndef _PI_MM_CORE_MEMORY_ALLOCATION_SERVICES_H_ #define _PI_MM_CORE_MEMORY_ALLOCATION_SERVICES_H_ -#include - /** Called to initialize the memory service. -- cgit v1.2.3