ArmPkg: Add a protocol notification for gEfiDxeMmReadyToLockProtocolGuid

Add and install a protocol notification handler for
gEfiDxeMmReadyToLockProtocolGuid, in order to to trigger MMI
handler to install gEfiMmReadyToLockProtocolGuid protocol in Mm.

Signed-off-by: Crystal Lee <CrystalLee@ami.com>
This commit is contained in:
Crystal Lee 2024-11-11 15:49:47 +08:00 committed by mergify[bot]
parent f1a2bd2333
commit 1c6ce560f0
2 changed files with 39 additions and 0 deletions

View File

@ -14,6 +14,7 @@
#include <Library/HobLib.h>
#include <Library/PcdLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
#include <Protocol/MmCommunication2.h>
@ -553,6 +554,34 @@ STATIC EFI_GUID *CONST mGuidedEventGuid[] = {
STATIC EFI_EVENT mGuidedEvent[ARRAY_SIZE (mGuidedEventGuid)];
/**
Event notification that is fired when ReadyToLockProtocol is signaled.
@param Event The Event that is being processed, not used.
@param Context Event Context, not used.
**/
VOID
EFIAPI
MMReadyToLockProtocolNotify (
IN EFI_EVENT Event,
IN VOID *Context
)
{
EFI_MM_COMMUNICATE_HEADER Header;
UINTN Size;
//
// Use Guid to initialize EFI_SMM_COMMUNICATE_HEADER structure
//
CopyGuid (&Header.HeaderGuid, &gEfiDxeMmReadyToLockProtocolGuid);
Header.MessageLength = 1;
Header.Data[0] = 0;
Size = sizeof (Header);
MmCommunication2Communicate (&mMmCommunication2, &Header, &Header, &Size);
}
/**
Event notification that is fired when GUIDed Event Group is signaled.
@ -680,6 +709,15 @@ MmCommunication2Initialize (
);
ASSERT_EFI_ERROR (Status);
Status = EfiNamedEventListen (
&gEfiDxeMmReadyToLockProtocolGuid,
TPL_NOTIFY,
MMReadyToLockProtocolNotify,
NULL,
NULL
);
ASSERT_EFI_ERROR (Status);
for (Index = 0; Index < ARRAY_SIZE (mGuidedEventGuid); Index++) {
Status = gBS->CreateEventEx (
EVT_NOTIFY_SIGNAL,

View File

@ -41,6 +41,7 @@
UefiDriverEntryPoint
[Protocols]
gEfiDxeMmReadyToLockProtocolGuid ## UNDEFINED # SmiHandlerRegister
gEfiMmCommunication2ProtocolGuid ## PRODUCES
[Guids]