From: Star Zeng Date: Fri, 7 Jun 2013 02:38:00 +0000 (+0000) Subject: Use right LBA to get the backed up WorkSpace in spare block. X-Git-Tag: edk2-stable201903~12508 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=0f199272f77504a4bee3466ac331a0e5b0f6605c Use right LBA to get the backed up WorkSpace in spare block. Signed-off-by: Star Zeng Reviewed-by: Liming Gao git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14398 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FtwMisc.c b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FtwMisc.c index c5f41d7378..2e4052c1ea 100644 --- a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FtwMisc.c +++ b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FtwMisc.c @@ -2,7 +2,7 @@ Internal generic functions to operate flash block. -Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.
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 @@ -411,7 +411,7 @@ FlushSpareBlockToBootBlock ( return EFI_ABORTED; } // - // Write memory buffer currenet spare block. Still top block. + // Write memory buffer to current spare block. Still top block. // Ptr = Buffer; for (Index = 0; Index < FtwDevice->NumberOfSpareBlock; Index += 1) { @@ -1147,6 +1147,7 @@ InitFtwProtocol ( EFI_FAULT_TOLERANT_WRITE_HEADER *FtwHeader; UINTN Offset; EFI_HANDLE FvbHandle; + EFI_LBA WorkSpaceLbaOffset; // // Find the right SMM Fvb protocol instance for FTW. @@ -1188,10 +1189,11 @@ InitFtwProtocol ( // // Read from spare block // + WorkSpaceLbaOffset = FtwDevice->FtwWorkSpaceLba - FtwDevice->FtwWorkBlockLba; Length = FtwDevice->FtwWorkSpaceSize; Status = FtwDevice->FtwBackupFvb->Read ( FtwDevice->FtwBackupFvb, - FtwDevice->FtwSpareLba, + FtwDevice->FtwSpareLba + WorkSpaceLbaOffset, FtwDevice->FtwWorkSpaceBase, &Length, FtwDevice->FtwWorkSpace