]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg PeiCore: PEI dispatcher need retry to process NOT_DISPATCHED FV
authorStar Zeng <star.zeng@intel.com>
Fri, 13 Nov 2015 02:43:37 +0000 (02:43 +0000)
committerlzeng14 <lzeng14@Edk2>
Fri, 13 Nov 2015 02:43:37 +0000 (02:43 +0000)
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.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Eugene Cohen <eugene@hp.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18781 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c

index 7480b662c579cbb86a0c915736f5d38480566ea7..e7e795d123d6caa9ff1881f00b99aa75c1dcaf4e 100644 (file)
@@ -1056,7 +1056,7 @@ PeiDispatcher (
             ASSERT_EFI_ERROR (Status);\r
             if (FvFileInfo.FileType == EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE) {\r
               //\r
-              // For Fv type file, Produce new FV PPI and FV hob\r
+              // For Fv type file, Produce new FvInfo PPI and FV hob\r
               //\r
               Status = ProcessFvFile (Private, &Private->Fv[FvCount], PeimFileHandle);\r
               if (Status == EFI_SUCCESS) {\r
@@ -1065,6 +1065,13 @@ PeiDispatcher (
                 //\r
                 Private->Fv[FvCount].PeimState[PeimCount]++;\r
                 Private->PeimDispatchOnThisPass = TRUE;\r
+              } else {\r
+                //\r
+                // The related GuidedSectionExtraction/Decompress PPI for the\r
+                // encapsulated FV image section may be installed in the rest\r
+                // of this do-while loop, so need to make another pass.\r
+                //\r
+                Private->PeimNeedingDispatch = TRUE;\r
               }\r
             } else {\r
               //\r
@@ -1192,11 +1199,11 @@ PeiDispatcher (
     Private->CurrentPeimFvCount = 0;\r
 \r
     //\r
-    // PeimNeedingDispatch being TRUE means we found a PEIM that did not get\r
+    // PeimNeedingDispatch being TRUE means we found a PEIM/FV that did not get\r
     //  dispatched. So we need to make another pass\r
     //\r
-    // PeimDispatchOnThisPass being TRUE means we dispatched a PEIM on this\r
-    //  pass. If we did not dispatch a PEIM there is no point in trying again\r
+    // PeimDispatchOnThisPass being TRUE means we dispatched a PEIM/FV on this\r
+    //  pass. If we did not dispatch a PEIM/FV there is no point in trying again\r
     //  as it will fail the next time too (nothing has changed).\r
     //\r
   } while (Private->PeimNeedingDispatch && Private->PeimDispatchOnThisPass);\r