]> git.proxmox.com Git - mirror_edk2.git/commitdiff
StandaloneMmPkg/Core: dispatch all drivers at init time
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Mon, 4 Mar 2019 17:17:06 +0000 (18:17 +0100)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Mon, 11 Mar 2019 11:51:12 +0000 (12:51 +0100)
Instead of deferring dispatch of the remaining MM drivers once the
CPU driver has been dispatched, proceed and dispatch all drivers.
This makes sense for standalone MM, since all dispatchable drivers
should be present in the initial firmware volume anyway: dispatch
of additional FVs originating in the non-secure side is not supported.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: "Yao, Jiewen" <jiewen.yao@intel.com>
Reviewed-by: Achin Gupta <achin.gupta@arm.com>
StandaloneMmPkg/Core/Dispatcher.c
StandaloneMmPkg/Core/StandaloneMmCore.c

index 8a2ad5118d92def3904731a8d9a594d247a8aff7..bede4832cfb767db4c9c4655fac9149ce4e29a84 100644 (file)
@@ -575,7 +575,6 @@ MmDispatcher (
   LIST_ENTRY            *Link;\r
   EFI_MM_DRIVER_ENTRY  *DriverEntry;\r
   BOOLEAN               ReadyToRun;\r
-  BOOLEAN               PreviousMmEntryPointRegistered;\r
 \r
   DEBUG ((DEBUG_INFO, "MmDispatcher\n"));\r
 \r
@@ -639,11 +638,6 @@ MmDispatcher (
       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
@@ -661,20 +655,6 @@ MmDispatcher (
         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
@@ -903,78 +883,6 @@ MmAddToDriverList (
   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
index 74432320bfc742e89d46fd25d5a239e31bddaaba..ec53b8d8bec4dbc45d6486fa30ab886a7762c193 100644 (file)
@@ -100,7 +100,6 @@ BOOLEAN  mInLegacyBoot = FALSE;
 //\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