mirror of
https://github.com/acidanthera/audk.git
synced 2025-04-08 17:05:09 +02:00
StandaloneMmPkg/Core: 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:
parent
24e41d1fa3
commit
18591343b2
@ -19,11 +19,6 @@ MmDispatcher (
|
||||
//
|
||||
EFI_HANDLE mMmCpuHandle = NULL;
|
||||
|
||||
//
|
||||
// Physical pointer to private structure shared between MM IPL and the MM Core
|
||||
//
|
||||
MM_CORE_PRIVATE_DATA *gMmCorePrivate;
|
||||
|
||||
//
|
||||
// MM Core global variable for MM System Table. Only accessed as a physical structure in MMRAM.
|
||||
//
|
||||
@ -86,6 +81,7 @@ MM_CORE_MMI_HANDLERS mMmCoreMmiHandlers[] = {
|
||||
{ NULL, NULL, NULL, FALSE },
|
||||
};
|
||||
|
||||
BOOLEAN mMmEntryPointRegistered = FALSE;
|
||||
UINTN mMmramRangeCount;
|
||||
EFI_MMRAM_DESCRIPTOR *mMmramRanges;
|
||||
MM_COMM_BUFFER *mMmCommunicationBuffer;
|
||||
@ -487,15 +483,6 @@ MmEntryPoint (
|
||||
//
|
||||
// PlatformHookBeforeMmDispatch ();
|
||||
|
||||
//
|
||||
// If a legacy boot has occurred, then make sure gMmCorePrivate is not accessed
|
||||
//
|
||||
|
||||
//
|
||||
// TBD: Mark the InMm flag as TRUE
|
||||
//
|
||||
gMmCorePrivate->InMm = TRUE;
|
||||
|
||||
//
|
||||
// Check to see if this is a Synchronous MMI sent through the MM Communication
|
||||
// Protocol or an Asynchronous MMI
|
||||
@ -570,11 +557,6 @@ MmEntryPoint (
|
||||
// TBD: Do not use private data structure ?
|
||||
//
|
||||
|
||||
//
|
||||
// Clear the InMm flag as we are going to leave MM
|
||||
//
|
||||
gMmCorePrivate->InMm = FALSE;
|
||||
|
||||
DEBUG ((DEBUG_INFO, "MmEntryPoint Done\n"));
|
||||
}
|
||||
|
||||
@ -605,19 +587,19 @@ MmConfigurationMmNotify (
|
||||
//
|
||||
// Register the MM Entry Point provided by the MM Core with the MM COnfiguration protocol
|
||||
//
|
||||
Status = MmConfiguration->RegisterMmEntry (MmConfiguration, (EFI_MM_ENTRY_POINT)(UINTN)gMmCorePrivate->MmEntryPoint);
|
||||
Status = MmConfiguration->RegisterMmEntry (MmConfiguration, (EFI_MM_ENTRY_POINT)MmEntryPoint);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// Set flag to indicate that the MM Entry Point has been registered which
|
||||
// means that MMIs are now fully operational.
|
||||
//
|
||||
gMmCorePrivate->MmEntryPointRegistered = TRUE;
|
||||
mMmEntryPointRegistered = TRUE;
|
||||
|
||||
//
|
||||
// Print debug message showing MM Core entry point address.
|
||||
//
|
||||
DEBUG ((DEBUG_INFO, "MM Core registered MM Entry Point address %p\n", (VOID *)(UINTN)gMmCorePrivate->MmEntryPoint));
|
||||
DEBUG ((DEBUG_INFO, "MM Core registered MM Entry Point address %p\n", MmEntryPoint));
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
@ -671,8 +653,6 @@ StandaloneMmMain (
|
||||
VOID *MmHobStart;
|
||||
UINTN HobSize;
|
||||
VOID *Registration;
|
||||
EFI_HOB_GUID_TYPE *GuidHob;
|
||||
MM_CORE_DATA_HOB_DATA *DataInHob;
|
||||
EFI_HOB_GUID_TYPE *MmramRangesHob;
|
||||
EFI_MMRAM_HOB_DESCRIPTOR_BLOCK *MmramRangesHobData;
|
||||
EFI_MMRAM_DESCRIPTOR *MmramRanges;
|
||||
@ -688,58 +668,20 @@ StandaloneMmMain (
|
||||
);
|
||||
|
||||
//
|
||||
// Determine if the caller has passed a reference to a MM_CORE_PRIVATE_DATA
|
||||
// structure in the Hoblist. This choice will govern how boot information is
|
||||
// extracted later.
|
||||
// Extract the MMRAM ranges from the MMRAM descriptor HOB
|
||||
//
|
||||
GuidHob = GetNextGuidHob (&gMmCoreDataHobGuid, HobStart);
|
||||
if (GuidHob == NULL) {
|
||||
//
|
||||
// Allocate and zero memory for a MM_CORE_PRIVATE_DATA table and then
|
||||
// initialise it
|
||||
//
|
||||
gMmCorePrivate = (MM_CORE_PRIVATE_DATA *)AllocateRuntimePages (EFI_SIZE_TO_PAGES (sizeof (MM_CORE_PRIVATE_DATA)));
|
||||
SetMem ((VOID *)(UINTN)gMmCorePrivate, sizeof (MM_CORE_PRIVATE_DATA), 0);
|
||||
gMmCorePrivate->Signature = MM_CORE_PRIVATE_DATA_SIGNATURE;
|
||||
gMmCorePrivate->MmEntryPointRegistered = FALSE;
|
||||
gMmCorePrivate->InMm = FALSE;
|
||||
gMmCorePrivate->ReturnStatus = EFI_SUCCESS;
|
||||
|
||||
//
|
||||
// Extract the MMRAM ranges from the MMRAM descriptor HOB
|
||||
//
|
||||
MmramRangesHob = GetNextGuidHob (&gEfiMmPeiMmramMemoryReserveGuid, HobStart);
|
||||
if (MmramRangesHob == NULL) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
MmramRangesHobData = GET_GUID_HOB_DATA (MmramRangesHob);
|
||||
ASSERT (MmramRangesHobData != NULL);
|
||||
MmramRanges = MmramRangesHobData->Descriptor;
|
||||
MmramRangeCount = (UINTN)MmramRangesHobData->NumberOfMmReservedRegions;
|
||||
ASSERT (MmramRanges);
|
||||
ASSERT (MmramRangeCount);
|
||||
|
||||
//
|
||||
// Copy the MMRAM ranges into MM_CORE_PRIVATE_DATA table just in case any
|
||||
// code relies on them being present there
|
||||
//
|
||||
gMmCorePrivate->MmramRangeCount = (UINT64)MmramRangeCount;
|
||||
gMmCorePrivate->MmramRanges =
|
||||
(EFI_PHYSICAL_ADDRESS)(UINTN)AllocatePool (MmramRangeCount * sizeof (EFI_MMRAM_DESCRIPTOR));
|
||||
ASSERT (gMmCorePrivate->MmramRanges != 0);
|
||||
CopyMem (
|
||||
(VOID *)(UINTN)gMmCorePrivate->MmramRanges,
|
||||
MmramRanges,
|
||||
MmramRangeCount * sizeof (EFI_MMRAM_DESCRIPTOR)
|
||||
);
|
||||
} else {
|
||||
DataInHob = GET_GUID_HOB_DATA (GuidHob);
|
||||
gMmCorePrivate = (MM_CORE_PRIVATE_DATA *)(UINTN)DataInHob->Address;
|
||||
MmramRanges = (EFI_MMRAM_DESCRIPTOR *)(UINTN)gMmCorePrivate->MmramRanges;
|
||||
MmramRangeCount = (UINTN)gMmCorePrivate->MmramRangeCount;
|
||||
MmramRangesHob = GetNextGuidHob (&gEfiMmPeiMmramMemoryReserveGuid, HobStart);
|
||||
if (MmramRangesHob == NULL) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
MmramRangesHobData = GET_GUID_HOB_DATA (MmramRangesHob);
|
||||
ASSERT (MmramRangesHobData != NULL);
|
||||
MmramRanges = MmramRangesHobData->Descriptor;
|
||||
MmramRangeCount = (UINTN)MmramRangesHobData->NumberOfMmReservedRegions;
|
||||
ASSERT (MmramRanges);
|
||||
ASSERT (MmramRangeCount);
|
||||
|
||||
//
|
||||
// Print the MMRAM ranges passed by the caller
|
||||
//
|
||||
@ -764,19 +706,6 @@ StandaloneMmMain (
|
||||
ASSERT (mMmramRanges != NULL);
|
||||
CopyMem (mMmramRanges, (VOID *)(UINTN)MmramRanges, mMmramRangeCount * sizeof (EFI_MMRAM_DESCRIPTOR));
|
||||
|
||||
//
|
||||
// Get Boot Firmware Volume address from the BFV Hob
|
||||
//
|
||||
BfvHob = GetFirstHob (EFI_HOB_TYPE_FV);
|
||||
if (BfvHob != NULL) {
|
||||
DEBUG ((DEBUG_INFO, "BFV address - 0x%x\n", BfvHob->BaseAddress));
|
||||
DEBUG ((DEBUG_INFO, "BFV size - 0x%x\n", BfvHob->Length));
|
||||
gMmCorePrivate->StandaloneBfvAddress = BfvHob->BaseAddress;
|
||||
}
|
||||
|
||||
gMmCorePrivate->Mmst = (EFI_PHYSICAL_ADDRESS)(UINTN)&gMmCoreMmst;
|
||||
gMmCorePrivate->MmEntryPoint = (EFI_PHYSICAL_ADDRESS)(UINTN)MmEntryPoint;
|
||||
|
||||
//
|
||||
// No need to initialize memory service.
|
||||
// It is done in the constructor of StandaloneMmCoreMemoryAllocationLib(),
|
||||
@ -810,12 +739,20 @@ StandaloneMmMain (
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// Dispatch standalone BFV
|
||||
// Get Boot Firmware Volume address from the BFV Hob
|
||||
//
|
||||
DEBUG ((DEBUG_INFO, "Mm Dispatch StandaloneBfvAddress - 0x%08x\n", gMmCorePrivate->StandaloneBfvAddress));
|
||||
if (gMmCorePrivate->StandaloneBfvAddress != 0) {
|
||||
MmCoreFfsFindMmDriver ((EFI_FIRMWARE_VOLUME_HEADER *)(UINTN)gMmCorePrivate->StandaloneBfvAddress, 0);
|
||||
MmDispatcher ();
|
||||
BfvHob = GetFirstHob (EFI_HOB_TYPE_FV);
|
||||
if (BfvHob != NULL) {
|
||||
DEBUG ((DEBUG_INFO, "BFV address - 0x%x\n", BfvHob->BaseAddress));
|
||||
DEBUG ((DEBUG_INFO, "BFV size - 0x%x\n", BfvHob->Length));
|
||||
//
|
||||
// Dispatch standalone BFV
|
||||
//
|
||||
if (BfvHob->BaseAddress != 0) {
|
||||
DEBUG ((DEBUG_INFO, "Mm Dispatch StandaloneBfvAddress - 0x%08x\n", BfvHob->BaseAddress));
|
||||
MmCoreFfsFindMmDriver ((EFI_FIRMWARE_VOLUME_HEADER *)(UINTN)BfvHob->BaseAddress, 0);
|
||||
MmDispatcher ();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -175,9 +175,8 @@ typedef struct {
|
||||
//
|
||||
// MM Core Global Variables
|
||||
//
|
||||
extern MM_CORE_PRIVATE_DATA *gMmCorePrivate;
|
||||
extern EFI_MM_SYSTEM_TABLE gMmCoreMmst;
|
||||
extern LIST_ENTRY gHandleList;
|
||||
extern EFI_MM_SYSTEM_TABLE gMmCoreMmst;
|
||||
extern LIST_ENTRY gHandleList;
|
||||
|
||||
/**
|
||||
Called to initialize the memory service.
|
||||
|
@ -71,7 +71,6 @@
|
||||
gZeroGuid ## SOMETIMES_CONSUMES ## GUID
|
||||
gEfiHobListGuid
|
||||
gEfiHobMemoryAllocModuleGuid
|
||||
gMmCoreDataHobGuid
|
||||
gMmFvDispatchGuid
|
||||
gEfiEventLegacyBootGuid
|
||||
gEfiEventExitBootServicesGuid
|
||||
|
@ -11,8 +11,6 @@
|
||||
#ifndef _STANDALONE_MM_CORE_PRIVATE_DATA_H_
|
||||
#define _STANDALONE_MM_CORE_PRIVATE_DATA_H_
|
||||
|
||||
#include <Guid/MmCoreData.h>
|
||||
|
||||
//
|
||||
// Page management
|
||||
//
|
||||
|
Loading…
x
Reference in New Issue
Block a user