]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c
PI 1.1 SMM Feature Check-in
[mirror_edk2.git] / MdeModulePkg / Core / Dxe / Dispatcher / Dispatcher.c
index 6a18fe909e6d3e81ea322fad12754c017dd3ee67..5fbb2d442d2d4d2406ce55aa98ba7bc8c5c5e686 100644 (file)
@@ -26,7 +26,7 @@
   Depex - Dependency Expresion.\r
   SOR   - Schedule On Request - Don't schedule if this bit is set.\r
 \r
-Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
+Copyright (c) 2006 - 2009, Intel Corporation. <BR>\r
 All rights reserved. This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -78,6 +78,7 @@ VOID            *mFwVolEventRegistration;
 //\r
 EFI_FV_FILETYPE mDxeFileTypes[] = {\r
   EFI_FV_FILETYPE_DRIVER,\r
+  EFI_FV_FILETYPE_COMBINED_SMM_DXE,\r
   EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER,\r
   EFI_FV_FILETYPE_DXE_CORE,\r
   EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE\r
@@ -386,6 +387,23 @@ CoreTrust (
 }\r
 \r
 \r
+/**\r
+  An empty function to pass error checking of CreateEventEx ().\r
+\r
+  @param  Event                 Event whose notification function is being invoked.\r
+  @param  Context               Pointer to the notification function's context,\r
+                                which is implementation-dependent.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+EmptyFuntion (\r
+  IN EFI_EVENT                Event,\r
+  IN VOID                     *Context\r
+  )\r
+{\r
+  return;\r
+}\r
 \r
 /**\r
   This is the main Dispatcher for DXE and it exits when there are no more\r
@@ -412,6 +430,8 @@ CoreDispatcher (
   LIST_ENTRY                      *Link;\r
   EFI_CORE_DRIVER_ENTRY           *DriverEntry;\r
   BOOLEAN                         ReadyToRun;\r
+  EFI_EVENT                       DxeDispatchEvent;\r
+  \r
 \r
   if (gDispatcherRunning) {\r
     //\r
@@ -422,6 +442,17 @@ CoreDispatcher (
 \r
   gDispatcherRunning = TRUE;\r
 \r
+  Status = CoreCreateEventEx (\r
+             EVT_NOTIFY_SIGNAL,\r
+             TPL_NOTIFY,\r
+             EmptyFuntion,\r
+             NULL,\r
+             &gEfiEventDxeDispatchGuid,\r
+             &DxeDispatchEvent\r
+             );\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  }\r
 \r
   ReturnStatus = EFI_NOT_FOUND;\r
   do {\r
@@ -534,8 +565,22 @@ CoreDispatcher (
         }\r
       }\r
     }\r
+\r
+    //\r
+    // Now DXE Dispatcher finished one round of dispatch, signal an event group\r
+    // so that SMM Dispatcher get chance to dispatch SMM Drivers which depend\r
+    // on UEFI protocols\r
+    //\r
+    if (!EFI_ERROR (ReturnStatus)) {\r
+      CoreSignalEvent (DxeDispatchEvent);\r
+    }\r
   } while (ReadyToRun);\r
 \r
+  //\r
+  // Close DXE dispatch Event\r
+  //\r
+  CoreCloseEvent (DxeDispatchEvent);\r
+\r
   gDispatcherRunning = FALSE;\r
 \r
   return ReturnStatus;\r