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