summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Core/Pei/FwVol/FwVol.c
diff options
context:
space:
mode:
Diffstat (limited to 'MdeModulePkg/Core/Pei/FwVol/FwVol.c')
-rw-r--r--MdeModulePkg/Core/Pei/FwVol/FwVol.c382
1 files changed, 191 insertions, 191 deletions
diff --git a/MdeModulePkg/Core/Pei/FwVol/FwVol.c b/MdeModulePkg/Core/Pei/FwVol/FwVol.c
index 4150b338b2..65c4855497 100644
--- a/MdeModulePkg/Core/Pei/FwVol/FwVol.c
+++ b/MdeModulePkg/Core/Pei/FwVol/FwVol.c
@@ -1,15 +1,15 @@
/** @file
Pei Core Firmware File System service routines.
-
+
Copyright (c) 2015 HP Development Company, L.P.
-Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
@@ -19,12 +19,12 @@ EFI_PEI_NOTIFY_DESCRIPTOR mNotifyOnFvInfoList[] = {
{
EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK,
&gEfiPeiFirmwareVolumeInfoPpiGuid,
- FirmwareVolmeInfoPpiNotifyCallback
+ FirmwareVolmeInfoPpiNotifyCallback
},
{
(EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
&gEfiPeiFirmwareVolumeInfo2PpiGuid,
- FirmwareVolmeInfoPpiNotifyCallback
+ FirmwareVolmeInfoPpiNotifyCallback
}
};
@@ -61,7 +61,7 @@ PEI_FW_VOL_INSTANCE mPeiFfs3FwVol = {
EFI_PEI_FIRMWARE_VOLUME_PPI_REVISION
}
};
-
+
EFI_PEI_PPI_DESCRIPTOR mPeiFfs2FvPpiList = {
(EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
&gEfiFirmwareFileSystem2Guid,
@@ -136,7 +136,7 @@ FfsAttributes2FvFileAttributes (
in the Attributes field.
@param FfsHeader Pointer to FFS File Header.
- @retval EFI_FFS_FILE_STATE File state is set by the highest none zero bit
+ @retval EFI_FFS_FILE_STATE File state is set by the highest none zero bit
in the header State field.
**/
EFI_FFS_FILE_STATE
@@ -153,7 +153,7 @@ GetFileState(
if (ErasePolarity != 0) {
FileState = (EFI_FFS_FILE_STATE)~FileState;
}
-
+
//
// Get file state set by its highest none zero bit.
//
@@ -163,7 +163,7 @@ GetFileState(
}
return HighestBit;
-}
+}
/**
Calculates the checksum of the header of a file.
@@ -206,7 +206,7 @@ CalculateHeaderChecksum (
Find FV handler according to FileHandle in that FV.
@param FileHandle Handle of file image
-
+
@return Pointer to instance of PEI_CORE_FV_HANDLE.
**/
PEI_CORE_FV_HANDLE*
@@ -221,10 +221,10 @@ FileHandleToVolume (
PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS (GetPeiServicesTablePointer ());
BestIndex = PrivateData->FvCount;
-
+
//
// Find the best matched FV image that includes this FileHandle.
- // FV may include the child FV, and they are in the same continuous space.
+ // FV may include the child FV, and they are in the same continuous space.
// If FileHandle is from the child FV, the updated logic can find its matched FV.
//
for (Index = 0; Index < PrivateData->FvCount; Index++) {
@@ -253,8 +253,8 @@ FileHandleToVolume (
FFS volume as defined by SearchType. The search starts from FileHeader inside
the Firmware Volume defined by FwVolHeader.
If SearchType is EFI_FV_FILETYPE_ALL, the first FFS file will return without check its file type.
- If SearchType is PEI_CORE_INTERNAL_FFS_FILE_DISPATCH_TYPE,
- the first PEIM, or COMBINED PEIM or FV file type FFS file will return.
+ If SearchType is PEI_CORE_INTERNAL_FFS_FILE_DISPATCH_TYPE,
+ the first PEIM, or COMBINED PEIM or FV file type FFS file will return.
@param FvHandle Pointer to the FV header of the volume to search
@param FileName File name
@@ -288,7 +288,7 @@ FindFileEx (
UINT8 FileState;
UINT8 DataCheckSum;
BOOLEAN IsFfs3Fv;
-
+
//
// Convert the handle of FV to FV header for memory-mapped firmware volume
//
@@ -303,7 +303,7 @@ FindFileEx (
} else {
ErasePolarity = 0;
}
-
+
//
// If FileHeader is not specified (NULL) or FileName is not NULL,
// start with the first file in the firmware volume. Otherwise,
@@ -336,13 +336,13 @@ FindFileEx (
FileOccupiedSize = GET_OCCUPIED_SIZE (FileLength, 8);
FfsFileHeader = (EFI_FFS_FILE_HEADER *)((UINT8 *)*FileHeader + FileOccupiedSize);
}
-
+
FileOffset = (UINT32) ((UINT8 *)FfsFileHeader - (UINT8 *)FwVolHeader);
ASSERT (FileOffset <= 0xFFFFFFFF);
while (FileOffset < (FvLength - sizeof (EFI_FFS_FILE_HEADER))) {
//
- // Get FileState which is the highest bit of the State
+ // Get FileState which is the highest bit of the State
//
FileState = GetFileState (ErasePolarity, FfsFileHeader);
switch (FileState) {
@@ -360,7 +360,7 @@ FindFileEx (
FfsFileHeader = (EFI_FFS_FILE_HEADER *) ((UINT8 *) FfsFileHeader + sizeof (EFI_FFS_FILE_HEADER));
}
break;
-
+
case EFI_FILE_DATA_VALID:
case EFI_FILE_MARKED_FOR_UPDATE:
if (CalculateHeaderChecksum (FfsFileHeader) != 0) {
@@ -404,29 +404,29 @@ FindFileEx (
return EFI_SUCCESS;
}
} else if (SearchType == PEI_CORE_INTERNAL_FFS_FILE_DISPATCH_TYPE) {
- if ((FfsFileHeader->Type == EFI_FV_FILETYPE_PEIM) ||
+ if ((FfsFileHeader->Type == EFI_FV_FILETYPE_PEIM) ||
(FfsFileHeader->Type == EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER) ||
- (FfsFileHeader->Type == EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE)) {
-
+ (FfsFileHeader->Type == EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE)) {
+
*FileHeader = FfsFileHeader;
return EFI_SUCCESS;
} else if (AprioriFile != NULL) {
if (FfsFileHeader->Type == EFI_FV_FILETYPE_FREEFORM) {
if (CompareGuid (&FfsFileHeader->Name, &gPeiAprioriFileNameGuid)) {
*AprioriFile = FfsFileHeader;
- }
- }
+ }
+ }
}
- } else if (((SearchType == FfsFileHeader->Type) || (SearchType == EFI_FV_FILETYPE_ALL)) &&
- (FfsFileHeader->Type != EFI_FV_FILETYPE_FFS_PAD)) {
+ } else if (((SearchType == FfsFileHeader->Type) || (SearchType == EFI_FV_FILETYPE_ALL)) &&
+ (FfsFileHeader->Type != EFI_FV_FILETYPE_FFS_PAD)) {
*FileHeader = FfsFileHeader;
return EFI_SUCCESS;
}
- FileOffset += FileOccupiedSize;
+ FileOffset += FileOccupiedSize;
FfsFileHeader = (EFI_FFS_FILE_HEADER *)((UINT8 *)FfsFileHeader + FileOccupiedSize);
break;
-
+
case EFI_FILE_DELETED:
if (IS_FFS_FILE2 (FfsFileHeader)) {
if (!IsFfs3Fv) {
@@ -445,11 +445,11 @@ FindFileEx (
default:
*FileHeader = NULL;
return EFI_NOT_FOUND;
- }
+ }
}
-
+
*FileHeader = NULL;
- return EFI_NOT_FOUND;
+ return EFI_NOT_FOUND;
}
/**
@@ -458,7 +458,7 @@ FindFileEx (
@param PrivateData - Pointer to PEI_CORE_INSTANCE.
@param SecCoreData - Pointer to EFI_SEC_PEI_HAND_OFF.
**/
-VOID
+VOID
PeiInitializeFv (
IN PEI_CORE_INSTANCE *PrivateData,
IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData
@@ -468,7 +468,7 @@ PeiInitializeFv (
EFI_PEI_FIRMWARE_VOLUME_PPI *FvPpi;
EFI_PEI_FV_HANDLE FvHandle;
EFI_FIRMWARE_VOLUME_HEADER *BfvHeader;
-
+
//
// Install FV_PPI for FFS2 file system.
//
@@ -480,7 +480,7 @@ PeiInitializeFv (
PeiServicesInstallPpi (&mPeiFfs3FvPpiList);
BfvHeader = (EFI_FIRMWARE_VOLUME_HEADER *)SecCoreData->BootFirmwareVolumeBase;
-
+
//
// The FV_PPI in BFV's format should be installed.
//
@@ -491,7 +491,7 @@ PeiInitializeFv (
(VOID**)&FvPpi
);
ASSERT_EFI_ERROR (Status);
-
+
//
// Get handle of BFV
//
@@ -511,15 +511,15 @@ PeiInitializeFv (
PrivateData->Fv[PrivateData->FvCount].FvHandle = FvHandle;
PrivateData->Fv[PrivateData->FvCount].AuthenticationStatus = 0;
DEBUG ((
- EFI_D_INFO,
- "The %dth FV start address is 0x%11p, size is 0x%08x, handle is 0x%p\n",
- (UINT32) PrivateData->FvCount,
- (VOID *) BfvHeader,
+ EFI_D_INFO,
+ "The %dth FV start address is 0x%11p, size is 0x%08x, handle is 0x%p\n",
+ (UINT32) PrivateData->FvCount,
+ (VOID *) BfvHeader,
(UINT32) BfvHeader->FvLength,
FvHandle
- ));
+ ));
PrivateData->FvCount ++;
-
+
//
// Post a call-back for the FvInfoPPI and FvInfo2PPI services to expose
// additional Fvs to PeiCore.
@@ -528,7 +528,7 @@ PeiInitializeFv (
ASSERT_EFI_ERROR (Status);
}
-
+
/**
Process Firmware Volum Information once FvInfoPPI or FvInfo2PPI install.
The FV Info will be registered into PeiCore private data structure.
@@ -619,7 +619,7 @@ FirmwareVolmeInfoPpiNotifyCallback (
if (PrivateData->Fv[FvIndex].FvHandle == FvHandle) {
if (IsFvInfo2 && (FvInfo2Ppi.AuthenticationStatus != PrivateData->Fv[FvIndex].AuthenticationStatus)) {
PrivateData->Fv[FvIndex].AuthenticationStatus = FvInfo2Ppi.AuthenticationStatus;
- DEBUG ((EFI_D_INFO, "Update AuthenticationStatus of the %dth FV to 0x%x!\n", FvIndex, FvInfo2Ppi.AuthenticationStatus));
+ DEBUG ((EFI_D_INFO, "Update AuthenticationStatus of the %dth FV to 0x%x!\n", FvIndex, FvInfo2Ppi.AuthenticationStatus));
}
DEBUG ((EFI_D_INFO, "The Fv %p has already been processed!\n", FvInfo2Ppi.FvInfo));
return EFI_SUCCESS;
@@ -641,17 +641,17 @@ FirmwareVolmeInfoPpiNotifyCallback (
PrivateData->Fv[PrivateData->FvCount].AuthenticationStatus = FvInfo2Ppi.AuthenticationStatus;
CurFvCount = PrivateData->FvCount;
DEBUG ((
- EFI_D_INFO,
- "The %dth FV start address is 0x%11p, size is 0x%08x, handle is 0x%p\n",
+ EFI_D_INFO,
+ "The %dth FV start address is 0x%11p, size is 0x%08x, handle is 0x%p\n",
(UINT32) CurFvCount,
- (VOID *) FvInfo2Ppi.FvInfo,
+ (VOID *) FvInfo2Ppi.FvInfo,
FvInfo2Ppi.FvInfoSize,
FvHandle
- ));
+ ));
PrivateData->FvCount ++;
//
- // Scan and process the new discoveried FV for EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE
+ // Scan and process the new discoveried FV for EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE
//
FileHandle = NULL;
do {
@@ -676,17 +676,17 @@ FirmwareVolmeInfoPpiNotifyCallback (
continue;
}
}
-
+
DEBUG ((EFI_D_INFO, "Found firmware volume Image File %p in FV[%d] %p\n", FileHandle, CurFvCount, FvHandle));
ProcessFvFile (PrivateData, &PrivateData->Fv[CurFvCount], FileHandle);
}
} while (FileHandle != NULL);
} else {
DEBUG ((EFI_D_ERROR, "Fail to process FV %p because no corresponding EFI_FIRMWARE_VOLUME_PPI is found!\n", FvInfo2Ppi.FvInfo));
-
+
AddUnknownFormatFvInfo (PrivateData, &FvInfo2Ppi);
}
-
+
return EFI_SUCCESS;
}
@@ -699,7 +699,7 @@ FirmwareVolmeInfoPpiNotifyCallback (
@return TRUE The GuidedSectionGuid could be identified, and the pointer to
the Guided Section Extraction Ppi will be returned to *GuidedSectionExtraction.
- @return FALSE The GuidedSectionGuid could not be identified, or
+ @return FALSE The GuidedSectionGuid could not be identified, or
the Guided Section Extraction Ppi has not been installed yet.
**/
@@ -740,10 +740,10 @@ VerifyGuidedSectionGuid (
}
/**
- Go through the file to search SectionType section.
- Search within encapsulation sections (compression and GUIDed) recursively,
+ Go through the file to search SectionType section.
+ Search within encapsulation sections (compression and GUIDed) recursively,
until the match section is found.
-
+
@param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
@param SectionType Filter to find only section of this type.
@param SectionInstance Pointer to the filter to find the specific instance of section.
@@ -862,8 +862,8 @@ ProcessSection (
PeiServices,
SectionType,
SectionInstance,
- PpiOutput,
- PpiOutputSize,
+ PpiOutput,
+ PpiOutputSize,
&TempOutputBuffer,
&TempAuthenticationStatus,
IsFfs3Fv
@@ -946,8 +946,8 @@ ProcessSection (
PeiServices,
SectionType,
SectionInstance,
- PpiOutput,
- PpiOutputSize,
+ PpiOutput,
+ PpiOutputSize,
&TempOutputBuffer,
&TempAuthenticationStatus,
IsFfs3Fv
@@ -975,7 +975,7 @@ ProcessSection (
ParsedLength += SectionLength;
Section = (EFI_COMMON_SECTION_HEADER *)((UINT8 *)Section + SectionLength);
}
-
+
return EFI_NOT_FOUND;
}
@@ -1003,12 +1003,12 @@ PeiFfsFindSectionData (
)
{
PEI_CORE_FV_HANDLE *CoreFvHandle;
-
+
CoreFvHandle = FileHandleToVolume (FileHandle);
if ((CoreFvHandle == NULL) || (CoreFvHandle->FvPpi == NULL)) {
return EFI_NOT_FOUND;
}
-
+
return CoreFvHandle->FvPpi->FindSectionByType (CoreFvHandle->FvPpi, SectionType, FileHandle, SectionData);
}
@@ -1038,7 +1038,7 @@ PeiFfsFindSectionData3 (
)
{
PEI_CORE_FV_HANDLE *CoreFvHandle;
-
+
CoreFvHandle = FileHandleToVolume (FileHandle);
if ((CoreFvHandle == NULL) || (CoreFvHandle->FvPpi == NULL)) {
return EFI_NOT_FOUND;
@@ -1081,9 +1081,9 @@ PeiFfsFindNextFile (
)
{
PEI_CORE_FV_HANDLE *CoreFvHandle;
-
+
CoreFvHandle = FvHandleToCoreHandle (FvHandle);
-
+
//
// To make backward compatiblity, if can not find corresponding the handle of FV
// then treat FV as build-in FFS2/FFS3 format and memory mapped FV that FV handle is pointed
@@ -1091,12 +1091,12 @@ PeiFfsFindNextFile (
//
if ((CoreFvHandle == NULL) && FeaturePcdGet (PcdFrameworkCompatibilitySupport)) {
return FindFileEx (FvHandle, NULL, SearchType, FileHandle, NULL);
- }
-
+ }
+
if ((CoreFvHandle == NULL) || CoreFvHandle->FvPpi == NULL) {
return EFI_NOT_FOUND;
}
-
+
return CoreFvHandle->FvPpi->FindFileByType (CoreFvHandle->FvPpi, SearchType, FvHandle, FileHandle);
}
@@ -1114,7 +1114,7 @@ PeiFfsFindNextFile (
@retval EFI_SUCCESS The volume was found.
**/
-EFI_STATUS
+EFI_STATUS
EFIAPI
PeiFfsFindNextVolume (
IN CONST EFI_PEI_SERVICES **PeiServices,
@@ -1124,21 +1124,21 @@ PeiFfsFindNextVolume (
{
PEI_CORE_INSTANCE *Private;
PEI_CORE_FV_HANDLE *CoreFvHandle;
-
+
if (VolumeHandle == NULL) {
return EFI_INVALID_PARAMETER;
}
-
+
Private = PEI_CORE_INSTANCE_FROM_PS_THIS (PeiServices);
-
+
CoreFvHandle = FindNextCoreFvHandle (Private, Instance);
if (CoreFvHandle == NULL) {
*VolumeHandle = NULL;
return EFI_NOT_FOUND;
}
-
+
*VolumeHandle = CoreFvHandle->FvHandle;
-
+
return EFI_SUCCESS;
}
@@ -1148,7 +1148,7 @@ PeiFfsFindNextVolume (
@param FileName A pointer to the name of the file to find within the firmware volume.
@param VolumeHandle The firmware volume to search
- @param FileHandle Upon exit, points to the found file's handle
+ @param FileHandle Upon exit, points to the found file's handle
or NULL if it could not be found.
@retval EFI_SUCCESS File was found.
@@ -1157,7 +1157,7 @@ PeiFfsFindNextVolume (
**/
EFI_STATUS
-EFIAPI
+EFIAPI
PeiFfsFindFileByName (
IN CONST EFI_GUID *FileName,
IN EFI_PEI_FV_HANDLE VolumeHandle,
@@ -1165,16 +1165,16 @@ PeiFfsFindFileByName (
)
{
PEI_CORE_FV_HANDLE *CoreFvHandle;
-
+
if ((VolumeHandle == NULL) || (FileName == NULL) || (FileHandle == NULL)) {
return EFI_INVALID_PARAMETER;
}
-
+
CoreFvHandle = FvHandleToCoreHandle (VolumeHandle);
if ((CoreFvHandle == NULL) || (CoreFvHandle->FvPpi == NULL)) {
return EFI_NOT_FOUND;
}
-
+
return CoreFvHandle->FvPpi->FindFileByName (CoreFvHandle->FvPpi, FileName, &VolumeHandle, FileHandle);
}
@@ -1190,14 +1190,14 @@ PeiFfsFindFileByName (
**/
EFI_STATUS
-EFIAPI
+EFIAPI
PeiFfsGetFileInfo (
IN EFI_PEI_FILE_HANDLE FileHandle,
OUT EFI_FV_FILE_INFO *FileInfo
)
{
PEI_CORE_FV_HANDLE *CoreFvHandle;
-
+
if ((FileHandle == NULL) || (FileInfo == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -1225,14 +1225,14 @@ PeiFfsGetFileInfo (
**/
EFI_STATUS
-EFIAPI
+EFIAPI
PeiFfsGetFileInfo2 (
IN EFI_PEI_FILE_HANDLE FileHandle,
OUT EFI_FV_FILE_INFO2 *FileInfo
)
{
PEI_CORE_FV_HANDLE *CoreFvHandle;
-
+
if ((FileHandle == NULL) || (FileInfo == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -1274,24 +1274,24 @@ PeiFfsGetFileInfo2 (
**/
EFI_STATUS
-EFIAPI
+EFIAPI
PeiFfsGetVolumeInfo (
IN EFI_PEI_FV_HANDLE VolumeHandle,
OUT EFI_FV_INFO *VolumeInfo
)
{
PEI_CORE_FV_HANDLE *CoreHandle;
-
+
if ((VolumeInfo == NULL) || (VolumeHandle == NULL)) {
return EFI_INVALID_PARAMETER;
}
-
+
CoreHandle = FvHandleToCoreHandle (VolumeHandle);
-
+
if ((CoreHandle == NULL) || (CoreHandle->FvPpi == NULL)) {
return EFI_INVALID_PARAMETER;
}
-
+
return CoreHandle->FvPpi->GetVolumeInfo (CoreHandle->FvPpi, VolumeHandle, VolumeInfo);
}
@@ -1369,7 +1369,7 @@ GetFvUsedSize (
@retval EFI_OUT_OF_RESOURCES Can not allocate page when aligning FV image
@retval EFI_SECURITY_VIOLATION Image is illegal
@retval Others Can not find EFI_SECTION_FIRMWARE_VOLUME_IMAGE section
-
+
**/
EFI_STATUS
ProcessFvFile (
@@ -1410,7 +1410,7 @@ ProcessFvFile (
ParentFvHandle = ParentFvCoreHandle->FvHandle;
ParentFvPpi = ParentFvCoreHandle->FvPpi;
-
+
//
// Find FvImage in FvFile
//
@@ -1492,10 +1492,10 @@ ProcessFvFile (
Status = ParentFvPpi->GetVolumeInfo (ParentFvPpi, ParentFvHandle, &ParentFvImageInfo);
ASSERT_EFI_ERROR (Status);
-
+
Status = ParentFvPpi->GetFileInfo (ParentFvPpi, ParentFvFileHandle, &FileInfo);
ASSERT_EFI_ERROR (Status);
-
+
//
// Install FvInfo(2) Ppi
// NOTE: FvInfo2 must be installed before FvInfo so that recursive processing of encapsulated
@@ -1562,15 +1562,15 @@ ProcessFvFile (
buffer which contains the necessary information for creating
the firmware volume handle. Normally, these values are derived
from the EFI_FIRMWARE_VOLUME_INFO_PPI.
-
-
+
+
@param This Points to this instance of the
EFI_PEI_FIRMWARE_VOLUME_PPI.
@param Buffer Points to the start of the buffer.
@param BufferSize Size of the buffer.
@param FvHandle Points to the returned firmware volume
handle. The firmware volume handle must
- be unique within the system.
+ be unique within the system.
@retval EFI_SUCCESS Firmware volume handle created.
@retval EFI_VOLUME_CORRUPTED Volume was corrupt.
@@ -1586,19 +1586,19 @@ PeiFfsFvPpiProcessVolume (
)
{
EFI_STATUS Status;
-
+
ASSERT (FvHandle != NULL);
-
+
if (Buffer == NULL) {
return EFI_VOLUME_CORRUPTED;
}
-
+
//
// The build-in EFI_PEI_FIRMWARE_VOLUME_PPI for FFS2/FFS3 support memory-mapped
// FV image and the handle is pointed to Fv image's buffer.
//
*FvHandle = (EFI_PEI_FV_HANDLE) Buffer;
-
+
//
// Do verify for given FV buffer.
//
@@ -1609,12 +1609,12 @@ PeiFfsFvPpiProcessVolume (
}
return EFI_SUCCESS;
-}
+}
/**
Finds the next file of the specified type.
- This service enables PEI modules to discover additional firmware files.
+ This service enables PEI modules to discover additional firmware files.
The FileHandle must be unique within the system.
@param This Points to this instance of the
@@ -1641,13 +1641,13 @@ PeiFfsFvPpiFindFileByType (
IN EFI_PEI_FV_HANDLE FvHandle,
IN OUT EFI_PEI_FILE_HANDLE *FileHandle
)
-{
+{
return FindFileEx (FvHandle, NULL, SearchType, FileHandle, NULL);
}
/**
- Find a file within a volume by its name.
-
+ Find a file within a volume by its name.
+
This service searches for files with a specific name, within
either the specified firmware volume or all firmware volumes.
@@ -1676,28 +1676,28 @@ PeiFfsFvPpiFindFileByName (
IN CONST EFI_PEI_FIRMWARE_VOLUME_PPI *This,
IN CONST EFI_GUID *FileName,
IN EFI_PEI_FV_HANDLE *FvHandle,
- OUT EFI_PEI_FILE_HANDLE *FileHandle
+ OUT EFI_PEI_FILE_HANDLE *FileHandle
)
{
EFI_STATUS Status;
PEI_CORE_INSTANCE *PrivateData;
UINTN Index;
-
+
if ((FvHandle == NULL) || (FileName == NULL) || (FileHandle == NULL)) {
return EFI_INVALID_PARAMETER;
}
-
+
if (*FvHandle != NULL) {
Status = FindFileEx (*FvHandle, FileName, 0, FileHandle, NULL);
if (Status == EFI_NOT_FOUND) {
*FileHandle = NULL;
}
- } else {
+ } else {
//
// If *FvHandle = NULL, so search all FV for given filename
//
Status = EFI_NOT_FOUND;
-
+
PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS (GetPeiServicesTablePointer());
for (Index = 0; Index < PrivateData->FvCount; Index ++) {
//
@@ -1712,17 +1712,17 @@ PeiFfsFvPpiFindFileByName (
}
}
}
-
- return Status;
-}
+
+ return Status;
+}
/**
Returns information about a specific file.
This function returns information about a specific
file, including its file name, type, attributes, starting
- address and size.
-
+ address and size.
+
@param This Points to this instance of the
EFI_PEI_FIRMWARE_VOLUME_PPI.
@param FileHandle Handle of the file.
@@ -1733,13 +1733,13 @@ PeiFfsFvPpiFindFileByName (
@retval EFI_INVALID_PARAMETER If FileHandle does not
represent a valid file.
@retval EFI_INVALID_PARAMETER If FileInfo is NULL.
-
-**/
+
+**/
EFI_STATUS
EFIAPI
PeiFfsFvPpiGetFileInfo (
- IN CONST EFI_PEI_FIRMWARE_VOLUME_PPI *This,
- IN EFI_PEI_FILE_HANDLE FileHandle,
+ IN CONST EFI_PEI_FIRMWARE_VOLUME_PPI *This,
+ IN EFI_PEI_FILE_HANDLE FileHandle,
OUT EFI_FV_FILE_INFO *FileInfo
)
{
@@ -1770,14 +1770,14 @@ PeiFfsFvPpiGetFileInfo (
}
//
- // Get FileState which is the highest bit of the State
+ // Get FileState which is the highest bit of the State
//
FileState = GetFileState (ErasePolarity, (EFI_FFS_FILE_HEADER*)FileHandle);
switch (FileState) {
case EFI_FILE_DATA_VALID:
case EFI_FILE_MARKED_FOR_UPDATE:
- break;
+ break;
default:
return EFI_INVALID_PARAMETER;
}
@@ -1826,8 +1826,8 @@ PeiFfsFvPpiGetFileInfo (
EFI_STATUS
EFIAPI
PeiFfsFvPpiGetFileInfo2 (
- IN CONST EFI_PEI_FIRMWARE_VOLUME_PPI *This,
- IN EFI_PEI_FILE_HANDLE FileHandle,
+ IN CONST EFI_PEI_FIRMWARE_VOLUME_PPI *This,
+ IN EFI_PEI_FILE_HANDLE FileHandle,
OUT EFI_FV_FILE_INFO2 *FileInfo
)
{
@@ -1856,7 +1856,7 @@ PeiFfsFvPpiGetFileInfo2 (
/**
This function returns information about the firmware volume.
-
+
@param This Points to this instance of the
EFI_PEI_FIRMWARE_VOLUME_PPI.
@param FvHandle Handle to the firmware handle.
@@ -1867,12 +1867,12 @@ PeiFfsFvPpiGetFileInfo2 (
@retval EFI_INVALID_PARAMETER FvHandle does not indicate a valid
firmware volume or VolumeInfo is NULL.
-**/
+**/
EFI_STATUS
EFIAPI
PeiFfsFvPpiGetVolumeInfo (
- IN CONST EFI_PEI_FIRMWARE_VOLUME_PPI *This,
- IN EFI_PEI_FV_HANDLE FvHandle,
+ IN CONST EFI_PEI_FIRMWARE_VOLUME_PPI *This,
+ IN EFI_PEI_FV_HANDLE FvHandle,
OUT EFI_FV_INFO *VolumeInfo
)
{
@@ -1882,10 +1882,10 @@ PeiFfsFvPpiGetVolumeInfo (
if ((VolumeInfo == NULL) || (FvHandle == 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.
+ // 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, FvHandle, sizeof (EFI_FIRMWARE_VOLUME_HEADER));
@@ -1907,16 +1907,16 @@ PeiFfsFvPpiGetVolumeInfo (
FwVolExHeaderInfo = (EFI_FIRMWARE_VOLUME_EXT_HEADER*)(((UINT8 *)FvHandle) + FwVolHeader.ExtHeaderOffset);
CopyMem (&VolumeInfo->FvName, &FwVolExHeaderInfo->FvName, sizeof(EFI_GUID));
}
-
- return EFI_SUCCESS;
-}
+
+ return EFI_SUCCESS;
+}
/**
Find the next matching section in the firmware file.
-
+
This service enables PEI modules to discover sections
of a given type within a valid file.
-
+
@param This Points to this instance of the
EFI_PEI_FIRMWARE_VOLUME_PPI.
@param SearchType A filter to find only sections of this
@@ -1925,7 +1925,7 @@ PeiFfsFvPpiGetVolumeInfo (
search.
@param SectionData Updated upon return to point to the
section found.
-
+
@retval EFI_SUCCESS Section was found.
@retval EFI_NOT_FOUND Section of the specified type was not
found. SectionData contains NULL.
@@ -2021,8 +2021,8 @@ PeiFfsFvPpiFindSectionByType2 (
GetPeiServicesTablePointer (),
SearchType,
&Instance,
- Section,
- FileSize,
+ Section,
+ FileSize,
SectionData,
&ExtractedAuthenticationStatus,
FwVolInstance->IsFfs3Fv
@@ -2038,11 +2038,11 @@ PeiFfsFvPpiFindSectionByType2 (
/**
Convert the handle of FV to pointer of corresponding PEI_CORE_FV_HANDLE.
-
+
@param FvHandle The handle of a FV.
-
+
@retval NULL if can not find.
- @return Pointer of corresponding PEI_CORE_FV_HANDLE.
+ @return Pointer of corresponding PEI_CORE_FV_HANDLE.
**/
PEI_CORE_FV_HANDLE *
FvHandleToCoreHandle (
@@ -2051,25 +2051,25 @@ FvHandleToCoreHandle (
{
UINTN Index;
PEI_CORE_INSTANCE *PrivateData;
-
- PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS (GetPeiServicesTablePointer());
+
+ PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS (GetPeiServicesTablePointer());
for (Index = 0; Index < PrivateData->FvCount; Index ++) {
if (FvHandle == PrivateData->Fv[Index].FvHandle) {
return &PrivateData->Fv[Index];
}
}
-
+
return NULL;
-}
+}
/**
Get instance of PEI_CORE_FV_HANDLE for next volume according to given index.
-
+
This routine also will install FvInfo ppi for FV hob in PI ways.
-
+
@param Private Pointer of PEI_CORE_INSTANCE
@param Instance The index of FV want to be searched.
-
+
@return Instance of PEI_CORE_FV_HANDLE.
**/
PEI_CORE_FV_HANDLE *
@@ -2081,7 +2081,7 @@ FindNextCoreFvHandle (
UINTN Index;
BOOLEAN Match;
EFI_HOB_FIRMWARE_VOLUME *FvHob;
-
+
//
// Handle Framework FvHob and Install FvInfo Ppi for it.
//
@@ -2101,7 +2101,7 @@ FindNextCoreFvHandle (
break;
}
}
-
+
//
// Search whether FvHob has been cached into PeiCore's Unknown FV database.
// If found, no need install new FvInfoPpi for it.
@@ -2129,8 +2129,8 @@ FindNextCoreFvHandle (
NULL
);
}
-
- FvHob = (EFI_HOB_FIRMWARE_VOLUME *)GetNextHob (EFI_HOB_TYPE_FV, (VOID *)((UINTN)FvHob + FvHob->Header.HobLength));
+
+ FvHob = (EFI_HOB_FIRMWARE_VOLUME *)GetNextHob (EFI_HOB_TYPE_FV, (VOID *)((UINTN)FvHob + FvHob->Header.HobLength));
}
}
@@ -2140,16 +2140,16 @@ FindNextCoreFvHandle (
}
return &Private->Fv[Instance];
-}
+}
/**
After PeiCore image is shadowed into permanent memory, all build-in FvPpi should
- be re-installed with the instance in permanent memory and all cached FvPpi pointers in
+ be re-installed with the instance in permanent memory and all cached FvPpi pointers in
PrivateData->Fv[] array should be fixed up to be pointed to the one in permanent
memory.
-
+
@param PrivateData Pointer to PEI_CORE_INSTANCE.
-**/
+**/
VOID
PeiReinitializeFv (
IN PEI_CORE_INSTANCE *PrivateData
@@ -2219,17 +2219,17 @@ PeiReinitializeFv (
/**
Report the information for a new discoveried FV in unknown third-party format.
-
+
If the EFI_PEI_FIRMWARE_VOLUME_PPI has not been installed for third-party FV format, but
the FV in this format has been discoveried, then this FV's information will be cached into
PEI_CORE_INSTANCE's UnknownFvInfo array.
Also a notification would be installed for unknown third-party FV format guid, if EFI_PEI_FIRMWARE_VOLUME_PPI
is installed later by platform's PEIM, the original unknown third-party FV will be processed by
using new installed EFI_PEI_FIRMWARE_VOLUME_PPI.
-
+
@param PrivateData Point to instance of PEI_CORE_INSTANCE
@param FvInfo2Ppi Point to FvInfo2 PPI.
-
+
@retval EFI_OUT_OF_RESOURCES The FV info array in PEI_CORE_INSTANCE has no more spaces.
@retval EFI_SUCCESS Success to add the information for unknown FV.
**/
@@ -2240,14 +2240,14 @@ AddUnknownFormatFvInfo (
)
{
PEI_CORE_UNKNOW_FORMAT_FV_INFO *NewUnknownFv;
-
+
if (PrivateData->UnknownFvInfoCount + 1 >= PcdGet32 (PcdPeiCoreMaxFvSupported)) {
return EFI_OUT_OF_RESOURCES;
}
-
+
NewUnknownFv = &PrivateData->UnknownFvInfo[PrivateData->UnknownFvInfoCount];
PrivateData->UnknownFvInfoCount ++;
-
+
CopyGuid (&NewUnknownFv->FvFormat, &FvInfo2Ppi->FvFormat);
NewUnknownFv->FvInfo = FvInfo2Ppi->FvInfo;
NewUnknownFv->FvInfoSize = FvInfo2Ppi->FvInfoSize;
@@ -2255,23 +2255,23 @@ AddUnknownFormatFvInfo (
NewUnknownFv->NotifyDescriptor.Flags = (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST);
NewUnknownFv->NotifyDescriptor.Guid = &NewUnknownFv->FvFormat;
NewUnknownFv->NotifyDescriptor.Notify = ThirdPartyFvPpiNotifyCallback;
-
+
PeiServicesNotifyPpi (&NewUnknownFv->NotifyDescriptor);
return EFI_SUCCESS;
}
/**
Find the FV information according to third-party FV format guid.
-
+
This routine also will remove the FV information found by given FV format guid from
PrivateData->UnknownFvInfo[].
-
+
@param PrivateData Point to instance of PEI_CORE_INSTANCE
@param Format Point to given FV format guid
@param FvInfo On return, the pointer of FV information buffer
@param FvInfoSize On return, the size of FV information buffer.
@param AuthenticationStatus On return, the authentication status of FV information buffer.
-
+
@retval EFI_NOT_FOUND The FV is not found for new installed EFI_PEI_FIRMWARE_VOLUME_PPI
@retval EFI_SUCCESS Success to find a FV which could be processed by new installed EFI_PEI_FIRMWARE_VOLUME_PPI.
**/
@@ -2293,15 +2293,15 @@ FindUnknownFormatFvInfo (
break;
}
}
-
+
if (Index == PrivateData->UnknownFvInfoCount) {
return EFI_NOT_FOUND;
}
-
+
*FvInfo = PrivateData->UnknownFvInfo[Index].FvInfo;
*FvInfoSize = PrivateData->UnknownFvInfo[Index].FvInfoSize;
*AuthenticationStatus = PrivateData->UnknownFvInfo[Index].AuthenticationStatus;
-
+
//
// Remove an entry from UnknownFvInfo array.
//
@@ -2311,18 +2311,18 @@ FindUnknownFormatFvInfo (
}
PrivateData->UnknownFvInfoCount --;
return EFI_SUCCESS;
-}
+}
/**
Notification callback function for EFI_PEI_FIRMWARE_VOLUME_PPI.
-
- When a EFI_PEI_FIRMWARE_VOLUME_PPI is installed to support new FV format, this
+
+ When a EFI_PEI_FIRMWARE_VOLUME_PPI is installed to support new FV format, this
routine is called to process all discoveried FVs in this format.
-
+
@param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation
@param NotifyDescriptor Address of the notification descriptor data structure.
@param Ppi Address of the PPI that was installed.
-
+
@retval EFI_SUCCESS The notification callback is processed correctly.
**/
EFI_STATUS
@@ -2343,18 +2343,18 @@ ThirdPartyFvPpiNotifyCallback (
BOOLEAN IsProcessed;
UINTN FvIndex;
EFI_PEI_FILE_HANDLE FileHandle;
- VOID *DepexData;
+ VOID *DepexData;
UINTN CurFvCount;
PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS (PeiServices);
FvPpi = (EFI_PEI_FIRMWARE_VOLUME_PPI*) Ppi;
-
+
do {
Status = FindUnknownFormatFvInfo (PrivateData, NotifyDescriptor->Guid, &FvInfo, &FvInfoSize, &AuthenticationStatus);
if (EFI_ERROR (Status)) {
return EFI_SUCCESS;
}
-
+
//
// Process new found FV and get FV handle.
//
@@ -2375,17 +2375,17 @@ ThirdPartyFvPpiNotifyCallback (
break;
}
}
-
+
if (IsProcessed) {
continue;
}
-
+
if (PrivateData->FvCount >= PcdGet32 (PcdPeiCoreMaxFvSupported)) {
DEBUG ((EFI_D_ERROR, "The number of Fv Images (%d) exceed the max supported FVs (%d) in Pei", PrivateData->FvCount + 1, PcdGet32 (PcdPeiCoreMaxFvSupported)));
DEBUG ((EFI_D_ERROR, "PcdPeiCoreMaxFvSupported value need be reconfigurated in DSC"));
ASSERT (FALSE);
}
-
+
//
// Update internal PEI_CORE_FV array.
//
@@ -2395,17 +2395,17 @@ ThirdPartyFvPpiNotifyCallback (
PrivateData->Fv[PrivateData->FvCount].AuthenticationStatus = AuthenticationStatus;
CurFvCount = PrivateData->FvCount;
DEBUG ((
- EFI_D_INFO,
- "The %dth FV start address is 0x%11p, size is 0x%08x, handle is 0x%p\n",
+ EFI_D_INFO,
+ "The %dth FV start address is 0x%11p, size is 0x%08x, handle is 0x%p\n",
(UINT32) CurFvCount,
- (VOID *) FvInfo,
+ (VOID *) FvInfo,
FvInfoSize,
FvHandle
- ));
+ ));
PrivateData->FvCount ++;
//
- // Scan and process the new discoveried FV for EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE
+ // Scan and process the new discoveried FV for EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE
//
FileHandle = NULL;
do {
@@ -2430,7 +2430,7 @@ ThirdPartyFvPpiNotifyCallback (
continue;
}
}
-
+
DEBUG ((EFI_D_INFO, "Found firmware volume Image File %p in FV[%d] %p\n", FileHandle, CurFvCount, FvHandle));
ProcessFvFile (PrivateData, &PrivateData->Fv[CurFvCount], FileHandle);
}