10#ifndef _RECOVERY_ATAPI_H_
11#define _RECOVERY_ATAPI_H_
31#define MAX_SENSE_KEY_COUNT 6
32#define MAX_IDE_CHANNELS 4
33#define MAX_IDE_DEVICES 8
88#define ATAPI_BLK_IO_DEV_SIGNATURE SIGNATURE_32 ('a', 'b', 'i', 'o')
103#define PEI_RECOVERY_ATAPI_FROM_BLKIO_THIS(a) CR (a, ATAPI_BLK_IO_DEV, AtapiBlkIo, ATAPI_BLK_IO_DEV_SIGNATURE)
104#define PEI_RECOVERY_ATAPI_FROM_BLKIO2_THIS(a) CR (a, ATAPI_BLK_IO_DEV, AtapiBlkIo2, ATAPI_BLK_IO_DEV_SIGNATURE)
106#define STALL_1_MILLI_SECOND 1000
107#define STALL_1_SECONDS 1000 * STALL_1_MILLI_SECOND
114#define ATATIMEOUT 1000
118#define ATAPITIMEOUT 1000
122#define CDROMLONGTIMEOUT 2000
123#define ATAPILONGTIMEOUT 5000
663 IN OUT UINT8 *SenseCounts
775 OUT BOOLEAN *NeedRetry
EFI_STATUS EFIAPI AtapiReadBlocks(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_RECOVERY_BLOCK_IO_PPI *This, IN UINTN DeviceIndex, IN EFI_PEI_LBA StartLBA, IN UINTN BufferSize, OUT VOID *Buffer)
EFI_STATUS EFIAPI AtapiGetBlockDeviceMediaInfo(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_RECOVERY_BLOCK_IO_PPI *This, IN UINTN DeviceIndex, OUT EFI_PEI_BLOCK_IO_MEDIA *MediaInfo)
EFI_STATUS ReadCapacity(IN ATAPI_BLK_IO_DEV *AtapiBlkIoDev, IN UINTN DevicePosition, IN OUT EFI_PEI_BLOCK_IO_MEDIA *MediaInfo, IN OUT EFI_PEI_BLOCK_IO2_MEDIA *MediaInfo2)
EFI_STATUS DRDYReady(IN ATAPI_BLK_IO_DEV *AtapiBlkIoDev, IN IDE_BASE_REGISTERS *IdeIoRegisters, IN UINTN TimeoutInMilliSeconds)
EFI_STATUS DRQReady(IN ATAPI_BLK_IO_DEV *AtapiBlkIoDev, IN IDE_BASE_REGISTERS *IdeIoRegisters, IN UINTN TimeoutInMilliSeconds)
EFI_STATUS TestUnitReady(IN ATAPI_BLK_IO_DEV *AtapiBlkIoDev, IN UINTN DevicePosition)
VOID AtapiEnumerateDevices(IN ATAPI_BLK_IO_DEV *AtapiBlkIoDev)
BOOLEAN DiscoverAtapiDevice(IN ATAPI_BLK_IO_DEV *AtapiBlkIoDev, IN UINTN DevicePosition, OUT EFI_PEI_BLOCK_IO_MEDIA *MediaInfo, OUT EFI_PEI_BLOCK_IO2_MEDIA *MediaInfo2)
EFI_STATUS EFIAPI AtapiGetNumberOfBlockDevices2(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This, OUT UINTN *NumberBlockDevices)
EFI_STATUS AtapiPacketCommandIn(IN ATAPI_BLK_IO_DEV *AtapiBlkIoDev, IN UINTN DevicePosition, IN ATAPI_PACKET_COMMAND *Packet, IN UINT16 *Buffer, IN UINT32 ByteCount, IN UINTN TimeoutInMilliSeconds)
EFI_STATUS DRQClear(IN ATAPI_BLK_IO_DEV *AtapiBlkIoDev, IN IDE_BASE_REGISTERS *IdeIoRegisters, IN UINTN TimeoutInMilliSeconds)
EFI_STATUS ReadSectors(IN ATAPI_BLK_IO_DEV *AtapiBlkIoDev, IN UINTN DevicePosition, IN VOID *Buffer, IN EFI_PEI_LBA StartLba, IN UINTN NumberOfBlocks, IN UINTN BlockSize)
BOOLEAN DetectIDEController(IN ATAPI_BLK_IO_DEV *AtapiBlkIoDev, IN UINTN DevicePosition)
EFI_STATUS ATAPIIdentify(IN ATAPI_BLK_IO_DEV *AtapiBlkIoDev, IN UINTN DevicePosition)
EFI_STATUS RequestSense(IN ATAPI_BLK_IO_DEV *AtapiBlkIoDev, IN UINTN DevicePosition, IN ATAPI_REQUEST_SENSE_DATA *SenseBuffers, IN OUT UINT8 *SenseCounts)
EFI_STATUS WaitForBSYClear(IN ATAPI_BLK_IO_DEV *AtapiBlkIoDev, IN IDE_BASE_REGISTERS *IdeIoRegisters, IN UINTN TimeoutInMilliSeconds)
EFI_STATUS CheckErrorStatus(IN ATAPI_BLK_IO_DEV *AtapiBlkIoDev, IN UINT16 StatusReg)
EFI_STATUS DetectMedia(IN ATAPI_BLK_IO_DEV *AtapiBlkIoDev, IN UINTN DevicePosition, IN OUT EFI_PEI_BLOCK_IO_MEDIA *MediaInfo, IN OUT EFI_PEI_BLOCK_IO2_MEDIA *MediaInfo2)
BOOLEAN IsNoMedia(IN ATAPI_REQUEST_SENSE_DATA *SenseData, IN UINTN SenseCounts)
BOOLEAN IsDriveReady(IN ATAPI_REQUEST_SENSE_DATA *SenseData, IN UINTN SenseCounts, OUT BOOLEAN *NeedRetry)
EFI_STATUS DRQReady2(IN ATAPI_BLK_IO_DEV *AtapiBlkIoDev, IN IDE_BASE_REGISTERS *IdeIoRegisters, IN UINTN TimeoutInMilliSeconds)
BOOLEAN IsMediaError(IN ATAPI_REQUEST_SENSE_DATA *SenseData, IN UINTN SenseCounts)
BOOLEAN IsDeviceStateUnclear(IN ATAPI_REQUEST_SENSE_DATA *SenseData, IN UINTN SenseCounts)
EFI_STATUS EFIAPI AtapiReadBlocks2(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This, IN UINTN DeviceIndex, IN EFI_PEI_LBA StartLBA, IN UINTN BufferSize, OUT VOID *Buffer)
EFI_STATUS EFIAPI AtapiGetBlockDeviceMediaInfo2(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This, IN UINTN DeviceIndex, OUT EFI_PEI_BLOCK_IO2_MEDIA *MediaInfo)
EFI_STATUS ResetDevice(IN ATAPI_BLK_IO_DEV *AtapiBlkIoDev, IN UINTN DevicePosition, IN BOOLEAN Extensive)
EFI_STATUS DRQClear2(IN ATAPI_BLK_IO_DEV *AtapiBlkIoDev, IN IDE_BASE_REGISTERS *IdeIoRegisters, IN UINTN TimeoutInMilliSeconds)
EFI_STATUS Inquiry(IN ATAPI_BLK_IO_DEV *AtapiBlkIoDev, IN UINTN DevicePosition, OUT EFI_PEI_BLOCK_IO_MEDIA *MediaInfo, OUT EFI_PEI_BLOCK_IO2_MEDIA *MediaInfo2)
EFI_STATUS EFIAPI AtapiGetNumberOfBlockDevices(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_RECOVERY_BLOCK_IO_PPI *This, OUT UINTN *NumberBlockDevices)