71#ifdef USE_DBGPRINT_LOGGER
73#define DbgPrint DbgDump_Printf
74#define Connect_DbgPrint() {DbgDump_SetAutoReconnect(TRUE); DbgDump_Reconnect();}
76#define Connect_DbgPrint() {;}
79#ifdef SCSI_PORT_DBG_PRINT
85 ULONG DebugPrintLevel,
90#define PRINT_PREFIX 0,
92#define KdPrint3(_x_) ScsiDebugPrint _x_ {;}
93#define KdPrint2(_x_) {ScsiDebugPrint("%x: ", PsGetCurrentThread()) ; ScsiDebugPrint _x_ ; }
94#define KdPrint(_x_) ScsiDebugPrint _x_ {;}
98#ifndef USE_DBGPRINT_LOGGER
116#define KdPrint3(_x_) {if(LOG_ON_RAISED_IRQL_W2K || MajorVersion < 0x05 || KeGetCurrentIrql() <= 2){ DbgPrint _x_ ; if(g_LogToDisplay){ PrintNtConsole _x_ ;} }}
117#define KdPrint2(_x_) {if(LOG_ON_RAISED_IRQL_W2K || MajorVersion < 0x05 || KeGetCurrentIrql() <= 2){ DbgPrint _x_ ; if(g_LogToDisplay){ PrintNtConsole _x_ ;} }}
118#define KdPrint(_x_) {if(LOG_ON_RAISED_IRQL_W2K || MajorVersion < 0x05 || KeGetCurrentIrql() <= 2){ DbgPrint _x_ ; if(g_LogToDisplay){ PrintNtConsole _x_ ;} }}
140#define AtapiStallExecution(dt) { ScsiPortStallExecution(dt); }
150#define PRINT_PREFIX "UniATA: "
153#define KdPrint3(_x_) {;}
154#define KdPrint2(_x_) {;}
155#define KdPrint(_x_) {;}
156#define Connect_DbgPrint() {;}
158#define AtapiStallExecution(dt) ScsiPortStallExecution(dt)
192#define IDX_IO1_SZ sizeof(IDE_REGISTERS_1)
195#define IDX_IO1_SZ sizeof(IDE_REGISTERS_1)
196#define IDX_IO1_i_Data (FIELD_OFFSET(IDE_REGISTERS_1, i.Data )+IDX_IO1)
197#define IDX_IO1_i_Error (FIELD_OFFSET(IDE_REGISTERS_1, i.Error )+IDX_IO1)
198#define IDX_IO1_i_BlockCount (FIELD_OFFSET(IDE_REGISTERS_1, i.BlockCount )+IDX_IO1)
199#define IDX_IO1_i_BlockNumber (FIELD_OFFSET(IDE_REGISTERS_1, i.BlockNumber )+IDX_IO1)
200#define IDX_IO1_i_CylinderLow (FIELD_OFFSET(IDE_REGISTERS_1, i.CylinderLow )+IDX_IO1)
201#define IDX_IO1_i_CylinderHigh (FIELD_OFFSET(IDE_REGISTERS_1, i.CylinderHigh)+IDX_IO1)
202#define IDX_IO1_i_DriveSelect (FIELD_OFFSET(IDE_REGISTERS_1, i.DriveSelect )+IDX_IO1)
203#define IDX_IO1_i_Status (FIELD_OFFSET(IDE_REGISTERS_1, i.Status )+IDX_IO1)
205#define IDX_IO1_o IDX_IO1_SZ
206#define IDX_IO1_o_SZ sizeof(IDE_REGISTERS_1)
208#define IDX_IO1_o_Data (FIELD_OFFSET(IDE_REGISTERS_1, o.Data )+IDX_IO1_o)
209#define IDX_IO1_o_Feature (FIELD_OFFSET(IDE_REGISTERS_1, o.Feature )+IDX_IO1_o)
210#define IDX_IO1_o_BlockCount (FIELD_OFFSET(IDE_REGISTERS_1, o.BlockCount )+IDX_IO1_o)
211#define IDX_IO1_o_BlockNumber (FIELD_OFFSET(IDE_REGISTERS_1, o.BlockNumber )+IDX_IO1_o)
212#define IDX_IO1_o_CylinderLow (FIELD_OFFSET(IDE_REGISTERS_1, o.CylinderLow )+IDX_IO1_o)
213#define IDX_IO1_o_CylinderHigh (FIELD_OFFSET(IDE_REGISTERS_1, o.CylinderHigh)+IDX_IO1_o)
214#define IDX_IO1_o_DriveSelect (FIELD_OFFSET(IDE_REGISTERS_1, o.DriveSelect )+IDX_IO1_o)
215#define IDX_IO1_o_Command (FIELD_OFFSET(IDE_REGISTERS_1, o.Command )+IDX_IO1_o)
222#define IDX_IO2 (IDX_IO1_o+IDX_IO1_o_SZ)
223#define IDX_IO2_SZ sizeof(IDE_REGISTERS_2)
225#define IDX_IO2_AltStatus (FIELD_OFFSET(IDE_REGISTERS_2, AltStatus )+IDX_IO2)
228#define IDX_IO2_o (IDX_IO2+IDX_IO2_SZ)
229#define IDX_IO2_o_SZ sizeof(IDE_REGISTERS_2)
231#define IDX_IO2_o_Control (FIELD_OFFSET(IDE_REGISTERS_2, Control)+IDX_IO2_o)
236#define DFLAGS_DEVICE_PRESENT 0x0001
237#define DFLAGS_ATAPI_DEVICE 0x0002
238#define DFLAGS_TAPE_DEVICE 0x0004
239#define DFLAGS_INT_DRQ 0x0008
241#define DFLAGS_REMOVABLE_DRIVE 0x0010
243#define DFLAGS_MEDIA_STATUS_ENABLED 0x0020
244#define DFLAGS_ATAPI_CHANGER 0x0040
245#define DFLAGS_SANYO_ATAPI_CHANGER 0x0080
246#define DFLAGS_CHANGER_INITED 0x0100
247#define DFLAGS_LBA_ENABLED 0x0200
248#define DFLAGS_DWORDIO_ENABLED 0x0400
249#define DFLAGS_WCACHE_ENABLED 0x0800
250#define DFLAGS_RCACHE_ENABLED 0x1000
251#define DFLAGS_ORIG_GEOMETRY 0x2000
252#define DFLAGS_REINIT_DMA 0x4000
253#define DFLAGS_HIDDEN 0x8000
255#define DFLAGS_MANUAL_CHS 0x10000
256#define DFLAGS_LBA32plus 0x20000
268#define ATAPI_MODE_SENSE 0x5A
269#define ATAPI_MODE_SELECT 0x55
270#define ATAPI_FORMAT_UNIT 0x24
307#define ATA_PIO_NRDY 0x01
318#define ATA_SDMA0 0x10
319#define ATA_SDMA1 0x11
320#define ATA_SDMA2 0x12
323#define ATA_WDMA0 0x20
324#define ATA_WDMA1 0x21
325#define ATA_WDMA2 0x22
328#define ATA_UDMA0 0x40
329#define ATA_UDMA1 0x41
330#define ATA_UDMA2 0x42
331#define ATA_UDMA3 0x43
332#define ATA_UDMA4 0x44
333#define ATA_UDMA5 0x45
334#define ATA_UDMA6 0x46
337#define ATA_SA150 0x47
338#define ATA_SA300 0x48
339#define ATA_SA600 0x49
341#define ATA_MODE_NOT_SPEC ((ULONG)(-1))
347#define IDE_COMMAND_DATA_SET_MGMT 0x06
348#define IDE_COMMAND_ATAPI_RESET 0x08
349#define IDE_COMMAND_RECALIBRATE 0x10
350#define IDE_COMMAND_READ 0x20
351#define IDE_COMMAND_READ_NO_RETR 0x21
352#define IDE_COMMAND_READ48 0x24
353#define IDE_COMMAND_READ_DMA48 0x25
354#define IDE_COMMAND_READ_DMA_Q48 0x26
355#define IDE_COMMAND_READ_NATIVE_SIZE48 0x27
356#define IDE_COMMAND_READ_MUL48 0x29
357#define IDE_COMMAND_READ_STREAM_DMA48 0x2A
358#define IDE_COMMAND_READ_STREAM48 0x2B
359#define IDE_COMMAND_READ_LOG48 0x2f
360#define IDE_COMMAND_WRITE 0x30
361#define IDE_COMMAND_WRITE_NO_RETR 0x31
362#define IDE_COMMAND_WRITE48 0x34
363#define IDE_COMMAND_WRITE_DMA48 0x35
364#define IDE_COMMAND_WRITE_DMA_Q48 0x36
365#define IDE_COMMAND_SET_NATIVE_SIZE48 0x37
366#define IDE_COMMAND_WRITE_MUL48 0x39
367#define IDE_COMMAND_WRITE_STREAM_DMA48 0x3a
368#define IDE_COMMAND_WRITE_STREAM48 0x3b
369#define IDE_COMMAND_WRITE_FUA_DMA48 0x3d
370#define IDE_COMMAND_WRITE_FUA_DMA_Q48 0x3e
371#define IDE_COMMAND_WRITE_LOG48 0x3f
372#define IDE_COMMAND_VERIFY 0x40
373#define IDE_COMMAND_VERIFY48 0x42
374#define IDE_COMMAND_READ_LOG_DMA48 0x47
375#define IDE_COMMAND_WRITE_LOG_DMA48 0x57
376#define IDE_COMMAND_TRUSTED_RCV 0x5c
377#define IDE_COMMAND_TRUSTED_RCV_DMA 0x5d
378#define IDE_COMMAND_TRUSTED_SEND 0x5e
379#define IDE_COMMAND_TRUSTED_SEND_DMA 0x5f
380#define IDE_COMMAND_SEEK 0x70
381#define IDE_COMMAND_SET_DRIVE_PARAMETERS 0x91
382#define IDE_COMMAND_ATAPI_PACKET 0xA0
383#define IDE_COMMAND_ATAPI_IDENTIFY 0xA1
384#define IDE_COMMAND_READ_MULTIPLE 0xC4
385#define IDE_COMMAND_WRITE_MULTIPLE 0xC5
386#define IDE_COMMAND_SET_MULTIPLE 0xC6
387#define IDE_COMMAND_READ_DMA_Q 0xC7
388#define IDE_COMMAND_READ_DMA 0xC8
389#define IDE_COMMAND_WRITE_DMA 0xCA
390#define IDE_COMMAND_WRITE_DMA_Q 0xCC
391#define IDE_COMMAND_WRITE_MUL_FUA48 0xCE
392#define IDE_COMMAND_GET_MEDIA_STATUS 0xDA
393#define IDE_COMMAND_DOOR_LOCK 0xDE
394#define IDE_COMMAND_DOOR_UNLOCK 0xDF
395#define IDE_COMMAND_STANDBY_IMMED 0xE0
396#define IDE_COMMAND_IDLE_IMMED 0xE1
397#define IDE_COMMAND_STANDBY 0xE2
398#define IDE_COMMAND_IDLE 0xE3
399#define IDE_COMMAND_READ_PM 0xE4
400#define IDE_COMMAND_SLEEP 0xE6
401#define IDE_COMMAND_FLUSH_CACHE 0xE7
402#define IDE_COMMAND_WRITE_PM 0xE8
403#define IDE_COMMAND_IDENTIFY 0xEC
404#define IDE_COMMAND_MEDIA_EJECT 0xED
405#define IDE_COMMAND_FLUSH_CACHE48 0xEA
406#define IDE_COMMAND_ENABLE_MEDIA_STATUS 0xEF
407#define IDE_COMMAND_SET_FEATURES 0xEF
409#define IDE_COMMAND_READ_NATIVE_SIZE 0xF8
410#define IDE_COMMAND_SET_NATIVE_SIZE 0xF9
412#define SCSIOP_ATA_PASSTHROUGH 0xCC
418#define IDE_STATUS_SUCCESS 0x00
419#define IDE_STATUS_ERROR 0x01
420#define IDE_STATUS_INDEX 0x02
421#define IDE_STATUS_CORRECTED_ERROR 0x04
422#define IDE_STATUS_DRQ 0x08
423#define IDE_STATUS_DSC 0x10
425#define IDE_STATUS_DMA 0x20
426#define IDE_STATUS_DWF 0x20
427#define IDE_STATUS_DRDY 0x40
428#define IDE_STATUS_IDLE 0x50
429#define IDE_STATUS_BUSY 0x80
431#define IDE_STATUS_WRONG 0xff
432#define IDE_STATUS_MASK 0xff
439#define IDE_DRIVE_SELECT 0xA0
440#define IDE_DRIVE_1 0x00
441#define IDE_DRIVE_2 0x10
442#define IDE_DRIVE_SELECT_1 (IDE_DRIVE_SELECT | IDE_DRIVE_1)
443#define IDE_DRIVE_SELECT_2 (IDE_DRIVE_SELECT | IDE_DRIVE_2)
444#define IDE_DRIVE_MASK (IDE_DRIVE_SELECT_1 | IDE_DRIVE_SELECT_2)
446#define IDE_USE_LBA 0x40
452#define IDE_DC_DISABLE_INTERRUPTS 0x02
453#define IDE_DC_RESET_CONTROLLER 0x04
454#define IDE_DC_A_4BIT 0x80
455#define IDE_DC_USE_HOB 0x80
456#define IDE_DC_REENABLE_CONTROLLER 0x00
461#define IDE_ERROR_ICRC 0x80
462#define IDE_ERROR_BAD_BLOCK 0x80
463#define IDE_ERROR_DATA_ERROR 0x40
464#define IDE_ERROR_MEDIA_CHANGE 0x20
465#define IDE_ERROR_ID_NOT_FOUND 0x10
466#define IDE_ERROR_MEDIA_CHANGE_REQ 0x08
467#define IDE_ERROR_COMMAND_ABORTED 0x04
468#define IDE_ERROR_END_OF_MEDIA 0x02
469#define IDE_ERROR_NO_MEDIA 0x02
470#define IDE_ERROR_ILLEGAL_LENGTH 0x01
503#define IDX_ATAPI_IO1 IDX_IO1
504#define IDX_ATAPI_IO1_SZ sizeof(ATAPI_REGISTERS_1)
506#define IDX_ATAPI_IO1_i_Data (FIELD_OFFSET(ATAPI_REGISTERS_1, i.Data )+IDX_ATAPI_IO1)
507#define IDX_ATAPI_IO1_i_Error (FIELD_OFFSET(ATAPI_REGISTERS_1, i.Error )+IDX_ATAPI_IO1)
508#define IDX_ATAPI_IO1_i_InterruptReason (FIELD_OFFSET(ATAPI_REGISTERS_1, i.InterruptReason)+IDX_ATAPI_IO1)
509#define IDX_ATAPI_IO1_i_Unused1 (FIELD_OFFSET(ATAPI_REGISTERS_1, i.Unused1 )+IDX_ATAPI_IO1)
510#define IDX_ATAPI_IO1_i_ByteCountLow (FIELD_OFFSET(ATAPI_REGISTERS_1, i.ByteCountLow )+IDX_ATAPI_IO1)
511#define IDX_ATAPI_IO1_i_ByteCountHigh (FIELD_OFFSET(ATAPI_REGISTERS_1, i.ByteCountHigh )+IDX_ATAPI_IO1)
512#define IDX_ATAPI_IO1_i_DriveSelect (FIELD_OFFSET(ATAPI_REGISTERS_1, i.DriveSelect )+IDX_ATAPI_IO1)
513#define IDX_ATAPI_IO1_i_Status (FIELD_OFFSET(ATAPI_REGISTERS_1, i.Status )+IDX_ATAPI_IO1)
515#define IDX_ATAPI_IO1_o_Data (FIELD_OFFSET(ATAPI_REGISTERS_1, o.Data )+IDX_ATAPI_IO1)
516#define IDX_ATAPI_IO1_o_Feature (FIELD_OFFSET(ATAPI_REGISTERS_1, o.Feature )+IDX_ATAPI_IO1)
517#define IDX_ATAPI_IO1_o_Unused0 (FIELD_OFFSET(ATAPI_REGISTERS_1, o.Unused0 )+IDX_ATAPI_IO1)
518#define IDX_ATAPI_IO1_o_Unused1 (FIELD_OFFSET(ATAPI_REGISTERS_1, o.Unused1 )+IDX_ATAPI_IO1)
519#define IDX_ATAPI_IO1_o_ByteCountLow (FIELD_OFFSET(ATAPI_REGISTERS_1, o.ByteCountLow )+IDX_ATAPI_IO1)
520#define IDX_ATAPI_IO1_o_ByteCountHigh (FIELD_OFFSET(ATAPI_REGISTERS_1, o.ByteCountHigh)+IDX_ATAPI_IO1)
521#define IDX_ATAPI_IO1_o_DriveSelect (FIELD_OFFSET(ATAPI_REGISTERS_1, o.DriveSelect )+IDX_ATAPI_IO1)
522#define IDX_ATAPI_IO1_o_Command (FIELD_OFFSET(ATAPI_REGISTERS_1, o.Command )+IDX_ATAPI_IO1)
544#define ATAPI_IR_COD 0x01
545#define ATAPI_IR_COD_Data 0x0
546#define ATAPI_IR_COD_Cmd 0x1
548#define ATAPI_IR_IO 0x02
549#define ATAPI_IR_IO_toDev 0x00
550#define ATAPI_IR_IO_toHost 0x02
552#define ATAPI_IR_Mask 0x03
558#define ATA_F_DMA 0x01
559#define ATA_F_OVL 0x02
560#define ATA_F_DMAREAD 0x04
562#define ATA_C_F_SETXFER 0x03
564#define ATA_C_F_ENAB_WCACHE 0x02
565#define ATA_C_F_DIS_WCACHE 0x82
567#define ATA_C_F_ENAB_RCACHE 0xaa
568#define ATA_C_F_DIS_RCACHE 0x55
570#define ATA_C_F_ENAB_RELIRQ 0x5d
571#define ATA_C_F_DIS_RELIRQ 0xdd
573#define ATA_C_F_ENAB_SRVIRQ 0x5e
574#define ATA_C_F_DIS_SRVIRQ 0xde
576#define ATA_C_F_ENAB_MEDIASTAT 0x95
577#define ATA_C_F_DIS_MEDIASTAT 0x31
579#define ATA_C_F_ENAB_APM 0x05
580#define ATA_C_F_DIS_APM 0x85
581#define ATA_C_F_APM_CNT_MAX_PERF 0xfe
582#define ATA_C_F_APM_CNT_MIN_NO_STANDBY 0x80
583#define ATA_C_F_APM_CNT_MIN_STANDBY 0x01
585#define ATA_C_F_ENAB_ACOUSTIC 0x42
586#define ATA_C_F_DIS_ACOUSTIC 0xc2
587#define ATA_C_F_AAM_CNT_MAX_PERF 0xfe
588#define ATA_C_F_AAM_CNT_MAX_POWER_SAVE 0x80
591#ifndef READ_LOG_SECTOR
592#define READ_LOG_SECTOR 0xD5
593#define WRITE_LOG_SECTOR 0xD6
594#define WRITE_THRESHOLDS 0xD7
595#define AUTO_OFFLINE 0xDB
602#define ATA_I_CMD 0x01
604#define ATA_I_RELEASE 0x04
605#define ATA_I_TAGMASK 0xf8
612#define ATAPI_PSIZE_12 0
613#define ATAPI_PSIZE_16 1
616#define ATAPI_DRQT_MPROC 0
617#define ATAPI_DRQT_INTR 1
618#define ATAPI_DRQT_ACCEL 2
622#define ATAPI_TYPE_DIRECT 0
623#define ATAPI_TYPE_TAPE 1
624#define ATAPI_TYPE_CDROM 5
625#define ATAPI_TYPE_OPTICAL 7
628#define ATAPI_PROTO_ATAPI 2
642#define ATA_BT_SINGLEPORTSECTOR 1
643#define ATA_BT_DUALPORTMULTI 2
644#define ATA_BT_DUALPORTMULTICACHE 3
727#define AdvancedPIOModes_3 1
728#define AdvancedPIOModes_4 2
729#define AdvancedPIOModes_5 4
758#define ATA_SATA_GEN1 0x0002
759#define ATA_SATA_GEN2 0x0004
760#define ATA_SATA_GEN3 0x0008
761#define ATA_SUPPORT_NCQ 0x0100
762#define ATA_SUPPORT_IFPWRMNGTRCV 0x0200
763#define ATA_SUPPORT_PHY_EVENT_COUNTER 0x0400
764#define ATA_SUPPORT_NCQ_UNLOAD 0x0800
765#define ATA_SUPPORT_NCQ_PRI_INFO 0x1000
770#define ATA_SUPPORT_NONZERO 0x0002
771#define ATA_SUPPORT_AUTOACTIVATE 0x0004
772#define ATA_SUPPORT_IFPWRMNGT 0x0008
773#define ATA_SUPPORT_INORDERDATA 0x0010
779#define ATA_VER_MJ_ATA4 0x0010
780#define ATA_VER_MJ_ATA5 0x0020
781#define ATA_VER_MJ_ATA6 0x0040
782#define ATA_VER_MJ_ATA7 0x0080
783#define ATA_VER_MJ_ATA8_ASC 0x0100
845#define IDENTIFY_CABLE_ID_VALID 0x01
979#define ATA_ChecksumValid 0xA5
990#define IDENTIFY_DATA2 IDENTIFY_DATA
991#define PIDENTIFY_DATA2 PIDENTIFY_DATA
1034#define IDENTIFY_DATA_SIZE sizeof(IDENTIFY_DATA)
1038#define IDENTIFY_DMA_CYCLES_MODE_0 0x00
1039#define IDENTIFY_DMA_CYCLES_MODE_1 0x01
1040#define IDENTIFY_DMA_CYCLES_MODE_2 0x02
1090#define GetStatus(chan, Status) \
1091 Status = AtapiReadPort1(chan, IDX_IO2_AltStatus);
1093#define GetBaseStatus(chan, pStatus) \
1094 pStatus = AtapiReadPort1(chan, IDX_IO1_i_Status);
1096#define WriteCommand(chan, _Command) \
1097 AtapiWritePort1(chan, IDX_IO1_o_Command, _Command);
1106#define ReadBuffer(chan, Buffer, Count, timing) \
1107 AtapiReadBuffer2(chan, IDX_IO1_i_Data, \
1112#define WriteBuffer(chan, Buffer, Count, timing) \
1113 AtapiWriteBuffer2(chan, IDX_IO1_o_Data, \
1118#define ReadBuffer2(chan, Buffer, Count, timing) \
1119 AtapiReadBuffer4(chan, IDX_IO1_i_Data, \
1124#define WriteBuffer2(chan, Buffer, Count, timing) \
1125 AtapiWriteBuffer4(chan, IDX_IO1_o_Data, \
1198#define IS_RDP(OperationCode)\
1199 ((OperationCode == SCSIOP_ERASE)||\
1200 (OperationCode == SCSIOP_LOAD_UNLOAD)||\
1201 (OperationCode == SCSIOP_LOCATE)||\
1202 (OperationCode == SCSIOP_REWIND) ||\
1203 (OperationCode == SCSIOP_SPACE)||\
1204 (OperationCode == SCSIOP_SEEK)||\
1207 (OperationCode == SCSIOP_WRITE_FILEMARKS))
1249#define AtapiCopyMemory RtlCopyMemory
1258#define AtapiStringCmp(s1, s2, n) _strnicmp(s1, s2, n)
1280#define INTERRUPT_REASON_IGNORE 0
1281#define INTERRUPT_REASON_OUR 1
1282#define INTERRUPT_REASON_UNEXPECTED 2
1362#define UNIATA_FIND_DEV_UNHIDE 0x01
1483#define CHAN_NOT_SPECIFIED (0xffffffffL)
1484#define CHAN_NOT_SPECIFIED_CHECK_CABLE (0xfffffffeL)
1485#define DEVNUM_NOT_SPECIFIED (0xffffffffL)
1486#define IOMODE_NOT_SPECIFIED (0xffffffffL)
1594#define ATA_AT_HOME_HDD 0x01
1595#define ATA_AT_HOME_ATAPI 0x02
1596#define ATA_AT_HOME_XXX 0x04
1597#define ATA_AT_HOME_NOBODY 0x00
1599#define ATA_CMD_FLAG_LBAIOsupp 0x01
1600#define ATA_CMD_FLAG_48supp 0x02
1601#define ATA_CMD_FLAG_48 0x04
1602#define ATA_CMD_FLAG_DMA 0x08
1603#define ATA_CMD_FLAG_FUA 0x10
1604#define ATA_CMD_FLAG_In 0x40
1605#define ATA_CMD_FLAG_Out 0x80
1611#define UniAta_need_lba48(command, lba, count, supp48) \
1612 ( ((AtaCommandFlags[command] & ATA_CMD_FLAG_LBAIOsupp) && (supp48) && (((lba+count) >= ATA_MAX_IOLBA28) || (count > 256)) ) || \
1613 (lba > ATA_MAX_LBA28) || (count > 255) )
1617#define UniAtaClearAtaReq(AtaReq) \
1619 RtlZeroMemory((PCHAR)(AtaReq), FIELD_OFFSET(ATA_REQ, ata)); \
1626#define ATAPI_DEVICE(chan, dev) ((chan->lun[dev]->DeviceFlags & DFLAGS_ATAPI_DEVICE) ? TRUE : FALSE)
1629#define PrintNtConsole _PrintNtConsole
1631#define PrintNtConsole(x) {;}
1642 return (
ident->SataCapabilities &&
ident->SataCapabilities != 0xffff);
1645#define IDENT_MODE_MAX FALSE
1646#define IDENT_MODE_ACTIVE TRUE
1669 if (
ident->UdmaModesValid) {
1688 if (
ident->MultiWordDMAActive & 0x04)
1690 if (
ident->MultiWordDMAActive & 0x02)
1692 if (
ident->MultiWordDMAActive & 0x01)
1696 if (
ident->SingleWordDMAActive & 0x04)
1698 if (
ident->SingleWordDMAActive & 0x02)
1700 if (
ident->SingleWordDMAActive & 0x01)
1703 if (
ident->PioTimingsValid) {
1713 if (
ident->PioCycleTimingMode == 2)
1715 if (
ident->PioCycleTimingMode == 1)
1717 if (
ident->PioCycleTimingMode == 0)
struct outqueuenode * head
struct _IDENTIFY_DATA * PIDENTIFY_DATA
struct _MODE_SENSE_10 MODE_SENSE_10
struct _IDENTIFY_DATA IDENTIFY_DATA
struct _IDE_REGISTERS_2 IDE_REGISTERS_2
#define WaitForDrq(BaseIoAddress, Status)
struct _ATAPI_REGISTERS_1 ATAPI_REGISTERS_1
struct _IDE_REGISTERS_2 * PIDE_REGISTERS_2
#define WaitShortForDrq(BaseIoAddress, Status)
#define WaitOnBaseBusy(BaseIoAddress, Status)
struct _IDE_REGISTERS_1 IDE_REGISTERS_1
struct _MODE_SELECT_10 MODE_SELECT_10
struct _MODE_PARAMETER_HEADER_10 MODE_PARAMETER_HEADER_10
struct _MODE_PARAMETER_HEADER_10 * PMODE_PARAMETER_HEADER_10
#define WaitOnBusy(BaseIoAddress, Status)
struct _IDE_REGISTERS_1 * PIDE_REGISTERS_1
struct _MODE_SENSE_10 * PMODE_SENSE_10
struct _ATAPI_REGISTERS_1 * PATAPI_REGISTERS_1
#define AtapiSoftReset(BaseIoAddress, DeviceNumber)
struct _MODE_SELECT_10 * PMODE_SELECT_10
VOID __cdecl ScsiDebugPrint(IN ULONG DebugPrintLevel, IN PCCHAR DebugMessage, IN ...)
_In_ PSCSI_REQUEST_BLOCK Srb
_In_ ULONG _In_ BOOLEAN _In_ ULONG _In_ UCHAR PathId
_In_ ULONG _In_ BOOLEAN _In_ ULONG _In_ UCHAR _In_ UCHAR TargetId
_In_ PCHAR _In_ ULONG DeviceNumber
VOID ResetBus(IN PDEVICE_OBJECT Fdo)
IN PFCB IN PCCB IN TYPE_OF_OPEN IN BOOLEAN IN BOOLEAN TopLevel
GLuint GLuint GLsizei count
GLenum const GLvoid * addr
INTERNETFEATURELIST feature
_In_ ULONG _In_ ULONG _In_ ULONG Length
struct _ATAPI_REGISTERS_1::_o o
struct _ATAPI_REGISTERS_1::_i i
USHORT NumberOfCurrentCylinders
USHORT NVCache_PM_Enabled
USHORT DeviceNominalFormFactor
USHORT StreamingTransferTimePIO
USHORT Reserved69_7_IEEE1667
USHORT MaxLBARangeDescBlockCount
USHORT UnformattedBytesPerSector
USHORT SingleWordDMASupport
USHORT NumberOfCurrentHeads
USHORT Reserved_CE_ATA[2]
ULONG UserAddressableSectors
USHORT Reserved209_14_One
struct _IDENTIFY_DATA::@1069::@1084 AtapiDMA
USHORT NVCache_Size_LogicalBlocks[2]
struct _IDENTIFY_DATA::@176 FeaturesEnabled
USHORT NominalMediaRotationRate
USHORT MultiWordDMASupport
USHORT NVCache_DeviceSpinUpTime
USHORT CurrentMultiSector
USHORT NVCache_Reserved_5_7
USHORT StreamAccessLatency
ULONGLONG UserAddressableSectors48
struct _IDENTIFY_DATA::@1075::@1087 SecurityStatusOpt
struct _IDENTIFY_DATA::@176 FeaturesSupport
struct _IDENTIFY_DATA::@1079::@1092 PATA
USHORT EnhancedEraseSupport
USHORT BlockEraseExtSupported
USHORT OverwriteExtSupported
USHORT MaxBlocks_MicrocodeDownload_Mode3
USHORT CurrentSectorsPerTrack
USHORT MasterPasswdRevision
USHORT MinBlocks_MicrocodeDownload_Mode3
struct _IDENTIFY_DATA::@1074 CommandFeatureSetEnabled
USHORT WriteReadVerify_Reserved220_8_15
USHORT TranslationFieldsValid
struct _IDENTIFY_DATA::@1074 CommandFeatureSetSupport
USHORT ReleaseTimeServiceCommand
USHORT AdditionalProdNum[4]
USHORT UnformattedBytesPerTrack
USHORT StreamTransferTime
USHORT SingleWordDMAActive
USHORT Reserved209_15_Zero
USHORT CryptoScrambleExtSupported
USHORT WriteReadVerify_CurrentMode
union _IDENTIFY_DATA::@1079 TransportMajor
USHORT FirmwareRevision[4]
USHORT NVCache_PM_Supported
USHORT NVCache_PM_Version
UCHAR MaximumBlockTransfer
USHORT WriteReadVerify_CountMode3[2]
USHORT MultiWordDMAActive
USHORT WriteReadVerify_CountMode2[2]
USHORT DeterministicReadAfterTrim
USHORT RecommendedMWXferCycleTime
USHORT MinimumPIOCycleTimeIORDY
USHORT LogicalSectorOffset
USHORT CurrentMultiSectorValid
USHORT DataSetManagementSupported
USHORT NVCache_Reserved_2_3
USHORT LongSectorErrorReporting
struct _IDENTIFY_DATA::@1079::@1093 SATA
USHORT NVCache_Reserved219_8_15
USHORT MinimumMWXferCycleTime
USHORT ReleaseTimeOverlapped
USHORT MicrocodeDownloadDMA
ULONG CurrentSectorCapacity
USHORT MinimumPIOCycleTime
struct _IDE_REGISTERS_1::_i i
struct _IDE_REGISTERS_1::_o o
UCHAR ParameterListLengthLsb
UCHAR ParameterListLengthMsb
UCHAR ParameterListLengthMsb
UCHAR ParameterListLengthLsb
LONG NTAPI AtaPio2Mode(LONG pio)
ULONG NTAPI AtapiRegCheckDevValue(IN PVOID HwDeviceExtension, IN ULONG chan, IN ULONG dev, IN PCWSTR Name, IN ULONG Default)
struct _TRIM_DATA * PTRIM_DATA
VOID NTAPI UniataDumpATARegs(IN struct _HW_CHANNEL *chan)
#define AdvancedPIOModes_3
VOID UniataInitIoRes(IN struct _HW_CHANNEL *chan, IN ULONG idx, IN ULONG addr, IN BOOLEAN MemIo, IN BOOLEAN Proc)
ULONG NTAPI IdeBuildSenseBuffer(IN PVOID HwDeviceExtension, IN PSCSI_REQUEST_BLOCK Srb)
BOOLEAN NTAPI AtapiStartIo__(IN PVOID HwDeviceExtension, IN PSCSI_REQUEST_BLOCK Srb, IN BOOLEAN TopLevel)
ULONG NTAPI AtapiSendCommand(IN PVOID HwDeviceExtension, IN PSCSI_REQUEST_BLOCK Srb, IN ULONG CmdAction)
UCHAR NTAPI AtaCommand48(IN struct _HW_DEVICE_EXTENSION *deviceExtension, IN ULONG DeviceNumber, IN ULONG Channel, IN UCHAR command, IN ULONGLONG lba, IN USHORT count, IN USHORT feature, IN ULONG flags)
struct _TRIM_DATA TRIM_DATA
VOID NTAPI UniataInitMapBase(IN struct _HW_CHANNEL *chan, IN PIDE_REGISTERS_1 BaseIoAddress1, IN PIDE_REGISTERS_2 BaseIoAddress2)
UCHAR DDKFASTAPI UniataIsIdle(IN struct _HW_DEVICE_EXTENSION *deviceExtension, IN UCHAR Status)
UCHAR DDKFASTAPI SelectDrive(IN struct _HW_CHANNEL *chan, IN ULONG DeviceNumber)
PSCSI_REQUEST_BLOCK NTAPI BuildRequestSenseSrb(IN PVOID HwDeviceExtension, IN PSCSI_REQUEST_BLOCK Srb)
ULONG NTAPI CheckDevice(IN PVOID HwDeviceExtension, IN ULONG Channel, IN ULONG deviceNumber, IN BOOLEAN ResetBus)
LONG NTAPI AtaWmode(PIDENTIFY_DATA2 ident)
BOOLEAN NTAPI AtapiInterrupt__(IN PVOID HwDeviceExtension, IN UCHAR c)
BOOLEAN NTAPI AtapiInterrupt(IN PVOID HwDeviceExtension)
ULONG NTAPI EncodeVendorStr(OUT PWCHAR Buffer, IN PUCHAR Str, IN ULONG Length)
UCHAR const AtaCommands48[256]
UCHAR NTAPI AtaCommand(IN struct _HW_DEVICE_EXTENSION *deviceExtension, IN ULONG DeviceNumber, IN ULONG Channel, IN UCHAR command, IN USHORT cylinder, IN UCHAR head, IN UCHAR sector, IN UCHAR count, IN UCHAR feature, IN ULONG flags)
UCHAR NTAPI AtapiCheckInterrupt__(IN PVOID HwDeviceExtension, IN UCHAR c)
VOID _cdecl _PrintNtConsole(PCCH DebugMessage,...)
ULONG NTAPI AtapiRegCheckParameterValue(IN PVOID HwDeviceExtension, IN PCWSTR PathSuffix, IN PCWSTR Name, IN ULONG Default)
BOOLEAN NTAPI IssueIdentify(IN PVOID HwDeviceExtension, IN ULONG DeviceNumber, IN ULONG Channel, IN UCHAR Command, IN BOOLEAN NoSetup)
VOID NTAPI UniataInitMapBM(IN struct _HW_DEVICE_EXTENSION *deviceExtension, IN struct _IDE_BUSMASTER_REGISTERS *BaseIoAddressBM_0, IN BOOLEAN MemIo)
ULONGLONG NTAPI UniAtaCalculateLBARegsBack(struct _HW_LU_EXTENSION *LunExt, ULONGLONG lba)
BOOLEAN NTAPI AtapiResetController(IN PVOID HwDeviceExtension, IN ULONG PathId)
BOOLEAN NTAPI AtapiHwInitialize(IN PVOID HwDeviceExtension)
BOOLEAN NTAPI SetDriveParameters(IN PVOID HwDeviceExtension, IN ULONG DeviceNumber, IN ULONG Channel)
VOID UniataInitIoResEx(IN struct _IORES *IoRes, IN ULONG addr, IN BOOLEAN MemIo, IN BOOLEAN Proc)
BOOLEAN NTAPI AtapiStartIo(IN PVOID HwDeviceExtension, IN PSCSI_REQUEST_BLOCK Srb)
ULONG NTAPI AtapiParseArgumentString(IN PCCH String, IN PCCH KeyWord)
VOID NTAPI AtapiEnableInterrupts(IN PVOID HwDeviceExtension, IN ULONG c)
VOID UniataExpectChannelInterrupt(IN struct _HW_CHANNEL *chan, IN BOOLEAN Expecting)
UCHAR DDKFASTAPI WaitOnBusyLong(IN struct _HW_CHANNEL *chan)
#define AdvancedPIOModes_4
ULONG NTAPI IdeSendCommand(IN PVOID HwDeviceExtension, IN PSCSI_REQUEST_BLOCK Srb, IN ULONG CmdAction)
UCHAR DDKFASTAPI WaitOnBaseBusyLong(IN struct _HW_CHANNEL *chan)
VOID NTAPI AtapiDisableInterrupts(IN PVOID HwDeviceExtension, IN ULONG c)
__inline LONG ata_cur_mode_from_ident(PIDENTIFY_DATA ident, BOOLEAN Active)
VOID NTAPI IdeMediaStatus(BOOLEAN EnableMSN, IN PVOID HwDeviceExtension, IN ULONG lChannel, IN ULONG DeviceNumber)
UCHAR const AtaCommandFlags[256]
#define AdvancedPIOModes_5
VOID NTAPI UniataInitSyncBaseIO(IN struct _HW_CHANNEL *chan)
PSCSI_REQUEST_BLOCK NTAPI BuildMechanismStatusSrb(IN PVOID HwDeviceExtension, IN PSCSI_REQUEST_BLOCK Srb)
ULONG NTAPI UniataAnybodyHome(IN PVOID HwDeviceExtension, IN ULONG Channel, IN ULONG deviceNumber)
__inline BOOLEAN ata_is_sata(PIDENTIFY_DATA ident)
ULONG NTAPI AtapiReadArgumentString(IN PVOID HwDeviceExtension, IN PVOID Context, IN PVOID BusInformation, IN PCHAR ArgumentString, IN OUT PPORT_CONFIGURATION_INFORMATION ConfigInfo, OUT PBOOLEAN Again)
LONG NTAPI AtaPioMode(PIDENTIFY_DATA2 ident)
VOID DDKFASTAPI AtapiHardReset(IN struct _HW_CHANNEL *chan, IN BOOLEAN DisableInterrupts, IN ULONG Delay)
VOID NTAPI AtapiHexToString(ULONG Value, PCHAR *Buffer)
ULONG NTAPI AtapiFindIsaController(IN PVOID HwDeviceExtension, IN PVOID Context, IN PVOID BusInformation, IN PCHAR ArgumentString, IN OUT PPORT_CONFIGURATION_INFORMATION ConfigInfo, OUT PBOOLEAN Again)
LONG NTAPI AtaUmode(PIDENTIFY_DATA2 ident)
VOID NTAPI AtapiHwInitializeChanger(IN PVOID HwDeviceExtension, IN ULONG TargetId, IN PMECHANICAL_STATUS_INFORMATION_HEADER MechanismStatus)
VOID NTAPI AtapiDpcDispatch(IN PKDPC Dpc, IN PVOID DeferredContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
_In_ WDFDEVICE _In_ PPNP_BUS_INFORMATION BusInformation
_Must_inspect_result_ _In_ PWDF_DPC_CONFIG _In_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFDPC * Dpc
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
_In_ ULONG _In_ ULONG_PTR ident
_Reserved_ PVOID Reserved
_Must_inspect_result_ _In_ ULONG Flags
_In_opt_ PVOID _In_opt_ PVOID SystemArgument1
_In_opt_ PVOID DeferredContext
_In_opt_ PVOID _In_opt_ PVOID _In_opt_ PVOID SystemArgument2
_In_ ULONG _In_ BOOLEAN Active