X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=ArmPlatformPkg%2FDrivers%2FNorFlashDxe%2FNorFlashDxe.h;h=a583e36c79887cf540fc279c2c6c939dd77464ef;hb=f4dfad05dda2c7b29e8105605621f2b413f0af2b;hp=424d63925bf0a78f5cc2b87514be0e38a0a128ab;hpb=2dff0c1ab2be86979ccb99db8b17bd3347b98b59;p=mirror_edk2.git diff --git a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.h b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.h index 424d63925b..a583e36c79 100644 --- a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.h +++ b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.h @@ -2,13 +2,7 @@ Copyright (c) 2011 - 2014, ARM Ltd. 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 - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -19,7 +13,10 @@ #include #include +#include + #include +#include #include #include @@ -115,23 +112,22 @@ #define NOR_FLASH_SIGNATURE SIGNATURE_32('n', 'o', 'r', '0') #define INSTANCE_FROM_FVB_THIS(a) CR(a, NOR_FLASH_INSTANCE, FvbProtocol, NOR_FLASH_SIGNATURE) #define INSTANCE_FROM_BLKIO_THIS(a) CR(a, NOR_FLASH_INSTANCE, BlockIoProtocol, NOR_FLASH_SIGNATURE) +#define INSTANCE_FROM_DISKIO_THIS(a) CR(a, NOR_FLASH_INSTANCE, DiskIoProtocol, NOR_FLASH_SIGNATURE) typedef struct _NOR_FLASH_INSTANCE NOR_FLASH_INSTANCE; -typedef EFI_STATUS (*NOR_FLASH_INITIALIZE) (NOR_FLASH_INSTANCE* Instance); - +#pragma pack (1) typedef struct { VENDOR_DEVICE_PATH Vendor; + UINT8 Index; EFI_DEVICE_PATH_PROTOCOL End; } NOR_FLASH_DEVICE_PATH; +#pragma pack () struct _NOR_FLASH_INSTANCE { UINT32 Signature; EFI_HANDLE Handle; - BOOLEAN Initialized; - NOR_FLASH_INITIALIZE Initialize; - UINTN DeviceBaseAddress; UINTN RegionBaseAddress; UINTN Size; @@ -139,12 +135,12 @@ struct _NOR_FLASH_INSTANCE { EFI_BLOCK_IO_PROTOCOL BlockIoProtocol; EFI_BLOCK_IO_MEDIA Media; + EFI_DISK_IO_PROTOCOL DiskIoProtocol; - BOOLEAN SupportFvb; EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL FvbProtocol; - VOID* FvbBuffer; + VOID* ShadowBuffer; - NOR_FLASH_DEVICE_PATH DevicePath; + NOR_FLASH_DEVICE_PATH DevicePath; }; EFI_STATUS @@ -208,6 +204,31 @@ NorFlashBlockIoFlushBlocks ( IN EFI_BLOCK_IO_PROTOCOL *This ); +// +// DiskIO Protocol function EFI_DISK_IO_PROTOCOL.ReadDisk +// +EFI_STATUS +EFIAPI +NorFlashDiskIoReadDisk ( + IN EFI_DISK_IO_PROTOCOL *This, + IN UINT32 MediaId, + IN UINT64 Offset, + IN UINTN BufferSize, + OUT VOID *Buffer + ); + +// +// DiskIO Protocol function EFI_DISK_IO_PROTOCOL.WriteDisk +// +EFI_STATUS +EFIAPI +NorFlashDiskIoWriteDisk ( + IN EFI_DISK_IO_PROTOCOL *This, + IN UINT32 MediaId, + IN UINT64 Offset, + IN UINTN BufferSize, + IN VOID *Buffer + ); // // NorFlashFvbDxe.c @@ -288,10 +309,11 @@ NorFlashUnlockAndEraseSingleBlock ( EFI_STATUS NorFlashWriteSingleBlock ( - IN NOR_FLASH_INSTANCE *Instance, - IN EFI_LBA Lba, - IN UINT32 *DataBuffer, - IN UINT32 BlockSizeInWords + IN NOR_FLASH_INSTANCE *Instance, + IN EFI_LBA Lba, + IN UINTN Offset, + IN OUT UINTN *NumBytes, + IN UINT8 *Buffer ); EFI_STATUS @@ -310,6 +332,24 @@ NorFlashReadBlocks ( OUT VOID *Buffer ); +EFI_STATUS +NorFlashRead ( + IN NOR_FLASH_INSTANCE *Instance, + IN EFI_LBA Lba, + IN UINTN Offset, + IN UINTN BufferSizeInBytes, + OUT VOID *Buffer + ); + +EFI_STATUS +NorFlashWrite ( + IN NOR_FLASH_INSTANCE *Instance, + IN EFI_LBA Lba, + IN UINTN Offset, + IN OUT UINTN *NumBytes, + IN UINT8 *Buffer + ); + EFI_STATUS NorFlashReset ( IN NOR_FLASH_INSTANCE *Instance