]> git.hungrycats.org Git - linux/commitdiff
[libata] DMADIR support
authorJeff Garzik <jgarzik@redhat.com>
Sun, 16 May 2004 14:35:15 +0000 (10:35 -0400)
committerJeff Garzik <jgarzik@redhat.com>
Sun, 16 May 2004 14:35:15 +0000 (10:35 -0400)
DMADIR bit is necessary for some PATA->SATA bridges.  These
bridges require the OS driver to specify the data xfer direction,
for PACKET (a.k.a. scsi) commands.

A reliable DMADIR detection method hasn't yet been developed,
and ATAPI is still a WIP, so DMADIR is enabled with an ifdef for
now.

drivers/scsi/libata-scsi.c
include/linux/ata.h
include/linux/libata.h

index ab308576b2e69b3e6d1ecb4006c84844619521be..5d06d5d391b202c58e75e24ebb63d7361a0b926b 100644 (file)
@@ -927,6 +927,12 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc, u8 *scsicmd)
                qc->flags |= ATA_QCFLAG_SG; /* data is present; dma-map it */
                qc->tf.protocol = ATA_PROT_ATAPI_DMA;
                qc->tf.feature |= ATAPI_PKT_DMA;
+
+#ifdef ATAPI_ENABLE_DMADIR
+               /* some SATA bridges need us to indicate data xfer direction */
+               if (cmd->sc_data_direction != SCSI_DATA_WRITE)
+                       qc->tf.feature |= ATAPI_DMADIR;
+#endif
        }
 
        return 0;
index 7275d89ace21c0b905bead36bbd9550f2091c54d..053fd4b64da62bd87df7c131a01e0152f2167c31 100644 (file)
@@ -134,6 +134,8 @@ enum {
 
        /* ATAPI stuff */
        ATAPI_PKT_DMA           = (1 << 0),
+       ATAPI_DMADIR            = (1 << 2),     /* ATAPI data dir:
+                                                  0=to device, 1=to host */
 
        /* cable types */
        ATA_CBL_NONE            = 0,
index c2172feb0d3742e74df628b692f9788d59ac7b42..077f6461ab2a0de0401c50d7e657913b6b185db4 100644 (file)
@@ -40,6 +40,7 @@
 #undef ATA_ENABLE_ATAPI                /* define to enable ATAPI support */
 #undef ATA_ENABLE_PATA         /* define to enable PATA support in some
                                 * low-level drivers */
+#undef ATAPI_ENABLE_DMADIR     /* enables ATAPI DMADIR bridge support */
 
 
 /* note: prints function name for you */