StandaloneMmPkg/Core: Install protocol to notify MmEndOfPei event

When the EndOfPei event is signaled, installs the MM EndOfPei Protocol
so MM Drivers are informed that EndOfPei event is signaled.

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 10:20:06 +08:00 committed by mergify[bot]
parent c8df60801f
commit b7931cafea
3 changed files with 65 additions and 0 deletions

View File

@ -76,6 +76,7 @@ EFI_MM_SYSTEM_TABLE gMmCoreMmst = {
MM_CORE_MMI_HANDLERS mMmCoreMmiHandlers[] = { MM_CORE_MMI_HANDLERS mMmCoreMmiHandlers[] = {
{ MmDriverDispatchHandler, &gEventMmDispatchGuid, NULL, FALSE }, { MmDriverDispatchHandler, &gEventMmDispatchGuid, NULL, FALSE },
{ MmReadyToLockHandler, &gEfiDxeMmReadyToLockProtocolGuid, NULL, TRUE }, { MmReadyToLockHandler, &gEfiDxeMmReadyToLockProtocolGuid, NULL, TRUE },
{ MmEndOfPeiHandler, &gEfiMmEndOfPeiProtocol, NULL, FALSE },
{ MmEndOfDxeHandler, &gEfiEndOfDxeEventGroupGuid, NULL, FALSE }, { MmEndOfDxeHandler, &gEfiEndOfDxeEventGroupGuid, NULL, FALSE },
{ MmExitBootServiceHandler, &gEfiEventExitBootServicesGuid, NULL, FALSE }, { MmExitBootServiceHandler, &gEfiEventExitBootServicesGuid, NULL, FALSE },
{ MmReadyToBootHandler, &gEfiEventReadyToBootGuid, NULL, FALSE }, { MmReadyToBootHandler, &gEfiEventReadyToBootGuid, NULL, FALSE },
@ -274,6 +275,46 @@ MmReadyToLockHandler (
return Status; return Status;
} }
/**
Software MMI handler that is called when the EndOfPei event is signaled.
This function installs the MM EndOfPei Protocol so MM Drivers are informed that
EndOfPei event is signaled.
@param DispatchHandle The unique handle assigned to this handler by MmiHandlerRegister().
@param Context Points to an optional handler context which was specified when the handler was registered.
@param CommBuffer A pointer to a collection of data in memory that will
be conveyed from a non-MM environment into an MM environment.
@param CommBufferSize The size of the CommBuffer.
@return Status Code
**/
EFI_STATUS
EFIAPI
MmEndOfPeiHandler (
IN EFI_HANDLE DispatchHandle,
IN CONST VOID *Context OPTIONAL,
IN OUT VOID *CommBuffer OPTIONAL,
IN OUT UINTN *CommBufferSize OPTIONAL
)
{
EFI_STATUS Status;
EFI_HANDLE MmHandle;
DEBUG ((DEBUG_INFO, "MmEndOfPeiHandler\n"));
//
// Install MM EndOfDxe protocol
//
MmHandle = NULL;
Status = MmInstallProtocolInterface (
&MmHandle,
&gEfiMmEndOfPeiProtocol,
EFI_NATIVE_INTERFACE,
NULL
);
return Status;
}
/** /**
Software MMI handler that is called when the EndOfDxe event is signaled. Software MMI handler that is called when the EndOfDxe event is signaled.
This function installs the MM EndOfDxe Protocol so MM Drivers are informed that This function installs the MM EndOfDxe Protocol so MM Drivers are informed that

View File

@ -683,6 +683,29 @@ MmReadyToLockHandler (
IN OUT UINTN *CommBufferSize OPTIONAL IN OUT UINTN *CommBufferSize OPTIONAL
); );
/**
Software MMI handler that is called when the EndOfPei event is signaled.
This function installs the MM EndOfPei Protocol so MM Drivers are informed that
EndOfPei event is signaled.
@param DispatchHandle The unique handle assigned to this handler by MmiHandlerRegister().
@param Context Points to an optional handler context which was specified when the handler was registered.
@param CommBuffer A pointer to a collection of data in memory that will
be conveyed from a non-MM environment into an MM environment.
@param CommBufferSize The size of the CommBuffer.
@return Status Code
**/
EFI_STATUS
EFIAPI
MmEndOfPeiHandler (
IN EFI_HANDLE DispatchHandle,
IN CONST VOID *Context OPTIONAL,
IN OUT VOID *CommBuffer OPTIONAL,
IN OUT UINTN *CommBufferSize OPTIONAL
);
/** /**
This function is the main entry point for an MM handler dispatch This function is the main entry point for an MM handler dispatch
or communicate-based callback. or communicate-based callback.

View File

@ -60,6 +60,7 @@
gEfiMmEndOfDxeProtocolGuid ## PRODUCES gEfiMmEndOfDxeProtocolGuid ## PRODUCES
gEfiLoadedImageProtocolGuid ## PRODUCES gEfiLoadedImageProtocolGuid ## PRODUCES
gEfiMmConfigurationProtocolGuid ## CONSUMES gEfiMmConfigurationProtocolGuid ## CONSUMES
gEfiMmEndOfPeiProtocol ## PRODUCES
[Guids] [Guids]
gAprioriGuid ## SOMETIMES_CONSUMES ## File gAprioriGuid ## SOMETIMES_CONSUMES ## File