patch-2.2.14 linux/drivers/isdn/eicon/eicon_isa.c

Next file: linux/drivers/isdn/eicon/eicon_isa.h
Previous file: linux/drivers/isdn/eicon/eicon_io.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.13/linux/drivers/isdn/eicon/eicon_isa.c linux/drivers/isdn/eicon/eicon_isa.c
@@ -1,4 +1,4 @@
-/* $Id: eicon_isa.c,v 1.9 1999/09/08 20:17:31 armin Exp $
+/* $Id: eicon_isa.c,v 1.12 1999/11/27 12:56:19 armin Exp $
  *
  * ISDN low-level module for Eicon.Diehl active ISDN-Cards.
  * Hardware-specific code for old ISA cards.
@@ -22,8 +22,17 @@
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 
  *
  * $Log: eicon_isa.c,v $
+ * Revision 1.12  1999/11/27 12:56:19  armin
+ * Forgot some iomem changes for last ioremap compat.
+ *
+ * Revision 1.11  1999/11/25 11:33:09  armin
+ * Microchannel fix from Erik Weber (exrz73@ibm.net).
+ *
+ * Revision 1.10  1999/11/18 21:14:30  armin
+ * New ISA memory mapped IO
+ *
  * Revision 1.9  1999/09/08 20:17:31  armin
- * Added microchannel patch from Erik Weber.
+ * Added microchannel patch from Erik Weber (exrz73@ibm.net).
  *
  * Revision 1.8  1999/09/06 07:29:35  fritz
  * Changed my mail-address.
@@ -70,7 +79,7 @@
 #define release_shmem release_region
 #define request_shmem request_region
 
-char *eicon_isa_revision = "$Revision: 1.9 $";
+char *eicon_isa_revision = "$Revision: 1.12 $";
 
 #undef EICON_MCA_DEBUG
 
@@ -87,8 +96,9 @@
 
 static void
 eicon_isa_release_shmem(eicon_isa_card *card) {
-	if (card->mvalid)
+	if (card->mvalid) {
 		release_shmem((unsigned long)card->shmem, card->ramsize);
+	}
 	card->mvalid = 0;
 }
 
@@ -117,7 +127,7 @@
 		case EICON_CTYPE_S2M:
 			printk(KERN_INFO "Eicon %s at 0x%lx, irq %d.\n",
 			       eicon_ctype_name[card->type],
-			       (unsigned long)card->shmem,
+			       card->physmem,
 			       card->irq);
 	}
 }
@@ -126,6 +136,7 @@
 eicon_isa_find_card(int Mem, int Irq, char * Id)
 {
 	int primary = 1;
+	unsigned long amem;
 
 	if (!strlen(Id))
 		return -1;
@@ -143,19 +154,20 @@
 		return -1;
 	}
 
-        writew(0x55aa, Mem + 0x402);
-        if (readw(Mem + 0x402) != 0x55aa) primary = 0;
-	writew(0, Mem + 0x402);
-	if (readw(Mem + 0x402) != 0) primary = 0;
+	amem = (unsigned long) Mem;
+        writew(0x55aa, amem + 0x402);
+        if (readw(amem + 0x402) != 0x55aa) primary = 0;
+	writew(0, amem + 0x402);
+	if (readw(amem + 0x402) != 0) primary = 0;
 
 	printk(KERN_INFO "Eicon: Driver-ID: %s\n", Id);
 	if (primary) {
 		printk(KERN_INFO "Eicon: assuming pri card at 0x%x\n", Mem);
-		writeb(0, Mem + 0x3ffe);
+		writeb(0, amem + 0x3ffe);
 		return EICON_CTYPE_ISAPRI;
 	} else {
 		printk(KERN_INFO "Eicon: assuming bri card at 0x%x\n", Mem);
-		writeb(0, Mem + 0x400);
+		writeb(0, amem + 0x400);
 		return EICON_CTYPE_ISABRI;
 	}
 	return -1;
@@ -187,57 +199,65 @@
 		return -EFAULT;
 	}
 
+	if (card->type == EICON_CTYPE_ISAPRI)
+		card->ramsize  = RAMSIZE_P;
+	else
+		card->ramsize  = RAMSIZE;
+
+	/* Register shmem */
+	if (check_shmem((unsigned long)card->shmem, card->ramsize)) {
+		printk(KERN_WARNING "eicon_isa_boot: memory at 0x%lx already in use.\n",
+			(unsigned long)card->shmem);
+		kfree(code);
+		return -EBUSY;
+	}
+	request_shmem((unsigned long)card->shmem, card->ramsize, "Eicon ISA ISDN");
+#ifdef EICON_MCA_DEBUG
+	printk(KERN_INFO "eicon_isa_boot: card->ramsize = %d.\n", card->ramsize);
+#endif
+	card->mvalid = 1;
+
 	switch(card->type) {
 		case EICON_CTYPE_S:
 		case EICON_CTYPE_SX:
 		case EICON_CTYPE_SCOM:
 		case EICON_CTYPE_QUADRO:
 		case EICON_CTYPE_ISABRI:
-			card->ramsize  = RAMSIZE;
 			card->intack   = (__u8 *)card->shmem + INTACK;
 			card->startcpu = (__u8 *)card->shmem + STARTCPU;
 			card->stopcpu  = (__u8 *)card->shmem + STOPCPU;
 			break;
 		case EICON_CTYPE_S2M:
 		case EICON_CTYPE_ISAPRI:
-			card->ramsize  = RAMSIZE_P;
 			card->intack   = (__u8 *)card->shmem + INTACK_P;
 			card->startcpu = (__u8 *)card->shmem + STARTCPU_P;
 			card->stopcpu  = (__u8 *)card->shmem + STOPCPU_P;
 			break;
 		default:
 			printk(KERN_WARNING "eicon_isa_boot: Invalid card type %d\n", card->type);
+			eicon_isa_release_shmem(card);
+			kfree(code);
 			return -EINVAL;
 	}
 
