Re: [PATCH] libata-scsi: automatically use DMADIR if drive/bridge requires it

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jeff Garzik wrote:
Mark Lord wrote:
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.

Signed-off-by: Mark Lord <mlord@xxxxxxxxx>

--- old/drivers/ata/libata-scsi.c    2008-02-18 14:45:08.000000000 -0500
+++ linux/drivers/ata/libata-scsi.c 2008-02-18 14:53:02.000000000 -0500
@@ -2543,9 +2543,10 @@
        qc->tf.protocol = ATAPI_PROT_DMA;
        qc->tf.feature |= ATAPI_PKT_DMA;

-        if (atapi_dmadir && (scmd->sc_data_direction != DMA_TO_DEVICE))
- /* some SATA bridges need us to indicate data xfer direction */
-            qc->tf.feature |= ATAPI_DMADIR;
+        /* some SATA bridges need us to indicate data xfer direction */
+        if (atapi_dmadir || (dev->id[62] & 0x8000))
+            if (scmd->sc_data_direction != DMA_TO_DEVICE)
+                qc->tf.feature |= ATAPI_DMADIR;

Regardless of the historical usage (or lack thereof) of that I.D. word, I would prefer

1) an ata version check

2) a simple wrapper in linux/ata.h, similar to the many that already exist

So, conditional ACK...
..

Good.  As I said, I don't expect to be doing this,
so if anyone else wants to fix this issue in libata
they are more than welcome to take the above and build on it.

Cheers -
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux