diff --git a/StandaloneMmPkg/Core/StandaloneMmCore.c b/StandaloneMmPkg/Core/StandaloneMmCore.c index c1281ca8d4..352a067253 100644 --- a/StandaloneMmPkg/Core/StandaloneMmCore.c +++ b/StandaloneMmPkg/Core/StandaloneMmCore.c @@ -76,6 +76,7 @@ EFI_MM_SYSTEM_TABLE gMmCoreMmst = { MM_CORE_MMI_HANDLERS mMmCoreMmiHandlers[] = { { MmDriverDispatchHandler, &gEventMmDispatchGuid, NULL, FALSE }, { MmReadyToLockHandler, &gEfiDxeMmReadyToLockProtocolGuid, NULL, TRUE }, + { MmEndOfPeiHandler, &gEfiMmEndOfPeiProtocol, NULL, FALSE }, { MmEndOfDxeHandler, &gEfiEndOfDxeEventGroupGuid, NULL, FALSE }, { MmExitBootServiceHandler, &gEfiEventExitBootServicesGuid, NULL, FALSE }, { MmReadyToBootHandler, &gEfiEventReadyToBootGuid, NULL, FALSE }, @@ -274,6 +275,46 @@ MmReadyToLockHandler ( 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. This function installs the MM EndOfDxe Protocol so MM Drivers are informed that diff --git a/StandaloneMmPkg/Core/StandaloneMmCore.h b/StandaloneMmPkg/Core/StandaloneMmCore.h index 681b7ff61d..632ded9b27 100644 --- a/StandaloneMmPkg/Core/StandaloneMmCore.h +++ b/StandaloneMmPkg/Core/StandaloneMmCore.h @@ -683,6 +683,29 @@ MmReadyToLockHandler ( 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 or communicate-based callback. diff --git a/StandaloneMmPkg/Core/StandaloneMmCore.inf b/StandaloneMmPkg/Core/StandaloneMmCore.inf index a6fafa5690..58c3bdee03 100644 --- a/StandaloneMmPkg/Core/StandaloneMmCore.inf +++ b/StandaloneMmPkg/Core/StandaloneMmCore.inf @@ -60,6 +60,7 @@ gEfiMmEndOfDxeProtocolGuid ## PRODUCES gEfiLoadedImageProtocolGuid ## PRODUCES gEfiMmConfigurationProtocolGuid ## CONSUMES + gEfiMmEndOfPeiProtocol ## PRODUCES [Guids] gAprioriGuid ## SOMETIMES_CONSUMES ## File