From: klu2 Date: Thu, 11 Feb 2010 05:49:48 +0000 (+0000) Subject: Fix the issue that unknown format FV in Fvhob is installed for FvInfoPpi more than... X-Git-Tag: edk2-stable201903~16352 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=20ead7252b301c04204afed52de53397a942c542 Fix the issue that unknown format FV in Fvhob is installed for FvInfoPpi more than one time. The fixing is search dispatched Fv database and cached unknown Fv information for all Fv in FvHob, if Fv has been identified by PeiCore, then no need install FvInfoPpi for it again. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9984 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/MdeModulePkg/Core/Pei/FwVol/FwVol.c b/MdeModulePkg/Core/Pei/FwVol/FwVol.c index c6eb1fa24f..30485a836c 100644 --- a/MdeModulePkg/Core/Pei/FwVol/FwVol.c +++ b/MdeModulePkg/Core/Pei/FwVol/FwVol.c @@ -1348,14 +1348,34 @@ FindNextCoreFvHandle ( // FvHob = (EFI_HOB_FIRMWARE_VOLUME *)GetFirstHob (EFI_HOB_TYPE_FV); while (FvHob != NULL) { + // + // Search whether FvHob has been installed into PeiCore's FV database. + // If found, no need install new FvInfoPpi for it. + // for (Index = 0, Match = FALSE; Index < Private->FvCount; Index++) { if ((EFI_PEI_FV_HANDLE)(UINTN)FvHob->BaseAddress == Private->Fv[Index].FvHeader) { Match = TRUE; break; } } + // - // If Not Found, Install FvInfo Ppi for it. + // Search whether FvHob has been cached into PeiCore's Unknown FV database. + // If found, no need install new FvInfoPpi for it. + // + if (!Match) { + for (Index = 0; Index < Private->UnknownFvInfoCount; Index ++) { + if ((UINTN)FvHob->BaseAddress == (UINTN)Private->UnknownFvInfo[Index].FvInfo) { + Match = TRUE; + break; + } + } + } + + // + // If the Fv in FvHob has not been installed into PeiCore's FV database and has + // not been cached into PeiCore's Unknown FV database, install a new FvInfoPpi + // for it then PeiCore will dispatch it in callback of FvInfoPpi. // if (!Match) { PeiServicesInstallFvInfoPpi ( @@ -1366,6 +1386,7 @@ FindNextCoreFvHandle ( NULL ); } + FvHob = (EFI_HOB_FIRMWARE_VOLUME *)GetNextHob (EFI_HOB_TYPE_FV, (VOID *)((UINTN)FvHob + FvHob->Header.HobLength)); } }