Resent-Date: Sun, 22 Nov 1998 14:30:52 +0100 (MET)
Date: Sun, 22 Nov 1998 14:30:48 +0100
From: Alain Malek <alain@dumbo.cryogen.ch>
X-Accept-Language: en
To: linux68k <linux-m68k@phil.uni-sb.de>
Subject: Re: 8390.h reg_offset type
References: <3656C708.54CA0E2E@dumbo.cryogen.ch> <d3n25lnn82.fsf@valhall.cern.ch>
Resent-From: linux-m68k@phil.uni-sb.de


Jes Sorensen wrote:
> 
> If you send me a new patch I will be happy to put it in.

Here is the patch. It uses the type u32 as Alan did.
The change is reflected in the daynaport and ariadne2 drivers.
There are also some small fixes in the apne driver.

Alain

diff -ruN linux-2.1.127/Documentation/Configure.help linux/Documentation/Configure.help
--- linux-2.1.127/Documentation/Configure.help	Sun Nov 22 11:08:45 1998
+++ linux/Documentation/Configure.help	Sun Nov 22 11:38:24 1998
@@ -9237,6 +9237,10 @@
   Note that even if you say N here, you can still use your expansion
   cards. If in doubt, say Y.
 
+CONFIG_AMIGA_PCMCIA
+  Include support in the kernel for pcmcia on Amiga 1200 and Amiga 600.
+  If you intend to use pcmcia cards say Y; otherwise say N.
+
 Amiga GSP (TMS340x0) support
 CONFIG_AMIGA_GSP
   Include support for Amiga graphics cards that use the Texas
@@ -9439,6 +9443,16 @@
   This driver is also available as a module ( = code which can be
   inserted in and removed from the running kernel whenever you
   want). The module is called hydra.o. If you want to compile it as a
+  module, say M here and read Documentation/modules.txt.
+
+Pcmcia NE2000 compatible support
+CONFIG_APNE
+  If you have a pcmcia ne2000 compatible adapter, say Y.  Otherwise,
+  say N.
+
+  This driver is also available as a module ( = code which can be
+  inserted in and removed from the running kernel whenever you
+  want). The module is called apne.o. If you want to compile it as a
   module, say M here and read Documentation/modules.txt.
 
 Atari Lance support
diff -ruN linux-2.1.127/drivers/net/8390.h linux/drivers/net/8390.h
--- linux-2.1.127/drivers/net/8390.h	Sun Nov 22 11:10:59 1998
+++ linux/drivers/net/8390.h	Sun Nov 22 11:13:29 1998
@@ -177,7 +177,7 @@
   unsigned char saved_irq;	/* Original dev->irq value. */
   /* The new statistics table. */
   struct net_device_stats stat;
-  unsigned char *reg_offset;    /* Register mapping table */
+  u32 *reg_offset;		/* Register mapping table */
   unsigned long priv;		/* Private field to store bus IDs etc. */
 };
 
diff -ruN linux-2.1.127/drivers/net/apne.c linux/drivers/net/apne.c
--- linux-2.1.127/drivers/net/apne.c	Sun Nov 22 11:11:08 1998
+++ linux/drivers/net/apne.c	Sun Nov 22 11:12:52 1998
@@ -119,22 +119,26 @@
 static const char *version =
     "apne.c:v1.1 7/10/98 Alain Malek (Alain.Malek@cryogen.ch)\n";
 
+static int apne_owned = 0;	/* signal if card already owned */
 
 __initfunc(int apne_probe(struct device *dev))
 {
 #ifndef MANUAL_CONFIG
 	char tuple[8];
 #endif
+
+	if (apne_owned)
+		return -ENODEV;
         
 	if ( !(AMIGAHW_PRESENT(PCMCIA)) )
-		return (ENODEV);
+		return (-ENODEV);
                                 
 	printk("Looking for PCMCIA ethernet card : ");
                                         
 	/* check if a card is inserted */
 	if (!(PCMCIA_INSERTED)) {
 		printk("NO PCMCIA card inserted\n");
-		return (ENODEV);
+		return (-ENODEV);
 	}
                                                                                                 
 	/* disable pcmcia irq for readtuple */
@@ -144,7 +148,7 @@
 	if ((pcmcia_copy_tuple(CISTPL_FUNCID, tuple, 8) < 3) ||
 		(tuple[2] != CISTPL_FUNCID_NETWORK)) {
 		printk("not an ethernet card\n");
-		return (ENODEV);
+		return (-ENODEV);
 	}
 #endif
 
@@ -153,7 +157,7 @@
 	if (init_pcmcia())
 		return apne_probe1(dev, IOBASE+GAYLE_IO);
 	else
-		return (ENODEV);
+		return (-ENODEV);
 
 }
 
