[PATCH] ide: sensible probing for PCI systems
authorAlan Cox <alan@lxorguk.ukuu.org.uk>
Mon, 27 Jun 2005 22:24:31 +0000 (15:24 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Tue, 28 Jun 2005 00:36:41 +0000 (17:36 -0700)
Old ISA/VESA systems sometimes put tertiary IDE controllers at addresses
0x1e8, 0x168, 0x1e0 or 0x160.  Linux thus probes these addresses on x86
systems.  Unfortunately some PCI systems now use these addresses for other
purposes which leads to users seeing minute plus hangs during boot or even
crashes.

The following patch (again has been in Fedora for a while) only probes the
obscure legacy ISA ports on machinea that are pre-PCI.  This seems to keep
everyone happy and if there is someone with that utterly weird corner case
the ide= command line still provides a get out of jail card.
Unsurprisingly we've not found anyone so affected.

Signed-off-by: Alan Cox <alan@redhat.com>
Acked-by: Bartlomiej Zolnierkiewicz <B.Zolnierkiewicz@elka.pw.edu.pl>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
include/asm-i386/ide.h

index 859ebf4da632cabe31276fb5d8ff6cb8121288bc..79dfab87135d5448673e92bc60d42fb5b096bf75 100644 (file)
@@ -41,13 +41,17 @@ static __inline__ int ide_default_irq(unsigned long base)
 
 static __inline__ unsigned long ide_default_io_base(int index)
 {
+       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;
+               }
+       }
        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;
        }