patch-1.3.17 linux/drivers/net/hp.c

Next file: linux/drivers/net/ibmtr.c
Previous file: linux/drivers/net/hp-plus.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.16/linux/drivers/net/hp.c linux/drivers/net/hp.c
@@ -21,6 +21,12 @@
 static const char *version =
 	"hp.c:v1.10 9/23/94 Donald Becker (becker@cesdis.gsfc.nasa.gov)\n";
 
+
+#ifdef MODULE
+#include <linux/module.h>
+#include <linux/version.h>
+#endif
+
 #include <linux/kernel.h>
 #include <linux/sched.h>
 #include <linux/errno.h>
@@ -66,6 +72,9 @@
 /* My default is IRQ5	   0  1	 2  3  4  5  6	7  8  9 10 11 */
 static char irqmap[16] = { 0, 0, 4, 6, 8,10, 0,14, 0, 4, 2,12,0,0,0,0};
 
+/* NE2000, et.al. bug-fix code */
+static int ne8390_rw_bugfix = 0;
+
 
 /*	Probe for an HP LAN adaptor.
 	Also initialize the card and fill in STATION_ADDR with the station
@@ -266,18 +275,19 @@
 	/* We should already be in page 0, but to be safe... */
 	outb_p(E8390_PAGE0+E8390_START+E8390_NODMA, nic_base);
 
-#ifdef ei8390_bug
-	/* Handle the read-before-write bug the same way as the
-	   Crynwr packet driver -- the NatSemi method doesn't work. */
-	outb_p(0x42, nic_base + EN0_RCNTLO);
-	outb_p(0,	nic_base + EN0_RCNTHI);
-	outb_p(0xff, nic_base + EN0_RSARLO);
-	outb_p(0x00, nic_base + EN0_RSARHI);
-	outb_p(E8390_RREAD+E8390_START, EN_CMD);
-	/* Make certain that the dummy read has occurred. */
-	inb_p(0x61);
-	inb_p(0x61);
-#endif
+	if (ne8390_rw_bugfix) {
+		/* Handle the read-before-write bug the same way as the
+		   Crynwr packet driver -- the NatSemi method doesn't work. */
+		outb_p(0x42, nic_base + EN0_RCNTLO);
+		outb_p(0,	nic_base + EN0_RCNTHI);
+		outb_p(0xff, nic_base + EN0_RSARLO);
+		outb_p(0x00, nic_base + EN0_RSARHI);
+#define NE_CMD	 	0x00
+		outb_p(E8390_RREAD+E8390_START, nic_base + NE_CMD);
+		/* Make certain that the dummy read has occurred. */
+		inb_p(0x61);
+		inb_p(0x61);
+	}
 
 	outb_p(count & 0xff, nic_base + EN0_RCNTLO);
 	outb_p(count >> 8,	 nic_base + EN0_RCNTHI);
@@ -318,6 +328,36 @@
 	return;
 }
 
+#ifdef MODULE
+char kernel_version[] = UTS_RELEASE;
+static struct device dev_hp = {
+	"        " /*"hp"*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, hp_probe };
+
+int io = 0;
+int irq = 0;
+
+int init_module(void)
+{
+	dev_hp.base_addr = io;
+	dev_hp.irq       = irq;
+	if (register_netdev(&dev_hp) != 0) {
+		printk("hp: register_netdev() returned non-zero.\n");
+		return -EIO;
+	}
+	return 0;
+}
+
+void
+cleanup_module(void)
+{
+	if (MOD_IN_USE)
+		printk("hp: device busy, remove delayed\n");
+	else
+	{
+		unregister_netdev(&dev_hp);
+	}
+}
+#endif /* MODULE */
 
 /*
  * Local variables:

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this