summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWrite.c
diff options
context:
space:
mode:
authorlzeng14 <lzeng14@6f19259b-4bc3-4df7-8a09-765794883524>2012-09-14 06:54:35 +0000
committerlzeng14 <lzeng14@6f19259b-4bc3-4df7-8a09-765794883524>2012-09-14 06:54:35 +0000
commitd26c7e82f2bf80dd2a64b61fee33a3f3f5e01d5a (patch)
treeb6fd1300299f4041b03861ead824d9a5b19ccf6d /MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWrite.c
parent42ed76042a117057d819218164dd9cddff1ae7a0 (diff)
downloadedk2-platforms-d26c7e82f2bf80dd2a64b61fee33a3f3f5e01d5a.tar.xz
Fix the issue that FTW driver fail to reclaim WorkSpace.
Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Hengyan Tao <hengyan.tao@intel.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13732 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWrite.c')
-rw-r--r--MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWrite.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWrite.c b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWrite.c
index 625737eac0..2f110167d7 100644
--- a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWrite.c
+++ b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWrite.c
@@ -3,7 +3,7 @@
These are the common Fault Tolerant Write (FTW) functions that are shared
by DXE FTW driver and SMM FTW driver.
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -193,9 +193,12 @@ FtwWriteRecord (
EFI_FAULT_TOLERANT_WRITE_HEADER *Header;
EFI_FAULT_TOLERANT_WRITE_RECORD *Record;
UINTN Offset;
+ EFI_LBA WorkSpaceLbaOffset;
FtwDevice = FTW_CONTEXT_FROM_THIS (This);
+ WorkSpaceLbaOffset = FtwDevice->FtwWorkSpaceLba - FtwDevice->FtwWorkBlockLba;
+
//
// Spare Complete but Destination not complete,
// Recover the target block with the spare block.
@@ -215,7 +218,7 @@ FtwWriteRecord (
Offset = (UINT8 *) Record - FtwDevice->FtwWorkSpace;
Status = FtwUpdateFvState (
FtwDevice->FtwBackupFvb,
- FtwDevice->FtwWorkSpaceLba,
+ FtwDevice->FtwSpareLba + WorkSpaceLbaOffset,
FtwDevice->FtwWorkSpaceBase + Offset,
SPARE_COMPLETED
);