Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14398
6f19259b-4bc3-4df7-8a09-
765794883524
\r
Internal generic functions to operate flash block.\r
\r
\r
Internal generic functions to operate flash block.\r
\r
-Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 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
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
return EFI_ABORTED;\r
}\r
//\r
return EFI_ABORTED;\r
}\r
//\r
- // Write memory buffer currenet spare block. Still top block.\r
+ // Write memory buffer to current spare block. Still top block.\r
//\r
Ptr = Buffer;\r
for (Index = 0; Index < FtwDevice->NumberOfSpareBlock; Index += 1) {\r
//\r
Ptr = Buffer;\r
for (Index = 0; Index < FtwDevice->NumberOfSpareBlock; Index += 1) {\r
EFI_FAULT_TOLERANT_WRITE_HEADER *FtwHeader;\r
UINTN Offset;\r
EFI_HANDLE FvbHandle;\r
EFI_FAULT_TOLERANT_WRITE_HEADER *FtwHeader;\r
UINTN Offset;\r
EFI_HANDLE FvbHandle;\r
+ EFI_LBA WorkSpaceLbaOffset;\r
\r
//\r
// Find the right SMM Fvb protocol instance for FTW.\r
\r
//\r
// Find the right SMM Fvb protocol instance for FTW.\r
//\r
// Read from spare block\r
//\r
//\r
// Read from spare block\r
//\r
+ WorkSpaceLbaOffset = FtwDevice->FtwWorkSpaceLba - FtwDevice->FtwWorkBlockLba;\r
Length = FtwDevice->FtwWorkSpaceSize;\r
Status = FtwDevice->FtwBackupFvb->Read (\r
FtwDevice->FtwBackupFvb,\r
Length = FtwDevice->FtwWorkSpaceSize;\r
Status = FtwDevice->FtwBackupFvb->Read (\r
FtwDevice->FtwBackupFvb,\r
- FtwDevice->FtwSpareLba,\r
+ FtwDevice->FtwSpareLba + WorkSpaceLbaOffset,\r
FtwDevice->FtwWorkSpaceBase,\r
&Length,\r
FtwDevice->FtwWorkSpace\r
FtwDevice->FtwWorkSpaceBase,\r
&Length,\r
FtwDevice->FtwWorkSpace\r