Resent-Date: Wed, 6 Jan 1999 10:05:25 +0100 (MET)
From: zippel@fh-brandenburg.de (Roman Zippel)
Subject: Re: Ariadne2
To: steigies@physik.uni-kiel.de
Date: Wed, 6 Jan 1999 10:04:37 +0100 (MET)
Cc: linux-m68k@lists.linux-m68k.org
In-Reply-To: <Pine.LNX.3.96.981228140834.5821A-100000@ap031.experimentalphysik.uni-kiel.de> from "Christian T. Steigies" at Dec 28, 98 02:13:12 pm
Resent-From: linux-m68k@phil.uni-sb.de

Hi,

> my weekly update about the (non-)progress of ariadne2 for 2.0.36. Mostly
> spelling fixes (ok, Geert?). New wrapper function ariadne2_interrupt to
> minimize changes in 8390.c (should be equivalent to Michael patch now).
> The bad news, it doesnt work any better with that, I guess I need another
> hint.

What's the problem with it? I only needed to remove (un)lock_8390_module()
to get it compiled and a first working version. After that I only had to
shut up the interrupt and to correct a unload bug and it works nicely
now. The other changes are cosmetic changes (I think we don't really need
a wrapper for the interrupt?).

bye, Roman

--- linux-2.0.36-pre1/drivers/net/ariadne2.c.org	Tue Jan  5 20:14:33 1999
+++ linux-2.0.36-pre1/drivers/net/ariadne2.c	Wed Jan  6 00:25:08 1999
@@ -82,7 +82,6 @@
 static void ariadne2_block_output(struct device *dev, const int count,
 				  const unsigned char *buf,
 				  const int start_page);
-static void ariadne2_interrupt(int irq, void *dev_id, struct pt_regs *regs);
 
 
 int ariadne2_probe(struct device *dev)
@@ -180,7 +179,7 @@
     dev->base_addr = ioaddr;
     dev->irq = IRQ_IDX(IRQ_AMIGA_PORTS); /* whatever IRQ, WITHOUT THE *?! IRQ_MACHSPEC BIT */
 #ifdef ARIADNE2_DEBUG
-    printk("irq2dev_map[%d] = %ld\n", IRQ_IDX(dev->irq), dev);
+    printk("irq2dev_map[%ld] = %p\n", IRQ_IDX(dev->irq), dev);
     printk("dev->base_addr:%ld  dev->irq:%d  dev->name:%s\n", 
             dev->base_addr,     dev->irq,    dev->name);
 #endif
@@ -189,10 +188,7 @@
     /* array contains only 16 elements, so here without the IRQ_MACHSPEC bit */
 
     /* Install the Interrupt handler */
-    if (request_irq(IRQ_AMIGA_PORTS, ariadne2_interrupt, 0, "AriadNE2 Ethernet", dev))
-    /* request_irq has to be called with IRQ_MACHSPEC bit, otherwise arch/m68k/kernel/ints.c barfs:
-       request_irq: Incorrect IRQ 12 from AriadNE2 Ethernet
-    */
+    if (request_irq(IRQ_AMIGA_PORTS, ei_interrupt, 0, "AriadNE2 Ethernet", dev))
     {
 #ifdef ARIADNE2_DEBUG
     	printk("ariadne2: request irq failed?\n");
@@ -303,7 +299,7 @@
     /* This *shouldn't* happen. If it does, it's the last thing you'll see */
     if (ei_status.dmaing) {
 	printk("%s: DMAing conflict in ne_get_8390_hdr "
-	   "[DMAstat:%d][irqlock:%d][intr:%ld].\n", dev->name, ei_status.dmaing,
+	   "[DMAstat:%d][irqlock:%d][intr:%d].\n", dev->name, ei_status.dmaing,
 	   ei_status.irqlock, dev->interrupt);
 	return;
     }
@@ -344,7 +340,7 @@
     /* This *shouldn't* happen. If it does, it's the last thing you'll see */
     if (ei_status.dmaing) {
 	printk("%s: DMAing conflict in ne_block_input "
-	   "[DMAstat:%d][irqlock:%d][intr:%ld].\n",
+	   "[DMAstat:%d][irqlock:%d][intr:%d].\n",
 	   dev->name, ei_status.dmaing, ei_status.irqlock,
 	   dev->interrupt);
 	return;
@@ -385,7 +381,7 @@
     /* This *shouldn't* happen. If it does, it's the last thing you'll see */
     if (ei_status.dmaing) {
 	printk("%s: DMAing conflict in ne_block_output."
-	   "[DMAstat:%d][irqlock:%d][intr:%ld]\n", dev->name, ei_status.dmaing,
+	   "[DMAstat:%d][irqlock:%d][intr:%d]\n", dev->name, ei_status.dmaing,
 	   ei_status.irqlock, dev->interrupt);
 	return;
     }
@@ -421,11 +417,6 @@
     return;
 }
 
-void ariadne2_interrupt(int irq, void *dev_id, struct pt_regs *regs)
-{
-        ei_interrupt(IRQ_IDX(irq), dev_id, regs);
-}
-        
 #ifdef MODULE
 static char devicename[9] = { 0, };
 
@@ -445,7 +436,6 @@
 	    printk("No AriadNE2 ethernet card found.\n");
 	return err;
     }
