diff options
author | Star Zeng <star.zeng@intel.com> | 2013-07-03 09:08:40 +0000 |
---|---|---|
committer | lzeng14 <lzeng14@6f19259b-4bc3-4df7-8a09-765794883524> | 2013-07-03 09:08:40 +0000 |
commit | 3e02ebb2bbe0fd4da880511b1f35951e1c4b8404 (patch) | |
tree | 95fc155e9d76e163cd295db373734cc276f4abc6 /MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWrite.h | |
parent | 70066a82a54bd5136556dff3ea76dff035a3aca3 (diff) | |
download | edk2-3e02ebb2bbe0fd4da880511b1f35951e1c4b8404.zip edk2-3e02ebb2bbe0fd4da880511b1f35951e1c4b8404.tar.gz edk2-3e02ebb2bbe0fd4da880511b1f35951e1c4b8404.tar.bz2 |
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
Diffstat (limited to 'MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWrite.h')
-rw-r--r-- | MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWrite.h | 44 |
1 files changed, 1 insertions, 43 deletions
diff --git a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWrite.h b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWrite.h index 8deae88..78c65f2 100644 --- a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWrite.h +++ b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWrite.h @@ -3,7 +3,7 @@ The internal header file includes the common header files, defines
internal structure and functions used by FtwLite module.
-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
@@ -38,59 +38,17 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. //
#define FTW_ERASE_POLARITY 1
-#define FTW_VALID_STATE 0
-#define FTW_INVALID_STATE 1
-
#define FTW_ERASED_BYTE ((UINT8) (255))
#define FTW_POLARITY_REVERT ((UINT8) (255))
-//
-// EFI Fault tolerant block update write queue entry
-//
-typedef struct {
- UINT8 HeaderAllocated : 1;
- UINT8 WritesAllocated : 1;
- UINT8 Complete : 1;
#define HEADER_ALLOCATED 0x1
#define WRITES_ALLOCATED 0x2
#define WRITES_COMPLETED 0x4
- UINT8 Reserved : 5;
- EFI_GUID CallerId;
- UINTN NumberOfWrites;
- UINTN PrivateDataSize;
-} EFI_FAULT_TOLERANT_WRITE_HEADER;
-//
-// EFI Fault tolerant block update write queue record
-//
-typedef struct {
- UINT8 BootBlockUpdate : 1;
- UINT8 SpareComplete : 1;
- UINT8 DestinationComplete : 1;
#define BOOT_BLOCK_UPDATE 0x1
#define SPARE_COMPLETED 0x2
#define DEST_COMPLETED 0x4
- UINT8 Reserved : 5;
- EFI_LBA Lba;
- UINTN Offset;
- UINTN Length;
- EFI_PHYSICAL_ADDRESS FvBaseAddress;
- //
- // UINT8 PrivateData[PrivateDataSize]
- //
-} EFI_FAULT_TOLERANT_WRITE_RECORD;
-
-
-#define RECORD_SIZE(PrivateDataSize) (sizeof (EFI_FAULT_TOLERANT_WRITE_RECORD) + PrivateDataSize)
-
-#define RECORD_TOTAL_SIZE(NumberOfWrites, PrivateDataSize) \
- ((NumberOfWrites) * (sizeof (EFI_FAULT_TOLERANT_WRITE_RECORD) + PrivateDataSize))
-#define WRITE_TOTAL_SIZE(NumberOfWrites, PrivateDataSize) \
- ( \
- sizeof (EFI_FAULT_TOLERANT_WRITE_HEADER) + (NumberOfWrites) * \
- (sizeof (EFI_FAULT_TOLERANT_WRITE_RECORD) + PrivateDataSize) \
- )
#define FTW_DEVICE_SIGNATURE SIGNATURE_32 ('F', 'T', 'W', 'D')
|