patch-2.4.3 linux/drivers/net/3c509.c
Next file: linux/drivers/net/3c515.c
Previous file: linux/drivers/net/3c505.c
Back to the patch index
Back to the overall index
- Lines: 247
- Date:
Sun Mar 25 18:14:25 2001
- Orig file:
v2.4.2/linux/drivers/net/3c509.c
- Orig date:
Wed Feb 21 18:20:25 2001
diff -u --recursive --new-file v2.4.2/linux/drivers/net/3c509.c linux/drivers/net/3c509.c
@@ -1,8 +1,8 @@
/* 3c509.c: A 3c509 EtherLink3 ethernet driver for linux. */
/*
- Written 1993-1998 by Donald Becker.
+ Written 1993-2000 by Donald Becker.
- Copyright 1994-1998 by Donald Becker.
+ Copyright 1994-2000 by Donald Becker.
Copyright 1993 United States Government as represented by the
Director, National Security Agency. This software may be used and
distributed according to the terms of the GNU General Public License,
@@ -39,9 +39,11 @@
v1.14 10/15/97 Avoided waiting..discard message for fast machines -djb
v1.15 1/31/98 Faster recovery for Tx errors. -djb
v1.16 2/3/98 Different ID port handling to avoid sound cards. -djb
+ v1.18 12Mar2001 Andrew Morton <andrewm@uow.edu.au>
+ - Avoid bogus detect of 3c590's (Andrzej Krzysztofowicz)
+ - Reviewed against 1.18 from scyld.com
*/
-static char *version = "3c509.c:1.16 (2.2) 2/3/98 becker@cesdis.gsfc.nasa.gov.\n";
/* A few values that may be tweaked. */
/* Time in jiffies before concluding the transmitter is hung. */
@@ -61,6 +63,7 @@
#include <linux/in.h>
#include <linux/slab.h>
#include <linux/ioport.h>
+#include <linux/init.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/skbuff.h>
@@ -71,10 +74,13 @@
#include <asm/io.h>
#include <asm/irq.h>
+static char versionA[] __initdata = "3c509.c:1.18 12Mar2001 becker@scyld.com\n";
+static char versionB[] __initdata = "http://www.scyld.com/network/3c509.html\n";
+
#ifdef EL3_DEBUG
-int el3_debug = EL3_DEBUG;
+static int el3_debug = EL3_DEBUG;
#else
-int el3_debug = 2;
+static int el3_debug = 2;
#endif
/* To minimize the size of the driver source I only define operating
@@ -137,7 +143,7 @@
struct sk_buff *queue[SKB_QUEUE_SIZE];
char mca_slot;
};
-static int id_port = 0x110; /* Start with 0x110 to avoid new sound cards.*/
+static int id_port __initdata = 0x110; /* Start with 0x110 to avoid new sound cards.*/
static struct net_device *el3_root_dev = NULL;
static ushort id_read_eeprom(int index);
@@ -158,7 +164,7 @@
int id;
};
-struct el3_mca_adapters_struct el3_mca_adapters[] = {
+static struct el3_mca_adapters_struct el3_mca_adapters[] __initdata = {
{ "3Com 3c529 EtherLink III (10base2)", 0x627c },
{ "3Com 3c529 EtherLink III (10baseT)", 0x627d },
{ "3Com 3c529 EtherLink III (test mode)", 0x62db },
@@ -166,29 +172,38 @@
{ "3Com 3c529 EtherLink III (TP)", 0x62f7 },
{ NULL, 0 },
};
-#endif
+#endif /* CONFIG_MCA */
-#ifdef __ISAPNP__
-struct el3_isapnp_adapters_struct {
- unsigned short vendor, function;
- char *name;
-};
-static struct el3_isapnp_adapters_struct el3_isapnp_adapters[] = {
- {ISAPNP_VENDOR('T', 'C', 'M'), ISAPNP_FUNCTION(0x5090), "3Com Etherlink III (TP)"},
- {ISAPNP_VENDOR('T', 'C', 'M'), ISAPNP_FUNCTION(0x5091), "3Com Etherlink III"},
- {ISAPNP_VENDOR('T', 'C', 'M'), ISAPNP_FUNCTION(0x5094), "3Com Etherlink III (combo)"},
- {ISAPNP_VENDOR('T', 'C', 'M'), ISAPNP_FUNCTION(0x5095), "3Com Etherlink III (TPO)"},
- {ISAPNP_VENDOR('T', 'C', 'M'), ISAPNP_FUNCTION(0x5098), "3Com Etherlink III (TPC)"},
- {ISAPNP_VENDOR('P', 'N', 'P'), ISAPNP_FUNCTION(0x80f8), "3Com Etherlink III compatible"},
- {0, }
+#ifdef CONFIG_ISAPNP
+static struct isapnp_device_id el3_isapnp_adapters[] __initdata = {
+ { ISAPNP_ANY_ID, ISAPNP_ANY_ID,
+ ISAPNP_VENDOR('T', 'C', 'M'), ISAPNP_FUNCTION(0x5090),
+ (long) "3Com Etherlink III (TP)" },
+ { ISAPNP_ANY_ID, ISAPNP_ANY_ID,
+ ISAPNP_VENDOR('T', 'C', 'M'), ISAPNP_FUNCTION(0x5091),
+ (long) "3Com Etherlink III" },
+ { ISAPNP_ANY_ID, ISAPNP_ANY_ID,
+ ISAPNP_VENDOR('T', 'C', 'M'), ISAPNP_FUNCTION(0x5094),
+ (long) "3Com Etherlink III (combo)" },
+ { ISAPNP_ANY_ID, ISAPNP_ANY_ID,
+ ISAPNP_VENDOR('T', 'C', 'M'), ISAPNP_FUNCTION(0x5095),
+ (long) "3Com Etherlink III (TPO)" },
+ { ISAPNP_ANY_ID, ISAPNP_ANY_ID,
+ ISAPNP_VENDOR('T', 'C', 'M'), ISAPNP_FUNCTION(0x5098),
+ (long) "3Com Etherlink III (TPC)" },
+ { ISAPNP_ANY_ID, ISAPNP_ANY_ID,
+ ISAPNP_VENDOR('P', 'N', 'P'), ISAPNP_FUNCTION(0x80f8),
+ (long) "3Com Etherlink III compatible" },
+ { } /* terminate list */
};
+
+MODULE_DEVICE_TABLE(isapnp, el3_isapnp_adapters);
+
static u16 el3_isapnp_phys_addr[8][3];
-#endif /* CONFIG_ISAPNP */
-#ifdef __ISAPNP__
static int nopnp;
-#endif
+#endif /* CONFIG_ISAPNP */
-int el3_probe(struct net_device *dev)
+int __init el3_probe(struct net_device *dev)
{
struct el3_private *lp;
short lrs_state = 0xff, i;
@@ -196,9 +211,9 @@
u16 phys_addr[3];
static int current_tag = 0;
int mca_slot = -1;
-#ifdef __ISAPNP__
+#ifdef CONFIG_ISAPNP
static int pnp_cards = 0;
-#endif /* __ISAPNP__ */
+#endif /* CONFIG_ISAPNP */
if (dev) SET_MODULE_OWNER(dev);
@@ -207,6 +222,8 @@
if (EISA_bus) {
static int eisa_addr = 0x1000;
while (eisa_addr < 0x9000) {
+ int device_id;
+
ioaddr = eisa_addr;
eisa_addr += 0x1000;
@@ -214,6 +231,12 @@
if (inw(ioaddr + 0xC80) != 0x6d50)
continue;
+ /* Avoid conflict with 3c590, 3c592, 3c597, etc */
+ device_id = (inb(ioaddr + 0xC82)<<8) + inb(ioaddr + 0xC83);
+ if ((device_id & 0xFF00) == 0x5900) {
+ continue;
+ }
+
/* Change the register set to the configuration window 0. */
outw(SelectWindow | 0, ioaddr + 0xC80 + EL3_CMD);
@@ -294,7 +317,7 @@
}
#endif /* CONFIG_MCA */
-#ifdef __ISAPNP__
+#ifdef CONFIG_ISAPNP
if (nopnp == 1)
goto no_pnp;
@@ -318,7 +341,7 @@
irq = idev->irq_resource[0].start;
if (el3_debug > 3)
printk ("ISAPnP reports %s at i/o 0x%x, irq %d\n",
- el3_isapnp_adapters[i].name, ioaddr, irq);
+ (char*) el3_isapnp_adapters[i].driver_data, ioaddr, irq);
EL3WINDOW(0);
for (j = 0; j < 3; j++)
el3_isapnp_phys_addr[pnp_cards][j] =
@@ -330,7 +353,7 @@
}
}
no_pnp:
-#endif /* __ISAPNP__ */
+#endif /* CONFIG_ISAPNP */
/* Select an open I/O location at 0x1*0 to do contention select. */
for ( ; id_port < 0x200; id_port += 0x10) {
@@ -376,7 +399,7 @@
phys_addr[i] = htons(id_read_eeprom(i));
}
-#ifdef __ISAPNP__
+#ifdef CONFIG_ISAPNP
if (nopnp == 0) {
/* The ISA PnP 3c509 cards respond to the ID sequence.
This check is needed in order not to register them twice. */
@@ -396,7 +419,7 @@
}
}
}
-#endif /* __ISAPNP__ */
+#endif /* CONFIG_ISAPNP */
{
unsigned int iobase = id_read_eeprom(8);
@@ -451,7 +474,7 @@
{
const char *if_names[] = {"10baseT", "AUI", "undefined", "BNC"};
- printk("%s: 3c509 at %#3.3lx, %s port, address ",
+ printk("%s: 3c5x9 at %#3.3lx, %s port, address ",
dev->name, dev->base_addr, if_names[dev->if_port]);
}
@@ -474,7 +497,7 @@
el3_root_dev = dev;
if (el3_debug > 0)
- printk(version);
+ printk(KERN_INFO "%s" KERN_INFO "%s", versionA, versionB);
/* The EL3-specific entries in the device structure. */
dev->open = &el3_open;
@@ -493,7 +516,7 @@
/* Read a word from the EEPROM using the regular EEPROM access register.
Assume that we are in register window zero.
*/
-static ushort read_eeprom(int ioaddr, int index)
+static ushort __init read_eeprom(int ioaddr, int index)
{
outw(EEPROM_READ + index, ioaddr + 10);
/* Pause for at least 162 us. for the read to take place. */
@@ -502,7 +525,7 @@
}
/* Read a word from the EEPROM when in the ISA ID probe state. */
-static ushort id_read_eeprom(int index)
+static ushort __init id_read_eeprom(int index)
{
int bit, word = 0;
@@ -984,7 +1007,7 @@
MODULE_PARM(irq,"1-8i");
MODULE_PARM(xcvr,"1-8i");
MODULE_PARM(max_interrupt_work, "i");
-#ifdef __ISAPNP__
+#ifdef CONFIG_ISAPNP
MODULE_PARM(nopnp, "i");
#endif
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)