summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Core
diff options
context:
space:
mode:
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2009-03-05 05:05:57 +0000
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2009-03-05 05:05:57 +0000
commit97b2c9b51469851f2637526b138be5776ac029e8 (patch)
treea3a4a8737290ff57ede8c6ec82ffbc0c28586779 /MdeModulePkg/Core
parent5bb820af594a34f4fa69e609e04a624527f1327d (diff)
downloadedk2-97b2c9b51469851f2637526b138be5776ac029e8.zip
edk2-97b2c9b51469851f2637526b138be5776ac029e8.tar.gz
edk2-97b2c9b51469851f2637526b138be5776ac029e8.tar.bz2
Update PeiCore to handle FvImage with PI FV extension header
Update Capsule PCDs PcdMaxSizePopulateCapsule and PcdMaxSizeNonPopulateCapsule to the flexible PCD type. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7805 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Core')
-rw-r--r--MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c8
-rw-r--r--MdeModulePkg/Core/Pei/FwVol/FwVol.c46
-rw-r--r--MdeModulePkg/Core/Pei/PeiMain.h6
-rw-r--r--MdeModulePkg/Core/Pei/PeiMain.inf2
-rw-r--r--MdeModulePkg/Core/Pei/Ppi/Ppi.c2
5 files changed, 41 insertions, 23 deletions
diff --git a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c b/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
index db1fe4b..9caa890 100644
--- a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
+++ b/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
@@ -85,6 +85,12 @@ DiscoverPeimsAndOrderWithApriori (
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));
Private->AprioriCount = 0;
if (AprioriFileHandle != NULL) {
@@ -377,7 +383,7 @@ PeiDispatcher (
//
// For Fv type file, Produce new FV PPI and FV hob
//
- Status = ProcessFvFile (PeiServices, PeimFileHandle, &AuthenticationState);
+ Status = ProcessFvFile (PeiServices, VolumeHandle, PeimFileHandle, &AuthenticationState);
} else {
//
// For PEIM driver, Load its entry point
diff --git a/MdeModulePkg/Core/Pei/FwVol/FwVol.c b/MdeModulePkg/Core/Pei/FwVol/FwVol.c
index cf1f8d5..d416205 100644
--- a/MdeModulePkg/Core/Pei/FwVol/FwVol.c
+++ b/MdeModulePkg/Core/Pei/FwVol/FwVol.c
@@ -151,7 +151,6 @@ PeiFindFileEx (
EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader;
EFI_FFS_FILE_HEADER **FileHeader;
EFI_FFS_FILE_HEADER *FfsFileHeader;
- EFI_FIRMWARE_VOLUME_EXT_HEADER *FwVolExHeaderInfo;
UINT32 FileLength;
UINT32 FileOccupiedSize;
UINT32 FileOffset;
@@ -176,10 +175,6 @@ PeiFindFileEx (
//
if ((*FileHeader == NULL) || (FileName != NULL)) {
FfsFileHeader = (EFI_FFS_FILE_HEADER *)((UINT8 *)FwVolHeader + FwVolHeader->HeaderLength);
- if (FwVolHeader->ExtHeaderOffset != 0) {
- FwVolExHeaderInfo = (EFI_FIRMWARE_VOLUME_EXT_HEADER *)(((UINT8 *)FwVolHeader) + FwVolHeader->ExtHeaderOffset);
- FfsFileHeader = (EFI_FFS_FILE_HEADER *)(((UINT8 *)FwVolExHeaderInfo) + FwVolExHeaderInfo->ExtHeaderSize);
- }
} else {
//
// Length is 24 bits wide so mask upper 8 bits
@@ -332,11 +327,16 @@ FirmwareVolmeInfoPpiNotifyCallback (
PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS (PeiServices);
if (PrivateData->FvCount >= FixedPcdGet32 (PcdPeiCoreMaxFvSupported)) {
+ DEBUG ((EFI_D_ERROR, "The number of Fv Images (%d) exceed the max supported FVs (%d) in Pei", PrivateData->FvCount + 1, FixedPcdGet32 (PcdPeiCoreMaxFvSupported)));
+ DEBUG ((EFI_D_ERROR, "PcdPeiCoreMaxFvSupported value need be reconfigurated in DSC"));
ASSERT (FALSE);
}
Fv = (EFI_PEI_FIRMWARE_VOLUME_INFO_PPI *)Ppi;
+ //
+ // Only add FileSystem2 Fv to Fv list
+ //
if (CompareGuid (&Fv->FvFormat, &gEfiFirmwareFileSystem2Guid)) {
for (FvCount = 0; FvCount < PrivateData->FvCount; FvCount ++) {
if ((UINTN)PrivateData->Fv[FvCount].FvHeader == (UINTN)Fv->FvInfo) {
@@ -352,9 +352,6 @@ FirmwareVolmeInfoPpiNotifyCallback (
PrivateData->Fv[PrivateData->FvCount++].FvHeader = (EFI_FIRMWARE_VOLUME_HEADER*)Fv->FvInfo;
- //
- // Only add FileSystem2 Fv to the All list
- //
PrivateData->AllFv[PrivateData->AllFvCount++] = (EFI_PEI_FV_HANDLE)Fv->FvInfo;
DEBUG ((EFI_D_INFO, "The %dth FvImage start address is 0x%11p and size is 0x%08x\n", (UINT32)PrivateData->AllFvCount, (VOID *) Fv->FvInfo, Fv->FvInfoSize));
@@ -387,7 +384,7 @@ FirmwareVolmeInfoPpiNotifyCallback (
//
// Process FvFile to install FvInfo ppi and build FvHob
//
- ProcessFvFile ((CONST EFI_PEI_SERVICES **) PeiServices, FileHandle, &AuthenticationStatus);
+ ProcessFvFile ((CONST EFI_PEI_SERVICES **) PeiServices, (EFI_PEI_FV_HANDLE)Fv->FvInfo, FileHandle, &AuthenticationStatus);
}
} while (FileHandle != NULL);
}
@@ -809,6 +806,7 @@ PeiFfsGetVolumeInfo (
if (FwVolHeader.Signature != EFI_FVH_SIGNATURE) {
return EFI_INVALID_PARAMETER;
}
+ ZeroMem (VolumeInfo, sizeof (EFI_FV_INFO));
VolumeInfo->FvAttributes = FwVolHeader.Attributes;
VolumeInfo->FvStart = (VOID *) VolumeHandle;
VolumeInfo->FvSize = FwVolHeader.FvLength;
@@ -825,7 +823,8 @@ PeiFfsGetVolumeInfo (
Get Fv image from the FV type file, then install FV INFO ppi, Build FV hob.
@param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
- @param FvFileHandle File handle of a Fv type file.
+ @param ParentFvHandle Fv handle to parent Fv image that contain this Fv image.
+ @param ParentFvFileHandle File handle of a Fv type file that contain this Fv image.
@param AuthenticationState Pointer to attestation authentication state of image.
@@ -838,13 +837,15 @@ PeiFfsGetVolumeInfo (
EFI_STATUS
ProcessFvFile (
IN CONST EFI_PEI_SERVICES **PeiServices,
- IN EFI_PEI_FILE_HANDLE FvFileHandle,
+ IN EFI_PEI_FV_HANDLE ParentFvHandle,
+ IN EFI_PEI_FILE_HANDLE ParentFvFileHandle,
OUT UINT32 *AuthenticationState
)
{
EFI_STATUS Status;
EFI_PEI_FV_HANDLE FvImageHandle;
EFI_FV_INFO FvImageInfo;
+ EFI_FV_INFO ParentFvImageInfo;
UINT32 FvAlignment;
VOID *FvBuffer;
EFI_PEI_HOB_POINTERS HobPtr;
@@ -858,7 +859,7 @@ ProcessFvFile (
//
HobPtr.Raw = GetHobList ();
while ((HobPtr.Raw = GetNextHob (EFI_HOB_TYPE_FV2, HobPtr.Raw)) != NULL) {
- if (CompareGuid (&(((EFI_FFS_FILE_HEADER *)FvFileHandle)->Name), &HobPtr.FirmwareVolume2->FileName)) {
+ if (CompareGuid (&(((EFI_FFS_FILE_HEADER *)ParentFvFileHandle)->Name), &HobPtr.FirmwareVolume2->FileName)) {
//
// this FILE has been dispatched, it will not be dispatched again.
//
@@ -873,14 +874,20 @@ ProcessFvFile (
Status = PeiFfsFindSectionData (
PeiServices,
EFI_SECTION_FIRMWARE_VOLUME_IMAGE,
- FvFileHandle,
+ ParentFvFileHandle,
(VOID **)&FvImageHandle
);
if (EFI_ERROR (Status)) {
return Status;
}
-
+
+ //
+ // Collect Parent FvImage Info.
+ //
+ Status = PeiFfsGetVolumeInfo (ParentFvHandle, &ParentFvImageInfo);
+ ASSERT_EFI_ERROR (Status);
+
//
// Collect FvImage Info.
//
@@ -907,7 +914,8 @@ ProcessFvFile (
//
// Update FvImageInfo after reload FvImage to new aligned memory
//
- PeiFfsGetVolumeInfo ((EFI_PEI_FV_HANDLE) FvBuffer, &FvImageInfo);
+ Status = PeiFfsGetVolumeInfo ((EFI_PEI_FV_HANDLE) FvBuffer, &FvImageInfo);
+ ASSERT_EFI_ERROR (Status);
}
//
@@ -917,8 +925,8 @@ ProcessFvFile (
NULL,
FvImageInfo.FvStart,
(UINT32) FvImageInfo.FvSize,
- &(FvImageInfo.FvName),
- &(((EFI_FFS_FILE_HEADER*)FvFileHandle)->Name)
+ &ParentFvImageInfo.FvName,
+ &(((EFI_FFS_FILE_HEADER*)ParentFvFileHandle)->Name)
);
//
@@ -936,8 +944,8 @@ ProcessFvFile (
BuildFv2Hob (
(EFI_PHYSICAL_ADDRESS) (UINTN) FvImageInfo.FvStart,
FvImageInfo.FvSize,
- &FvImageInfo.FvName,
- &(((EFI_FFS_FILE_HEADER *)FvFileHandle)->Name)
+ &ParentFvImageInfo.FvName,
+ &(((EFI_FFS_FILE_HEADER *)ParentFvFileHandle)->Name)
);
return EFI_SUCCESS;
diff --git a/MdeModulePkg/Core/Pei/PeiMain.h b/MdeModulePkg/Core/Pei/PeiMain.h
index e629b23..453f230 100644
--- a/MdeModulePkg/Core/Pei/PeiMain.h
+++ b/MdeModulePkg/Core/Pei/PeiMain.h
@@ -1006,7 +1006,8 @@ InitializeImageServices (
Get Fv image from the FV type file, then install FV INFO ppi, Build FV hob.
@param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
- @param FvFileHandle File handle of a Fv type file.
+ @param ParentFvHandle Fv handle to parent Fv image that contain this Fv file.
+ @param ParentFvFileHandle File handle of a Fv type file that contain this Fv image.
@param AuthenticationState Pointer to attestation authentication state of image.
If return 0, means pass security checking.
@@ -1017,7 +1018,8 @@ InitializeImageServices (
EFI_STATUS
ProcessFvFile (
IN CONST EFI_PEI_SERVICES **PeiServices,
- IN EFI_PEI_FILE_HANDLE FvFileHandle,
+ IN EFI_PEI_FV_HANDLE ParentFvHandle,
+ IN EFI_PEI_FILE_HANDLE ParentFvFileHandle,
OUT UINT32 *AuthenticationState
);
diff --git a/MdeModulePkg/Core/Pei/PeiMain.inf b/MdeModulePkg/Core/Pei/PeiMain.inf
index 52b0bf2..7a95ce0 100644
--- a/MdeModulePkg/Core/Pei/PeiMain.inf
+++ b/MdeModulePkg/Core/Pei/PeiMain.inf
@@ -88,7 +88,7 @@
gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxFvSupported ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPeimPerFv ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPpiSupported ## CONSUMES
- gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValuePeimDispatch ## CONSUMES
+ gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValuePeimDispatch ## CONSUMES
gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValuePeiCoreEntry ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPeiStackSize ## CONSUMES
diff --git a/MdeModulePkg/Core/Pei/Ppi/Ppi.c b/MdeModulePkg/Core/Pei/Ppi/Ppi.c
index 6feab63..ffed6cf 100644
--- a/MdeModulePkg/Core/Pei/Ppi/Ppi.c
+++ b/MdeModulePkg/Core/Pei/Ppi/Ppi.c
@@ -151,6 +151,7 @@ PeiInstallPpi (
//
// Since PpiData is used for NotifyList and PpiList, max resource
// is reached if the Install reaches the NotifyList
+ // PcdPeiCoreMaxPpiSupported can be set to a larger value in DSC to satisfy more PPI requirement.
//
if (Index == PrivateData->PpiData.NotifyListEnd + 1) {
return EFI_OUT_OF_RESOURCES;
@@ -392,6 +393,7 @@ PeiNotifyPpi (
//
// Since PpiData is used for NotifyList and InstallList, max resource
// is reached if the Install reaches the PpiList
+ // PcdPeiCoreMaxPpiSupported can be set to a larger value in DSC to satisfy more Notify PPIs requirement.
//
if (Index == PrivateData->PpiData.PpiListEnd - 1) {
return EFI_OUT_OF_RESOURCES;