i386 removal, part 15/x: Remove i386 specific network drivers.
authorSascha Wildner <saw@online.de>
Wed, 8 Jul 2015 19:46:54 +0000 (21:46 +0200)
committerSascha Wildner <saw@online.de>
Wed, 8 Jul 2015 19:46:54 +0000 (21:46 +0200)
28 files changed:
Makefile_upgrade.inc
share/examples/netgraph/raw [deleted file]
sys/conf/files
sys/dev/netif/Makefile
sys/dev/netif/ar/Makefile [deleted file]
sys/dev/netif/ar/if_ar.c [deleted file]
sys/dev/netif/ar/if_ar.h [deleted file]
sys/dev/netif/ar/if_ar_pci.c [deleted file]
sys/dev/netif/ar/if_arregs.h [deleted file]
sys/dev/netif/ed/Makefile [deleted file]
sys/dev/netif/ed/if_ed.c [deleted file]
sys/dev/netif/ed/if_ed_pccard.c [deleted file]
sys/dev/netif/ed/if_ed_pci.c [deleted file]
sys/dev/netif/ed/if_edreg.h [deleted file]
sys/dev/netif/ed/if_edvar.h [deleted file]
sys/dev/netif/sbni/Makefile [deleted file]
sys/dev/netif/sbni/if_sbni.c [deleted file]
sys/dev/netif/sbni/if_sbni_pci.c [deleted file]
sys/dev/netif/sbni/if_sbnireg.h [deleted file]
sys/dev/netif/sbni/if_sbnivar.h [deleted file]
sys/dev/netif/sr/Makefile [deleted file]
sys/dev/netif/sr/if_sr.c [deleted file]
sys/dev/netif/sr/if_sr.h [deleted file]
sys/dev/netif/sr/if_sr_pci.c [deleted file]
sys/dev/netif/sr/if_srregs.h [deleted file]
sys/netgraph/Makefile
sys/netgraph/sync_ar/Makefile [deleted file]
sys/netgraph/sync_sr/Makefile [deleted file]

index cb5c815..538657d 100644 (file)
@@ -2126,6 +2126,12 @@ TO_REMOVE+=/usr/share/man/man8/apmd.8.gz
 TO_REMOVE+=/usr/share/man/man8/battd.8.gz
 TO_REMOVE+=/usr/share/man/man8/zzz.8.gz
 TO_REMOVE+=/usr/lib/compat
+TO_REMOVE+=/boot/kernel/if_ar.ko
+TO_REMOVE+=/boot/kernel/if_ed.ko
+TO_REMOVE+=/boot/kernel/if_sbni.ko
+TO_REMOVE+=/boot/kernel/if_sr.ko
+TO_REMOVE+=/boot/kernel/ng_sync_ar.ko
+TO_REMOVE+=/boot/kernel/ng_sync_sr.ko
 
 .if ${MACHINE_ARCH} == "x86_64"
 TO_REMOVE+=/usr/sbin/stlstats
@@ -2135,14 +2141,8 @@ TO_REMOVE+=/usr/sbin/kgzip
 TO_REMOVE+=/usr/share/man/man8/kgzip.8.gz
 TO_REMOVE+=/usr/sbin/pnpinfo
 TO_REMOVE+=/usr/share/man/man8/pnpinfo.8.gz
-TO_REMOVE+=/boot/kernel/if_ar.ko
 TO_REMOVE+=/boot/kernel/glxsb.ko
-TO_REMOVE+=/boot/kernel/if_sbni.ko
 TO_REMOVE+=/boot/kernel/pst.ko
-TO_REMOVE+=/boot/kernel/if_ed.ko
-TO_REMOVE+=/boot/kernel/if_sr.ko
-TO_REMOVE+=/boot/kernel/ng_sync_ar.ko
-TO_REMOVE+=/boot/kernel/ng_sync_sr.ko
 .endif
 
 .if !defined(WANT_INSTALLER)
diff --git a/share/examples/netgraph/raw b/share/examples/netgraph/raw
deleted file mode 100644 (file)
index fab83e9..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/sh
-# script to connect a raw synchronous card to a system interface.
-# Assumes the file if_sr was compiled with options NETGRAPH.
-# $FreeBSD: src/share/examples/netgraph/raw,v 1.1 1999/11/19 07:04:36 julian Exp $
-# $DragonFly: src/share/examples/netgraph/raw,v 1.2 2003/06/17 04:36:57 dillon Exp $
-
-CARD=sr0
-
-# create an interface "ng0" and attach it to the sync port.
-# The packets had jolly well better be ip because we are not discriminating.
-ngctl mkpeer ${CARD}: iface rawdata inet
-
-# if ng0 already exists, use a CONNECT command instead of a mkpeer. e.g.
-# ngctl connect ${CARD}: ng0: rawdata inet
-
-# Then use ifconfig on interface ng0 as usual
-
index fb35c9b..22e9cf6 100644 (file)
@@ -153,8 +153,6 @@ dev/netif/age/if_age.c                      optional age
 dev/netif/an/if_an.c                   optional an
 dev/netif/an/if_an_pci.c               optional an pci
 dev/netif/an/if_an_pccard.c            optional an pccard
-dev/netif/ar/if_ar.c                   optional ar
-dev/netif/ar/if_ar_pci.c               optional ar pci
 dev/raid/asr/asr.c                     optional asr pci
 dev/disk/ahci/ahci.c                   optional ahci
 dev/disk/ahci/ahci_dragonfly.c         optional ahci
index 9458e89..a53ecae 100644 (file)
@@ -5,10 +5,6 @@ SUBDIR= an age alc ale ath bce bfe bge bwn \
        ral re rl sbsh sf sis sk sln ste stge ti tl tx txp \
        vge vr vx wb wi wpi xe xl ig_hal emx ae igb ix bnx
 
-.if ${MACHINE_ARCH} == "i386"
-SUBDIR+=ar ed sbni sr
-.endif
-
 # Empty for concurrent build
 #
 SUBDIR_ORDERED=
