]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWrite.c
Add more exact SMM check in SmmFaultTolerantWriteHandler.
[mirror_edk2.git] / MdeModulePkg / Universal / FaultTolerantWriteDxe / FaultTolerantWrite.c
index 625737eac018affcae37b9f9e6843d9e93bfc1f7..2f110167d7cc19cc46f89447d757bea0a0f8c859 100644 (file)
@@ -3,7 +3,7 @@
   These are the common Fault Tolerant Write (FTW) functions that are shared \r
   by DXE FTW driver and SMM FTW driver.\r
 \r
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2012, 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
@@ -193,9 +193,12 @@ FtwWriteRecord (
   EFI_FAULT_TOLERANT_WRITE_HEADER *Header;\r
   EFI_FAULT_TOLERANT_WRITE_RECORD *Record;\r
   UINTN                           Offset;\r
+  EFI_LBA                         WorkSpaceLbaOffset;\r
 \r
   FtwDevice = FTW_CONTEXT_FROM_THIS (This);\r
 \r
+  WorkSpaceLbaOffset = FtwDevice->FtwWorkSpaceLba - FtwDevice->FtwWorkBlockLba;\r
+\r
   //\r
   // Spare Complete but Destination not complete,\r
   // Recover the target block with the spare block.\r
@@ -215,7 +218,7 @@ FtwWriteRecord (
     Offset = (UINT8 *) Record - FtwDevice->FtwWorkSpace;\r
     Status = FtwUpdateFvState (\r
               FtwDevice->FtwBackupFvb,\r
-              FtwDevice->FtwWorkSpaceLba,\r
+              FtwDevice->FtwSpareLba + WorkSpaceLbaOffset,\r
               FtwDevice->FtwWorkSpaceBase + Offset,\r
               SPARE_COMPLETED\r
               );\r