Revision: 14462
          http://sourceforge.net/p/edk2/code/14462
Author:   lzeng14
Date:     2013-07-11 01:40:10 +0000 (Thu, 11 Jul 2013)
Log Message:
-----------
MdeModulePkg FaultTolerantWritePei: Refine the code to avoid error report.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <[email protected]>
Reviewed-by: Eric Dong <[email protected]>

Modified Paths:
--------------
    
trunk/edk2/MdeModulePkg/Universal/FaultTolerantWritePei/FaultTolerantWritePei.c

Modified: 
trunk/edk2/MdeModulePkg/Universal/FaultTolerantWritePei/FaultTolerantWritePei.c
===================================================================
--- 
trunk/edk2/MdeModulePkg/Universal/FaultTolerantWritePei/FaultTolerantWritePei.c 
    2013-07-10 05:52:58 UTC (rev 14461)
+++ 
trunk/edk2/MdeModulePkg/Universal/FaultTolerantWritePei/FaultTolerantWritePei.c 
    2013-07-11 01:40:10 UTC (rev 14462)
@@ -254,23 +254,26 @@
                  );
     }
 
-    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;

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to