linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH #upstream] sata_sil24: always set protocol override for non-ATAPI data commands
@ 2009-07-30 20:11 Robert Hancock
  2009-07-30 20:18 ` Mark Lord
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Robert Hancock @ 2009-07-30 20:11 UTC (permalink / raw)
  To: ide, Jeff Garzik; +Cc: Tejun Heo, Mark Lord

The sil24 hardware has a built-in list of commands and associated protocols
that gets used by default to decide how to handle a given command. However,
if the command is not known to the controller then it presumably assumes it to
be a non-data command which then causes protocol mismatch errors if the device
ends up requesting data transfer. The new DATA SET MANAGEMENT - Trim command
causes this issue since it's a DMA data-out command.

Since we should always know best what protocol the command should be using,
let's just set the override flag to inform the controller what protocol to use
for all non-ATAPI commands with data transfer.

Signed-off-by: Robert Hancock <hancockrwd@gmail.com>
Tested-by: Mark Lord <liml@rtr.ca>

diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c
index 77aa8d7..e6946fc 100644
--- a/drivers/ata/sata_sil24.c
+++ b/drivers/ata/sata_sil24.c
@@ -846,6 +846,17 @@ static void sil24_qc_prep(struct ata_queued_cmd *qc)
 	if (!ata_is_atapi(qc->tf.protocol)) {
 		prb = &cb->ata.prb;
 		sge = cb->ata.sge;
+		if (ata_is_data(qc->tf.protocol)) {
+			u16 prot = 0;
+			ctrl = PRB_CTRL_PROTOCOL;
+			if (ata_is_ncq(qc->tf.protocol))
+				prot |= PRB_PROT_NCQ;
+			if (qc->tf.flags & ATA_TFLAG_WRITE)
+				prot |= PRB_PROT_WRITE;
+			else
+				prot |= PRB_PROT_READ;
+			prb->prot = cpu_to_le16(prot);
+		}
 	} else {
 		prb = &cb->atapi.prb;
 		sge = cb->atapi.sge;

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

end of thread, other threads:[~2009-08-22 16:30 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-30 20:11 [PATCH #upstream] sata_sil24: always set protocol override for non-ATAPI data commands Robert Hancock
2009-07-30 20:18 ` Mark Lord
2009-07-30 20:53 ` Jeff Garzik
2009-07-31  1:20   ` Tejun Heo
2009-08-22  5:57 ` Robert Hancock
2009-08-22 14:03   ` Mark Lord
2009-08-22 14:11     ` Jeff Garzik
2009-08-22 15:25       ` Mark Lord
2009-08-22 15:28         ` Mark Lord
2009-08-22 16:10           ` Jeff Garzik
2009-08-22 16:27             ` Robert Hancock
2009-08-22 16:02         ` Jeff Garzik
2009-08-22 16:30       ` Robert Hancock

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).