Linux ATA/IDE development
 help / color / mirror / Atom feed
* [PATCH] make ata_exec_internal_sg honor DMADIR
@ 2013-02-18 18:17 Csaba Halász
  2013-05-12 10:13 ` Vincent Pelletier
  0 siblings, 1 reply; 16+ messages in thread
From: Csaba Halász @ 2013-02-18 18:17 UTC (permalink / raw)
  To: linux-ide

[-- Attachment #1: Type: text/plain, Size: 793 bytes --]

Hi!

There seems to be a longstanding problem with certain ATAPI drives and
SATA bridges. This usually manifests itself in the device being
disabled on boot, with log messages similar to this:

kernel: ata5.00: qc timeout (cmd 0xa0)
kernel: ata5.00: failed to clear UNIT ATTENTION (err_mask=0x5)
kernel: ata5.00: disabled

At least for the bridge I have (an Abit Serillel 2) setting DMADIR
option and making sure even the internal commands use it seems to fix
the issue.
I have copied the code from atapi_xlat. Maybe some refactoring would
be in order, because apparently some other things might have to be
done too (such as setting lbam/lbah).
Also I am not sure whether we need to check that it's in fact an ATAPI
command (maybe by putting this in the if (cdb) block).

Cheers,
Csaba Halasz

[-- Attachment #2: dmadir.diff --]
[-- Type: application/octet-stream, Size: 557 bytes --]

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 46cd3f4..140d671 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -1614,6 +1614,10 @@ unsigned ata_exec_internal_sg(struct ata_device *dev,
 		ata_sg_init(qc, sgl, n_elem);
 		qc->nbytes = buflen;
 	}
+	if ((dev->flags & ATA_DFLAG_DMADIR) &&
+		    (dma_dir == DMA_FROM_DEVICE))
+			/* some SATA bridges need us to indicate data xfer direction */
+			qc->tf.feature |= ATAPI_DMADIR;
 
 	qc->private_data = &wait;
 	qc->complete_fn = ata_qc_complete_internal;

^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2013-05-21 23:35 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-18 18:17 [PATCH] make ata_exec_internal_sg honor DMADIR Csaba Halász
2013-05-12 10:13 ` Vincent Pelletier
2013-05-14 19:06   ` Tejun Heo
2013-05-17 17:20     ` Vincent Pelletier
2013-05-17 18:47       ` Tejun Heo
2013-05-19 13:31         ` Vincent Pelletier
2013-05-19 23:38           ` Tejun Heo
2013-05-20  6:20             ` Vincent Pelletier
2013-05-20  7:30               ` Tejun Heo
2013-05-20 10:51                 ` Vincent Pelletier
2013-05-20 18:59                   ` Tejun Heo
2013-05-20 20:43                     ` Vincent Pelletier
2013-05-20 22:02                       ` Tejun Heo
2013-05-21 20:37                         ` Vincent Pelletier
2013-05-21 23:32                           ` [PATCH 1/2] libata: " Tejun Heo
2013-05-21 23:35                           ` [PATCH 2/2] libata: Add atapi_dmadir force flag Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox