Skip to content

Commit 1c6ce56

Browse files
CrystalLee-77mergify[bot]
authored andcommitted
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 <[email protected]>
1 parent f1a2bd2 commit 1c6ce56

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.c

+38
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <Library/HobLib.h>
1515
#include <Library/PcdLib.h>
1616
#include <Library/UefiBootServicesTableLib.h>
17+
#include <Library/UefiLib.h>
1718
#include <Library/UefiRuntimeServicesTableLib.h>
1819

1920
#include <Protocol/MmCommunication2.h>
@@ -553,6 +554,34 @@ STATIC EFI_GUID *CONST mGuidedEventGuid[] = {
553554

554555
STATIC EFI_EVENT mGuidedEvent[ARRAY_SIZE (mGuidedEventGuid)];
555556

557+
/**
558+
Event notification that is fired when ReadyToLockProtocol is signaled.
559+
560+
@param Event The Event that is being processed, not used.
561+
@param Context Event Context, not used.
562+
563+
**/
564+
VOID
565+
EFIAPI
566+
MMReadyToLockProtocolNotify (
567+
IN EFI_EVENT Event,
568+
IN VOID *Context
569+
)
570+
{
571+
EFI_MM_COMMUNICATE_HEADER Header;
572+
UINTN Size;
573+
574+
//
575+
// Use Guid to initialize EFI_SMM_COMMUNICATE_HEADER structure
576+
//
577+
CopyGuid (&Header.HeaderGuid, &gEfiDxeMmReadyToLockProtocolGuid);
578+
Header.MessageLength = 1;
579+
Header.Data[0] = 0;
580+
581+
Size = sizeof (Header);
582+
MmCommunication2Communicate (&mMmCommunication2, &Header, &Header, &Size);
583+
}
584+
556585
/**
557586
Event notification that is fired when GUIDed Event Group is signaled.
558587
@@ -680,6 +709,15 @@ MmCommunication2Initialize (
680709
);
681710
ASSERT_EFI_ERROR (Status);
682711

712+
Status = EfiNamedEventListen (
713+
&gEfiDxeMmReadyToLockProtocolGuid,
714+
TPL_NOTIFY,
715+
MMReadyToLockProtocolNotify,
716+
NULL,
717+
NULL
718+
);
719+
ASSERT_EFI_ERROR (Status);
720+
683721
for (Index = 0; Index < ARRAY_SIZE (mGuidedEventGuid); Index++) {
684722
Status = gBS->CreateEventEx (
685723
EVT_NOTIFY_SIGNAL,

ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
UefiDriverEntryPoint
4242

4343
[Protocols]
44+
gEfiDxeMmReadyToLockProtocolGuid ## UNDEFINED # SmiHandlerRegister
4445
gEfiMmCommunication2ProtocolGuid ## PRODUCES
4546

4647
[Guids]

0 commit comments

Comments
 (0)