summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLiming Gao <liming.gao@intel.com>2013-12-17 06:21:33 +0000
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2013-12-17 06:21:33 +0000
commit9b8e61be26dd303ffb88785bee63bdd1410b6234 (patch)
treed0984ef9688237982fa9ed31ff0911e2ecb9db20
parent98c4caa1e9504f87bda712f4df03c6817f869658 (diff)
downloadedk2-platforms-9b8e61be26dd303ffb88785bee63bdd1410b6234.tar.xz
Fix two issues in PeiCore.
1. HOB address is not 8 byte alignment. 2. FV with the max supported PEIM can't be dispatched. Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14993 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c b/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
index 96381cd8c0..b5e2a82455 100644
--- a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
+++ b/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
@@ -49,7 +49,7 @@ DiscoverPeimsAndOrderWithApriori (
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 @@ DiscoverPeimsAndOrderWithApriori (
//
// 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 @@ PeiDispatcher (
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;