diff options
| author | Jeff Garzik <jgarzik@pobox.com> | 2004-07-10 04:47:34 -0400 |
|---|---|---|
| committer | Jeff Garzik <jgarzik@pobox.com> | 2004-07-10 04:47:34 -0400 |
| commit | 04272d0f35b2e25f5ae1a23432260f771e652554 (patch) | |
| tree | c738516659dfab5ea7b7b3f2fbddb1d6dc617a07 /include/linux | |
| parent | 3fcfe3871c0dc3901f740afe7331ba6e67679493 (diff) | |
[libata] ATAPI work - cdb len, new taskfile protocol, cleanups
* new helper atapi_cdb_len() in linux/ata.h, use it after
IDENTIFY PACKET DEVICE command completes
* add new taskfile protocol ATA_PROT_ATAPI_NODATA
* store scsi cdb in ata_queued_cmd. This removes another dependence
on the scsi layer, and enables us to issue an internal REQUEST SENSE.
* store cdb len in ata_port
* new constant ATAPI_CDB_LEN for max cdb length
* move ATA taskfile and SCSI cdb near the top of ata_queued_cmd, for
better cacheline friendliness.
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/ata.h | 15 | ||||
| -rw-r--r-- | include/linux/libata.h | 5 |
2 files changed, 18 insertions, 2 deletions
diff --git a/include/linux/ata.h b/include/linux/ata.h index c8c5a0385414..58c84a4b31f4 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h @@ -147,6 +147,7 @@ enum { ATAPI_PKT_DMA = (1 << 0), ATAPI_DMADIR = (1 << 2), /* ATAPI data dir: 0=to device, 1=to host */ + ATAPI_CDB_LEN = 16, /* cable types */ ATA_CBL_NONE = 0, @@ -176,7 +177,8 @@ enum ata_tf_protocols { ATA_PROT_PIO, /* PIO single sector */ ATA_PROT_PIO_MULT, /* PIO multiple sector */ ATA_PROT_DMA, /* DMA */ - ATA_PROT_ATAPI, /* packet command */ + ATA_PROT_ATAPI, /* packet command, PIO data xfer*/ + ATA_PROT_ATAPI_NODATA, /* packet command, no data */ ATA_PROT_ATAPI_DMA, /* packet command with special DMA sauce */ }; @@ -227,9 +229,20 @@ struct ata_taskfile { ((u64) dev->id[(n) + 1] << 16) | \ ((u64) dev->id[(n) + 0]) ) +static inline int atapi_cdb_len(u16 *dev_id) +{ + u16 tmp = dev_id[0] & 0x3; + switch (tmp) { + case 0: return 12; + case 1: return 16; + default: return -1; + } +} + static inline int is_atapi_taskfile(struct ata_taskfile *tf) { return (tf->protocol == ATA_PROT_ATAPI) || + (tf->protocol == ATA_PROT_ATAPI_NODATA) || (tf->protocol == ATA_PROT_ATAPI_DMA); } diff --git a/include/linux/libata.h b/include/linux/libata.h index 42a9bde8e42d..8443cce6971f 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -218,6 +218,9 @@ struct ata_queued_cmd { struct scsi_cmnd *scsicmd; void (*scsidone)(struct scsi_cmnd *); + struct ata_taskfile tf; + u8 cdb[ATAPI_CDB_LEN]; + unsigned long flags; /* ATA_QCFLAG_xxx */ unsigned int tag; unsigned int n_elem; @@ -229,7 +232,6 @@ struct ata_queued_cmd { unsigned int cursg; unsigned int cursg_ofs; - struct ata_taskfile tf; struct scatterlist sgent; void *buf_virt; @@ -285,6 +287,7 @@ struct ata_port { unsigned int mwdma_mask; unsigned int udma_mask; unsigned int cbl; /* cable type; ATA_CBL_xxx */ + unsigned int cdb_len; struct ata_device device[ATA_MAX_DEVICES]; |
