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
This commit is contained in:
Liming Gao 2013-12-17 06:21:33 +00:00 committed by lgao4
parent 98c4caa1e9
commit 9b8e61be26
1 changed files with 10 additions and 6 deletions

View File

@ -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;