lkml.org 
[lkml]   [1999]   [Sep]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] support for ISAPnP code with ne2000 network driver
Hi!

Attached is a patch to support initializing a ISAPnP ne2k clone
with the ne.c driver. Unfortunately, deactivating the card at
module unload seems to be impossible (or at least hard) due to
a lack of a private field in struct net_dev. At least it works
for me, but probably other ID's have to be added to the isapnp
card list.

Richard.

--
Richard Guenther <richard.guenther@student.uni-tuebingen.de>
PGP: 2E829319 - 2F 83 FC 93 E9 E4 19 E2 93 7A 32 42 45 37 23 57
WWW: http://www.anatom.uni-tuebingen.de/~richi/


--- linux-2.3.16/drivers/net/ne.c.original Fri Sep 10 21:27:46 1999
+++ linux-2.3.16/drivers/net/ne.c Fri Sep 10 23:04:23 1999
@@ -28,7 +28,8 @@
rjohnson@analogic.com : Changed init order so an interrupt will only
occur after memory is allocated for dev->priv. Deallocated memory
last in cleanup_modue()
-
+ Richard Guenther : Added support for ISAPnP cards
+
*/

/* Routines for the NatSemi-based designs (NE[12]000). */
@@ -43,6 +44,7 @@
#include <linux/sched.h>
#include <linux/errno.h>
#include <linux/pci.h>
+#include <linux/isapnp.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <asm/system.h>
@@ -90,6 +92,13 @@
static int probe_pci = 1;
#endif

+static struct { unsigned short vendor, function; char *name; }
+isapnp_clone_list[] __initdata = {
+ {ISAPNP_VENDOR('E','D','I'), ISAPNP_FUNCTION(0x0216), "NN NE2000" },
+ {ISAPNP_VENDOR('P','N','P'), ISAPNP_FUNCTION(0x80d6), "Generic PNP" },
+ {0,}
+};
+
#ifdef SUPPORT_NE_BAD_CLONES
/* A list of bad clones that we none-the-less recognize. */
static struct { const char *name8, *name16; unsigned char SAprefix[4];}
@@ -128,6 +137,7 @@

int ne_probe(struct net_device *dev);
static int ne_probe1(struct net_device *dev, int ioaddr);
+static int ne_probe_isapnp(struct net_device *dev);
#ifdef CONFIG_PCI
static int ne_probe_pci(struct net_device *dev);
#endif
@@ -193,6 +203,10 @@
return 0;
#endif

+ /* Then look for any installed ISAPnP clones */
+ if (isapnp_present() && (ne_probe_isapnp(dev) == 0))
+ return 0;
+
#ifndef MODULE
/* Last resort. The semi-risky ISA auto-probe. */
for (base_addr = 0; netcard_portlist[base_addr] != 0; base_addr++) {
@@ -242,6 +256,45 @@
return -ENODEV;
}
#endif /* CONFIG_PCI */
+
+static int __init ne_probe_isapnp(struct net_device *dev)
+{
+ int i;
+
+ for (i = 0; isapnp_clone_list[i].vendor != 0; i++) {
+ struct pci_dev *idev = NULL;
+
+ while ((idev = isapnp_find_dev(NULL,
+ isapnp_clone_list[i].vendor,
+ isapnp_clone_list[i].function,
+ idev))) {
+ /* Avoid already found cards from previous calls */
+ if (idev->prepare(idev))
+ continue;
+ if (idev->activate(idev))
+ continue;
+ pci_irq_line = idev->irq_resource[0].start;
+ /* if no irq, search for next */
+ if (!pci_irq_line)
+ continue;
+ /* found it */
+ if (ne_probe1(dev, idev->resource[0].start) != 0) { /* Shouldn't happen. */
+ printk(KERN_ERR "ne.c: Probe of ISAPnP card at %#lx failed.\n",
+ idev->resource[0].start);
+ return -ENXIO;
+ }
+ break;
+ }
+ if (!idev)
+ continue;
+ printk(KERN_INFO "ne.c: ISAPnP reports %s at i/o %#lx, irq %d.\n",
+ isapnp_clone_list[i].name,
+ dev->base_addr, dev->irq);
+ return 0;
+ }
+
+ return -ENODEV;
+}

static int __init ne_probe1(struct net_device *dev, int ioaddr)
{

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:53    [W:0.046 / U:0.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site