Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-5]: src/sys Pullup from trunk:



details:   https://anonhg.NetBSD.org/src/rev/8b7bf074260d
branches:  netbsd-1-5
changeset: 489061:8b7bf074260d
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Fri Aug 11 18:16:46 2000 +0000

description:
Pullup from trunk:
Add support for the DEC DE422 Ethernet, which is a DEPCA
attached to the EISA bus.  This board is commonly found
on Alpha Jensen systems.

diffstat:

 sys/conf/files             |    7 +-
 sys/dev/eisa/depca_eisa.c  |  187 +++++++++++++++++
 sys/dev/eisa/files.eisa    |    6 +-
 sys/dev/ic/depca.c         |  361 ++++++++++++++++++++++++++++++++++
 sys/dev/ic/depcareg.h      |   86 ++++++++
 sys/dev/ic/depcavar.h      |   97 +++++++++
 sys/dev/isa/depca_isa.c    |  224 +++++++++++++++++++++
 sys/dev/isa/files.isa      |    6 +-
 sys/dev/isa/if_depca_isa.c |  475 ---------------------------------------------
 9 files changed, 968 insertions(+), 481 deletions(-)

diffs (truncated from 1516 to 300 lines):

diff -r 316f22ce6f05 -r 8b7bf074260d sys/conf/files
--- a/sys/conf/files    Fri Aug 11 18:00:03 2000 +0000
+++ b/sys/conf/files    Fri Aug 11 18:16:46 2000 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files,v 1.373.2.4 2000/08/06 02:12:13 briggs Exp $
+#      $NetBSD: files,v 1.373.2.5 2000/08/11 18:16:46 thorpej Exp $
 
 #      @(#)files.newconf       7.5 (Berkeley) 5/10/93
 
@@ -295,6 +295,11 @@
 file   dev/ic/am79900.c                le32
 file   dev/ic/lance.c                  le24 | le32
 
+# DEC DEPCA-family of LANCE Ethernet controllers
+device depca { }: le24
+file   dev/ic/depca.c                  depca
+attach le at depca with le_depca
+
 # Sun HME Ethernet controllers
 device hme: arp, ether, ifnet, mii
 file   dev/ic/hme.c                    hme
