return Status;\r
}\r
\r
+STATIC EFI_GUID* CONST mGuidedEventGuid[] = {\r
+ &gEfiEndOfDxeEventGroupGuid,\r
+ &gEfiEventExitBootServicesGuid,\r
+ &gEfiEventReadyToBootGuid,\r
+};\r
+\r
+STATIC EFI_EVENT mGuidedEvent[ARRAY_SIZE (mGuidedEventGuid)];\r
+\r
+/**\r
+ Event notification that is fired when GUIDed Event Group is signaled.\r
+\r
+ @param Event The Event that is being processed, not used.\r
+ @param Context Event Context, not used.\r
+\r
+**/\r
+STATIC\r
+VOID\r
+EFIAPI\r
+MmGuidedEventNotify (\r
+ IN EFI_EVENT Event,\r
+ IN VOID *Context\r
+ )\r
+{\r
+ EFI_MM_COMMUNICATE_HEADER Header;\r
+ UINTN Size;\r
+\r
+ //\r
+ // Use Guid to initialize EFI_SMM_COMMUNICATE_HEADER structure\r
+ //\r
+ CopyGuid (&Header.HeaderGuid, Context);\r
+ Header.MessageLength = 1;\r
+ Header.Data[0] = 0;\r
+\r
+ Size = sizeof (Header);\r
+ MmCommunicationCommunicate (&mMmCommunication, &Header, &Size);\r
+}\r
+\r
/**\r
The Entry Point for MM Communication\r
\r
)\r
{\r
EFI_STATUS Status;\r
+ UINTN Index;\r
\r
// Check if we can make the MM call\r
Status = GetMmCompatibility ();\r
NULL,\r
&mSetVirtualAddressMapEvent\r
);\r
- if (Status == EFI_SUCCESS) {\r
- return Status;\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
+ for (Index = 0; Index < ARRAY_SIZE (mGuidedEventGuid); Index++) {\r
+ Status = gBS->CreateEventEx (EVT_NOTIFY_SIGNAL, TPL_CALLBACK,\r
+ MmGuidedEventNotify, mGuidedEventGuid[Index],\r
+ mGuidedEventGuid[Index], &mGuidedEvent[Index]);\r
+ ASSERT_EFI_ERROR (Status);\r
}\r
\r
gBS->UninstallProtocolInterface (\r