]> git.proxmox.com Git - mirror_edk2.git/blobdiff - DuetPkg/FvbRuntimeService/FWBlockService.c
Update the copyright notice format
[mirror_edk2.git] / DuetPkg / FvbRuntimeService / FWBlockService.c
index faca5ea4227cfd1d8eea9bb0dfdfe76c83e4d3cc..e0ddbd53121bf59a6685b93666db166dd9bfa2be 100644 (file)
@@ -1,6 +1,6 @@
 /**@file\r
-Copyright (c) 2007, Intel Corporation                                                         \r
-All rights reserved. This program and the accompanying materials                          \r
+Copyright (c) 2007 - 2009, 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
@@ -61,9 +61,6 @@ EFI_FW_VOL_BLOCK_DEVICE mFvbDeviceTemplate = {
     FvbProtocolWrite,\r
     FvbProtocolEraseBlocks,\r
     NULL\r
-  },\r
-  {\r
-    FvbExtendProtocolEraseCustomBlockRange\r
   }\r
 };\r
 \r
@@ -86,11 +83,11 @@ Returns:
 \r
 --*/\r
 {\r
-  EFI_STATUS  Status;\r
-  EFI_FILE    *File;\r
-  UINTN       FileOffset;\r
-  UINTN       BufferForFile;\r
-  UINTN       Length;\r
+  EFI_STATUS          Status;\r
+  EFI_FILE_PROTOCOL   *File;\r
+  UINTN               FileOffset;\r
+  UINTN               BufferForFile;\r
+  UINTN               Length;\r
 \r
   Status = EFI_SUCCESS;\r
   CopyMem ((VOID *) Address, Buffer, *NumBytes);\r
@@ -134,11 +131,11 @@ Returns:
 \r
 --*/\r
 {\r
-  EFI_STATUS  Status;\r
-  EFI_FILE    *File;\r
-  UINTN       FileOffset;\r
-  UINTN       BufferForFile;\r
-  UINTN       Length;\r
+  EFI_STATUS           Status;\r
+  EFI_FILE_PROTOCOL    *File;\r
+  UINTN                FileOffset;\r
+  UINTN                BufferForFile;\r
+  UINTN                Length;\r
 \r
   Status = EFI_SUCCESS;\r
 \r
@@ -700,99 +697,6 @@ Returns:
           );\r
 }\r
 \r
