From 6d2e8727b7608da76113c879851d6d69f88bfed0 Mon Sep 17 00:00:00 2001 From: qhuang8 Date: Tue, 12 Aug 2008 05:38:58 +0000 Subject: [PATCH] Re-integrate patch in r5625: "Only build FvHob for the extracted FvImage those parent Fv image has FvHob" git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5631 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c | 32 +++++++++++++------ 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c b/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c index a4ed45af52..9c1aab916f 100644 --- a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c +++ b/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c @@ -814,7 +814,7 @@ ProcessFvFile ( EFI_FV_INFO FvImageInfo; UINT32 FvAlignment; VOID *FvBuffer; - EFI_PEI_HOB_POINTERS HobFv2; + EFI_PEI_HOB_POINTERS HobPtr; FvBuffer = NULL; *AuthenticationState = 0; @@ -823,15 +823,15 @@ ProcessFvFile ( // 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)) { + 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)) { // // this FILE has been dispatched, it will not be dispatched again. // return EFI_SUCCESS; } - HobFv2.Raw = GET_NEXT_HOB (HobFv2); + HobPtr.Raw = GET_NEXT_HOB (HobPtr); } // @@ -886,12 +886,24 @@ ProcessFvFile ( ); // - // Inform HOB consumer phase, i.e. DXE core, the existance of this FV + // Inform the extracted FvImage to Fv HOB consumer phase, i.e. DXE phase + // based on its parent Fvimage is informed or not. + // If FvHob of its parent fvimage is built, the extracted FvImage will be built also. + // Or, the extracted FvImage will not be built. // - BuildFvHob ( - (EFI_PHYSICAL_ADDRESS) (UINTN) FvImageInfo.FvStart, - FvImageInfo.FvSize - ); + HobPtr.Raw = GetHobList (); + while ((HobPtr.Raw = GetNextHob (EFI_HOB_TYPE_FV, HobPtr.Raw)) != NULL) { + if (((EFI_PHYSICAL_ADDRESS) (UINTN)FvFileHandle > HobPtr.FirmwareVolume->BaseAddress) && + ((EFI_PHYSICAL_ADDRESS) (UINTN)FvFileHandle < HobPtr.FirmwareVolume->BaseAddress + HobPtr.FirmwareVolume->Length)) { + BuildFvHob ( + (EFI_PHYSICAL_ADDRESS) (UINTN) FvImageInfo.FvStart, + FvImageInfo.FvSize + ); + break; + } + HobPtr.Raw = GET_NEXT_HOB (HobPtr); + } + // // Makes the encapsulated volume show up in DXE phase to skip processing of // encapsulated file again.