Revision: 18872
          http://sourceforge.net/p/edk2/code/18872
Author:   vanjeff
Date:     2015-11-18 08:06:21 +0000 (Wed, 18 Nov 2015)
Log Message:
-----------
MdeModulePkg PeiCore: PEI dispatcher need retry to process NOT_DISPATCHED FV

A corner case like below will cause a NOT_DISPATCHED FV has no opportunity to
be dispatched.
  1. FV_RECOVERY has SecCore, PeiCore and some other PEI modules, a module will
    report FVMAIN_COMPACT and FV_RECOVERY2 in sequence.
  2. FVMAIN_COMPACT has a FV image file with GUIDED FV image section in it.
  3. FV_RECOVERY2 has DxeIpl and other PEI modules, the DxeIpl will install
     SectionExtractionPpi
  If ALL the PEIMs in FV_RECOVERY and FV_RECOVERY2 have DEPEX satisfied and
  executed in one loop, PeimNeedingDispatch will be always FALSE, FVMAIN_COMPACT
  will have no opportunity to be decompressed and dispatched as DxeIpl executes
  after the first processing to FVMAIN_COMPACT.

The patch is to set PeimNeedingDispatch to TRUE when ProcessFvFile() not 
successfully,
then the NOT_DISPATCHED FV could have another opportunity to be processed.

(Sync patch r18781 from main trunk.)

Cc: Liming Gao <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <[email protected]>
Reviewed-by: Eugene Cohen <[email protected]>
Reviewed-by: Liming Gao <[email protected]>

Revision Links:
--------------
    http://sourceforge.net/p/edk2/code/18781

Modified Paths:
--------------
    branches/UDK2015/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c

Modified: branches/UDK2015/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
===================================================================
--- branches/UDK2015/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c      
2015-11-18 08:05:27 UTC (rev 18871)
+++ branches/UDK2015/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c      
2015-11-18 08:06:21 UTC (rev 18872)
@@ -1056,7 +1056,7 @@
             ASSERT_EFI_ERROR (Status);
             if (FvFileInfo.FileType == EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE) {
               //
-              // For Fv type file, Produce new FV PPI and FV hob
+              // For Fv type file, Produce new FvInfo PPI and FV hob
               //
               Status = ProcessFvFile (Private, &Private->Fv[FvCount], 
PeimFileHandle);
               if (Status == EFI_SUCCESS) {
@@ -1065,6 +1065,13 @@
                 //
                 Private->Fv[FvCount].PeimState[PeimCount]++;
                 Private->PeimDispatchOnThisPass = TRUE;
+              } else {
+                //
+                // The related GuidedSectionExtraction/Decompress PPI for the
+                // encapsulated FV image section may be installed in the rest
+                // of this do-while loop, so need to make another pass.
+                //
+                Private->PeimNeedingDispatch = TRUE;
               }
             } else {
               //
@@ -1192,11 +1199,11 @@
     Private->CurrentPeimFvCount = 0;
 
     //
-    // PeimNeedingDispatch being TRUE means we found a PEIM that did not get
+    // PeimNeedingDispatch being TRUE means we found a PEIM/FV that did not get
     //  dispatched. So we need to make another pass
     //
-    // PeimDispatchOnThisPass being TRUE means we dispatched a PEIM on this
-    //  pass. If we did not dispatch a PEIM there is no point in trying again
+    // PeimDispatchOnThisPass being TRUE means we dispatched a PEIM/FV on this
+    //  pass. If we did not dispatch a PEIM/FV there is no point in trying 
again
     //  as it will fail the next time too (nothing has changed).
     //
   } while (Private->PeimNeedingDispatch && Private->PeimDispatchOnThisPass);


------------------------------------------------------------------------------
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to