Revision: 14993
          http://sourceforge.net/p/edk2/code/14993
Author:   lgao4
Date:     2013-12-17 06:21:33 +0000 (Tue, 17 Dec 2013)
Log Message:
-----------
Fix two issues in PeiCore. 
1. HOB address is not 8 byte alignment.
2. FV with the max supported PEIM can?\226?\128?\153t be dispatched. 

Signed-off-by: Liming Gao <[email protected]>
Reviewed-by: Star Zeng <[email protected]>

Modified Paths:
--------------
    trunk/edk2/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c

Modified: trunk/edk2/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
===================================================================
--- trunk/edk2/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c    2013-12-17 
05:00:17 UTC (rev 14992)
+++ trunk/edk2/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c    2013-12-17 
06:21:33 UTC (rev 14993)
@@ -49,7 +49,7 @@
   UINTN                               PeimIndex;
   UINTN                               PeimCount;
   EFI_GUID                            *Guid;
-  EFI_PEI_FILE_HANDLE                 TempFileHandles[FixedPcdGet32 
(PcdPeiCoreMaxPeimPerFv)];
+  EFI_PEI_FILE_HANDLE                 TempFileHandles[FixedPcdGet32 
(PcdPeiCoreMaxPeimPerFv) + 1];
   EFI_GUID                            FileGuid[FixedPcdGet32 
(PcdPeiCoreMaxPeimPerFv)];
   EFI_PEI_FIRMWARE_VOLUME_PPI         *FvPpi;
   EFI_FV_FILE_INFO                    FileInfo;
@@ -75,20 +75,21 @@
   //
   // Go ahead to scan this Fv, and cache FileHandles within it.
   //
-  for (PeimCount = 0; PeimCount < FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv); 
PeimCount++) {
+  Status = EFI_NOT_FOUND;
+  for (PeimCount = 0; PeimCount <= FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv); 
PeimCount++) {
     Status = FvPpi->FindFileByType (FvPpi, 
PEI_CORE_INTERNAL_FFS_FILE_DISPATCH_TYPE, CoreFileHandle->FvHandle, 
&FileHandle);
-    if (Status != EFI_SUCCESS) {
+    if (Status != EFI_SUCCESS || PeimCount == FixedPcdGet32 
(PcdPeiCoreMaxPeimPerFv)) {
       break;
     }
 
     Private->CurrentFvFileHandles[PeimCount] = FileHandle;
   }
-  
+
   //
   // Check whether the count of Peims exceeds the max support PEIMs in a FV 
image
   // If more Peims are required in a FV image, PcdPeiCoreMaxPeimPerFv can be 
set to a larger value in DSC file.
   //
-  ASSERT (PeimCount < FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv));
+  ASSERT ((Status != EFI_SUCCESS) || (PeimCount < FixedPcdGet32 
(PcdPeiCoreMaxPeimPerFv)));
 
   //
   // Get Apriori File handle
@@ -1001,7 +1002,10 @@
                 HoleMemBase   = TopOfNewStack;
                 HoleMemSize   = TemporaryRamSize - PeiTemporaryRamSize - 
TemporaryStackSize;
                 if (HoleMemSize != 0) {
-                  BaseOfNewHeap = BaseOfNewHeap + HoleMemSize;
+                  //
+                  // Make sure HOB List start address is 8 byte alignment.
+                  //
+                  BaseOfNewHeap = ALIGN_VALUE (BaseOfNewHeap + HoleMemSize, 8);
                 }
                 if (BaseOfNewHeap >= (UINTN)SecCoreData->PeiTemporaryRamBase) {
                   Private->HeapOffsetPositive = TRUE;

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to