Skip to content

Commit

Permalink
Merged PR 1425:[TCBZ2094] Fix FV2 Hob creation when processing FV fil…
Browse files Browse the repository at this point in the history
…e in PrePiLib

Fix FV2 Hob creation when processing FV file in PrePiLib
  • Loading branch information
dmitryantipov authored and kenlautner committed Dec 18, 2023
1 parent 869f513 commit b593cc3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 23 deletions.
22 changes: 4 additions & 18 deletions EmbeddedPkg/Include/Library/PrePiLib.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ FfsGetVolumeInfo (
/**
Get Fv image from the FV type file, then add FV & FV2 Hob.
@param FileHandle File handle of a Fv type file.
@param FvFileHandle File handle of a Fv type file.
@param ParentVolumeHandle Parent volume handle, for filling out FvName field in FV2 Hob
@retval EFI_NOT_FOUND FV image can't be found.
@retval EFI_SUCCESS Successfully to process it.
Expand All @@ -189,7 +190,8 @@ FfsGetVolumeInfo (
EFI_STATUS
EFIAPI
FfsProcessFvFile (
IN EFI_PEI_FILE_HANDLE FvFileHandle
IN EFI_PEI_FILE_HANDLE FvFileHandle,
IN EFI_PEI_FV_HANDLE ParentVolumeHandle // MU_CHANGE
);

/**
Expand All @@ -211,22 +213,6 @@ FfsAnyFvFindFirstFile (
OUT EFI_PEI_FILE_HANDLE *FileHandle
);

/**
Get Fv image from the FV type file, then add FV & FV2 Hob.
@param FileHandle File handle of a Fv type file.
@retval EFI_NOT_FOUND FV image can't be found.
@retval EFI_SUCCESS Successfully to process it.
**/
EFI_STATUS
EFIAPI
FfsProcessFvFile (
IN EFI_PEI_FILE_HANDLE FvFileHandle
);

/**
This service enables PEIMs to ascertain the present value of the boot mode.
Expand Down
15 changes: 11 additions & 4 deletions EmbeddedPkg/Library/PrePiLib/FwVol.c
Original file line number Diff line number Diff line change
Expand Up @@ -803,8 +803,8 @@ FfsAnyFvFindFirstFile (
/**
Get Fv image from the FV type file, then add FV & FV2 Hob.
@param FileHandle File handle of a Fv type file.
@param FvFileHandle File handle of a Fv type file.
@param ParentVolumeHandle Parent volume handle, for filling out FvName field in FV2 Hob
@retval EFI_NOT_FOUND FV image can't be found.
@retval EFI_SUCCESS Successfully to process it.
Expand All @@ -813,12 +813,14 @@ FfsAnyFvFindFirstFile (
EFI_STATUS
EFIAPI
FfsProcessFvFile (
IN EFI_PEI_FILE_HANDLE FvFileHandle
IN EFI_PEI_FILE_HANDLE FvFileHandle,
IN EFI_PEI_FV_HANDLE ParentVolumeHandle // MU_CHANGE
)
{
EFI_STATUS Status;
EFI_PEI_FV_HANDLE FvImageHandle;
EFI_FV_INFO FvImageInfo;
EFI_FV_INFO ParentVolumeInfo; // MU_CHANGE
UINT32 FvAlignment;
VOID *FvBuffer;
EFI_PEI_HOB_POINTERS HobFv2;
Expand Down Expand Up @@ -885,14 +887,19 @@ FfsProcessFvFile (
//
BuildFvHob ((EFI_PHYSICAL_ADDRESS)(UINTN)FvImageInfo.FvStart, FvImageInfo.FvSize);

// MU_CHANGE Start
Status = FfsGetVolumeInfo (ParentVolumeHandle, &ParentVolumeInfo);
ASSERT_EFI_ERROR (Status);
// MU_CHANGE End

//
// 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,
&ParentVolumeInfo.FvName, // MU_CHANGE
&(((EFI_FFS_FILE_HEADER *)FvFileHandle)->Name)
);

Expand Down
2 changes: 1 addition & 1 deletion EmbeddedPkg/Library/PrePiLib/PrePiLib.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ DecompressFirstFv (

Status = FfsAnyFvFindFirstFile (EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE, &VolumeHandle, &FileHandle);
if (!EFI_ERROR (Status)) {
Status = FfsProcessFvFile (FileHandle);
Status = FfsProcessFvFile (FileHandle, VolumeHandle); // MU_CHANGE
}

return Status;
Expand Down

0 comments on commit b593cc3

Please sign in to comment.