-    lock_8390_module();
     return 0;
 }
 
@@ -454,8 +444,7 @@
     unsigned int key = ((struct ei_device *)ariadne2_dev.priv)->priv;
     free_irq(IRQ_AMIGA_PORTS, &ariadne2_dev);
     unregister_netdev(&ariadne2_dev);
-    zorro_config_board(key, 0);
-    unlock_8390_module();
+    zorro_unconfig_board(key, 0);
 }
 
 #endif	/* MODULE */
--- linux-2.0.36-pre1/drivers/net/8390.c.org	Tue Jan  5 23:46:50 1999
+++ linux-2.0.36-pre1/drivers/net/8390.c	Tue Jan  5 23:57:04 1999
@@ -52,6 +52,7 @@
 #include <asm/segment.h>
 #include <asm/bitops.h>
 #include <asm/io.h>
+#include <asm/irq.h>
 #include <linux/errno.h>
 #include <linux/fcntl.h>
 #include <linux/in.h>
@@ -122,6 +123,7 @@
     NS8390_init(dev, 1);
     dev->start = 1;
     ei_local->irqlock = 0;
+    MOD_INC_USE_COUNT;
     return 0;
 }
 
@@ -130,6 +132,7 @@
 {
     NS8390_init(dev, 0);
     dev->start = 0;
+    MOD_DEC_USE_COUNT;
     return 0;
 }
 
@@ -285,11 +288,7 @@
    Handle the ether interface interrupts. */
 void ei_interrupt(int irq, void *dev_id, struct pt_regs * regs)
 {
-#if 1
-    struct device *dev = (struct device *)(irq2dev_map[irq]);
-#else
     struct device *dev = (struct device *)(irq2dev_map[IRQ_IDX(irq)]);
-#endif
     int e8390_base;
     int interrupts, nr_serviced = 0;
     struct ei_device *ei_local;
@@ -300,11 +299,12 @@
     }
     e8390_base = dev->base_addr;
     ei_local = (struct ei_device *) dev->priv;
-    if (dev->interrupt || ei_local->irqlock) {
+    if (ei_local->irqlock)
+	/* We assume a shared interrupt */
+	return;
+    if (dev->interrupt) {
 		/* The "irqlock" check is only for testing. */
-		printk(ei_local->irqlock
-			   ? "%s: Interrupted while interrupts are masked! isr=%#2x imr=%#2x.\n"
-			   : "%s: Reentering the interrupt handler! isr=%#2x imr=%#2x.\n",
+		printk("%s: Reentering the interrupt handler! isr=%#2x imr=%#2x.\n",
 			   dev->name, inb_p(e8390_base + EN0_ISR),
 			   inb_p(e8390_base + EN0_IMR));
 		return;