-EFI_STATUS\r
-FvbEraseCustomBlockRange (\r
-  IN UINTN                                Instance,\r
-  IN EFI_LBA                              StartLba,\r
-  IN UINTN                                OffsetStartLba,\r
-  IN EFI_LBA                              LastLba,\r
-  IN UINTN                                OffsetLastLba,\r
-  IN ESAL_FWB_GLOBAL                      *Global,\r
-  IN BOOLEAN                              Virtual\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-  Erases and initializes a specified range of a firmware volume\r
-\r
-Arguments:\r
-  Instance              - The FV instance to be erased\r
-  StartLba              - The starting logical block index to be erased\r
-  OffsetStartLba        - Offset into the starting block at which to \r
-                          begin erasing\r
-  LastLba               - The last logical block index to be erased\r
-  OffsetStartLba        - Offset into the last block at which to end erasing\r
-  Global                - Pointer to ESAL_FWB_GLOBAL that contains all\r
-                          instance data\r
-  Virtual               - Whether CPU is in virtual or physical mode\r
-\r
-Returns: \r
-  EFI_SUCCESS           - The firmware volume was erased successfully\r
-  EFI_ACCESS_DENIED     - The firmware volume is in the WriteDisabled state\r
-  EFI_DEVICE_ERROR      - The block device is not functioning correctly and \r
-                          could not be written. Firmware device may have been\r
-                          partially erased\r
-  EFI_INVALID_PARAMETER - Instance not found\r
-\r
---*/\r
-{\r
-  EFI_LBA Index;\r
-  UINTN   LbaSize;\r
-  UINTN   ScratchLbaSizeData;\r
-\r
-  //\r
-  // First LBA.\r
-  //\r
-  FvbGetLbaAddress (Instance, StartLba, NULL, &LbaSize, NULL, Global, Virtual);\r
-\r
-  //\r
-  // Use the scratch space as the intermediate buffer to transfer data\r
-  // Back up the first LBA in scratch space.\r
-  //\r
-  FvbReadBlock (Instance, StartLba, 0, &LbaSize, Global->FvbScratchSpace[Virtual], Global, Virtual);\r
-\r
-  //\r
-  // erase now\r
-  //\r
-  FvbEraseBlock (Instance, StartLba, Global, Virtual);\r
-  ScratchLbaSizeData = OffsetStartLba;\r
-\r
-  //\r
-  // write the data back to the first block\r
-  //\r
-  if (ScratchLbaSizeData > 0) {\r
-    FvbWriteBlock (Instance, StartLba, 0, &ScratchLbaSizeData, Global->FvbScratchSpace[Virtual], Global, Virtual);\r
-  }\r
-  //\r
-  // Middle LBAs\r
-  //\r
-  if (LastLba > (StartLba + 1)) {\r
-    for (Index = (StartLba + 1); Index <= (LastLba - 1); Index++) {\r
-      FvbEraseBlock (Instance, Index, Global, Virtual);\r
-    }\r
-  }\r
-  //\r
-  // Last LBAs, the same as first LBAs\r
-  //\r
-  if (LastLba > StartLba) {\r
-    FvbGetLbaAddress (Instance, LastLba, NULL, &LbaSize, NULL, Global, Virtual);\r
-    FvbReadBlock (Instance, LastLba, 0, &LbaSize, Global->FvbScratchSpace[Virtual], Global, Virtual);\r
-    FvbEraseBlock (Instance, LastLba, Global, Virtual);\r
-  }\r
-\r
-  ScratchLbaSizeData = LbaSize - (OffsetStartLba + 1);\r
-\r
-  return FvbWriteBlock (\r
-          Instance,\r
-          LastLba,\r
-          (OffsetLastLba + 1),\r
-          &ScratchLbaSizeData,\r
-          Global->FvbScratchSpace[Virtual],\r
-          Global,\r
-          Virtual\r
-          );\r
-}\r
-\r
 EFI_STATUS\r
 FvbSetVolumeAttributes (\r
   IN UINTN                                Instance,\r
@@ -1223,54 +1127,6 @@ Returns:
 \r
   return FvbReadBlock (FvbDevice->Instance, Lba, Offset, NumBytes, Buffer, mFvbModuleGlobal, EfiGoneVirtual ());\r
 }\r
-//\r
-// FVB Extension Protocols\r
-//\r
-EFI_STATUS\r
-EFIAPI\r
-FvbExtendProtocolEraseCustomBlockRange (\r
-  IN EFI_FVB_EXTENSION_PROTOCOL           *This,\r
-  IN EFI_LBA                              StartLba,\r
-  IN UINTN                                OffsetStartLba,\r
-  IN EFI_LBA                              LastLba,\r
-  IN UINTN                                OffsetLastLba\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-  Erases and initializes a specified range of a firmware volume\r
-\r
-Arguments:\r
-  This                  - Calling context\r
-  StartLba              - The starting logical block index to be erased\r
-  OffsetStartLba        - Offset into the starting block at which to \r
-                          begin erasing\r
-  LastLba               - The last logical block index to be erased\r
-  OffsetStartLba        - Offset into the last block at which to end erasing\r
-\r
-Returns: \r
-  EFI_SUCCESS           - The firmware volume was erased successfully\r
-  EFI_ACCESS_DENIED     - The firmware volume is in the WriteDisabled state\r
-  EFI_DEVICE_ERROR      - The block device is not functioning correctly and \r
-                          could not be written. Firmware device may have been\r
-                          partially erased\r
-\r
---*/\r
-{\r
-  EFI_FW_VOL_BLOCK_DEVICE *FvbDevice;\r
-\r
-  FvbDevice = FVB_EXTEND_DEVICE_FROM_THIS (This);\r
-\r
-  return FvbEraseCustomBlockRange (\r
-          FvbDevice->Instance,\r
-          StartLba,\r
-          OffsetStartLba,\r
-          LastLba,\r
-          OffsetLastLba,\r
-          mFvbModuleGlobal,\r
-          EfiGoneVirtual ()\r
-          );\r
-}\r
 \r
 EFI_STATUS\r
 ValidateFvHeader (\r
@@ -1416,7 +1272,7 @@ OnSimpleFileSystemInstall (
   EFI_HANDLE                Handle;\r
   UINTN                     Instance;\r
   EFI_DEVICE_PATH_PROTOCOL  *Device;\r
-  EFI_FILE                  *File;\r
+  EFI_FILE_PROTOCOL         *File;\r
   EFI_FW_VOL_INSTANCE       *FwhInstance;\r
   while (TRUE) {\r
     HandleSize = sizeof (EFI_HANDLE);\r
@@ -1751,7 +1607,7 @@ Returns:
                       NULL\r
                       );\r
       ASSERT_EFI_ERROR (Status);\r
-    } else if (EfiIsDevicePathEnd (TempFwbDevicePath)) {\r
+    } else if (IsDevicePathEnd (TempFwbDevicePath)) {\r
       //\r
       // Device allready exists, so reinstall the FVB protocol\r
       //\r
@@ -1776,19 +1632,6 @@ Returns:
       //\r
       ASSERT (FALSE);\r
     }\r
-    //\r
-    // Install FVB Extension Protocol on the same handle\r
-    //\r
-    Status = gBS->InstallMultipleProtocolInterfaces (\r
-                    &FwbHandle,\r
-                    &gEfiFvbExtensionProtocolGuid,\r
-                    &FvbDevice->FvbExtension,\r
-                    &gEfiAlternateFvBlockGuid,\r
-                    NULL,\r
-                    NULL\r
-                    );\r
-\r
-    ASSERT_EFI_ERROR (Status);\r
 \r
     FwhInstance = (EFI_FW_VOL_INSTANCE *)\r
       (\r