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
This commit is contained in:
lzeng14
2012-09-14 06:54:35 +00:00
parent 42ed76042a
commit d26c7e82f2
4 changed files with 31 additions and 20 deletions

View File

@ -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
);