This driver installs gEdkiiFaultTolerantWriteGuid PPI to inform\r
the check for FTW last write data has been done.\r
\r
-Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials \r
-are licensed and made available under the terms and conditions of the BSD License \r
-which accompanies this distribution. The full text of the license may be found at \r
-http://opensource.org/licenses/bsd-license.php \r
- \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
+Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution. The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
**/\r
\r
);\r
}\r
\r
- if (!EFI_ERROR (Status) && ((FtwLastWriteRecord->SpareComplete == FTW_VALID_STATE) && (FtwLastWriteRecord->DestinationComplete != FTW_VALID_STATE))) {\r
- //\r
- // If FTW last write was still in progress with SpareComplete set and DestinationComplete not set.\r
- // It means the target buffer has been backed up in spare block, then target block has been erased,\r
- // but the target buffer has not been writen in target block from spare block, we need to build\r
- // FAULT_TOLERANT_WRITE_LAST_WRITE_DATA GUID hob to hold the FTW last write data.\r
- //\r
- FtwLastWrite.TargetAddress = (EFI_PHYSICAL_ADDRESS) (UINTN) ((INT64) SpareAreaAddress + FtwLastWriteRecord->RelativeOffset);\r
- FtwLastWrite.SpareAddress = SpareAreaAddress;\r
- FtwLastWrite.Length = SpareAreaLength;\r
- DEBUG ((\r
- EFI_D_INFO,\r
- "FtwPei last write data: TargetAddress - 0x%x SpareAddress - 0x%x Length - 0x%x\n",\r
- (UINTN) FtwLastWrite.TargetAddress,\r
- (UINTN) FtwLastWrite.SpareAddress,\r
- (UINTN) FtwLastWrite.Length));\r
- BuildGuidDataHob (&gEdkiiFaultTolerantWriteGuid, (VOID *) &FtwLastWrite, sizeof (FAULT_TOLERANT_WRITE_LAST_WRITE_DATA));\r
+ if (!EFI_ERROR (Status)) {\r
+ ASSERT (FtwLastWriteRecord != NULL);\r
+ if ((FtwLastWriteRecord->SpareComplete == FTW_VALID_STATE) && (FtwLastWriteRecord->DestinationComplete != FTW_VALID_STATE)) {\r
+ //\r
+ // If FTW last write was still in progress with SpareComplete set and DestinationComplete not set.\r
+ // It means the target buffer has been backed up in spare block, then target block has been erased,\r
+ // but the target buffer has not been writen in target block from spare block, we need to build\r
+ // FAULT_TOLERANT_WRITE_LAST_WRITE_DATA GUID hob to hold the FTW last write data.\r
+ //\r
+ FtwLastWrite.TargetAddress = (EFI_PHYSICAL_ADDRESS) (UINTN) ((INT64) SpareAreaAddress + FtwLastWriteRecord->RelativeOffset);\r
+ FtwLastWrite.SpareAddress = SpareAreaAddress;\r
+ FtwLastWrite.Length = SpareAreaLength;\r
+ DEBUG ((\r
+ EFI_D_INFO,\r
+ "FtwPei last write data: TargetAddress - 0x%x SpareAddress - 0x%x Length - 0x%x\n",\r
+ (UINTN) FtwLastWrite.TargetAddress,\r
+ (UINTN) FtwLastWrite.SpareAddress,\r
+ (UINTN) FtwLastWrite.Length));\r
+ BuildGuidDataHob (&gEdkiiFaultTolerantWriteGuid, (VOID *) &FtwLastWrite, sizeof (FAULT_TOLERANT_WRITE_LAST_WRITE_DATA));\r
+ }\r
}\r
} else {\r
FtwWorkingBlockHeader = NULL;\r