MdeModulePkg Variable: Handle ftw driver executes prior to variable driver

Variable driver uses gEdkiiFaultTolerantWriteGuid hob and copies  data to NvStorageData if hob exists.
But if ftw driver executes prior to variable driver then spare block is erased.

So the patch is to enhance the code to do not check FTW last write data hob if FTW protocol has been installed.

Cc: Liming Gao <liming.gao@intel.com>
Reported-by: Baraneedharan Anbazhagan <anbazhagan@hp.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Baraneedharan Anbazhagan <anbazhagan@hp.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19577 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Star Zeng 2015-12-30 05:09:16 +00:00 committed by lzeng14
parent bc003bc076
commit 14326ed091
1 changed files with 30 additions and 22 deletions

View File

@ -3626,6 +3626,8 @@ InitNonVolatileVariableStore (
UINT32 HwErrStorageSize;
UINT32 MaxUserNvVariableSpaceSize;
UINT32 BoottimeReservedNvVariableSpaceSize;
EFI_STATUS Status;
VOID *FtwProtocol;
mVariableModuleGlobal->FvbInstance = NULL;
@ -3648,6 +3650,11 @@ InitNonVolatileVariableStore (
//
CopyMem (NvStorageData, (UINT8 *) (UINTN) NvStorageBase, NvStorageSize);
Status = GetFtwProtocol ((VOID **)&FtwProtocol);
//
// If FTW protocol has been installed, no need to check FTW last write data hob.
//
if (EFI_ERROR (Status)) {
//
// Check the FTW last write data hob.
//
@ -3674,6 +3681,7 @@ InitNonVolatileVariableStore (
CopyMem (NvStorageData + BackUpOffset, (UINT8 *) (UINTN) FtwLastWriteData->SpareAddress, BackUpSize);
}
}
}
FvHeader = (EFI_FIRMWARE_VOLUME_HEADER *) NvStorageData;