X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=ArmPlatformPkg%2FDrivers%2FNorFlashDxe%2FNorFlashDxe.h;h=4436fc4323f56a95ef786a9b3d21452588806d1b;hp=424d63925bf0a78f5cc2b87514be0e38a0a128ab;hb=4ef113583978c6a385c82cbbe1ed9cc754a5ffdc;hpb=2dff0c1ab2be86979ccb99db8b17bd3347b98b59 diff --git a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.h b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.h index 424d63925b..4436fc4323 100644 --- a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.h +++ b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.h @@ -19,7 +19,10 @@ #include #include +#include + #include +#include #include #include @@ -115,23 +118,21 @@ #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; 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 +140,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 +209,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 +314,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 +337,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