All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: linux--ide-momail.e4ward.com-linux--ide-vger.kernel.org-CDD-6w99-4@reply.e4ward.com,
	Jeff Garzik <jeff@garzik.org>, Robert Hancock <hancockr@shaw.ca>,
	peter.klotz@aon.at, linux-ide@vger.kernel.org, m.nov4k@gmail.com,
	lars21ce@gmx.de
Subject: Re: [PATCH #upstream-fixes] libata: implement and use HORKAGE_NOSETXFER
Date: Thu, 09 Jul 2009 08:07:44 +0900	[thread overview]
Message-ID: <4A5526C0.2030302@kernel.org> (raw)
In-Reply-To: <20090708132104.10e969a1@lxorguk.ukuu.org.uk>

Hello,

Alan Cox wrote:
>> 2. Skip SETXFER.  Any direct SATA connection to the device would work
>>    fine.
>>
>> 2. Ignore SETXFER timeout.  Probably would work for TF based
>>    controllers but it's largely untested for sata controllers and the
>>    behavior is likely undefined for more advanced controllers.
> 
>> So, #2 seems like the logical choice here.  If worst comes to worst
> 
> You have two #2's

Oops.

> but I agree that providing its for this specific drive
> and we document it carefully so people don't add it to stuff that is
> wrong then your first #2 is probably safest.
> 
> Possibly  HORKAGE_NO_SETXFER_SATA and check word 93 ?

How about something like the following?

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 045a486..2c6aeda 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -3392,17 +3392,27 @@ int ata_down_xfermask_limit(struct ata_device *dev, unsigned int sel)
 
 static int ata_dev_set_mode(struct ata_device *dev)
 {
+	struct ata_port *ap = dev->link->ap;
 	struct ata_eh_context *ehc = &dev->link->eh_context;
+	const bool nosetxfer = dev->horkage & ATA_HORKAGE_NOSETXFER;
 	const char *dev_err_whine = "";
 	int ign_dev_err = 0;
-	unsigned int err_mask;
+	unsigned int err_mask = 0;
 	int rc;
 
 	dev->flags &= ~ATA_DFLAG_PIO;
 	if (dev->xfer_shift == ATA_SHIFT_PIO)
 		dev->flags |= ATA_DFLAG_PIO;
 
-	err_mask = ata_dev_set_xfermode(dev);
+	if (nosetxfer && ap->flags & ATA_FLAG_SATA && ata_id_is_sata(dev->id))
+		dev_err_whine = " (SET_XFERMODE skipped)";
+	else {
+		if (nosetxfer)
+			ata_dev_printk(dev, KERN_WARNING,
+				       "NOSETXFER but PATA detected - can't "
+				       "skip SETXFER, might malfunction\n");
+		err_mask = ata_dev_set_xfermode(dev);
+	}
 
 	if (err_mask & ~AC_ERR_DEV)
 		goto fail;
@@ -4297,6 +4307,12 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
 	/* Devices which aren't very happy with higher link speeds */
 	{ "WD My Book",			NULL,	ATA_HORKAGE_1_5_GBPS, },
 
+	/*
+	 * Devices which choke on SETXFER.  Applies only if both the
+	 * device and controller are SATA.
+	 */
+	{ "PIONEER DVD-RW  DVRTD08",	"1.00",	ATA_HORKAGE_NOSETXFER },
+
 	/* End Marker */
 	{ }
 };
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 3d501db..2b641af 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -385,6 +385,7 @@ enum {
 						    not multiple of 16 bytes */
 	ATA_HORKAGE_FIRMWARE_WARN = (1 << 12),	/* firmware update warning */
 	ATA_HORKAGE_1_5_GBPS	= (1 << 13),	/* force 1.5 Gbps */
+	ATA_HORKAGE_NOSETXFER	= (1 << 14),
 
 	 /* DMA mask for user DMA control: User visible values; DO NOT
 	    renumber */

-- 
tejun

  reply	other threads:[~2009-07-08 23:09 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-21 21:18 PIONEER DVD-RW DVRTD08 is disabled if there is no disc present at boot time linux-ide
2008-12-22  0:22 ` Robert Hancock
2008-12-22 10:02   ` Tejun Heo
2008-12-22 12:13     ` linux-ide
2008-12-23  3:03       ` Tejun Heo
2008-12-24 13:40         ` linux-ide
2008-12-29  8:14           ` Tejun Heo
2008-12-29 21:32             ` linux-ide
2009-01-06 22:51               ` linux-ide
2009-01-07  2:01                 ` [PATCH #upstream-fixes] libata: implement and use HORKAGE_NOSETXFER Tejun Heo
2009-01-07  9:40                   ` Alan Cox
2009-01-07 10:27                     ` Tejun Heo
2009-01-07 10:53                       ` Alan Cox
2009-01-07 11:04                         ` Tejun Heo
2009-05-25  3:10                           ` Tejun Heo
2009-05-25  8:11                             ` Alan Cox
2009-07-08  8:00                               ` Tejun Heo
2009-07-08 10:14                                 ` Alan Cox
2009-07-08 11:16                                   ` Tejun Heo
2009-07-08 12:21                                     ` Alan Cox
2009-07-08 23:07                                       ` Tejun Heo [this message]
2009-07-08 14:53                                   ` Sergei Shtylyov
2009-07-08 15:06                                     ` Alan Cox
2008-12-29 22:11             ` PIONEER DVD-RW DVRTD08 is disabled if there is no disc present at boot time Peter Klotz
2008-12-22 11:57   ` linux-ide
  -- strict thread matches above, loose matches on Subject: below --
2009-01-07 14:15 [PATCH #upstream-fixes] libata: implement and use HORKAGE_NOSETXFER Moritz Rigler
2009-01-07 14:23 ` Alan Cox
2009-01-09  0:11   ` Robert Hancock
2009-01-15  5:48   ` Tejun Heo
2009-01-15  9:45     ` Alan Cox
2009-01-15 10:06       ` Tejun Heo
2009-01-15 13:48         ` Tejun Heo
2009-01-07 14:18 Moritz Rigler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A5526C0.2030302@kernel.org \
    --to=tj@kernel.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=hancockr@shaw.ca \
    --cc=jeff@garzik.org \
    --cc=lars21ce@gmx.de \
    --cc=linux--ide-momail.e4ward.com-linux--ide-vger.kernel.org-CDD-6w99-4@reply.e4ward.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=m.nov4k@gmail.com \
    --cc=peter.klotz@aon.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.