From owner-freebsd-bugs Fri May 29 17:40:20 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id RAA12218 for freebsd-bugs-outgoing; Fri, 29 May 1998 17:40:20 -0700 (PDT) (envelope-from owner-freebsd-bugs@FreeBSD.ORG) Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id RAA12127 for ; Fri, 29 May 1998 17:40:07 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.8.8/8.8.5) id RAA04098; Fri, 29 May 1998 17:40:01 -0700 (PDT) Received: from cesit1.unifi.it (cesit1.unifi.it [150.217.1.31]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id RAA10404 for ; Fri, 29 May 1998 17:31:31 -0700 (PDT) (envelope-from ugo@dsi.UNIFI.IT) Received: from aguirre.dsi.unifi.it by CESIT1.UNIFI.IT (PMDF V5.1-10 #23168) with SMTP id <01IXMMVTB0G00000YT@CESIT1.UNIFI.IT> for FreeBSD-gnats-submit@freebsd.org; Sat, 30 May 1998 02:31:59 MET Received: from dsi.unifi.it (ppp-firenze71-170.iol.it) by aguirre.dsi.unifi.it (4.1/SMI-4.1) id AA20825; Sat, 30 May 1998 02:32:22 +0200 Received: from pegasus.home.net (pegasus.home.net [192.168.1.3]) by dsi.unifi.it (8.8.8/8.8.8) with ESMTP id AAA00265 for ; Sat, 30 May 1998 00:47:37 +0200 (MET DST envelope-from ugo) Received: (from ugo@localhost) by pegasus.home.net (8.8.8/8.8.8) id AAA05562; Sat, 30 May 1998 00:47:36 +0200 (MET DST envelope-from ugo) Message-Id: <199805292247.AAA05562@pegasus.home.net> Date: Sat, 30 May 1998 00:47:36 +0200 (MET DST) From: Ugo Paternostro Reply-To: paterno@dsi.UNIFI.IT To: FreeBSD-gnats-submit@FreeBSD.ORG X-Send-Pr-Version: 3.2 Subject: i386/6792: Backported PnP support for if_ed to -stable Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 6792 >Category: i386 >Synopsis: Backported PnP support for if_ed to -stable >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Fri May 29 17:40:01 PDT 1998 >Last-Modified: >Originator: Ugo Paternostro >Organization: Not an organization >Release: FreeBSD 2.2.6-STABLE i386 >Environment: FreeBSD pegasus.home.net 2.2.6-STABLE FreeBSD 2.2.6-STABLE #1: Tue May 26 14:46:22 MET DST 1998 ugo@pegasus.home.net:/usr/src/sys/compile/PEGASUS i386 >Description: Subject says it all: I ported PnP support for NE2000 and compatibles back from -current to -stable (a lot of cut&paste ;-) Please note that I added a vendor ID that wasn't present in -current sources (WSC9008), so you may think to commit that there too. P.S.: I hope that i386 is the right category for this report: I was in doubt between kern and i386... >How-To-Repeat: Insert a PnP NE2000 card into your -stable box. >Fix: Index: src/sys/i386/isa/if_ed.c =================================================================== RCS file: /home/ncvs/src/sys/i386/isa/if_ed.c,v retrieving revision 1.107.2.7 diff -u -r1.107.2.7 if_ed.c --- if_ed.c 1998/04/18 23:25:05 1.107.2.7 +++ if_ed.c 1998/05/29 22:01:40 @@ -39,7 +39,18 @@ #include "ed.h" #include "bpfilter.h" +#include "pnp.h" +#ifndef EXTRA_ED +# if NPNP > 0 +# define EXTRA_ED 8 +# else +# define EXTRA_ED 0 +# endif +#endif + +#define NEDTOT (NED + EXTRA_ED) + #include #include #include @@ -85,6 +96,10 @@ #include #include +#if NPNP > 0 +#include +#endif /* NPNP > 0 */ + /* * ed_softc: per line info and status */ @@ -137,7 +152,7 @@ struct ifmib_iso_8802_3 mibdata; /* stuff for network mgmt */ }; -static struct ed_softc ed_softc[NED]; +static struct ed_softc ed_softc[NEDTOT]; static int ed_attach __P((struct ed_softc *, int, int)); static int ed_attach_isa __P((struct isa_device *)); @@ -227,7 +242,7 @@ struct ed_softc *sc = &ed_softc[devi->isahd.id_unit]; /* validate unit number. */ - if (devi->isahd.id_unit >= NED) + if (devi->isahd.id_unit >= NEDTOT) return(ENODEV); /* * Probe the device. If a value is returned, the @@ -3415,3 +3430,95 @@ ETHER_NEXT_MULTI(step, enm); } } + +/* + * support PnP cards if we are using 'em + */ + +#if NPNP > 0 + +static struct edpnp_ids { + u_long vend_id; + char *id_str; +} edpnp_ids[] = { + { 0x1980635e, "WSC8019"}, + { 0x0890635e, "WSC9008"}, + { 0 } +}; + +static char *edpnp_probe(u_long csn, u_long vend_id); +static void edpnp_attach(u_long csn, u_long vend_id, char *name, + struct isa_device *dev); +static u_long nedpnp = NED; + +static struct pnp_device edpnp = { + "edpnp", + edpnp_probe, + edpnp_attach, + &nedpnp, + &net_imask +}; +DATA_SET (pnpdevice_set, edpnp); + +static char * +edpnp_probe(u_long csn, u_long vend_id) +{ + struct edpnp_ids *ids; + char *s = NULL; + + for(ids = edpnp_ids; ids->vend_id != 0; ids++) { + if (vend_id == ids->vend_id) { + s = ids->id_str; + break; + } + } + + if (s) { + struct pnp_cinfo d; + read_pnp_parms(&d, 0); + if (d.enable == 0 || d.flags & 1) { + printf("CSN %d is disabled.\n", csn); + return (NULL); + } + + } + + return (s); +} + +static void +edpnp_attach(u_long csn, u_long vend_id, char *name, struct isa_device *dev) +{ + struct pnp_cinfo d; + struct isa_device *dvp; + + if (dev->id_unit >= NEDTOT) + return; + + if (read_pnp_parms(&d, 0) == 0) { + printf("failed to read pnp parms\n"); + return; + } + + write_pnp_parms(&d, 0); + + enable_pnp_card(); + + dev->id_iobase = d.port[0]; + dev->id_irq = (1 << d.irq[0]); + dev->id_intr = edintr; + dev->id_drq = -1; + + if (dev->id_driver == NULL) { + dev->id_driver = &eddriver; + dvp = find_isadev(isa_devtab_net, &eddriver, 0); + if (dvp != NULL) + dev->id_id = dvp->id_id; + } + + if ((dev->id_alive = ed_probe(dev)) != 0) + ed_attach_isa(dev); + else + printf("ed%d: probe failed\n", dev->id_unit); +} +#endif >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message