diff options
author | Star Zeng <star.zeng@intel.com> | 2013-07-11 01:40:10 +0000 |
---|---|---|
committer | lzeng14 <lzeng14@6f19259b-4bc3-4df7-8a09-765794883524> | 2013-07-11 01:40:10 +0000 |
commit | 0dda774c86bf00462fc167686d5f8497abb633bb (patch) | |
tree | 090c7aa86f88ca1a7d1f7a4c5754c2de3c859e3c /MdeModulePkg | |
parent | 6c657d742e7a05786a74ee75e1237d9192913a44 (diff) | |
download | edk2-platforms-0dda774c86bf00462fc167686d5f8497abb633bb.tar.xz |
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
Diffstat (limited to 'MdeModulePkg')
-rw-r--r-- | MdeModulePkg/Universal/FaultTolerantWritePei/FaultTolerantWritePei.c | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/MdeModulePkg/Universal/FaultTolerantWritePei/FaultTolerantWritePei.c b/MdeModulePkg/Universal/FaultTolerantWritePei/FaultTolerantWritePei.c index ec03216c06..14e18e5ae2 100644 --- a/MdeModulePkg/Universal/FaultTolerantWritePei/FaultTolerantWritePei.c +++ b/MdeModulePkg/Universal/FaultTolerantWritePei/FaultTolerantWritePei.c @@ -254,23 +254,26 @@ PeimFaultTolerantWriteInitialize ( );
}
- if (!EFI_ERROR (Status) && ((FtwLastWriteRecord->SpareComplete == FTW_VALID_STATE) && (FtwLastWriteRecord->DestinationComplete != FTW_VALID_STATE))) {
- //
- // If FTW last write was still in progress with SpareComplete set and DestinationComplete not set.
- // 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
- // FAULT_TOLERANT_WRITE_LAST_WRITE_DATA GUID hob to hold the FTW last write data.
- //
- FtwLastWrite.TargetAddress = (EFI_PHYSICAL_ADDRESS) (UINTN) ((INT64) SpareAreaAddress + FtwLastWriteRecord->RelativeOffset);
- FtwLastWrite.SpareAddress = SpareAreaAddress;
- FtwLastWrite.Length = SpareAreaLength;
- DEBUG ((
- EFI_D_INFO,
- "FtwPei last write data: TargetAddress - 0x%x SpareAddress - 0x%x Length - 0x%x\n",
- (UINTN) FtwLastWrite.TargetAddress,
- (UINTN) FtwLastWrite.SpareAddress,
- (UINTN) FtwLastWrite.Length));
- BuildGuidDataHob (&gEdkiiFaultTolerantWriteGuid, (VOID *) &FtwLastWrite, sizeof (FAULT_TOLERANT_WRITE_LAST_WRITE_DATA));
+ if (!EFI_ERROR (Status)) {
+ ASSERT (FtwLastWriteRecord != NULL);
+ if ((FtwLastWriteRecord->SpareComplete == FTW_VALID_STATE) && (FtwLastWriteRecord->DestinationComplete != FTW_VALID_STATE)) {
+ //
+ // If FTW last write was still in progress with SpareComplete set and DestinationComplete not set.
+ // 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
+ // FAULT_TOLERANT_WRITE_LAST_WRITE_DATA GUID hob to hold the FTW last write data.
+ //
+ FtwLastWrite.TargetAddress = (EFI_PHYSICAL_ADDRESS) (UINTN) ((INT64) SpareAreaAddress + FtwLastWriteRecord->RelativeOffset);
+ FtwLastWrite.SpareAddress = SpareAreaAddress;
+ FtwLastWrite.Length = SpareAreaLength;
+ DEBUG ((
+ EFI_D_INFO,
+ "FtwPei last write data: TargetAddress - 0x%x SpareAddress - 0x%x Length - 0x%x\n",
+ (UINTN) FtwLastWrite.TargetAddress,
+ (UINTN) FtwLastWrite.SpareAddress,
+ (UINTN) FtwLastWrite.Length));
+ BuildGuidDataHob (&gEdkiiFaultTolerantWriteGuid, (VOID *) &FtwLastWrite, sizeof (FAULT_TOLERANT_WRITE_LAST_WRITE_DATA));
+ }
}
} else {
FtwWorkingBlockHeader = NULL;
|