mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-30 00:54:06 +02:00
MdeModulePkg PeiCore: Handle multiple FV images in one FV file
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1131 PI spec and BaseTools support to generate multiple FV images in one FV file. This patch is to update PeiCore to handle the case. Cc: Liming Gao <liming.gao@intel.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
parent
374168ae65
commit
0e042d0ad7
@ -1358,7 +1358,7 @@ GetFvUsedSize (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get Fv image from the FV type file, then install FV INFO(2) ppi, Build FV hob.
|
Get Fv image(s) from the FV type file, then install FV INFO(2) ppi, Build FV(2, 3) hob.
|
||||||
|
|
||||||
@param PrivateData PeiCore's private data structure
|
@param PrivateData PeiCore's private data structure
|
||||||
@param ParentFvCoreHandle Pointer of EFI_CORE_FV_HANDLE to parent Fv image that contain this Fv image.
|
@param ParentFvCoreHandle Pointer of EFI_CORE_FV_HANDLE to parent Fv image that contain this Fv image.
|
||||||
@ -1391,6 +1391,7 @@ ProcessFvFile (
|
|||||||
UINT32 AuthenticationStatus;
|
UINT32 AuthenticationStatus;
|
||||||
UINT32 FvUsedSize;
|
UINT32 FvUsedSize;
|
||||||
UINT8 EraseByte;
|
UINT8 EraseByte;
|
||||||
|
UINTN Index;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check if this EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE file has already
|
// Check if this EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE file has already
|
||||||
@ -1412,20 +1413,29 @@ ProcessFvFile (
|
|||||||
ParentFvPpi = ParentFvCoreHandle->FvPpi;
|
ParentFvPpi = ParentFvCoreHandle->FvPpi;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Find FvImage in FvFile
|
// Find FvImage(s) in FvFile
|
||||||
//
|
//
|
||||||
|
Index = 0;
|
||||||
|
do {
|
||||||
AuthenticationStatus = 0;
|
AuthenticationStatus = 0;
|
||||||
if ((ParentFvPpi->Signature == EFI_PEI_FIRMWARE_VOLUME_PPI_SIGNATURE) &&
|
if ((ParentFvPpi->Signature == EFI_PEI_FIRMWARE_VOLUME_PPI_SIGNATURE) &&
|
||||||
(ParentFvPpi->Revision == EFI_PEI_FIRMWARE_VOLUME_PPI_REVISION)) {
|
(ParentFvPpi->Revision == EFI_PEI_FIRMWARE_VOLUME_PPI_REVISION)) {
|
||||||
Status = ParentFvPpi->FindSectionByType2 (
|
Status = ParentFvPpi->FindSectionByType2 (
|
||||||
ParentFvPpi,
|
ParentFvPpi,
|
||||||
EFI_SECTION_FIRMWARE_VOLUME_IMAGE,
|
EFI_SECTION_FIRMWARE_VOLUME_IMAGE,
|
||||||
0,
|
Index,
|
||||||
ParentFvFileHandle,
|
ParentFvFileHandle,
|
||||||
(VOID **)&FvHeader,
|
(VOID **)&FvHeader,
|
||||||
&AuthenticationStatus
|
&AuthenticationStatus
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
//
|
||||||
|
// Old FvPpi has no parameter to input SearchInstance,
|
||||||
|
// only one instance is supported.
|
||||||
|
//
|
||||||
|
if (Index > 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
Status = ParentFvPpi->FindSectionByType (
|
Status = ParentFvPpi->FindSectionByType (
|
||||||
ParentFvPpi,
|
ParentFvPpi,
|
||||||
EFI_SECTION_FIRMWARE_VOLUME_IMAGE,
|
EFI_SECTION_FIRMWARE_VOLUME_IMAGE,
|
||||||
@ -1434,12 +1444,12 @@ ProcessFvFile (
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = VerifyPeim (PrivateData, ParentFvHandle, ParentFvFileHandle, AuthenticationStatus);
|
Status = VerifyPeim (PrivateData, ParentFvHandle, ParentFvFileHandle, AuthenticationStatus);
|
||||||
if (Status == EFI_SECURITY_VIOLATION) {
|
if (Status == EFI_SECURITY_VIOLATION) {
|
||||||
return Status;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -1471,7 +1481,8 @@ ProcessFvFile (
|
|||||||
FvLength = ReadUnaligned64 (&FvHeader->FvLength);
|
FvLength = ReadUnaligned64 (&FvHeader->FvLength);
|
||||||
NewFvBuffer = AllocateAlignedPages (EFI_SIZE_TO_PAGES ((UINT32) FvLength), FvAlignment);
|
NewFvBuffer = AllocateAlignedPages (EFI_SIZE_TO_PAGES ((UINT32) FvLength), FvAlignment);
|
||||||
if (NewFvBuffer == NULL) {
|
if (NewFvBuffer == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (GetFvUsedSize (FvHeader, &FvUsedSize, &EraseByte)) {
|
if (GetFvUsedSize (FvHeader, &FvUsedSize, &EraseByte)) {
|
||||||
//
|
//
|
||||||
@ -1549,7 +1560,17 @@ ProcessFvFile (
|
|||||||
&FileInfo.FileName
|
&FileInfo.FileName
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Index++;
|
||||||
|
} while (TRUE);
|
||||||
|
|
||||||
|
if (Index > 0) {
|
||||||
|
//
|
||||||
|
// At least one FvImage has been processed successfully.
|
||||||
|
//
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
|
} else {
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1258,7 +1258,7 @@ SecurityPpiNotifyCallback (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get Fv image from the FV type file, then install FV INFO(2) ppi, Build FV hob.
|
Get Fv image(s) from the FV type file, then install FV INFO(2) ppi, Build FV(2, 3) hob.
|
||||||
|
|
||||||
@param PrivateData PeiCore's private data structure
|
@param PrivateData PeiCore's private data structure
|
||||||
@param ParentFvCoreHandle Pointer of EFI_CORE_FV_HANDLE to parent Fv image that contain this Fv image.
|
@param ParentFvCoreHandle Pointer of EFI_CORE_FV_HANDLE to parent Fv image that contain this Fv image.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user