libata: automatically use DMADIR if drive/bridge requires it
authorTejun Heo <htejun@gmail.com>
Thu, 21 Feb 2008 04:25:50 +0000 (13:25 +0900)
committerJeff Garzik <jeff@garzik.org>
Sun, 24 Feb 2008 05:27:33 +0000 (00:27 -0500)
commitf92396bd0a9a7c41ad1d79e41fc8c454d70b2a06
treedfc527d28af35f19dcb9c4092757d6eabb8afb1d
parentbcf058e7027dedacead8d5a13fdef8bd28687564
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>
drivers/ata/libata-core.c
drivers/ata/libata-scsi.c
include/linux/ata.h
include/linux/libata.h