MdeModulePkg: Variable drivers robustly handle crashes during Reclaim().
PEI variable implementation checks only the variable header signature for validity. This does not seem robust if system crash occurred during previous Reclaim() operation. If the crash occurred while FTW was rewriting the variable FV, the signature could be valid even though the rest of the FV isn't valid. Solution: Add a FaultTolerantWritePei driver to check and provide the FTW last write status, then PEI variable and early phase(before FTW protocol ready) of DXE variable can check the status and determine if all or partial variable data has been backed up in spare block, and then use the backed up data. Contributed-under: TianoCore Contribution Agreement 1.0 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@14454 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
Internal functions to operate Working Block Space.
|
||||
|
||||
Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2006 - 2013, 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
|
||||
@@ -32,9 +32,9 @@ InitializeLocalWorkSpaceHeader (
|
||||
EFI_STATUS Status;
|
||||
|
||||
//
|
||||
// Check signature with gEfiSystemNvDataFvGuid.
|
||||
// Check signature with gEdkiiWorkingBlockSignatureGuid.
|
||||
//
|
||||
if (CompareGuid (&gEfiSystemNvDataFvGuid, &mWorkingBlockHeader.Signature)) {
|
||||
if (CompareGuid (&gEdkiiWorkingBlockSignatureGuid, &mWorkingBlockHeader.Signature)) {
|
||||
//
|
||||
// The local work space header has been initialized.
|
||||
//
|
||||
@@ -48,11 +48,11 @@ InitializeLocalWorkSpaceHeader (
|
||||
);
|
||||
|
||||
//
|
||||
// Here using gEfiSystemNvDataFvGuid as the signature.
|
||||
// Here using gEdkiiWorkingBlockSignatureGuid as the signature.
|
||||
//
|
||||
CopyMem (
|
||||
&mWorkingBlockHeader.Signature,
|
||||
&gEfiSystemNvDataFvGuid,
|
||||
&gEdkiiWorkingBlockSignatureGuid,
|
||||
sizeof (EFI_GUID)
|
||||
);
|
||||
mWorkingBlockHeader.WriteQueueSize = (UINT64) (PcdGet32 (PcdFlashNvStorageFtwWorkingSize) - sizeof (EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER));
|
||||
@@ -322,7 +322,7 @@ FtwReclaimWorkSpace (
|
||||
CopyMem (
|
||||
Ptr + sizeof (EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER),
|
||||
FtwDevice->FtwLastWriteHeader,
|
||||
WRITE_TOTAL_SIZE (Header->NumberOfWrites, Header->PrivateDataSize)
|
||||
FTW_WRITE_TOTAL_SIZE (Header->NumberOfWrites, Header->PrivateDataSize)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user