diff options
author | Wei6 Xu <wei6.xu@intel.com> | 2024-05-06 23:45:05 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2024-08-28 15:25:27 +0000 |
commit | 6dc14fb5b47da8059f65512543afd72624bd7085 (patch) | |
tree | 0fe4a4338e2747286d65fd8da460cf95db22eb60 /StandaloneMmPkg | |
parent | 6855567d52246d6fb31a2eccc6add3e12fa9b3df (diff) | |
download | edk2-6dc14fb5b47da8059f65512543afd72624bd7085.zip edk2-6dc14fb5b47da8059f65512543afd72624bd7085.tar.gz edk2-6dc14fb5b47da8059f65512543afd72624bd7085.tar.bz2 |
StandaloneMmPkg/Core: Remove traditional MM driver support
StandaloneMmCore should not support dispatching traditional MM
driver which has dependency on UEFI services. Therefore, remove
the related code that supports traditional MM driver.
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>
Diffstat (limited to 'StandaloneMmPkg')
-rw-r--r-- | StandaloneMmPkg/Core/Dependency.c | 7 | ||||
-rw-r--r-- | StandaloneMmPkg/Core/Dispatcher.c | 52 | ||||
-rw-r--r-- | StandaloneMmPkg/Core/FwVol.c | 41 | ||||
-rw-r--r-- | StandaloneMmPkg/Core/StandaloneMmCore.c | 1 | ||||
-rw-r--r-- | StandaloneMmPkg/Core/StandaloneMmCore.h | 1 |
5 files changed, 14 insertions, 88 deletions
diff --git a/StandaloneMmPkg/Core/Dependency.c b/StandaloneMmPkg/Core/Dependency.c index 2bcb07d..0a77ceb 100644 --- a/StandaloneMmPkg/Core/Dependency.c +++ b/StandaloneMmPkg/Core/Dependency.c @@ -231,13 +231,6 @@ MmIsSchedulable ( CopyMem (&DriverGuid, Iterator + 1, sizeof (EFI_GUID));
Status = MmLocateProtocol (&DriverGuid, NULL, &Interface);
- if (EFI_ERROR (Status) && (mEfiSystemTable != NULL)) {
- //
- // For MM Driver, it may depend on uefi protocols
- //
- Status = mEfiSystemTable->BootServices->LocateProtocol (&DriverGuid, NULL, &Interface);
- }
-
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_DISPATCH, " PUSH GUID(%g) = FALSE\n", &DriverGuid));
Status = PushBool (FALSE);
diff --git a/StandaloneMmPkg/Core/Dispatcher.c b/StandaloneMmPkg/Core/Dispatcher.c index 01a2b3a..31ba236 100644 --- a/StandaloneMmPkg/Core/Dispatcher.c +++ b/StandaloneMmPkg/Core/Dispatcher.c @@ -185,45 +185,6 @@ MmLoadImage ( DriverEntry->ImageBuffer = DstBuffer;
DriverEntry->NumberOfPage = PageCount;
- if (mEfiSystemTable != NULL) {
- Status = mEfiSystemTable->BootServices->AllocatePool (
- EfiBootServicesData,
- sizeof (EFI_LOADED_IMAGE_PROTOCOL),
- (VOID **)&DriverEntry->LoadedImage
- );
- if (EFI_ERROR (Status)) {
- MmFreePages (DstBuffer, PageCount);
- return Status;
- }
-
- ZeroMem (DriverEntry->LoadedImage, sizeof (EFI_LOADED_IMAGE_PROTOCOL));
- //
- // Fill in the remaining fields of the Loaded Image Protocol instance.
- // Note: ImageBase is an SMRAM address that can not be accessed outside of SMRAM if SMRAM window is closed.
- //
- DriverEntry->LoadedImage->Revision = EFI_LOADED_IMAGE_PROTOCOL_REVISION;
- DriverEntry->LoadedImage->ParentHandle = NULL;
- DriverEntry->LoadedImage->SystemTable = mEfiSystemTable;
- DriverEntry->LoadedImage->DeviceHandle = NULL;
- DriverEntry->LoadedImage->FilePath = NULL;
-
- DriverEntry->LoadedImage->ImageBase = (VOID *)(UINTN)DriverEntry->ImageBuffer;
- DriverEntry->LoadedImage->ImageSize = ImageContext.ImageSize;
- DriverEntry->LoadedImage->ImageCodeType = EfiRuntimeServicesCode;
- DriverEntry->LoadedImage->ImageDataType = EfiRuntimeServicesData;
-
- //
- // Create a new image handle in the UEFI handle database for the MM Driver
- //
- DriverEntry->ImageHandle = NULL;
- Status = mEfiSystemTable->BootServices->InstallMultipleProtocolInterfaces (
- &DriverEntry->ImageHandle,
- &gEfiLoadedImageProtocolGuid,
- DriverEntry->LoadedImage,
- NULL
- );
- }
-
//
// Print the load address and the PDB file name if it is available
//
@@ -464,17 +425,8 @@ MmDispatcher ( //
// For each MM driver, pass NULL as ImageHandle
//
- if (mEfiSystemTable == NULL) {
- DEBUG ((DEBUG_INFO, "StartImage - 0x%x (Standalone Mode)\n", DriverEntry->ImageEntryPoint));
- Status = ((MM_IMAGE_ENTRY_POINT)(UINTN)DriverEntry->ImageEntryPoint)(DriverEntry->ImageHandle, &gMmCoreMmst);
- } else {
- DEBUG ((DEBUG_INFO, "StartImage - 0x%x (Tradition Mode)\n", DriverEntry->ImageEntryPoint));
- Status = ((EFI_IMAGE_ENTRY_POINT)(UINTN)DriverEntry->ImageEntryPoint)(
- DriverEntry->ImageHandle,
- mEfiSystemTable
- );
- }
-
+ DEBUG ((DEBUG_INFO, "StartImage - 0x%x (Standalone Mode)\n", DriverEntry->ImageEntryPoint));
+ Status = ((MM_IMAGE_ENTRY_POINT)(UINTN)DriverEntry->ImageEntryPoint)(DriverEntry->ImageHandle, &gMmCoreMmst);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_INFO, "StartImage Status - %r\n", Status));
MmFreePages (DriverEntry->ImageBuffer, DriverEntry->NumberOfPage);
diff --git a/StandaloneMmPkg/Core/FwVol.c b/StandaloneMmPkg/Core/FwVol.c index 07500ce..9c5ee9c 100644 --- a/StandaloneMmPkg/Core/FwVol.c +++ b/StandaloneMmPkg/Core/FwVol.c @@ -11,18 +11,6 @@ #include <Library/FvLib.h>
#include <Library/ExtractGuidedSectionLib.h>
-//
-// List of file types supported by dispatcher
-//
-EFI_FV_FILETYPE mMmFileTypes[] = {
- EFI_FV_FILETYPE_MM,
- 0xE, // EFI_FV_FILETYPE_MM_STANDALONE,
- //
- // Note: DXE core will process the FV image file, so skip it in MM core
- // EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE
- //
-};
-
EFI_STATUS
MmAddToDriverList (
IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader,
@@ -72,12 +60,10 @@ MmCoreFfsFindMmDriver ( EFI_STATUS Status;
EFI_STATUS DepexStatus;
EFI_FFS_FILE_HEADER *FileHeader;
- EFI_FV_FILETYPE FileType;
VOID *Pe32Data;
UINTN Pe32DataSize;
VOID *Depex;
UINTN DepexSize;
- UINTN Index;
EFI_COMMON_SECTION_HEADER *Section;
VOID *SectionData;
UINTN SectionDataSize;
@@ -224,22 +210,19 @@ MmCoreFfsFindMmDriver ( }
} while (TRUE);
- for (Index = 0; Index < sizeof (mMmFileTypes) / sizeof (mMmFileTypes[0]); Index++) {
- DEBUG ((DEBUG_INFO, "Check MmFileTypes - 0x%x\n", mMmFileTypes[Index]));
- FileType = mMmFileTypes[Index];
- FileHeader = NULL;
- do {
- Status = FfsFindNextFile (FileType, FwVolHeader, &FileHeader);
- if (!EFI_ERROR (Status)) {
- Status = FfsFindSectionData (EFI_SECTION_PE32, FileHeader, &Pe32Data, &Pe32DataSize);
- DEBUG ((DEBUG_INFO, "Find PE data - 0x%x\n", Pe32Data));
- DepexStatus = FfsFindSectionData (EFI_SECTION_MM_DEPEX, FileHeader, &Depex, &DepexSize);
- if (!EFI_ERROR (DepexStatus)) {
- MmAddToDriverList (FwVolHeader, Pe32Data, Pe32DataSize, Depex, DepexSize, &FileHeader->Name);
- }
+ DEBUG ((DEBUG_INFO, "Check MmFileTypes - 0x%x\n", EFI_FV_FILETYPE_MM_STANDALONE));
+ FileHeader = NULL;
+ do {
+ Status = FfsFindNextFile (EFI_FV_FILETYPE_MM_STANDALONE, FwVolHeader, &FileHeader);
+ if (!EFI_ERROR (Status)) {
+ Status = FfsFindSectionData (EFI_SECTION_PE32, FileHeader, &Pe32Data, &Pe32DataSize);
+ DEBUG ((DEBUG_INFO, "Find PE data - 0x%x\n", Pe32Data));
+ DepexStatus = FfsFindSectionData (EFI_SECTION_MM_DEPEX, FileHeader, &Depex, &DepexSize);
+ if (!EFI_ERROR (DepexStatus)) {
+ MmAddToDriverList (FwVolHeader, Pe32Data, Pe32DataSize, Depex, DepexSize, &FileHeader->Name);
}
- } while (!EFI_ERROR (Status));
- }
+ }
+ } while (!EFI_ERROR (Status));
return EFI_SUCCESS;
diff --git a/StandaloneMmPkg/Core/StandaloneMmCore.c b/StandaloneMmPkg/Core/StandaloneMmCore.c index 81db9a9..b70e340 100644 --- a/StandaloneMmPkg/Core/StandaloneMmCore.c +++ b/StandaloneMmPkg/Core/StandaloneMmCore.c @@ -86,7 +86,6 @@ MM_CORE_MMI_HANDLERS mMmCoreMmiHandlers[] = { { NULL, NULL, NULL, FALSE },
};
-EFI_SYSTEM_TABLE *mEfiSystemTable;
UINTN mMmramRangeCount;
EFI_MMRAM_DESCRIPTOR *mMmramRanges;
diff --git a/StandaloneMmPkg/Core/StandaloneMmCore.h b/StandaloneMmPkg/Core/StandaloneMmCore.h index a8fda6d..ae6c840 100644 --- a/StandaloneMmPkg/Core/StandaloneMmCore.h +++ b/StandaloneMmPkg/Core/StandaloneMmCore.h @@ -873,6 +873,5 @@ MmCoreFfsFindMmDriver ( extern UINTN mMmramRangeCount;
extern EFI_MMRAM_DESCRIPTOR *mMmramRanges;
-extern EFI_SYSTEM_TABLE *mEfiSystemTable;
#endif
|