Skip to contentSkip to conversation

PATCH: (Discussion) Stop IDE legacy ISA probes on PCI systems

PATCH Alan Cox 5 participants 5 messages Dec 27, 2004 – Dec 28, 2004 libata

lore
Share & tools
lore

Alan Cox

author
#0 lore raw

We don't generally want to poke around legacy ISA ide2..ide5 on a system with PCI , it tends to cause long delays.

include/asm-i386/ide.h +8 -4
diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.10/include/asm-i386/ide.h linux-2.6.10/include/asm-i386/ide.h
@@ -44,10 +44,14 @@
 	switch (index) {
 		case 0:	return 0x1f0;
 		case 1:	return 0x170;
-		case 2: return 0x1e8;
-		case 3: return 0x168;
-		case 4: return 0x1e0;
-		case 5: return 0x160;
+		
+		if(pci_find_device(PCI_ANY_ID, PCI_ANY_ID, NULL) == NULL) {
+			case 2: return 0x1e8;
+			case 3: return 0x168;
+			case 4: return 0x1e0;
+			case 5: return 0x160;
+		}
+
 		default:
 			return 0;
 	}
#1 lore raw
Quoted 4 lines · Alan Cox
include/asm-i386/ide.h +1 -0
 	switch (index) {
 		case 0:	return 0x1f0;
 		case 1:	return 0x170;
+		

include/asm-i386/ide.h line 57

Quoted 10 lines
include/asm-i386/ide.h +7 -0
+		if(pci_find_device(PCI_ANY_ID, PCI_ANY_ID, NULL) == NULL) {
+			case 2: return 0x1e8;
+			case 3: return 0x168;
+			case 4: return 0x1e0;
+			case 5: return 0x160;
+		}
+
 		default:
 			return 0;
 	}

I don't think that code will have the intended effect, unless your GCC has some funny ideas about switch statements...

Signature · 1 line
Adam Sampson <[email protected]>                        <http://offog.org/>
#2 lore raw
Quoted 11 lines · Adam Sampson
Quoted 9 lines · Alan Cox
include/asm-i386/ide.h +6 -0
 	switch (index) {
 		case 0:	return 0x1f0;
 		case 1:	return 0x170;
+		
+		if(pci_find_device(PCI_ANY_ID, PCI_ANY_ID, NULL) == NULL) {
+			case 2: return 0x1e8;
+			case 3: return 0x168;
+			case 4: return 0x1e0;
+			case 5: return 0x160;
Quoted 8 lines

include/asm-i386/ide.h line 57

Quoted 5 lines
include/asm-i386/ide.h +2 -0
+		}
+
 		default:
 			return 0;
 	}

I don't think that code will have the intended effect, unless your GCC has some funny ideas about switch statements...

Those who don't understand the Duff Device are doomed to re-invent it, poorly. ;)

(Yes Alan, I know *you* know C well enough, but I just looked at that block of code and it looked *so* much like Tom Duff's that I had to say it. ;)

For those not in the know:

http://www.lysator.liu.se/c/duffs-device.html

#3 lore raw
In reply to Adam Sampson
Quoted 3 lines · Adam Sampson

I don't think that code will have the intended effect, unless your GCC has some funny ideas about switch statements...

Indeed. That if-statement is unreachable and has no effect.

Linus

#4 lore raw

This should solve the problem.

coywolf

--- linux-2.6.10/include/asm-i386/ide.h 2004-10-19 05:53:13.000000000 +0800
+++ linux-2.6.10-cy/include/asm-i386/ide.h 2004-12-28
11:45:38.000000000 +0800
@@ -44,13 +44,18 @@ static __inline__ unsigned long ide_defa

        switch (index) {
                case 0: return 0x1f0;
                case 1: return 0x170;
-               case 2: return 0x1e8;
-               case 3: return 0x168;
-               case 4: return 0x1e0;
-               case 5: return 0x160;
-               default:
-                       return 0;
        }
+
+       if (pci_find_device(PCI_ANY_ID, PCI_ANY_ID, NULL) == NULL) {
+               switch (index) {
+                       case 2: return 0x1e8;
+                       case 3: return 0x168;
+                       case 4: return 0x1e0;
+                       case 5: return 0x160;

+ }
+ }
+
+ return 0;
}

#define IDE_ARCH_OBSOLETE_INIT

Quoted 11 lines · Linus Torvalds
Quoted 3 lines · Adam Sampson

I don't think that code will have the intended effect, unless your GCC has some funny ideas about switch statements...

Indeed. That if-statement is unreachable and has no effect.

Linus
-

Signature · 2 lines
Coywolf Qi Hunt
Homepage http://sosdg.org/~coywolf/