IDE problem [PATCH]

From: Andrzej Krzysztofowicz (ankry@green.mif.pg.gda.pl)
Date: Wed May 17 2000 - 17:23:43 EST


Hi,
   
Problem description:

When
  CONFIG_BLK_DEV_IDE=y
  # CONFIG_BLK_DEV_IDEPCI is not set
there is a problem using more than one IDE interface on kernels: 2.3.99pre9-2
and/or 2.2.15+ide.2.2.15.20000504.patch (i386, gcc-2.7.2.3).

Boot messages:

  ide1: ports already in use, skipping probe
  ide2: ports already in use, skipping probe
  ide3: ports already in use, skipping probe
  ide4: ports already in use, skipping probe
  ide5: ports already in use, skipping probe
  ide0 at 0x1f0-0x1f7,0x3f6 on irq 14

are related to non-initialized (random value) hwif->io_ports[IDE_IRQ_OFFSET],
in ide_init_hwif_ports(). This port should not be used for i386:

  01f0-01f7 : ide0
  03c0-03df : vga+
  03f6-03f6 : ide0
  c020-c020 : ide0 <------- port may be different ...
  0cf8-0cff : PCI conf1
  ffa0-ffaf : Acer Laboratories Inc. [ALi] M5229 IDE

The following patch fixes this problem in 2.3.99pre9-2 for i386 and,
possibly, for similar (in IDE implementation) architectures
(ia64/alpha/sparc/sparc64/sh). I do not know whether this problem touches
other architectures.
Same problem may appear in ide_register()/ide_setup()

The patch also contains some cleaning 0 -> NULL for pointers.
BTW, I wonder if IDE support compiles for arm because of this mismatch in
ide_init_hwif_ports() (last parameter).
 
Regards
   Andrzej
******************** patch ******************************
diff -u --recursive linux-2.3.99pre9-2/include/asm-alpha/ide.h linux/include/asm-alpha/ide.h
--- linux-2.3.99pre9-2/include/asm-alpha/ide.h Wed May 17 22:48:15 2000
+++ linux/include/asm-alpha/ide.h Wed May 17 22:53:03 2000
@@ -74,7 +74,8 @@
         int index;
 
         for (index = 0; index < MAX_HWIFS; index++) {
- ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, 0);
+ memset(&hw, 0, sizeof(hw_regs_t));
+ ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, NULL);
                 hw.irq = ide_default_irq(ide_default_io_base(index));
                 ide_register_hw(&hw, NULL);
         }
diff -u --recursive linux-2.3.99pre9-2/include/asm-i386/ide.h linux/include/asm-i386/ide.h
--- linux-2.3.99pre9-2/include/asm-i386/ide.h Wed May 17 08:30:45 2000
+++ linux/include/asm-i386/ide.h Wed May 17 22:46:03 2000
@@ -78,6 +78,7 @@
         int index;
 
         for(index = 0; index < MAX_HWIFS; index++) {
+ memset(&hw, 0, sizeof(hw_regs_t));
                 ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, NULL);
                 hw.irq = ide_default_irq(ide_default_io_base(index));
                 ide_register_hw(&hw, NULL);
diff -u --recursive linux-2.3.99pre9-2/include/asm-ia64/ide.h linux/include/asm-ia64/ide.h
--- linux-2.3.99pre9-2/include/asm-ia64/ide.h Fri May 5 22:30:42 2000
+++ linux/include/asm-ia64/ide.h Wed May 17 22:53:44 2000
@@ -84,6 +84,7 @@
         int index;
 
         for(index = 0; index < MAX_HWIFS; index++) {
+ memset(&hw, 0, sizeof(hw_regs_t));
                 ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, NULL);
                 hw.irq = ide_default_irq(ide_default_io_base(index));
                 ide_register_hw(&hw, NULL);
diff -u --recursive linux-2.3.99pre9-2/include/asm-sh/ide.h linux/include/asm-sh/ide.h
--- linux-2.3.99pre9-2/include/asm-sh/ide.h Wed Mar 29 21:26:35 2000
+++ linux/include/asm-sh/ide.h Wed May 17 23:31:48 2000
@@ -69,6 +69,7 @@
         int index;
 
         for(index = 0; index < MAX_HWIFS; index++) {
+ memset(&hw, 0, sizeof(hw_regs_t));
                 ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, NULL);
                 hw.irq = ide_default_irq(ide_default_io_base(index));
                 ide_register_hw(&hw, NULL);
diff -u --recursive linux-2.3.99pre9-2/include/asm-sparc/ide.h linux/include/asm-sparc/ide.h
--- linux-2.3.99pre9-2/include/asm-sparc/ide.h Wed May 17 22:55:05 2000
+++ linux/include/asm-sparc/ide.h Wed May 17 22:57:36 2000
@@ -65,7 +65,8 @@
         int index;
 
         for (index = 0; index < MAX_HWIFS; index++) {
- ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, 0);
+ memset(&hw, 0, sizeof(hw_regs_t));
+ ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, NULL);
                 hw.irq = ide_default_irq(ide_default_io_base(index));
                 ide_register_hw(&hw, NULL);
         }
diff -u --recursive linux-2.3.99pre9-2/include/asm-sparc64/ide.h linux/include/asm-sparc64/ide.h
--- linux-2.3.99pre9-2/include/asm-sparc64/ide.h Wed May 17 22:57:55 2000
+++ linux/include/asm-sparc64/ide.h Wed May 17 22:58:17 2000
@@ -59,7 +59,8 @@
         int index;
 
         for (index = 0; index < MAX_HWIFS; index++) {
- ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, 0);
+ memset(&hw, 0, sizeof(hw_regs_t));
+ ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, NULL);
                 hw.irq = ide_default_irq(ide_default_io_base(index));
                 ide_register_hw(&hw, NULL);
         }
*********************************************************

-- 
=======================================================================
  Andrzej M. Krzysztofowicz               ankry@mif.pg.gda.pl
  tel.  (0-58) 347 14 61
Wydz.Fizyki Technicznej i Matematyki Stosowanej Politechniki Gdanskiej

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue May 23 2000 - 21:00:13 EST