/** @file
Handles non-volatile variable store garbage collection, using FTW
(Fault Tolerant Write) protocol.
Copyright (c) 2006 - 2011, 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
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "Variable.h"
/**
Gets firmware volume block handle by given address.
This function gets firmware volume block handle whose
address range contains the parameter Address.
@param[in] Address Address which should be contained
by returned FVB handle.
@param[out] FvbHandle Pointer to FVB handle for output.
@retval EFI_SUCCESS FVB handle successfully returned.
@retval EFI_NOT_FOUND Failed to find FVB handle by address.
**/
)
{
//
// Locate all handles with Firmware Volume Block protocol
//
NULL,
);
return EFI_NOT_FOUND;
}
//
// Traverse all the handles, searching for the one containing parameter Address
//
);
break;
}
//
// Checks if the address range of this handle contains parameter Address
//
continue;
}
break;
}
}
return Status;
}
/**
Gets LBA of block and offset by given address.
This function gets the Logical Block Address (LBA) of firmware
volume block containing the given address, and the offset of
address on the block.
@param[in] Address Address which should be contained
by returned FVB handle.
@param[out] Lba The pointer to LBA for output.
@param[out] Offset The pointer to offset for output.
@retval EFI_SUCCESS LBA and offset successfully returned.
@retval EFI_NOT_FOUND Failed to find FVB handle by address.
@retval EFI_ABORTED Failed to find valid LBA and offset.
**/
)
{
*Offset = 0;
//
// Gets firmware volume block handle by given address.
//
return Status;
}
);
return Status;
}
//
// Get the Base Address of FV
//
return Status;
}
//
// Get the (LBA, Offset) of Address
//
//
// BUGBUG: Assume one FV has one type of BlockLength
//
//
// Found the (Lba, Offset)
//
return EFI_SUCCESS;
}
}
}
}
return EFI_ABORTED;
}
/**
Writes a buffer to variable storage space.
This function writes a buffer to variable storage space into firmware
volume block device. The destination is specified by parameter
VariableBase. Fault Tolerant Write protocol is used for writing.
@param[in] VariableBase The base address of the variable to write.
@param[in] Buffer Points to the data buffer.
@param[in] BufferSize The number of bytes of the data Buffer.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_NOT_FOUND Fail to locate Fault Tolerant Write protocol.
@retval Other The function could not complete successfully.
**/
)
{
//
// Locate Fault Tolerant Write protocol
//
NULL,
(VOID **) &FtwProtocol
);
return EFI_NOT_FOUND;
}
//
// Gets firmware volume block handle by VariableBase.
//
return Status;
}
//
// Gets LBA of block and offset by VariableBase.
//
return EFI_ABORTED;
}
//
// Prepare for the variable data
//
return EFI_OUT_OF_RESOURCES;
}
//
// FTW write record
//
VarLba, // LBA
VarOffset, // Offset
FtwBufferSize, // NumBytes,
NULL,
);
return Status;
}