Handles non-volatile variable store garbage collection, using FTW\r
(Fault Tolerant Write) protocol.\r
\r
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2014, 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
EFI_FV_BLOCK_MAP_ENTRY *FvbMapEntry;\r
UINT32 LbaIndex;\r
\r
+ Fvb = NULL;\r
*Lba = (EFI_LBA) (-1);\r
*Offset = 0;\r
\r
VariableBase. Fault Tolerant Write protocol is used for writing.\r
\r
@param VariableBase Base address of variable to write\r
- @param Buffer Point to the data buffer.\r
- @param BufferSize The number of bytes of the data Buffer.\r
+ @param VariableBuffer Point to the variable data buffer.\r
\r
@retval EFI_SUCCESS The function completed successfully.\r
@retval EFI_NOT_FOUND Fail to locate Fault Tolerant Write protocol.\r
EFI_STATUS\r
FtwVariableSpace (\r
IN EFI_PHYSICAL_ADDRESS VariableBase,\r
- IN UINT8 *Buffer,\r
- IN UINTN BufferSize\r
+ IN VARIABLE_STORE_HEADER *VariableBuffer\r
)\r
{\r
EFI_STATUS Status;\r
EFI_HANDLE FvbHandle;\r
EFI_LBA VarLba;\r
UINTN VarOffset;\r
- UINT8 *FtwBuffer;\r
UINTN FtwBufferSize;\r
EFI_FAULT_TOLERANT_WRITE_PROTOCOL *FtwProtocol;\r
\r
if (EFI_ERROR (Status)) {\r
return EFI_ABORTED;\r
}\r
- //\r
- // Prepare for the variable data.\r
- //\r
- FtwBufferSize = ((VARIABLE_STORE_HEADER *) ((UINTN) VariableBase))->Size;\r
- FtwBuffer = AllocatePool (FtwBufferSize);\r
- if (FtwBuffer == NULL) {\r
- return EFI_OUT_OF_RESOURCES;\r
- }\r
\r
- SetMem (FtwBuffer, FtwBufferSize, (UINT8) 0xff);\r
- CopyMem (FtwBuffer, Buffer, BufferSize);\r
+ FtwBufferSize = ((VARIABLE_STORE_HEADER *) ((UINTN) VariableBase))->Size;\r
+ ASSERT (FtwBufferSize == VariableBuffer->Size);\r
\r
//\r
// FTW write record.\r
FtwBufferSize, // NumBytes\r
NULL, // PrivateData NULL\r
FvbHandle, // Fvb Handle\r
- FtwBuffer // write buffer\r
+ (VOID *) VariableBuffer // write buffer\r
);\r
\r
- FreePool (FtwBuffer);\r
return Status;\r
}\r