summaryrefslogtreecommitdiff
path: root/SecurityPkg/VariableAuthenticated/RuntimeDxe/Reclaim.c
diff options
context:
space:
mode:
authorStar Zeng <star.zeng@intel.com>2015-07-01 03:13:02 +0000
committerlzeng14 <lzeng14@Edk2>2015-07-01 03:13:02 +0000
commit7ae77cee9627f417b3bbcc3334d3823ff248a3f5 (patch)
tree2dabbab3cf728ec0d129584fa1f55b3640b12ddb /SecurityPkg/VariableAuthenticated/RuntimeDxe/Reclaim.c
parent0b8c5cd4e6b5c7148d2d6c018fc359e0146ca3a9 (diff)
downloadedk2-platforms-7ae77cee9627f417b3bbcc3334d3823ff248a3f5.tar.xz
SecurityPkg: Delete Auth Variable driver
1. Delete TpmMeasurementLib LibraryClass from SecurityPkg after it moved to MdeModulePkg. 2. Update DxeTpmMeasurementLib.inf to include MdeModulePkg.dec. 3. Delete authenticated variable definition from AuthenticatedVariableFormat.h after them moved to VariableFormat.h. 4. Replace VARIABLE_HEADER with AUTHENTICATED_VARIABLE_HEADER in EsalVariableDxeSal. 5. Delete VariableInfo from SecurityPkg after it merged to VariableInfo in MdeModulePkg. 6. Delete VariablePei from SecurityPkg after it merged to VariablePei in MdeModulePkg. 7. Delete Auth Variable driver from SecurityPkg after it merged to Variable driver in MdeModulePkg. 8. Also update PACKAGE_GUID and PACKAGE_VERSION in SecurityPkg.dec after the deletion of authenticated variable definition, VariableInfo, VariablePei and Auth Variable driver from SecurityPkg; update PLATFORM_VERSION in SecurityPkg.dsc. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17772 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'SecurityPkg/VariableAuthenticated/RuntimeDxe/Reclaim.c')
-rw-r--r--SecurityPkg/VariableAuthenticated/RuntimeDxe/Reclaim.c161
1 files changed, 0 insertions, 161 deletions
diff --git a/SecurityPkg/VariableAuthenticated/RuntimeDxe/Reclaim.c b/SecurityPkg/VariableAuthenticated/RuntimeDxe/Reclaim.c
deleted file mode 100644
index d79cd36b0d..0000000000
--- a/SecurityPkg/VariableAuthenticated/RuntimeDxe/Reclaim.c
+++ /dev/null
@@ -1,161 +0,0 @@
-/** @file
- Handles non-volatile variable store garbage collection, using FTW
- (Fault Tolerant Write) protocol.
-
-Copyright (c) 2009 - 2014, 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
-http://opensource.org/licenses/bsd-license.php
-
-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 LBA of block and offset by given address.
-
- This function gets the Logical Block Address (LBA) of a firmware
- volume block containing the given address, and the offset of the
- address on the block.
-
- @param Address Address which should be contained
- by returned FVB handle.
- @param Lba Pointer to LBA for output.
- @param Offset Pointer to offset for output.
-
- @retval EFI_SUCCESS LBA and offset successfully returned.
- @retval EFI_NOT_FOUND Fail to find FVB handle by address.
- @retval EFI_ABORTED Fail to find valid LBA and offset.
-
-**/
-EFI_STATUS
-GetLbaAndOffsetByAddress (
- IN EFI_PHYSICAL_ADDRESS Address,
- OUT EFI_LBA *Lba,
- OUT UINTN *Offset
- )
-{
- EFI_STATUS Status;
- EFI_PHYSICAL_ADDRESS FvbBaseAddress;
- EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb;
- EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader;
- EFI_FV_BLOCK_MAP_ENTRY *FvbMapEntry;
- UINT32 LbaIndex;
-
- *Lba = (EFI_LBA) (-1);
- *Offset = 0;
- Fvb = NULL;
-
- //
- // Get the proper FVB protocol.
- //
- Status = GetFvbInfoByAddress (Address, NULL, &Fvb);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Get the Base Address of FV.
- //
- Status = Fvb->GetPhysicalAddress (Fvb, &FvbBaseAddress);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *) ((UINTN) FvbBaseAddress);
-
- //
- // Get the (LBA, Offset) of Address.
- //
- if ((FwVolHeader->FvLength) > (FwVolHeader->HeaderLength)) {
- //
- // BUGBUG: Assume one FV has one type of BlockLength.
- //
- FvbMapEntry = &FwVolHeader->BlockMap[0];
- for (LbaIndex = 1; LbaIndex <= FvbMapEntry->NumBlocks; LbaIndex += 1) {
- if (Address < (FvbBaseAddress + FvbMapEntry->Length * LbaIndex)) {
- //
- // Found the (Lba, Offset).
- //
- *Lba = LbaIndex - 1;
- *Offset = (UINTN) (Address - (FvbBaseAddress + FvbMapEntry->Length * (LbaIndex - 1)));
- return EFI_SUCCESS;
- }
- }
- }
-
- return EFI_ABORTED;
-}
-
-/**
- Writes a buffer to variable storage space, in the working block.
-
- This function writes a buffer to variable storage space into a firmware
- volume block device. The destination is specified by parameter
- VariableBase. Fault Tolerant Write protocol is used for writing.
-
- @param VariableBase Base address of variable to write
- @param VariableBuffer Point to the variable data buffer.
-
- @retval EFI_SUCCESS The function completed successfully.
- @retval EFI_NOT_FOUND Fail to locate Fault Tolerant Write protocol.
- @retval EFI_ABORTED The function could not complete successfully.
-
-**/
-EFI_STATUS
-FtwVariableSpace (
- IN EFI_PHYSICAL_ADDRESS VariableBase,
- IN VARIABLE_STORE_HEADER *VariableBuffer
- )
-{
- EFI_STATUS Status;
- EFI_HANDLE FvbHandle;
- EFI_LBA VarLba;
- UINTN VarOffset;
- UINTN FtwBufferSize;
- EFI_FAULT_TOLERANT_WRITE_PROTOCOL *FtwProtocol;
-
- //
- // Locate fault tolerant write protocol.
- //
- Status = GetFtwProtocol((VOID **) &FtwProtocol);
- if (EFI_ERROR (Status)) {
- return EFI_NOT_FOUND;
- }
- //
- // Locate Fvb handle by address.
- //
- Status = GetFvbInfoByAddress (VariableBase, &FvbHandle, NULL);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Get LBA and Offset by address.
- //
- Status = GetLbaAndOffsetByAddress (VariableBase, &VarLba, &VarOffset);
- if (EFI_ERROR (Status)) {
- return EFI_ABORTED;
- }
-
- FtwBufferSize = ((VARIABLE_STORE_HEADER *) ((UINTN) VariableBase))->Size;
- ASSERT (FtwBufferSize == VariableBuffer->Size);
-
- //
- // FTW write record.
- //
- Status = FtwProtocol->Write (
- FtwProtocol,
- VarLba, // LBA
- VarOffset, // Offset
- FtwBufferSize, // NumBytes
- NULL, // PrivateData NULL
- FvbHandle, // Fvb Handle
- (VOID *) VariableBuffer // write buffer
- );
-
- return Status;
-}