patch-2.4.0-test12 linux/drivers/ide/q40ide.c

Next file: linux/drivers/ieee1394/guid.c
Previous file: linux/drivers/ide/ide.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test11/linux/drivers/ide/q40ide.c linux/drivers/ide/q40ide.c
@@ -1,18 +1,12 @@
 /*
  *  linux/drivers/ide/q40ide.c -- Q40 I/O port IDE Driver
  *
- *     original file created 12 Jul 1997 by Geert Uytterhoeven
+ *     (c) Richard Zidlicky
  *
  *  This file is subject to the terms and conditions of the GNU General Public
  *  License.  See the file COPYING in the main directory of this archive for
  *  more details.
  *
- * RZ:
- *  almost identical with pcide.c, maybe we can merge it later. 
- *  Differences:
- *       max 2 HWIFS for now
- *       translate portaddresses to q40 native addresses (not yet...) instead rely on in/out[bw]
- *         address translation
  *
  */
 
@@ -28,7 +22,7 @@
      *  Bases of the IDE interfaces
      */
 
-#define PCIDE_NUM_HWIFS	2
+#define Q40IDE_NUM_HWIFS	2
 
 #define PCIDE_BASE1	0x1f0
 #define PCIDE_BASE2	0x170
@@ -37,7 +31,7 @@
 #define PCIDE_BASE5	0x1e0
 #define PCIDE_BASE6	0x160
 
-static const q40ide_ioreg_t pcide_bases[PCIDE_NUM_HWIFS] = {
+static const q40ide_ioreg_t pcide_bases[Q40IDE_NUM_HWIFS] = {
     PCIDE_BASE1, PCIDE_BASE2, /* PCIDE_BASE3, PCIDE_BASE4  , PCIDE_BASE5,
     PCIDE_BASE6 */
 };
@@ -58,7 +52,7 @@
     PCIDE_REG(CMD)
 };
 
-int q40ide_default_irq(q40ide_ioreg_t base)
+static int q40ide_default_irq(q40ide_ioreg_t base)
 {
            switch (base) { 
 	            case 0x1f0: return 14;
@@ -69,41 +63,26 @@
 	   }
 }
 
-void q40_ide_init_hwif_ports (q40ide_ioreg_t *p, q40ide_ioreg_t base, int *irq)
-{
-	q40ide_ioreg_t port = base;
-	int i = 8;
-
-	while (i--)
-		*p++ = port++;
-	*p++ = base + 0x206;
-	if (irq != NULL)
-		*irq = 0;
-}
 
 
     /*
-     *  Probe for PC IDE interfaces
+     *  Probe for Q40 IDE interfaces
      */
 
-int q40ide_probe_hwif(int index, ide_hwif_t *hwif)
+void q40ide_init(void)
 {
-    static int pcide_index[PCIDE_NUM_HWIFS] = { 0, };
     int i;
 
     if (!MACH_IS_Q40)
-      return 0;
+      return ;
 
-    for (i = 0; i < PCIDE_NUM_HWIFS; i++) {
-	if (!pcide_index[i]) {
-	  /*printk("ide%d: Q40 IDE interface\n", index);*/
-	    pcide_index[i] = index+1;
-	}
-	if (pcide_index[i] == index+1) {
-	    ide_setup_ports(hwif,(ide_ioreg_t) pcide_bases[i], pcide_offsets, 0, /*q40_ack_intr???*/ NULL);
-	    hwif->irq = ide_default_irq((ide_ioreg_t)pcide_bases[i]); /*q40_ide_irq[i];  */ /* 14 */
-	    return 1;
-	}
+    for (i = 0; i < Q40IDE_NUM_HWIFS; i++) {
+	hw_regs_t hw;
+
+	ide_setup_ports(&hw,(ide_ioreg_t) pcide_bases[i], (int *)pcide_offsets, 
+			pcide_bases[i]+0x206, 
+			0, NULL, q40ide_default_irq(pcide_bases[i]));
+	ide_register_hw(&hw, NULL);
     }
-    return 0;
 }
+

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)