LIST_ENTRY *Link;\r
EFI_MM_DRIVER_ENTRY *DriverEntry;\r
BOOLEAN ReadyToRun;\r
- BOOLEAN PreviousMmEntryPointRegistered;\r
\r
DEBUG ((DEBUG_INFO, "MmDispatcher\n"));\r
\r
DriverEntry->Initialized = TRUE;\r
RemoveEntryList (&DriverEntry->ScheduledLink);\r
\r
- //\r
- // Cache state of MmEntryPointRegistered before calling entry point\r
- //\r
- PreviousMmEntryPointRegistered = gMmCorePrivate->MmEntryPointRegistered;\r
-\r
//\r
// For each MM driver, pass NULL as ImageHandle\r
//\r
DEBUG ((DEBUG_INFO, "StartImage Status - %r\n", Status));\r
MmFreePages(DriverEntry->ImageBuffer, DriverEntry->NumberOfPage);\r
}\r
-\r
- if (!PreviousMmEntryPointRegistered && gMmCorePrivate->MmEntryPointRegistered) {\r
- //\r
- // Return immediately if the MM Entry Point was registered by the MM\r
- // Driver that was just dispatched. The MM IPL will reinvoke the MM\r
- // Core Dispatcher. This is required so MM Mode may be enabled as soon\r
- // as all the dependent MM Drivers for MM Mode have been dispatched.\r
- // Once the MM Entry Point has been registered, then MM Mode will be\r
- // used.\r
- //\r
- gRequestDispatch = TRUE;\r
- gDispatcherRunning = FALSE;\r
- return EFI_NOT_READY;\r
- }\r
}\r
\r
//\r
return EFI_SUCCESS;\r
}\r
\r
-/**\r
- This function is the main entry point for an MM handler dispatch\r
- or communicate-based callback.\r
-\r
- Event notification that is fired every time a FV dispatch protocol is added.\r
- More than one protocol may have been added when this event is fired, so you\r
- must loop on MmLocateHandle () to see how many protocols were added and\r
- do the following to each FV:\r
- If the Fv has already been processed, skip it. If the Fv has not been\r
- processed then mark it as being processed, as we are about to process it.\r
- Read the Fv and add any driver in the Fv to the mDiscoveredList.The\r
- mDiscoveredList is never free'ed and contains variables that define\r
- the other states the MM driver transitions to..\r
- While you are at it read the A Priori file into memory.\r
- Place drivers in the A Priori list onto the mScheduledQueue.\r
-\r
- @param DispatchHandle The unique handle assigned to this handler by SmiHandlerRegister().\r
- @param Context Points to an optional handler context which was specified when the handler was registered.\r
- @param CommBuffer A pointer to a collection of data in memory that will\r
- be conveyed from a non-MM environment into an MM environment.\r
- @param CommBufferSize The size of the CommBuffer.\r
-\r
- @return Status Code\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-MmDriverDispatchHandler (\r
- IN EFI_HANDLE DispatchHandle,\r
- IN CONST VOID *Context, OPTIONAL\r
- IN OUT VOID *CommBuffer, OPTIONAL\r
- IN OUT UINTN *CommBufferSize OPTIONAL\r
- )\r
-{\r
- EFI_STATUS Status;\r
-\r
- DEBUG ((DEBUG_INFO, "MmDriverDispatchHandler\n"));\r
-\r
- //\r
- // Execute the MM Dispatcher on any newly discovered FVs and previously\r
- // discovered MM drivers that have been discovered but not dispatched.\r
- //\r
- Status = MmDispatcher ();\r
-\r
- //\r
- // Check to see if CommBuffer and CommBufferSize are valid\r
- //\r
- if (CommBuffer != NULL && CommBufferSize != NULL) {\r
- if (*CommBufferSize > 0) {\r
- if (Status == EFI_NOT_READY) {\r
- //\r
- // If a the MM Core Entry Point was just registered, then set flag to\r
- // request the MM Dispatcher to be restarted.\r
- //\r
- *(UINT8 *)CommBuffer = COMM_BUFFER_MM_DISPATCH_RESTART;\r
- } else if (!EFI_ERROR (Status)) {\r
- //\r
- // Set the flag to show that the MM Dispatcher executed without errors\r
- //\r
- *(UINT8 *)CommBuffer = COMM_BUFFER_MM_DISPATCH_SUCCESS;\r
- } else {\r
- //\r
- // Set the flag to show that the MM Dispatcher encountered an error\r
- //\r
- *(UINT8 *)CommBuffer = COMM_BUFFER_MM_DISPATCH_ERROR;\r
- }\r
- }\r
- }\r
-\r
- return EFI_SUCCESS;\r
-}\r
-\r
/**\r
This function is the main entry point for an MM handler dispatch\r
or communicate-based callback.\r
//\r
MM_CORE_MMI_HANDLERS mMmCoreMmiHandlers[] = {\r
{ MmFvDispatchHandler, &gMmFvDispatchGuid, NULL, TRUE },\r
- { MmDriverDispatchHandler, &gEfiEventDxeDispatchGuid, NULL, TRUE },\r
{ MmReadyToLockHandler, &gEfiDxeMmReadyToLockProtocolGuid, NULL, TRUE },\r
{ MmEndOfDxeHandler, &gEfiEndOfDxeEventGroupGuid, NULL, FALSE },\r
{ MmLegacyBootHandler, &gEfiEventLegacyBootGuid, NULL, FALSE },\r