diff --git a/StandaloneMmPkg/Core/StandaloneMmCore.c b/StandaloneMmPkg/Core/StandaloneMmCore.c index 6ce09176e3..36be31ca53 100644 --- a/StandaloneMmPkg/Core/StandaloneMmCore.c +++ b/StandaloneMmPkg/Core/StandaloneMmCore.c @@ -505,6 +505,7 @@ MmEntryPoint ( EFI_MM_COMMUNICATE_HEADER *CommunicateHeader; MM_COMM_BUFFER_STATUS *CommunicationStatus; UINTN BufferSize; + EFI_HANDLE MmHandle; DEBUG ((DEBUG_INFO, "MmEntryPoint ...\n")); @@ -514,9 +515,22 @@ MmEntryPoint ( CopyMem (&gMmCoreMmst.MmStartupThisAp, MmEntryContext, sizeof (EFI_MM_ENTRY_CONTEXT)); // - // Call platform hook before Mm Dispatch + // Install a protocol to notify BeforeMmDispatch. // - // PlatformHookBeforeMmDispatch (); + MmHandle = NULL; + Status = MmInstallProtocolInterface ( + &MmHandle, + &gEfiMmEntryNotifyProtocolGuid, + EFI_NATIVE_INTERFACE, + NULL + ); + if (!EFI_ERROR (Status)) { + MmUninstallProtocolInterface ( + MmHandle, + &gEfiMmEntryNotifyProtocolGuid, + NULL + ); + } // // Check to see if this is a Synchronous MMI sent through the MM Communication @@ -589,6 +603,24 @@ MmEntryPoint ( // MmiManage (NULL, NULL, NULL, NULL); + // + // Install a protocol to notify AfterMmDispatch. + // + MmHandle = NULL; + Status = MmInstallProtocolInterface ( + &MmHandle, + &gEfiMmExitNotifyProtocolGuid, + EFI_NATIVE_INTERFACE, + NULL + ); + if (!EFI_ERROR (Status)) { + MmUninstallProtocolInterface ( + MmHandle, + &gEfiMmExitNotifyProtocolGuid, + NULL + ); + } + // // TBD: Do not use private data structure ? // diff --git a/StandaloneMmPkg/Core/StandaloneMmCore.inf b/StandaloneMmPkg/Core/StandaloneMmCore.inf index f825a98fa1..f3340d26f9 100644 --- a/StandaloneMmPkg/Core/StandaloneMmCore.inf +++ b/StandaloneMmPkg/Core/StandaloneMmCore.inf @@ -63,6 +63,8 @@ gEfiLoadedImageProtocolGuid ## PRODUCES gEfiMmConfigurationProtocolGuid ## CONSUMES gEfiMmEndOfPeiProtocol ## PRODUCES + gEfiMmEntryNotifyProtocolGuid ## PRODUCES + gEfiMmExitNotifyProtocolGuid ## PRODUCES [Guids] gAprioriGuid ## SOMETIMES_CONSUMES ## File diff --git a/StandaloneMmPkg/StandaloneMmPkg.dec b/StandaloneMmPkg/StandaloneMmPkg.dec index 00ec8c076e..8292c8ebe5 100644 --- a/StandaloneMmPkg/StandaloneMmPkg.dec +++ b/StandaloneMmPkg/StandaloneMmPkg.dec @@ -43,6 +43,10 @@ gEventMmDispatchGuid = { 0x7e6efffa, 0x69b4, 0x4c1b, { 0xa4, 0xc7, 0xaf, 0xf9, 0xc9, 0x24, 0x4f, 0xee }} +[Protocols] + gEfiMmEntryNotifyProtocolGuid = { 0x9bfbcc5f, 0x6435, 0x46d3, { 0xb9, 0xa5, 0x70, 0xfb, 0xa4, 0x71, 0xe1, 0x26 }} + gEfiMmExitNotifyProtocolGuid = { 0x0e265f48, 0x47c0, 0x471f, { 0x9c, 0x83, 0xc6, 0xd6, 0x57, 0x64, 0x21, 0xa4 }} + [Ppis] gMmCoreFvLocationPpiGuid = { 0x47a00618, 0x237a, 0x4386, { 0x8f, 0xc5, 0x2a, 0x86, 0xd8, 0xac, 0x41, 0x05 }}