diff -r 316f22ce6f05 -r 8b7bf074260d sys/dev/eisa/depca_eisa.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/dev/eisa/depca_eisa.c Fri Aug 11 18:16:46 2000 +0000
@@ -0,0 +1,187 @@
+/*     $NetBSD: depca_eisa.c,v 1.1.2.2 2000/08/11 18:16:48 thorpej Exp $       */
+
+/*-
+ * Copyright (c) 2000 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe.
+ *
+ * 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. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the NetBSD
+ *     Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+ */
+
+/*
+ * EISA bus front-end for the Digital DEPCA Ethernet controller.
+ */
+
+#include "opt_inet.h"
+#include "bpfilter.h"
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/mbuf.h>
+#include <sys/syslog.h>
+#include <sys/socket.h>
+#include <sys/device.h>
+
+#include <net/if.h>
+#include <net/if_media.h>
+#include <net/if_ether.h>
+
+#ifdef INET
+#include <netinet/in.h> 
+#include <netinet/if_inarp.h>
+#endif
+
+#include <machine/bus.h>
+#include <machine/intr.h>
+
+#include <dev/eisa/eisareg.h>
+#include <dev/eisa/eisavar.h>
+#include <dev/eisa/eisadevs.h>
+
+#include <dev/ic/lancereg.h>
+#include <dev/ic/lancevar.h>
+#include <dev/ic/am7990reg.h>
+#include <dev/ic/am7990var.h>
+#include <dev/ic/depcareg.h>
+#include <dev/ic/depcavar.h>
+
+int    depca_eisa_match(struct device *, struct cfdata *, void *);
+void   depca_eisa_attach(struct device *, struct device *, void *);
+
+struct depca_eisa_softc {
+       struct depca_softc sc_depca;
+
+       eisa_chipset_tag_t sc_ec;
+       int sc_irq;
+       int sc_ist;
+};
+
+struct cfattach depca_eisa_ca = {
+       sizeof(struct depca_eisa_softc), depca_eisa_match, depca_eisa_attach,
+};
+
+void   *depca_eisa_intr_establish(struct depca_softc *, struct lance_softc *);
+
+int
+depca_eisa_match(struct device *parent, struct cfdata *match, void *aux)
+{
+       struct eisa_attach_args *ea = aux;
+
+       return (strcmp(ea->ea_idstring, "DEC4220") == 0);
+}
+
+#define        DEPCA_ECU_FUNC_NETINTR  0
+#define        DEPCA_ECU_FUNC_NETBUF   1
+
+void
+depca_eisa_attach(struct device *parent, struct device *self, void *aux)
+{
+       struct depca_softc *sc = (void *) self;
+       struct depca_eisa_softc *esc = (void *) self;
+       struct eisa_attach_args *ea = aux;
+       struct eisa_cfg_mem ecm;
+       struct eisa_cfg_irq eci;
+
+       printf(": DEC DE422 Ethernet\n");
+
+       sc->sc_iot = ea->ea_iot;
+       sc->sc_memt = ea->ea_memt;
+
+       esc->sc_ec = ea->ea_ec;
+
+       sc->sc_intr_establish = depca_eisa_intr_establish;
+
+       if (eisa_conf_read_mem(ea->ea_ec, ea->ea_slot,
+           DEPCA_ECU_FUNC_NETBUF, 0, &ecm) != 0) {
+               printf("%s: unable to find network buffer\n",
+                   sc->sc_dev.dv_xname);
+               return;
+       }
+
+       printf("%s: shared memory at 0x%lx-0x%lx\n", sc->sc_dev.dv_xname,
+           ecm.ecm_addr, ecm.ecm_addr + ecm.ecm_size - 1);
+
+       sc->sc_memsize = ecm.ecm_size;
+
+       if (bus_space_map(sc->sc_iot, EISA_SLOT_ADDR(ea->ea_slot) + 0xc00, 16,
+           0, &sc->sc_ioh) != 0) {
+               printf("%s: unable to map i/o space\n", sc->sc_dev.dv_xname);
+               return;
+       }
+       if (bus_space_map(sc->sc_memt, ecm.ecm_addr, sc->sc_memsize,
+           0, &sc->sc_memh) != 0) {
+               printf("%s: unable to map memory space\n", sc->sc_dev.dv_xname);
+               return;
+       }
+
+       if (eisa_conf_read_irq(ea->ea_ec, ea->ea_slot,
+           DEPCA_ECU_FUNC_NETINTR, 0, &eci) != 0) {
+               printf("%s: unable to determine IRQ\n",
+                   sc->sc_dev.dv_xname);
+               return;
+       }
+
+       esc->sc_irq = eci.eci_irq;
+       esc->sc_ist = eci.eci_ist;
+
+       depca_attach(sc);
+}
+
+void *
+depca_eisa_intr_establish(struct depca_softc *parent, struct lance_softc *child)
+{
+       struct depca_eisa_softc *esc = (void *) parent;
+       eisa_intr_handle_t ih;
+       const char *intrstr;
+       void *rv;
+
+       if (eisa_intr_map(esc->sc_ec, esc->sc_irq, &ih)) {
+               printf("%s: unable to map interrupt (%d)\n",
+                   parent->sc_dev.dv_xname, esc->sc_irq);
+               return (NULL);
+       }
+       intrstr = eisa_intr_string(esc->sc_ec, ih);
+       rv = eisa_intr_establish(esc->sc_ec, ih, esc->sc_ist, IPL_NET,
+           (esc->sc_ist == IST_LEVEL) ? am7990_intr : depca_intredge, child);
+       if (rv == NULL) {
+               printf("%s: unable to establish interrupt",
+                   parent->sc_dev.dv_xname);
+               if (intrstr != NULL)
+                       printf(" at %s", intrstr);
+               printf("\n");
+               return (NULL);
+       }
+       if (intrstr != NULL)
+               printf("%s: interrupting at %s\n", parent->sc_dev.dv_xname,
+                   intrstr);
+
+       return (rv);
+}
diff -r 316f22ce6f05 -r 8b7bf074260d sys/dev/eisa/files.eisa
--- a/sys/dev/eisa/files.eisa   Fri Aug 11 18:00:03 2000 +0000
+++ b/sys/dev/eisa/files.eisa   Fri Aug 11 18:16:46 2000 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.eisa,v 1.20 2000/03/15 02:04:43 fvdl Exp $
+#      $NetBSD: files.eisa,v 1.20.4.1 2000/08/11 18:16:48 thorpej Exp $
 #
 # Config file and device description for machine-independent EISA code.
 # Included by ports that need it.  Requires that the SCSI files be
@@ -45,6 +45,10 @@
 attach fea at eisa
 file   dev/eisa/if_fea.c               fea
 
+# DEC DE422 EISA Ethernet Controller
+attach depca at eisa with depca_eisa
+file   dev/eisa/depca_eisa.c           depca_eisa
+
 # DEC DE425 EISA Ethernet Controller
 attach tlp at eisa with tlp_eisa
 file   dev/eisa/if_tlp_eisa.c          tlp_eisa
diff -r 316f22ce6f05 -r 8b7bf074260d sys/dev/ic/depca.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/dev/ic/depca.c        Fri Aug 11 18:16:46 2000 +0000
@@ -0,0 +1,361 @@
+/*     $NetBSD: depca.c,v 1.1.2.2 2000/08/11 18:16:49 thorpej Exp $    */
+
+/*-
+ * Copyright (c) 1997, 1998, 2000 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Charles M. Hannum and by Jason R. Thorpe of the Numerical Aerospace
+ * Simulation Facility, NASA Ames Research Center.
+ *
+ * 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. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the NetBSD
+ *     Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+ */
+
+/*-
+ * Copyright (c) 1992, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Ralph Campbell and Rick Macklem.
+ *
+ * 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. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE



Home | Main Index | Thread Index | Old Index