StandaloneMmMemLib: 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:22:03 +08:00 committed by mergify[bot]
parent 189398dcf8
commit 0f89005d71
2 changed files with 12 additions and 34 deletions

View File

@ -51,5 +51,4 @@
MemoryAllocationLib
[Guids]
gMmCoreDataHobGuid ## SOMETIMES_CONSUMES ## HOB
gEfiMmPeiMmramMemoryReserveGuid ## SOMETIMES_CONSUMES ## HOB

View File

@ -20,7 +20,6 @@
#include <Library/DebugLib.h>
#include <Library/HobLib.h>
#include <Guid/MmCoreData.h>
#include <Guid/MmramMemoryReserve.h>
//
@ -87,9 +86,6 @@ MmMemLibInternalPopulateMmramRanges (
)
{
VOID *HobStart;
EFI_HOB_GUID_TYPE *GuidHob;
MM_CORE_DATA_HOB_DATA *DataInHob;
MM_CORE_PRIVATE_DATA *MmCorePrivateData;
EFI_HOB_GUID_TYPE *MmramRangesHob;
EFI_MMRAM_HOB_DESCRIPTOR_BLOCK *MmramRangesHobData;
EFI_MMRAM_DESCRIPTOR *MmramDescriptors;
@ -98,38 +94,21 @@ MmMemLibInternalPopulateMmramRanges (
DEBUG ((DEBUG_INFO, "%a - 0x%x\n", __func__, 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 = GetFirstGuidHob (&gEfiMmPeiMmramMemoryReserveGuid);
if (MmramRangesHob == NULL) {
return EFI_UNSUPPORTED;
}
MmramRangesHobData = GET_GUID_HOB_DATA (MmramRangesHob);
if ((MmramRangesHobData == NULL) || (MmramRangesHobData->Descriptor == NULL)) {
return EFI_UNSUPPORTED;
}
mMmMemLibInternalMmramCount = MmramRangesHobData->NumberOfMmReservedRegions;
MmramDescriptors = MmramRangesHobData->Descriptor;
} else {
DataInHob = GET_GUID_HOB_DATA (GuidHob);
if (DataInHob == NULL) {
return EFI_UNSUPPORTED;
}
MmCorePrivateData = (MM_CORE_PRIVATE_DATA *)(UINTN)DataInHob->Address;
if ((MmCorePrivateData == NULL) || (MmCorePrivateData->MmramRanges == 0)) {
return EFI_UNSUPPORTED;
}
mMmMemLibInternalMmramCount = (UINTN)MmCorePrivateData->MmramRangeCount;
MmramDescriptors = (EFI_MMRAM_DESCRIPTOR *)(UINTN)MmCorePrivateData->MmramRanges;
MmramRangesHob = GetFirstGuidHob (&gEfiMmPeiMmramMemoryReserveGuid);
if (MmramRangesHob == NULL) {
return EFI_UNSUPPORTED;
}
MmramRangesHobData = GET_GUID_HOB_DATA (MmramRangesHob);
if ((MmramRangesHobData == NULL) || (MmramRangesHobData->Descriptor == NULL)) {
return EFI_UNSUPPORTED;
}
mMmMemLibInternalMmramCount = MmramRangesHobData->NumberOfMmReservedRegions;
MmramDescriptors = MmramRangesHobData->Descriptor;
mMmMemLibInternalMmramRanges = AllocatePool (mMmMemLibInternalMmramCount * sizeof (EFI_MMRAM_DESCRIPTOR));
if (mMmMemLibInternalMmramRanges) {
CopyMem (