]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c
Use TmpStr as a backup, as StrCpy in BaseLib does not handle copy of two strings
[mirror_edk2.git] / MdeModulePkg / Core / Dxe / Dispatcher / Dispatcher.c
index 064ea1190e8509e76954c54b464008b2492411aa..27f18326e02047b0d1c3fa94c730c6cdd53f28eb 100644 (file)
@@ -76,7 +76,7 @@ VOID            *mFwVolEventRegistration;
 //\r
 // List of file types supported by dispatcher\r
 //\r
-STATIC EFI_FV_FILETYPE mDxeFileTypes[] = { \r
+EFI_FV_FILETYPE mDxeFileTypes[] = { \r
   EFI_FV_FILETYPE_DRIVER, \r
   EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER, \r
   EFI_FV_FILETYPE_DXE_CORE,\r
@@ -135,7 +135,7 @@ CoreFwVolEventProtocolNotify (
   );\r
 \r
 /**\r
-  Convert FvHandle and DriverName into an EFI device path\r
+  Convert FvHandle and DriverName into an EFI device path.\r
 \r
   @param  Fv                    Fv protocol, needed to read Depex info out of \r
                                 FLASH. \r
@@ -341,7 +341,7 @@ CoreSchedule (
 \r
 \r
 /**\r
-  Convert a driver from the Untrused back to the Scheduled state\r
+  Convert a driver from the Untrused back to the Scheduled state.\r
 \r
   @param  FirmwareVolumeHandle  The handle of the Firmware Volume that contains \r
                                 the firmware  file specified by DriverName. \r
@@ -396,8 +396,6 @@ CoreTrust (
   will be called, and when the Bds() exits the Dispatcher will be called\r
   again.\r
 \r
-  NONE\r
-\r
   @retval EFI_ALREADY_STARTED   The DXE Dispatcher is already running \r
   @retval EFI_NOT_FOUND         No DXE Drivers were dispatched \r
   @retval EFI_SUCCESS           One or more DXE Drivers were dispatched \r
@@ -604,8 +602,7 @@ CoreInsertOnScheduledQueueWhileProcessingBeforeAndAfter (
   @param  FvHandle              The handle of a FV that's being tested \r
 \r
   @retval TRUE                  Fv protocol on FvHandle has been processed \r
-  @retval FALSE                 Fv protocol on FvHandle has not yet been \r
-                                processed\r
+  @retval FALSE                 Fv protocol on FvHandle has not yet been processed\r
 \r
 **/\r
 BOOLEAN\r
@@ -702,7 +699,6 @@ CoreFvToDevicePath (
 \r
 \r
 \r
-\r
 /**\r
   Add an entry to the mDiscoveredList. Allocate memory to store the DriverEntry,\r
   and initilize any state variables. Read the Depex from the FV and store it\r
@@ -741,7 +737,7 @@ CoreAddToDriverList (
   ASSERT (DriverEntry != NULL);\r
 \r
   DriverEntry->Signature        = EFI_CORE_DRIVER_ENTRY_SIGNATURE;\r
-  CopyMem (&DriverEntry->FileName, DriverName, sizeof (EFI_GUID));\r
+  CopyGuid (&DriverEntry->FileName, DriverName);\r
   DriverEntry->FvHandle         = FvHandle;\r
   DriverEntry->Fv               = Fv;\r
   DriverEntry->FvFileDevicePath = CoreFvToDevicePath (Fv, FvHandle, DriverName);\r
@@ -823,21 +819,21 @@ CoreProcessFvImageFile (
   //\r
   // Read the first (and only the first) firmware volume section\r
   //\r
-  SectionType = EFI_SECTION_FIRMWARE_VOLUME_IMAGE;\r
-  FvHeader    = NULL;\r
-  FvAlignment = 0;\r
-  Buffer      = NULL;\r
-  BufferSize  = 0;\r
+  SectionType   = EFI_SECTION_FIRMWARE_VOLUME_IMAGE;\r
+  FvHeader      = NULL;\r
+  FvAlignment   = 0;\r
+  Buffer        = NULL;\r
+  BufferSize    = 0;\r
   AlignedBuffer = NULL;\r
   Status = Fv->ReadSection (\r
-                Fv, \r
-                DriverName, \r
-                SectionType, \r
-                0, \r
-                &Buffer, \r
-                &BufferSize,\r
-                &AuthenticationStatus\r
-                );\r
+                 Fv, \r
+                 DriverName, \r
+                 SectionType, \r
+                 0, \r
+                 &Buffer, \r
+                 &BufferSize,\r
+                 &AuthenticationStatus\r
+                 );\r
   if (!EFI_ERROR (Status)) {\r
     //\r
     // FvImage should be at its required alignment.\r
@@ -850,6 +846,9 @@ CoreProcessFvImageFile (
     if (FvAlignment < 8) {\r
       FvAlignment = 8;\r
     }\r
+    //\r
+    // Allocate the aligned buffer for the FvImage.\r
+    //\r
     AlignedBuffer = AllocateAlignedPages (EFI_SIZE_TO_PAGES (BufferSize), (UINTN) FvAlignment);\r
     if (AlignedBuffer == NULL) {\r
       Status = EFI_OUT_OF_RESOURCES;\r
@@ -937,12 +936,12 @@ CoreFwVolEventProtocolNotify (
   while (TRUE) {\r
     BufferSize = sizeof (EFI_HANDLE);\r
     Status = CoreLocateHandle (\r
-                    ByRegisterNotify,\r
-                    NULL,\r
-                    mFwVolEventRegistration,\r
-                    &BufferSize,\r
-                    &FvHandle\r
-                    );\r
+               ByRegisterNotify,\r
+               NULL,\r
+               mFwVolEventRegistration,\r
+               &BufferSize,\r
+               &FvHandle\r
+               );\r
     if (EFI_ERROR (Status)) {\r
       //\r
       // If no more notification events exit\r
@@ -971,7 +970,6 @@ CoreFwVolEventProtocolNotify (
     //\r
     FvIsBeingProcesssed (FvHandle);\r
 \r
-\r
     Status = CoreHandleProtocol (FvHandle, &gEfiFirmwareVolume2ProtocolGuid, (VOID **)&Fv);\r
     if (EFI_ERROR (Status)) {\r
       //\r
@@ -1014,7 +1012,7 @@ CoreFwVolEventProtocolNotify (
     //  EFI_FV_FILETYPE_DXE_CORE is processed to produce a Loaded Image protocol for the core\r
     //  EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE is processed to create a Fvb\r
     //\r
-    for (Index = 0; Index < sizeof (mDxeFileTypes)/sizeof (EFI_FV_FILETYPE); Index++) {\r
+    for (Index = 0; Index < sizeof (mDxeFileTypes) / sizeof (EFI_FV_FILETYPE); Index++) {\r
       //\r
       // Initialize the search key\r
       //\r
@@ -1127,7 +1125,7 @@ CoreFwVolEventProtocolNotify (
 \r
 /**\r
   Initialize the dispatcher. Initialize the notification function that runs when\r
-  a FV protocol is added to the system.\r
+  an FV2 protocol is added to the system.\r
 \r
 **/\r
 VOID\r