aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-scsi.c
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2008-02-20 23:25:50 -0500
committerJeff Garzik <jeff@garzik.org>2008-02-24 00:27:33 -0500
commit9116300634c5c76cfcd0d2af689846e04d172256 (patch)
treedfc527d28af35f19dcb9c4092757d6eabb8afb1d /drivers/ata/libata-scsi.c
parent559bbe6cbd0d8c68d40076a5f7dc98e3bf5864b2 (diff)
libata: automatically use DMADIR if drive/bridge requires it
Back in 2.6.17-rc2, a libata module parameter was added for atapi_dmadir. That's nice, but most SATA devices which need it will tell us about it in their IDENTIFY PACKET response, as bit-15 of word-62 of the returned data (as per ATA7, ATA8 specifications). So for those which specify it, we should automatically use the DMADIR bit. Otherwise, disc writing will fail by default on many SATA-ATAPI drives. This patch adds ATA_DFLAG_DMADIR and make ata_dev_configure() set it if atapi_dmadir is set or identify data indicates DMADIR is necessary. atapi_xlat() is converted to check ATA_DFLAG_DMADIR before setting DMADIR. Original patch is from Mark Lord. Signed-off-by: Tejun Heo <htejun@gmail.com> Cc: Mark Lord <mlord@pobox.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/libata-scsi.c')
-rw-r--r--drivers/ata/libata-scsi.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index f888babc828..0562b0a49f3 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -2582,7 +2582,8 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc)
2582 qc->tf.protocol = ATAPI_PROT_DMA; 2582 qc->tf.protocol = ATAPI_PROT_DMA;
2583 qc->tf.feature |= ATAPI_PKT_DMA; 2583 qc->tf.feature |= ATAPI_PKT_DMA;
2584 2584
2585 if (atapi_dmadir && (scmd->sc_data_direction != DMA_TO_DEVICE)) 2585 if ((dev->flags & ATA_DFLAG_DMADIR) &&
2586 (scmd->sc_data_direction != DMA_TO_DEVICE))
2586 /* some SATA bridges need us to indicate data xfer direction */ 2587 /* some SATA bridges need us to indicate data xfer direction */
2587 qc->tf.feature |= ATAPI_DMADIR; 2588 qc->tf.feature |= ATAPI_DMADIR;
2588 } 2589 }