Firmware Block Services to support emulating non-volatile variables\r
by pretending that a memory buffer is storage for the NV variables.\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
0,\r
\r
// UINT8 Reserved[1];\r
- 0,\r
+ {0},\r
\r
// UINT8 Revision;\r
EFI_FVH_REVISION,\r
\r
// EFI_FV_BLOCK_MAP_ENTRY BlockMap[1];\r
- { 2, // UINT32 NumBlocks;\r
- EMU_FVB_BLOCK_SIZE // UINT32 Length;\r
+ { \r
+ {\r
+ 2, // UINT32 NumBlocks;\r
+ EMU_FVB_BLOCK_SIZE // UINT32 Length;\r
+ }\r
}\r
},\r
// EFI_FV_BLOCK_MAP_ENTRY EndBlockMap;\r
0,\r
\r
// UINT8 Reserved[1];\r
- 0,\r
+ {0},\r
\r
// UINT8 Revision;\r
EFI_FVH_REVISION,\r
\r
// EFI_FV_BLOCK_MAP_ENTRY BlockMap[1];\r
- { 2, // UINT32 NumBlocks;\r
- EMU_FVB_BLOCK_SIZE // UINT32 Length;\r
+ {\r
+ {\r
+ 2, // UINT32 NumBlocks;\r
+ EMU_FVB_BLOCK_SIZE // UINT32 Length;\r
+ }\r
}\r
},\r
// EFI_FV_BLOCK_MAP_ENTRY EndBlockMap;\r
Fv->Checksum = CalculateCheckSum16 (Ptr, Fv->HeaderLength);\r
}\r
\r
-\r
-/**\r
- Initializes the Fault Tolerant Write data structure\r
-\r
- This data structure is used by the Fault Tolerant Write driver.\r
-\r
- @param[in] Buffer - Location for the FTW data structure\r
-\r
-**/\r
-VOID\r
-InitializeFtwState (\r
- IN VOID *Buffer\r
- )\r
-{\r
- EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER *Hdr;\r
- UINT32 TempCrc;\r
- STATIC EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER DefaultFtw = {\r
- EFI_SYSTEM_NV_DATA_FV_GUID, // EFI_GUID Signature;\r
- ERASED_UINT32, // UINT32 Crc;\r
- ERASED_BIT, // UINT8 WorkingBlockValid : 1;\r
- ERASED_BIT, // UINT8 WorkingBlockInvalid : 1;\r
- 0, // UINT8 Reserved : 6;\r
- { 0, 0, 0 }, // UINT8 Reserved3[3];\r
- FTW_WRITE_QUEUE_SIZE // UINT64 WriteQueueSize;\r
- };\r
-\r
- CopyMem (Buffer, (VOID*) &DefaultFtw, sizeof (DefaultFtw));\r
-\r
- Hdr = (EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER*) Buffer;\r
-\r
- //\r
- // Calculate checksum.\r
- //\r
- // The Crc, WorkingBlockValid and WorkingBlockInvalid bits should\r
- // be set to the erased state before computing the checksum.\r
- //\r
- gBS->CalculateCrc32 (Buffer, sizeof (DefaultFtw), &TempCrc);\r
- Hdr->Crc = TempCrc;\r
-\r
- //\r
- // Mark as valid.\r
- //\r
- Hdr->WorkingBlockValid = NOT_ERASED_BIT;\r
-}\r
-\r
-\r
/**\r
Main entry point.\r
\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
+ if (PcdGet64 (PcdFlashNvStorageVariableBase64) != 0) {\r
+ DEBUG ((EFI_D_INFO, "Disabling EMU Variable FVB since "\r
+ "flash variables appear to be supported.\n"));\r
+ return EFI_ABORTED;\r
+ }\r
+\r
//\r
// By default we will initialize the FV contents. But, if\r
// PcdEmuVariableNvStoreReserved is non-zero, then we will\r
// Initialize the Fault Tolerant Write data area\r
//\r
SubPtr = (VOID*) ((UINT8*) Ptr + PcdGet32 (PcdVariableStoreSize));\r
- if (Initialize) {\r
- InitializeFtwState (SubPtr);\r
- }\r
PcdSet32 (PcdFlashNvStorageFtwWorkingBase, (UINT32)(UINTN) SubPtr);\r
\r
//\r