-	/* Register shmem */
-	if (check_shmem((unsigned long)card->shmem, card->ramsize)) {
-		printk(KERN_WARNING "eicon_isa_boot: memory at 0x%lx already in use.\n",
-			(unsigned long)card->shmem);
-		kfree(code);
-		return -EBUSY;
-	}
-	request_shmem((unsigned long)card->shmem, card->ramsize, "Eicon ISA ISDN");
-#ifdef EICON_MCA_DEBUG
-	printk(KERN_INFO "eicon_isa_boot: card->ramsize = %d.\n", card->ramsize);
-#endif
-	card->mvalid = 1;
-
 	/* clear any pending irq's */
 	readb(card->intack);
 #ifdef CONFIG_MCA
-	if (card->type == EICON_CTYPE_SCOM) {
-		outb_p(0,card->io+1);
-	}
-	else {
-		printk(KERN_WARNING "eicon_isa_boot: Card type yet not supported.\n");
-		return -EINVAL;
-	};
+	if (MCA_bus) {
+		if (card->type == EICON_CTYPE_SCOM) {
+			outb_p(0,card->io+1);
+		}
+		else {
+			printk(KERN_WARNING "eicon_isa_boot: Card type not supported yet.\n");
+			eicon_isa_release_shmem(card);
+			return -EINVAL;
+		};
 
 #ifdef EICON_MCA_DEBUG
 	printk(KERN_INFO "eicon_isa_boot: card->io      = %x.\n", card->io);
 	printk(KERN_INFO "eicon_isa_boot: card->irq     = %d.\n", (int)card->irq);
 #endif
+	}
 #else
 	/* set reset-line active */
 	writeb(0, card->stopcpu); 
@@ -269,7 +289,9 @@
 	/* Start CPU */
 	writeb(cbuf.boot_opt, &boot->ctrl);
 #ifdef CONFIG_MCA
-	outb_p(0, card->io);
+	if (MCA_bus) {
+		outb_p(0, card->io);
+	}
 #else 
 	writeb(0, card->startcpu); 
 #endif /* CONFIG_MCA */
@@ -320,7 +342,7 @@
         }
 	printk(KERN_INFO "%s: startup-code loaded\n", eicon_ctype_name[card->type]); 
 	if ((card->type == EICON_CTYPE_QUADRO) && (card->master)) {
-		tmp = eicon_addcard(card->type, (unsigned long)card->shmem, card->irq, 
+		tmp = eicon_addcard(card->type, card->physmem, card->irq, 
 					((eicon_card *)card->card)->regname);
 		printk(KERN_INFO "Eicon: %d adapters added\n", tmp);
 	}

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