Skip to contentSkip to conversation

libata: skip 0xff polling for PATA controllers

PATCH Applied Tejun Heo 4 participants 5 messages Nov 8, 2007 – Nov 9, 2007 libata

lore
Share & tools
lore

Tejun Heo

author
#0 lore raw

PATCH 1/1 libata: skip 0xff polling for PATA controllers

In a presentation of true workmanship, pata_ali asserts IRQ permanantly if the TF status register is read more than once when there's no device attached to the port.

Avoid waiting polling for !0xff if it's PATA. It's needed only for some rare SATA devices anyway.

This problem is reported by Luca Tettamanti in bugzilla bug 9298.

---
 drivers/ata/libata-core.c |   16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
drivers/ata/libata-core.c +11 -5
index 009bd60..fd73f0b 100644
@@ -3383,14 +3383,20 @@ void ata_wait_after_reset(struct ata_port *ap, unsigned long deadline)
 	 * to clear 0xff after reset.  For example, HHD424020F7SV00
 	 * iVDR needs >= 800ms while.  Quantum GoVault needs even more
 	 * than that.
+	 *
+	 * Note that some PATA controllers (pata_ali) explode if
+	 * status register is read more than once when there's no
+	 * device attached.
 	 */
-	while (1) {
-		u8 status = ata_chk_status(ap);
+	if (ap->flags & ATA_FLAG_SATA) {
+		while (1) {
+			u8 status = ata_chk_status(ap);
 
-		if (status != 0xff || time_after(jiffies, deadline))
-			return;
+			if (status != 0xff || time_after(jiffies, deadline))
+				return;
 
-		msleep(50);
+			msleep(50);
+		}
 	}
 }
 
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · On Thu, 08 Nov 2007 11:20:18 +0900 Tejun Heo <[email protected]> wrote:

In a presentation of true workmanship, pata_ali asserts IRQ permanantly if the TF status register is read more than once when there's no device attached to the port.

Avoid waiting polling for !0xff if it's PATA. It's needed only for some rare SATA devices anyway.

Quoted 7 lines

This problem is reported by Luca Tettamanti in bugzilla bug 9298.

---
 drivers/ata/libata-core.c |   16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

Bletch.. 8)

#2 lore raw
In reply to Tejun Heo
Quoted 3 lines · Tejun Heo

In a presentation of true workmanship, pata_ali asserts IRQ permanantly if the TF status register is read more than once when there's no device attached to the port.

..

Is using the altstatus reg (rather than status reg), when possible, a better idea here?

author
#3 lore raw
Quoted 8 lines · Mark Lord
Quoted 3 lines · Tejun Heo

In a presentation of true workmanship, pata_ali asserts IRQ permanantly if the TF status register is read more than once when there's no device attached to the port.

..

Is using the altstatus reg (rather than status reg), when possible, a better idea here?

I dunno. It probably differs case-by-case. In general, status reg should be safer as it is supposed to clear IRQ.

Signature · 1 line
tejun
Applied
#4 lore raw
In reply to Tejun Heo
Quoted 11 lines · Tejun Heo

In a presentation of true workmanship, pata_ali asserts IRQ permanantly if the TF status register is read more than once when there's no device attached to the port.

Avoid waiting polling for !0xff if it's PATA. It's needed only for some rare SATA devices anyway.

This problem is reported by Luca Tettamanti in bugzilla bug 9298.

applied