summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Core/Pei
diff options
context:
space:
mode:
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2007-12-06 09:52:27 +0000
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2007-12-06 09:52:27 +0000
commit288f9b382445a50278155f703ccce9a0293fceb5 (patch)
treef1e3aef0dd88a58849b443a90b5ac8c6ac496a13 /MdeModulePkg/Core/Pei
parent6ee65722c769660e29c9ec524c79a6d7f9825d2b (diff)
downloadedk2-288f9b382445a50278155f703ccce9a0293fceb5.zip
edk2-288f9b382445a50278155f703ccce9a0293fceb5.tar.gz
edk2-288f9b382445a50278155f703ccce9a0293fceb5.tar.bz2
Enable PeiCore to dispatch the encapsulated fv images with depex expression. This feature can process the different fv images in the different boot path, which is useful for boot performance and image size.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4366 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Core/Pei')
-rw-r--r--MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c174
-rw-r--r--MdeModulePkg/Core/Pei/FwVol/FwVol.c217
-rw-r--r--MdeModulePkg/Core/Pei/Image/Image.c2
-rw-r--r--MdeModulePkg/Core/Pei/PeiMain.h30
-rw-r--r--MdeModulePkg/Core/Pei/PeiMain.inf4
5 files changed, 339 insertions, 88 deletions
diff --git a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c b/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
index 164c2c8..5a140ed 100644
--- a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
+++ b/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
@@ -30,7 +30,6 @@ InvokePeiCore (
VOID *Context2
);
-
VOID
DiscoverPeimsAndOrderWithApriori (
IN PEI_CORE_INSTANCE *Private,
@@ -233,11 +232,13 @@ Returns:
VOID *TopOfStack;
PEI_CORE_PARAMETERS PeiCoreParameters;
EFI_DEVICE_HANDLE_EXTENDED_DATA ExtendedData;
+ EFI_FV_FILE_INFO FvFileInfo;
PeiServices = &Private->PS;
PeimEntryPoint = NULL;
PeimFileHandle = NULL;
+ EntryPoint = 0;
if ((Private->PeiMemoryInstalled) && (Private->HobList.HandoffInformationTable->BootMode != BOOT_ON_S3_RESUME)) {
//
@@ -327,16 +328,28 @@ Returns:
if (!DepexSatisfied (Private, PeimFileHandle, PeimCount)) {
PeimNeedingDispatch = TRUE;
} else {
- Status = PeiLoadImage (
- PeiServices,
- PeimFileHandle,
- &EntryPoint,
- &AuthenticationState
- );
+ Status = PeiFfsGetFileInfo (PeimFileHandle, &FvFileInfo);
+ ASSERT_EFI_ERROR (Status);
+ if (FvFileInfo.FileType == EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE) {
+ //
+ // For Fv type file, Produce new FV PPI and FV hob
+ //
+ Status = ProcessFvFile (PeiServices, PeimFileHandle, &AuthenticationState);
+ } else {
+ //
+ // For PEIM driver, Load its entry point
+ //
+ Status = PeiLoadImage (
+ PeiServices,
+ PeimFileHandle,
+ &EntryPoint,
+ &AuthenticationState
+ );
+ }
+
if ((Status == EFI_SUCCESS)) {
//
- // The PEIM has its dependencies satisfied, and its entry point
- // has been found, so invoke it.
+ // The PEIM has its dependencies satisfied, and is processed.
//
PERF_START (0, "PEIM", NULL, 0);
@@ -355,12 +368,17 @@ Returns:
// PEIM_STATE_NOT_DISPATCHED move to PEIM_STATE_DISPATCHED
//
Private->Fv[FvCount].PeimState[PeimCount]++;
-
+
+ if (FvFileInfo.FileType != EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE) {
+ //
+ // Call the PEIM entry point for PEIM driver
+ //
+ PeimEntryPoint = (EFI_PEIM_ENTRY_POINT)(UINTN)EntryPoint;
+ PeimEntryPoint (PeimFileHandle, PeiServices);
+ }
//
- // Call the PEIM entry point
+ // One module has been dispatched.
//
- PeimEntryPoint = (EFI_PEIM_ENTRY_POINT)(UINTN)EntryPoint;
- PeimEntryPoint (PeimFileHandle, PeiServices);
PeimDispatchOnThisPass = TRUE;
}
@@ -572,8 +590,8 @@ Returns:
--*/
{
- EFI_STATUS Status;
- VOID *DepexData;
+ EFI_STATUS Status;
+ VOID *DepexData;
if (PeimCount < Private->AprioriCount) {
//
@@ -581,8 +599,16 @@ Returns:
//
return TRUE;
}
+
+ //
+ // Depex section not in the encapsulated section.
+ //
+ Status = PeiServicesFfsFindSectionData (
+ EFI_SECTION_PEI_DEPEX,
+ FileHandle,
+ (VOID **)&DepexData
+ );
- Status = PeiServicesFfsFindSectionData (EFI_SECTION_PEI_DEPEX, FileHandle, (VOID **) &DepexData);
if (EFI_ERROR (Status)) {
//
// If there is no DEPEX, assume the module can be executed
@@ -675,3 +701,119 @@ InvokePeiCore (
ASSERT (FALSE);
CpuDeadLoop ();
}
+
+/**
+ Get Fv image from the FV type file, then install FV INFO ppi, Build FV hob.
+
+ @param PeiServices Pointer to the PEI Core Services Table.
+ @param FileHandle File handle of a Fv type file.
+ @param AuthenticationState Pointer to attestation authentication state of image.
+
+
+ @retval EFI_NOT_FOUND FV image can't be found.
+ @retval EFI_SUCCESS Successfully to process it.
+
+**/
+EFI_STATUS
+ProcessFvFile (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_FILE_HANDLE FvFileHandle,
+ OUT UINT32 *AuthenticationState
+ )
+{
+ EFI_STATUS Status;
+ EFI_PEI_FV_HANDLE FvImageHandle;
+ EFI_FV_INFO FvImageInfo;
+ UINT32 FvAlignment;
+ VOID *FvBuffer;
+ EFI_PEI_HOB_POINTERS HobFv2;
+
+ FvBuffer = NULL;
+ *AuthenticationState = 0;
+
+ //
+ // Check if this EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE file has already
+ // been extracted.
+ //
+ HobFv2.Raw = GetHobList ();
+ while ((HobFv2.Raw = GetNextHob (EFI_HOB_TYPE_FV2, HobFv2.Raw)) != NULL) {
+ if (CompareGuid (&(((EFI_FFS_FILE_HEADER *)FvFileHandle)->Name), &HobFv2.FirmwareVolume2->FileName)) {
+ //
+ // this FILE has been dispatched, it will not be dispatched again.
+ //
+ return EFI_SUCCESS;
+ }
+ HobFv2.Raw = GET_NEXT_HOB (HobFv2);
+ }
+
+ //
+ // Find FvImage in FvFile
+ //
+ Status = PeiFfsFindSectionData (
+ (CONST EFI_PEI_SERVICES **) PeiServices,
+ EFI_SECTION_FIRMWARE_VOLUME_IMAGE,
+ FvFileHandle,
+ (VOID **)&FvImageHandle
+ );
+
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ //
+ // Collect FvImage Info.
+ //
+ Status = PeiFfsGetVolumeInfo (FvImageHandle, &FvImageInfo);
+ ASSERT_EFI_ERROR (Status);
+ //
+ // FvAlignment must be more than 8 bytes required by FvHeader structure.
+ //
+ FvAlignment = 1 << ((FvImageInfo.FvAttributes & EFI_FVB2_ALIGNMENT) >> 16);
+ if (FvAlignment < 8) {
+ FvAlignment = 8;
+ }
+ //
+ // Check FvImage
+ //
+ if ((UINTN) FvImageInfo.FvStart % FvAlignment != 0) {
+ FvBuffer = AllocateAlignedPages (EFI_SIZE_TO_PAGES ((UINT32) FvImageInfo.FvSize), FvAlignment);
+ if (FvBuffer == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ CopyMem (FvBuffer, FvImageInfo.FvStart, (UINTN) FvImageInfo.FvSize);
+ //
+ // Update FvImageInfo after reload FvImage to new aligned memory
+ //
+ PeiFfsGetVolumeInfo ((EFI_PEI_FV_HANDLE) FvBuffer, &FvImageInfo);
+ }
+
+ //
+ // Install FvPpi and Build FvHob
+ //
+ PiLibInstallFvInfoPpi (
+ NULL,
+ FvImageInfo.FvStart,
+ (UINT32) FvImageInfo.FvSize,
+ &(FvImageInfo.FvName),
+ &(((EFI_FFS_FILE_HEADER*)FvFileHandle)->Name)
+ );
+
+ //
+ // Inform HOB consumer phase, i.e. DXE core, the existance of this FV
+ //
+ BuildFvHob (
+ (EFI_PHYSICAL_ADDRESS) (UINTN) FvImageInfo.FvStart,
+ FvImageInfo.FvSize
+ );
+ //
+ // Makes the encapsulated volume show up in DXE phase to skip processing of
+ // encapsulated file again.
+ //
+ BuildFv2Hob (
+ (EFI_PHYSICAL_ADDRESS) (UINTN) FvImageInfo.FvStart,
+ FvImageInfo.FvSize,
+ &FvImageInfo.FvName,
+ &(((EFI_FFS_FILE_HEADER *)FvFileHandle)->Name)
+ );
+
+ return EFI_SUCCESS;
+}
diff --git a/MdeModulePkg/Core/Pei/FwVol/FwVol.c b/MdeModulePkg/Core/Pei/FwVol/FwVol.c
index 57b45d0..621fb16 100644
--- a/MdeModulePkg/Core/Pei/FwVol/FwVol.c
+++ b/MdeModulePkg/Core/Pei/FwVol/FwVol.c
@@ -258,7 +258,8 @@ Returns:
}
} else if (SearchType == PEI_CORE_INTERNAL_FFS_FILE_DISPATCH_TYPE) {
if ((FfsFileHeader->Type == EFI_FV_FILETYPE_PEIM) ||
- (FfsFileHeader->Type == EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER)) {
+ (FfsFileHeader->Type == EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER) ||
+ (FfsFileHeader->Type == EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE)) {
*FileHeader = FfsFileHeader;
return EFI_SUCCESS;
@@ -366,8 +367,15 @@ Returns:
UINT8 FvCount;
EFI_PEI_FIRMWARE_VOLUME_INFO_PPI *Fv;
PEI_CORE_INSTANCE *PrivateData;
+ EFI_PEI_FILE_HANDLE FileHandle;
+ VOID *DepexData;
+ UINT32 AuthenticationStatus;
+ EFI_STATUS Status;
- PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS (PeiServices);
+ FileHandle = NULL;
+ DepexData = NULL;
+ Status = EFI_SUCCESS;
+ PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS (PeiServices);
if (PrivateData->FvCount >= FixedPcdGet32 (PcdPeiCoreMaxFvSupported)) {
ASSERT (FALSE);
@@ -375,19 +383,53 @@ Returns:
Fv = (EFI_PEI_FIRMWARE_VOLUME_INFO_PPI *)Ppi;
- if (CompareGuid (&Fv->FvFormat, &gEfiFirmwareFileSystem2Guid)) {
- for (FvCount = 0; FvCount < PrivateData->FvCount; FvCount ++) {
- if ((UINTN)PrivateData->Fv[FvCount].FvHeader == (UINTN)Fv->FvInfo) {
- return EFI_SUCCESS;
- }
- }
+ if (CompareGuid (&Fv->FvFormat, &gEfiFirmwareFileSystem2Guid)) {
+ for (FvCount = 0; FvCount < PrivateData->FvCount; FvCount ++) {
+ if ((UINTN)PrivateData->Fv[FvCount].FvHeader == (UINTN)Fv->FvInfo) {
+ return EFI_SUCCESS;
+ }
+ }
PrivateData->Fv[PrivateData->FvCount++].FvHeader = (EFI_FIRMWARE_VOLUME_HEADER*)Fv->FvInfo;
- }
- //
- // Allways add to the All list
- //
- PrivateData->AllFv[PrivateData->AllFvCount++] = (EFI_PEI_FV_HANDLE)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%10p and size is 0x%08x\n", PrivateData->AllFvCount, (VOID *) Fv->FvInfo, Fv->FvInfoSize));
+ //
+ // Preprocess all FV type files in this new FileSystem2 Fv image
+ //
+ do {
+ Status = PeiFindFileEx (
+ (EFI_PEI_FV_HANDLE)Fv->FvInfo,
+ NULL,
+ EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE,
+ &FileHandle,
+ NULL
+ );
+ if (!EFI_ERROR (Status)) {
+ Status = PeiFfsFindSectionData (
+ (CONST EFI_PEI_SERVICES **) PeiServices,
+ EFI_SECTION_PEI_DEPEX,
+ FileHandle,
+ (VOID **)&DepexData
+ );
+ if (!EFI_ERROR (Status)) {
+ if (!PeimDispatchReadiness (PeiServices, DepexData)) {
+ //
+ // Dependency is not satisfied.
+ //
+ continue;
+ }
+ }
+ //
+ // Process FvFile to install FvInfo ppi and build FvHob
+ //
+ ProcessFvFile (PeiServices, FileHandle, &AuthenticationStatus);
+ }
+ } while (FileHandle != NULL);
+ }
return EFI_SUCCESS;
}
@@ -398,25 +440,21 @@ PeiFfsProcessSection (
IN EFI_SECTION_TYPE SectionType,
IN EFI_COMMON_SECTION_HEADER *Section,
IN UINTN SectionSize,
- OUT VOID **OutputBuffer,
- OUT UINTN *OutputSize,
- OUT UINT32 *Authentication
+ OUT VOID **OutputBuffer
)
/*++
Routine Description:
Go through the file to search SectionType section,
- when meeting an encapsuled section, search recursively.
+ when meeting an encapsuled section.
Arguments:
- PeiServices - Pointer to the PEI Core Services Table.
+ PeiServices - General purpose services available to every PEIM.
SearchType - Filter to find only section of this type.
Section - From where to search.
SectionSize - The file size to search.
OutputBuffer - Pointer to the section to search.
- OutputSize - The size of the section to search.
- Authentication - Authenticate the section.
Returns:
EFI_STATUS
@@ -426,58 +464,95 @@ Returns:
EFI_STATUS Status;
UINT32 SectionLength;
UINT32 ParsedLength;
- EFI_GUID_DEFINED_SECTION *GuidSection;
EFI_PEI_GUIDED_SECTION_EXTRACTION_PPI *GuidSectionPpi;
- EFI_COMPRESSION_SECTION *CompressionSection;
EFI_PEI_DECOMPRESS_PPI *DecompressPpi;
VOID *PpiOutput;
UINTN PpiOutputSize;
+ UINTN Index;
+ UINT32 Authentication;
+ PEI_CORE_INSTANCE *PrivateData;
+ PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS (PeiServices);
*OutputBuffer = NULL;
- ParsedLength = 0;
+ ParsedLength = 0;
+ Index = 0;
+ Status = EFI_NOT_FOUND;
+ PpiOutput = NULL;
+ PpiOutputSize = 0;
while (ParsedLength < SectionSize) {
if (Section->Type == SectionType) {
*OutputBuffer = (VOID *)(Section + 1);
return EFI_SUCCESS;
- } else if (Section->Type == EFI_SECTION_GUID_DEFINED) {
- GuidSection = (EFI_GUID_DEFINED_SECTION *)Section;
- Status = PeiServicesLocatePpi (&GuidSection->SectionDefinitionGuid, 0, NULL, (VOID **) &GuidSectionPpi);
- if (!EFI_ERROR (Status)) {
- Status = GuidSectionPpi->ExtractSection (
- GuidSectionPpi,
- Section,
- &PpiOutput,
- &PpiOutputSize,
- Authentication
- );
- if (!EFI_ERROR (Status)) {
+ } else if ((Section->Type == EFI_SECTION_GUID_DEFINED) || (Section->Type == EFI_SECTION_COMPRESSION)) {
+ //
+ // Check the encapsulated section is extracted into the cache data.
+ //
+ for (Index = 0; Index < PrivateData->CacheSection.AllSectionCount; Index ++) {
+ if (Section == PrivateData->CacheSection.Section[Index]) {
+ PpiOutput = PrivateData->CacheSection.SectionData[Index];
+ PpiOutputSize = PrivateData->CacheSection.SectionSize[Index];
+ //
+ // Search section directly from the cache data.
+ //
return PeiFfsProcessSection (
PeiServices,
SectionType,
PpiOutput,
PpiOutputSize,
- OutputBuffer,
- OutputSize,
- Authentication
+ OutputBuffer
);
}
}
- } else if (Section->Type == EFI_SECTION_COMPRESSION) {
- CompressionSection = (EFI_COMPRESSION_SECTION *)Section;
- Status = PeiServicesLocatePpi (&gEfiPeiDecompressPpiGuid, 0, NULL, (VOID **) &DecompressPpi);
- if (!EFI_ERROR (Status)) {
- Status = DecompressPpi->Decompress (
- DecompressPpi,
- CompressionSection,
- &PpiOutput,
- &PpiOutputSize
- );
+
+ Status = EFI_NOT_FOUND;
+ if (Section->Type == EFI_SECTION_GUID_DEFINED) {
+ Status = PeiServicesLocatePpi (
+ &((EFI_GUID_DEFINED_SECTION *)Section)->SectionDefinitionGuid,
+ 0,
+ NULL,
+ (VOID **) &GuidSectionPpi
+ );
if (!EFI_ERROR (Status)) {
- return PeiFfsProcessSection (
- PeiServices, SectionType, PpiOutput, PpiOutputSize, OutputBuffer, OutputSize, Authentication
- );
+ Status = GuidSectionPpi->ExtractSection (
+ GuidSectionPpi,
+ Section,
+ &PpiOutput,
+ &PpiOutputSize,
+ &Authentication
+ );
+ }
+ } else if (Section->Type == EFI_SECTION_COMPRESSION) {
+ Status = PeiServicesLocatePpi (&gEfiPeiDecompressPpiGuid, 0, NULL, (VOID **) &DecompressPpi);
+ if (!EFI_ERROR (Status)) {
+ Status = DecompressPpi->Decompress (
+ DecompressPpi,
+ (CONST EFI_COMPRESSION_SECTION*) Section,
+ &PpiOutput,
+ &PpiOutputSize
+ );
}
}
+
+ if (!EFI_ERROR (Status)) {
+ //
+ // Update cache section data.
+ //
+ if (PrivateData->CacheSection.AllSectionCount < CACHE_SETION_MAX_NUMBER) {
+ PrivateData->CacheSection.AllSectionCount ++;
+ }
+ PrivateData->CacheSection.Section [PrivateData->CacheSection.SectionIndex] = Section;
+ PrivateData->CacheSection.SectionData [PrivateData->CacheSection.SectionIndex] = PpiOutput;
+ PrivateData->CacheSection.SectionSize [PrivateData->CacheSection.SectionIndex] = PpiOutputSize;
+ PrivateData->CacheSection.SectionIndex = (PrivateData->CacheSection.SectionIndex + 1)%CACHE_SETION_MAX_NUMBER;
+
+ return PeiFfsProcessSection (
+ PeiServices,
+ SectionType,
+ PpiOutput,
+ PpiOutputSize,
+ OutputBuffer
+ );
+ }
}
//
@@ -526,9 +601,6 @@ Returns:
EFI_FFS_FILE_HEADER *FfsFileHeader;
UINT32 FileSize;
EFI_COMMON_SECTION_HEADER *Section;
- UINTN OutputSize;
- UINT32 AuthenticationStatus;
-
FfsFileHeader = (EFI_FFS_FILE_HEADER *)(FileHandle);
@@ -542,13 +614,11 @@ Returns:
FileSize -= sizeof (EFI_FFS_FILE_HEADER);
return PeiFfsProcessSection (
- PeiServices,
+ PeiServices,
SectionType,
Section,
FileSize,
- SectionData,
- &OutputSize,
- &AuthenticationStatus
+ SectionData
);
}
@@ -601,7 +671,7 @@ PeiFvFindNextVolume (
Routine Description:
- Return the BFV location
+ Return the firmware volumes.
BugBug -- Move this to the location of this code to where the
other FV and FFS support code lives.
@@ -761,21 +831,32 @@ Returns:
--*/
{
- EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader;
+ EFI_FIRMWARE_VOLUME_HEADER FwVolHeader;
EFI_FIRMWARE_VOLUME_EXT_HEADER *FwVolExHeaderInfo;
if (VolumeInfo == NULL) {
return EFI_INVALID_PARAMETER;
}
+
+ //
+ // VolumeHandle may not align at 8 byte,
+ // but FvLength is UINT64 type, which requires FvHeader align at least 8 byte.
+ // So, Copy FvHeader into the local FvHeader structure.
+ //
+ CopyMem (&FwVolHeader, VolumeHandle, sizeof (EFI_FIRMWARE_VOLUME_HEADER));
+ //
+ // Check Fv Image Signature
+ //
+ if (FwVolHeader.Signature != EFI_FVH_SIGNATURE) {
+ return EFI_INVALID_PARAMETER;
+ }
+ VolumeInfo->FvAttributes = FwVolHeader.Attributes;
+ VolumeInfo->FvStart = (VOID *) VolumeHandle;
+ VolumeInfo->FvSize = FwVolHeader.FvLength;
+ CopyMem (&VolumeInfo->FvFormat, &FwVolHeader.FileSystemGuid, sizeof(EFI_GUID));
- FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *)(VolumeHandle);
- VolumeInfo->FvAttributes = FwVolHeader->Attributes;
- VolumeInfo->FvStart = FwVolHeader;
- VolumeInfo->FvSize = FwVolHeader->FvLength;
- CopyMem (&VolumeInfo->FvFormat, &FwVolHeader->FileSystemGuid,sizeof(EFI_GUID));
-
- if (FwVolHeader->ExtHeaderOffset != 0) {
- FwVolExHeaderInfo = (EFI_FIRMWARE_VOLUME_EXT_HEADER*)(((UINT8 *)FwVolHeader) + FwVolHeader->ExtHeaderOffset);
+ if (FwVolHeader.ExtHeaderOffset != 0) {
+ FwVolExHeaderInfo = (EFI_FIRMWARE_VOLUME_EXT_HEADER*)(((UINT8 *)VolumeHandle) + FwVolHeader.ExtHeaderOffset);
CopyMem (&VolumeInfo->FvName, &FwVolExHeaderInfo->FvName, sizeof(EFI_GUID));
}
return EFI_SUCCESS;
diff --git a/MdeModulePkg/Core/Pei/Image/Image.c b/MdeModulePkg/Core/Pei/Image/Image.c
index 0c627c1..2c7e584 100644
--- a/MdeModulePkg/Core/Pei/Image/Image.c
+++ b/MdeModulePkg/Core/Pei/Image/Image.c
@@ -241,7 +241,7 @@ Returns:
// When Image has no reloc section, it can't be relocated into memory.
//
if (ImageContext.RelocationsStripped) {
- DEBUG ((EFI_D_ERROR, "The image at 0x%08x without reloc section can't be loaded into memory", (UINTN) Pe32Data));
+ DEBUG ((EFI_D_ERROR, "The image at 0x%08x without reloc section can't be loaded into memory\n", (UINTN) Pe32Data));
return EFI_INVALID_PARAMETER;
}
//
diff --git a/MdeModulePkg/Core/Pei/PeiMain.h b/MdeModulePkg/Core/Pei/PeiMain.h
index 61641b3..84d187e 100644
--- a/MdeModulePkg/Core/Pei/PeiMain.h
+++ b/MdeModulePkg/Core/Pei/PeiMain.h
@@ -53,6 +53,7 @@ Revision History
#include <IndustryStandard/PeImage.h>
#include <Library/PeiServicesTablePointerLib.h>
#include <Library/MemoryAllocationLib.h>
+#include <Library/PeiPiLib.h>
#include <Guid/FirmwareFileSystem2.h>
#include <Guid/AprioriFileName.h>
@@ -98,6 +99,15 @@ typedef struct {
BOOLEAN ScanFv;
} PEI_CORE_FV_HANDLE;
+#define CACHE_SETION_MAX_NUMBER 0x10
+typedef struct {
+ EFI_COMMON_SECTION_HEADER* Section[CACHE_SETION_MAX_NUMBER];
+ VOID* SectionData[CACHE_SETION_MAX_NUMBER];
+ UINTN SectionSize[CACHE_SETION_MAX_NUMBER];
+ UINTN AllSectionCount;
+ UINTN SectionIndex;
+} CACHE_SECTION_DATA;
+
//
// Pei Core private data structure instance
//
@@ -130,6 +140,7 @@ typedef struct{
UINTN SizeOfCacheAsRam;
VOID *MaxTopOfCarHeap;
EFI_PEI_PPI_DESCRIPTOR *XipLoadFile;
+ CACHE_SECTION_DATA CacheSection;
} PEI_CORE_INSTANCE;
//
@@ -1379,4 +1390,23 @@ Returns:
--*/
;
+/**
+ Get Fv image from the FV type file, then install FV INFO ppi, Build FV hob.
+
+ @param PeiServices Pointer to the PEI Core Services Table.
+ @param FileHandle File handle of a Fv type file.
+ @param AuthenticationState Pointer to attestation authentication state of image.
+
+
+ @retval EFI_NOT_FOUND FV image can't be found.
+ @retval EFI_SUCCESS Successfully to process it.
+
+**/
+EFI_STATUS
+ProcessFvFile (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_FILE_HANDLE FvFileHandle,
+ OUT UINT32 *AuthenticationState
+ );
+
#endif
diff --git a/MdeModulePkg/Core/Pei/PeiMain.inf b/MdeModulePkg/Core/Pei/PeiMain.inf
index 360f027..0d58f95 100644
--- a/MdeModulePkg/Core/Pei/PeiMain.inf
+++ b/MdeModulePkg/Core/Pei/PeiMain.inf
@@ -81,6 +81,7 @@
MemoryAllocationLib
CacheMaintenanceLib
PeCoffLib
+ PeiPiLib
[Guids]
gPeiAprioriFileNameGuid
@@ -103,6 +104,3 @@
[FeaturePcd.common]
gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreImageLoaderSearchTeSectionFirst
-
-
-