]> git.proxmox.com Git - mirror_edk2.git/blobdiff - SecurityPkg/VariableAuthenticated/RuntimeDxe/Reclaim.c
SecurityPkg: Delete Auth Variable driver
[mirror_edk2.git] / SecurityPkg / VariableAuthenticated / RuntimeDxe / Reclaim.c
diff --git a/SecurityPkg/VariableAuthenticated/RuntimeDxe/Reclaim.c b/SecurityPkg/VariableAuthenticated/RuntimeDxe/Reclaim.c
deleted file mode 100644 (file)
index d79cd36..0000000
+++ /dev/null
@@ -1,161 +0,0 @@
-/** @file\r
-  Handles non-volatile variable store garbage collection, using FTW\r
-  (Fault Tolerant Write) protocol.\r
-\r
-Copyright (c) 2009 - 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
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#include "Variable.h"\r
-\r
-/**\r
-  Gets LBA of block and offset by given address.\r
-\r
-  This function gets the Logical Block Address (LBA) of a firmware\r
-  volume block containing the given address, and the offset of the\r
-  address on the block.\r
-\r
-  @param  Address        Address which should be contained\r
-                         by returned FVB handle.\r
-  @param  Lba            Pointer to LBA for output.\r
-  @param  Offset         Pointer to offset for output.\r
-\r
-  @retval EFI_SUCCESS    LBA and offset successfully returned.\r
-  @retval EFI_NOT_FOUND  Fail to find FVB handle by address.\r
-  @retval EFI_ABORTED    Fail to find valid LBA and offset.\r
-\r
-**/\r
-EFI_STATUS\r
-GetLbaAndOffsetByAddress (\r
-  IN  EFI_PHYSICAL_ADDRESS   Address,\r
-  OUT EFI_LBA                *Lba,\r
-  OUT UINTN                  *Offset\r
-  )\r
-{\r
-  EFI_STATUS                          Status;\r
-  EFI_PHYSICAL_ADDRESS                FvbBaseAddress;\r
-  EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL  *Fvb;\r
-  EFI_FIRMWARE_VOLUME_HEADER          *FwVolHeader;\r
-  EFI_FV_BLOCK_MAP_ENTRY              *FvbMapEntry;\r
-  UINT32                              LbaIndex;\r
-\r
-  *Lba    = (EFI_LBA) (-1);\r
-  *Offset = 0;\r
-  Fvb = NULL;\r
-\r
-  //\r
-  // Get the proper FVB protocol.\r
-  //\r
-  Status = GetFvbInfoByAddress (Address, NULL, &Fvb);\r
-  if (EFI_ERROR (Status)) {\r
-    return Status;\r
-  }\r
-\r
-  //\r
-  // Get the Base Address of FV.\r
-  //\r
-  Status = Fvb->GetPhysicalAddress (Fvb, &FvbBaseAddress);\r
-  if (EFI_ERROR (Status)) {\r
-    return Status;\r
-  }\r
-\r
-  FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *) ((UINTN) FvbBaseAddress);\r
-\r
-  //\r
-  // Get the (LBA, Offset) of Address.\r
-  //\r
-  if ((FwVolHeader->FvLength) > (FwVolHeader->HeaderLength)) {\r
-    //\r
-    // BUGBUG: Assume one FV has one type of BlockLength.\r
-    //\r
-    FvbMapEntry = &FwVolHeader->BlockMap[0];\r
-    for (LbaIndex = 1; LbaIndex <= FvbMapEntry->NumBlocks; LbaIndex += 1) {\r
-      if (Address < (FvbBaseAddress + FvbMapEntry->Length * LbaIndex)) {\r
-        //\r
-        // Found the (Lba, Offset).\r
-        //\r
-        *Lba    = LbaIndex - 1;\r
-        *Offset = (UINTN) (Address - (FvbBaseAddress + FvbMapEntry->Length * (LbaIndex - 1)));\r
-        return EFI_SUCCESS;\r
-     }\r
-    }\r
-  }\r
-\r
-  return EFI_ABORTED;\r
-}\r
-\r
-/**\r
-  Writes a buffer to variable storage space, in the working block.\r
-\r
-  This function writes a buffer to variable storage space into a firmware\r
-  volume block device. The destination is specified by parameter\r
-  VariableBase. Fault Tolerant Write protocol is used for writing.\r
-\r
-  @param  VariableBase   Base address of variable to write\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
-  @retval EFI_ABORTED    The function could not complete successfully.\r
-\r
-**/\r
-EFI_STATUS\r
-FtwVariableSpace (\r
-  IN EFI_PHYSICAL_ADDRESS   VariableBase,\r
-  IN VARIABLE_STORE_HEADER  *VariableBuffer\r
-  )\r
-{\r
-  EFI_STATUS                         Status;\r
-  EFI_HANDLE                         FvbHandle;\r
-  EFI_LBA                            VarLba;\r
-  UINTN                              VarOffset;\r
-  UINTN                              FtwBufferSize;\r
-  EFI_FAULT_TOLERANT_WRITE_PROTOCOL  *FtwProtocol;\r
-\r
-  //\r
-  // Locate fault tolerant write protocol.\r
-  //\r
-  Status = GetFtwProtocol((VOID **) &FtwProtocol);\r
-  if (EFI_ERROR (Status)) {\r
-    return EFI_NOT_FOUND;\r
-  }\r
-  //\r
-  // Locate Fvb handle by address.\r
-  //\r
-  Status = GetFvbInfoByAddress (VariableBase, &FvbHandle, NULL);\r
-  if (EFI_ERROR (Status)) {\r
-    return Status;\r
-  }\r
-  //\r
-  // Get LBA and Offset by address.\r
-  //\r
-  Status = GetLbaAndOffsetByAddress (VariableBase, &VarLba, &VarOffset);\r
-  if (EFI_ERROR (Status)) {\r
-    return EFI_ABORTED;\r
-  }\r
-\r
-  FtwBufferSize = ((VARIABLE_STORE_HEADER *) ((UINTN) VariableBase))->Size;\r
-  ASSERT (FtwBufferSize == VariableBuffer->Size);\r
-\r
-  //\r
-  // FTW write record.\r
-  //\r
-  Status = FtwProtocol->Write (\r
-                          FtwProtocol,\r
-                          VarLba,         // LBA\r
-                          VarOffset,      // Offset\r
-                          FtwBufferSize,  // NumBytes\r
-                          NULL,           // PrivateData NULL\r
-                          FvbHandle,      // Fvb Handle\r
-                          (VOID *) VariableBuffer // write buffer\r
-                          );\r
-\r
-  return Status;\r
-}\r