From d89ee0218780580d748a7d43344c87bb1153886a Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Sun, 16 May 2004 10:35:15 -0400 Subject: [PATCH] [libata] DMADIR support 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 | 6 ++++++ include/linux/ata.h | 2 ++ include/linux/libata.h | 1 + 3 files changed, 9 insertions(+) diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c index ab308576b2e69..5d06d5d391b20 100644 --- a/drivers/scsi/libata-scsi.c +++ b/drivers/scsi/libata-scsi.c @@ -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; diff --git a/include/linux/ata.h b/include/linux/ata.h index 7275d89ace21c..053fd4b64da62 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h @@ -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, diff --git a/include/linux/libata.h b/include/linux/libata.h index c2172feb0d374..077f6461ab2a0 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -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 */ -- 2.53.0