MdeModulePkg FaultTolerantWritePei: Refine the code to avoid error report.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14462 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Star Zeng 2013-07-11 01:40:10 +00:00 committed by lzeng14
parent 6c657d742e
commit 0dda774c86

View File

@ -254,23 +254,26 @@ PeimFaultTolerantWriteInitialize (
); );
} }
if (!EFI_ERROR (Status) && ((FtwLastWriteRecord->SpareComplete == FTW_VALID_STATE) && (FtwLastWriteRecord->DestinationComplete != FTW_VALID_STATE))) { if (!EFI_ERROR (Status)) {
// ASSERT (FtwLastWriteRecord != NULL);
// If FTW last write was still in progress with SpareComplete set and DestinationComplete not set. if ((FtwLastWriteRecord->SpareComplete == FTW_VALID_STATE) && (FtwLastWriteRecord->DestinationComplete != FTW_VALID_STATE)) {
// It means the target buffer has been backed up in spare block, then target block has been erased, //
// but the target buffer has not been writen in target block from spare block, we need to build // If FTW last write was still in progress with SpareComplete set and DestinationComplete not set.
// FAULT_TOLERANT_WRITE_LAST_WRITE_DATA GUID hob to hold the FTW last write data. // It means the target buffer has been backed up in spare block, then target block has been erased,
// // but the target buffer has not been writen in target block from spare block, we need to build
FtwLastWrite.TargetAddress = (EFI_PHYSICAL_ADDRESS) (UINTN) ((INT64) SpareAreaAddress + FtwLastWriteRecord->RelativeOffset); // FAULT_TOLERANT_WRITE_LAST_WRITE_DATA GUID hob to hold the FTW last write data.
FtwLastWrite.SpareAddress = SpareAreaAddress; //
FtwLastWrite.Length = SpareAreaLength; FtwLastWrite.TargetAddress = (EFI_PHYSICAL_ADDRESS) (UINTN) ((INT64) SpareAreaAddress + FtwLastWriteRecord->RelativeOffset);
DEBUG (( FtwLastWrite.SpareAddress = SpareAreaAddress;
EFI_D_INFO, FtwLastWrite.Length = SpareAreaLength;
"FtwPei last write data: TargetAddress - 0x%x SpareAddress - 0x%x Length - 0x%x\n", DEBUG ((
(UINTN) FtwLastWrite.TargetAddress, EFI_D_INFO,
(UINTN) FtwLastWrite.SpareAddress, "FtwPei last write data: TargetAddress - 0x%x SpareAddress - 0x%x Length - 0x%x\n",
(UINTN) FtwLastWrite.Length)); (UINTN) FtwLastWrite.TargetAddress,
BuildGuidDataHob (&gEdkiiFaultTolerantWriteGuid, (VOID *) &FtwLastWrite, sizeof (FAULT_TOLERANT_WRITE_LAST_WRITE_DATA)); (UINTN) FtwLastWrite.SpareAddress,
(UINTN) FtwLastWrite.Length));
BuildGuidDataHob (&gEdkiiFaultTolerantWriteGuid, (VOID *) &FtwLastWrite, sizeof (FAULT_TOLERANT_WRITE_LAST_WRITE_DATA));
}
} }
} else { } else {
FtwWorkingBlockHeader = NULL; FtwWorkingBlockHeader = NULL;