Install LoadedImage protocol for PiSmmCore.
PiSmmCore installs LoadedImage for each SMM driver. However itself is missing. So we follow DxeCore style, let PiSmmCore installs LoadedImage protocol for itself, then the SMM image information is complete. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: "Yao, Jiewen" <jiewen.yao@intel.com> Reviewed-by: "Zeng, Star" <star.zeng@intel.com> Reviewed-by: "Kinney, Michael D" <michael.d.kinney@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18945 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -87,6 +87,8 @@ SMM_CORE_SMI_HANDLERS mSmmCoreSmiHandlers[] = {
|
||||
UINTN mFullSmramRangeCount;
|
||||
EFI_SMRAM_DESCRIPTOR *mFullSmramRanges;
|
||||
|
||||
EFI_LOADED_IMAGE_PROTOCOL *mSmmCoreLoadedImage;
|
||||
|
||||
/**
|
||||
Place holder function until all the SMM System Table Service are available.
|
||||
|
||||
@@ -520,6 +522,51 @@ SmmEntryPoint (
|
||||
PERF_END (NULL, "SMM", NULL, 0) ;
|
||||
}
|
||||
|
||||
/**
|
||||
Install LoadedImage protocol for SMM Core.
|
||||
**/
|
||||
VOID
|
||||
SmmCoreInstallLoadedImage (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_HANDLE Handle;
|
||||
|
||||
//
|
||||
// Allocate a Loaded Image Protocol in EfiBootServicesData
|
||||
//
|
||||
Status = gBS->AllocatePool (EfiBootServicesData, sizeof(EFI_LOADED_IMAGE_PROTOCOL), (VOID **)&mSmmCoreLoadedImage);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
ZeroMem (mSmmCoreLoadedImage, 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.
|
||||
//
|
||||
mSmmCoreLoadedImage->Revision = EFI_LOADED_IMAGE_PROTOCOL_REVISION;
|
||||
mSmmCoreLoadedImage->ParentHandle = gSmmCorePrivate->SmmIplImageHandle;
|
||||
mSmmCoreLoadedImage->SystemTable = gST;
|
||||
|
||||
mSmmCoreLoadedImage->ImageBase = (VOID *)(UINTN)gSmmCorePrivate->PiSmmCoreImageBase;
|
||||
mSmmCoreLoadedImage->ImageSize = gSmmCorePrivate->PiSmmCoreImageSize;
|
||||
mSmmCoreLoadedImage->ImageCodeType = EfiRuntimeServicesCode;
|
||||
mSmmCoreLoadedImage->ImageDataType = EfiRuntimeServicesData;
|
||||
|
||||
//
|
||||
// Create a new image handle in the UEFI handle database for the SMM Driver
|
||||
//
|
||||
Handle = NULL;
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||
&Handle,
|
||||
&gEfiLoadedImageProtocolGuid, mSmmCoreLoadedImage,
|
||||
NULL
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
/**
|
||||
The Entry Point for SMM Core
|
||||
|
||||
@@ -586,5 +633,7 @@ SmmMain (
|
||||
|
||||
RegisterSmramProfileHandler ();
|
||||
|
||||
SmmCoreInstallLoadedImage ();
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
Reference in New Issue
Block a user