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 <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 01:20:38 +08:00 committed by mergify[bot]
parent 18591343b2
commit 189398dcf8
2 changed files with 16 additions and 30 deletions

View File

@ -845,9 +845,6 @@ MemoryAllocationLibConstructor (
IN EFI_MM_SYSTEM_TABLE *MmSystemTable IN EFI_MM_SYSTEM_TABLE *MmSystemTable
) )
{ {
MM_CORE_PRIVATE_DATA *MmCorePrivate;
EFI_HOB_GUID_TYPE *GuidHob;
MM_CORE_DATA_HOB_DATA *DataInHob;
VOID *HobStart; VOID *HobStart;
EFI_MMRAM_HOB_DESCRIPTOR_BLOCK *MmramRangesHobData; EFI_MMRAM_HOB_DESCRIPTOR_BLOCK *MmramRangesHobData;
EFI_MMRAM_DESCRIPTOR *MmramRanges; EFI_MMRAM_DESCRIPTOR *MmramRanges;
@ -858,35 +855,26 @@ MemoryAllocationLibConstructor (
DEBUG ((DEBUG_INFO, "StandaloneMmCoreMemoryAllocationLibConstructor - 0x%x\n", HobStart)); DEBUG ((DEBUG_INFO, "StandaloneMmCoreMemoryAllocationLibConstructor - 0x%x\n", HobStart));
// //
// Extract MM Core Private context from the Hob. If absent search for // Search for a Hob containing the MMRAM ranges
// a Hob containing the MMRAM ranges
// //
GuidHob = GetNextGuidHob (&gMmCoreDataHobGuid, HobStart); MmramRangesHob = GetNextGuidHob (&gEfiMmPeiMmramMemoryReserveGuid, HobStart);
if (GuidHob == NULL) { if (MmramRangesHob == NULL) {
MmramRangesHob = GetNextGuidHob (&gEfiMmPeiMmramMemoryReserveGuid, HobStart); return EFI_UNSUPPORTED;
if (MmramRangesHob == NULL) { }
return EFI_UNSUPPORTED;
}
MmramRangesHobData = GET_GUID_HOB_DATA (MmramRangesHob); MmramRangesHobData = GET_GUID_HOB_DATA (MmramRangesHob);
if (MmramRangesHobData == NULL) { if (MmramRangesHobData == NULL) {
return EFI_UNSUPPORTED; return EFI_UNSUPPORTED;
} }
MmramRanges = MmramRangesHobData->Descriptor; MmramRanges = MmramRangesHobData->Descriptor;
if (MmramRanges == NULL) { if (MmramRanges == NULL) {
return EFI_UNSUPPORTED; return EFI_UNSUPPORTED;
} }
MmramRangeCount = (UINTN)MmramRangesHobData->NumberOfMmReservedRegions; MmramRangeCount = (UINTN)MmramRangesHobData->NumberOfMmReservedRegions;
if (MmramRanges == NULL) { if (MmramRanges == NULL) {
return EFI_UNSUPPORTED; 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;
} }
{ {

View File

@ -14,8 +14,6 @@
#ifndef _PI_MM_CORE_MEMORY_ALLOCATION_SERVICES_H_ #ifndef _PI_MM_CORE_MEMORY_ALLOCATION_SERVICES_H_
#define _PI_MM_CORE_MEMORY_ALLOCATION_SERVICES_H_ #define _PI_MM_CORE_MEMORY_ALLOCATION_SERVICES_H_
#include <Guid/MmCoreData.h>
/** /**
Called to initialize the memory service. Called to initialize the memory service.