|
14 | 14 | #include <Library/HobLib.h>
|
15 | 15 | #include <Library/PcdLib.h>
|
16 | 16 | #include <Library/UefiBootServicesTableLib.h>
|
| 17 | +#include <Library/UefiLib.h> |
17 | 18 | #include <Library/UefiRuntimeServicesTableLib.h>
|
18 | 19 |
|
19 | 20 | #include <Protocol/MmCommunication2.h>
|
@@ -553,6 +554,34 @@ STATIC EFI_GUID *CONST mGuidedEventGuid[] = {
|
553 | 554 |
|
554 | 555 | STATIC EFI_EVENT mGuidedEvent[ARRAY_SIZE (mGuidedEventGuid)];
|
555 | 556 |
|
| 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 | + |
556 | 585 | /**
|
557 | 586 | Event notification that is fired when GUIDed Event Group is signaled.
|
558 | 587 |
|
@@ -680,6 +709,15 @@ MmCommunication2Initialize (
|
680 | 709 | );
|
681 | 710 | ASSERT_EFI_ERROR (Status);
|
682 | 711 |
|
| 712 | + Status = EfiNamedEventListen ( |
| 713 | + &gEfiDxeMmReadyToLockProtocolGuid, |
| 714 | + TPL_NOTIFY, |
| 715 | + MMReadyToLockProtocolNotify, |
| 716 | + NULL, |
| 717 | + NULL |
| 718 | + ); |
| 719 | + ASSERT_EFI_ERROR (Status); |
| 720 | + |
683 | 721 | for (Index = 0; Index < ARRAY_SIZE (mGuidedEventGuid); Index++) {
|
684 | 722 | Status = gBS->CreateEventEx (
|
685 | 723 | EVT_NOTIFY_SIGNAL,
|
|
0 commit comments