@@ -169,7 +173,7 @@
     int neX000, ctron;
 #endif
     static unsigned version_printed = 0;
-    static int pcmcia_offsets[16]={
+    static u32 pcmcia_offsets[16]={
                 0,   1+GAYLE_ODD,   2,   3+GAYLE_ODD,
                 4,   5+GAYLE_ODD,   6,   7+GAYLE_ODD,
                 8,   9+GAYLE_ODD, 0xa, 0xb+GAYLE_ODD,
@@ -197,7 +201,7 @@
 	while ((readb(ioaddr + NE_EN0_ISR) & ENISR_RESET) == 0)
 		if (jiffies - reset_start_time > 2*HZ/100) {
 			printk(" not found (no reset ack).\n");
-			return ENODEV;
+			return -ENODEV;
 		}
 
 	writeb(0xff, ioaddr + NE_EN0_ISR);		/* Ack all intr. */
@@ -328,6 +332,8 @@
     pcmcia_ack_int(pcmcia_get_intreq());		/* ack PCMCIA int req */
     pcmcia_enable_irq();
 
+    apne_owned = 1;
+
     return 0;
 }
 
@@ -390,7 +396,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:%d].\n",
+	   "[DMAstat:%d][irqlock:%d][intr:%ld].\n",
 	   dev->name, ei_status.dmaing, ei_status.irqlock,
 	   dev->interrupt);
 	return;
@@ -439,7 +445,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:%d].\n",
+	   "[DMAstat:%d][irqlock:%d][intr:%ld].\n",
 	   dev->name, ei_status.dmaing, ei_status.irqlock,
 	   dev->interrupt);
 	return;
@@ -488,7 +494,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:%d]\n",
+	   "[DMAstat:%d][irqlock:%d][intr:%ld]\n",
 	   dev->name, ei_status.dmaing, ei_status.irqlock,
 	   dev->interrupt);
 	return;
@@ -586,6 +592,8 @@
 	pcmcia_reset();
 
 	unlock_8390_module();
+
+	apne_owned = 0;
 }
 
 #endif
diff -ruN linux-2.1.127/drivers/net/ariadne2.c linux/drivers/net/ariadne2.c
--- linux-2.1.127/drivers/net/ariadne2.c	Sun Nov 22 11:11:09 1998
+++ linux/drivers/net/ariadne2.c	Sun Nov 22 11:13:52 1998
@@ -107,7 +107,7 @@
     unsigned char SA_prom[32];
     const char *name = NULL;
     int start_page, stop_page;
-    static int ariadne2_offsets[16] = {
+    static u32 ariadne2_offsets[16] = {
 	0x00, 0x02, 0x04, 0x06, 0x08, 0x0a, 0x0c, 0x0e,
 	0x10, 0x12, 0x14, 0x16, 0x18, 0x1a, 0x1c, 0x1e,
     };
diff -ruN linux-2.1.127/drivers/net/daynaport.c linux/drivers/net/daynaport.c
--- linux-2.1.127/drivers/net/daynaport.c	Sun Nov 22 11:11:10 1998
+++ linux/drivers/net/daynaport.c	Sun Nov 22 11:14:23 1998
@@ -340,13 +340,13 @@
 {
 	static unsigned version_printed = 0;
 
-	static int fwrd4_offsets[16]={
+	static u32 fwrd4_offsets[16]={
 		0,      4,      8,      12,
 		16,     20,     24,     28,
 		32,     36,     40,     44,
 		48,     52,     56,     60
 	};
-	static int back4_offsets[16]={
+	static u32 back4_offsets[16]={
 		60,     56,     52,     48,
 		44,     40,     36,     32,
 		28,     24,     20,     16,

