This message is from the T13 list server.
There has been some discussion on specification of a SCSI command that
acts as a direct passthru for ATA commands. Here is a description
of the "Linux IDE taskfile ioctl", which is a system-call-level
implementation of an ATA passthru facility. Andre H originally designed
this facility IIRC.
The C data definition that represents a single ATA passthru command
follows. Elaboration follows that.
typedef struct ide_task_request_s {
task_ioreg_t io_ports[8];
task_ioreg_t hob_ports[8];
ide_reg_valid_t out_flags;
ide_reg_valid_t in_flags;
int data_phase;
int req_cmd;
unsigned long out_size;
unsigned long in_size;
} ide_task_request_t;
typedef unsigned char task_ioreg_t;
typedef union ide_reg_valid_s {
unsigned all : 16;
struct {
unsigned data : 1;
unsigned error_feature : 1;
unsigned sector : 1;
unsigned nsector : 1;
unsigned lcyl : 1;
unsigned hcyl : 1;
unsigned select : 1;
unsigned status_command : 1;
unsigned data_hob : 1;
unsigned error_feature_hob : 1;
unsigned sector_hob : 1;
unsigned nsector_hob : 1;
unsigned lcyl_hob : 1;
unsigned hcyl_hob : 1;
unsigned select_hob : 1;
unsigned control_hob : 1;
} b;
} ide_reg_valid_t;
#define TASKFILE_NO_DATA 0x0000
#define TASKFILE_IN 0x0001
#define TASKFILE_MULTI_IN 0x0002
#define TASKFILE_OUT 0x0004
#define TASKFILE_MULTI_OUT 0x0008
#define TASKFILE_IN_OUT 0x0010
#define TASKFILE_IN_DMA 0x0020
#define TASKFILE_OUT_DMA 0x0040
#define TASKFILE_IN_DMAQ 0x0080
#define TASKFILE_OUT_DMAQ 0x0100
#define TASKFILE_P_IN 0x0200
#define TASKFILE_P_OUT 0x0400
#define TASKFILE_P_IN_DMA 0x0800
#define TASKFILE_P_OUT_DMA 0x1000
#define TASKFILE_P_IN_DMAQ 0x2000
#define TASKFILE_P_OUT_DMAQ 0x4000
"io_ports" -- standard taskfile registers
"hob_ports" -- HOB taskfile registers
"in_flags", "out_flags" -- bitmap of valid taskfile registers in
io_ports[] and hob_ports[]
"data_phase" -- indicates the command protocol required to execute this
command. This is ABSOLUTELY REQUIRED for correct execution of the ATA
passthru command. This is DMA READ, PIO WRITE MULTI, NO-DATA, etc. as
illustrated by the TASKFILE_xxx constants above.
"req_cmd" -- indicates some special command details of note, such as
whether this is a SET FEATURES - XFER MODE command (which often requires
special OS driver handling under PATA).
"in_size", "out_size" -- amount of data to be transferred
Note that a key design feature of this ATA passthru interface is that
it eliminates the need for lookup tables in the OS driver, from which
some of this data may be inferred.
For example, some of the more simple OS drivers include a 256-element
lookup table that automatically detects the command protocol (pio-in,
dma-out, etc.) based on the command. This is insufficient, because it
breaks the capability to make use of unspecified or vendor-reserved
commands, for which the command protocol and data direction is not
known in advance.
A lookup table is not necessarily a bad thing -- it may enable
certain fast-path optimizations or additional security features --
but designers of any proposed ATA passthru command for SCSI should
avoid problems associated with implied / derived knowledge.
I'll include my own rough proposal of an ATA-passthru SCSI command
in a separate email.
Jeff