diff --git a/sys/dev/netif/ar/Makefile b/sys/dev/netif/ar/Makefile
deleted file mode 100644 (file)
index 5191677..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-# $FreeBSD: src/sys/modules/ar/Makefile,v 1.3.2.1 2002/06/17 15:11:03 jhay Exp $
-
-KMOD    = if_ar
-SRCS    = if_ar.c if_ar_pci.c
-SRCS    += device_if.h bus_if.h pci_if.h opt_netgraph.h pcidevs.h
-
-.include <bsd.kmod.mk>
diff --git a/sys/dev/netif/ar/if_ar.c b/sys/dev/netif/ar/if_ar.c
deleted file mode 100644 (file)
index c5ae425..0000000
+++ /dev/null
@@ -1,2350 +0,0 @@
-/*-
- * Copyright (c) 1995 - 2001 John Hay.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the author nor the names of any co-contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY John Hay ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL John Hay BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD: src/sys/dev/ar/if_ar.c,v 1.66 2005/01/06 01:42:28 imp Exp $
- */
-
-/*
- * Programming assumptions and other issues.
- *
- * The descriptors of a DMA channel will fit in a 16K memory window.
- *
- * The buffers of a transmit DMA channel will fit in a 16K memory window.
- *
- * Only the ISA bus cards with X.21 and V.35 is tested.
- *
- * When interface is going up, handshaking is set and it is only cleared
- * when the interface is down'ed.
- *
- * There should be a way to set/reset Raw HDLC/PPP, Loopback, DCE/DTE,
- * internal/external clock, etc.....
- */
-
-#include "opt_netgraph.h"
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/malloc.h>
-#include <sys/mbuf.h>
-#include <sys/socket.h>
-#include <sys/sockio.h>
-#include <sys/module.h>
-#include <sys/bus.h>
-#include <sys/serialize.h>
-#include <sys/rman.h>
-#include <sys/thread2.h>
-
-#include <net/if.h>
-#include <net/ifq_var.h>
-#ifdef NETGRAPH
-#include <netgraph/ng_message.h>
-#include <netgraph/netgraph.h>
-#include <sys/syslog.h>
-#include <dev/netif/ar/if_ar.h>
-#else /* NETGRAPH */
-#include <net/if_arp.h>
-#include <net/sppp/if_sppp.h>
-#include <net/bpf.h>
-#endif /* NETGRAPH */
-
-#include <machine/md_var.h>
-
-#include <dev/netif/ic_layer/hd64570.h>
-#include <dev/netif/ar/if_arregs.h>
-
-#ifdef TRACE
-#define TRC(x)               x
-#else
-#define TRC(x)
-#endif
-
-#define TRCL(x)              x
-
-#define PPP_HEADER_LEN       4
-
-devclass_t ar_devclass;
-
-struct ar_softc {
-#ifndef        NETGRAPH
-       struct sppp ifsppp;
-#endif /* NETGRAPH */
-       int unit;            /* With regards to all ar devices */
-       int subunit;         /* With regards to this card */
-       struct ar_hardc *hc;
-
-       struct buf_block {
-               u_int txdesc;        /* On card address */
-               u_int txstart;       /* On card address */
-               u_int txend;         /* On card address */
-               u_int txtail;        /* Index of first unused buffer */
-               u_int txmax;         /* number of usable buffers/descriptors */
-               u_int txeda;         /* Error descriptor addresses */
-       }block[AR_TX_BLOCKS];
-
-       char  xmit_busy;     /* Transmitter is busy */
-       char  txb_inuse;     /* Number of tx blocks currently in use */
-       u_char txb_new;      /* Index to where new buffer will be added */
-       u_char txb_next_tx;  /* Index to next block ready to tx */
-
-       u_int rxdesc;        /* On card address */
-       u_int rxstart;       /* On card address */
-       u_int rxend;         /* On card address */
-       u_int rxhind;        /* Index to the head of the rx buffers. */
-       u_int rxmax;         /* number of usable buffers/descriptors */
-
-       int scano;
-       int scachan;
-       sca_regs *sca;
-#ifdef NETGRAPH
-       int     running;        /* something is attached so we are running */
-       int     dcd;            /* do we have dcd? */
-       /* ---netgraph bits --- */
-       char            nodename[NG_NODESIZ]; /* store our node name */
-       int             datahooks;      /* number of data hooks attached */
-       node_p          node;           /* netgraph node */
-       hook_p          hook;           /* data hook */
-       hook_p          debug_hook;
-       struct ifqueue  xmitq_hipri;    /* hi-priority transmit queue */
-       struct ifqueue  xmitq;          /* transmit queue */
-       int             flags;          /* state */
-#define        SCF_RUNNING     0x01            /* board is active */
-#define        SCF_OACTIVE     0x02            /* output is active */
-       int             out_dog;        /* watchdog cycles output count-down */
-       struct callout  timer;          /* watchdog timer */
-       u_long          inbytes, outbytes;      /* stats */
-       u_long          lastinbytes, lastoutbytes; /* a second ago */
-       u_long          inrate, outrate;        /* highest rate seen */
-       u_long          inlast;         /* last input N secs ago */
-       u_long          out_deficit;    /* output since last input */
-       u_long          oerrors, ierrors[6];
-       u_long          opackets, ipackets;
-#endif /* NETGRAPH */
-};
-
-static int     next_ar_unit = 0;
-static struct lwkt_serialize ar_serializer;
-
-#ifdef NETGRAPH
-#define DOG_HOLDOFF    6       /* dog holds off for 6 secs */
-#define QUITE_A_WHILE  300     /* 5 MINUTES */
-#define LOTS_OF_PACKETS        100
-#endif /* NETGRAPH */
-
-/*
- * This translate from irq numbers to
- * the value that the arnet card needs
- * in the lower part of the AR_INT_SEL
- * register.
- */
-static int irqtable[16] = {
-       0,      /*  0 */
-       0,      /*  1 */
-       0,      /*  2 */
-       1,      /*  3 */
-       0,      /*  4 */
-       2,      /*  5 */
-       0,      /*  6 */
-       3,      /*  7 */
-       0,      /*  8 */
-       0,      /*  9 */
-       4,      /* 10 */
-       5,      /* 11 */
-       6,      /* 12 */
-       0,      /* 13 */
-       0,      /* 14 */
-       7       /* 15 */
-};
-
-#ifndef NETGRAPH
-DECLARE_DUMMY_MODULE(if_ar);
-MODULE_DEPEND(if_ar, sppp, 1, 1, 1);
-#else
-MODULE_DEPEND(ng_sync_ar, netgraph, NG_ABI_VERSION, NG_ABI_VERSION, NG_ABI_VERSION);
-#endif
-
-static void arintr(void *arg);
-static void ar_xmit(struct ar_softc *sc);
-#ifndef NETGRAPH
-static void arstart(struct ifnet *ifp, struct ifaltq_subque *);
-static int arioctl(struct ifnet *ifp, u_long cmd, caddr_t data, struct ucred *);
-static void arwatchdog(struct ifnet *ifp);
-#else  /* NETGRAPH */
-static void arstart(struct ar_softc *sc);
-static void arwatchdog(struct ar_softc *sc);
-#endif /* NETGRAPH */
-static int ar_packet_avail(struct ar_softc *sc, int *len, u_char *rxstat);
-static void ar_copy_rxbuf(struct mbuf *m, struct ar_softc *sc, int len);
-static void ar_eat_packet(struct ar_softc *sc, int single);
-static void ar_get_packets(struct ar_softc *sc);
-
-static int ar_read_pim_iface(volatile struct ar_hardc *hc, int channel);
-static void ar_up(struct ar_softc *sc);
-static void ar_down(struct ar_softc *sc);
-static void arc_init(struct ar_hardc *hc);
-static void ar_init_sca(struct ar_hardc *hc, int scano);
-static void ar_init_msci(struct ar_softc *sc);
-static void ar_init_rx_dmac(struct ar_softc *sc);
-static void ar_init_tx_dmac(struct ar_softc *sc);
-static void ar_dmac_intr(struct ar_hardc *hc, int scano, u_char isr);
-static void ar_msci_intr(struct ar_hardc *hc, int scano, u_char isr);
-static void ar_timer_intr(struct ar_hardc *hc, int scano, u_char isr);
-
-#ifdef NETGRAPH
-static void    ngar_watchdog_frame(void * arg);
-static void    ngar_init(void* ignored);
-
-static ng_constructor_t        ngar_constructor;
-static ng_rcvmsg_t     ngar_rcvmsg;
-static ng_shutdown_t   ngar_shutdown;
-static ng_newhook_t    ngar_newhook;
-/*static ng_findhook_t ngar_findhook; */
-static ng_connect_t    ngar_connect;
-static ng_rcvdata_t    ngar_rcvdata;
-static ng_disconnect_t ngar_disconnect;
-       
-static struct ng_type typestruct = {
-       NG_VERSION,
-       NG_AR_NODE_TYPE,
-       NULL,
-       ngar_constructor,
-       ngar_rcvmsg,
-       ngar_shutdown,
-       ngar_newhook,
-       NULL,
-       ngar_connect,
-       ngar_rcvdata,
-       ngar_rcvdata,
-       ngar_disconnect,
-       NULL
-};
-
-static int     ngar_done_init = 0;
-#endif /* NETGRAPH */
-
-int
-ar_attach(device_t device)
-{
-       struct ar_hardc *hc;
-       struct ar_softc *sc;
-#ifndef        NETGRAPH
-       struct ifnet *ifp;
-       char *iface;
-#endif /* NETGRAPH */
-       int unit;
-       int error;
-
-       hc = (struct ar_hardc *)device_get_softc(device);
-       lwkt_serialize_init(&ar_serializer);
-
-       kprintf("arc%d: %uK RAM, %u ports, rev %u.\n",
-               hc->cunit,
-               hc->memsize/1024,
-               hc->numports,
-               hc->revision);
-       
-       arc_init(hc);
-
-       error = BUS_SETUP_INTR(device_get_parent(device), device, hc->res_irq,
-                              0, arintr, hc,
-                              &hc->intr_cookie, &ar_serializer, NULL);
-       if (error)
-               return (1);
-
-       sc = hc->sc;
-
-       for(unit=0;unit<hc->numports;unit+=NCHAN)
-               ar_init_sca(hc, unit / NCHAN);
-
-       /*
-        * Now configure each port on the card.
-        */
-       for(unit=0;unit<hc->numports;sc++,unit++) {
-               sc->hc = hc;
-               sc->subunit = unit;
-               sc->unit = next_ar_unit;
-               next_ar_unit++;
-               sc->scano = unit / NCHAN;
-               sc->scachan = unit%NCHAN;
-
-               ar_init_rx_dmac(sc);
-               ar_init_tx_dmac(sc);
-               ar_init_msci(sc);
-
-#ifndef        NETGRAPH
-               ifp = &sc->ifsppp.pp_if;
-
-               ifp->if_softc = sc;
-               if_initname(ifp, device_get_name(device), sc->unit);
-               ifp->if_mtu = PP_MTU;
-               ifp->if_flags = IFF_POINTOPOINT | IFF_MULTICAST;
-               ifp->if_ioctl = arioctl;
-               ifp->if_start = arstart;
-               ifp->if_watchdog = arwatchdog;
-
-               sc->ifsppp.pp_flags = PP_KEEPALIVE;
-
-               switch(hc->interface[unit]) {
-               default: iface = "UNKNOWN"; break;
-               case AR_IFACE_EIA_232: iface = "EIA-232"; break;
-               case AR_IFACE_V_35: iface = "EIA-232 or V.35"; break;
-               case AR_IFACE_EIA_530: iface = "EIA-530"; break;
-               case AR_IFACE_X_21: iface = "X.21"; break;
-               case AR_IFACE_COMBO: iface = "COMBO X.21 / EIA-530"; break;
-               }
-
-               kprintf("ar%d: Adapter %d, port %d, interface %s.\n",
-                       sc->unit,
-                       hc->cunit,
-                       sc->subunit,
-                       iface);
-
-               sppp_attach((struct ifnet *)&sc->ifsppp);
-               if_attach(ifp, &ar_serializer);
-
-               bpfattach(ifp, DLT_PPP, PPP_HEADER_LEN);
-#else  /* NETGRAPH */
-               /*
-                * we have found a node, make sure our 'type' is availabe.
-                */
-               if (ngar_done_init == 0) ngar_init(NULL);
-               if (ng_make_node_common(&typestruct, &sc->node) != 0)
-                       return (1);
-               ksprintf(sc->nodename, "%s%d", NG_AR_NODE_TYPE, sc->unit);
-               if (ng_name_node(sc->node, sc->nodename)) {
-                       NG_NODE_UNREF(sc->node); /* drop it again */
-                       return (1);
-               }
-               NG_NODE_SET_PRIVATE(sc->node, sc);
-               callout_init(&sc->timer);
-               sc->xmitq.ifq_maxlen = IFQ_MAXLEN;
-               sc->xmitq_hipri.ifq_maxlen = IFQ_MAXLEN;
-               sc->running = 0;
-#endif /* NETGRAPH */
-       }
-
-       if(hc->bustype == AR_BUS_ISA)
-               ARC_SET_OFF(hc);
-
-       return (0);
-}
-
-int
-ar_detach(device_t device)
-{
-       device_t parent = device_get_parent(device);
-       struct ar_hardc *hc = device_get_softc(device);
-       int error;
-
-       lwkt_serialize_enter(&ar_serializer);
-
-       if (hc->intr_cookie != NULL) {
-               if (BUS_TEARDOWN_INTR(parent, device,
-                       hc->res_irq, hc->intr_cookie) != 0) {
-                               kprintf("intr teardown failed.. continuing\n");
-               }
-               hc->intr_cookie = NULL;
-       }
-
-       /*
-        * deallocate any system resources we may have
-        * allocated on behalf of this driver.
-        */
-       kfree(hc->sc, M_DEVBUF);
-       hc->sc = NULL;
-       hc->mem_start = NULL;
-       error = ar_deallocate_resources(device);
-       lwkt_serialize_exit(&ar_serializer);
-
-       return (error);
-}
-
-int
-ar_allocate_ioport(device_t device, int rid, u_long size)
-{
-       struct ar_hardc *hc = device_get_softc(device);
-
-       hc->rid_ioport = rid;
-       hc->res_ioport = bus_alloc_resource(device, SYS_RES_IOPORT,
-                       &hc->rid_ioport, 0ul, ~0ul, size, RF_ACTIVE);
-       if (hc->res_ioport == NULL) {
-               goto errexit;
-       }
-       hc->bt = rman_get_bustag(hc->res_ioport);
-       hc->bh = rman_get_bushandle(hc->res_ioport);
-
-       return (0);
-
-errexit:
-       ar_deallocate_resources(device);
-       return (ENXIO);
-}
-
-int
-ar_allocate_irq(device_t device, int rid, u_long size)
-{
-       struct ar_hardc *hc = device_get_softc(device);
-
-       hc->rid_irq = rid;
-       hc->res_irq = bus_alloc_resource_any(device, SYS_RES_IRQ,
-                       &hc->rid_irq, RF_SHAREABLE|RF_ACTIVE);
-       if (hc->res_irq == NULL) {
-               goto errexit;
-       }
-       return (0);
-
-errexit:
-       ar_deallocate_resources(device);
-       return (ENXIO);
-}
-
-int
-ar_allocate_memory(device_t device, int rid, u_long size)
-{
-       struct ar_hardc *hc = device_get_softc(device);
-
-       hc->rid_memory = rid;
-       hc->res_memory = bus_alloc_resource(device, SYS_RES_MEMORY,
-                       &hc->rid_memory, 0ul, ~0ul, size, RF_ACTIVE);
-       if (hc->res_memory == NULL) {
-               goto errexit;
-       }
-       return (0);
-
-errexit:
-       ar_deallocate_resources(device);
-       return (ENXIO);
-}
-
-int
-ar_allocate_plx_memory(device_t device, int rid, u_long size)
-{
-       struct ar_hardc *hc = device_get_softc(device);
-
-       hc->rid_plx_memory = rid;
-       hc->res_plx_memory = bus_alloc_resource(device, SYS_RES_MEMORY,
-                       &hc->rid_plx_memory, 0ul, ~0ul, size, RF_ACTIVE);
-       if (hc->res_plx_memory == NULL) {
-               goto errexit;
-       }
-       return (0);
-
-errexit:
-       ar_deallocate_resources(device);
-       return (ENXIO);
-}
-
-int
-ar_deallocate_resources(device_t device)
-{
-       struct ar_hardc *hc = device_get_softc(device);
-
-       if (hc->res_irq != 0) {
-               bus_deactivate_resource(device, SYS_RES_IRQ,
-                       hc->rid_irq, hc->res_irq);
-               bus_release_resource(device, SYS_RES_IRQ,
-                       hc->rid_irq, hc->res_irq);
-               hc->res_irq = 0;
-       }
-       if (hc->res_ioport != 0) {
-               bus_deactivate_resource(device, SYS_RES_IOPORT,
-                       hc->rid_ioport, hc->res_ioport);
-               bus_release_resource(device, SYS_RES_IOPORT,
-                       hc->rid_ioport, hc->res_ioport);
-               hc->res_ioport = 0;
-       }
-       if (hc->res_memory != 0) {
-               bus_deactivate_resource(device, SYS_RES_MEMORY,
-                       hc->rid_memory, hc->res_memory);
-               bus_release_resource(device, SYS_RES_MEMORY,
-                       hc->rid_memory, hc->res_memory);
-               hc->res_memory = 0;
-       }
-       if (hc->res_plx_memory != 0) {
-               bus_deactivate_resource(device, SYS_RES_MEMORY,
-                       hc->rid_plx_memory, hc->res_plx_memory);
-               bus_release_resource(device, SYS_RES_MEMORY,
-                       hc->rid_plx_memory, hc->res_plx_memory);
-               hc->res_plx_memory = 0;
-       }
-       return (0);
-}
-
-/*
- * First figure out which SCA gave the interrupt.
- * Process it.
- * See if there is other interrupts pending.
- * Repeat until there is no more interrupts.
- */
-static void
-arintr(void *arg)
-{
-       struct ar_hardc *hc = (struct ar_hardc *)arg;
-       sca_regs *sca;
-       u_char isr0, isr1, isr2, arisr;
-       int scano;
-
-       /* XXX Use the PCI interrupt score board register later */
-       if(hc->bustype == AR_BUS_PCI)
-               arisr = hc->orbase[AR_ISTAT * 4];
-       else
-               arisr = ar_inb(hc, AR_ISTAT);
-
-       while(arisr & AR_BD_INT) {
-               TRC(kprintf("arisr = %x\n", arisr));
-               if(arisr & AR_INT_0)
-                       scano = 0;
-               else if(arisr & AR_INT_1)
-                       scano = 1;
-               else {
-                       /* XXX Oops this shouldn't happen. */
-                       kprintf("arc%d: Interrupted with no interrupt.\n",
-                               hc->cunit);
-                       return;
-               }
-               sca = hc->sca[scano];
-
-               if(hc->bustype == AR_BUS_ISA)
-                       ARC_SET_SCA(hc, scano);
-
-               isr0 = sca->isr0;
-               isr1 = sca->isr1;
-               isr2 = sca->isr2;
-
-               TRC(kprintf("arc%d: ARINTR isr0 %x, isr1 %x, isr2 %x\n",
-                       hc->cunit,
-                       isr0,
-                       isr1,
-                       isr2));
-               if(isr0)
-                       ar_msci_intr(hc, scano, isr0);
-
-               if(isr1)
-                       ar_dmac_intr(hc, scano, isr1);
-
-               if(isr2)
-                       ar_timer_intr(hc, scano, isr2);
-
-               /*
-                * Proccess the second sca's interrupt if available.
-                * Else see if there are any new interrupts.
-                */
-               if((arisr & AR_INT_0) && (arisr & AR_INT_1))
-                       arisr &= ~AR_INT_0;
-               else {
-                       if(hc->bustype == AR_BUS_PCI)
-                               arisr = hc->orbase[AR_ISTAT * 4];
-                       else
-                               arisr = ar_inb(hc, AR_ISTAT);
-               }
-       }
-
-       if(hc->bustype == AR_BUS_ISA)
-               ARC_SET_OFF(hc);
-}
-
-
-/*
- * This will only start the transmitter. It is assumed that the data
- * is already there. It is normally called from arstart() or ar_dmac_intr().
- *
- */
-static void
-ar_xmit(struct ar_softc *sc)
-{
-#ifndef NETGRAPH
-       struct ifnet *ifp;
-#endif /* NETGRAPH */
-       dmac_channel *dmac;
-
-#ifndef NETGRAPH
-       ifp = &sc->ifsppp.pp_if;
-#endif /* NETGRAPH */
-       dmac = &sc->sca->dmac[DMAC_TXCH(sc->scachan)];
-
-       if(sc->hc->bustype == AR_BUS_ISA)
-               ARC_SET_SCA(sc->hc, sc->scano);
-       dmac->cda = (u_short)(sc->block[sc->txb_next_tx].txdesc & 0xffff);
-
-       dmac->eda = (u_short)(sc->block[sc->txb_next_tx].txeda & 0xffff);
-       dmac->dsr = SCA_DSR_DE;
-
-       sc->xmit_busy = 1;
-
-       sc->txb_next_tx++;
-       if(sc->txb_next_tx == AR_TX_BLOCKS)
-               sc->txb_next_tx = 0;
-
-#ifndef NETGRAPH
-       ifp->if_timer = 2; /* Value in seconds. */
-#else  /* NETGRAPH */
-       sc->out_dog = DOG_HOLDOFF;      /* give ourself some breathing space*/
-#endif /* NETGRAPH */
-       if(sc->hc->bustype == AR_BUS_ISA)
-               ARC_SET_OFF(sc->hc);
-}
-
-/*
- * This function will be called from the upper level when a user add a
- * packet to be send, and from the interrupt handler after a finished
- * transmit.
- *
- * This function only place the data in the oncard buffers. It does not
- * start the transmition. ar_xmit() does that.
- *
- * Transmitter idle state is indicated by the ifq_is_oactive. The function
- * that clears that should ensure that the transmitter and its DMA is
- * in a "good" idle state.
- */
-#ifndef NETGRAPH
-static void
-arstart(struct ifnet *ifp, struct ifaltq_subque *ifsq)
-{
-       struct ar_softc *sc = ifp->if_softc;
-#else  /* NETGRAPH */
-static void
-arstart(struct ar_softc *sc)
-{
-#endif /* NETGRAPH */
-       int i, len, tlen;
-       struct mbuf *mtx;
-       u_char *txdata;
-       sca_descriptor *txdesc;
-       struct buf_block *blkp;
-
-#ifndef NETGRAPH
-       if(!(ifp->if_flags & IFF_RUNNING))
-               return;
-#else  /* NETGRAPH */
-/* XXX */
-#endif /* NETGRAPH */
-  
-top_arstart:
-
-       /*
-        * See if we have space for more packets.
-        */
-       if(sc->txb_inuse == AR_TX_BLOCKS) {
-#ifndef NETGRAPH
-               ifq_set_oactive(&ifp->if_snd);  /* yes, mark active */
-#else  /* NETGRAPH */
-/*XXX*/                /*ifq_set_oactive(&ifp->if_snd);*/      /* yes, mark active */
-#endif /* NETGRAPH */
-               return;
-       }
-
-#ifndef NETGRAPH
-       mtx = sppp_dequeue(ifp);
-#else  /* NETGRAPH */
-       IF_DEQUEUE(&sc->xmitq_hipri, mtx);
-       if (mtx == NULL) {
-               IF_DEQUEUE(&sc->xmitq, mtx);
-       }
-#endif /* NETGRAPH */
-       if(!mtx)
-               return;
-
-       /*
-        * It is OK to set the memory window outside the loop because
-        * all tx buffers and descriptors are assumed to be in the same
-        * 16K window.
-        */
-       if(sc->hc->bustype == AR_BUS_ISA)
-               ARC_SET_MEM(sc->hc, sc->block[0].txdesc);
-
-       /*
-        * We stay in this loop until there is nothing in the
-        * TX queue left or the tx buffer is full.
-        */
-       i = 0;
-       blkp = &sc->block[sc->txb_new];
-       txdesc = (sca_descriptor *)
-               (sc->hc->mem_start + (blkp->txdesc & sc->hc->winmsk));
-       txdata = (u_char *)(sc->hc->mem_start + (blkp->txstart & sc->hc->winmsk));
-       for(;;) {
-               len = mtx->m_pkthdr.len;
-
-               TRC(kprintf("ar%d: ARstart len %u\n", sc->unit, len));
-
-               /*
-                * We can do this because the tx buffers don't wrap.
-                */
-               m_copydata(mtx, 0, len, txdata);
-               tlen = len;
-               while(tlen > AR_BUF_SIZ) {
-                       txdesc->stat = 0;
-                       txdesc->len = AR_BUF_SIZ;
-                       tlen -= AR_BUF_SIZ;
-                       txdesc++;
-                       txdata += AR_BUF_SIZ;
-                       i++;
-               }
-               /* XXX Move into the loop? */
-               txdesc->stat = SCA_DESC_EOM;
-               txdesc->len = tlen;
-               txdesc++;
-               txdata += AR_BUF_SIZ;
-               i++;
-
-#ifndef NETGRAPH
-               BPF_MTAP(ifp, mtx);
-               m_freem(mtx);
-               IFNET_STAT_INC(&sc->ifsppp.pp_if, opackets, 1);
-#else  /* NETGRAPH */
-               m_freem(mtx);
-               sc->outbytes += len;
-               ++sc->opackets;
-#endif /* NETGRAPH */
-
-               /*
-                * Check if we have space for another mbuf.
-                * XXX This is hardcoded. A packet won't be larger
-                * than 3 buffers (3 x 512).
-                */
-               if((i + 3) >= blkp->txmax)
-                       break;
-
-#ifndef NETGRAPH
-               mtx = sppp_dequeue(ifp);
-#else  /* NETGRAPH */
-               IF_DEQUEUE(&sc->xmitq_hipri, mtx);
-               if (mtx == NULL) {
-                       IF_DEQUEUE(&sc->xmitq, mtx);
-               }
-#endif /* NETGRAPH */
-               if(!mtx)
-                       break;
-       }
-
-       blkp->txtail = i;
-
-       /*
-        * Mark the last descriptor, so that the SCA know where
-        * to stop.
-        */
-       txdesc--;
-       txdesc->stat |= SCA_DESC_EOT;
-
-       txdesc = (sca_descriptor *)blkp->txdesc;
-       blkp->txeda = (u_short)((u_int)&txdesc[i]);
-
-#if 0
-       kprintf("ARstart: %p desc->cp %x\n", &txdesc->cp, txdesc->cp);
-       kprintf("ARstart: %p desc->bp %x\n", &txdesc->bp, txdesc->bp);
-       kprintf("ARstart: %p desc->bpb %x\n", &txdesc->bpb, txdesc->bpb);
-       kprintf("ARstart: %p desc->len %x\n", &txdesc->len, txdesc->len);
-       kprintf("ARstart: %p desc->stat %x\n", &txdesc->stat, txdesc->stat);
-#endif
-
-       sc->txb_inuse++;
-       sc->txb_new++;
-       if(sc->txb_new == AR_TX_BLOCKS)
-               sc->txb_new = 0;
-
-       if(sc->xmit_busy == 0)
-               ar_xmit(sc);
-
-       if(sc->hc->bustype == AR_BUS_ISA)
-               ARC_SET_OFF(sc->hc);
-
-       goto top_arstart;
-}
-
-#ifndef        NETGRAPH
-static int
-arioctl(struct ifnet *ifp, u_long cmd, caddr_t data, struct ucred *cr)
-{
-       int error;
-       int was_up, should_be_up;
-       struct ar_softc *sc = ifp->if_softc;
-
-       TRC(if_printf(ifp, "arioctl.\n");)
-
-       was_up = ifp->if_flags & IFF_RUNNING;
-
-       error = sppp_ioctl(ifp, cmd, data);
-       TRC(if_printf(ifp, "ioctl: ifsppp.pp_flags = %x, if_flags %x.\n", 
-               ((struct sppp *)ifp)->pp_flags, ifp->if_flags);)
-       if(error)
-               return (error);
-
-       if((cmd != SIOCSIFFLAGS) && cmd != (SIOCSIFADDR))
-               return (0);
-
-       TRC(if_printf(ifp, "arioctl %s.\n",
-               (cmd == SIOCSIFFLAGS) ? "SIOCSIFFLAGS" : "SIOCSIFADDR");)
-
-       should_be_up = ifp->if_flags & IFF_RUNNING;
-
-       if(!was_up && should_be_up) {
-               /* Interface should be up -- start it. */
-               ar_up(sc);
-               arstart(ifp, ifq_get_subq_default(&ifp->if_snd));
-               /* XXX Maybe clear the IFF_UP flag so that the link
-                * will only go up after sppp lcp and ipcp negotiation.
-                */
-       } else if(was_up && !should_be_up) {
-               /* Interface should be down -- stop it. */
-               ar_down(sc);
-               sppp_flush(ifp);
-       }
-       return (0);
-}
-#endif /* NETGRAPH */
-
-/*
- * This is to catch lost tx interrupts.
- */
-static void
-#ifndef        NETGRAPH
-arwatchdog(struct ifnet *ifp)
-{
-       struct ar_softc *sc = ifp->if_softc;
-#else  /* NETGRAPH */
-arwatchdog(struct ar_softc *sc)
-{
-#endif /* NETGRAPH */
-       msci_channel *msci = &sc->sca->msci[sc->scachan];
-
-#ifndef        NETGRAPH
-       if(!(ifp->if_flags & IFF_RUNNING))
-               return;
-#endif /* NETGRAPH */
-
-       if(sc->hc->bustype == AR_BUS_ISA)
-               ARC_SET_SCA(sc->hc, sc->scano);
-
-       /* XXX if(sc->ifsppp.pp_if.if_flags & IFF_DEBUG) */
-               kprintf("ar%d: transmit failed, "
-                       "ST0 %x, ST1 %x, ST3 %x, DSR %x.\n",
-                       sc->unit,
-                       msci->st0,
-                       msci->st1,
-                       msci->st3,
-                       sc->sca->dmac[DMAC_TXCH(sc->scachan)].dsr);
-
-       if(msci->st1 & SCA_ST1_UDRN) {
-               msci->cmd = SCA_CMD_TXABORT;
-               msci->cmd = SCA_CMD_TXENABLE;
-               msci->st1 = SCA_ST1_UDRN;
-       }
-
-       sc->xmit_busy = 0;
-#ifndef        NETGRAPH
-       ifq_clr_oactive(&ifp->if_snd);
-#else  /* NETGRAPH */
-       /* XXX ifq_clr_oactive(&ifp->if_snd); */
-#endif /* NETGRAPH */
-
-       if(sc->txb_inuse && --sc->txb_inuse)
-               ar_xmit(sc);
-
-#ifndef        NETGRAPH
-       arstart(ifp, ifq_get_subq_default(&ifp->if_snd));
-#else  /* NETGRAPH */
-       arstart(sc);
-#endif /* NETGRAPH */
-}
-
-static void
-ar_up(struct ar_softc *sc)
-{
-       sca_regs *sca;
-       msci_channel *msci;
-
-       sca = sc->sca;
-       msci = &sca->msci[sc->scachan];
-
-       TRC(kprintf("ar%d: sca %p, msci %p, ch %d\n",
-               sc->unit, sca, msci, sc->scachan));
-
-       /*
-        * Enable transmitter and receiver.
-        * Raise DTR and RTS.
-        * Enable interrupts.
-        */
-       if(sc->hc->bustype == AR_BUS_ISA)
-               ARC_SET_SCA(sc->hc, sc->scano);
-
-       /* XXX
-        * What about using AUTO mode in msci->md0 ???
-        * And what about CTS/DCD etc... ?
-        */
-       if(sc->hc->handshake & AR_SHSK_RTS)
-               msci->ctl &= ~SCA_CTL_RTS;
-       if(sc->hc->handshake & AR_SHSK_DTR) {
-               sc->hc->txc_dtr[sc->scano] &= sc->scachan ? 
-                       ~AR_TXC_DTR_DTR1 : ~AR_TXC_DTR_DTR0;
-               if(sc->hc->bustype == AR_BUS_PCI)
-                       sc->hc->orbase[sc->hc->txc_dtr_off[sc->scano]] =
-                               sc->hc->txc_dtr[sc->scano];
-               else
-                       ar_outb(sc->hc, sc->hc->txc_dtr_off[sc->scano],
-                               sc->hc->txc_dtr[sc->scano]);
-       }
-
-       if(sc->scachan == 0) {
-               sca->ier0 |= 0x0F;
-               sca->ier1 |= 0x0F;
-       } else {
-               sca->ier0 |= 0xF0;
-               sca->ier1 |= 0xF0;
-       }
-
-       msci->cmd = SCA_CMD_RXENABLE;
-       if(sc->hc->bustype == AR_BUS_ISA)
-               ar_inb(sc->hc, AR_ID_5); /* XXX slow it down a bit. */
-       msci->cmd = SCA_CMD_TXENABLE;
-
-       if(sc->hc->bustype == AR_BUS_ISA)
-               ARC_SET_OFF(sc->hc);
-#ifdef NETGRAPH
-       callout_reset(&sc->timer, hz, ngar_watchdog_frame, sc);
-       sc->running = 1;
-#endif /* NETGRAPH */
-}
-
-static void
-ar_down(struct ar_softc *sc)
-{
-       sca_regs *sca;
-       msci_channel *msci;
-
-       sca = sc->sca;
-       msci = &sca->msci[sc->scachan];
-
-#ifdef NETGRAPH
-       callout_stop(&sc->timer);
-       sc->running = 0;
-#endif /* NETGRAPH */
-       /*
-        * Disable transmitter and receiver.
-        * Lower DTR and RTS.
-        * Disable interrupts.
-        */
-       if(sc->hc->bustype == AR_BUS_ISA)
-               ARC_SET_SCA(sc->hc, sc->scano);
-       msci->cmd = SCA_CMD_RXDISABLE;
-       if(sc->hc->bustype == AR_BUS_ISA)
-               ar_inb(sc->hc, AR_ID_5); /* XXX slow it down a bit. */
-       msci->cmd = SCA_CMD_TXDISABLE;
-
-       if(sc->hc->handshake & AR_SHSK_RTS)
-               msci->ctl |= SCA_CTL_RTS;
-       if(sc->hc->handshake & AR_SHSK_DTR) {
-               sc->hc->txc_dtr[sc->scano] |= sc->scachan ? 
-                       AR_TXC_DTR_DTR1 : AR_TXC_DTR_DTR0;
-               if(sc->hc->bustype == AR_BUS_PCI)
-                       sc->hc->orbase[sc->hc->txc_dtr_off[sc->scano]] =
-                               sc->hc->txc_dtr[sc->scano];
-               else
-                       ar_outb(sc->hc, sc->hc->txc_dtr_off[sc->scano],
-                               sc->hc->txc_dtr[sc->scano]);
-       }
-
-       if(sc->scachan == 0) {
-               sca->ier0 &= ~0x0F;
-               sca->ier1 &= ~0x0F;
-       } else {
-               sca->ier0 &= ~0xF0;
-               sca->ier1 &= ~0xF0;
-       }
-
-       if(sc->hc->bustype == AR_BUS_ISA)
-               ARC_SET_OFF(sc->hc);
-}
-
-static int
-ar_read_pim_iface(volatile struct ar_hardc *hc, int channel)
-{
-       int ctype, i, val, x;
-       volatile u_char *pimctrl;
-
-       ctype = 0;
-       val = 0;
-
-       pimctrl = hc->orbase + AR_PIMCTRL;
-
-       /* Reset the PIM */
-       *pimctrl = 0x00;
-       *pimctrl = AR_PIM_STROBE;
-
-       /* Check if there is a PIM */
-       *pimctrl = 0x00;
-       *pimctrl = AR_PIM_READ;
-       x = *pimctrl;
-       TRC(kprintf("x = %x", x));
-       if(x & AR_PIM_DATA) {
-               kprintf("No PIM installed\n");
-               return (AR_IFACE_UNKNOWN);
-       }
-
-       x = (x >> 1) & 0x01;
-       val |= x << 0;
-
-       /* Now read the next 15 bits */
-       for(i = 1; i < 16; i++) {
-               *pimctrl = AR_PIM_READ;
-               *pimctrl = AR_PIM_READ | AR_PIM_STROBE;
-               x = *pimctrl;
-               TRC(kprintf(" %x ", x));
-               x = (x >> 1) & 0x01;
-               val |= x << i;
-               if(i == 8 && (val & 0x000f) == 0x0004) {
-                       int ii;
-                       
-                       /* Start bit */
-                       *pimctrl = AR_PIM_A2D_DOUT | AR_PIM_A2D_STROBE;
-                       *pimctrl = AR_PIM_A2D_DOUT;
-
-                       /* Mode bit */
-                       *pimctrl = AR_PIM_A2D_DOUT | AR_PIM_A2D_STROBE;
-                       *pimctrl = AR_PIM_A2D_DOUT;
-
-                       /* Sign bit */
-                       *pimctrl = AR_PIM_A2D_DOUT | AR_PIM_A2D_STROBE;
-                       *pimctrl = AR_PIM_A2D_DOUT;
-
-                       /* Select channel */
-                       *pimctrl = AR_PIM_A2D_STROBE | ((channel & 2) << 2);
-                       *pimctrl = ((channel & 2) << 2);
-                       *pimctrl = AR_PIM_A2D_STROBE | ((channel & 1) << 3);
-                       *pimctrl = ((channel & 1) << 3);
-
-                       *pimctrl = AR_PIM_A2D_STROBE;
-
-                       x = *pimctrl;
-                       if(x & AR_PIM_DATA)
-                               kprintf("\nOops A2D start bit not zero (%X)\n", x);
-
-                       for(ii = 7; ii >= 0; ii--) {
-                               *pimctrl = 0x00;
-                               *pimctrl = AR_PIM_A2D_STROBE;
-                               x = *pimctrl;
-                               if(x & AR_PIM_DATA)
-                                       ctype |= 1 << ii;
-                       }
-               }
-       }
-       TRC(kprintf("\nPIM val %x, ctype %x, %d\n", val, ctype, ctype));
-       *pimctrl = AR_PIM_MODEG;
-       *pimctrl = AR_PIM_MODEG | AR_PIM_AUTO_LED;
-       if(ctype > 255)
-               return (AR_IFACE_UNKNOWN);
-       if(ctype > 239)
-               return (AR_IFACE_V_35);
-       if(ctype > 207)
-               return (AR_IFACE_EIA_232);
-       if(ctype > 178)
-               return (AR_IFACE_X_21);
-       if(ctype > 150)
-               return (AR_IFACE_EIA_530);
-       if(ctype > 25)
-               return (AR_IFACE_UNKNOWN);
-       if(ctype > 7)
-               return (AR_IFACE_LOOPBACK);
-       return (AR_IFACE_UNKNOWN);
-}
-
-/*
- * Initialize the card, allocate memory for the ar_softc structures
- * and fill in the pointers.
- */
-static void
-arc_init(struct ar_hardc *hc)
-{
-       struct ar_softc *sc;
-       int x;
-       u_int chanmem;
-       u_int bufmem;
-       u_int next;
-       u_int descneeded;
-       u_char isr, mar;
-       u_long memst;
-
-       sc = kmalloc(hc->numports * sizeof(struct ar_softc), M_DEVBUF,
-                    M_WAITOK | M_ZERO);
-       hc->sc = sc;
-
-       hc->txc_dtr[0] = AR_TXC_DTR_NOTRESET |
-                        AR_TXC_DTR_DTR0 | AR_TXC_DTR_DTR1;
-       hc->txc_dtr[1] = AR_TXC_DTR_DTR0 | AR_TXC_DTR_DTR1;
-       hc->txc_dtr_off[0] = AR_TXC_DTR0;
-       hc->txc_dtr_off[1] = AR_TXC_DTR2;
-       if(hc->bustype == AR_BUS_PCI) {
-               hc->txc_dtr_off[0] *= 4;
-               hc->txc_dtr_off[1] *= 4;
-       }
-
-       /*
-        * reset the card and wait at least 1uS.
-        */
-       if(hc->bustype == AR_BUS_PCI)
-               hc->orbase[AR_TXC_DTR0 * 4] = ~AR_TXC_DTR_NOTRESET &
-                       hc->txc_dtr[0];
-       else
-               ar_outb(hc, AR_TXC_DTR0, ~AR_TXC_DTR_NOTRESET &
-                       hc->txc_dtr[0]);
-       DELAY(2);
-       if(hc->bustype == AR_BUS_PCI)
-               hc->orbase[AR_TXC_DTR0 * 4] = hc->txc_dtr[0];
-       else
-               ar_outb(hc, AR_TXC_DTR0, hc->txc_dtr[0]);
-
-       if(hc->bustype == AR_BUS_ISA) {
-               /*
-                * Configure the card.
-                * Mem address, irq, 
-                */
-               memst = rman_get_start(hc->res_memory);
-               mar = memst >> 16;
-               isr = irqtable[hc->isa_irq] << 1;
-               if(isr == 0)
-                       kprintf("ar%d: Warning illegal interrupt %d\n",
-                               hc->cunit, hc->isa_irq);
-               isr = isr | ((memst & 0xc000) >> 10);
-
-               hc->sca[0] = (sca_regs *)hc->mem_start;
-               hc->sca[1] = (sca_regs *)hc->mem_start;
-
-               ar_outb(hc, AR_MEM_SEL, mar);
-               ar_outb(hc, AR_INT_SEL, isr | AR_INTS_CEN);
-       }
-
-       if(hc->bustype == AR_BUS_PCI && hc->interface[0] == AR_IFACE_PIM)
-               for(x = 0; x < hc->numports; x++)
-                       hc->interface[x] = ar_read_pim_iface(hc, x);
-
-       /*
-        * Set the TX clock direction and enable TX.
-        */
-       for(x=0;x<hc->numports;x++) {
-               switch(hc->interface[x]) {
-               case AR_IFACE_V_35:
-                       hc->txc_dtr[x / NCHAN] |= (x % NCHAN == 0) ?
-                           AR_TXC_DTR_TX0 : AR_TXC_DTR_TX1;
-                       hc->txc_dtr[x / NCHAN] |= (x % NCHAN == 0) ?
-                           AR_TXC_DTR_TXCS0 : AR_TXC_DTR_TXCS1;
-                       break;
-               case AR_IFACE_EIA_530:
-               case AR_IFACE_COMBO:
-               case AR_IFACE_X_21:
-                       hc->txc_dtr[x / NCHAN] |= (x % NCHAN == 0) ?
-                           AR_TXC_DTR_TX0 : AR_TXC_DTR_TX1;
-                       break;
-               }
-       }
-
-       if(hc->bustype == AR_BUS_PCI)
-               hc->orbase[AR_TXC_DTR0 * 4] = hc->txc_dtr[0];
-       else
-               ar_outb(hc, AR_TXC_DTR0, hc->txc_dtr[0]);
-       if(hc->numports > NCHAN) {
-               if(hc->bustype == AR_BUS_PCI)
-                       hc->orbase[AR_TXC_DTR2 * 4] = hc->txc_dtr[1];
-               else
-                       ar_outb(hc, AR_TXC_DTR2, hc->txc_dtr[1]);
-       }
-
-       chanmem = hc->memsize / hc->numports;
-       next = 0;
-
-       for(x=0;x<hc->numports;x++, sc++) {
-               int blk;
-
-               sc->sca = hc->sca[x / NCHAN];
-
-               for(blk = 0; blk < AR_TX_BLOCKS; blk++) {
-                       sc->block[blk].txdesc = next;
-                       bufmem = (16 * 1024) / AR_TX_BLOCKS;
-                       descneeded = bufmem / AR_BUF_SIZ;
-                       sc->block[blk].txstart = sc->block[blk].txdesc +
-                               ((((descneeded * sizeof(sca_descriptor)) /
-                                       AR_BUF_SIZ) + 1) * AR_BUF_SIZ);
-                       sc->block[blk].txend = next + bufmem;
-                       sc->block[blk].txmax =
-                               (sc->block[blk].txend - sc->block[blk].txstart)
-                               / AR_BUF_SIZ;
-                       next += bufmem;
-
-                       TRC(kprintf("ar%d: blk %d: txdesc %x, txstart %x, "
-                                  "txend %x, txmax %d\n",
-                                  x,
-                                  blk,
-                                  sc->block[blk].txdesc,
-                                  sc->block[blk].txstart,
-                                  sc->block[blk].txend,
-                                  sc->block[blk].txmax));
-               }
-
-               sc->rxdesc = next;
-               bufmem = chanmem - (bufmem * AR_TX_BLOCKS);
-               descneeded = bufmem / AR_BUF_SIZ;
-               sc->rxstart = sc->rxdesc +
-                               ((((descneeded * sizeof(sca_descriptor)) /
-                                       AR_BUF_SIZ) + 1) * AR_BUF_SIZ);
-               sc->rxend = next + bufmem;
-               sc->rxmax = (sc->rxend - sc->rxstart) / AR_BUF_SIZ;
-               next += bufmem;
-               TRC(kprintf("ar%d: rxdesc %x, rxstart %x, "
-                          "rxend %x, rxmax %d\n",
-                          x, sc->rxdesc, sc->rxstart, sc->rxend, sc->rxmax));
-       }
-
-       if(hc->bustype == AR_BUS_PCI)
-               hc->orbase[AR_PIMCTRL] = AR_PIM_MODEG | AR_PIM_AUTO_LED;
-}
-
-
-/*
- * The things done here are channel independent.
- *
- *   Configure the sca waitstates.
- *   Configure the global interrupt registers.
- *   Enable master dma enable.
- */
-static void
-ar_init_sca(struct ar_hardc *hc, int scano)
-{
-       sca_regs *sca;
-
-       sca = hc->sca[scano];
-       if(hc->bustype == AR_BUS_ISA)
-               ARC_SET_SCA(hc, scano);
-
-       /*
-        * Do the wait registers.
-        * Set everything to 0 wait states.
-        */
-       sca->pabr0 = 0;
-       sca->pabr1 = 0;
-       sca->wcrl  = 0;
-       sca->wcrm  = 0;
-       sca->wcrh  = 0;
-
-       /*
-        * Configure the interrupt registers.
-        * Most are cleared until the interface is configured.
-        */
-       sca->ier0 = 0x00; /* MSCI interrupts... Not used with dma. */
-       sca->ier1 = 0x00; /* DMAC interrupts */
-       sca->ier2 = 0x00; /* TIMER interrupts... Not used yet. */
-       sca->itcr = 0x00; /* Use ivr and no intr ack */
-       sca->ivr  = 0x40; /* Fill in the interrupt vector. */
-       sca->imvr = 0x40;
-
-       /*
-        * Configure the timers.
-        * XXX Later
-        */
-
-
-       /*
-        * Set the DMA channel priority to rotate between
-        * all four channels.
-        *
-        * Enable all dma channels.
-        */
-       if(hc->bustype == AR_BUS_PCI) {
-               u_char *t;
-
-               /*
-                * Stupid problem with the PCI interface chip that break
-                * things.
-                * XXX
-                */
-               t = (u_char *)sca;
-               t[AR_PCI_SCA_PCR] = SCA_PCR_PR2;
-               t[AR_PCI_SCA_DMER] = SCA_DMER_EN;
-       } else {
-               sca->pcr = SCA_PCR_PR2;
-               sca->dmer = SCA_DMER_EN;
-       }
-}
-
-
-/*
- * Configure the msci
- *
- * NOTE: The serial port configuration is hardcoded at the moment.
- */
-static void
-ar_init_msci(struct ar_softc *sc)
-{
-       msci_channel *msci;
-
-       msci = &sc->sca->msci[sc->scachan];
-
-       if(sc->hc->bustype == AR_BUS_ISA)
-               ARC_SET_SCA(sc->hc, sc->scano);
-
-       msci->cmd = SCA_CMD_RESET;
-
-       msci->md0 = SCA_MD0_CRC_1 |
-                   SCA_MD0_CRC_CCITT |
-                   SCA_MD0_CRC_ENABLE |
-                   SCA_MD0_MODE_HDLC;
-       msci->md1 = SCA_MD1_NOADDRCHK;
-       msci->md2 = SCA_MD2_DUPLEX | SCA_MD2_NRZ;
-
-       /*
-        * Acording to the manual I should give a reset after changing the
-        * mode registers.
-        */
-       msci->cmd = SCA_CMD_RXRESET;
-       msci->ctl = SCA_CTL_IDLPAT | SCA_CTL_UDRNC | SCA_CTL_RTS;
-
-       /*
-        * For now all interfaces are programmed to use the RX clock for
-        * the TX clock.
-        */
-       switch(sc->hc->interface[sc->subunit]) {
-       case AR_IFACE_V_35:
-               msci->rxs = SCA_RXS_CLK_RXC0 | SCA_RXS_DIV1;
-               msci->txs = SCA_TXS_CLK_TXC | SCA_TXS_DIV1;
-               break;
-       case AR_IFACE_X_21:
-       case AR_IFACE_EIA_530:
-       case AR_IFACE_COMBO:
-               msci->rxs = SCA_RXS_CLK_RXC0 | SCA_RXS_DIV1;
-               msci->txs = SCA_TXS_CLK_RX | SCA_TXS_DIV1;
-       }
-
-       msci->tmc = 153;   /* This give 64k for loopback */
-
-       /* XXX
-        * Disable all interrupts for now. I think if you are using
-        * the dmac you don't use these interrupts.
-        */
-       msci->ie0 = 0;
-       msci->ie1 = 0x0C; /* XXX CTS and DCD (DSR on 570I) level change. */
-       msci->ie2 = 0;
-       msci->fie = 0;
-
-       msci->sa0 = 0;
-       msci->sa1 = 0;
-
-       msci->idl = 0x7E; /* XXX This is what cisco does. */
-
-       /*
-        * This is what the ARNET diags use.
-        */
-       msci->rrc  = 0x0E;
-       msci->trc0 = 0x12;
-       msci->trc1 = 0x1F;
-}
-
-/*
- * Configure the rx dma controller.
- */
-static void
-ar_init_rx_dmac(struct ar_softc *sc)
-{
-       dmac_channel *dmac;
-       sca_descriptor *rxd;
-       u_int rxbuf;
-       u_int rxda;
-       u_int rxda_d;
-       int x = 0;
-
-       dmac = &sc->sca->dmac[DMAC_RXCH(sc->scachan)];
-
-       if(sc->hc->bustype == AR_BUS_ISA)
-               ARC_SET_MEM(sc->hc, sc->rxdesc);
-
-       rxd = (sca_descriptor *)(sc->hc->mem_start + (sc->rxdesc&sc->hc->winmsk));
-       rxda_d = (u_int)sc->hc->mem_start - (sc->rxdesc & ~sc->hc->winmsk);
-
-       for(rxbuf=sc->rxstart;rxbuf<sc->rxend;rxbuf += AR_BUF_SIZ, rxd++) {
-               rxda = (u_int)&rxd[1] - rxda_d;
-               rxd->cp = (u_short)(rxda & 0xfffful);
-
-               x++;
-               if(x < 6)
-                       TRC(kprintf("Descrp %p, data pt %x, data %x, ",
-                           rxd, rxda, rxbuf));
-
-               rxd->bp = (u_short)(rxbuf & 0xfffful);
-               rxd->bpb = (u_char)((rxbuf >> 16) & 0xff);
-               rxd->len = 0;
-               rxd->stat = 0xff; /* The sca write here when it is finished. */
-
-               if(x < 6)
-               TRC(kprintf("bpb %x, bp %x.\n", rxd->bpb, rxd->bp));
-       }
-       rxd--;
-       rxd->cp = (u_short)(sc->rxdesc & 0xfffful);
-
-       sc->rxhind = 0;
-
-       if(sc->hc->bustype == AR_BUS_ISA)
-               ARC_SET_SCA(sc->hc, sc->scano);
-
-       dmac->dsr = 0;    /* Disable DMA transfer */
-       dmac->dcr = SCA_DCR_ABRT;
-
-       /* XXX maybe also SCA_DMR_CNTE */
-       dmac->dmr = SCA_DMR_TMOD | SCA_DMR_NF;
-       dmac->bfl = AR_BUF_SIZ;
-
-       dmac->cda = (u_short)(sc->rxdesc & 0xffff);
-       dmac->sarb = (u_char)((sc->rxdesc >> 16) & 0xff);
-
-       rxd = (sca_descriptor *)sc->rxstart;
-       dmac->eda = (u_short)((u_int)&rxd[sc->rxmax - 1] & 0xffff);
-
-       dmac->dir = 0xF0;
-
-       dmac->dsr = SCA_DSR_DE;
-}
-
-/*
- * Configure the TX DMA descriptors.
- * Initialize the needed values and chain the descriptors.
- */
-static void
-ar_init_tx_dmac(struct ar_softc *sc)
-{
-       dmac_channel *dmac;
-       struct buf_block *blkp;
-       int blk;
-       sca_descriptor *txd;
-       u_int txbuf;
-       u_int txda;
-       u_int txda_d;
-
-       dmac = &sc->sca->dmac[DMAC_TXCH(sc->scachan)];
-
-       if(sc->hc->bustype == AR_BUS_ISA)
-               ARC_SET_MEM(sc->hc, sc->block[0].txdesc);
-
-       for(blk = 0; blk < AR_TX_BLOCKS; blk++) {
-               blkp = &sc->block[blk];
-               txd = (sca_descriptor *)(sc->hc->mem_start +
-                                       (blkp->txdesc&sc->hc->winmsk));
-               txda_d = (u_int)sc->hc->mem_start -
-                               (blkp->txdesc & ~sc->hc->winmsk);
-
-               txbuf=blkp->txstart;
-               for(;txbuf<blkp->txend;txbuf += AR_BUF_SIZ, txd++) {
-                       txda = (u_int)&txd[1] - txda_d;
-                       txd->cp = (u_short)(txda & 0xfffful);
-
-                       txd->bp = (u_short)(txbuf & 0xfffful);
-                       txd->bpb = (u_char)((txbuf >> 16) & 0xff);
-                       TRC(kprintf("ar%d: txbuf %x, bpb %x, bp %x\n",
-                               sc->unit, txbuf, txd->bpb, txd->bp));
-                       txd->len = 0;
-                       txd->stat = 0;
-               }
-               txd--;
-               txd->cp = (u_short)(blkp->txdesc & 0xfffful);
-
-               blkp->txtail = (u_int)txd - (u_int)sc->hc->mem_start;
-               TRC(kprintf("TX Descriptors start %x, end %x.\n",
-                       blkp->txdesc,
-                       blkp->txtail));
-       }
-
-       if(sc->hc->bustype == AR_BUS_ISA)
-               ARC_SET_SCA(sc->hc, sc->scano);
-
-       dmac->dsr = 0; /* Disable DMA */
-       dmac->dcr = SCA_DCR_ABRT;
-       dmac->dmr = SCA_DMR_TMOD | SCA_DMR_NF;
-       dmac->dir = SCA_DIR_EOT | SCA_DIR_BOF | SCA_DIR_COF;
-
-       dmac->sarb = (u_char)((sc->block[0].txdesc >> 16) & 0xff);
-}
-
-
-/*
- * Look through the descriptors to see if there is a complete packet
- * available. Stop if we get to where the sca is busy.
- *
- * Return the length and status of the packet.
- * Return nonzero if there is a packet available.
- *
- * NOTE:
- * It seems that we get the interrupt a bit early. The updateing of
- * descriptor values is not always completed when this is called.
- */
-static int
-ar_packet_avail(struct ar_softc *sc,
-                   int *len,
-                   u_char *rxstat)
-{
-       dmac_channel *dmac;
-       sca_descriptor *rxdesc;
-       sca_descriptor *endp;
-       sca_descriptor *cda;
-
-       if(sc->hc->bustype == AR_BUS_ISA)
-               ARC_SET_SCA(sc->hc, sc->scano);
-       dmac = &sc->sca->dmac[DMAC_RXCH(sc->scachan)];
-       cda = (sca_descriptor *)(sc->hc->mem_start +
-             ((((u_int)dmac->sarb << 16) + dmac->cda) & sc->hc->winmsk));
-
-       if(sc->hc->bustype == AR_BUS_ISA)
-               ARC_SET_MEM(sc->hc, sc->rxdesc);
-       rxdesc = (sca_descriptor *)
-                       (sc->hc->mem_start + (sc->rxdesc & sc->hc->winmsk));
-       endp = rxdesc;
-       rxdesc = &rxdesc[sc->rxhind];
-       endp = &endp[sc->rxmax];
-
-       *len = 0;
-
-       while(rxdesc != cda) {
-               *len += rxdesc->len;
-
-               if(rxdesc->stat & SCA_DESC_EOM) {
-                       *rxstat = rxdesc->stat;
-                       TRC(kprintf("ar%d: PKT AVAIL len %d, %x.\n",
-                               sc->unit, *len, *rxstat));
-                       return (1);
-               }
-
-               rxdesc++;
-               if(rxdesc == endp)
-                       rxdesc = (sca_descriptor *)
-                              (sc->hc->mem_start + (sc->rxdesc & sc->hc->winmsk));
-       }
-
-       *len = 0;
-       *rxstat = 0;
-       return (0);
-}
-
-
-/*
- * Copy a packet from the on card memory into a provided mbuf.
- * Take into account that buffers wrap and that a packet may
- * be larger than a buffer.
- */
-static void 
-ar_copy_rxbuf(struct mbuf *m,
-                  struct ar_softc *sc,
-                  int len)
-{
-       sca_descriptor *rxdesc;
-       u_int rxdata;
-       u_int rxmax;
-       u_int off = 0;
-       u_int tlen;
-
-       rxdata = sc->rxstart + (sc->rxhind * AR_BUF_SIZ);
-       rxmax = sc->rxstart + (sc->rxmax * AR_BUF_SIZ);
-
-       rxdesc = (sca_descriptor *)
-                       (sc->hc->mem_start + (sc->rxdesc & sc->hc->winmsk));
-       rxdesc = &rxdesc[sc->rxhind];
-
-       while(len) {
-               tlen = (len < AR_BUF_SIZ) ? len : AR_BUF_SIZ;
-               if(sc->hc->bustype == AR_BUS_ISA)
-                       ARC_SET_MEM(sc->hc, rxdata);
-               bcopy(sc->hc->mem_start + (rxdata & sc->hc->winmsk), 
-                       mtod(m, caddr_t) + off,
-                       tlen);
-
-               off += tlen;
-               len -= tlen;
-
-               if(sc->hc->bustype == AR_BUS_ISA)
-                       ARC_SET_MEM(sc->hc, sc->rxdesc);
-               rxdesc->len = 0;
-               rxdesc->stat = 0xff;
-
-               rxdata += AR_BUF_SIZ;
-               rxdesc++;
-               if(rxdata == rxmax) {
-                       rxdata = sc->rxstart;
-                       rxdesc = (sca_descriptor *)
-                               (sc->hc->mem_start + (sc->rxdesc & sc->hc->winmsk));
-               }
-       }
-}
-
-/*
- * If single is set, just eat a packet. Otherwise eat everything up to
- * where cda points. Update pointers to point to the next packet.
- */
-static void
-ar_eat_packet(struct ar_softc *sc, int single)
-{
-       dmac_channel *dmac;
-       sca_descriptor *rxdesc;
-       sca_descriptor *endp;
-       sca_descriptor *cda;
-       int loopcnt = 0;
-       u_char stat;
-
-       if(sc->hc->bustype == AR_BUS_ISA)
-               ARC_SET_SCA(sc->hc, sc->scano);
-       dmac = &sc->sca->dmac[DMAC_RXCH(sc->scachan)];
-       cda = (sca_descriptor *)(sc->hc->mem_start +
-             ((((u_int)dmac->sarb << 16) + dmac->cda) & sc->hc->winmsk));
-
-       /*
-        * Loop until desc->stat == (0xff || EOM)
-        * Clear the status and length in the descriptor.
-        * Increment the descriptor.
-        */
-       if(sc->hc->bustype == AR_BUS_ISA)
-               ARC_SET_MEM(sc->hc, sc->rxdesc);
-       rxdesc = (sca_descriptor *)
-               (sc->hc->mem_start + (sc->rxdesc & sc->hc->winmsk));
-       endp = rxdesc;
-       rxdesc = &rxdesc[sc->rxhind];
-       endp = &endp[sc->rxmax];
-
-       while(rxdesc != cda) {
-               loopcnt++;
-               if(loopcnt > sc->rxmax) {
-                       kprintf("ar%d: eat pkt %d loop, cda %p, "
-                              "rxdesc %p, stat %x.\n",
-                              sc->unit,
-                              loopcnt,
-                              (void *)cda,
-                              (void *)rxdesc,
-                              rxdesc->stat);
-                       break;
-               }
-
-               stat = rxdesc->stat;
-
-               rxdesc->len = 0;
-               rxdesc->stat = 0xff;
-
-               rxdesc++;
-               sc->rxhind++;
-               if(rxdesc == endp) {
-                       rxdesc = (sca_descriptor *)
-                              (sc->hc->mem_start + (sc->rxdesc & sc->hc->winmsk));
-                       sc->rxhind = 0;
-               }
-
-               if(single && (stat == SCA_DESC_EOM))
-                       break;
-       }
-
-       /*
-        * Update the eda to the previous descriptor.
-        */
-       if(sc->hc->bustype == AR_BUS_ISA)
-               ARC_SET_SCA(sc->hc, sc->scano);
-
-       rxdesc = (sca_descriptor *)sc->rxdesc;
-       rxdesc = &rxdesc[(sc->rxhind + sc->rxmax - 2 ) % sc->rxmax];
-
-       sc->sca->dmac[DMAC_RXCH(sc->scachan)].eda = 
-                       (u_short)((u_int)rxdesc & 0xffff);
-}
-
-
-/*
- * While there is packets available in the rx buffer, read them out
- * into mbufs and ship them off.
- */
-static void
-ar_get_packets(struct ar_softc *sc)
-{
-       sca_descriptor *rxdesc;
-       struct mbuf *m = NULL;
-       int i;
-       int len;
-       u_char rxstat;
-#ifdef NETGRAPH
-       int error;
-#endif
-
-       while(ar_packet_avail(sc, &len, &rxstat)) {
-               TRC(kprintf("apa: len %d, rxstat %x\n", len, rxstat));
-               if(((rxstat & SCA_DESC_ERRORS) == 0) && (len < MCLBYTES)) {
-                       m =  m_getl(len, M_NOWAIT, MT_DATA, M_PKTHDR, NULL);
-                       if(m == NULL) {
-                               /* eat packet if get mbuf fail!! */
-                               ar_eat_packet(sc, 1);
-                               continue;
-                       }
-#ifdef NETGRAPH
-                       m->m_pkthdr.rcvif = NULL;
-                       sc->inbytes += len;
-                       sc->inlast = 0;
-#else
-                       m->m_pkthdr.rcvif = &sc->ifsppp.pp_if;
-#endif
-                       m->m_pkthdr.len = m->m_len = len;
-                       ar_copy_rxbuf(m, sc, len);
-#ifdef NETGRAPH
-                       NG_SEND_DATA_ONLY(error, sc->hook, m);
-                       sc->ipackets++;
-#else
-                       BPF_MTAP(&sc->ifsppp.pp_if, m);
-                       sppp_input(&sc->ifsppp.pp_if, m);
-                       IFNET_STAT_INC(&sc->ifsppp.pp_if, ipackets, 1);
-#endif
-                       /*
-                        * Update the eda to the previous descriptor.
-                        */
-                       i = (len + AR_BUF_SIZ - 1) / AR_BUF_SIZ;
-                       sc->rxhind = (sc->rxhind + i) % sc->rxmax;
-
-                       if(sc->hc->bustype == AR_BUS_ISA)
-                               ARC_SET_SCA(sc->hc, sc->scano);
-
-                       rxdesc = (sca_descriptor *)sc->rxdesc;
-                       rxdesc =
-                            &rxdesc[(sc->rxhind + sc->rxmax - 2 ) % sc->rxmax];
-
-                       sc->sca->dmac[DMAC_RXCH(sc->scachan)].eda = 
-                               (u_short)((u_int)rxdesc & 0xffff);
-               } else {
-                       int tries = 5;
-
-                       while((rxstat == 0xff) && --tries)
-                               ar_packet_avail(sc, &len, &rxstat);
-
-                       /*
-                        * It look like we get an interrupt early
-                        * sometimes and then the status is not
-                        * filled in yet.
-                        */
-                       if(tries && (tries != 5))
-                               continue;
-
-                       ar_eat_packet(sc, 1);
-
-#ifndef        NETGRAPH
-                       IFNET_STAT_INC(&sc->ifsppp.pp_if, ierrors, 1);
-#else  /* NETGRAPH */
-                       sc->ierrors[0]++;
-#endif /* NETGRAPH */
-
-                       if(sc->hc->bustype == AR_BUS_ISA)
-                               ARC_SET_SCA(sc->hc, sc->scano);
-
-                       TRCL(kprintf("ar%d: Receive error chan %d, "
-                                       "stat %x, msci st3 %x,"
-                                       "rxhind %d, cda %x, eda %x.\n",
-                                       sc->unit,
-                                       sc->scachan, 
-                                       rxstat,
-                                       sc->sca->msci[sc->scachan].st3,
-                                       sc->rxhind,
-                                       sc->sca->dmac[
-                                               DMAC_RXCH(sc->scachan)].cda,
-                                       sc->sca->dmac[
-                                               DMAC_RXCH(sc->scachan)].eda));
-               }
-       }
-}
-
-
-/*
- * All DMA interrupts come here.
- *
- * Each channel has two interrupts.
- * Interrupt A for errors and Interrupt B for normal stuff like end
- * of transmit or receive dmas.
- */
-static void
-ar_dmac_intr(struct ar_hardc *hc, int scano, u_char isr1)
-{
-       u_char dsr;
-       u_char dotxstart = isr1;
-       int mch;
-       struct ar_softc *sc;
-       sca_regs *sca;
-       dmac_channel *dmac;
-
-       sca = hc->sca[scano];
-       mch = 0;
-       /*
-        * Shortcut if there is no interrupts for dma channel 0 or 1
-        */
-       if((isr1 & 0x0F) == 0) {
-               mch = 1;
-               isr1 >>= 4;
-       }
-
-       do {
-               sc = &hc->sc[mch + (NCHAN * scano)];
-
-               /*
-                * Transmit channel
-                */
-               if(isr1 & 0x0C) {
-                       u_long opkt;
-
-                       dmac = &sca->dmac[DMAC_TXCH(mch)];
-
-                       if(hc->bustype == AR_BUS_ISA)
-                               ARC_SET_SCA(hc, scano);
-
-                       dsr = dmac->dsr;
-                       dmac->dsr = dsr;
-
-                       /* Counter overflow */
-                       if(dsr & SCA_DSR_COF) {
-#ifndef        NETGRAPH
-                               IFNET_STAT_GET(&sc->ifsppp.pp_if, opackets,
-                                   opkt);
-                               IFNET_STAT_INC(&sc->ifsppp.pp_if, oerrors, 1);
-#else  /* NETGRAPH */
-                               opkt = sc->opackets;
-                               sc->oerrors++;
-#endif /* NETGRAPH */
-                               kprintf("ar%d: TX DMA Counter overflow, "
-                                       "txpacket no %lu.\n",
-                                       sc->unit, opkt);
-                       }
-
-                       /* Buffer overflow */
-                       if(dsr & SCA_DSR_BOF) {
-#ifndef        NETGRAPH
-                               IFNET_STAT_GET(&sc->ifsppp.pp_if, opackets,
-                                   opkt);
-                               IFNET_STAT_INC(&sc->ifsppp.pp_if, oerrors, 1);
-#else  /* NETGRAPH */
-                               opkt = sc->opackets,
-                               sc->oerrors++;
-#endif /* NETGRAPH */
-                               kprintf("ar%d: TX DMA Buffer overflow, "
-                                       "txpacket no %lu, dsr %02x, "
-                                       "cda %04x, eda %04x.\n",
-                                       sc->unit,
-                                       opkt,
-                                       dsr,
-                                       dmac->cda,
-                                       dmac->eda);
-                       }
-
-                       /* End of Transfer */
-                       if(dsr & SCA_DSR_EOT) {
-                               /*
-                                * This should be the most common case.
-                                *
-                                * Call arstart to start a new transmit if
-                                * there is data to transmit.
-                                */
-                               sc->xmit_busy = 0;
-#ifndef        NETGRAPH
-                               ifq_clr_oactive(&sc->ifsppp.pp_if.if_snd);
-                               sc->ifsppp.pp_if.if_timer = 0;
-#else  /* NETGRAPH */
-                       /* XXX  ifq_clr_oactive(&sc->ifsppp.pp_if.if_snd); */
-                               sc->out_dog = 0; /* XXX */
-#endif /* NETGRAPH */
-
-                               if(sc->txb_inuse && --sc->txb_inuse)
-                                       ar_xmit(sc);
-                       }
-               }
-
-               /*
-                * Receive channel
-                */
-               if(isr1 & 0x03) {
-                       u_long ipkt;
-
-                       dmac = &sca->dmac[DMAC_RXCH(mch)];
-
-                       if(hc->bustype == AR_BUS_ISA)
-                               ARC_SET_SCA(hc, scano);
-
-                       dsr = dmac->dsr;
-                       dmac->dsr = dsr;
-
-                       TRC(kprintf("AR: RX DSR %x\n", dsr));
-
-                       /* End of frame */
-                       if(dsr & SCA_DSR_EOM) {
-                               TRC(int tt = sc->ifsppp.pp_if.if_ipackets;)
-                               TRC(int ind = sc->rxhind;)
-
-                               ar_get_packets(sc);
-#ifndef        NETGRAPH
-                               IFNET_STAT_GET(&sc->ifsppp.pp_if, ipackets,
-                                   ipkt);
-#else  /* NETGRAPH */
-                               ipkt = sc->ipackets
-#endif /* NETGRAPH */
-                               TRC(if(tt == ipkt) {
-                                       sca_descriptor *rxdesc;
-                                       int i;
-
-                                       if(hc->bustype == AR_BUS_ISA)
-                                               ARC_SET_SCA(hc, scano);
-                                       kprintf("AR: RXINTR isr1 %x, dsr %x, "
-                                              "no data %d pkts, orxhind %d.\n",
-                                              dotxstart,
-                                              dsr,
-                                              tt,
-                                              ind);
-                                       kprintf("AR: rxdesc %x, rxstart %x, "
-                                              "rxend %x, rxhind %d, "
-                                              "rxmax %d.\n",
-                                              sc->rxdesc,
-                                              sc->rxstart,
-                                              sc->rxend,
-                                              sc->rxhind,
-                                              sc->rxmax);
-                                       kprintf("AR: cda %x, eda %x.\n",
-                                              dmac->cda,
-                                              dmac->eda);
-
-                                       if(sc->hc->bustype == AR_BUS_ISA)
-                                               ARC_SET_MEM(sc->hc,
-                                                   sc->rxdesc);
-                                       rxdesc = (sca_descriptor *)
-                                                (sc->hc->mem_start +
-                                                 (sc->rxdesc & sc->hc->winmsk));
-                                       rxdesc = &rxdesc[sc->rxhind];
-                                       for(i=0;i<3;i++,rxdesc++)
-                                               kprintf("AR: rxdesc->stat %x, "
-                                                       "len %d.\n",
-                                                       rxdesc->stat,
-                                                       rxdesc->len);
-                               });
-                       }
-
-                       /* Counter overflow */
-                       if(dsr & SCA_DSR_COF) {
-#ifndef        NETGRAPH
-                               IFNET_STAT_GET(&sc->ifsppp.pp_if, ipackets,
-                                   ipkt);
-                               IFNET_STAT_INC(&sc->ifsppp.pp_if, ierrors, 1);
-#else  /* NETGRAPH */
-                               ipkt = sc->ipackets;
-                               sc->ierrors[1]++;
-#endif /* NETGRAPH */
-                               kprintf("ar%d: RX DMA Counter overflow, "
-                                       "rxpkts %lu.\n",
-                                       sc->unit, ipkt);
-                       }
-
-                       /* Buffer overflow */
-                       if(dsr & SCA_DSR_BOF) {
-#ifndef        NETGRAPH
-                               IFNET_STAT_GET(&sc->ifsppp.pp_if, ipackets,
-                                   ipkt);
-#else  /* NETGRAPH */
-                               ipkt = sc->ipackets;
-#endif /* NETGRAPH */
-                               if(hc->bustype == AR_BUS_ISA)
-                                       ARC_SET_SCA(hc, scano);
-                               kprintf("ar%d: RX DMA Buffer overflow, "
-                                       "rxpkts %lu, rxind %d, "
-                                       "cda %x, eda %x, dsr %x.\n",
-                                       sc->unit,
-                                       ipkt,
-                                       sc->rxhind,
-                                       dmac->cda,
-                                       dmac->eda,
-                                       dsr);
-                               /*
-                                * Make sure we eat as many as possible.
-                                * Then get the system running again.
-                                */
-                               ar_eat_packet(sc, 0);
-#ifndef        NETGRAPH
-                               IFNET_STAT_INC(&sc->ifsppp.pp_if, ierrors, 1);
-#else  /* NETGRAPH */
-                               sc->ierrors[2]++;
-#endif /* NETGRAPH */
-                               if(hc->bustype == AR_BUS_ISA)
-                                       ARC_SET_SCA(hc, scano);
-                               sca->msci[mch].cmd = SCA_CMD_RXMSGREJ;
-                               dmac->dsr = SCA_DSR_DE;
-
-                               TRC(kprintf("ar%d: RX DMA Buffer overflow, "
-                                       "rxpkts %lu, rxind %d, "
-                                       "cda %x, eda %x, dsr %x. After\n",
-                                       sc->unit,
-                                       sc->ifsppp.pp_if.if_ipackets,
-                                       sc->rxhind,
-                                       dmac->cda,
-                                       dmac->eda,
-                                       dmac->dsr);)
-                       }
-
-                       /* End of Transfer */
-                       if(dsr & SCA_DSR_EOT) {
-#ifndef        NETGRAPH
-                               IFNET_STAT_GET(&sc->ifsppp.pp_if, ipackets,
-                                   ipkt);
-                               IFNET_STAT_INC(&sc->ifsppp.pp_if, ierrors, 1);
-#else  /* NETGRAPH */
-                               ipkt = sc->ipackets;
-                               sc->ierrors[3]++;
-#endif /* NETGRAPH */
-                               /*
-                                * If this happen, it means that we are
-                                * receiving faster than what the processor
-                                * can handle.
-                                *
-                                * XXX We should enable the dma again.
-                                */
-                               kprintf("ar%d: RX End of transfer, rxpkts %lu.\n",
-                                       sc->unit, ipkt);
-                       }
-               }
-
-               isr1 >>= 4;
-
-               mch++;
-       }while((mch<NCHAN) && isr1);
-
-       /*
-        * Now that we have done all the urgent things, see if we
-        * can fill the transmit buffers.
-        */
-       for(mch = 0; mch < NCHAN; mch++) {
-               if(dotxstart & 0x0C) {
-                       sc = &hc->sc[mch + (NCHAN * scano)];
-#ifndef        NETGRAPH
-                       arstart(&sc->ifsppp.pp_if,
-                           ifq_get_subq_default(&sc->ifsppp.pp_if.if_snd));
-#else  /* NETGRAPH */
-                       arstart(sc);
-#endif /* NETGRAPH */
-               }
-               dotxstart >>= 4;
-       }
-}
-
-static void
-ar_msci_intr(struct ar_hardc *hc, int scano, u_char isr0)
-{
-       kprintf("arc%d: ARINTR: MSCI\n", hc->cunit);
-}
-
-static void
-ar_timer_intr(struct ar_hardc *hc, int scano, u_char isr2)
-{
-       kprintf("arc%d: ARINTR: TIMER\n", hc->cunit);
-}
-
-
-#ifdef NETGRAPH
-/*****************************************
- * Device timeout/watchdog routine.
- * called once per second.
- * checks to see that if activity was expected, that it hapenned.
- * At present we only look to see if expected output was completed.
- */
-static void
-ngar_watchdog_frame(void * arg)
-{
-       struct ar_softc * sc = arg;
-       int     speed;
-
-       if (sc->running == 0) {
-               return; /* if we are not running let timeouts die */
-       }
-
-       lwkt_serialize_enter(&ar_serializer);
-
-       /*
-        * calculate the apparent throughputs 
-        *  XXX a real hack
-        */
-       speed = sc->inbytes - sc->lastinbytes;
-       sc->lastinbytes = sc->inbytes;
-       if ( sc->inrate < speed )
-               sc->inrate = speed;
-       speed = sc->outbytes - sc->lastoutbytes;
-       sc->lastoutbytes = sc->outbytes;
-       if ( sc->outrate < speed )
-               sc->outrate = speed;
-       sc->inlast++;
-
-       if ((sc->inlast > QUITE_A_WHILE)
-       && (sc->out_deficit > LOTS_OF_PACKETS)) {
-               log(LOG_ERR, "ar%d: No response from remote end\n", sc->unit);
-
-               ar_down(sc);
-               ar_up(sc);
-               sc->inlast = sc->out_deficit = 0;
-       } else if ( sc->xmit_busy ) { /* no TX -> no TX timeouts */
-               if (sc->out_dog == 0) { 
-                       log(LOG_ERR, "ar%d: Transmit failure.. no clock?\n",
-                                       sc->unit);
-
-                       arwatchdog(sc);
-#if 0
-                       ar_down(sc);
-                       ar_up(sc);
-#endif
-                       sc->inlast = sc->out_deficit = 0;
-               } else {
-                       sc->out_dog--;
-               }
-       }
-       lwkt_serialize_exit(&ar_serializer);
-       callout_reset(&sc->timer, hz, ngar_watchdog_frame, sc);
-}
-
-/***********************************************************************
- * This section contains the methods for the Netgraph interface
- ***********************************************************************/
-/*
- * It is not possible or allowable to create a node of this type.
- * If the hardware exists, it will already have created it.
- */
-static int
-ngar_constructor(node_p *nodep)
-{
-       return (EINVAL);
-}
-
-/*
- * give our ok for a hook to be added...
- * If we are not running this should kick the device into life.
- * The hook's private info points to our stash of info about that
- * channel.
- */
-static int
-ngar_newhook(node_p node, hook_p hook, const char *name)
-{
-       struct ar_softc *       sc = NG_NODE_PRIVATE(node);
-
-       /*
-        * check if it's our friend the debug hook
-        */
-       if (strcmp(name, NG_AR_HOOK_DEBUG) == 0) {
-               NG_HOOK_SET_PRIVATE(hook, NULL); /* paranoid */
-               sc->debug_hook = hook;
-               return (0);
-       }
-
-       /*
-        * Check for raw mode hook.
-        */
-       if (strcmp(name, NG_AR_HOOK_RAW) != 0) {
-               return (EINVAL);
-       }
-       NG_HOOK_SET_PRIVATE(hook, sc);
-       sc->hook = hook;
-       sc->datahooks++;
-       ar_up(sc);
-       return (0);
-}
-
-/*
- * incoming messages.
- * Just respond to the generic TEXT_STATUS message
- */
-static int
-ngar_rcvmsg(node_p node, struct ng_mesg *msg, const char *retaddr,
-           struct ng_mesg **rptr)
-{
-       struct ar_softc *sc;
-       int error = 0;
-       struct ng_mesg *resp = NULL;
-
-       sc = NG_NODE_PRIVATE(node);
-       switch (msg->header.typecookie) {
-       case    NG_AR_COOKIE: 
-               error = EINVAL;
-               break;
-       case    NGM_GENERIC_COOKIE: 
-               switch(msg->header.cmd) {
-               case NGM_TEXT_STATUS: {
-                       char        *arg;
-                       int pos = 0;
-
-                       int resplen = sizeof(struct ng_mesg) + 512;
-                       NG_MKRESPONSE(resp, msg, resplen, M_INTWAIT);
-                       if (resp == NULL) {
-                               error = ENOMEM;
-                               break;
-                       }
-                       arg = (resp)->data;
-                       pos = ksprintf(arg, "%ld bytes in, %ld bytes out\n"
-                           "highest rate seen: %ld B/S in, %ld B/S out\n",
-                       sc->inbytes, sc->outbytes,
-                       sc->inrate, sc->outrate);
-                       pos += ksprintf(arg + pos,
-                               "%ld output errors\n",
-                               sc->oerrors);
-                       pos += ksprintf(arg + pos,
-                               "ierrors = %ld, %ld, %ld, %ld\n",
-                               sc->ierrors[0],
-                               sc->ierrors[1],
-                               sc->ierrors[2],
-                               sc->ierrors[3]);
-
-                       (resp)->header.arglen = pos + 1;
-                       break;
-                     }
-               default:
-                       error = EINVAL;
-                       break;
-                   }
-               break;
-       default:
-               error = EINVAL;
-               break;
-       }
-       /* Take care of synchronous response, if any */
-       NG_RESPOND_MSG(error, node, retaddr, resp, rptr);
-       NG_FREE_MSG(msg);
-       return (error);
-}
-
-/*
- * get data from another node and transmit it to the correct channel
- */
-static int
-ngar_rcvdata(hook_p hook, struct mbuf *m, meta_p meta)
-{
-       int error = 0;
-       struct ar_softc * sc = NG_NODE_PRIVATE(NG_HOOK_NODE(hook));
-       struct ifqueue  *xmitq_p;
-       
-       /*
-        * data doesn't come in from just anywhere (e.g control hook)
-        */
-       if ( NG_HOOK_PRIVATE(hook) == NULL) {
-               error = ENETDOWN;
-               goto bad;
-       }
-
-       /* 
-        * Now queue the data for when it can be sent
-        */
-       if (meta && meta->priority > 0)
-               xmitq_p = (&sc->xmitq_hipri);
-       else
-               xmitq_p = (&sc->xmitq);
-
-       if (IF_QFULL(xmitq_p)) {
-               IF_DROP(xmitq_p);
-
-               error = ENOBUFS;
-               goto bad;
-       }
-       IF_ENQUEUE(xmitq_p, m);
-       arstart(sc);
-
-       return (0);
-
-bad:
-       /* 
-        * It was an error case.
-        * check if we need to free the mbuf, and then return the error
-        */
-       NG_FREE_DATA(m, meta);
-       return (error);
-}
-
-/*
- * do local shutdown processing..
- * this node will refuse to go away, unless the hardware says to..
- * don't unref the node, or remove our name. just clear our links up.
- */
-static int
-ngar_shutdown(node_p node)
-{
-       struct ar_softc * sc = NG_NODE_PRIVATE(node);
-
-       ar_down(sc);
-       NG_NODE_UNREF(node);
-       /* XXX need to drain the output queues! */
-
-       /* The node is dead, long live the node! */
-       /* stolen from the attach routine */
-       if (ng_make_node_common(&typestruct, &sc->node) != 0)
-               return (0);
-       ksprintf(sc->nodename, "%s%d", NG_AR_NODE_TYPE, sc->unit);
-       if (ng_name_node(sc->node, sc->nodename)) {
-               sc->node = NULL;
-               kprintf("node naming failed\n");
-               NG_NODE_UNREF(sc->node); /* node dissappears */
-               return (0);
-       }
-       NG_NODE_SET_PRIVATE(sc->node, sc);
-       sc->running = 0;
-       return (0);
-}
-
-/* already linked */
-static int
-ngar_connect(hook_p hook)
-{
-       /* be really amiable and just say "YUP that's OK by me! " */
-       return (0);
-}
-
-/*
- * notify on hook disconnection (destruction)
- *
- * Invalidate the private data associated with this dlci.
- * For this type, removal of the last link resets tries to destroy the node.
- * As the device still exists, the shutdown method will not actually
- * destroy the node, but reset the device and leave it 'fresh' :)
- *
- * The node removal code will remove all references except that owned by the
- * driver. 
- */
-static int
-ngar_disconnect(hook_p hook)
-{
-       struct ar_softc * sc = NG_NODE_PRIVATE(NG_HOOK_NODE(hook));
-
-       /*
-        * If it's the data hook, then free resources etc.
-        */
-       if (NG_HOOK_PRIVATE(hook)) {
-               sc->datahooks--;
-               if (sc->datahooks == 0)
-                       ar_down(sc);
-       } else {
-               sc->debug_hook = NULL;
-       }
-       return (0);
-}
-
-/*
- * called during bootup
- * or LKM loading to put this type into the list of known modules
- */
-static void
-ngar_init(void *ignored)
-{
-       if (ng_newtype(&typestruct))
-               kprintf("ngar install failed\n");
-       ngar_done_init = 1;
-}
-#endif /* NETGRAPH */
-
-/*
- ********************************* END ************************************
- */
diff --git a/sys/dev/netif/ar/if_ar.h b/sys/dev/netif/ar/if_ar.h
deleted file mode 100644 (file)
index 23cb45b..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*-
- * if_ar.h
- *
- * Copyright (C) 1997-1999 Whistle Communications Inc.
- * All rights reserved.
- *
- * Subject to the following obligations and disclaimer of warranty, use and
- * redistribution of this software, in source or object code forms, with or
- * without modifications are expressly permitted by Whistle Communications;
- * provided, however, that:
- * 1. Any and all reproductions of the source or object code must include the
- *    copyright notice above and the following disclaimer of warranties; and
- * 2. No rights are granted, in any manner or form, to use Whistle
- *    Communications, Inc. trademarks, including the mark "WHISTLE
- *    COMMUNICATIONS" on advertising, endorsements, or otherwise except as
- *    such appears in the above copyright notice or in the software.
- * 
- * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
- * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
- * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
- * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
- * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
- * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
- * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
- * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
- * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
- * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * $FreeBSD: src/sys/dev/ar/if_ar.h,v 1.4 2005/01/06 01:42:28 imp Exp $
- * $DragonFly: src/sys/dev/netif/ar/if_ar.h,v 1.4 2006/10/23 21:50:32 dillon Exp $
- */
-
-#ifndef _DEV_NETIF_AR_IF_AR_H_
-#define _DEV_NETIF_AR_IF_AR_H_
-
-/* Node type name and type cookie */
-#define NG_AR_NODE_TYPE                "sync_ar"
-#define NG_AR_COOKIE           860552149
-
-/* Netgraph hooks */
-#define NG_AR_HOOK_DEBUG       "debug"
-#define NG_AR_HOOK_RAW         "rawdata"
-
-#endif /* _DEV_NETIF_AR_IF_AR_H_ */
-
diff --git a/sys/dev/netif/ar/if_ar_pci.c b/sys/dev/netif/ar/if_ar_pci.c
deleted file mode 100644 (file)
index 7b9ddbf..0000000
+++ /dev/null
@@ -1,179 +0,0 @@
-/*-
- * Copyright (c) 1999 - 2001 John Hay.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the author nor the names of any co-contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD: src/sys/dev/ar/if_ar_pci.c,v 1.11 2004/05/30 20:08:26 phk Exp $
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/malloc.h>
-#include <sys/module.h>
-#include <sys/bus.h>
-#include <sys/rman.h>
-
-#include "pcidevs.h"
-#include <bus/pci/pcireg.h>
-#include <bus/pci/pcivar.h>
-
-#include <dev/netif/ic_layer/hd64570.h>
-#include <dev/netif/ar/if_arregs.h>
-
-#ifdef TRACE
-#define TRC(x)               x
-#else
-#define TRC(x)
-#endif
-
-#define TRCL(x)              x
-
-static struct ar_type {
-       uint16_t         ar_vid;
-       uint16_t         ar_did;
-       const char      *ar_name;
-       const char      *ar_errmsg;
-} ar_devs[] = {
-       { PCI_VENDOR_DIGI, PCI_PRODUCT_DIGI_SYNC570I_2P,
-               "Digi SYNC/570i-PCI 2 port",
-               NULL },
-       { PCI_VENDOR_DIGI, PCI_PRODUCT_DIGI_SYNC570I_2PB1,
-               "Digi SYNC/570i-PCI 2 port (mapped below 1M)",
-               "Please change the jumper to select linear mode." },
-       { PCI_VENDOR_DIGI, PCI_PRODUCT_DIGI_SYNC570I_4P,
-               "Digi SYNC/570i-PCI 4 port",
-               NULL },
-       { PCI_VENDOR_DIGI, PCI_PRODUCT_DIGI_SYNC570I_4PB1,
-               "Digi SYNC/570i-PCI 4 port (mapped below 1M)",
-               "Please change the jumper to select linear mode." },
-       { 0, 0, NULL }
-};
-
-static int     ar_pci_probe(device_t);
-static int     ar_pci_attach(device_t);
-
-static device_method_t ar_pci_methods[] = {
-       /* Device interface */
-       DEVMETHOD(device_probe,         ar_pci_probe),
-       DEVMETHOD(device_attach,        ar_pci_attach),
-       DEVMETHOD(device_detach,        ar_detach),
-       DEVMETHOD_END
-};
-
-static driver_t ar_pci_driver = {
-       "ar",
-       ar_pci_methods,
-       sizeof(struct ar_hardc),
-};
-
-DRIVER_MODULE(if_ar, pci, ar_pci_driver, ar_devclass, NULL, NULL);
-
-static int
-ar_pci_probe(device_t device)
-{
-       struct ar_type *t;
-       uint16_t product = pci_get_device(device);
-       uint16_t vendor = pci_get_vendor(device);
-
-       for (t = ar_devs; t->ar_name != NULL; t++) {
-               if (vendor == t->ar_vid && product == t->ar_did) {
-                       if (t->ar_errmsg != NULL) {
-                               kprintf("%s\n%s\n", t->ar_name, t->ar_errmsg);
-                               return(ENXIO);
-                       } else {
-                               device_set_desc(device, t->ar_name);
-                               return(0);
-                       }
-               }
-       }
-       return (ENXIO);
-}
-
-static int
-ar_pci_attach(device_t device)
-{
-       int error;
-       u_int i, tmp;
-       struct ar_hardc *hc;
-
-       hc = (struct ar_hardc *)device_get_softc(device);
-       bzero(hc, sizeof(struct ar_hardc));
-
-       error = ar_allocate_plx_memory(device, 0x10, 1);
-       if(error)
-               goto errexit;
-
-       error = ar_allocate_memory(device, 0x18, 1);
-       if(error)
-               goto errexit;
-
-       error = ar_allocate_irq(device, 0, 1);
-       if(error)
-               goto errexit;
-
-       hc->mem_start = rman_get_virtual(hc->res_memory);
-
-       hc->cunit = device_get_unit(device);
-       hc->sca[0] = (sca_regs *)(hc->mem_start + AR_PCI_SCA_1_OFFSET);
-       hc->sca[1] = (sca_regs *)(hc->mem_start + AR_PCI_SCA_2_OFFSET);
-       hc->orbase = (u_char *)(hc->mem_start + AR_PCI_ORBASE_OFFSET);
-
-       tmp = hc->orbase[AR_BMI * 4];
-       hc->bustype = tmp & AR_BUS_MSK;
-       hc->memsize = (tmp & AR_MEM_MSK) >> AR_MEM_SHFT;
-       hc->memsize = 1 << hc->memsize;
-       hc->memsize <<= 16;
-       hc->interface[0] = (tmp & AR_IFACE_MSK);
-       tmp = hc->orbase[AR_REV * 4];
-       hc->revision = tmp & AR_REV_MSK;
-       hc->winsize = (1 << ((tmp & AR_WSIZ_MSK) >> AR_WSIZ_SHFT)) * 16 * 1024;
-       hc->mem_end = (caddr_t)(hc->mem_start + hc->winsize);
-       hc->winmsk = hc->winsize - 1;
-       hc->numports = hc->orbase[AR_PNUM * 4];
-       hc->handshake = hc->orbase[AR_HNDSH * 4];
-
-       for(i = 1; i < hc->numports; i++)
-               hc->interface[i] = hc->interface[0];
-
-       TRC(kprintf("arp%d: bus %x, rev %d, memstart %p, winsize %d, "
-           "winmsk %x, interface %x\n",
-           unit, hc->bustype, hc->revision, hc->mem_start, hc->winsize,
-           hc->winmsk, hc->interface[0]));
-
-       ar_attach(device);
-
-       /* Magic to enable the card to generate interrupts. */
-       bus_space_write_1(rman_get_bustag(hc->res_plx_memory),
-           rman_get_bushandle(hc->res_plx_memory), 0x69, 0x09);
-
-       return (0);
-
-errexit:
-       ar_deallocate_resources(device);
-       return (ENXIO);
-}
-
diff --git a/sys/dev/netif/ar/if_arregs.h b/sys/dev/netif/ar/if_arregs.h
deleted file mode 100644 (file)
index e6e0071..0000000
+++ /dev/null
@@ -1,232 +0,0 @@
-/*-
- * Copyright (c) 1995 - 2001 John Hay.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the author nor the names of any co-contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY [your name] AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD: src/sys/dev/ar/if_arregs.h,v 1.10 2005/01/06 01:42:28 imp Exp $
- * $DragonFly: src/sys/dev/netif/ar/if_arregs.h,v 1.3 2005/02/08 14:31:16 joerg Exp $
- */
-#ifndef _IF_ARREGS_H_
-#define _IF_ARREGS_H_
-
-#define NCHAN                  2    /* A HD64570 chip have 2 channels */
-#define NPORT                  4    /* An ArNet board can have 4 ports or */
-                                    /* channels */
-
-#define AR_BUF_SIZ             512
-#define AR_TX_BLOCKS           2
-#define ARC_IO_SIZ             0x10
-#define ARC_WIN_SIZ            0x00004000
-#define ARC_WIN_MSK            (ARC_WIN_SIZ - 1)
-#define ARC_WIN_SHFT           14
-
-/* Some PCI specific offsets. */
-#define AR_PCI_SCA_1_OFFSET    0x00040000
-#define AR_PCI_SCA_2_OFFSET    0x00040400
-#define AR_PCI_ORBASE_OFFSET   0x00041000
-#define AR_PCI_SCA_PCR         0x0208
-#define AR_PCI_SCA_DMER                0x0309
-/* PCI Legacy (below 1M) offsets. */
-#define AR_PCI_L_SCA_1_OFFSET  0x00004000
-#define AR_PCI_L_SCA_2_OFFSET  0x00004400
-#define AR_PCI_L_ORBASE_OFFSET 0x00005000
-
-#define AR_ID_5                        0x00 /* RO, Card probe '5' */
-#define AR_ID_7                        0x01 /* RO, Card probe '7' */
-#define AR_ID_0                        0x02 /* RO, Card probe '0' */
-#define AR_BMI                 0x03 /* RO, Bus, mem and interface type */
-#define AR_REV                 0x04 /* RO, Adapter revision */
-#define AR_PNUM                        0x05 /* RO, Port number */
-#define AR_HNDSH               0x06 /* RO, Supported handshake */
-#define AR_ISTAT               0x07 /* RO, DCD and Interrupt status */
-#define AR_MSCA_EN             0x08 /* WO, Memory and SCA enable */
-#define AR_TXC_DTR0            0x09 /* WO, Tx Clock and DTR control 0 + 1 */
-#define AR_SEC_PAL             0x0A /* RW, Security PAL */
-#define AR_INT_ACK0            0x0B /* RO, Interrupt Acknowledge 0 + 1 */
-#define AR_INT_SEL             0x0C /* RW, Interrupt Select */
-#define AR_MEM_SEL             0x0D /* RW, Memory Select */
-#define AR_INT_ACK2            0x0E /* RO, Interrupt Acknowledge 2 + 3 */
-#define AR_TXC_DTR2            0x0E /* WO, Tx Clock and DTR control 2 + 3 */
-/* PCI only */
-#define AR_PIMCTRL             0x4C /* RW, PIM and LEDs */
-#define AR_INT_SCB             0x50 /* RO, Interrupt Scoreboard */
-
-#define AR_REV_MSK             0x0F
-#define AR_WSIZ_MSK            0xE0
-#define AR_WSIZ_SHFT           5
-/* Bus memory and interface type */
-#define AR_BUS_MSK             0x03
-#define AR_BUS_ISA             0x00
-#define AR_BUS_MCA             0x01
-#define AR_BUS_EISA            0x02
-#define AR_BUS_PCI             0x03
-
-#define AR_MEM_MSK             0x1C
-#define AR_MEM_SHFT            0x02
-#define AR_MEM_64K             0x00
-#define AR_MEM_128K            0x04
-#define AR_MEM_256K            0x08
-#define AR_MEM_512K            0x0C
-
-/*
- * EIA-232
- * V.35/EIA-232
- * EIA-530
- * X.21
- * EIA-530/X.21 Combo
- */
-#define AR_IFACE_MSK           0xE0
-#define AR_IFACE_SHFT          0x05
-#define AR_IFACE_EIA_232       0x00  /* Only on the 570 card, not 570i */
-#define AR_IFACE_V_35          0x20  /* Selectable between V.35 and EIA-232 */
-#define AR_IFACE_EIA_530       0x40
-#define AR_IFACE_X_21          0x60
-#define AR_IFACE_COMBO         0xC0  /* X.21 / EIA-530 */
-#define AR_IFACE_PIM           0xE0  /* PIM module */
-#define AR_IFACE_LOOPBACK      0xFE
-#define AR_IFACE_UNKNOWN       0xFF
-
-/* Supported Handshake signals */
-#define AR_SHSK_DTR            0x01
-#define AR_SHSK_RTS            0x02
-#define AR_SHSK_CTS            0x10
-#define AR_SHSK_DSR            0x20
-#define AR_SHSK_RI             0x40
-#define AR_SHSK_DCD            0x80
-
-/* DCD and Interrupt status */
-#define AR_BD_INT              0x01
-#define AR_INT_0               0x20
-#define AR_INT_1               0x40
-
-#define AR_DCD_MSK             0x1E
-#define AR_DCD_SHFT            0x01
-#define AR_DCD_0               0x02
-#define AR_DCD_1               0x04
-#define AR_DCD_2               0x08
-#define AR_DCD_3               0x10
-
-/* Memory and SCA enable */
-#define AR_WIN_MSK             0x1F
-
-#define AR_SEL_SCA_0           0x00
-#define AR_SEL_SCA_1           0x20
-#define AR_ENA_SCA             0x40
-#define AR_ENA_MEM             0x80
-
-/* Transmit Clock and DTR and RESET */
-#define AR_TXC_DTR_TX0         0x01
-#define AR_TXC_DTR_TX1         0x02
-#define AR_TXC_DTR_DTR0                0x04
-#define AR_TXC_DTR_DTR1                0x08
-#define AR_TXC_DTR_TXCS0       0x10
-#define AR_TXC_DTR_TXCS1       0x20
-#define AR_TXC_DTR_NOTRESET    0x40
-#define AR_TXC_DTR_RESET       0x00
-
-/* Interrupt select register */
-#define AR_INTS_CEN            0x01
-#define AR_INTS_ISEL0          0x02
-#define AR_INTS_ISEL1          0x04
-#define AR_INTS_ISEL2          0x08
-#define AR_INTS_CMA14          0x10
-#define AR_INTS_CMA15          0x20
-
-/* Advanced PIM Control */
-#define AR_PIM_STROBE          0x01
-#define AR_PIM_DATA            0x02
-#define AR_PIM_MODEG           0x04
-#define AR_PIM_A2D_STROBE      0x04
-#define AR_PIM_MODEY           0x08
-#define AR_PIM_A2D_DOUT                0x08
-#define AR_PIM_AUTO_LED                0x10
-#define AR_PIM_INT             0x20
-
-#define AR_PIM_RESET           0x00 /* MODEG and MODEY 0 */
-#define AR_PIM_READ            AR_PIM_MODEG
-#define AR_PIM_WRITE           AR_PIM_MODEY
-
-#define ARC_GET_WIN(addr)      ((addr >> ARC_WIN_SHFT) & AR_WIN_MSK)
-
-#define ARC_SET_MEM(hc,win)    ar_outb(hc, AR_MSCA_EN, AR_ENA_MEM | \
-                               ARC_GET_WIN(win))
-#define ARC_SET_SCA(hc,ch)     ar_outb(hc, AR_MSCA_EN, AR_ENA_MEM | \
-                               AR_ENA_SCA | (ch ? AR_SEL_SCA_1:AR_SEL_SCA_0))
-#define ARC_SET_OFF(hc)                ar_outb(hc, AR_MSCA_EN, 0)
-
-struct ar_hardc {
-       int cunit;
-       struct ar_softc *sc;
-       int isa_irq;
-       int numports;
-       caddr_t mem_start;
-       caddr_t mem_end;
-       u_char *orbase;
-
-       u_int memsize;          /* in bytes */
-       u_int winsize;          /* in bytes */
-       u_int winmsk;
-       u_char bustype;         /* ISA, MCA, PCI.... */
-       u_char interface[NPORT];/* X21, V.35, EIA-530.... */
-       u_char revision;
-       u_char handshake;       /* handshake lines supported by card. */
-
-       u_char txc_dtr[NPORT/NCHAN]; /* the register is write only */
-       u_int txc_dtr_off[NPORT/NCHAN];
-
-       sca_regs *sca[NPORT/NCHAN];
-
-       bus_space_tag_t bt;
-       bus_space_handle_t bh;
-       int rid_ioport;
-       int rid_memory;
-       int rid_plx_memory;
-       int rid_irq;
-       int rid_drq;
-       struct resource* res_ioport;    /* resource for port range */
-       struct resource* res_memory;    /* resource for mem range */
-       struct resource* res_plx_memory;
-       struct resource* res_irq;       /* resource for irq range */
-       struct resource* res_drq;       /* resource for dma channel */
-       void    *intr_cookie;
-};
-
-extern devclass_t ar_devclass;
-
-int ar_allocate_ioport(device_t device, int rid, u_long size);
-int ar_allocate_irq(device_t device, int rid, u_long size);
-int ar_allocate_memory(device_t device, int rid, u_long size);
-int ar_allocate_plx_memory(device_t device, int rid, u_long size);
-int ar_deallocate_resources(device_t device);
-int ar_attach(device_t device);
-int ar_detach (device_t);
-
-#define ar_inb(hc, port) \
-       bus_space_read_1((hc)->bt, (hc)->bh, (port))
-
-#define ar_outb(hc, port, value) \
-       bus_space_write_1((hc)->bt, (hc)->bh, (port), (value))
-
-#endif /* _IF_ARREGS_H_ */
diff --git a/sys/dev/netif/ed/Makefile b/sys/dev/netif/ed/Makefile
deleted file mode 100644 (file)
index 5d293c3..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-KMOD   = if_ed
-SRCS   = if_ed.c if_ed_pccard.c if_ed_pci.c \
-       card_if.h pccarddevs.h device_if.h bus_if.h pci_if.h \
-       miibus_if.h pcidevs.h \
-       opt_ed.h
-
-.include <bsd.kmod.mk>
diff --git a/sys/dev/netif/ed/if_ed.c b/sys/dev/netif/ed/if_ed.c
deleted file mode 100644 (file)
index c831b07..0000000
+++ /dev/null
@@ -1,3478 +0,0 @@
-/*
- * Copyright (c) 1995, David Greenman
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice unmodified, this list of conditions, and the following
- *    disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD: src/sys/dev/ed/if_ed.c,v 1.224 2003/12/08 07:54:12 obrien Exp $
- */
-
-/*
- * Device driver for National Semiconductor DS8390/WD83C690 based ethernet
- *   adapters. By David Greenman, 29-April-1993
- *
- * Currently supports the Western Digital/SMC 8003 and 8013 series,
- *   the SMC Elite Ultra (8216), the 3Com 3c503, the NE1000 and NE2000,
- *   and a variety of similar clones.
- *
- */
-
-#include "opt_ed.h"
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/sockio.h>
-#include <sys/mbuf.h>
-#include <sys/kernel.h>
-#include <sys/socket.h>
-#include <sys/syslog.h>
-#include <sys/module.h>
-#include <sys/bus.h>
-#include <sys/rman.h>
-#include <sys/thread2.h>
-#include <sys/machintr.h>
-
-#include <net/ethernet.h>
-#include <net/if.h>
-#include <net/ifq_var.h>
-#include <net/if_arp.h>
-#include <net/if_dl.h>
-#include <net/if_mib.h>
-#include <net/if_media.h>
-
-#ifndef ED_NO_MIIBUS
-#include <dev/netif/mii_layer/mii.h>
-#include <dev/netif/mii_layer/miivar.h>
-#endif
-
-#include <net/bpf.h>
-
-#include <machine/md_var.h>
-
-#include "if_edreg.h"
-#include "if_edvar.h"
-
-devclass_t ed_devclass;
-
-static void    ed_init         (void *);
-static int     ed_ioctl(struct ifnet *, u_long, caddr_t, struct ucred *);
-static void    ed_start        (struct ifnet *, struct ifaltq_subque *);
-static void    ed_reset        (struct ifnet *);
-static void    ed_watchdog     (struct ifnet *);
-#ifndef ED_NO_MIIBUS
-static void    ed_tick         (void *);
-#endif
-
-static void    ds_getmcaf      (struct ed_softc *, u_int32_t *);
-
-static void    ed_get_packet   (struct ed_softc *, char *, u_short);
-
-static __inline void   ed_rint (struct ed_softc *);
-static __inline void   ed_xmit (struct ed_softc *);
-static __inline char * ed_ring_copy (struct ed_softc *, char *, char *,
-                                         u_short);
-static void    ed_hpp_set_physical_link (struct ed_softc *);
-static void    ed_hpp_readmem  (struct ed_softc *, u_short, u_char *, u_short);
-static void    ed_hpp_writemem (struct ed_softc *, u_char *, u_short, u_short);
-static u_short ed_hpp_write_mbufs (struct ed_softc *, struct mbuf *, int);
-
-static u_short ed_pio_write_mbufs (struct ed_softc *, struct mbuf *, int);
-
-static void    ed_setrcr       (struct ed_softc *);
-
-static uint32_t ds_mchash      (const uint8_t *);
-
-DECLARE_DUMMY_MODULE(if_ed);
-
-/*
- * Interrupt conversion table for WD/SMC ASIC/83C584
- */
-static u_short ed_intr_val[] = {
-       9,
-       3,
-       5,
-       7,
-       10,
-       11,
-       15,
-       4
-};
-
-/*
- * Interrupt conversion table for 83C790
- */
-static u_short ed_790_intr_val[] = {
-       0,
-       9,
-       3,
-       5,
-       7,
-       10,
-       11,
-       15
-};
-
-/*
- * Interrupt conversion table for the HP PC LAN+
- */
-
-static u_short ed_hpp_intr_val[] = {
-       0,              /* 0 */
-       0,              /* 1 */
-       0,              /* 2 */
-       3,              /* 3 */
-       4,              /* 4 */
-       5,              /* 5 */
-       6,              /* 6 */
-       7,              /* 7 */
-       0,              /* 8 */
-       9,              /* 9 */
-       10,             /* 10 */
-       11,             /* 11 */
-       12,             /* 12 */
-       0,              /* 13 */
-       0,              /* 14 */
-       15              /* 15 */
-};
-
-/*
- * Generic probe routine for testing for the existance of a DS8390.
- *     Must be called after the NIC has just been reset. This routine
- *     works by looking at certain register values that are guaranteed
- *     to be initialized a certain way after power-up or reset. Seems
- *     not to currently work on the 83C690.
- *
- * Specifically:
- *
- *     Register                        reset bits      set bits
- *     Command Register (CR)           TXP, STA        RD2, STP
- *     Interrupt Status (ISR)                          RST
- *     Interrupt Mask (IMR)            All bits
- *     Data Control (DCR)                              LAS
- *     Transmit Config. (TCR)          LB1, LB0
- *
- * We only look at the CR and ISR registers, however, because looking at
- *     the others would require changing register pages (which would be
- *     intrusive if this isn't an 8390).
- *
- * Return 1 if 8390 was found, 0 if not.
- */
-
-int
-ed_probe_generic8390(struct ed_softc *sc)
-{
-       if ((ed_nic_inb(sc, ED_P0_CR) &
-            (ED_CR_RD2 | ED_CR_TXP | ED_CR_STA | ED_CR_STP)) !=
-           (ED_CR_RD2 | ED_CR_STP))
-               return (0);
-       if ((ed_nic_inb(sc, ED_P0_ISR) & ED_ISR_RST) != ED_ISR_RST)
-               return (0);
-
-       return (1);
-}
-
-/*
- * Probe and vendor-specific initialization routine for SMC/WD80x3 boards
- */
-int
-ed_probe_WD80x3_generic(device_t dev, int flags, u_short *intr_vals[])
-{
-       struct ed_softc *sc = device_get_softc(dev);
-       int     error;
-       int     i;
-       u_int   memsize, maddr;
-       u_char  iptr, isa16bit, sum, totalsum;
-       u_long  conf_maddr, conf_msize, irq, junk;
-
-       sc->chip_type = ED_CHIP_TYPE_DP8390;
-
-       if (ED_FLAGS_GETTYPE(flags) == ED_FLAGS_TOSH_ETHER) {
-               totalsum = ED_WD_ROM_CHECKSUM_TOTAL_TOSH_ETHER;
-               ed_asic_outb(sc, ED_WD_MSR, ED_WD_MSR_POW);
-               DELAY(10000);
-       }
-       else
-               totalsum = ED_WD_ROM_CHECKSUM_TOTAL;
-
-       /*
-        * Attempt to do a checksum over the station address PROM. If it
-        * fails, it's probably not a SMC/WD board. There is a problem with
-        * this, though: some clone WD boards don't pass the checksum test.
-        * Danpex boards for one.
-        */
-       for (sum = 0, i = 0; i < 8; ++i)
-               sum += ed_asic_inb(sc, ED_WD_PROM + i);
-
-       if (sum != totalsum) {
-
-               /*
-                * Checksum is invalid. This often happens with cheap WD8003E
-                * clones.  In this case, the checksum byte (the eighth byte)
-                * seems to always be zero.
-                */
-               if (ed_asic_inb(sc, ED_WD_CARD_ID) != ED_TYPE_WD8003E ||
-                   ed_asic_inb(sc, ED_WD_PROM + 7) != 0)
-                       return (ENXIO);
-       }
-       /* reset card to force it into a known state. */
-       if (ED_FLAGS_GETTYPE(flags) == ED_FLAGS_TOSH_ETHER)
-               ed_asic_outb(sc, ED_WD_MSR, ED_WD_MSR_RST | ED_WD_MSR_POW);
-       else
-               ed_asic_outb(sc, ED_WD_MSR, ED_WD_MSR_RST);
-
-       DELAY(100);
-       ed_asic_outb(sc, ED_WD_MSR, ed_asic_inb(sc, ED_WD_MSR) & ~ED_WD_MSR_RST);
-       /* wait in the case this card is reading its EEROM */
-       DELAY(5000);
-
-       sc->vendor = ED_VENDOR_WD_SMC;
-       sc->type = ed_asic_inb(sc, ED_WD_CARD_ID);
-
-       /*
-        * Set initial values for width/size.
-        */
-       memsize = 8192;
-       isa16bit = 0;
-       switch (sc->type) {
-       case ED_TYPE_WD8003S:
-               sc->type_str = "WD8003S";
-               break;
-       case ED_TYPE_WD8003E:
-               sc->type_str = "WD8003E";
-               break;
-       case ED_TYPE_WD8003EB:
-               sc->type_str = "WD8003EB";
-               break;
-       case ED_TYPE_WD8003W:
-               sc->type_str = "WD8003W";
-               break;
-       case ED_TYPE_WD8013EBT:
-               sc->type_str = "WD8013EBT";
-               memsize = 16384;
-               isa16bit = 1;
-               break;
-       case ED_TYPE_WD8013W:
-               sc->type_str = "WD8013W";
-               memsize = 16384;
-               isa16bit = 1;
-               break;
-       case ED_TYPE_WD8013EP:  /* also WD8003EP */
-               if (ed_asic_inb(sc, ED_WD_ICR) & ED_WD_ICR_16BIT) {
-                       isa16bit = 1;
-                       memsize = 16384;
-                       sc->type_str = "WD8013EP";
-               } else {
-                       sc->type_str = "WD8003EP";
-               }
-               break;
-       case ED_TYPE_WD8013WC:
-               sc->type_str = "WD8013WC";
-               memsize = 16384;
-               isa16bit = 1;
-               break;
-       case ED_TYPE_WD8013EBP:
-               sc->type_str = "WD8013EBP";
-               memsize = 16384;
-               isa16bit = 1;
-               break;
-       case ED_TYPE_WD8013EPC:
-               sc->type_str = "WD8013EPC";
-               memsize = 16384;
-               isa16bit = 1;
-               break;
-       case ED_TYPE_SMC8216C: /* 8216 has 16K shared mem -- 8416 has 8K */
-       case ED_TYPE_SMC8216T:
-               if (sc->type == ED_TYPE_SMC8216C) {
-                       sc->type_str = "SMC8216/SMC8216C";
-               } else {
-                       sc->type_str = "SMC8216T";
-               }
-
-               ed_asic_outb(sc, ED_WD790_HWR,
-                   ed_asic_inb(sc, ED_WD790_HWR) | ED_WD790_HWR_SWH);
-               switch (ed_asic_inb(sc, ED_WD790_RAR) & ED_WD790_RAR_SZ64) {
-               case ED_WD790_RAR_SZ64:
-                       memsize = 65536;
-                       break;
-               case ED_WD790_RAR_SZ32:
-                       memsize = 32768;
-                       break;
-               case ED_WD790_RAR_SZ16:
-                       memsize = 16384;
-                       break;
-               case ED_WD790_RAR_SZ8:
-                       /* 8216 has 16K shared mem -- 8416 has 8K */
-                       if (sc->type == ED_TYPE_SMC8216C) {
-                               sc->type_str = "SMC8416C/SMC8416BT";
-                       } else {
-                               sc->type_str = "SMC8416T";
-                       }
-                       memsize = 8192;
-                       break;
-               }
-               ed_asic_outb(sc, ED_WD790_HWR,
-                   ed_asic_inb(sc, ED_WD790_HWR) & ~ED_WD790_HWR_SWH);
-
-               isa16bit = 1;
-               sc->chip_type = ED_CHIP_TYPE_WD790;
-               break;
-       case ED_TYPE_TOSHIBA1:
-               sc->type_str = "Toshiba1";
-               memsize = 32768;
-               isa16bit = 1;
-               break;
-       case ED_TYPE_TOSHIBA4:
-               sc->type_str = "Toshiba4";
-               memsize = 32768;
-               isa16bit = 1;
-               break;
-       default:
-               sc->type_str = "";
-               break;
-       }
-
-       /*
-        * Make some adjustments to initial values depending on what is found
-        * in the ICR.
-        */
-       if (isa16bit && (sc->type != ED_TYPE_WD8013EBT)
-         && (sc->type != ED_TYPE_TOSHIBA1) && (sc->type != ED_TYPE_TOSHIBA4)
-           && ((ed_asic_inb(sc, ED_WD_ICR) & ED_WD_ICR_16BIT) == 0)) {
-               isa16bit = 0;
-               memsize = 8192;
-       }
-
-       error = bus_get_resource(dev, SYS_RES_MEMORY, 0,
-                                &conf_maddr, &conf_msize);
-       if (error)
-               return (error);
-
-#ifdef ED_DEBUG
-       kprintf("type = %x type_str=%s isa16bit=%d memsize=%d id_msize=%d\n",
-              sc->type, sc->type_str, isa16bit, memsize, conf_msize);
-       for (i = 0; i < 8; i++)
-               kprintf("%x -> %x\n", i, ed_asic_inb(sc, i));
-#endif
-
-       /*
-        * Allow the user to override the autoconfiguration
-        */
-       if (conf_msize > 1)
-               memsize = conf_msize;
-
-       maddr = conf_maddr;
-       if (maddr < 0xa0000 || maddr + memsize > 0x1000000) {
-               device_printf(dev, "Invalid ISA memory address range configured: 0x%x - 0x%x\n",
-                             maddr, maddr + memsize);
-               return (ENXIO);
-       }
-
-       /*
-        * (note that if the user specifies both of the following flags that
-        * '8bit' mode intentionally has precedence)
-        */
-       if (flags & ED_FLAGS_FORCE_16BIT_MODE)
-               isa16bit = 1;
-       if (flags & ED_FLAGS_FORCE_8BIT_MODE)
-               isa16bit = 0;
-
-       /*
-        * If possible, get the assigned interrupt number from the card and
-        * use it.
-        */
-       if ((sc->type & ED_WD_SOFTCONFIG) &&
-           (sc->chip_type != ED_CHIP_TYPE_WD790)) {
-
-               /*
-                * Assemble together the encoded interrupt number.
-                */
-               iptr = (ed_asic_inb(sc, ED_WD_ICR) & ED_WD_ICR_IR2) |
-                   ((ed_asic_inb(sc, ED_WD_IRR) &
-                     (ED_WD_IRR_IR0 | ED_WD_IRR_IR1)) >> 5);
-
-               /*
-                * If no interrupt specified (or "?"), use what the board tells us.
-                */
-               error = bus_get_resource(dev, SYS_RES_IRQ, 0,
-                                        &irq, &junk);
-               if (error && intr_vals[0] != NULL) {
-                       int intr_val = intr_vals[0][iptr];
-
-                       error = bus_set_resource(dev, SYS_RES_IRQ, 0,
-                           intr_val, 1, machintr_legacy_intr_cpuid(intr_val));
-               }
-               if (error)
-                       return (error);
-
-               /*
-                * Enable the interrupt.
-                */
-               ed_asic_outb(sc, ED_WD_IRR,
-                    ed_asic_inb(sc, ED_WD_IRR) | ED_WD_IRR_IEN);
-       }
-       if (sc->chip_type == ED_CHIP_TYPE_WD790) {
-               ed_asic_outb(sc, ED_WD790_HWR,
-                 ed_asic_inb(sc, ED_WD790_HWR) | ED_WD790_HWR_SWH);
-               iptr = (((ed_asic_inb(sc, ED_WD790_GCR) & ED_WD790_GCR_IR2) >> 4) |
-                       (ed_asic_inb(sc, ED_WD790_GCR) &
-                        (ED_WD790_GCR_IR1 | ED_WD790_GCR_IR0)) >> 2);
-               ed_asic_outb(sc, ED_WD790_HWR,
-                ed_asic_inb(sc, ED_WD790_HWR) & ~ED_WD790_HWR_SWH);
-
-               /*
-                * If no interrupt specified (or "?"), use what the board tells us.
-                */
-               error = bus_get_resource(dev, SYS_RES_IRQ, 0,
-                                        &irq, &junk);
-               if (error && intr_vals[1] != NULL) {
-                       int intr_val = intr_vals[1][iptr];
-
-                       error = bus_set_resource(dev, SYS_RES_IRQ, 0,
-                           intr_val, 1, machintr_legacy_intr_cpuid(intr_val));
-               }
-               if (error)
-                       return (error);
-
-               /*
-                * Enable interrupts.
-                */
-               ed_asic_outb(sc, ED_WD790_ICR,
-                 ed_asic_inb(sc, ED_WD790_ICR) | ED_WD790_ICR_EIL);
-       }
-       error = bus_get_resource(dev, SYS_RES_IRQ, 0,
-                                &irq, &junk);
-       if (error) {
-               device_printf(dev, "%s cards don't support auto-detected/assigned interrupts.\n",
-                             sc->type_str);
-               return (ENXIO);
-       }
-       sc->isa16bit = isa16bit;
-       sc->mem_shared = 1;
-
-       error = ed_alloc_memory(dev, 0, memsize);
-       if (error) {
-               kprintf("*** ed_alloc_memory() failed! (%d)\n", error);
-               return (error);
-       }
-       sc->mem_start = (caddr_t) rman_get_virtual(sc->mem_res);
-
-       /*
-        * allocate one xmit buffer if < 16k, two buffers otherwise
-        */
-       if ((memsize < 16384) ||
-            (flags & ED_FLAGS_NO_MULTI_BUFFERING)) {
-               sc->txb_cnt = 1;
-       } else {
-               sc->txb_cnt = 2;
-       }
-       sc->tx_page_start = ED_WD_PAGE_OFFSET;
-       sc->rec_page_start = ED_WD_PAGE_OFFSET + ED_TXBUF_SIZE * sc->txb_cnt;
-       sc->rec_page_stop = ED_WD_PAGE_OFFSET + memsize / ED_PAGE_SIZE;
-       sc->mem_ring = sc->mem_start + (ED_PAGE_SIZE * sc->rec_page_start);
-       sc->mem_size = memsize;
-       sc->mem_end = sc->mem_start + memsize;
-
-       /*
-        * Get station address from on-board ROM
-        */
-       for (i = 0; i < ETHER_ADDR_LEN; ++i)
-               sc->arpcom.ac_enaddr[i] = ed_asic_inb(sc, ED_WD_PROM + i);
-
-       /*
-        * Set upper address bits and 8/16 bit access to shared memory.
-        */
-       if (isa16bit) {
-               if (sc->chip_type == ED_CHIP_TYPE_WD790) {
-                       sc->wd_laar_proto = ed_asic_inb(sc, ED_WD_LAAR);
-               } else {
-                       sc->wd_laar_proto = ED_WD_LAAR_L16EN |
-                           ((kvtop(sc->mem_start) >> 19) & ED_WD_LAAR_ADDRHI);
-               }
-               /*
-                * Enable 16bit access
-                */
-               ed_asic_outb(sc, ED_WD_LAAR, sc->wd_laar_proto |
-                   ED_WD_LAAR_M16EN);
-       } else {
-               if (((sc->type & ED_WD_SOFTCONFIG) ||
-                    (sc->type == ED_TYPE_TOSHIBA1) ||
-                    (sc->type == ED_TYPE_TOSHIBA4) ||
-                    (sc->type == ED_TYPE_WD8013EBT)) &&
-                   (sc->chip_type != ED_CHIP_TYPE_WD790)) {
-                       sc->wd_laar_proto = (kvtop(sc->mem_start) >> 19) &
-                           ED_WD_LAAR_ADDRHI;
-                       ed_asic_outb(sc, ED_WD_LAAR, sc->wd_laar_proto);
-               }
-       }
-
-       /*
-        * Set address and enable interface shared memory.
-        */
-       if (sc->chip_type != ED_CHIP_TYPE_WD790) {
-               if (ED_FLAGS_GETTYPE(flags) == ED_FLAGS_TOSH_ETHER) {
-                       ed_asic_outb(sc, ED_WD_MSR + 1,
-                                    ((kvtop(sc->mem_start) >> 8) & 0xe0) | 4);
-                       ed_asic_outb(sc, ED_WD_MSR + 2,
-                                    ((kvtop(sc->mem_start) >> 16) & 0x0f));
-                       ed_asic_outb(sc, ED_WD_MSR,
-                                    ED_WD_MSR_MENB | ED_WD_MSR_POW);
-               } else {
-                       ed_asic_outb(sc, ED_WD_MSR,
-                                    ((kvtop(sc->mem_start) >> 13) &
-                                     ED_WD_MSR_ADDR) | ED_WD_MSR_MENB);
-               }
-               sc->cr_proto = ED_CR_RD2;
-       } else {
-               ed_asic_outb(sc, ED_WD_MSR, ED_WD_MSR_MENB);
-               ed_asic_outb(sc, ED_WD790_HWR, (ed_asic_inb(sc, ED_WD790_HWR) | ED_WD790_HWR_SWH));
-               ed_asic_outb(sc, ED_WD790_RAR, ((kvtop(sc->mem_start) >> 13) & 0x0f) |
-                    ((kvtop(sc->mem_start) >> 11) & 0x40) |
-                    (ed_asic_inb(sc, ED_WD790_RAR) & 0xb0));
-               ed_asic_outb(sc, ED_WD790_HWR, (ed_asic_inb(sc, ED_WD790_HWR) & ~ED_WD790_HWR_SWH));
-               sc->cr_proto = 0;
-       }
-
-#if 0
-       kprintf("starting memory performance test at 0x%x, size %d...\n",
-               sc->mem_start, memsize*16384);
-       for (i = 0; i < 16384; i++)
-               bzero(sc->mem_start, memsize);
-       kprintf("***DONE***\n");
-#endif
-
-       /*
-        * Now zero memory and verify that it is clear
-        */
-       bzero(sc->mem_start, memsize);
-
-       for (i = 0; i < memsize; ++i) {
-               if (sc->mem_start[i]) {
-                       device_printf(dev, "failed to clear shared memory at %llx - check configuration\n",
-                                     (long long)kvtop(sc->mem_start + i));
-
-                       /*
-                        * Disable 16 bit access to shared memory
-                        */
-                       if (isa16bit) {
-                               if (sc->chip_type == ED_CHIP_TYPE_WD790) {
-                                       ed_asic_outb(sc, ED_WD_MSR, 0x00);
-                               }
-                               ed_asic_outb(sc, ED_WD_LAAR, sc->wd_laar_proto &
-                                   ~ED_WD_LAAR_M16EN);
-                       }
-                       return (ENXIO);
-               }
-       }
-
-       /*
-        * Disable 16bit access to shared memory - we leave it
-        * disabled so that 1) machines reboot properly when the board
-        * is set 16 bit mode and there are conflicting 8bit
-        * devices/ROMS in the same 128k address space as this boards
-        * shared memory. and 2) so that other 8 bit devices with
-        * shared memory can be used in this 128k region, too.
-        */
-       if (isa16bit) {
-               if (sc->chip_type == ED_CHIP_TYPE_WD790) {
-                       ed_asic_outb(sc, ED_WD_MSR, 0x00);
-               }
-               ed_asic_outb(sc, ED_WD_LAAR, sc->wd_laar_proto &
-                   ~ED_WD_LAAR_M16EN);
-       }
-       return (0);
-}
-
-int
-ed_probe_WD80x3(device_t dev, int port_rid, int flags)
-{
-       struct ed_softc *sc = device_get_softc(dev);
-       int     error;
-       static u_short *intr_vals[] = {ed_intr_val, ed_790_intr_val};
-
-       error = ed_alloc_port(dev, port_rid, ED_WD_IO_PORTS);
-       if (error)
-               return (error);
-
-       sc->asic_offset = ED_WD_ASIC_OFFSET;
-       sc->nic_offset  = ED_WD_NIC_OFFSET;
-
-       return ed_probe_WD80x3_generic(dev, flags, intr_vals);
-}
-
-/*
- * Probe and vendor-specific initialization routine for 3Com 3c503 boards
- */
-int
-ed_probe_3Com(device_t dev, int port_rid, int flags)
-{
-       struct ed_softc *sc = device_get_softc(dev);
-       int     error;
-       int     i;
-       u_int   memsize;
-       u_char  isa16bit;
-       u_long  conf_maddr, conf_msize, irq, junk;
-
-       error = ed_alloc_port(dev, 0, ED_3COM_IO_PORTS);
-       if (error)
-               return (error);
-
-       sc->asic_offset = ED_3COM_ASIC_OFFSET;
-       sc->nic_offset  = ED_3COM_NIC_OFFSET;
-
-       /*
-        * Verify that the kernel configured I/O address matches the board
-        * configured address
-        */
-       switch (ed_asic_inb(sc, ED_3COM_BCFR)) {
-       case ED_3COM_BCFR_300:
-               if (rman_get_start(sc->port_res) != 0x300)
-                       return (ENXIO);
-               break;
-       case ED_3COM_BCFR_310:
-               if (rman_get_start(sc->port_res) != 0x310)
-                       return (ENXIO);
-               break;
-       case ED_3COM_BCFR_330:
-               if (rman_get_start(sc->port_res) != 0x330)
-                       return (ENXIO);
-               break;
-       case ED_3COM_BCFR_350:
-               if (rman_get_start(sc->port_res) != 0x350)
-                       return (ENXIO);
-               break;
-       case ED_3COM_BCFR_250:
-               if (rman_get_start(sc->port_res) != 0x250)
-                       return (ENXIO);
-               break;
-       case ED_3COM_BCFR_280:
-               if (rman_get_start(sc->port_res) != 0x280)
-                       return (ENXIO);
-               break;
-       case ED_3COM_BCFR_2A0:
-               if (rman_get_start(sc->port_res) != 0x2a0)
-                       return (ENXIO);
-               break;
-       case ED_3COM_BCFR_2E0:
-               if (rman_get_start(sc->port_res) != 0x2e0)
-                       return (ENXIO);
-               break;
-       default:
-               return (ENXIO);
-       }
-
-       error = bus_get_resource(dev, SYS_RES_MEMORY, 0,
-                                &conf_maddr, &conf_msize);
-       if (error)
-               return (error);
-
-       /*
-        * Verify that the kernel shared memory address matches the board
-        * configured address.
-        */
-       switch (ed_asic_inb(sc, ED_3COM_PCFR)) {
-       case ED_3COM_PCFR_DC000:
-               if (conf_maddr != 0xdc000)
-                       return (ENXIO);
-               break;
-       case ED_3COM_PCFR_D8000:
-               if (conf_maddr != 0xd8000)
-                       return (ENXIO);
-               break;
-       case ED_3COM_PCFR_CC000:
-               if (conf_maddr != 0xcc000)
-                       return (ENXIO);
-               break;
-       case ED_3COM_PCFR_C8000:
-               if (conf_maddr != 0xc8000)
-                       return (ENXIO);
-               break;
-       default:
-               return (ENXIO);
-       }
-
-
-       /*
-        * Reset NIC and ASIC. Enable on-board transceiver throughout reset
-        * sequence because it'll lock up if the cable isn't connected if we
-        * don't.
-        */
-       ed_asic_outb(sc, ED_3COM_CR, ED_3COM_CR_RST | ED_3COM_CR_XSEL);
-
-       /*
-        * Wait for a while, then un-reset it
-        */
-       DELAY(50);
-
-       /*
-        * The 3Com ASIC defaults to rather strange settings for the CR after
-        * a reset - it's important to set it again after the following outb
-        * (this is done when we map the PROM below).
-        */
-       ed_asic_outb(sc, ED_3COM_CR, ED_3COM_CR_XSEL);
-
-       /*
-        * Wait a bit for the NIC to recover from the reset
-        */
-       DELAY(5000);
-
-       sc->vendor = ED_VENDOR_3COM;
-       sc->type_str = "3c503";
-       sc->mem_shared = 1;
-       sc->cr_proto = ED_CR_RD2;
-
-       /*
-        * Hmmm...a 16bit 3Com board has 16k of memory, but only an 8k window
-        * to it.
-        */
-       memsize = 8192;
-
-       /*
-        * Get station address from on-board ROM
-        */
-
-       /*
-        * First, map ethernet address PROM over the top of where the NIC
-        * registers normally appear.
-        */
-       ed_asic_outb(sc, ED_3COM_CR, ED_3COM_CR_EALO | ED_3COM_CR_XSEL);
-
-       for (i = 0; i < ETHER_ADDR_LEN; ++i)
-               sc->arpcom.ac_enaddr[i] = ed_nic_inb(sc, i);
-
-       /*
-        * Unmap PROM - select NIC registers. The proper setting of the
-        * tranceiver is set in ed_init so that the attach code is given a
-        * chance to set the default based on a compile-time config option
-        */
-       ed_asic_outb(sc, ED_3COM_CR, ED_3COM_CR_XSEL);
-
-       /*
-        * Determine if this is an 8bit or 16bit board
-        */
-
-       /*
-        * select page 0 registers
-        */
-       ed_nic_outb(sc, ED_P0_CR, ED_CR_RD2 | ED_CR_STP);
-
-       /*
-        * Attempt to clear WTS bit. If it doesn't clear, then this is a 16bit
-        * board.
-        */
-       ed_nic_outb(sc, ED_P0_DCR, 0);
-
-       /*
-        * select page 2 registers
-        */
-       ed_nic_outb(sc, ED_P0_CR, ED_CR_PAGE_2 | ED_CR_RD2 | ED_CR_STP);
-
-       /*
-        * The 3c503 forces the WTS bit to a one if this is a 16bit board
-        */
-       if (ed_nic_inb(sc, ED_P2_DCR) & ED_DCR_WTS)
-               isa16bit = 1;
-       else
-               isa16bit = 0;
-
-       /*
-        * select page 0 registers
-        */
-       ed_nic_outb(sc, ED_P2_CR, ED_CR_RD2 | ED_CR_STP);
-
-       error = ed_alloc_memory(dev, 0, memsize);
-       if (error)
-               return (error);
-
-       sc->mem_start = (caddr_t) rman_get_virtual(sc->mem_res);
-       sc->mem_size = memsize;
-       sc->mem_end = sc->mem_start + memsize;
-
-       /*
-        * We have an entire 8k window to put the transmit buffers on the
-        * 16bit boards. But since the 16bit 3c503's shared memory is only
-        * fast enough to overlap the loading of one full-size packet, trying
-        * to load more than 2 buffers can actually leave the transmitter idle
-        * during the load. So 2 seems the best value. (Although a mix of
-        * variable-sized packets might change this assumption. Nonetheless,
-        * we optimize for linear transfers of same-size packets.)
-        */
-       if (isa16bit) {
-               if (flags & ED_FLAGS_NO_MULTI_BUFFERING)
-                       sc->txb_cnt = 1;
-               else
-                       sc->txb_cnt = 2;
-
-               sc->tx_page_start = ED_3COM_TX_PAGE_OFFSET_16BIT;
-               sc->rec_page_start = ED_3COM_RX_PAGE_OFFSET_16BIT;
-               sc->rec_page_stop = memsize / ED_PAGE_SIZE +
-                   ED_3COM_RX_PAGE_OFFSET_16BIT;
-               sc->mem_ring = sc->mem_start;
-       } else {
-               sc->txb_cnt = 1;
-               sc->tx_page_start = ED_3COM_TX_PAGE_OFFSET_8BIT;
-               sc->rec_page_start = ED_TXBUF_SIZE + ED_3COM_TX_PAGE_OFFSET_8BIT;
-               sc->rec_page_stop = memsize / ED_PAGE_SIZE +
-                   ED_3COM_TX_PAGE_OFFSET_8BIT;
-               sc->mem_ring = sc->mem_start + (ED_PAGE_SIZE * ED_TXBUF_SIZE);
-       }
-
-       sc->isa16bit = isa16bit;
-
-       /*
-        * Initialize GA page start/stop registers. Probably only needed if
-        * doing DMA, but what the hell.
-        */
-       ed_asic_outb(sc, ED_3COM_PSTR, sc->rec_page_start);
-       ed_asic_outb(sc, ED_3COM_PSPR, sc->rec_page_stop);
-
-       /*
-        * Set IRQ. 3c503 only allows a choice of irq 2-5.
-        */
-       error = bus_get_resource(dev, SYS_RES_IRQ, 0, &irq, &junk);
-       if (error)
-               return (error);
-
-       switch (irq) {
-       case 2:
-       case 9:
-               ed_asic_outb(sc, ED_3COM_IDCFR, ED_3COM_IDCFR_IRQ2);
-               break;
-       case 3:
-               ed_asic_outb(sc, ED_3COM_IDCFR, ED_3COM_IDCFR_IRQ3);
-               break;
-       case 4:
-               ed_asic_outb(sc, ED_3COM_IDCFR, ED_3COM_IDCFR_IRQ4);
-               break;
-       case 5:
-               ed_asic_outb(sc, ED_3COM_IDCFR, ED_3COM_IDCFR_IRQ5);
-               break;
-       default:
-               device_printf(dev, "Invalid irq configuration (%ld) must be 3-5,9 for 3c503\n",
-                             irq);
-               return (ENXIO);
-       }
-
-       /*
-        * Initialize GA configuration register. Set bank and enable shared
-        * mem.
-        */
-       ed_asic_outb(sc, ED_3COM_GACFR, ED_3COM_GACFR_RSEL |
-            ED_3COM_GACFR_MBS0);
-
-       /*
-        * Initialize "Vector Pointer" registers. These gawd-awful things are
-        * compared to 20 bits of the address on ISA, and if they match, the
-        * shared memory is disabled. We set them to 0xffff0...allegedly the
-        * reset vector.
-        */
-       ed_asic_outb(sc, ED_3COM_VPTR2, 0xff);
-       ed_asic_outb(sc, ED_3COM_VPTR1, 0xff);
-       ed_asic_outb(sc, ED_3COM_VPTR0, 0x00);
-
-       /*
-        * Zero memory and verify that it is clear
-        */
-       bzero(sc->mem_start, memsize);
-
-       for (i = 0; i < memsize; ++i)
-               if (sc->mem_start[i]) {
-                       device_printf(dev, "failed to clear shared memory "
-                           "at %llx - check configuration\n",
-                           (unsigned long long)kvtop(sc->mem_start + i));
-                       return (ENXIO);
-               }
-       return (0);
-}
-
-/*
- * Probe and vendor-specific initialization routine for SIC boards
- */
-int
-ed_probe_SIC(device_t dev, int port_rid, int flags)
-{
-       struct ed_softc *sc = device_get_softc(dev);
-       int     error;
-       int     i;
-       u_int   memsize;
-       u_long  conf_maddr, conf_msize;
-       u_char  sum;
-#ifdef ED_DEBUG
-       char ethstr[ETHER_ADDRSTRLEN + 1];
-#endif
-
-       error = ed_alloc_port(dev, 0, ED_SIC_IO_PORTS);
-       if (error)
-               return (error);
-
-       sc->asic_offset = ED_SIC_ASIC_OFFSET;
-       sc->nic_offset  = ED_SIC_NIC_OFFSET;
-
-       error = bus_get_resource(dev, SYS_RES_MEMORY, 0,
-                                &conf_maddr, &conf_msize);
-       if (error)
-               return (error);
-
-       memsize = 16384;
-       if (conf_msize > 1)
-               memsize = conf_msize;
-
-       error = ed_alloc_memory(dev, 0, memsize);
-       if (error)
-               return (error);
-
-       sc->mem_start = (caddr_t) rman_get_virtual(sc->mem_res);
-       sc->mem_size  = memsize;
-
-       /* Reset card to force it into a known state. */
-       ed_asic_outb(sc, 0, 0x00);
-       DELAY(100);
-
-       /*
-        * Here we check the card ROM, if the checksum passes, and the
-        * type code and ethernet address check out, then we know we have
-        * an SIC card.
-        */
-       ed_asic_outb(sc, 0, 0x81);
-       DELAY(100);
-
-       sum = sc->mem_start[6];
-       for (i = 0; i < ETHER_ADDR_LEN; i++) {
-               sum ^= (sc->arpcom.ac_enaddr[i] = sc->mem_start[i]);
-       }
-#ifdef ED_DEBUG
-       device_printf(dev, "ed_probe_sic: got address %s\n",
-           kether_ntoa(sc->arpcom.ac_enaddr, ethstr));
-#endif
-       if (sum != 0) {
-               return (ENXIO);
-       }
-       if ((sc->arpcom.ac_enaddr[0] | sc->arpcom.ac_enaddr[1] |
-            sc->arpcom.ac_enaddr[2]) == 0) {
-               return (ENXIO);
-       }
-
-       sc->vendor   = ED_VENDOR_SIC;
-       sc->type_str = "SIC";
-       sc->isa16bit = 0;
-       sc->cr_proto = 0;
-
-       /*
-        * SIC RAM page 0x0000-0x3fff(or 0x7fff)
-        */
-       ed_asic_outb(sc, 0, 0x80);
-       DELAY(100);
-
-       /*
-        * Now zero memory and verify that it is clear
-        */
-       bzero(sc->mem_start, sc->mem_size);
-
-       for (i = 0; i < sc->mem_size; i++) {
-               if (sc->mem_start[i]) {
-                       device_printf(dev, "failed to clear shared memory "
-                               "at %llx - check configuration\n",
-                               (long long)kvtop(sc->mem_start + i));
-
-                       return (ENXIO);
-               }
-       }
-
-       sc->mem_shared = 1;
-       sc->mem_end = sc->mem_start + sc->mem_size;
-
-       /*
-        * allocate one xmit buffer if < 16k, two buffers otherwise
-        */
-       if ((sc->mem_size < 16384) || (flags & ED_FLAGS_NO_MULTI_BUFFERING)) {
-               sc->txb_cnt = 1;
-       } else {
-               sc->txb_cnt = 2;
-       }
-       sc->tx_page_start = 0;
-
-       sc->rec_page_start = sc->tx_page_start + ED_TXBUF_SIZE * sc->txb_cnt;
-       sc->rec_page_stop = sc->tx_page_start + sc->mem_size / ED_PAGE_SIZE;
-
-       sc->mem_ring = sc->mem_start + sc->txb_cnt * ED_PAGE_SIZE * ED_TXBUF_SIZE;
-
-       return (0);
-}
-
-/*
- * Probe and vendor-specific initialization routine for NE1000/2000 boards
- */
-int
-ed_probe_Novell_generic(device_t dev, int flags)
-{
-       struct ed_softc *sc = device_get_softc(dev);
-       u_int   memsize, n;
-       u_char  romdata[16], tmp;
-       static char test_pattern[32] = "THIS is A memory TEST pattern";
-       char    test_buffer[32];
-
-       /* XXX - do Novell-specific probe here */
-
-       /* Reset the board */
-       if (ED_FLAGS_GETTYPE(flags) == ED_FLAGS_GWETHER) {
-               ed_asic_outb(sc, ED_NOVELL_RESET, 0);
-               DELAY(200);
-       }
-       tmp = ed_asic_inb(sc, ED_NOVELL_RESET);
-
-       /*
-        * I don't know if this is necessary; probably cruft leftover from
-        * Clarkson packet driver code. Doesn't do a thing on the boards I've
-        * tested. -DG [note that an outb(0x84, 0) seems to work here, and is
-        * non-invasive...but some boards don't seem to reset and I don't have
-        * complete documentation on what the 'right' thing to do is...so we
-        * do the invasive thing for now. Yuck.]
-        */
-       ed_asic_outb(sc, ED_NOVELL_RESET, tmp);
-       DELAY(5000);
-
-       /*
-        * This is needed because some NE clones apparently don't reset the
-        * NIC properly (or the NIC chip doesn't reset fully on power-up) XXX
-        * - this makes the probe invasive! ...Done against my better
-        * judgement. -DLG
-        */
-       ed_nic_outb(sc, ED_P0_CR, ED_CR_RD2 | ED_CR_STP);
-
-       DELAY(5000);
-
-       /* Make sure that we really have an 8390 based board */
-       if (!ed_probe_generic8390(sc))
-               return (ENXIO);
-
-       sc->vendor = ED_VENDOR_NOVELL;
-       sc->mem_shared = 0;
-       sc->cr_proto = ED_CR_RD2;
-
-       /*
-        * Test the ability to read and write to the NIC memory. This has the
-        * side affect of determining if this is an NE1000 or an NE2000.
-        */
-
-       /*
-        * This prevents packets from being stored in the NIC memory when the
-        * readmem routine turns on the start bit in the CR.
-        */
-       ed_nic_outb(sc, ED_P0_RCR, ED_RCR_MON);
-
-       /* Temporarily initialize DCR for byte operations */
-       ed_nic_outb(sc, ED_P0_DCR, ED_DCR_FT1 | ED_DCR_LS);
-
-       ed_nic_outb(sc, ED_P0_PSTART, 8192 / ED_PAGE_SIZE);
-       ed_nic_outb(sc, ED_P0_PSTOP, 16384 / ED_PAGE_SIZE);
-
-       sc->isa16bit = 0;
-
-       /*
-        * Write a test pattern in byte mode. If this fails, then there
-        * probably isn't any memory at 8k - which likely means that the board
-        * is an NE2000.
-        */
-       ed_pio_writemem(sc, test_pattern, 8192, sizeof(test_pattern));
-       ed_pio_readmem(sc, 8192, test_buffer, sizeof(test_pattern));
-
-       if (bcmp(test_pattern, test_buffer, sizeof(test_pattern)) == 0) {
-               sc->type = ED_TYPE_NE1000;
-               sc->type_str = "NE1000";
-       } else {
-
-               /* neither an NE1000 nor a Linksys - try NE2000 */
-               ed_nic_outb(sc, ED_P0_DCR, ED_DCR_WTS | ED_DCR_FT1 | ED_DCR_LS);
-               ed_nic_outb(sc, ED_P0_PSTART, 16384 / ED_PAGE_SIZE);
-               ed_nic_outb(sc, ED_P0_PSTOP, 32768 / ED_PAGE_SIZE);
-
-               sc->isa16bit = 1;
-
-               /*
-                * Write a test pattern in word mode. If this also fails, then
-                * we don't know what this board is.
-                */
-               ed_pio_writemem(sc, test_pattern, 16384, sizeof(test_pattern));
-               ed_pio_readmem(sc, 16384, test_buffer, sizeof(test_pattern));
-               if (bcmp(test_pattern, test_buffer, sizeof(test_pattern)) == 0) {
-                       sc->type = ED_TYPE_NE2000;
-                       sc->type_str = "NE2000";
-               } else {
-                       return (ENXIO);
-               }
-       }
-
-
-       /* 8k of memory plus an additional 8k if 16bit */
-       memsize = 8192 + sc->isa16bit * 8192;
-
-#if 0  /* probably not useful - NE boards only come two ways */
-       /* allow kernel config file overrides */
-       if (isa_dev->id_msize)
-               memsize = isa_dev->id_msize;
-#endif
-
-       sc->mem_size = memsize;
-
-       /* NIC memory doesn't start at zero on an NE board */
-       /* The start address is tied to the bus width */
-       sc->mem_start = (char *) 8192 + sc->isa16bit * 8192;
-       sc->mem_end = sc->mem_start + memsize;
-       sc->tx_page_start = memsize / ED_PAGE_SIZE;
-
-       if (ED_FLAGS_GETTYPE(flags) == ED_FLAGS_GWETHER) {
-               int     x, i, mstart = 0, msize = 0;
-               char    pbuf0[ED_PAGE_SIZE], pbuf[ED_PAGE_SIZE], tbuf[ED_PAGE_SIZE];
-
-               for (i = 0; i < ED_PAGE_SIZE; i++)
-                       pbuf0[i] = 0;
-
-               /* Clear all the memory. */
-               for (x = 1; x < 256; x++)
-                       ed_pio_writemem(sc, pbuf0, x * 256, ED_PAGE_SIZE);
-
-               /* Search for the start of RAM. */
-               for (x = 1; x < 256; x++) {
-                       ed_pio_readmem(sc, x * 256, tbuf, ED_PAGE_SIZE);
-                       if (bcmp(pbuf0, tbuf, ED_PAGE_SIZE) == 0) {
-                               for (i = 0; i < ED_PAGE_SIZE; i++)
-                                       pbuf[i] = 255 - x;
-                               ed_pio_writemem(sc, pbuf, x * 256, ED_PAGE_SIZE);
-                               ed_pio_readmem(sc, x * 256, tbuf, ED_PAGE_SIZE);
-                               if (bcmp(pbuf, tbuf, ED_PAGE_SIZE) == 0) {
-                                       mstart = x * ED_PAGE_SIZE;
-                                       msize = ED_PAGE_SIZE;
-                                       break;
-                               }
-                       }
-               }
-
-               if (mstart == 0) {
-                       device_printf(dev, "Cannot find start of RAM.\n");
-                       return (ENXIO);
-               }
-               /* Search for the start of RAM. */
-               for (x = (mstart / ED_PAGE_SIZE) + 1; x < 256; x++) {
-                       ed_pio_readmem(sc, x * 256, tbuf, ED_PAGE_SIZE);
-                       if (bcmp(pbuf0, tbuf, ED_PAGE_SIZE) == 0) {
-                               for (i = 0; i < ED_PAGE_SIZE; i++)
-                                       pbuf[i] = 255 - x;
-                               ed_pio_writemem(sc, pbuf, x * 256, ED_PAGE_SIZE);
-                               ed_pio_readmem(sc, x * 256, tbuf, ED_PAGE_SIZE);
-                               if (bcmp(pbuf, tbuf, ED_PAGE_SIZE) == 0)
-                                       msize += ED_PAGE_SIZE;
-                               else {
-                                       break;
-                               }
-                       } else {
-                               break;
-                       }
-               }
-
-               if (msize == 0) {
-                       device_printf(dev, "Cannot find any RAM, start : %d, x = %d.\n", mstart, x);
-                       return (ENXIO);
-               }
-               device_printf(dev, "RAM start at %d, size : %d.\n", mstart, msize);
-
-               sc->mem_size = msize;
-               sc->mem_start = (caddr_t) mstart;
-               sc->mem_end = (caddr_t) (msize + mstart);
-               sc->tx_page_start = mstart / ED_PAGE_SIZE;
-       }
-
-       /*
-        * Use one xmit buffer if < 16k, two buffers otherwise (if not told
-        * otherwise).
-        */
-       if ((memsize < 16384) || (flags & ED_FLAGS_NO_MULTI_BUFFERING))
-               sc->txb_cnt = 1;
-       else
-               sc->txb_cnt = 2;
-
-       sc->rec_page_start = sc->tx_page_start + sc->txb_cnt * ED_TXBUF_SIZE;
-       sc->rec_page_stop = sc->tx_page_start + memsize / ED_PAGE_SIZE;
-
-       sc->mem_ring = sc->mem_start + sc->txb_cnt * ED_PAGE_SIZE * ED_TXBUF_SIZE;
-
-       ed_pio_readmem(sc, 0, romdata, 16);
-       for (n = 0; n < ETHER_ADDR_LEN; n++)
-               sc->arpcom.ac_enaddr[n] = romdata[n * (sc->isa16bit + 1)];
-
-       if ((ED_FLAGS_GETTYPE(flags) == ED_FLAGS_GWETHER) &&
-           (sc->arpcom.ac_enaddr[2] == 0x86)) {
-               sc->type_str = "Gateway AT";
-       }
-
-       /* clear any pending interrupts that might have occurred above */
-       ed_nic_outb(sc, ED_P0_ISR, 0xff);
-
-       return (0);
-}
-
-int
-ed_probe_Novell(device_t dev, int port_rid, int flags)
-{
-       struct ed_softc *sc = device_get_softc(dev);
-       int     error;
-
-       error = ed_alloc_port(dev, port_rid, ED_NOVELL_IO_PORTS);
-       if (error)
-               return (error);
-
-       sc->asic_offset = ED_NOVELL_ASIC_OFFSET;
-       sc->nic_offset  = ED_NOVELL_NIC_OFFSET;
-
-       return ed_probe_Novell_generic(dev, flags);
-}
-
-#define        ED_HPP_TEST_SIZE        16
-
-/*
- * Probe and vendor specific initialization for the HP PC Lan+ Cards.
- * (HP Part nos: 27247B and 27252A).
- *
- * The card has an asic wrapper around a DS8390 core.  The asic handles 
- * host accesses and offers both standard register IO and memory mapped 
- * IO.  Memory mapped I/O allows better performance at the expense of greater
- * chance of an incompatibility with existing ISA cards.
- *
- * The card has a few caveats: it isn't tolerant of byte wide accesses, only
- * short (16 bit) or word (32 bit) accesses are allowed.  Some card revisions
- * don't allow 32 bit accesses; these are indicated by a bit in the software
- * ID register (see if_edreg.h).
- * 
- * Other caveats are: we should read the MAC address only when the card
- * is inactive.
- *
- * For more information; please consult the CRYNWR packet driver.
- *
- * The AUI port is turned on using the "link2" option on the ifconfig 
- * command line.
- */
-int
-ed_probe_HP_pclanp(device_t dev, int port_rid, int flags)
-{
-       struct ed_softc *sc = device_get_softc(dev);
-       int error;
-       int n;                          /* temp var */
-       int memsize;                    /* mem on board */
-       u_char checksum;                /* checksum of board address */
-       u_char irq;                     /* board configured IRQ */
-       char test_pattern[ED_HPP_TEST_SIZE];    /* read/write areas for */
-       char test_buffer[ED_HPP_TEST_SIZE];     /* probing card */
-       u_long conf_maddr, conf_msize, conf_irq, junk;
-
-       error = ed_alloc_port(dev, 0, ED_HPP_IO_PORTS);
-       if (error)
-               return (error);
-
-       /* Fill in basic information */
-       sc->asic_offset = ED_HPP_ASIC_OFFSET;
-       sc->nic_offset  = ED_HPP_NIC_OFFSET;
-
-       sc->chip_type = ED_CHIP_TYPE_DP8390;
-       sc->isa16bit = 0;       /* the 8390 core needs to be in byte mode */
-
-       /* 
-        * Look for the HP PCLAN+ signature: "0x50,0x48,0x00,0x53" 
-        */
-       
-       if ((ed_asic_inb(sc, ED_HPP_ID) != 0x50) || 
-           (ed_asic_inb(sc, ED_HPP_ID + 1) != 0x48) ||
-           ((ed_asic_inb(sc, ED_HPP_ID + 2) & 0xF0) != 0) ||
-           (ed_asic_inb(sc, ED_HPP_ID + 3) != 0x53))
-               return ENXIO;
-
-       /* 
-        * Read the MAC address and verify checksum on the address.
-        */
-
-       ed_asic_outw(sc, ED_HPP_PAGING, ED_HPP_PAGE_MAC);
-       for (n  = 0, checksum = 0; n < ETHER_ADDR_LEN; n++)
-               checksum += (sc->arpcom.ac_enaddr[n] = 
-                       ed_asic_inb(sc, ED_HPP_MAC_ADDR + n));
-       
-       checksum += ed_asic_inb(sc, ED_HPP_MAC_ADDR + ETHER_ADDR_LEN);
-
-       if (checksum != 0xFF)
-               return ENXIO;
-
-       /*
-        * Verify that the software model number is 0.
-        */
-       
-       ed_asic_outw(sc, ED_HPP_PAGING, ED_HPP_PAGE_ID);
-       if (((sc->hpp_id = ed_asic_inw(sc, ED_HPP_PAGE_4)) & 
-               ED_HPP_ID_SOFT_MODEL_MASK) != 0x0000)
-               return ENXIO;
-
-       /*
-        * Read in and save the current options configured on card.
-        */
-
-       sc->hpp_options = ed_asic_inw(sc, ED_HPP_OPTION);
-
-       sc->hpp_options |= (ED_HPP_OPTION_NIC_RESET | 
-                               ED_HPP_OPTION_CHIP_RESET |
-                               ED_HPP_OPTION_ENABLE_IRQ);
-
-       /* 
-        * Reset the chip.  This requires writing to the option register
-        * so take care to preserve the other bits.
-        */
-
-       ed_asic_outw(sc, ED_HPP_OPTION, 
-               (sc->hpp_options & ~(ED_HPP_OPTION_NIC_RESET | 
-                       ED_HPP_OPTION_CHIP_RESET)));
-
-       DELAY(5000);    /* wait for chip reset to complete */
-
-       ed_asic_outw(sc, ED_HPP_OPTION,
-               (sc->hpp_options | (ED_HPP_OPTION_NIC_RESET |
-                       ED_HPP_OPTION_CHIP_RESET |
-                       ED_HPP_OPTION_ENABLE_IRQ)));
-
-       DELAY(5000);
-
-       if (!(ed_nic_inb(sc, ED_P0_ISR) & ED_ISR_RST))
-               return ENXIO;   /* reset did not complete */
-
-       /*
-        * Read out configuration information.
-        */
-
-       ed_asic_outw(sc, ED_HPP_PAGING, ED_HPP_PAGE_HW);
-
-       irq = ed_asic_inb(sc, ED_HPP_HW_IRQ);
-
-       /*
-        * Check for impossible IRQ.
-        */
-
-       if (irq >= NELEM(ed_hpp_intr_val))
-               return ENXIO;
-
-       /* 
-        * If the kernel IRQ was specified with a '?' use the cards idea
-        * of the IRQ.  If the kernel IRQ was explicitly specified, it
-        * should match that of the hardware.
-        */
-       error = bus_get_resource(dev, SYS_RES_IRQ, 0,
-                                &conf_irq, &junk);
-       if (error) {
-               int intr_val = ed_hpp_intr_val[irq];
-
-               bus_set_resource(dev, SYS_RES_IRQ, 0, intr_val, 1,
-                   machintr_legacy_intr_cpuid(intr_val));
-       } else {
-               if (conf_irq != ed_hpp_intr_val[irq])
-                       return (ENXIO);
-       }
-
-       /*
-        * Fill in softconfig info.
-        */
-
-       sc->vendor = ED_VENDOR_HP;
-       sc->type = ED_TYPE_HP_PCLANPLUS;
-       sc->type_str = "HP-PCLAN+";
-
-       sc->mem_shared = 0;     /* we DON'T have dual ported RAM */
-       sc->mem_start = 0;      /* we use offsets inside the card RAM */
-
-       sc->hpp_mem_start = NULL;/* no memory mapped I/O by default */
-
-       /*
-        * The board has 32KB of memory.  Is there a way to determine
-        * this programmatically?
-        */
-       
-       memsize = 32768;
-
-       /*
-        * Check if memory mapping of the I/O registers possible.
-        */
-
-       if (sc->hpp_options & ED_HPP_OPTION_MEM_ENABLE)
-       {
-               u_long mem_addr;
-
-               /*
-                * determine the memory address from the board.
-                */
-               
-               ed_asic_outw(sc, ED_HPP_PAGING, ED_HPP_PAGE_HW);
-               mem_addr = (ed_asic_inw(sc, ED_HPP_HW_MEM_MAP) << 8);
-
-               /*
-                * Check that the kernel specified start of memory and
-                * hardware's idea of it match.
-                */
-               error = bus_get_resource(dev, SYS_RES_MEMORY, 0,
-                                        &conf_maddr, &conf_msize);
-               if (error)
-                       return (error);
-               
-               if (mem_addr != conf_maddr)
-                       return ENXIO;
-
-               error = ed_alloc_memory(dev, 0, memsize);
-               if (error)
-                       return (error);
-
-               sc->hpp_mem_start = rman_get_virtual(sc->mem_res);
-       }
-
-       /*
-        * Fill in the rest of the soft config structure.
-        */
-
-       /*
-        * The transmit page index.
-        */
-
-       sc->tx_page_start = ED_HPP_TX_PAGE_OFFSET;
-
-       if (device_get_flags(dev) & ED_FLAGS_NO_MULTI_BUFFERING)
-               sc->txb_cnt = 1;
-       else
-               sc->txb_cnt = 2;
-
-       /*
-        * Memory description
-        */
-
-       sc->mem_size = memsize;
-       sc->mem_ring = sc->mem_start + 
-               (sc->txb_cnt * ED_PAGE_SIZE * ED_TXBUF_SIZE);
-       sc->mem_end = sc->mem_start + sc->mem_size;
-
-       /*
-        * Receive area starts after the transmit area and 
-        * continues till the end of memory.
-        */
-
-       sc->rec_page_start = sc->tx_page_start + 
-                               (sc->txb_cnt * ED_TXBUF_SIZE);
-       sc->rec_page_stop = (sc->mem_size / ED_PAGE_SIZE);
-
-
-       sc->cr_proto = 0;       /* value works */
-
-       /*
-        * Set the wrap registers for string I/O reads.
-        */
-
-       ed_asic_outw(sc, ED_HPP_PAGING, ED_HPP_PAGE_HW);
-       ed_asic_outw(sc, ED_HPP_HW_WRAP,
-               ((sc->rec_page_start / ED_PAGE_SIZE) |
-                (((sc->rec_page_stop / ED_PAGE_SIZE) - 1) << 8)));
-
-       /*
-        * Reset the register page to normal operation.
-        */
-
-       ed_asic_outw(sc, ED_HPP_PAGING, ED_HPP_PAGE_PERF);
-
-       /*
-        * Verify that we can read/write from adapter memory.
-        * Create test pattern.
-        */
-
-       for (n = 0; n < ED_HPP_TEST_SIZE; n++)
-       {
-               test_pattern[n] = (n*n) ^ ~n;
-       }
-
-#undef ED_HPP_TEST_SIZE
-
-       /*
-        * Check that the memory is accessible thru the I/O ports.
-        * Write out the contents of "test_pattern", read back
-        * into "test_buffer" and compare the two for any
-        * mismatch.
-        */
-
-       for (n = 0; n < (32768 / ED_PAGE_SIZE); n ++) {
-
-               ed_hpp_writemem(sc, test_pattern, (n * ED_PAGE_SIZE), 
-                               sizeof(test_pattern));
-               ed_hpp_readmem(sc, (n * ED_PAGE_SIZE), 
-                       test_buffer, sizeof(test_pattern));
-
-               if (bcmp(test_pattern, test_buffer, 
-                       sizeof(test_pattern)))
-                       return ENXIO;
-       }
-
-       return (0);
-
-}
-
-/*
- * HP PC Lan+ : Set the physical link to use AUI or TP/TL.
- */
-
-static void
-ed_hpp_set_physical_link(struct ed_softc *sc)
-{
-       struct ifnet *ifp = &sc->arpcom.ac_if;
-       int lan_page;
-
-       ed_asic_outw(sc, ED_HPP_PAGING, ED_HPP_PAGE_LAN);
-       lan_page = ed_asic_inw(sc, ED_HPP_PAGE_0);
-
-       if (ifp->if_flags & IFF_ALTPHYS) {
-
-               /*
-                * Use the AUI port.
-                */
-
-               lan_page |= ED_HPP_LAN_AUI;
-
-               ed_asic_outw(sc, ED_HPP_PAGING, ED_HPP_PAGE_LAN);
-               ed_asic_outw(sc, ED_HPP_PAGE_0, lan_page);
-
-
-       } else {
-
-               /*
-                * Use the ThinLan interface
-                */
-
-               lan_page &= ~ED_HPP_LAN_AUI;
-
-               ed_asic_outw(sc, ED_HPP_PAGING, ED_HPP_PAGE_LAN);
-               ed_asic_outw(sc, ED_HPP_PAGE_0, lan_page);
-
-       }
-
-       /*
-        * Wait for the lan card to re-initialize itself
-        */
-
-       DELAY(150000);  /* wait 150 ms */
-
-       /*
-        * Restore normal pages.
-        */
-
-       ed_asic_outw(sc, ED_HPP_PAGING, ED_HPP_PAGE_PERF);
-
-}
-
-/*
- * Allocate a port resource with the given resource id.
- */
-int
-ed_alloc_port(device_t dev, int rid, int size)
-{
-       struct ed_softc *sc = device_get_softc(dev);
-       struct resource *res;
-
-       res = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid,
-                                0ul, ~0ul, size, RF_ACTIVE);
-       if (res) {
-               sc->port_rid = rid;
-               sc->port_res = res;
-               sc->port_used = size;
-               return (0);
-       } else {
-               return (ENOENT);
-       }
-}
-
-/*
- * Allocate a memory resource with the given resource id.
- */
-int
-ed_alloc_memory(device_t dev, int rid, int size)
-{
-       struct ed_softc *sc = device_get_softc(dev);
-       struct resource *res;
-
-       res = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid,
-                                0ul, ~0ul, size, RF_ACTIVE);
-       if (res) {
-               sc->mem_rid = rid;
-               sc->mem_res = res;
-               sc->mem_used = size;
-               return (0);
-       } else {
-               return (ENOENT);
-       }
-}
-
-/*
- * Allocate an irq resource with the given resource id.
- */
-int
-ed_alloc_irq(device_t dev, int rid, int flags)
-{
-       struct ed_softc *sc = device_get_softc(dev);
-       struct resource *res;
-
-       res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
-           (RF_ACTIVE | flags));
-       if (res) {
-               sc->irq_rid = rid;
-               sc->irq_res = res;
-               return (0);
-       } else {
-               return (ENOENT);
-       }
-}
-
-/*
- * Release all resources
- */
-void
-ed_release_resources(device_t dev)
-{
-       struct ed_softc *sc = device_get_softc(dev);
-
-       if (sc->port_res) {
-               bus_deactivate_resource(dev, SYS_RES_IOPORT,
-                                       sc->port_rid, sc->port_res);
-               bus_release_resource(dev, SYS_RES_IOPORT,
-                                    sc->port_rid, sc->port_res);
-               sc->port_res = 0;
-       }
-       if (sc->mem_res) {
-               bus_deactivate_resource(dev, SYS_RES_MEMORY,
-                                       sc->mem_rid, sc->mem_res);
-               bus_release_resource(dev, SYS_RES_MEMORY,
-                                    sc->mem_rid, sc->mem_res);
-               sc->mem_res = 0;
-       }
-       if (sc->irq_res) {
-               bus_deactivate_resource(dev, SYS_RES_IRQ,
-                                       sc->irq_rid, sc->irq_res);
-               bus_release_resource(dev, SYS_RES_IRQ,
-                                    sc->irq_rid, sc->irq_res);
-               sc->irq_res = 0;
-       }
-}
-
-/*
- * Install interface into kernel networking data structures
- */
-int
-ed_attach(device_t dev)
-{
-       struct ed_softc *sc = device_get_softc(dev);
-       struct ifnet *ifp = &sc->arpcom.ac_if;
-
-       callout_init(&sc->ed_timer);
-       /*
-        * Set interface to stopped condition (reset)
-        */
-       ed_stop(sc);
-
-       /*
-        * Initialize ifnet structure
-        */
-       ifp->if_softc = sc;
-       if_initname(ifp, device_get_name(dev), device_get_unit(dev));
-       ifp->if_mtu = ETHERMTU;
-       ifp->if_start = ed_start;
-       ifp->if_ioctl = ed_ioctl;
-       ifp->if_watchdog = ed_watchdog;
-       ifp->if_init = ed_init;
-       ifq_set_maxlen(&ifp->if_snd, IFQ_MAXLEN);
-       ifq_set_ready(&ifp->if_snd);
-       ifp->if_linkmib = &sc->mibdata;
-       ifp->if_linkmiblen = sizeof sc->mibdata;
-       ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
-       /*
-        * XXX - should do a better job.
-        */
-       if (sc->chip_type == ED_CHIP_TYPE_WD790)
-               sc->mibdata.dot3StatsEtherChipSet =
-                       DOT3CHIPSET(dot3VendorWesternDigital,
-                                   dot3ChipSetWesternDigital83C790);
-       else
-               sc->mibdata.dot3StatsEtherChipSet =
-                       DOT3CHIPSET(dot3VendorNational, 
-                                   dot3ChipSetNational8390);
-       sc->mibdata.dot3Compliance = DOT3COMPLIANCE_COLLS;
-
-       /*
-        * Set default state for ALTPHYS flag (used to disable the 
-        * tranceiver for AUI operation), based on compile-time 
-        * config option.
-        */
-       if (device_get_flags(dev) & ED_FLAGS_DISABLE_TRANCEIVER)
-               ifp->if_flags |= IFF_ALTPHYS;
-
-       /*
-        * Attach the interface
-        */
-       ether_ifattach(ifp, sc->arpcom.ac_enaddr, NULL);
-
-       /* device attach does transition from UNCONFIGURED to IDLE state */
-
-       if (sc->type_str && (*sc->type_str != 0))
-               kprintf("type %s ", sc->type_str);
-       else
-               kprintf("type unknown (0x%x) ", sc->type);
-
-       if (sc->vendor == ED_VENDOR_HP)
-               kprintf("(%s %s IO)", (sc->hpp_id & ED_HPP_ID_16_BIT_ACCESS) ?
-                       "16-bit" : "32-bit",
-                       sc->hpp_mem_start ? "memory mapped" : "regular");
-       else
-               kprintf("%s ", sc->isa16bit ? "(16 bit)" : "(8 bit)");
-
-       kprintf("%s\n", (((sc->vendor == ED_VENDOR_3COM) ||
-                        (sc->vendor == ED_VENDOR_HP)) &&
-               (ifp->if_flags & IFF_ALTPHYS)) ? " transceiver disabled" : "");
-
-       return (0);
-}
-
-/*
- * Reset interface.
- */
-static void
-ed_reset(struct ifnet *ifp)
-{
-       struct ed_softc *sc = ifp->if_softc;
-
-       crit_enter();
-
-       if (sc->gone) {
-               crit_exit();
-               return;
-       }
-
-       /*
-        * Stop interface and re-initialize.
-        */
-       ed_stop(sc);
-       ed_init(sc);
-
-       crit_exit();
-}
-
-/*
- * Take interface offline.
- */
-void
-ed_stop(struct ed_softc *sc)
-{
-       int     n = 5000;
-
-#ifndef ED_NO_MIIBUS
-       callout_stop(&sc->ed_timer);
-#endif
-       if (sc->gone)
-               return;
-       /*
-        * Stop everything on the interface, and select page 0 registers.
-        */
-       ed_nic_outb(sc, ED_P0_CR, sc->cr_proto | ED_CR_STP);
-
-       /*
-        * Wait for interface to enter stopped state, but limit # of checks to
-        * 'n' (about 5ms). It shouldn't even take 5us on modern DS8390's, but
-        * just in case it's an old one.
-        */
-       if (sc->chip_type != ED_CHIP_TYPE_AX88190)
-               while (((ed_nic_inb(sc, ED_P0_ISR) & ED_ISR_RST) == 0) && --n);
-}
-
-/*
- * Device timeout/watchdog routine. Entered if the device neglects to
- *     generate an interrupt after a transmit has been started on it.
- */
-static void
-ed_watchdog(struct ifnet *ifp)
-{
-       struct ed_softc *sc = ifp->if_softc;
-
-       if (sc->gone)
-               return;
-       log(LOG_ERR, "%s: device timeout\n", ifp->if_xname);
-       IFNET_STAT_INC(ifp, oerrors, 1);
-
-       ed_reset(ifp);
-}
-
-#ifndef ED_NO_MIIBUS
-static void
-ed_tick(void *arg)
-{
-       struct ed_softc *sc = arg;
-       struct mii_data *mii;
-       struct ifnet *ifp;
-
-       ifp = &sc->arpcom.ac_if;
-       lwkt_serialize_enter(ifp->if_serializer);
-
-       if (sc->gone) {
-               lwkt_serialize_exit(ifp->if_serializer);
-               return;
-       }
-
-       if (sc->miibus != NULL) {
-               mii = device_get_softc(sc->miibus);
-               mii_tick(mii);
-       }
-
-       callout_reset(&sc->ed_timer, hz, ed_tick, sc);
-       lwkt_serialize_exit(ifp->if_serializer);
-}
-#endif
-
-/*
- * Initialize device.
- */
-static void
-ed_init(void *xsc)
-{
-       struct ed_softc *sc = xsc;
-       struct ifnet *ifp = &sc->arpcom.ac_if;
-       int i;
-
-       crit_enter();
-
-       if (sc->gone) {
-               crit_exit();
-               return;
-       }
-
-       /*
-        * Initialize the NIC in the exact order outlined in the NS manual.
-        * This init procedure is "mandatory"...don't change what or when
-        * things happen.
-        */
-
-       /* reset transmitter flags */
-       sc->xmit_busy = 0;
-       ifp->if_timer = 0;
-
-       sc->txb_inuse = 0;
-       sc->txb_new = 0;
-       sc->txb_next_tx = 0;
-
-       /* This variable is used below - don't move this assignment */
-       sc->next_packet = sc->rec_page_start + 1;
-
-       /*
-        * Set interface for page 0, Remote DMA complete, Stopped
-        */
-       ed_nic_outb(sc, ED_P0_CR, sc->cr_proto | ED_CR_STP);
-
-       if (sc->isa16bit) {
-
-               /*
-                * Set FIFO threshold to 8, No auto-init Remote DMA, byte
-                * order=80x86, word-wide DMA xfers,
-                */
-               ed_nic_outb(sc, ED_P0_DCR, ED_DCR_FT1 | ED_DCR_WTS | ED_DCR_LS);
-       } else {
-
-               /*
-                * Same as above, but byte-wide DMA xfers
-                */
-               ed_nic_outb(sc, ED_P0_DCR, ED_DCR_FT1 | ED_DCR_LS);
-       }
-
-       /*
-        * Clear Remote Byte Count Registers
-        */
-       ed_nic_outb(sc, ED_P0_RBCR0, 0);
-       ed_nic_outb(sc, ED_P0_RBCR1, 0);
-
-       /*
-        * For the moment, don't store incoming packets in memory.
-        */
-       ed_nic_outb(sc, ED_P0_RCR, ED_RCR_MON);
-
-       /*
-        * Place NIC in internal loopback mode
-        */
-       ed_nic_outb(sc, ED_P0_TCR, ED_TCR_LB0);
-
-       /*
-        * Initialize transmit/receive (ring-buffer) Page Start
-        */
-       ed_nic_outb(sc, ED_P0_TPSR, sc->tx_page_start);
-       ed_nic_outb(sc, ED_P0_PSTART, sc->rec_page_start);
-       /* Set lower bits of byte addressable framing to 0 */
-       if (sc->chip_type == ED_CHIP_TYPE_WD790)
-               ed_nic_outb(sc, 0x09, 0);
-
-       /*
-        * Initialize Receiver (ring-buffer) Page Stop and Boundry
-        */
-       ed_nic_outb(sc, ED_P0_PSTOP, sc->rec_page_stop);
-       ed_nic_outb(sc, ED_P0_BNRY, sc->rec_page_start);
-
-       /*
-        * Clear all interrupts. A '1' in each bit position clears the
-        * corresponding flag.
-        */
-       ed_nic_outb(sc, ED_P0_ISR, 0xff);
-
-       /*
-        * Enable the following interrupts: receive/transmit complete,
-        * receive/transmit error, and Receiver OverWrite.
-        *
-        * Counter overflow and Remote DMA complete are *not* enabled.
-        */
-       ed_nic_outb(sc, ED_P0_IMR,
-       ED_IMR_PRXE | ED_IMR_PTXE | ED_IMR_RXEE | ED_IMR_TXEE | ED_IMR_OVWE);
-
-       /*
-        * Program Command Register for page 1
-        */
-       ed_nic_outb(sc, ED_P0_CR, sc->cr_proto | ED_CR_PAGE_1 | ED_CR_STP);
-
-       /*
-        * Copy out our station address
-        */
-       for (i = 0; i < ETHER_ADDR_LEN; ++i)
-               ed_nic_outb(sc, ED_P1_PAR(i), sc->arpcom.ac_enaddr[i]);
-
-       /*
-        * Set Current Page pointer to next_packet (initialized above)
-        */
-       ed_nic_outb(sc, ED_P1_CURR, sc->next_packet);
-
-       /*
-        * Program Receiver Configuration Register and multicast filter. CR is
-        * set to page 0 on return.
-        */
-       ed_setrcr(sc);
-
-       /*
-        * Take interface out of loopback
-        */
-       ed_nic_outb(sc, ED_P0_TCR, 0);
-
-       /*
-        * If this is a 3Com board, the tranceiver must be software enabled
-        * (there is no settable hardware default).
-        */
-       if (sc->vendor == ED_VENDOR_3COM) {
-               if (ifp->if_flags & IFF_ALTPHYS) {
-                       ed_asic_outb(sc, ED_3COM_CR, 0);
-               } else {
-                       ed_asic_outb(sc, ED_3COM_CR, ED_3COM_CR_XSEL);
-               }
-       }
-
-#ifndef ED_NO_MIIBUS
-       if (sc->miibus != NULL) {
-               struct mii_data *mii;
-               mii = device_get_softc(sc->miibus);
-               mii_mediachg(mii);
-       }
-#endif
-       /*
-        * Set 'running' flag, and clear output active flag.
-        */
-       ifp->if_flags |= IFF_RUNNING;
-       ifq_clr_oactive(&ifp->if_snd);
-
-       /*
-        * ...and attempt to start output
-        */
-       if_devstart(ifp);
-
-#ifndef ED_NO_MIIBUS
-       callout_reset(&sc->ed_timer, hz, ed_tick, sc);
-#endif
-
-       crit_exit();
-}
-
-/*
- * This routine actually starts the transmission on the interface
- */
-static __inline void
-ed_xmit(struct ed_softc *sc)
-{
-       struct ifnet *ifp = (struct ifnet *)sc;
-       u_short len;
-
-       if (sc->gone)
-               return;
-       len = sc->txb_len[sc->txb_next_tx];
-
-       /*
-        * Set NIC for page 0 register access
-        */
-       ed_nic_outb(sc, ED_P0_CR, sc->cr_proto | ED_CR_STA);
-
-       /*
-        * Set TX buffer start page
-        */
-       ed_nic_outb(sc, ED_P0_TPSR, sc->tx_page_start +
-                   sc->txb_next_tx * ED_TXBUF_SIZE);
-
-       /*
-        * Set TX length
-        */
-       ed_nic_outb(sc, ED_P0_TBCR0, len);
-       ed_nic_outb(sc, ED_P0_TBCR1, len >> 8);
-
-       /*
-        * Set page 0, Remote DMA complete, Transmit Packet, and *Start*
-        */
-       ed_nic_outb(sc, ED_P0_CR, sc->cr_proto | ED_CR_TXP | ED_CR_STA);
-       sc->xmit_busy = 1;
-
-       /*
-        * Point to next transmit buffer slot and wrap if necessary.
-        */
-       sc->txb_next_tx++;
-       if (sc->txb_next_tx == sc->txb_cnt)
-               sc->txb_next_tx = 0;
-
-       /*
-        * Set a timer just in case we never hear from the board again
-        */
-       ifp->if_timer = 2;
-}
-
-/*
- * Start output on interface.
- * We make two assumptions here:
- *  1) that the current priority is set to splimp _before_ this code
- *     is called *and* is returned to the appropriate priority after
- *     return
- *  2) that the OACTIVE flag is checked before this code is called
- *     (i.e. that the output part of the interface is idle)
- */
-static void
-ed_start(struct ifnet *ifp, struct ifaltq_subque *ifsq)
-{
-       struct ed_softc *sc = ifp->if_softc;
-       struct mbuf *m0, *m;
-       caddr_t buffer;
-       int     len;
-
-       ASSERT_ALTQ_SQ_DEFAULT(ifp, ifsq);
-
-       if (sc->gone) {
-               kprintf("ed_start(%p) GONE\n",ifp);
-               ifq_purge(&ifp->if_snd);
-               return;
-       }
-outloop:
-
-       /*
-        * First, see if there are buffered packets and an idle transmitter -
-        * should never happen at this point.
-        */
-       if (sc->txb_inuse && (sc->xmit_busy == 0)) {
-               kprintf("ed: packets buffered, but transmitter idle\n");
-               ed_xmit(sc);
-       }
-
-       /*
-        * See if there is room to put another packet in the buffer.
-        */
-       if (sc->txb_inuse == sc->txb_cnt) {
-
-               /*
-                * No room. Indicate this to the outside world and exit.
-                */
-               ifq_set_oactive(&ifp->if_snd);
-               return;
-       }
-       m = ifq_dequeue(&ifp->if_snd);
-       if (m == NULL) {
-
-               /*
-                * We are using the !OACTIVE flag to indicate to the outside
-                * world that we can accept an additional packet rather than
-                * that the transmitter is _actually_ active. Indeed, the
-                * transmitter may be active, but if we haven't filled all the
-                * buffers with data then we still want to accept more.
-                */
-               ifq_clr_oactive(&ifp->if_snd);
-               return;
-       }
-
-       /*
-        * Copy the mbuf chain into the transmit buffer
-        */
-
-       m0 = m;
-
-       /* txb_new points to next open buffer slot */
-       buffer = sc->mem_start + (sc->txb_new * ED_TXBUF_SIZE * ED_PAGE_SIZE);
-
-       if (sc->mem_shared) {
-
-               /*
-                * Special case setup for 16 bit boards...
-                */
-               if (sc->isa16bit) {
-                       switch (sc->vendor) {
-
-                               /*
-                                * For 16bit 3Com boards (which have 16k of
-                                * memory), we have the xmit buffers in a
-                                * different page of memory ('page 0') - so
-                                * change pages.
-                                */
-                       case ED_VENDOR_3COM:
-                               ed_asic_outb(sc, ED_3COM_GACFR,
-                                            ED_3COM_GACFR_RSEL);
-                               break;
-
-                               /*
-                                * Enable 16bit access to shared memory on
-                                * WD/SMC boards.
-                                */
-                       case ED_VENDOR_WD_SMC:
-                               ed_asic_outb(sc, ED_WD_LAAR,
-                                            sc->wd_laar_proto | ED_WD_LAAR_M16EN);
-                               if (sc->chip_type == ED_CHIP_TYPE_WD790) {
-                                       ed_asic_outb(sc, ED_WD_MSR, ED_WD_MSR_MENB);
-                               }
-                               break;
-                       }
-               }
-               for (len = 0; m != NULL; m = m->m_next) {
-                       bcopy(mtod(m, caddr_t), buffer, m->m_len);
-                       buffer += m->m_len;
-                       len += m->m_len;
-               }
-
-               /*
-                * Restore previous shared memory access
-                */
-               if (sc->isa16bit) {
-                       switch (sc->vendor) {
-                       case ED_VENDOR_3COM:
-                               ed_asic_outb(sc, ED_3COM_GACFR,
-                                            ED_3COM_GACFR_RSEL | ED_3COM_GACFR_MBS0);
-                               break;
-                       case ED_VENDOR_WD_SMC:
-                               if (sc->chip_type == ED_CHIP_TYPE_WD790) {
-                                       ed_asic_outb(sc, ED_WD_MSR, 0x00);
-                               }
-                               ed_asic_outb(sc, ED_WD_LAAR,
-                                            sc->wd_laar_proto & ~ED_WD_LAAR_M16EN);
-                               break;
-                       }
-               }
-       } else {
-               len = ed_pio_write_mbufs(sc, m, (int)buffer);
-               if (len == 0) {
-                       m_freem(m0);
-                       goto outloop;
-               }
-       }
-
-       sc->txb_len[sc->txb_new] = max(len, (ETHER_MIN_LEN-ETHER_CRC_LEN));
-
-       sc->txb_inuse++;
-
-       /*
-        * Point to next buffer slot and wrap if necessary.
-        */
-       sc->txb_new++;
-       if (sc->txb_new == sc->txb_cnt)
-               sc->txb_new = 0;
-
-       if (sc->xmit_busy == 0)
-               ed_xmit(sc);
-
-       BPF_MTAP(ifp, m0);
-
-       m_freem(m0);
-
-       /*
-        * Loop back to the top to possibly buffer more packets
-        */
-       goto outloop;
-}
-
-/*
- * Ethernet interface receiver interrupt.
- */
-static __inline void
-ed_rint(struct ed_softc *sc)
-{
-       struct ifnet *ifp = &sc->arpcom.ac_if;
-       u_char  boundry;
-       u_short len;
-       struct ed_ring packet_hdr;
-       char   *packet_ptr;
-
-       if (sc->gone)
-               return;
-
-       /*
-        * Set NIC to page 1 registers to get 'current' pointer
-        */
-       ed_nic_outb(sc, ED_P0_CR, sc->cr_proto | ED_CR_PAGE_1 | ED_CR_STA);
-
-       /*
-        * 'sc->next_packet' is the logical beginning of the ring-buffer -
-        * i.e. it points to where new data has been buffered. The 'CURR'
-        * (current) register points to the logical end of the ring-buffer -
-        * i.e. it points to where additional new data will be added. We loop
-        * here until the logical beginning equals the logical end (or in
-        * other words, until the ring-buffer is empty).
-        */
-       while (sc->next_packet != ed_nic_inb(sc, ED_P1_CURR)) {
-
-               /* get pointer to this buffer's header structure */
-               packet_ptr = sc->mem_ring +
-                   (sc->next_packet - sc->rec_page_start) * ED_PAGE_SIZE;
-
-               /*
-                * The byte count includes a 4 byte header that was added by
-                * the NIC.
-                */
-               if (sc->mem_shared)
-                       packet_hdr = *(struct ed_ring *) packet_ptr;
-               else
-                       ed_pio_readmem(sc, (int)packet_ptr, (char *) &packet_hdr,
-                                      sizeof(packet_hdr));
-               len = packet_hdr.count;
-               if (len > (ETHER_MAX_LEN - ETHER_CRC_LEN + sizeof(struct ed_ring)) ||
-                   len < (ETHER_MIN_LEN - ETHER_CRC_LEN + sizeof(struct ed_ring))) {
-                       /*
-                        * Length is a wild value. There's a good chance that
-                        * this was caused by the NIC being old and buggy.
-                        * The bug is that the length low byte is duplicated in
-                        * the high byte. Try to recalculate the length based on
-                        * the pointer to the next packet.
-                        */
-                       /*
-                        * NOTE: sc->next_packet is pointing at the current packet.
-                        */
-                       len &= ED_PAGE_SIZE - 1;        /* preserve offset into page */
-                       if (packet_hdr.next_packet >= sc->next_packet) {
-                               len += (packet_hdr.next_packet - sc->next_packet) * ED_PAGE_SIZE;
-                       } else {
-                               len += ((packet_hdr.next_packet - sc->rec_page_start) +
-                                       (sc->rec_page_stop - sc->next_packet)) * ED_PAGE_SIZE;
-                       }
-                       /*
-                        * because buffers are aligned on 256-byte boundary,
-                        * the length computed above is off by 256 in almost
-                        * all cases. Fix it...
-                        */
-                       if (len & 0xff)
-                               len -= 256 ;
-                       if (len > (ETHER_MAX_LEN - ETHER_CRC_LEN 
-                                  + sizeof(struct ed_ring)))
-                               sc->mibdata.dot3StatsFrameTooLongs++;
-               }
-               /*
-                * Be fairly liberal about what we allow as a "reasonable" length
-                * so that a [crufty] packet will make it to BPF (and can thus
-                * be analyzed). Note that all that is really important is that
-                * we have a length that will fit into one mbuf cluster or less;
-                * the upper layer protocols can then figure out the length from
-                * their own length field(s).
-                * But make sure that we have at least a full ethernet header
-                * or we would be unable to call ether_input() later.
-                */
-               if ((len >= sizeof(struct ed_ring) + ETHER_HDR_LEN) &&
-                   (len <= MCLBYTES) &&
-                   (packet_hdr.next_packet >= sc->rec_page_start) &&
-                   (packet_hdr.next_packet < sc->rec_page_stop)) {
-                       /*
-                        * Go get packet.
-                        */
-                       ed_get_packet(sc, packet_ptr + sizeof(struct ed_ring),
-                                     len - sizeof(struct ed_ring));
-                       IFNET_STAT_INC(ifp, ipackets, 1);
-               } else {
-                       /*
-                        * Really BAD. The ring pointers are corrupted.
-                        */
-                       log(LOG_ERR,
-                           "%s: NIC memory corrupt - invalid packet length %d\n",
-                           ifp->if_xname, len);
-                       IFNET_STAT_INC(ifp, ierrors, 1);
-                       ed_reset(ifp);
-                       return;
-               }
-
-               /*
-                * Update next packet pointer
-                */
-               sc->next_packet = packet_hdr.next_packet;
-
-               /*
-                * Update NIC boundry pointer - being careful to keep it one
-                * buffer behind. (as recommended by NS databook)
-                */
-               boundry = sc->next_packet - 1;
-               if (boundry < sc->rec_page_start)
-                       boundry = sc->rec_page_stop - 1;
-
-               /*
-                * Set NIC to page 0 registers to update boundry register
-                */
-               ed_nic_outb(sc, ED_P0_CR, sc->cr_proto | ED_CR_STA);
-
-               ed_nic_outb(sc, ED_P0_BNRY, boundry);
-
-               /*
-                * Set NIC to page 1 registers before looping to top (prepare
-                * to get 'CURR' current pointer)
-                */
-               ed_nic_outb(sc, ED_P0_CR, sc->cr_proto | ED_CR_PAGE_1 | ED_CR_STA);
-       }
-}
-
-/*
- * Ethernet interface interrupt processor
- */
-void
-edintr(void *arg)
-{
-       struct ed_softc *sc = (struct ed_softc*) arg;
-       struct ifnet *ifp = (struct ifnet *)sc;
-       u_char  isr;
-       int     count;
-
-       if (sc->gone)
-               return;
-       /*
-        * Set NIC to page 0 registers
-        */
-       ed_nic_outb(sc, ED_P0_CR, sc->cr_proto | ED_CR_STA);
-
-       /*
-        * loop until there are no more new interrupts.  When the card
-        * goes away, the hardware will read back 0xff.  Looking at
-        * the interrupts, it would appear that 0xff is impossible,
-        * or at least extremely unlikely.
-        */
-       while ((isr = ed_nic_inb(sc, ED_P0_ISR)) != 0 && isr != 0xff) {
-
-               /*
-                * reset all the bits that we are 'acknowledging' by writing a
-                * '1' to each bit position that was set (writing a '1'
-                * *clears* the bit)
-                */
-               ed_nic_outb(sc, ED_P0_ISR, isr);
-
-               /* 
-                * XXX workaround for AX88190
-                * We limit this to 5000 iterations.  At 1us per inb/outb,
-                * this translates to about 15ms, which should be plenty
-                * of time, and also gives protection in the card eject
-                * case.
-                */
-               if (sc->chip_type == ED_CHIP_TYPE_AX88190) {
-                       count = 5000;           /* 15ms */
-                       while (count-- && (ed_nic_inb(sc, ED_P0_ISR) & isr)) {
-                               ed_nic_outb(sc, ED_P0_ISR,0);
-                               ed_nic_outb(sc, ED_P0_ISR,isr);
-                       }
-                       if (count == 0)
-                               break;
-               }
-
-               /*
-                * Handle transmitter interrupts. Handle these first because
-                * the receiver will reset the board under some conditions.
-                */
-               if (isr & (ED_ISR_PTX | ED_ISR_TXE)) {
-                       u_char  collisions = ed_nic_inb(sc, ED_P0_NCR) & 0x0f;
-
-                       /*
-                        * Check for transmit error. If a TX completed with an
-                        * error, we end up throwing the packet away. Really
-                        * the only error that is possible is excessive
-                        * collisions, and in this case it is best to allow
-                        * the automatic mechanisms of TCP to backoff the
-                        * flow. Of course, with UDP we're screwed, but this
-                        * is expected when a network is heavily loaded.
-                        */
-                       ed_nic_inb(sc, ED_P0_TSR);
-                       if (isr & ED_ISR_TXE) {
-                               u_char tsr;
-
-                               /*
-                                * Excessive collisions (16)
-                                */
-                               tsr = ed_nic_inb(sc, ED_P0_TSR);
-                               if ((tsr & ED_TSR_ABT)  
-                                   && (collisions == 0)) {
-
-                                       /*
-                                        * When collisions total 16, the
-                                        * P0_NCR will indicate 0, and the
-                                        * TSR_ABT is set.
-                                        */
-                                       collisions = 16;
-                                       sc->mibdata.dot3StatsExcessiveCollisions++;
-                                       sc->mibdata.dot3StatsCollFrequencies[15]++;
-                               }
-                               if (tsr & ED_TSR_OWC)
-                                       sc->mibdata.dot3StatsLateCollisions++;
-                               if (tsr & ED_TSR_CDH)
-                                       sc->mibdata.dot3StatsSQETestErrors++;
-                               if (tsr & ED_TSR_CRS)
-                                       sc->mibdata.dot3StatsCarrierSenseErrors++;
-                               if (tsr & ED_TSR_FU)
-                                       sc->mibdata.dot3StatsInternalMacTransmitErrors++;
-
-                               /*
-                                * update output errors counter
-                                */
-                               IFNET_STAT_INC(ifp, oerrors, 1);
-                       } else {
-
-                               /*
-                                * Update total number of successfully
-                                * transmitted packets.
-                                */
-                               IFNET_STAT_INC(ifp, opackets, 1);
-                       }
-
-                       /*
-                        * reset tx busy and output active flags
-                        */
-                       sc->xmit_busy = 0;
-                       ifq_clr_oactive(&ifp->if_snd);
-
-                       /*
-                        * clear watchdog timer
-                        */
-                       ifp->if_timer = 0;
-
-                       /*
-                        * Add in total number of collisions on last
-                        * transmission.
-                        */
-                       IFNET_STAT_INC(ifp, collisions, collisions);
-                       switch(collisions) {
-                       case 0:
-                       case 16:
-                               break;
-                       case 1:
-                               sc->mibdata.dot3StatsSingleCollisionFrames++;
-                               sc->mibdata.dot3StatsCollFrequencies[0]++;
-                               break;
-                       default:
-                               sc->mibdata.dot3StatsMultipleCollisionFrames++;
-                               sc->mibdata.
-                                       dot3StatsCollFrequencies[collisions-1]
-                                               ++;
-                               break;
-                       }
-
-                       /*
-                        * Decrement buffer in-use count if not zero (can only
-                        * be zero if a transmitter interrupt occured while
-                        * not actually transmitting). If data is ready to
-                        * transmit, start it transmitting, otherwise defer
-                        * until after handling receiver
-                        */
-                       if (sc->txb_inuse && --sc->txb_inuse)
-                               ed_xmit(sc);
-               }
-
-               /*
-                * Handle receiver interrupts
-                */
-               if (isr & (ED_ISR_PRX | ED_ISR_RXE | ED_ISR_OVW)) {
-
-                       /*
-                        * Overwrite warning. In order to make sure that a
-                        * lockup of the local DMA hasn't occurred, we reset
-                        * and re-init the NIC. The NSC manual suggests only a
-                        * partial reset/re-init is necessary - but some chips
-                        * seem to want more. The DMA lockup has been seen
-                        * only with early rev chips - Methinks this bug was
-                        * fixed in later revs. -DG
-                        */
-                       if (isr & ED_ISR_OVW) {
-                               IFNET_STAT_INC(ifp, ierrors, 1);
-#ifdef DIAGNOSTIC
-                               log(LOG_WARNING,
-                                   "%s: warning - receiver ring buffer overrun\n",
-                                   ifp->if_xname);
-#endif
-
-                               /*
-                                * Stop/reset/re-init NIC
-                                */
-                               ed_reset(ifp);
-                       } else {
-
-                               /*
-                                * Receiver Error. One or more of: CRC error,
-                                * frame alignment error FIFO overrun, or
-                                * missed packet.
-                                */
-                               if (isr & ED_ISR_RXE) {
-                                       u_char rsr;
-                                       rsr = ed_nic_inb(sc, ED_P0_RSR);
-                                       if (rsr & ED_RSR_CRC)
-                                               sc->mibdata.dot3StatsFCSErrors++;
-                                       if (rsr & ED_RSR_FAE)
-                                               sc->mibdata.dot3StatsAlignmentErrors++;
-                                       if (rsr & ED_RSR_FO)
-                                               sc->mibdata.dot3StatsInternalMacReceiveErrors++;
-                                       IFNET_STAT_INC(ifp, ierrors, 1);
-#ifdef ED_DEBUG
-                                       if_printf("receive error %x\n",
-                                              ed_nic_inb(sc, ED_P0_RSR));
-#endif
-                               }
-
-                               /*
-                                * Go get the packet(s) XXX - Doing this on an
-                                * error is dubious because there shouldn't be
-                                * any data to get (we've configured the
-                                * interface to not accept packets with
-                                * errors).
-                                */
-
-                               /*
-                                * Enable 16bit access to shared memory first
-                                * on WD/SMC boards.
-                                */
-                               if (sc->isa16bit &&
-                                   (sc->vendor == ED_VENDOR_WD_SMC)) {
-
-                                       ed_asic_outb(sc, ED_WD_LAAR,
-                                                    sc->wd_laar_proto | ED_WD_LAAR_M16EN);
-                                       if (sc->chip_type == ED_CHIP_TYPE_WD790) {
-                                               ed_asic_outb(sc, ED_WD_MSR,
-                                                            ED_WD_MSR_MENB);
-                                       }
-                               }
-                               ed_rint(sc);
-
-                               /* disable 16bit access */
-                               if (sc->isa16bit &&
-                                   (sc->vendor == ED_VENDOR_WD_SMC)) {
-
-                                       if (sc->chip_type == ED_CHIP_TYPE_WD790) {
-                                               ed_asic_outb(sc, ED_WD_MSR, 0x00);
-                                       }
-                                       ed_asic_outb(sc, ED_WD_LAAR,
-                                                    sc->wd_laar_proto & ~ED_WD_LAAR_M16EN);
-                               }
-                       }
-               }
-
-               /*
-                * If it looks like the transmitter can take more data,
-                * attempt to start output on the interface. This is done
-                * after handling the receiver to give the receiver priority.
-                */
-               if (!ifq_is_oactive(&ifp->if_snd))
-                       if_devstart(ifp);
-
-               /*
-                * return NIC CR to standard state: page 0, remote DMA
-                * complete, start (toggling the TXP bit off, even if was just
-                * set in the transmit routine, is *okay* - it is 'edge'
-                * triggered from low to high)
-                */
-               ed_nic_outb(sc, ED_P0_CR, sc->cr_proto | ED_CR_STA);
-
-               /*
-                * If the Network Talley Counters overflow, read them to reset
-                * them. It appears that old 8390's won't clear the ISR flag
-                * otherwise - resulting in an infinite loop.
-                */
-               if (isr & ED_ISR_CNT) {
-                       ed_nic_inb(sc, ED_P0_CNTR0);
-                       ed_nic_inb(sc, ED_P0_CNTR1);
-                       ed_nic_inb(sc, ED_P0_CNTR2);
-               }
-       }
-}
-
-/*
- * Process an ioctl request. This code needs some work - it looks
- *     pretty ugly.
- */
-static int
-ed_ioctl(struct ifnet *ifp, u_long command, caddr_t data, struct ucred *cr)
-{
-       struct ed_softc *sc = ifp->if_softc;
-#ifndef ED_NO_MIIBUS
-       struct ifreq *ifr = (struct ifreq *)data;
-       struct mii_data *mii;
-#endif
-       int error = 0;
-
-       crit_enter();
-
-       if (sc == NULL || sc->gone) {
-               ifp->if_flags &= ~IFF_RUNNING;
-               crit_exit();
-               return ENXIO;
-       }
-
-       switch (command) {
-       case SIOCSIFFLAGS:
-
-               /*
-                * If the interface is marked up and stopped, then start it.
-                * If it is marked down and running, then stop it.
-                */
-               if (ifp->if_flags & IFF_UP) {
-                       if ((ifp->if_flags & IFF_RUNNING) == 0)
-                               ed_init(sc);
-               } else {
-                       if (ifp->if_flags & IFF_RUNNING) {
-                               ed_stop(sc);
-                               ifp->if_flags &= ~IFF_RUNNING;
-                       }
-               }
-
-               /*
-                * Promiscuous flag may have changed, so reprogram the RCR.
-                */
-               ed_setrcr(sc);
-
-               /*
-                * An unfortunate hack to provide the (required) software
-                * control of the tranceiver for 3Com boards. The ALTPHYS flag
-                * disables the tranceiver if set.
-                */
-               if (sc->vendor == ED_VENDOR_3COM) {
-                       if (ifp->if_flags & IFF_ALTPHYS) {
-                               ed_asic_outb(sc, ED_3COM_CR, 0);
-                       } else {
-                               ed_asic_outb(sc, ED_3COM_CR, ED_3COM_CR_XSEL);
-                       }
-               } else if (sc->vendor == ED_VENDOR_HP) 
-                       ed_hpp_set_physical_link(sc);
-               break;
-
-       case SIOCADDMULTI:
-       case SIOCDELMULTI:
-               /*
-                * Multicast list has changed; set the hardware filter
-                * accordingly.
-                */
-               ed_setrcr(sc);
-               error = 0;
-               break;
-
-#ifndef ED_NO_MIIBUS
-       case SIOCGIFMEDIA:
-       case SIOCSIFMEDIA:
-               if (sc->miibus == NULL) {
-                       error = EINVAL;
-                       break;
-               }
-               mii = device_get_softc(sc->miibus);
-               error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, command);
-               break;
-#endif
-
-       default:
-               error = ether_ioctl(ifp, command, data);
-               break;
-       }
-
-       crit_exit();
-
-       return (error);
-}
-
-/*
- * Given a source and destination address, copy 'amount' of a packet from
- *     the ring buffer into a linear destination buffer. Takes into account
- *     ring-wrap.
- */
-static __inline char *
-ed_ring_copy(struct ed_softc *sc, char *src, char *dst, u_short amount)
-{
-       u_short tmp_amount;
-
-       /* does copy wrap to lower addr in ring buffer? */
-       if (src + amount > sc->mem_end) {
-               tmp_amount = sc->mem_end - src;
-
-               /* copy amount up to end of NIC memory */
-               if (sc->mem_shared)
-                       bcopy(src, dst, tmp_amount);
-               else
-                       ed_pio_readmem(sc, (int)src, dst, tmp_amount);
-
-               amount -= tmp_amount;
-               src = sc->mem_ring;
-               dst += tmp_amount;
-       }
-       if (sc->mem_shared)
-               bcopy(src, dst, amount);
-       else
-               ed_pio_readmem(sc, (int)src, dst, amount);
-
-       return (src + amount);
-}
-
-/*
- * Retreive packet from shared memory and send to the next level up via
- * ether_input().
- */
-static void
-ed_get_packet(struct ed_softc *sc, char *buf, u_short len)
-{
-       struct ifnet *ifp = &sc->arpcom.ac_if;
-       struct ether_header *eh;
-       struct mbuf *m;
-
-       /*
-        * Allocate a header mbuf.
-        * We always put the received packet in a single buffer -
-        * either with just an mbuf header or in a cluster attached
-        * to the header. The +2 is to compensate for the alignment
-        * fixup below.
-        */
-       m = m_getl(len + 2, M_NOWAIT, MT_DATA, M_PKTHDR, NULL);
-       if (m == NULL)
-               return;
-       m->m_pkthdr.rcvif = ifp;
-       m->m_pkthdr.len = m->m_len = len;
-
-       /*
-        * The +2 is to longword align the start of the real packet.
-        * This is important for NFS.
-        */
-       m->m_data += 2;
-       eh = mtod(m, struct ether_header *);
-
-       /*
-        * Get packet, including link layer address, from interface.
-        */
-       ed_ring_copy(sc, buf, (char *)eh, len);
-
-       m->m_pkthdr.len = m->m_len = len;
-
-       ifp->if_input(ifp, m, NULL, -1);
-}
-
-/*
- * Supporting routines
- */
-
-/*
- * Given a NIC memory source address and a host memory destination
- *     address, copy 'amount' from NIC to host using Programmed I/O.
- *     The 'amount' is rounded up to a word - okay as long as mbufs
- *             are word sized.
- *     This routine is currently Novell-specific.
- */
-void
-ed_pio_readmem(struct ed_softc *sc, int src, u_char *dst, u_short amount)
-{
-       /* HP PC Lan+ cards need special handling */
-       if (sc->vendor == ED_VENDOR_HP && sc->type == ED_TYPE_HP_PCLANPLUS) {
-               ed_hpp_readmem(sc, src, dst, amount);
-               return;
-       }
-
-       /* Regular Novell cards */
-       /* select page 0 registers */
-       ed_nic_outb(sc, ED_P0_CR, ED_CR_RD2 | ED_CR_STA);
-
-       /* round up to a word */
-       if (amount & 1)
-               ++amount;
-
-       /* set up DMA byte count */
-       ed_nic_outb(sc, ED_P0_RBCR0, amount);
-       ed_nic_outb(sc, ED_P0_RBCR1, amount >> 8);
-
-       /* set up source address in NIC mem */
-       ed_nic_outb(sc, ED_P0_RSAR0, src);
-       ed_nic_outb(sc, ED_P0_RSAR1, src >> 8);
-
-       ed_nic_outb(sc, ED_P0_CR, ED_CR_RD0 | ED_CR_STA);
-
-       if (sc->isa16bit) {
-               ed_asic_insw(sc, ED_NOVELL_DATA, dst, amount / 2);
-       } else {
-               ed_asic_insb(sc, ED_NOVELL_DATA, dst, amount);
-       }
-}
-
-/*
- * Stripped down routine for writing a linear buffer to NIC memory.
- *     Only used in the probe routine to test the memory. 'len' must
- *     be even.
- */
-void
-ed_pio_writemem(struct ed_softc *sc, char *src, u_short dst, u_short len)
-{
-       int     maxwait = 200;  /* about 240us */
-
-       /* select page 0 registers */
-       ed_nic_outb(sc, ED_P0_CR, ED_CR_RD2 | ED_CR_STA);
-
-       /* reset remote DMA complete flag */
-       ed_nic_outb(sc, ED_P0_ISR, ED_ISR_RDC);
-
-       /* set up DMA byte count */
-       ed_nic_outb(sc, ED_P0_RBCR0, len);
-       ed_nic_outb(sc, ED_P0_RBCR1, len >> 8);
-
-       /* set up destination address in NIC mem */
-       ed_nic_outb(sc, ED_P0_RSAR0, dst);
-       ed_nic_outb(sc, ED_P0_RSAR1, dst >> 8);
-
-       /* set remote DMA write */
-       ed_nic_outb(sc, ED_P0_CR, ED_CR_RD1 | ED_CR_STA);
-
-       if (sc->isa16bit) {
-               ed_asic_outsw(sc, ED_NOVELL_DATA, src, len / 2);
-       } else {
-               ed_asic_outsb(sc, ED_NOVELL_DATA, src, len);
-       }
-
-       /*
-        * Wait for remote DMA complete. This is necessary because on the
-        * transmit side, data is handled internally by the NIC in bursts and
-        * we can't start another remote DMA until this one completes. Not
-        * waiting causes really bad things to happen - like the NIC
-        * irrecoverably jamming the ISA bus.
-        */
-       while (((ed_nic_inb(sc, ED_P0_ISR) & ED_ISR_RDC) != ED_ISR_RDC) && --maxwait);
-}
-
-/*
- * Write an mbuf chain to the destination NIC memory address using
- *     programmed I/O.
- */
-static u_short
-ed_pio_write_mbufs(struct ed_softc *sc, struct mbuf *m, int dst)
-{
-       struct ifnet *ifp = (struct ifnet *)sc;
-       u_short total_len, dma_len;
-       struct mbuf *mp;
-       int     maxwait = 200;  /* about 240us */
-
-       /* HP PC Lan+ cards need special handling */
-       if (sc->vendor == ED_VENDOR_HP && sc->type == ED_TYPE_HP_PCLANPLUS) {
-               return ed_hpp_write_mbufs(sc, m, dst);
-       }
-
-       /* Regular Novell cards */
-       /* First, count up the total number of bytes to copy */
-       for (total_len = 0, mp = m; mp; mp = mp->m_next)
-               total_len += mp->m_len;
-
-       dma_len = total_len;
-       if (sc->isa16bit && (dma_len & 1))
-               dma_len++;
-
-       /* select page 0 registers */
-       ed_nic_outb(sc, ED_P0_CR, ED_CR_RD2 | ED_CR_STA);
-
-       /* reset remote DMA complete flag */
-       ed_nic_outb(sc, ED_P0_ISR, ED_ISR_RDC);
-
-       /* set up DMA byte count */
-       ed_nic_outb(sc, ED_P0_RBCR0, dma_len);
-       ed_nic_outb(sc, ED_P0_RBCR1, dma_len >> 8);
-
-       /* set up destination address in NIC mem */
-       ed_nic_outb(sc, ED_P0_RSAR0, dst);
-       ed_nic_outb(sc, ED_P0_RSAR1, dst >> 8);
-
-       /* set remote DMA write */
-       ed_nic_outb(sc, ED_P0_CR, ED_CR_RD1 | ED_CR_STA);
-
-  /*
-   * Transfer the mbuf chain to the NIC memory.
-   * 16-bit cards require that data be transferred as words, and only words.
-   * So that case requires some extra code to patch over odd-length mbufs.
-   */
-
-       if (!sc->isa16bit) {
-               /* NE1000s are easy */
-               while (m) {
-                       if (m->m_len) {
-                               ed_asic_outsb(sc, ED_NOVELL_DATA,
-                                             m->m_data, m->m_len);
-                       }
-                       m = m->m_next;
-               }
-       } else {
-               /* NE2000s are a pain */
-               u_char *data;
-               int len, wantbyte;
-               u_char savebyte[2];
-
-               wantbyte = 0;
-
-               while (m) {
-                       len = m->m_len;
-                       if (len) {
-                               data = mtod(m, caddr_t);
-                               /* finish the last word */
-                               if (wantbyte) {
-                                       savebyte[1] = *data;
-                                       ed_asic_outw(sc, ED_NOVELL_DATA,
-                                                    *(u_short *)savebyte);
-                                       data++;
-                                       len--;
-                                       wantbyte = 0;
-                               }
-                               /* output contiguous words */
-                               if (len > 1) {
-                                       ed_asic_outsw(sc, ED_NOVELL_DATA,
-                                                     data, len >> 1);
-                                       data += len & ~1;
-                                       len &= 1;
-                               }
-                               /* save last byte, if necessary */
-                               if (len == 1) {
-                                       savebyte[0] = *data;
-                                       wantbyte = 1;
-                               }
-                       }
-                       m = m->m_next;
-               }
-               /* spit last byte */
-               if (wantbyte) {
-                       ed_asic_outw(sc, ED_NOVELL_DATA, *(u_short *)savebyte);
-               }
-       }
-
-       /*
-        * Wait for remote DMA complete. This is necessary because on the
-        * transmit side, data is handled internally by the NIC in bursts and
-        * we can't start another remote DMA until this one completes. Not
-        * waiting causes really bad things to happen - like the NIC
-        * irrecoverably jamming the ISA bus.
-        */
-       while (((ed_nic_inb(sc, ED_P0_ISR) & ED_ISR_RDC) != ED_ISR_RDC) && --maxwait);
-
-       if (!maxwait) {
-               log(LOG_WARNING, "%s: remote transmit DMA failed to complete\n",
-                   ifp->if_xname);
-               ed_reset(ifp);
-               return(0);
-       }
-       return (total_len);
-}
-
-/*
- * Support routines to handle the HP PC Lan+ card.
- */
-
-/*
- * HP PC Lan+: Read from NIC memory, using either PIO or memory mapped
- * IO.
- */
-
-static void
-ed_hpp_readmem(struct ed_softc *sc, u_short src, u_char *dst, u_short amount)
-{
-
-       int use_32bit_access = !(sc->hpp_id & ED_HPP_ID_16_BIT_ACCESS);
-
-
-       /* Program the source address in RAM */
-       ed_asic_outw(sc, ED_HPP_PAGE_2, src);
-
-       /*
-        * The HP PC Lan+ card supports word reads as well as
-        * a memory mapped i/o port that is aliased to every 
-        * even address on the board.
-        */
-
-       if (sc->hpp_mem_start) {
-
-               /* Enable memory mapped access.  */
-               ed_asic_outw(sc, ED_HPP_OPTION, sc->hpp_options & 
-                       ~(ED_HPP_OPTION_MEM_DISABLE | 
-                         ED_HPP_OPTION_BOOT_ROM_ENB));
-
-               if (use_32bit_access && (amount > 3)) {
-                       u_int32_t *dl = (u_int32_t *) dst;      
-                       volatile u_int32_t *const sl = 
-                               (u_int32_t *) sc->hpp_mem_start;
-                       u_int32_t *const fence = dl + (amount >> 2);
-                       
-                       /* Copy out NIC data.  We could probably write this
-                          as a `movsl'. The currently generated code is lousy.
-                          */
-
-                       while (dl < fence)
-                               *dl++ = *sl;
-               
-                       dst += (amount & ~3);
-                       amount &= 3;
-
-               } 
-
-               /* Finish off any words left, as a series of short reads */
-               if (amount > 1) {
-                       u_short *d = (u_short *) dst;   
-                       volatile u_short *const s = 
-                               (u_short *) sc->hpp_mem_start;
-                       u_short *const fence = d + (amount >> 1);
-                       
-                       /* Copy out NIC data.  */
-
-                       while (d < fence)
-                               *d++ = *s;
-       
-                       dst += (amount & ~1);
-                       amount &= 1;
-               }
-
-               /*
-                * read in a byte; however we need to always read 16 bits
-                * at a time or the hardware gets into a funny state
-                */
-
-               if (amount == 1) {
-                       /* need to read in a short and copy LSB */
-                       volatile u_short *const s = 
-                               (volatile u_short *) sc->hpp_mem_start;
-                       
-                       *dst = (*s) & 0xFF;     
-               }
-
-               /* Restore Boot ROM access.  */
-
-               ed_asic_outw(sc, ED_HPP_OPTION, sc->hpp_options);
-
-
-       } else { 
-               /* Read in data using the I/O port */
-               if (use_32bit_access && (amount > 3)) {
-                       ed_asic_insl(sc, ED_HPP_PAGE_4, dst, amount >> 2);
-                       dst += (amount & ~3);
-                       amount &= 3;
-               }
-               if (amount > 1) {
-                       ed_asic_insw(sc, ED_HPP_PAGE_4, dst, amount >> 1);
-                       dst += (amount & ~1);
-                       amount &= 1;
-               }
-               if (amount == 1) { /* read in a short and keep the LSB */
-                       *dst = ed_asic_inw(sc, ED_HPP_PAGE_4) & 0xFF;
-               }
-       }
-}
-
-/*
- * HP PC Lan+: Write to NIC memory, using either PIO or memory mapped
- * IO.
- *     Only used in the probe routine to test the memory. 'len' must
- *     be even.
- */
-static void
-ed_hpp_writemem(struct ed_softc *sc, u_char *src, u_short dst, u_short len)
-{
-       /* reset remote DMA complete flag */
-       ed_nic_outb(sc, ED_P0_ISR, ED_ISR_RDC);
-
-       /* program the write address in RAM */
-       ed_asic_outw(sc, ED_HPP_PAGE_0, dst);
-
-       if (sc->hpp_mem_start) {
-               u_short *s = (u_short *) src;
-               volatile u_short *d = (u_short *) sc->hpp_mem_start;
-               u_short *const fence = s + (len >> 1);
-
-               /*
-                * Enable memory mapped access.
-                */
-
-               ed_asic_outw(sc, ED_HPP_OPTION, sc->hpp_options & 
-                       ~(ED_HPP_OPTION_MEM_DISABLE | 
-                         ED_HPP_OPTION_BOOT_ROM_ENB));
-
-               /*
-                * Copy to NIC memory.
-                */
-
-               while (s < fence)
-                       *d = *s++;
-
-               /*
-                * Restore Boot ROM access.
-                */
-
-               ed_asic_outw(sc, ED_HPP_OPTION, sc->hpp_options);
-
-       } else {
-               /* write data using I/O writes */
-               ed_asic_outsw(sc, ED_HPP_PAGE_4, src, len / 2);
-       }
-}
-
-/*
- * Write to HP PC Lan+ NIC memory.  Access to the NIC can be by using 
- * outsw() or via the memory mapped interface to the same register.
- * Writes have to be in word units; byte accesses won't work and may cause
- * the NIC to behave weirdly. Long word accesses are permitted if the ASIC
- * allows it.
- */
-
-static u_short
-ed_hpp_write_mbufs(struct ed_softc *sc, struct mbuf *m, int dst)
-{
-       int len, wantbyte;
-       u_short total_len;
-       u_char savebyte[2];
-       volatile u_short * const d = 
-               (volatile u_short *) sc->hpp_mem_start;
-       int use_32bit_accesses = !(sc->hpp_id & ED_HPP_ID_16_BIT_ACCESS);
-
-       /* select page 0 registers */
-       ed_nic_outb(sc, ED_P0_CR, sc->cr_proto | ED_CR_STA);
-
-       /* reset remote DMA complete flag */
-       ed_nic_outb(sc, ED_P0_ISR, ED_ISR_RDC);
-
-       /* program the write address in RAM */
-       ed_asic_outw(sc, ED_HPP_PAGE_0, dst);
-
-       if (sc->hpp_mem_start)  /* enable memory mapped I/O */
-               ed_asic_outw(sc, ED_HPP_OPTION, sc->hpp_options & 
-                       ~(ED_HPP_OPTION_MEM_DISABLE |
-                       ED_HPP_OPTION_BOOT_ROM_ENB));
-
-       wantbyte = 0;
-       total_len = 0;
-
-       if (sc->hpp_mem_start) {        /* Memory mapped I/O port */
-               while (m) {
-                       total_len += (len = m->m_len);
-                       if (len) {
-                               caddr_t data = mtod(m, caddr_t);
-                               /* finish the last word of the previous mbuf */
-                               if (wantbyte) {
-                                       savebyte[1] = *data;
-                                       *d = *((u_short *) savebyte);
-                                       data++; len--; wantbyte = 0;
-                               }
-                               /* output contiguous words */
-                               if ((len > 3) && (use_32bit_accesses)) {
-                                       volatile u_int32_t *const dl = 
-                                               (volatile u_int32_t *) d;
-                                       u_int32_t *sl = (u_int32_t *) data;
-                                       u_int32_t *fence = sl + (len >> 2);
-
-                                       while (sl < fence)
-                                               *dl = *sl++;
-
-                                       data += (len & ~3);
-                                       len &= 3;
-                               }
-                               /* finish off remain 16 bit writes */
-                               if (len > 1) {
-                                       u_short *s = (u_short *) data;
-                                       u_short *fence = s + (len >> 1);
-
-                                       while (s < fence)
-                                               *d = *s++;
-
-                                       data += (len & ~1); 
-                                       len &= 1;
-                               }
-                               /* save last byte if needed */
-                               if ((wantbyte = (len == 1)) != 0)
-                                       savebyte[0] = *data;
-                       }
-                       m = m->m_next;  /* to next mbuf */
-               }
-               if (wantbyte) /* write last byte */
-                       *d = *((u_short *) savebyte);
-       } else {
-               /* use programmed I/O */
-               while (m) {
-                       total_len += (len = m->m_len);
-                       if (len) {
-                               caddr_t data = mtod(m, caddr_t);
-                               /* finish the last word of the previous mbuf */
-                               if (wantbyte) {
-                                       savebyte[1] = *data;
-                                       ed_asic_outw(sc, ED_HPP_PAGE_4,
-                                                    *((u_short *)savebyte));
-                                       data++; 
-                                       len--; 
-                                       wantbyte = 0;
-                               }
-                               /* output contiguous words */
-                               if ((len > 3) && use_32bit_accesses) {
-                                       ed_asic_outsl(sc, ED_HPP_PAGE_4,
-                                                     data, len >> 2);
-                                       data += (len & ~3);
-                                       len &= 3;
-                               }
-                               /* finish off remaining 16 bit accesses */
-                               if (len > 1) {
-                                       ed_asic_outsw(sc, ED_HPP_PAGE_4,
-                                                     data, len >> 1);
-                                       data += (len & ~1);
-                                       len &= 1;
-                               }
-                               if ((wantbyte = (len == 1)) != 0)
-                                       savebyte[0] = *data;
-
-                       } /* if len != 0 */
-                       m = m->m_next;
-               }
-               if (wantbyte) /* spit last byte */
-                       ed_asic_outw(sc, ED_HPP_PAGE_4, *(u_short *)savebyte);
-
-       }
-
-       if (sc->hpp_mem_start)  /* turn off memory mapped i/o */
-               ed_asic_outw(sc, ED_HPP_OPTION, sc->hpp_options);
-
-       return (total_len);
-}
-
-#ifndef ED_NO_MIIBUS
-/*
- * MII bus support routines.
- */
-int
-ed_miibus_readreg(device_t dev, int phy, int reg)
-{
-       struct ed_softc *sc = device_get_softc(dev);
-       int failed, val;
-
-       crit_enter();
-
-       if (sc->gone) {
-               crit_exit();
-               return (0);
-       }
-
-       (*sc->mii_writebits)(sc, 0xffffffff, 32);
-       (*sc->mii_writebits)(sc, ED_MII_STARTDELIM, ED_MII_STARTDELIM_BITS);
-       (*sc->mii_writebits)(sc, ED_MII_READOP, ED_MII_OP_BITS);
-       (*sc->mii_writebits)(sc, phy, ED_MII_PHY_BITS);
-       (*sc->mii_writebits)(sc, reg, ED_MII_REG_BITS);
-
-       failed = (*sc->mii_readbits)(sc, ED_MII_ACK_BITS);
-       val = (*sc->mii_readbits)(sc, ED_MII_DATA_BITS);
-       (*sc->mii_writebits)(sc, ED_MII_IDLE, ED_MII_IDLE_BITS);
-
-       crit_exit();
-
-       return (failed ? 0 : val);
-}
-
-void
-ed_miibus_writereg(device_t dev, int phy, int reg, int data)
-{
-       struct ed_softc *sc = device_get_softc(dev);
-
-       crit_enter();
-
-       if (sc->gone) {
-               crit_exit();
-               return;
-       }
-
-       (*sc->mii_writebits)(sc, 0xffffffff, 32);
-       (*sc->mii_writebits)(sc, ED_MII_STARTDELIM, ED_MII_STARTDELIM_BITS);
-       (*sc->mii_writebits)(sc, ED_MII_WRITEOP, ED_MII_OP_BITS);
-       (*sc->mii_writebits)(sc, phy, ED_MII_PHY_BITS);
-       (*sc->mii_writebits)(sc, reg, ED_MII_REG_BITS);
-       (*sc->mii_writebits)(sc, ED_MII_TURNAROUND, ED_MII_TURNAROUND_BITS);
-       (*sc->mii_writebits)(sc, data, ED_MII_DATA_BITS);
-       (*sc->mii_writebits)(sc, ED_MII_IDLE, ED_MII_IDLE_BITS);
-
-       crit_exit();
-}
-
-int
-ed_ifmedia_upd(struct ifnet *ifp)
-{
-       struct ed_softc *sc;
-       struct mii_data *mii;
-
-       sc = ifp->if_softc;
-       if (sc->gone || sc->miibus == NULL)
-               return (ENXIO);
-       
-       mii = device_get_softc(sc->miibus);
-       return mii_mediachg(mii);
-}
-
-void
-ed_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
-{
-       struct ed_softc *sc;
-       struct mii_data *mii;
-
-       sc = ifp->if_softc;
-       if (sc->gone || sc->miibus == NULL)
-               return;
-
-       mii = device_get_softc(sc->miibus);
-       mii_pollstat(mii);
-       ifmr->ifm_active = mii->mii_media_active;
-       ifmr->ifm_status = mii->mii_media_status;
-}
-
-void
-ed_child_detached(device_t dev, device_t child)
-{
-       struct ed_softc *sc;
-
-       sc = device_get_softc(dev);
-       if (child == sc->miibus)
-               sc->miibus = NULL;
-}
-#endif
-
-static void
-ed_setrcr(struct ed_softc *sc)
-{
-       struct ifnet *ifp = (struct ifnet *)sc;
-       int     i;
-       u_char  reg1;
-
-       /* Bit 6 in AX88190 RCR register must be set. */
-       if (sc->chip_type == ED_CHIP_TYPE_AX88190)
-               reg1 = ED_RCR_INTT;
-       else
-               reg1 = 0x00;
-
-       /* set page 1 registers */
-       ed_nic_outb(sc, ED_P0_CR, sc->cr_proto | ED_CR_PAGE_1 | ED_CR_STP);
-
-       if (ifp->if_flags & IFF_PROMISC) {
-
-               /*
-                * Reconfigure the multicast filter.
-                */
-               for (i = 0; i < 8; i++)
-                       ed_nic_outb(sc, ED_P1_MAR(i), 0xff);
-
-               /*
-                * And turn on promiscuous mode. Also enable reception of
-                * runts and packets with CRC & alignment errors.
-                */
-               /* Set page 0 registers */
-               ed_nic_outb(sc, ED_P0_CR, sc->cr_proto | ED_CR_STP);
-
-               ed_nic_outb(sc, ED_P0_RCR, ED_RCR_PRO | ED_RCR_AM |
-                           ED_RCR_AB | ED_RCR_AR | ED_RCR_SEP | reg1);
-       } else {
-               /* set up multicast addresses and filter modes */
-               if (ifp->if_flags & IFF_MULTICAST) {
-                       u_int32_t  mcaf[2];
-
-                       if (ifp->if_flags & IFF_ALLMULTI) {
-                               mcaf[0] = 0xffffffff;
-                               mcaf[1] = 0xffffffff;
-                       } else
-                               ds_getmcaf(sc, mcaf);
-
-                       /*
-                        * Set multicast filter on chip.
-                        */
-                       for (i = 0; i < 8; i++)
-                               ed_nic_outb(sc, ED_P1_MAR(i), ((u_char *) mcaf)[i]);
-
-                       /* Set page 0 registers */
-                       ed_nic_outb(sc, ED_P0_CR, sc->cr_proto | ED_CR_STP);
-
-                       ed_nic_outb(sc, ED_P0_RCR, ED_RCR_AM | ED_RCR_AB | reg1);
-               } else {
-
-                       /*
-                        * Initialize multicast address hashing registers to
-                        * not accept multicasts.
-                        */
-                       for (i = 0; i < 8; ++i)
-                               ed_nic_outb(sc, ED_P1_MAR(i), 0x00);
-
-                       /* Set page 0 registers */
-                       ed_nic_outb(sc, ED_P0_CR, sc->cr_proto | ED_CR_STP);
-
-                       ed_nic_outb(sc, ED_P0_RCR, ED_RCR_AB | reg1);
-               }
-       }
-
-       /*
-        * Start interface.
-        */
-       ed_nic_outb(sc, ED_P0_CR, sc->cr_proto | ED_CR_STA);
-}
-
-/*
- * Compute crc for ethernet address
- */
-static uint32_t
-ds_mchash(const uint8_t *addr)
-{
-#define ED_POLYNOMIAL 0x04c11db6
-       uint32_t crc = 0xffffffff;
-       int carry, idx, bit;
-       uint8_t data;
-
-       for (idx = 6; --idx >= 0;) {
-               for (data = *addr++, bit = 8; --bit >= 0; data >>=1 ) {
-                       carry = ((crc & 0x80000000) ? 1 : 0) ^ (data & 0x01);
-                       crc <<= 1;
-                       if (carry)
-                               crc = (crc ^ ED_POLYNOMIAL) | carry;
-               }
-       }
-       return crc;
-#undef POLYNOMIAL
-}
-
-/*
- * Compute the multicast address filter from the
- * list of multicast addresses we need to listen to.
- */
-static void
-ds_getmcaf(struct ed_softc *sc, u_int32_t *mcaf)
-{
-       u_int32_t index;
-       u_char *af = (u_char *) mcaf;
-       struct ifmultiaddr *ifma;
-
-       mcaf[0] = 0;
-       mcaf[1] = 0;
-
-       TAILQ_FOREACH(ifma, &sc->arpcom.ac_if.if_multiaddrs, ifma_link) {
-               if (ifma->ifma_addr->sa_family != AF_LINK)
-                       continue;
-               index = ds_mchash(LLADDR((struct sockaddr_dl *)ifma->ifma_addr))
-                       >> 26;
-               af[index >> 3] |= 1 << (index & 7);
-       }
-}
diff --git a/sys/dev/netif/ed/if_ed_pccard.c b/sys/dev/netif/ed/if_ed_pccard.c
deleted file mode 100644 (file)
index 8d952b6..0000000
+++ /dev/null
@@ -1,541 +0,0 @@
-/*
- * Copyright (c) 1995, David Greenman
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice unmodified, this list of conditions, and the following
- *    disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD: src/sys/dev/ed/if_ed_pccard.c,v 1.55 2003/12/31 04:25:00 kato Exp $
- */
-
-#include "opt_ed.h"
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/socket.h>
-#include <sys/kernel.h>
-#include <sys/conf.h>
-#include <sys/uio.h>
-#include <sys/module.h>
-#include <sys/interrupt.h>
-#include <sys/bus.h>
-#include <sys/rman.h>
-
-#include <net/ethernet.h>
-#include <net/if.h>
-#include <net/if_arp.h>
-#include <net/if_mib.h>
-#include <net/if_media.h>
-#include <net/ifq_var.h>
-
-#include "if_edreg.h"
-#include "if_edvar.h"
-#include <bus/pccard/pccard_cis.h>
-#include <bus/pccard/pccardvar.h>
-#ifndef ED_NO_MIIBUS
-#include <dev/netif/mii_layer/mii.h>
-#include <dev/netif/mii_layer/miivar.h>
-#endif
-
-#include "card_if.h"
-#include "pccarddevs.h"
-#ifndef ED_NO_MIIBUS
-/* "device miibus" required.  See GENERIC if you get errors here. */
-#include "miibus_if.h"
-
-MODULE_DEPEND(ed, miibus, 1, 1, 1);
-#endif
-MODULE_DEPEND(ed, pccard, 1, 1, 1);
-
-/*
- *      PC-Card (PCMCIA) specific code.
- */
-static int     ed_pccard_match(device_t);
-static int     ed_pccard_probe(device_t);
-static int     ed_pccard_attach(device_t);
-static int     ed_pccard_detach(device_t);
-
-static int     ed_pccard_Linksys(device_t dev);
-static int     ed_pccard_ax88190(device_t dev);
-
-static void    ax88190_geteprom(struct ed_softc *);
-static int     ed_pccard_memwrite(device_t dev, off_t offset, u_char byte);
-#ifndef ED_NO_MIIBUS
-static void    ed_pccard_dlink_mii_reset(struct ed_softc *sc);
-static u_int   ed_pccard_dlink_mii_readbits(struct ed_softc *sc, int nbits);
-static void    ed_pccard_dlink_mii_writebits(struct ed_softc *sc, u_int val,
-    int nbits);
-#endif
-
-/*
- *      ed_pccard_detach - unload the driver and clear the table.
- *      XXX TODO:
- *      This is usually called when the card is ejected, but
- *      can be caused by a modunload of a controller driver.
- *      The idea is to reset the driver's view of the device
- *      and ensure that any driver entry points such as
- *      read and write do not hang.
- */
-static int
-ed_pccard_detach(device_t dev)
-{
-       struct ed_softc *sc = device_get_softc(dev);
-       struct ifnet *ifp = &sc->arpcom.ac_if;
-
-       lwkt_serialize_enter(ifp->if_serializer);
-
-       if (sc->gone) {
-               device_printf(dev, "already unloaded\n");
-               lwkt_serialize_exit(ifp->if_serializer);
-               return (0);
-       }
-       ed_stop(sc);
-       ifp->if_flags &= ~IFF_RUNNING;
-       sc->gone = 1;
-       bus_teardown_intr(dev, sc->irq_res, sc->irq_handle);
-
-       lwkt_serialize_exit(ifp->if_serializer);
-
-       ether_ifdetach(ifp);
-       ed_release_resources(dev);
-       return (0);
-}
-
-static const struct ed_product {
-       struct pccard_product   prod;
-       int flags;
-#define        NE2000DVF_DL10019       0x0001          /* chip is D-Link DL10019 */
-#define        NE2000DVF_AX88190       0x0002          /* chip is ASIX AX88190 */
-} ed_pccard_products[] = {
-       { PCMCIA_CARD(ACCTON, EN2212, 0), 0},
-       { PCMCIA_CARD(ALLIEDTELESIS, LA_PCM, 0), 0},
-       { PCMCIA_CARD(AMBICOM, AMB8002T, 0), 0},
-       { PCMCIA_CARD(BILLIONTON, LNT10TN, 0), 0},
-       { PCMCIA_CARD(BILLIONTON, CFLT10N, 0), 0},
-       { PCMCIA_CARD(BUFFALO, LPC3_CLT,  0), 0},
-       { PCMCIA_CARD(BUFFALO, LPC3_CLX,  0), NE2000DVF_AX88190},
-       { PCMCIA_CARD(BUFFALO, LPC_CF_CLT,  0), 0},
-       { PCMCIA_CARD(CNET, NE2000, 0), 0},
-       { PCMCIA_CARD(COMPEX, LINKPORT_ENET_B, 0), 0},
-       { PCMCIA_CARD(COREGA, ETHER_II_PCC_T, 0), 0},
-       { PCMCIA_CARD(COREGA, ETHER_II_PCC_TD, 0), 0},
-       { PCMCIA_CARD(COREGA, ETHER_PCC_T, 0), 0},
-       { PCMCIA_CARD(COREGA, ETHER_PCC_TD, 0), 0},
-       { PCMCIA_CARD(COREGA, FAST_ETHER_PCC_TX, 0), NE2000DVF_DL10019 },
-       { PCMCIA_CARD(COREGA, FETHER_PCC_TXD, 0), NE2000DVF_AX88190 },
-       { PCMCIA_CARD(COREGA, FETHER_PCC_TXF, 0), NE2000DVF_DL10019 },
-       { PCMCIA_CARD(DAYNA, COMMUNICARD_E_1, 0), 0},
-       { PCMCIA_CARD(DAYNA, COMMUNICARD_E_2, 0), 0},
-       { PCMCIA_CARD(DLINK, DE650, 0), 0},
-       { PCMCIA_CARD(DLINK, DE660, 0), 0 },
-       { PCMCIA_CARD(DLINK, DE660PLUS, 0), 0},
-       { PCMCIA_CARD(DLINK, DFE670TXD, 0), NE2000DVF_DL10019},
-       { PCMCIA_CARD(DYNALINK, L10C, 0), 0},
-       { PCMCIA_CARD(EDIMAX, EP4000A, 0), 0},
-       { PCMCIA_CARD(EPSON, EEN10B, 0), 0},
-       { PCMCIA_CARD(EXP, THINLANCOMBO, 0), 0},
-       { PCMCIA_CARD(IBM, INFOMOVER, 0), 0},
-       { PCMCIA_CARD(IODATA3, PCLAT, 0), 0},
-       { PCMCIA_CARD(KINGSTON, KNE2, 0), 0},
-       { PCMCIA_CARD(LANTECH, FASTNETTX, 0),NE2000DVF_AX88190 },
-       { PCMCIA_CARD(LINKSYS, COMBO_ECARD, 0), NE2000DVF_DL10019 },
-       { PCMCIA_CARD(LINKSYS, ECARD_1, 0), 0},
-       { PCMCIA_CARD(LINKSYS, ECARD_2, 0), 0},
-       { PCMCIA_CARD(LINKSYS, ETHERFAST, 0), NE2000DVF_DL10019 },
-       { PCMCIA_CARD(LINKSYS, TRUST_COMBO_ECARD, 0), 0},
-       { PCMCIA_CARD(MACNICA, ME1_JEIDA, 0), 0},
-       { PCMCIA_CARD(MELCO, LPC3_CLX,  0), NE2000DVF_AX88190},
-       { PCMCIA_CARD(MELCO, LPC3_TX, 0), NE2000DVF_AX88190 },
-       { PCMCIA_CARD(NDC, ND5100_E, 0), 0},
-       { PCMCIA_CARD(NETGEAR, FA410TXC, 0), NE2000DVF_DL10019},
-       { PCMCIA_CARD(NETGEAR, FA411, 0), NE2000DVF_AX88190},
-       { PCMCIA_CARD(NEXTCOM, NEXTHAWK, 0), 0},
-       { PCMCIA_CARD(OEM2, ETHERNET, 0), 0},
-       { PCMCIA_CARD(PLANET, SMARTCOM2000, 0), 0 },
-       { PCMCIA_CARD(PREMAX, PE200, 0), 0},
-       { PCMCIA_CARD(RACORE, ETHERNET, 0), 0},
-       { PCMCIA_CARD(RPTI, EP400, 0), 0},
-       { PCMCIA_CARD(RPTI, EP401, 0), 0},
-       { PCMCIA_CARD(SMC, EZCARD, 0), 0},
-       { PCMCIA_CARD(SOCKET, EA_ETHER, 0), 0},
-       { PCMCIA_CARD(SOCKET, LP_ETHER, 0), 0},
-       { PCMCIA_CARD(SOCKET, LP_ETHER_CF, 0), 0},
-       { PCMCIA_CARD(SOCKET, LP_ETH_10_100_CF, 0), NE2000DVF_DL10019},
-       { PCMCIA_CARD(SVEC, COMBOCARD, 0), 0},
-       { PCMCIA_CARD(SVEC, LANCARD, 0), 0},
-       { PCMCIA_CARD(TAMARACK, ETHERNET, 0), 0},
-       { PCMCIA_CARD(TDK, LAK_CD031, 0), 0},
-       { PCMCIA_CARD(TELECOMDEVICE, TCD_HPC100, 0), NE2000DVF_AX88190 },
-       { PCMCIA_CARD(XIRCOM, CFE_10, 0), 0},
-       { PCMCIA_CARD(ZONET, ZEN, 0), 0},
-       { { NULL } }
-};
-
-static int
-ed_pccard_match(device_t dev)
-{
-       const struct ed_product *pp;
-
-       if ((pp = (const struct ed_product *) pccard_product_lookup(dev, 
-           (const struct pccard_product *) ed_pccard_products,
-           sizeof(ed_pccard_products[0]), NULL)) != NULL) {
-               if (pp->prod.pp_name != NULL)
-                       device_set_desc(dev, pp->prod.pp_name);
-               if (pp->flags & NE2000DVF_DL10019)
-                       device_set_flags(dev, ED_FLAGS_LINKSYS);
-               else if (pp->flags & NE2000DVF_AX88190)
-                       device_set_flags(dev, ED_FLAGS_AX88190);
-               return (0);
-       }
-       return (EIO);
-}
-
-/* 
- * Probe framework for pccards.  Replicates the standard framework,
- * minus the pccard driver registration and ignores the ether address
- * supplied (from the CIS), relying on the probe to find it instead.
- */
-static int
-ed_pccard_probe(device_t dev)
-{
-       int     error;
-       int     flags = device_get_flags(dev);
-
-       if (ED_FLAGS_GETTYPE(flags) == ED_FLAGS_AX88190) {
-               error = ed_pccard_ax88190(dev);
-               goto end2;
-       }
-
-       error = ed_probe_Novell(dev, 0, flags);
-       if (error == 0)
-               goto end;
-       ed_release_resources(dev);
-
-       error = ed_probe_WD80x3(dev, 0, flags);
-       if (error == 0)
-               goto end;
-       ed_release_resources(dev);
-       goto end2;
-
-end:
-       if (ED_FLAGS_GETTYPE(flags) & ED_FLAGS_LINKSYS)
-               ed_pccard_Linksys(dev);
-end2:
-       if (error == 0)
-               error = ed_alloc_irq(dev, 0, 0);
-
-       ed_release_resources(dev);
-       return (error);
-}
-
-static int
-ed_pccard_attach(device_t dev)
-{
-       struct ed_softc *sc = device_get_softc(dev);
-       struct ifnet *ifp = &sc->arpcom.ac_if;
-       int error;
-       int i;
-       uint8_t sum;
-       const uint8_t *ether_addr;
-       
-       if (sc->port_used > 0)
-               ed_alloc_port(dev, sc->port_rid, sc->port_used);
-       if (sc->mem_used)
-               ed_alloc_memory(dev, sc->mem_rid, sc->mem_used);
-       ed_alloc_irq(dev, sc->irq_rid, 0);
-               
-       if (sc->vendor != ED_VENDOR_LINKSYS) {
-               ether_addr = pccard_get_ether(dev);
-               for (i = 0, sum = 0; i < ETHER_ADDR_LEN; i++)
-                       sum |= ether_addr[i];
-               if (sum)
-                       bcopy(ether_addr, sc->arpcom.ac_enaddr, ETHER_ADDR_LEN);
-       }
-
-       error = ed_attach(dev);
-#ifndef ED_NO_MIIBUS
-       if (error == 0 && sc->vendor == ED_VENDOR_LINKSYS) {
-               /* Probe for an MII bus, but ignore errors. */
-               ed_pccard_dlink_mii_reset(sc);
-               sc->mii_readbits = ed_pccard_dlink_mii_readbits;
-               sc->mii_writebits = ed_pccard_dlink_mii_writebits;
-               mii_phy_probe(dev, &sc->miibus, ed_ifmedia_upd,
-                   ed_ifmedia_sts);
-       }
-#endif
-
-       ifq_set_cpuid(&ifp->if_snd, rman_get_cpuid(sc->irq_res));
-
-       error = bus_setup_intr(dev, sc->irq_res, INTR_MPSAFE,
-                              edintr, sc, &sc->irq_handle,
-                              ifp->if_serializer);
-       if (error) {
-               kprintf("setup intr failed %d \n", error);
-               ed_release_resources(dev);
-               return (error);
-       }
-
-       return (error);
-}
-
-static void
-ax88190_geteprom(struct ed_softc *sc)
-{
-       int prom[16],i;
-       u_char tmp;
-       struct {
-               u_char offset, value;
-       } pg_seq[] = {
-               {ED_P0_CR, ED_CR_RD2|ED_CR_STP},        /* Select Page0 */
-               {ED_P0_DCR, 0x01},
-               {ED_P0_RBCR0, 0x00},                    /* Clear the count regs. */
-               {ED_P0_RBCR1, 0x00},
-               {ED_P0_IMR, 0x00},                      /* Mask completion irq. */
-               {ED_P0_ISR, 0xff},
-               {ED_P0_RCR, ED_RCR_MON | ED_RCR_INTT},  /* Set To Monitor */
-               {ED_P0_TCR, ED_TCR_LB0},                /* loopback mode. */
-               {ED_P0_RBCR0, 32},
-               {ED_P0_RBCR1, 0x00},
-               {ED_P0_RSAR0, 0x00},
-               {ED_P0_RSAR1, 0x04},
-               {ED_P0_CR ,ED_CR_RD0 | ED_CR_STA},
-       };
-
-       /* Reset Card */
-       tmp = ed_asic_inb(sc, ED_NOVELL_RESET);
-       ed_asic_outb(sc, ED_NOVELL_RESET, tmp);
-       DELAY(5000);
-       ed_asic_outb(sc, ED_P0_CR, ED_CR_RD2 | ED_CR_STP);
-       DELAY(5000);
-
-       /* Card Settings */
-       for (i = 0; i < NELEM(pg_seq); i++)
-               ed_nic_outb(sc, pg_seq[i].offset, pg_seq[i].value);
-
-       /* Get Data */
-       for (i = 0; i < 16; i++)
-               prom[i] = ed_asic_inb(sc, 0);
-       sc->arpcom.ac_enaddr[0] = prom[0] & 0xff;
-       sc->arpcom.ac_enaddr[1] = prom[0] >> 8;
-       sc->arpcom.ac_enaddr[2] = prom[1] & 0xff;
-       sc->arpcom.ac_enaddr[3] = prom[1] >> 8;
-       sc->arpcom.ac_enaddr[4] = prom[2] & 0xff;
-       sc->arpcom.ac_enaddr[5] = prom[2] >> 8;
-}
-
-static int
-ed_pccard_memwrite(device_t dev, off_t offset, u_char byte)
-{
-       int cis_rid;
-       struct resource *cis;
-       
-       cis_rid = 0;
-       cis = bus_alloc_resource(dev, SYS_RES_MEMORY, &cis_rid, 0, ~0,
-                                4 << 10, RF_ACTIVE | RF_SHAREABLE);
-       if (cis == NULL)
-               return (ENXIO);
-       CARD_SET_RES_FLAGS(device_get_parent(dev), dev, SYS_RES_MEMORY,
-                          cis_rid, PCCARD_A_MEM_ATTR);
-
-       bus_space_write_1(rman_get_bustag(cis), rman_get_bushandle(cis),
-                         offset, byte);
-
-       bus_deactivate_resource(dev, SYS_RES_MEMORY, cis_rid, cis);
-       bus_release_resource(dev, SYS_RES_MEMORY, cis_rid, cis);
-
-       return (0);
-}
-
-/*
- * Probe the Ethernet MAC addrees for PCMCIA Linksys EtherFast 10/100 
- * and compatible cards (DL10019C Ethernet controller).
- *
- * Note: The PAO patches try to use more memory for the card, but that
- * seems to fail for my card.  A future optimization would add this back
- * conditionally.
- */
-static int
-ed_pccard_Linksys(device_t dev)
-{
-       struct ed_softc *sc = device_get_softc(dev);
-       u_char sum;
-       int i;
-
-       /*
-        * Linksys registers(offset from ASIC base)
-        *
-        * 0x04-0x09 : Physical Address Register 0-5 (PAR0-PAR5)
-        * 0x0A      : Card ID Register (CIR)
-        * 0x0B      : Check Sum Register (SR)
-        */
-       for (sum = 0, i = 0x04; i < 0x0c; i++)
-               sum += ed_asic_inb(sc, i);
-       if (sum != 0xff)
-               return (0);             /* invalid DL10019C */
-       for (i = 0; i < ETHER_ADDR_LEN; i++) {
-               sc->arpcom.ac_enaddr[i] = ed_asic_inb(sc, 0x04 + i);
-       }
-
-       ed_nic_outb(sc, ED_P0_DCR, ED_DCR_WTS | ED_DCR_FT1 | ED_DCR_LS);
-       sc->isa16bit = 1;
-       sc->vendor = ED_VENDOR_LINKSYS;
-       sc->type = ED_TYPE_NE2000;
-       sc->type_str = "Linksys";
-
-       return (1);
-}
-
-/*
- * Special setup for AX88190
- */
-static int
-ed_pccard_ax88190(device_t dev)
-{
-       int     error;
-       int     flags = device_get_flags(dev);
-       int     iobase;
-       struct  ed_softc *sc = device_get_softc(dev);
-
-       /* Allocate the port resource during setup. */
-       error = ed_alloc_port(dev, 0, ED_NOVELL_IO_PORTS);
-       if (error)
-               return (error);
-
-       sc->asic_offset = ED_NOVELL_ASIC_OFFSET;
-       sc->nic_offset  = ED_NOVELL_NIC_OFFSET;
-       sc->chip_type = ED_CHIP_TYPE_AX88190;
-
-       /*
-        * Set Attribute Memory IOBASE Register.  Is this a deficiency in
-        * the PC Card layer, or an ax88190 specific issue? xxx
-        */
-       iobase = rman_get_start(sc->port_res);
-       ed_pccard_memwrite(dev, ED_AX88190_IOBASE0, iobase & 0xff);
-       ed_pccard_memwrite(dev, ED_AX88190_IOBASE1, (iobase >> 8) & 0xff);
-       ax88190_geteprom(sc);
-       ed_release_resources(dev);
-       error = ed_probe_Novell(dev, 0, flags);
-       if (error == 0) {
-               sc->vendor = ED_VENDOR_PCCARD;
-               sc->type = ED_TYPE_NE2000;
-               sc->type_str = "AX88190";
-       }
-       return (error);
-}
-
-#ifndef ED_NO_MIIBUS
-/* MII bit-twiddling routines for cards using Dlink chipset */
-#define DLINK_MIISET(sc, x) ed_asic_outb(sc, ED_DLINK_MIIBUS, \
-    ed_asic_inb(sc, ED_DLINK_MIIBUS) | (x))
-#define DLINK_MIICLR(sc, x) ed_asic_outb(sc, ED_DLINK_MIIBUS, \
-    ed_asic_inb(sc, ED_DLINK_MIIBUS) & ~(x))
-
-static void
-ed_pccard_dlink_mii_reset(struct ed_softc *sc)
-{
-       ed_asic_outb(sc, ED_DLINK_MIIBUS, 0);
-       DELAY(10);
-       DLINK_MIISET(sc, ED_DLINK_MII_RESET2);
-       DELAY(10);
-       DLINK_MIISET(sc, ED_DLINK_MII_RESET1);
-       DELAY(10);
-       DLINK_MIICLR(sc, ED_DLINK_MII_RESET1);
-       DELAY(10);
-       DLINK_MIICLR(sc, ED_DLINK_MII_RESET2);
-       DELAY(10);
-}
-
-static void
-ed_pccard_dlink_mii_writebits(struct ed_softc *sc, u_int val, int nbits)
-{
-       int i;
-
-       DLINK_MIISET(sc, ED_DLINK_MII_DIROUT);
-
-       for (i = nbits - 1; i >= 0; i--) {
-               if ((val >> i) & 1)
-                       DLINK_MIISET(sc, ED_DLINK_MII_DATAOUT);
-               else
-                       DLINK_MIICLR(sc, ED_DLINK_MII_DATAOUT);
-               DELAY(10);
-               DLINK_MIISET(sc, ED_DLINK_MII_CLK);
-               DELAY(10);
-               DLINK_MIICLR(sc, ED_DLINK_MII_CLK);
-               DELAY(10);
-       }
-}
-
-static u_int
-ed_pccard_dlink_mii_readbits(struct ed_softc *sc, int nbits)
-{
-       int i;
-       u_int val = 0;
-
-       DLINK_MIICLR(sc, ED_DLINK_MII_DIROUT);
-
-       for (i = nbits - 1; i >= 0; i--) {
-               DLINK_MIISET(sc, ED_DLINK_MII_CLK);
-               DELAY(10);
-               val <<= 1;
-               if (ed_asic_inb(sc, ED_DLINK_MIIBUS) & ED_DLINK_MII_DATATIN)
-                       val++;
-               DLINK_MIICLR(sc, ED_DLINK_MII_CLK);
-               DELAY(10);
-       }
-
-       return val;
-}
-#endif
-
-static device_method_t ed_pccard_methods[] = {
-       /* Device interface */
-       DEVMETHOD(device_probe,         pccard_compat_probe),
-       DEVMETHOD(device_attach,        pccard_compat_attach),
-       DEVMETHOD(device_detach,        ed_pccard_detach),
-
-#ifndef ED_NO_MIIBUS
-       /* Bus interface */
-       DEVMETHOD(bus_child_detached,   ed_child_detached),
-
-       /* MII interface */
-       DEVMETHOD(miibus_readreg,       ed_miibus_readreg),
-       DEVMETHOD(miibus_writereg,      ed_miibus_writereg),
-#endif
-
-       /* Card interface */
-       DEVMETHOD(card_compat_match,    ed_pccard_match),
-       DEVMETHOD(card_compat_probe,    ed_pccard_probe),
-       DEVMETHOD(card_compat_attach,   ed_pccard_attach),
-       DEVMETHOD_END
-};
-
-static driver_t ed_pccard_driver = {
-       "ed",
-       ed_pccard_methods,
-       sizeof(struct ed_softc)
-};
-
-DRIVER_MODULE(if_ed, pccard, ed_pccard_driver, ed_devclass, NULL, NULL);
-#ifndef ED_NO_MIIBUS
-MODULE_DEPEND(if_ed, miibus, 1, 1, 1);
-DRIVER_MODULE(miibus, ed, miibus_driver, miibus_devclass, NULL, NULL);
-#endif
diff --git a/sys/dev/netif/ed/if_ed_pci.c b/sys/dev/netif/ed/if_ed_pci.c
deleted file mode 100644 (file)
index 2a2acdb..0000000
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- *
- * Copyright (c) 1996 Stefan Esser <se@freebsd.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice immediately at the beginning of the file, without modification,
- *    this list of conditions, and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Absolutely no warranty of function or purpose is made by the author
- *    Stefan Esser.
- * 4. Modifications may be freely made to this file if the above conditions
- *    are met.
- *
- * $FreeBSD: src/sys/dev/ed/if_ed_pci.c,v 1.34 2003/10/31 18:31:58 brooks Exp $
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/socket.h>
-#include <sys/kernel.h>
-#include <sys/module.h>
-#include <sys/interrupt.h>
-#include <sys/bus.h>
-#include <sys/rman.h>
-
-#include <net/if.h>
-#include <net/if_arp.h>
-#include <net/if_mib.h>
-#include <net/ifq_var.h>
-
-#include "pcidevs.h"
-#include <bus/pci/pcireg.h>
-#include <bus/pci/pcivar.h>
-
-#include "if_edvar.h"
-
-static int ed_pci_detach(device_t dev);
-
-static struct ed_type {
-       uint16_t         ed_vid;
-       uint16_t         ed_did;
-       const char      *ed_name;
-} ed_devs[] = {
-       { PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8029,
-               "NE2000 PCI Ethernet (RealTek 8029)" },
-       { PCI_VENDOR_NETVIN, PCI_PRODUCT_NETVIN_5000,
-               "NE2000 PCI Ethernet (NetVin 5000)" },
-       { PCI_VENDOR_PROLAN, PCI_PRODUCT_PROLAN_NE2KETHER,
-               "NE2000 PCI Ethernet (ProLAN)" },
-       { PCI_VENDOR_COMPEX, PCI_PRODUCT_COMPEX_NE2KETHER,
-               "NE2000 PCI Ethernet (Compex)" },
-       { PCI_VENDOR_KTI, PCI_PRODUCT_KTI_NE2KETHER,
-               "NE2000 PCI Ethernet (KTI)" },
-       { PCI_VENDOR_WINBOND, PCI_PRODUCT_WINBOND_W89C940F,
-               "NE2000 PCI Ethernet (Winbond W89C940)" },
-       { PCI_VENDOR_SURECOM, PCI_PRODUCT_SURECOM_NE34,
-               "NE2000 PCI Ethernet (Surecom NE-34)" },
-       { PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT86C926,
-               "NE2000 PCI Ethernet (VIA VT86C926)" },
-       { 0, 0, NULL }
-};
-
-static int     ed_pci_probe    (device_t);
-static int     ed_pci_attach   (device_t);
-
-static int
-ed_pci_probe(device_t dev)
-{
-       struct ed_type *t;
-       uint16_t product = pci_get_device(dev);
-       uint16_t vendor = pci_get_vendor(dev);
-
-       for (t = ed_devs; t->ed_name != NULL; t++) {
-               if (vendor == t->ed_vid && product == t->ed_did) {
-                       device_set_desc(dev, t->ed_name);
-                       return 0;
-               }
-       }
-       return ENXIO;
-}
-
-static int
-ed_pci_attach(device_t dev)
-{
-        struct ed_softc *sc = device_get_softc(dev);
-        int    flags = 0;
-        int    error;
-
-        error = ed_probe_Novell(dev, PCIR_MAPS, flags);
-        if (error)
-                return (error);
-
-        error = ed_alloc_irq(dev, 0, RF_SHAREABLE);
-        if (error) {
-                ed_release_resources(dev);
-                return (error);
-        }
-
-       error = ed_attach(dev);
-       if (error == 0) {
-               struct ifnet *ifp = &sc->arpcom.ac_if;
-
-               ifq_set_cpuid(&ifp->if_snd, rman_get_cpuid(sc->irq_res));
-
-               error = bus_setup_intr(dev, sc->irq_res, INTR_MPSAFE,
-                                      edintr, sc, &sc->irq_handle,
-                                      ifp->if_serializer);
-               if (error)
-                       ed_pci_detach(dev);
-       } else {
-                ed_release_resources(dev);
-       }
-       return (error);
-}
-
-static int
-ed_pci_detach(device_t dev)
-{
-       struct ed_softc *sc = device_get_softc(dev);
-       struct ifnet *ifp = &sc->arpcom.ac_if;
-
-       lwkt_serialize_enter(ifp->if_serializer);
-
-       if (sc->gone) {
-               device_printf(dev, "already unloaded\n");
-               lwkt_serialize_exit(ifp->if_serializer);
-               return (0);
-       }
-       ed_stop(sc);
-       ifp->if_flags &= ~IFF_RUNNING;
-       sc->gone = 1;
-       bus_teardown_intr(dev, sc->irq_res, sc->irq_handle);
-
-       lwkt_serialize_exit(ifp->if_serializer);
-
-       ether_ifdetach(ifp);
-       ed_release_resources(dev);
-       return (0);
-}
-
-static device_method_t ed_pci_methods[] = {
-       /* Device interface */
-       DEVMETHOD(device_probe,         ed_pci_probe),
-       DEVMETHOD(device_attach,        ed_pci_attach),
-       DEVMETHOD(device_attach,        ed_pci_detach),
-
-       DEVMETHOD_END
-};
-
-static driver_t ed_pci_driver = {
-       "ed",
-       ed_pci_methods,
-       sizeof(struct ed_softc),
-};
-
-DRIVER_MODULE(ed, pci, ed_pci_driver, ed_devclass, NULL, NULL);
-MODULE_DEPEND(ed, pci, 1, 1, 1);
diff --git a/sys/dev/netif/ed/if_edreg.h b/sys/dev/netif/ed/if_edreg.h
deleted file mode 100644 (file)
index 0dd2e6d..0000000
+++ /dev/null
@@ -1,1155 +0,0 @@
-/*
- * Copyright (C) 1993, David Greenman. This software may be used, modified,
- *   copied, distributed, and sold, in both source and binary form provided
- *   that the above copyright and these terms are retained. Under no
- *   circumstances is the author responsible for the proper functioning
- *   of this software, nor does the author assume any responsibility
- *   for damages incurred with its use.
- *
- * $FreeBSD: src/sys/dev/ed/if_edreg.h,v 1.32 2003/10/15 17:22:15 shiba Exp $
- * $DragonFly: src/sys/dev/netif/ed/if_edreg.h,v 1.4 2004/02/13 21:15:12 joerg Exp $
- */
-/*
- * National Semiconductor DS8390 NIC register definitions
- *
- *
- * Modification history
- *
- * Revision 2.2  1993/11/29  16:33:39  davidg
- * From Thomas Sandford <t.d.g.sandford@comp.brad.ac.uk>
- * Add support for the 8013W board type
- *
- * Revision 2.1  1993/11/22  10:52:33  davidg
- * patch to add support for SMC8216 (Elite-Ultra) boards
- * from Glen H. Lowe
- *
- * Revision 2.0  93/09/29  00:37:15  davidg
- * changed double buffering flag to multi buffering
- * made changes/additions for 3c503 multi-buffering
- * ...companion to Rev. 2.0 of 'ed' driver.
- *
- * Revision 1.1  93/06/23  03:01:07  davidg
- * Initial revision
- *
- */
-
-/*
- * Page 0 register offsets
- */
-#define ED_P0_CR       0x00    /* Command Register */
-
-#define ED_P0_CLDA0    0x01    /* Current Local DMA Addr low (read) */
-#define ED_P0_PSTART   0x01    /* Page Start register (write) */
-
-#define ED_P0_CLDA1    0x02    /* Current Local DMA Addr high (read) */
-#define ED_P0_PSTOP    0x02    /* Page Stop register (write) */
-
-#define ED_P0_BNRY     0x03    /* Boundary Pointer */
-
-#define ED_P0_TSR      0x04    /* Transmit Status Register (read) */
-#define ED_P0_TPSR     0x04    /* Transmit Page Start (write) */
-
-#define ED_P0_NCR      0x05    /* Number of Collisions Reg (read) */
-#define ED_P0_TBCR0    0x05    /* Transmit Byte count, low (write) */
-
-#define ED_P0_FIFO     0x06    /* FIFO register (read) */
-#define ED_P0_TBCR1    0x06    /* Transmit Byte count, high (write) */
-
-#define ED_P0_ISR      0x07    /* Interrupt Status Register */
-
-#define ED_P0_CRDA0    0x08    /* Current Remote DMA Addr low (read) */
-#define ED_P0_RSAR0    0x08    /* Remote Start Address low (write) */
-
-#define ED_P0_CRDA1    0x09    /* Current Remote DMA Addr high (read) */
-#define ED_P0_RSAR1    0x09    /* Remote Start Address high (write) */
-
-#define ED_P0_RBCR0    0x0a    /* Remote Byte Count low (write) */
-
-#define ED_P0_RBCR1    0x0b    /* Remote Byte Count high (write) */
-
-#define ED_P0_RSR      0x0c    /* Receive Status (read) */
-#define ED_P0_RCR      0x0c    /* Receive Configuration Reg (write) */
-
-#define ED_P0_CNTR0    0x0d    /* frame alignment error counter (read) */
-#define ED_P0_TCR      0x0d    /* Transmit Configuration Reg (write) */
-
-#define ED_P0_CNTR1    0x0e    /* CRC error counter (read) */
-#define ED_P0_DCR      0x0e    /* Data Configuration Reg (write) */
-
-#define ED_P0_CNTR2    0x0f    /* missed packet counter (read) */
-#define ED_P0_IMR      0x0f    /* Interrupt Mask Register (write) */
-
-/*
- * Page 1 register offsets
- */
-#define ED_P1_CR       0x00    /* Command Register */
-#define ED_P1_PAR0     0x01    /* Physical Address Register 0 */
-#define ED_P1_PAR1     0x02    /* Physical Address Register 1 */
-#define ED_P1_PAR2     0x03    /* Physical Address Register 2 */
-#define ED_P1_PAR3     0x04    /* Physical Address Register 3 */
-#define ED_P1_PAR4     0x05    /* Physical Address Register 4 */
-#define ED_P1_PAR5     0x06    /* Physical Address Register 5 */
-#define ED_P1_PAR(i)   (ED_P1_PAR0 + i)
-#define ED_P1_CURR     0x07    /* Current RX ring-buffer page */
-#define ED_P1_MAR0     0x08    /* Multicast Address Register 0 */
-#define ED_P1_MAR1     0x09    /* Multicast Address Register 1 */
-#define ED_P1_MAR2     0x0a    /* Multicast Address Register 2 */
-#define ED_P1_MAR3     0x0b    /* Multicast Address Register 3 */
-#define ED_P1_MAR4     0x0c    /* Multicast Address Register 4 */
-#define ED_P1_MAR5     0x0d    /* Multicast Address Register 5 */
-#define ED_P1_MAR6     0x0e    /* Multicast Address Register 6 */
-#define ED_P1_MAR7     0x0f    /* Multicast Address Register 7 */
-#define ED_P1_MAR(i)   (ED_P1_MAR0 + i)
-
-/*
- * Page 2 register offsets
- */
-#define ED_P2_CR       0x00    /* Command Register */
-#define ED_P2_PSTART   0x01    /* Page Start (read) */
-#define ED_P2_CLDA0    0x01    /* Current Local DMA Addr 0 (write) */
-#define ED_P2_PSTOP    0x02    /* Page Stop (read) */
-#define ED_P2_CLDA1    0x02    /* Current Local DMA Addr 1 (write) */
-#define ED_P2_RNPP     0x03    /* Remote Next Packet Pointer */
-#define ED_P2_TPSR     0x04    /* Transmit Page Start (read) */
-#define ED_P2_LNPP     0x05    /* Local Next Packet Pointer */
-#define ED_P2_ACU      0x06    /* Address Counter Upper */
-#define ED_P2_ACL      0x07    /* Address Counter Lower */
-#define ED_P2_RCR      0x0c    /* Receive Configuration Register (read) */
-#define ED_P2_TCR      0x0d    /* Transmit Configuration Register (read) */
-#define ED_P2_DCR      0x0e    /* Data Configuration Register (read) */
-#define ED_P2_IMR      0x0f    /* Interrupt Mask Register (read) */
-
-/*
- *             Command Register (CR) definitions
- */
-
-/*
- * STP: SToP. Software reset command. Takes the controller offline. No
- *     packets will be received or transmitted. Any reception or
- *     transmission in progress will continue to completion before
- *     entering reset state. To exit this state, the STP bit must
- *     reset and the STA bit must be set. The software reset has
- *     executed only when indicated by the RST bit in the ISR being
- *     set.
- */
-#define ED_CR_STP      0x01
-
-/*
- * STA: STArt. This bit is used to activate the NIC after either power-up,
- *     or when the NIC has been put in reset mode by software command
- *     or error.
- */
-#define ED_CR_STA      0x02
-
-/*
- * TXP: Transmit Packet. This bit must be set to indicate transmission of
- *     a packet. TXP is internally reset either after the transmission is
- *     completed or aborted. This bit should be set only after the Transmit
- *     Byte Count and Transmit Page Start register have been programmed.
- */
-#define ED_CR_TXP      0x04
-
-/*
- * RD0, RD1, RD2: Remote DMA Command. These three bits control the operation
- *     of the remote DMA channel. RD2 can be set to abort any remote DMA
- *     command in progress. The Remote Byte Count registers should be cleared
- *     when a remote DMA has been aborted. The Remote Start Addresses are not
- *     restored to the starting address if the remote DMA is aborted.
- *
- *     RD2 RD1 RD0     function
- *      0   0   0      not allowed
- *      0   0   1      remote read
- *      0   1   0      remote write
- *      0   1   1      send packet
- *      1   X   X      abort
- */
-#define ED_CR_RD0      0x08
-#define ED_CR_RD1      0x10
-#define ED_CR_RD2      0x20
-
-/*
- * PS0, PS1: Page Select. The two bits select which register set or 'page' to
- *     access.
- *
- *     PS1 PS0         page
- *      0   0          0
- *      0   1          1
- *      1   0          2
- *      1   1          reserved
- */
-#define ED_CR_PS0      0x40
-#define ED_CR_PS1      0x80
-/* bit encoded aliases */
-#define ED_CR_PAGE_0   0x00 /* (for consistency) */
-#define ED_CR_PAGE_1   0x40
-#define ED_CR_PAGE_2   0x80
-
-/*
- *             Interrupt Status Register (ISR) definitions
- */
-
-/*
- * PRX: Packet Received. Indicates packet received with no errors.
- */
-#define ED_ISR_PRX     0x01
-
-/*
- * PTX: Packet Transmitted. Indicates packet transmitted with no errors.
- */
-#define ED_ISR_PTX     0x02
-
-/*
- * RXE: Receive Error. Indicates that a packet was received with one or more
- *     the following errors: CRC error, frame alignment error, FIFO overrun,
- *     missed packet.
- */
-#define ED_ISR_RXE     0x04
-
-/*
- * TXE: Transmission Error. Indicates that an attempt to transmit a packet
- *     resulted in one or more of the following errors: excessive
- *     collisions, FIFO underrun.
- */
-#define ED_ISR_TXE     0x08
-
-/*
- * OVW: OverWrite. Indicates a receive ring-buffer overrun. Incoming network
- *     would exceed (has exceeded?) the boundary pointer, resulting in data
- *     that was previously received and not yet read from the buffer to be
- *     overwritten.
- */
-#define ED_ISR_OVW     0x10
-
-/*
- * CNT: Counter Overflow. Set when the MSB of one or more of the Network Talley
- *     Counters has been set.
- */
-#define ED_ISR_CNT     0x20
-
-/*
- * RDC: Remote Data Complete. Indicates that a Remote DMA operation has completed.
- */
-#define ED_ISR_RDC     0x40
-
-/*
- * RST: Reset status. Set when the NIC enters the reset state and cleared when a
- *     Start Command is issued to the CR. This bit is also set when a receive
- *     ring-buffer overrun (OverWrite) occurs and is cleared when one or more
- *     packets have been removed from the ring. This is a read-only bit.
- */
-#define ED_ISR_RST     0x80
-
-/*
- *             Interrupt Mask Register (IMR) definitions
- */
-
-/*
- * PRXE: Packet Received interrupt Enable. If set, a received packet will cause
- *     an interrupt.
- */
-#define ED_IMR_PRXE    0x01
-
-/*
- * PTXE: Packet Transmit interrupt Enable. If set, an interrupt is generated when
- *     a packet transmission completes.
- */
-#define ED_IMR_PTXE    0x02
-
-/*
- * RXEE: Receive Error interrupt Enable. If set, an interrupt will occur whenever a
- *     packet is received with an error.
- */
-#define ED_IMR_RXEE    0x04
-
-/*
- * TXEE: Transmit Error interrupt Enable. If set, an interrupt will occur whenever
- *     a transmission results in an error.
- */
-#define ED_IMR_TXEE    0x08
-
-/*
- * OVWE: OverWrite error interrupt Enable. If set, an interrupt is generated whenever
- *     the receive ring-buffer is overrun. i.e. when the boundary pointer is exceeded.
- */
-#define ED_IMR_OVWE    0x10
-
-/*
- * CNTE: Counter overflow interrupt Enable. If set, an interrupt is generated whenever
- *     the MSB of one or more of the Network Statistics counters has been set.
- */
-#define ED_IMR_CNTE    0x20
-
-/*
- * RDCE: Remote DMA Complete interrupt Enable. If set, an interrupt is generated
- *     when a remote DMA transfer has completed.
- */
-#define ED_IMR_RDCE    0x40
-
-/*
- * bit 7 is unused/reserved
- */
-
-/*
- *             Data Configuration Register (DCR) definitions
- */
-
-/*
- * WTS: Word Transfer Select. WTS establishes byte or word transfers for
- *     both remote and local DMA transfers
- */
-#define ED_DCR_WTS     0x01
-
-/*
- * BOS: Byte Order Select. BOS sets the byte order for the host.
- *     Should be 0 for 80x86, and 1 for 68000 series processors
- */
-#define ED_DCR_BOS     0x02
-
-/*
- * LAS: Long Address Select. When LAS is 1, the contents of the remote
- *     DMA registers RSAR0 and RSAR1 are used to provide A16-A31
- */
-#define ED_DCR_LAS     0x04
-
-/*
- * LS: Loopback Select. When 0, loopback mode is selected. Bits D1 and D2
- *     of the TCR must also be programmed for loopback operation.
- *     When 1, normal operation is selected.
- */
-#define ED_DCR_LS      0x08
-
-/*
- * AR: Auto-initialize Remote. When 0, data must be removed from ring-buffer
- *     under program control. When 1, remote DMA is automatically initiated
- *     and the boundary pointer is automatically updated
- */
-#define ED_DCR_AR      0x10
-
-/*
- * FT0, FT1: Fifo Threshold select.
- *             FT1     FT0     Word-width      Byte-width
- *              0       0      1 word          2 bytes
- *              0       1      2 words         4 bytes
- *              1       0      4 words         8 bytes
- *              1       1      8 words         12 bytes
- *
- *     During transmission, the FIFO threshold indicates the number of bytes
- *     or words that the FIFO has filled from the local DMA before BREQ is
- *     asserted. The transmission threshold is 16 bytes minus the receiver
- *     threshold.
- */
-#define ED_DCR_FT0     0x20
-#define ED_DCR_FT1     0x40
-
-/*
- * bit 7 (0x80) is unused/reserved
- */
-
-/*
- *             Transmit Configuration Register (TCR) definitions
- */
-
-/*
- * CRC: Inhibit CRC. If 0, CRC will be appended by the transmitter, if 0, CRC
- *     is not appended by the transmitter.
- */
-#define ED_TCR_CRC     0x01
-
-/*
- * LB0, LB1: Loopback control. These two bits set the type of loopback that is
- *     to be performed.
- *
- *     LB1 LB0         mode
- *      0   0          0 - normal operation (DCR_LS = 0)
- *      0   1          1 - internal loopback (DCR_LS = 0)
- *      1   0          2 - external loopback (DCR_LS = 1)
- *      1   1          3 - external loopback (DCR_LS = 0)
- */
-#define ED_TCR_LB0     0x02
-#define ED_TCR_LB1     0x04
-
-/*
- * ATD: Auto Transmit Disable. Clear for normal operation. When set, allows
- *     another station to disable the NIC's transmitter by transmitting to
- *     a multicast address hashing to bit 62. Reception of a multicast address
- *     hashing to bit 63 enables the transmitter.
- */
-#define ED_TCR_ATD     0x08
-
-/*
- * OFST: Collision Offset enable. This bit when set modifies the backoff
- *     algorithm to allow prioritization of nodes.
- */
-#define ED_TCR_OFST    0x10
-
-/*
- * bits 5, 6, and 7 are unused/reserved
- */
-
-/*
- *             Transmit Status Register (TSR) definitions
- */
-
-/*
- * PTX: Packet Transmitted. Indicates successful transmission of packet.
- */
-#define ED_TSR_PTX     0x01
-
-/*
- * bit 1 (0x02) is unused/reserved
- */
-
-/*
- * COL: Transmit Collided. Indicates that the transmission collided at least
- *     once with another station on the network.
- */
-#define ED_TSR_COL     0x04
-
-/*
- * ABT: Transmit aborted. Indicates that the transmission was aborted due to
- *     excessive collisions.
- */
-#define ED_TSR_ABT     0x08
-
-/*
- * CRS: Carrier Sense Lost. Indicates that carrier was lost during the
- *     transmission of the packet. (Transmission is not aborted because
- *     of a loss of carrier)
- */
-#define ED_TSR_CRS     0x10
-
-/*
- * FU: FIFO Underrun. Indicates that the NIC wasn't able to access bus/
- *     transmission memory before the FIFO emptied. Transmission of the
- *     packet was aborted.
- */
-#define ED_TSR_FU      0x20
-
-/*
- * CDH: CD Heartbeat. Indicates that the collision detection circuitry
- *     isn't working correctly during a collision heartbeat test.
- */
-#define ED_TSR_CDH     0x40
-
-/*
- * OWC: Out of Window Collision: Indicates that a collision occurred after
- *     a slot time (51.2us). The transmission is rescheduled just as in
- *     normal collisions.
- */
-#define ED_TSR_OWC     0x80
-
-/*
- *             Receiver Configuration Register (RCR) definitions
- */
-
-/*
- * SEP: Save Errored Packets. If 0, error packets are discarded. If set to 1,
- *     packets with CRC and frame errors are not discarded.
- */
-#define ED_RCR_SEP     0x01
-
-/*
- * AR: Accept Runt packet. If 0, packet with less than 64 byte are discarded.
- *     If set to 1, packets with less than 64 byte are not discarded.
- */
-#define ED_RCR_AR      0x02
-
-/*
- * AB: Accept Broadcast. If set, packets sent to the broadcast address will be
- *     accepted.
- */
-#define ED_RCR_AB      0x04
-
-/*
- * AM: Accept Multicast. If set, packets sent to a multicast address are checked
- *     for a match in the hashing array. If clear, multicast packets are ignored.
- */
-#define ED_RCR_AM      0x08
-
-/*
- * PRO: Promiscuous Physical. If set, all packets with a physical addresses are
- *     accepted. If clear, a physical destination address must match this
- *     station's address. Note: for full promiscuous mode, RCR_AB and RCR_AM
- *     must also be set. In addition, the multicast hashing array must be set
- *     to all 1's so that all multicast addresses are accepted.
- */
-#define ED_RCR_PRO     0x10
-
-/*
- * MON: Monitor Mode. If set, packets will be checked for good CRC and framing,
- *     but are not stored in the ring-buffer. If clear, packets are stored (normal
- *     operation).
- */
-#define ED_RCR_MON     0x20
-
-/*
- * INTT: Interrupt Trigger Mode for AX88190.
- */
-#define ED_RCR_INTT    0x40
-
-/*
- * bit 7 is unused/reserved.
- */
-
-/*
- *             Receiver Status Register (RSR) definitions
- */
-
-/*
- * PRX: Packet Received without error.
- */
-#define ED_RSR_PRX     0x01
-
-/*
- * CRC: CRC error. Indicates that a packet has a CRC error. Also set for frame
- *     alignment errors.
- */
-#define ED_RSR_CRC     0x02
-
-/*
- * FAE: Frame Alignment Error. Indicates that the incoming packet did not end on
- *     a byte boundary and the CRC did not match at the last byte boundary.
- */
-#define ED_RSR_FAE     0x04
-
-/*
- * FO: FIFO Overrun. Indicates that the FIFO was not serviced (during local DMA)
- *     causing it to overrun. Reception of the packet is aborted.
- */
-#define ED_RSR_FO      0x08
-
-/*
- * MPA: Missed Packet. Indicates that the received packet couldn't be stored in
- *     the ring-buffer because of insufficient buffer space (exceeding the
- *     boundary pointer), or because the transfer to the ring-buffer was inhibited
- *     by RCR_MON - monitor mode.
- */
-#define ED_RSR_MPA     0x10
-
-/*
- * PHY: Physical address. If 0, the packet received was sent to a physical address.
- *     If 1, the packet was accepted because of a multicast/broadcast address
- *     match.
- */
-#define ED_RSR_PHY     0x20
-
-/*
- * DIS: Receiver Disabled. Set to indicate that the receiver has entered monitor
- *     mode. Cleared when the receiver exits monitor mode.
- */
-#define ED_RSR_DIS     0x40
-
-/*
- * DFR: Deferring. Set to indicate a 'jabber' condition. The CRS and COL inputs
- *     are active, and the transceiver has set the CD line as a result of the
- *     jabber.
- */
-#define ED_RSR_DFR     0x80
-
-/*
- * receive ring descriptor
- *
- * The National Semiconductor DS8390 Network interface controller uses
- * the following receive ring headers.  The way this works is that the
- * memory on the interface card is chopped up into 256 bytes blocks.
- * A contiguous portion of those blocks are marked for receive packets
- * by setting start and end block #'s in the NIC.  For each packet that
- * is put into the receive ring, one of these headers (4 bytes each) is
- * tacked onto the front. The first byte is a copy of the receiver status
- * register at the time the packet was received.
- */
-struct ed_ring {
-       u_char  rsr;                    /* receiver status */
-       u_char  next_packet;            /* pointer to next packet       */
-       u_short count;                  /* bytes in packet (length + 4) */
-};
-
-/*
- *                             Common constants
- */
-#define ED_PAGE_SIZE           256             /* Size of RAM pages in bytes */
-#define ED_TXBUF_SIZE          6               /* Size of TX buffer in pages */
-
-/*
- * Vendor types
- */
-#define ED_VENDOR_WD_SMC       0x00            /* Western Digital/SMC */
-#define ED_VENDOR_3COM         0x01            /* 3Com */
-#define ED_VENDOR_NOVELL       0x02            /* Novell */
-#define ED_VENDOR_PCCARD       0x03            /* PCMCIA/PCCARD */
-#define ED_VENDOR_HP           0x04            /* Hewlett Packard */
-#define ED_VENDOR_LINKSYS      0x05            /* Linksys (Dlink) */
-#define ED_VENDOR_SIC          0x06            /* Allied-Telesis SIC */
-
-/*
- * Compile-time config flags
- */
-/*
- * this sets the default for enabling/disabling the transceiver
- */
-#define ED_FLAGS_DISABLE_TRANCEIVER    0x0001
-
-/*
- * This forces the board to be used in 8/16bit mode even if it
- *     autoconfigs differently
- */
-#define ED_FLAGS_FORCE_8BIT_MODE       0x0002
-#define ED_FLAGS_FORCE_16BIT_MODE      0x0004
-
-/*
- * This disables the use of double transmit buffers.
- */
-#define ED_FLAGS_NO_MULTI_BUFFERING    0x0008
-
-/*
- * This forces all operations with the NIC memory to use Programmed
- *     I/O (i.e. not via shared memory)
- */
-#define ED_FLAGS_FORCE_PIO             0x0010
-
-/*
- * These are flags describing the chip type.
- */
-#define ED_FLAGS_TOSH_ETHER            0x10000
-#define ED_FLAGS_GWETHER               0x20000
-#define ED_FLAGS_AX88190               0x30000
-#define ED_FLAGS_LINKSYS               0x80000
-
-#define ED_FLAGS_GETTYPE(flg)          ((flg) & 0xff0000)
-
-/*
- *             Definitions for Western digital/SMC WD80x3 series ASIC
- */
-/*
- * Memory Select Register (MSR)
- */
-#define ED_WD_MSR      0
-
-/* next three definitions for Toshiba */
-#define ED_WD_MSR_POW  0x02    /* 0 = power save, 1 = normal (R/W) */
-#define ED_WD_MSR_BSY  0x04    /* gate array busy (R) */
-#define ED_WD_MSR_LEN  0x20    /* data bus width, 0 = 16 bits,
-                                  1 = 8 bits (R/W) */
-#define ED_WD_MSR_ADDR 0x3f    /* Memory decode bits 18-13 */
-#define ED_WD_MSR_MENB 0x40    /* Memory enable */
-#define ED_WD_MSR_RST  0x80    /* Reset board */
-
-/*
- * Interface Configuration Register (ICR)
- */
-#define ED_WD_ICR      1
-
-#define ED_WD_ICR_16BIT        0x01    /* 16-bit interface */
-#define ED_WD_ICR_OAR  0x02    /* select register. 0=BIO 1=EAR */
-#define ED_WD_ICR_IR2  0x04    /* high order bit of encoded IRQ */
-#define ED_WD_ICR_MSZ  0x08    /* memory size (0=8k 1=32k) */
-#define ED_WD_ICR_RLA  0x10    /* recall LAN address */
-#define ED_WD_ICR_RX7  0x20    /* recall all but i/o and LAN address */
-#define        ED_WD_ICR_RIO   0x40    /* recall i/o address */
-#define ED_WD_ICR_STO  0x80    /* store to non-volatile memory */
-#define ED_WD_ICR_MEM  0xe0    /* shared mem address A15-A13 (R/W) */
-#define ED_WD_ICR_MSZ1 0x0f    /* memory size, 0x08 = 64K, 0x04 = 32K,
-                                  0x02 = 16K, 0x01 = 8K */
-                               /* 64K can only be used if mem address
-                                  above 1Mb */
-                               /* IAR holds address A23-A16 (R/W) */
-
-/*
- * IO Address Register (IAR)
- */
-#define ED_WD_IAR      2
-
-/*
- * EEROM Address Register
- */
-#define ED_WD_EAR      3
-
-/*
- * Interrupt Request Register (IRR)
- */
-#define ED_WD_IRR      4
-
-#define        ED_WD_IRR_0WS   0x01    /* use 0 wait-states on 8 bit bus */
-#define ED_WD_IRR_OUT1 0x02    /* WD83C584 pin 1 output */
-#define ED_WD_IRR_OUT2 0x04    /* WD83C584 pin 2 output */
-#define ED_WD_IRR_OUT3 0x08    /* WD83C584 pin 3 output */
-#define ED_WD_IRR_FLASH        0x10    /* Flash RAM is in the ROM socket */
-
-/*
- * The three bits of the encoded IRQ are decoded as follows:
- *
- *     IR2 IR1 IR0     IRQ
- *      0   0   0       2/9
- *      0   0   1       3
- *      0   1   0       5
- *      0   1   1       7
- *      1   0   0       10
- *      1   0   1       11
- *      1   1   0       15
- *      1   1   1       4
- */
-#define ED_WD_IRR_IR0  0x20    /* bit 0 of encoded IRQ */
-#define ED_WD_IRR_IR1  0x40    /* bit 1 of encoded IRQ */
-#define ED_WD_IRR_IEN  0x80    /* Interrupt enable */
-
-/*
- * LA Address Register (LAAR)
- */
-#define ED_WD_LAAR     5
-
-#define ED_WD_LAAR_ADDRHI      0x1f    /* bits 23-19 of RAM address */
-#define ED_WD_LAAR_0WS16       0x20    /* enable 0 wait-states on 16 bit bus */
-#define ED_WD_LAAR_L16EN       0x40    /* enable 16-bit operation */
-#define ED_WD_LAAR_M16EN       0x80    /* enable 16-bit memory access */
-
-/* i/o base offset to station address/card-ID PROM */
-#define ED_WD_PROM     8
-
-/*
- *     83C790 specific registers
- */
-/*
- * Hardware Support Register (HWR) ('790)
- */
-#define ED_WD790_HWR   4
-
-#define WD_WD790_HWR_NUKE      0x10    /* hardware reset */
-#define ED_WD790_HWR_LPRM      0x40    /* LAN PROM select */
-#define ED_WD790_HWR_SWH       0x80    /* switch register set */
-
-/*
- * ICR790 Interrupt Control Register for the 83C790
- */
-#define ED_WD790_ICR   6
-
-#define ED_WD790_ICR_EIL       0x01    /* enable interrupts */
-
-/*
- * REV/IOPA Revision / I/O Pipe register for the 83C79X
- */
-#define ED_WD790_REV   7
-
-#define ED_WD790       0x20
-#define ED_WD795       0x40
-
-/*
- * 79X RAM Address Register (RAR)
- *     Enabled with SWH bit=1 in HWR register
- */
-#define ED_WD790_RAR   0x0b
-
-#define ED_WD790_RAR_SZ8       0x00    /* 8k memory buffer */
-#define ED_WD790_RAR_SZ16      0x10    /* 16k memory buffer */
-#define ED_WD790_RAR_SZ32      0x20    /* 32k memory buffer */
-#define ED_WD790_RAR_SZ64      0x30    /* 64k memory buffer */
-
-/*
- * General Control Register (GCR)
- *     Enabled with SWH bit=1 in HWR register
- */
-#define ED_WD790_GCR   0x0d
-
-#define ED_WD790_GCR_IR0       0x04    /* bit 0 of encoded IRQ */
-#define ED_WD790_GCR_IR1       0x08    /* bit 1 of encoded IRQ */
-#define ED_WD790_GCR_ZWSEN     0x20    /* zero wait state enable */
-#define ED_WD790_GCR_IR2       0x40    /* bit 2 of encoded IRQ */
-#define ED_WD790_GCR_LIT       0x01    /* Link Integrity Test Enable */
-/*
- * The three bits of the encoded IRQ are decoded as follows:
- *
- *     IR2 IR1 IR0     IRQ
- *      0   0   0       none
- *      0   0   1       9
- *      0   1   0       3
- *      0   1   1       5
- *      1   0   0       7
- *      1   0   1       10
- *      1   1   0       11
- *      1   1   1       15
- */
-
-/* i/o base offset to CARD ID */
-#define ED_WD_CARD_ID  ED_WD_PROM+6
-
-/* Board type codes in card ID */
-#define ED_TYPE_WD8003S                0x02
-#define ED_TYPE_WD8003E                0x03
-#define ED_TYPE_WD8013EBT      0x05
-#define ED_TYPE_TOSHIBA1       0x11 /* named PCETA1 */
-#define ED_TYPE_TOSHIBA2       0x12 /* named PCETA2 */
-#define ED_TYPE_TOSHIBA3       0x13 /* named PCETB  */
-#define ED_TYPE_TOSHIBA4       0x14 /* named PCETC  */
-#define ED_TYPE_WD8003W                0x24
-#define ED_TYPE_WD8003EB       0x25
-#define ED_TYPE_WD8013W                0x26
-#define ED_TYPE_WD8013EP       0x27
-#define ED_TYPE_WD8013WC       0x28
-#define ED_TYPE_WD8013EPC      0x29
-#define ED_TYPE_SMC8216T       0x2a
-#define ED_TYPE_SMC8216C       0x2b
-#define ED_TYPE_WD8013EBP      0x2c
-
-/* Bit definitions in card ID */
-#define        ED_WD_REV_MASK          0x1f            /* Revision mask */
-#define        ED_WD_SOFTCONFIG        0x20            /* Soft config */
-#define        ED_WD_LARGERAM          0x40            /* Large RAM */
-#define        ED_MICROCHANEL          0x80            /* Microchannel bus (vs. isa) */
-
-/*
- * Checksum total. All 8 bytes in station address PROM will add up to this
- */
-#define ED_WD_ROM_CHECKSUM_TOTAL               0xFF
-#define ED_WD_ROM_CHECKSUM_TOTAL_TOSH_ETHER    0xA5
-
-#define ED_WD_NIC_OFFSET       0x10            /* I/O base offset to NIC */
-#define ED_WD_ASIC_OFFSET      0               /* I/O base offset to ASIC */
-#define ED_WD_IO_PORTS         32              /* # of i/o addresses used */
-
-#define ED_WD_PAGE_OFFSET      0       /* page offset for NIC access to mem */
-
-/*
- *                     Definitions for 3Com 3c503
- */
-#define ED_3COM_NIC_OFFSET     0
-#define ED_3COM_ASIC_OFFSET    0x400           /* offset to nic i/o regs */
-
-/*
- * XXX - The I/O address range is fragmented in the 3c503; this is the
- *     number of regs at iobase.
- */
-#define ED_3COM_IO_PORTS       16              /* # of i/o addresses used */
-
-/* tx memory starts in second bank on 8bit cards */
-#define ED_3COM_TX_PAGE_OFFSET_8BIT    0x20
-
-/* tx memory starts in first bank on 16bit cards */
-#define ED_3COM_TX_PAGE_OFFSET_16BIT   0x0
-
-/* ...and rx memory starts in second bank */
-#define ED_3COM_RX_PAGE_OFFSET_16BIT   0x20
-
-
-/*
- *     Page Start Register. Must match PSTART in NIC
- */
-#define ED_3COM_PSTR           0
-
-/*
- *     Page Stop Register. Must match PSTOP in NIC
- */
-#define ED_3COM_PSPR           1
-
-/*
- *     Drq Timer Register. Determines number of bytes to be transfered during
- *             a DMA burst.
- */
-#define ED_3COM_DQTR           2
-
-/*
- *     Base Configuration Register. Read-only register which contains the
- *             board-configured I/O base address of the adapter. Bit encoded.
- */
-#define ED_3COM_BCFR           3
-
-#define ED_3COM_BCFR_2E0       0x01
-#define ED_3COM_BCFR_2A0       0x02
-#define ED_3COM_BCFR_280       0x04
-#define ED_3COM_BCFR_250       0x08
-#define ED_3COM_BCFR_350       0x10
-#define ED_3COM_BCFR_330       0x20
-#define ED_3COM_BCFR_310       0x40
-#define ED_3COM_BCFR_300       0x80
-
-/*
- *     EPROM Configuration Register. Read-only register which contains the
- *             board-configured memory base address. Bit encoded.
- */
-#define ED_3COM_PCFR           4
-
-#define ED_3COM_PCFR_C8000     0x10
-#define ED_3COM_PCFR_CC000     0x20
-#define ED_3COM_PCFR_D8000     0x40
-#define ED_3COM_PCFR_DC000     0x80
-
-/*
- *     GA Configuration Register. Gate-Array Configuration Register.
- */
-#define ED_3COM_GACFR          5
-
-/*
- * mbs2  mbs1  mbs0            start address
- *  0     0     0              0x0000
- *  0     0     1              0x2000
- *  0     1     0              0x4000
- *  0     1     1              0x6000
- *
- *     Note that with adapters with only 8K, the setting for 0x2000 must
- *             always be used.
- */
-#define ED_3COM_GACFR_MBS0     0x01
-#define ED_3COM_GACFR_MBS1     0x02
-#define ED_3COM_GACFR_MBS2     0x04
-
-#define ED_3COM_GACFR_RSEL     0x08    /* enable shared memory */
-#define ED_3COM_GACFR_TEST     0x10    /* for GA testing */
-#define ED_3COM_GACFR_OWS      0x20    /* select 0WS access to GA */
-#define ED_3COM_GACFR_TCM      0x40    /* Mask DMA interrupts */
-#define ED_3COM_GACFR_NIM      0x80    /* Mask NIC interrupts */
-
-/*
- *     Control Register. Miscellaneous control functions.
- */
-#define ED_3COM_CR             6
-
-#define ED_3COM_CR_RST         0x01    /* Reset GA and NIC */
-#define ED_3COM_CR_XSEL                0x02    /* Transceiver select. BNC=1(def) AUI=0 */
-#define ED_3COM_CR_EALO                0x04    /* window EA PROM 0-15 to I/O base */
-#define ED_3COM_CR_EAHI                0x08    /* window EA PROM 16-31 to I/O base */
-#define ED_3COM_CR_SHARE       0x10    /* select interrupt sharing option */
-#define ED_3COM_CR_DBSEL       0x20    /* Double buffer select */
-#define ED_3COM_CR_DDIR                0x40    /* DMA direction select */
-#define ED_3COM_CR_START       0x80    /* Start DMA controller */
-
-/*
- *     Status Register. Miscellaneous status information.
- */
-#define ED_3COM_STREG          7
-
-#define ED_3COM_STREG_REV      0x07    /* GA revision */
-#define ED_3COM_STREG_DIP      0x08    /* DMA in progress */
-#define ED_3COM_STREG_DTC      0x10    /* DMA terminal count */
-#define ED_3COM_STREG_OFLW     0x20    /* Overflow */
-#define ED_3COM_STREG_UFLW     0x40    /* Underflow */
-#define ED_3COM_STREG_DPRDY    0x80    /* Data port ready */
-
-/*
- *     Interrupt/DMA Configuration Register
- */
-#define ED_3COM_IDCFR          8
-
-#define ED_3COM_IDCFR_DRQ0     0x01    /* DMA request 1 select */
-#define ED_3COM_IDCFR_DRQ1     0x02    /* DMA request 2 select */
-#define ED_3COM_IDCFR_DRQ2     0x04    /* DMA request 3 select */
-#define ED_3COM_IDCFR_UNUSED   0x08    /* not used */
-#define ED_3COM_IDCFR_IRQ2     0x10    /* Interrupt request 2 select */
-#define ED_3COM_IDCFR_IRQ3     0x20    /* Interrupt request 3 select */
-#define ED_3COM_IDCFR_IRQ4     0x40    /* Interrupt request 4 select */
-#define ED_3COM_IDCFR_IRQ5     0x80    /* Interrupt request 5 select */
-
-/*
- *     DMA Address Register MSB
- */
-#define ED_3COM_DAMSB          9
-
-/*
- *     DMA Address Register LSB
- */
-#define ED_3COM_DALSB          0x0a
-
-/*
- *     Vector Pointer Register 2
- */
-#define ED_3COM_VPTR2          0x0b
-
-/*
- *     Vector Pointer Register 1
- */
-#define ED_3COM_VPTR1          0x0c
-
-/*
- *     Vector Pointer Register 0
- */
-#define ED_3COM_VPTR0          0x0d
-
-/*
- *     Register File Access MSB
- */
-#define ED_3COM_RFMSB          0x0e
-
-/*
- *     Register File Access LSB
- */
-#define ED_3COM_RFLSB          0x0f
-
-/*
- *              Definitions for Novell NE1000/2000 boards
- */
-
-/*
- * Board type codes
- */
-#define ED_TYPE_NE1000         0x01
-#define ED_TYPE_NE2000         0x02
-
-/*
- * Register offsets/total
- */
-#define ED_NOVELL_NIC_OFFSET   0x00
-#define ED_NOVELL_ASIC_OFFSET  0x10
-#define ED_NOVELL_IO_PORTS     32
-
-/*
- * Remote DMA data register; for reading or writing to the NIC mem
- *     via programmed I/O (offset from ASIC base)
- */
-#define ED_NOVELL_DATA         0x00
-
-/*
- * Reset register; reading from this register causes a board reset
- */
-#define ED_NOVELL_RESET                0x0f
-
-/*
- *             Definitions for PCCARD
- */
-#define ED_PC_PAGE_OFFSET      0x40    /* page offset for NIC access to mem */
-#define ED_PC_IO_PORTS         32
-#define ED_PC_ASIC_OFFSET      0x10
-#define ED_PC_RESET            0x0f    /* Reset(offset from ASIC base) */
-#define ED_PC_MISC             0x08    /* Misc (offset from ASIC base) */
-
-/* 
- * if_ze.h  constants
- */
-
-#define ZE_PAGE_OFFSET         0x40    /* mem buffer starts at 0x4000 */
-
-#define ZE_DATA_IO     0x10
-#define ZE_MISC                0x18
-#define ZE_RESET       0x1F
-
-/*
- * Definitions for HP PC LAN Adapter Plus; based on the CRYNWR packet
- * driver for the card.
- */
-
-#define        ED_HPP_ASIC_OFFSET      0x00    /* Offset to ASIC registers */
-#define        ED_HPP_NIC_OFFSET       0x10    /* Offset to 8390 registers */
-
-#define        ED_HPP_ID               0x00    /* ID register, always 0x4850 */
-#define        ED_HPP_PAGING           0x02    /* Page select register */
-#define        ED_HPP_OPTION           0x04    /* Bitmask of supported options */
-#define        ED_HPP_PAGE_0           0x08    /* Page 0 */
-#define        ED_HPP_PAGE_2           0x0A    /* Page 2 */
-#define ED_HPP_PAGE_4          0x0C    /* Page 4 */
-#define        ED_HPP_PAGE_6           0x0E    /* Page 6 */
-
-/* PERF PAGE */
-#define        ED_HPP_OUT_ADDR         ED_HPP_PAGE_0   /* I/O output location */
-#define        ED_HPP_IN_ADDR          ED_HPP_PAGE_2   /* I/O input location */
-#define        ED_HPP_DATAPORT         ED_HPP_PAGE_4   /* I/O data transfer */
-/* MAC PAGE */
-#define ED_HPP_MAC_ADDR                0x08    /* Offset of MAC address in MAC page */
-
-#define        ED_HPP_IO_PORTS         32      /* Number of IO ports */
-
-#define        ED_HPP_TX_PAGE_OFFSET   0x00    /* first page of TX buffer */
-#define ED_HPP_RX_PAGE_START   0x06    /* start at page 6 */
-#define        ED_HPP_RX_PAGE_STOP     0x80    /* end at page 128 */
-
-/*
- * Register pages supported.
- */
-
-#define        ED_HPP_PAGE_PERF        0       /* Normal operation */
-#define        ED_HPP_PAGE_MAC         1       /* The ethernet address and checksum */
-#define        ED_HPP_PAGE_HW          2       /* Hardware parameters in EEPROM */
-#define        ED_HPP_PAGE_LAN         4       /* Transciever selection etc */
-#define        ED_HPP_PAGE_ID          6       /* ID */
-
-/*
- * Options supported.
- */
-
-#define        ED_HPP_OPTION_NIC_RESET         0x0001  /* active low */
-#define        ED_HPP_OPTION_CHIP_RESET        0x0002  /* active low */
-#define        ED_HPP_OPTION_ENABLE_IRQ        0x0004
-#define        ED_HPP_OPTION_FAKE_INTR         0x0008
-#define        ED_HPP_OPTION_BOOT_ROM_ENB      0x0010
-#define        ED_HPP_OPTION_IO_ENB            0x0020
-#define        ED_HPP_OPTION_MEM_ENABLE        0x0040
-#define        ED_HPP_OPTION_ZERO_WAIT         0x0080
-#define        ED_HPP_OPTION_MEM_DISABLE       0x1000
-
-/*
- * Page ID configuration.
- */
-
-#define        ED_HPP_ID_REVISION_MASK         0x0300  /* revision id */
-#define ED_HPP_ID_SOFT_MODEL_MASK      0xFC00  /* soft model number */
-#define ED_HPP_ID_16_BIT_ACCESS                0x0010  /* if set use 16 bit accesses */
-#define        ED_HPP_ID_TWISTED_PAIR          0x0040  
-
-/*
- * Hardware configuration.
- */
-
-#define        ED_HPP_HW_MEM_MAP       0x09    /* low mem map location in HW page */
-#define ED_HPP_HW_ID           0x0C    /* revision number, capabilities */
-#define ED_HPP_HW_IRQ          0x0D    /* IRQ channel register in HW page */
-#define        ED_HPP_HW_WRAP          0x0E    /* mem wrap page for rcv */
-
-/*
- * Lan configuration
- */
-
-#define ED_HPP_LAN_AUI         0x01    /* Use AUI */
-#define ED_HPP_LAN_TL          0x40    /* Don't use AUI */
-
-/*
- * Card types.
- */
-
-#define ED_TYPE_HP_PCLANPLUS   0x00
-
-/*
- *                     Definitions for Allied-Telesis SIC
- */
-#define ED_SIC_NIC_OFFSET      0
-#define ED_SIC_ASIC_OFFSET     0x10            /* offset to nic i/o regs */
-
-#define ED_SIC_IO_PORTS                17              /* # of i/o addresses used */
-
-/*
- * Chip types.
- */
-
-#define ED_CHIP_TYPE_DP8390    0x00
-#define ED_CHIP_TYPE_WD790     0x01
-#define ED_CHIP_TYPE_AX88190   0x02
-
-/*
- * AX88190 IOBASE registers.
- */
-
-#define ED_AX88190_IOBASE0     0x3ca
-#define ED_AX88190_IOBASE1     0x3cc
-
-/*
- * MII bus definitions.
- */
-#define ED_MII_STARTDELIM      0x01
-#define ED_MII_WRITEOP         0x01
-#define ED_MII_READOP          0x02
-#define ED_MII_TURNAROUND      0x02
-#define ED_MII_IDLE            0x01
-
-#define ED_MII_STARTDELIM_BITS 2
-#define ED_MII_OP_BITS         2
-#define ED_MII_PHY_BITS                5
-#define ED_MII_REG_BITS                5
-#define ED_MII_TURNAROUND_BITS 2
-#define ED_MII_DATA_BITS       16
-#define ED_MII_ACK_BITS                1
-#define ED_MII_IDLE_BITS       1
-
-/* Dlink chipset used on some Netgear and Dlink PCMCIA cards */
-#define ED_DLINK_MIIBUS                0x0c    /* MII bus register on ASIC */
-
-#define ED_DLINK_MII_RESET1    0x04
-#define ED_DLINK_MII_RESET2    0x08
-
-#define ED_DLINK_MII_DATATIN   0x10
-#define ED_DLINK_MII_DIROUT    0x20
-#define ED_DLINK_MII_DATAOUT   0x40
-#define ED_DLINK_MII_CLK       0x80
diff --git a/sys/dev/netif/ed/if_edvar.h b/sys/dev/netif/ed/if_edvar.h
deleted file mode 100644 (file)
index 5235be7..0000000
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * Copyright (c) 1995, David Greenman
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice unmodified, this list of conditions, and the following
- *    disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INC