]> 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 7e6ddce77a0fd6cd4c81e9307d49ba4228cb6fb3..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
@@ -845,9 +890,12 @@ CoreProcessFvImageFile (
     // FvImage should be at its required alignment.\r
     //\r
     FvHeader = (EFI_FIRMWARE_VOLUME_HEADER *) Buffer;\r
+    //\r
+    // Get FvHeader alignment\r
+    //\r
     FvAlignment = 1 << ((FvHeader->Attributes & EFI_FVB2_ALIGNMENT) >> 16);\r
     //\r
-    // FvAlignment must be more than 8 bytes required by FvHeader structure.\r
+    // FvAlignment must be greater than or equal to 8 bytes of the minimum FFS alignment value. \r
     //\r
     if (FvAlignment < 8) {\r
       FvAlignment = 8;\r