From fbc5a27f3f8dff3ccdceac266613f56f99f35fe1 Mon Sep 17 00:00:00 2001 From: deraadt Date: Thu, 2 May 1996 13:51:45 +0000 Subject: [PATCH] make these work together --- sys/dev/ic/am7990.c | 41 +++---- sys/dev/ic/am7990var.h | 25 ++-- sys/dev/isa/if_le.c | 20 ++-- sys/dev/tc/if_le.c | 237 +++++--------------------------------- sys/dev/tc/if_le_ioasic.c | 104 +++++++++++++++++ sys/dev/tc/if_le_tc.c | 110 ++++++++++++++++++ sys/dev/tc/if_levar.h | 7 +- sys/dev/tc/tc.c | 38 +++--- 8 files changed, 314 insertions(+), 268 deletions(-) create mode 100644 sys/dev/tc/if_le_ioasic.c create mode 100644 sys/dev/tc/if_le_tc.c diff --git a/sys/dev/ic/am7990.c b/sys/dev/ic/am7990.c index b050dd728db..15d4909bdf8 100644 --- a/sys/dev/ic/am7990.c +++ b/sys/dev/ic/am7990.c @@ -1,5 +1,5 @@ -/* $OpenBSD: am7990.c,v 1.5 1996/04/21 22:21:15 deraadt Exp $ */ -/* $NetBSD: am7990.c,v 1.16 1996/04/09 15:21:59 pk Exp $ */ +/* $OpenBSD: am7990.c,v 1.6 1996/05/02 13:51:45 deraadt Exp $ */ +/* $NetBSD: am7990.c,v 1.18 1996/04/22 02:40:50 christos Exp $ */ /*- * Copyright (c) 1995 Charles M. Hannum. All rights reserved. @@ -291,6 +291,7 @@ leinit(sc) lestart(ifp); } else printf("%s: card failed to initialize\n", sc->sc_dev.dv_xname); + lehwinit(sc); } /* @@ -1015,8 +1016,8 @@ allmulti: * Buffers may have any alignment. */ -integrate void -copytobuf_contig(sc, from, boff, len) +void +am7990_copytobuf_contig(sc, from, boff, len) struct le_softc *sc; void *from; int boff, len; @@ -1029,8 +1030,8 @@ copytobuf_contig(sc, from, boff, len) bcopy(from, buf + boff, len); } -integrate void -copyfrombuf_contig(sc, to, boff, len) +void +am7990_copyfrombuf_contig(sc, to, boff, len) struct le_softc *sc; void *to; int boff, len; @@ -1043,8 +1044,8 @@ copyfrombuf_contig(sc, to, boff, len) bcopy(buf + boff, to, len); } -integrate void -zerobuf_contig(sc, boff, len) +void +am7990_zerobuf_contig(sc, boff, len) struct le_softc *sc; int boff, len; { @@ -1065,8 +1066,8 @@ zerobuf_contig(sc, boff, len) * doing an extra byte. */ -integrate void -copytobuf_gap2(sc, fromv, boff, len) +void +am7990_copytobuf_gap2(sc, fromv, boff, len) struct le_softc *sc; void *fromv; int boff; @@ -1094,8 +1095,8 @@ copytobuf_gap2(sc, fromv, boff, len) *bptr = (u_int16_t)*from; } -integrate void -copyfrombuf_gap2(sc, tov, boff, len) +void +am7990_copyfrombuf_gap2(sc, tov, boff, len) struct le_softc *sc; void *tov; int boff, len; @@ -1124,8 +1125,8 @@ copyfrombuf_gap2(sc, tov, boff, len) *to = *bptr & 0xff; } -integrate void -zerobuf_gap2(sc, boff, len) +void +am7990_zerobuf_gap2(sc, boff, len) struct le_softc *sc; int boff, len; { @@ -1154,8 +1155,8 @@ zerobuf_gap2(sc, boff, len) * Buffers must be 32-byte aligned. */ -integrate void -copytobuf_gap16(sc, fromv, boff, len) +void +am7990_copytobuf_gap16(sc, fromv, boff, len) struct le_softc *sc; void *fromv; int boff; @@ -1179,8 +1180,8 @@ copytobuf_gap16(sc, fromv, boff, len) } } -integrate void -copyfrombuf_gap16(sc, tov, boff, len) +void +am7990_copyfrombuf_gap16(sc, tov, boff, len) struct le_softc *sc; void *tov; int boff, len; @@ -1203,8 +1204,8 @@ copyfrombuf_gap16(sc, tov, boff, len) } } -integrate void -zerobuf_gap16(sc, boff, len) +void +am7990_zerobuf_gap16(sc, boff, len) struct le_softc *sc; int boff, len; { diff --git a/sys/dev/ic/am7990var.h b/sys/dev/ic/am7990var.h index 2e66bb6e804..337bc871fb5 100644 --- a/sys/dev/ic/am7990var.h +++ b/sys/dev/ic/am7990var.h @@ -1,5 +1,5 @@ -/* $OpenBSD: am7990var.h,v 1.3 1996/04/18 23:47:18 niklas Exp $ */ -/* $NetBSD: am7990var.h,v 1.4 1996/03/14 19:05:09 christos Exp $ */ +/* $OpenBSD: am7990var.h,v 1.4 1996/05/02 13:51:46 deraadt Exp $ */ +/* $NetBSD: am7990var.h,v 1.6 1996/04/22 02:40:49 christos Exp $ */ /* * Copyright (c) 1995 Charles M. Hannum. All rights reserved. @@ -33,7 +33,7 @@ #ifdef DDB #define integrate #else -#define integrate static inline +#define integrate static __inline #endif void leconfig __P((struct le_softc *)); @@ -46,6 +46,7 @@ void lestart __P((struct ifnet *)); void lestop __P((struct le_softc *)); void lewatchdog __P((int)); +integrate void lehwinit __P((struct le_softc *)); integrate u_int16_t lerdcsr __P((struct le_softc *, u_int16_t)); integrate void lewrcsr __P((struct le_softc *, u_int16_t, u_int16_t)); @@ -63,17 +64,17 @@ integrate void leread __P((struct le_softc *, int, int)); * for drivers that have not yet been optimized. */ #ifdef LE_NEED_BUF_CONTIG -integrate void copytobuf_contig __P((struct le_softc *, void *, int, int)); -integrate void copyfrombuf_contig __P((struct le_softc *, void *, int, int)); -integrate void zerobuf_contig __P((struct le_softc *, int, int)); +void am7990_copytobuf_contig __P((struct le_softc *, void *, int, int)); +void am7990_copyfrombuf_contig __P((struct le_softc *, void *, int, int)); +void am7990_zerobuf_contig __P((struct le_softc *, int, int)); #endif /* LE_NEED_BUF_CONTIG */ #ifdef LE_NEED_BUF_GAP2 -integrate void copytobuf_gap2 __P((struct le_softc *, void *, int, int)); -integrate void copyfrombuf_gap2 __P((struct le_softc *, void *, int, int)); -integrate void zerobuf_gap2 __P((struct le_softc *, int, int)); +void am7990_copytobuf_gap2 __P((struct le_softc *, void *, int, int)); +void am7990_copyfrombuf_gap2 __P((struct le_softc *, void *, int, int)); +void am7990_zerobuf_gap2 __P((struct le_softc *, int, int)); #endif /* LE_NEED_BUF_GAP2 */ #ifdef LE_NEED_BUF_GAP16 -integrate void copytobuf_gap16 __P((struct le_softc *, void *, int, int)); -integrate void copyfrombuf_gap16 __P((struct le_softc *, void *, int, int)); -integrate void zerobuf_gap16 __P((struct le_softc *, int, int)); +void am7990_copytobuf_gap16 __P((struct le_softc *, void *, int, int)); +void am7990_copyfrombuf_gap16 __P((struct le_softc *, void *, int, int)); +void am7990_zerobuf_gap16 __P((struct le_softc *, int, int)); #endif /* LE_NEED_BUF_GAP16 */ diff --git a/sys/dev/isa/if_le.c b/sys/dev/isa/if_le.c index b6016b092cd..bc7a2e6070e 100644 --- a/sys/dev/isa/if_le.c +++ b/sys/dev/isa/if_le.c @@ -1,5 +1,5 @@ -/* $OpenBSD: if_le.c,v 1.8 1996/04/21 22:24:09 deraadt Exp $ */ -/* $NetBSD: if_le.c,v 1.41 1996/04/11 22:29:34 cgd Exp $ */ +/* $OpenBSD: if_le.c,v 1.9 1996/05/02 13:51:53 deraadt Exp $ */ +/* $NetBSD: if_le.c,v 1.43 1996/04/22 02:53:28 christos Exp $ */ /*- * Copyright (c) 1995 Charles M. Hannum. All rights reserved. @@ -109,6 +109,12 @@ struct cfdriver le_cd = { NULL, "le", DV_IFNET }; +integrate void +lehwinit(sc) + struct le_softc *sc; +{ +} + integrate void lewrcsr(sc, port, val) struct le_softc *sc; @@ -389,11 +395,11 @@ leattach(parent, self, aux) sc->sc_memsize = 16384; } - sc->sc_copytodesc = copytobuf_contig; - sc->sc_copyfromdesc = copyfrombuf_contig; - sc->sc_copytobuf = copytobuf_contig; - sc->sc_copyfrombuf = copyfrombuf_contig; - sc->sc_zerobuf = zerobuf_contig; + sc->sc_copytodesc = am7990_copytobuf_contig; + sc->sc_copyfromdesc = am7990_copyfrombuf_contig; + sc->sc_copytobuf = am7990_copytobuf_contig; + sc->sc_copyfrombuf = am7990_copyfrombuf_contig; + sc->sc_zerobuf = am7990_zerobuf_contig; sc->sc_arpcom.ac_if.if_name = le_cd.cd_name; leconfig(sc); diff --git a/sys/dev/tc/if_le.c b/sys/dev/tc/if_le.c index b528f8c831e..51415a94208 100644 --- a/sys/dev/tc/if_le.c +++ b/sys/dev/tc/if_le.c @@ -1,5 +1,5 @@ -/* $OpenBSD: if_le.c,v 1.3 1996/04/21 22:26:24 deraadt Exp $ */ -/* $NetBSD: if_le.c,v 1.6 1996/04/08 20:09:56 jonathan Exp $ */ +/* $OpenBSD: if_le.c,v 1.4 1996/05/02 13:51:48 deraadt Exp $ */ +/* $NetBSD: if_le.c,v 1.9 1996/04/22 02:54:10 christos Exp $ */ /*- * Copyright (c) 1995 Charles M. Hannum. All rights reserved. @@ -40,37 +40,6 @@ * @(#)if_le.c 8.2 (Berkeley) 11/16/93 */ - -/* - * Supported busses: DEC IOCTL asic baseboard device, TurboChannel option, - * plus baseboard device on "busless" DECstations. - */ -#ifdef alpha -#define CAN_HAVE_IOASIC 1 -#define CAN_HAVE_TC 1 -#endif -#ifdef pmax -#define CAN_HAVE_IOASIC 1 -#define CAN_HAVE_TC 1 -#define CAN_HAVE_MAINBUS 1 -#endif /* pmax */ - - -/* - * For each bus on which a LANCE device might appear, determine - * if that bus was configured into the current kernel. - */ - -#ifdef CAN_HAVE_MAINBUS -/*XXX TEST FOR KN01 OR MIPSFAIR? */ -#endif -#ifdef CAN_HAVE_TC -#include "tc.h" -#endif -#ifdef CAN_HAVE_IOASIC -#include "ioasic.h" -#endif - #include "bpfilter.h" #include @@ -87,53 +56,55 @@ #include #endif -#include - -#if CAN_HAVE_TC && (NTC > 0) -#include -#endif -#if CAN_HAVE_IOASIC && (NIOASIC > 0) -#include -#endif -#if CAN_HAVE_MAINBUS -#include -#include -extern struct cfdriver mainbus_cd; /* XXX */ -#endif - #include #include #define LE_NEED_BUF_CONTIG #define LE_NEED_BUF_GAP2 #define LE_NEED_BUF_GAP16 #include +#include /* access LANCE registers */ void lewritereg __P((volatile u_short *regptr, u_short val)); #define LERDWR(cntl, src, dst) { (dst) = (src); tc_mb(); } #define LEWREG(src, dst) lewritereg(&(dst), (src)) -#define LE_OFFSET_RAM 0x0 -#define LE_OFFSET_LANCE 0x100000 -#define LE_OFFSET_ROM 0x1c0000 - -extern caddr_t le_iomem; - #define LE_SOFTC(unit) le_cd.cd_devs[unit] #define LE_DELAY(x) DELAY(x) -int le_tc_match __P((struct device *, void *, void *)); -void le_tc_attach __P((struct device *, struct device *, void *)); -int leintr __P((void *)); - -struct cfattach le_tc_ca = { - sizeof(struct le_softc), le_tc_match, le_tc_attach -}; - struct cfdriver le_cd = { NULL, "le", DV_IFNET }; +void +dec_le_common_attach(sc, eap) + struct le_softc *sc; + u_char *eap; +{ + int i; + + sc->sc_conf3 = 0; + sc->sc_addr = 0; + sc->sc_memsize = 65536; + + /* + * Get the ethernet address out of rom + */ + for (i = 0; i < sizeof(sc->sc_arpcom.ac_enaddr); i++) { + sc->sc_arpcom.ac_enaddr[i] = *eap; + eap += 4; + } + + sc->sc_arpcom.ac_if.if_name = le_cd.cd_name; + leconfig(sc); +} + +integrate void +lehwinit(sc) + struct le_softc *sc; +{ +} + integrate void lewrcsr(sc, port, val) struct le_softc *sc; @@ -158,150 +129,6 @@ lerdcsr(sc, port) return (val); } -int -le_tc_match(parent, match, aux) - struct device *parent; - void *match, *aux; -{ - -#if CAN_HAVE_IOASIC && (NIOASIC > 0) - if (parent->dv_cfdata->cf_driver == &ioasic_cd) { - struct ioasicdev_attach_args *d = aux; - - if (!ioasic_submatch(match, aux)) { - return (0); - } - if (strncmp("lance", d->iada_modname, TC_ROM_LLEN)) { - return (0); - } - } else -#endif /* IOASIC */ - -#if CAN_HAVE_TC && (NTC > 0) - if (parent->dv_cfdata->cf_driver == &tc_cd) { - struct tc_attach_args *d = aux; - - if (strncmp("PMAD-AA ", d->ta_modname, TC_ROM_LLEN) && - strncmp("PMAD-BA ", d->ta_modname, TC_ROM_LLEN)) - return (0); - } else -#endif /* TC */ - -#if CAN_HAVE_MAINBUS && defined(DS3100) - if (parent->dv_cfdata->cf_driver == &mainbus_cd) { - struct confargs *d = aux; - if (strcmp("lance", d->ca_name) != 0) - return (0); - } else -#endif /* MAINBUS */ - return (0); - - return (1); -} - -typedef void (*ie_fn_t) __P((struct device *, void *, - tc_intrlevel_t, int (*)(void *), void *)); - -void -le_tc_attach(parent, self, aux) - struct device *parent, *self; - void *aux; -{ - register struct le_softc *sc = (void *)self; - ie_fn_t ie_fn; - u_char *cp; /* pointer to MAC address */ - int i; - -#if CAN_HAVE_IOASIC && (NIOASIC > 0) - if (parent->dv_cfdata->cf_driver == &ioasic_cd) { - struct ioasicdev_attach_args *d = aux; - - /* It's on the system IOCTL ASIC */ - sc->sc_r1 = (struct lereg1 *) - TC_DENSE_TO_SPARSE(TC_PHYS_TO_UNCACHED(d->iada_addr)); - sc->sc_mem = (void *)TC_PHYS_TO_UNCACHED(le_iomem); - cp = ioasic_lance_ether_address(); - - sc->sc_copytodesc = copytobuf_gap2; - sc->sc_copyfromdesc = copyfrombuf_gap2; - sc->sc_copytobuf = copytobuf_gap16; - sc->sc_copyfrombuf = copyfrombuf_gap16; - sc->sc_zerobuf = zerobuf_gap16; - - ioasic_lance_dma_setup(le_iomem); /* XXX more thought */ - ie_fn = ioasic_intr_establish; - sc->sc_cookie = (void*)d->iada_cookie; - } else -#endif /* IOASIC */ -#if CAN_HAVE_TC && (NTC > 0) - if (parent->dv_cfdata->cf_driver == &tc_cd) { - struct tc_attach_args *d = aux; - - /* - * It's on the turbochannel proper, or a kn02 - * baseboard implementation of a TC option card. - */ - sc->sc_r1 = (struct lereg1 *)(d->ta_addr + LE_OFFSET_LANCE); - sc->sc_mem = (void *)(d->ta_addr + LE_OFFSET_RAM); - cp = (u_char *)(d->ta_addr + LE_OFFSET_ROM + 2); - - sc->sc_copytodesc = copytobuf_contig; - sc->sc_copyfromdesc = copyfrombuf_contig; - sc->sc_copytobuf = copytobuf_contig; - sc->sc_copyfrombuf = copyfrombuf_contig; - sc->sc_zerobuf = zerobuf_contig; - - sc->sc_cookie = d->ta_cookie; - /* - * TC lance boards have onboard SRAM buffers. DMA - * between the onbard RAM and main memory is not possible, - * so DMA setup is not required. - */ - ie_fn = tc_intr_establish; - } else -#endif /* TC */ -#if CAN_HAVE_MAINBUS && defined(DS3100) - if (parent->dv_cfdata->cf_driver == &mainbus_cd) { - struct confargs *ca = aux; - - /* - * It's on the baseboeard, with a dedicated interrupt line. - */ -/*XXX*/ sc->sc_r1 = (struct lereg1 *)(ca->ca_addr); -/*XXX*/ sc->sc_mem = (void *)TC_PHYS_TO_UNCACHED(0x19000000); -/*XXX*/ cp = (u_char *)(TC_PHYS_TO_UNCACHED(KN01_SYS_CLOCK) + 1); - - sc->sc_copytodesc = copytobuf_gap2; - sc->sc_copyfromdesc = copyfrombuf_gap2; - sc->sc_copytobuf = copytobuf_gap2; - sc->sc_copyfrombuf = copyfrombuf_gap2; - sc->sc_zerobuf = zerobuf_gap2; - - sc->sc_cookie = (void *)ca->ca_slotpri; /*XXX more thought */ - ie_fn = (ie_fn_t) kn01_intr_establish; - } else -#endif /* MAINBUS */ - - panic("le_tc_attach: can't be here"); - - sc->sc_conf3 = 0; - sc->sc_addr = 0; - sc->sc_memsize = 65536; - - /* - * Get the ethernet address out of rom - */ - for (i = 0; i < sizeof(sc->sc_arpcom.ac_enaddr); i++) { - sc->sc_arpcom.ac_enaddr[i] = *cp; - cp += 4; - } - - sc->sc_arpcom.ac_if.if_name = le_cd.cd_name; - leconfig(sc); - - (*ie_fn)(parent, sc->sc_cookie, TC_IPL_NET, leintr, sc); -} - /* * Write a lance register port, reading it back to ensure success. This seems * to be necessary during initialization, since the chip appears to be a bit diff --git a/sys/dev/tc/if_le_ioasic.c b/sys/dev/tc/if_le_ioasic.c new file mode 100644 index 00000000000..2a1fea050b6 --- /dev/null +++ b/sys/dev/tc/if_le_ioasic.c @@ -0,0 +1,104 @@ +/* $NetBSD: if_le_ioasic.c,v 1.1 1996/04/18 00:50:13 cgd Exp $ */ + +/* + * Copyright (c) 1996 Carnegie-Mellon University. + * All rights reserved. + * + * Author: Chris G. Demetriou + * + * Permission to use, copy, modify and distribute this software and + * its documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation. + * + * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" + * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND + * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. + * + * Carnegie Mellon requests users of this software to return to + * + * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU + * School of Computer Science + * Carnegie Mellon University + * Pittsburgh PA 15213-3890 + * + * any improvements or extensions that they make and grant Carnegie the + * rights to redistribute these changes. + */ + +/* + * LANCE on DEC IOCTL ASIC. + */ + +#include +#include +#include +#include +#include +#include + +#include + +#ifdef INET +#include +#include +#endif + +#include +#include +#define LE_NEED_BUF_GAP2 +#define LE_NEED_BUF_GAP16 +#include + +#include +#include + +extern caddr_t le_iomem; + +int le_ioasic_match __P((struct device *, void *, void *)); +void le_ioasic_attach __P((struct device *, struct device *, void *)); + +struct cfattach le_ioasic_ca = { + sizeof(struct le_softc), le_ioasic_match, le_ioasic_attach +}; + +int +le_ioasic_match(parent, match, aux) + struct device *parent; + void *match, *aux; +{ + struct ioasicdev_attach_args *d = aux; + + if (!ioasic_submatch(match, aux)) + return (0); + if (strncmp("lance", d->iada_modname, TC_ROM_LLEN)) + return (0); + + return (1); +} + +void +le_ioasic_attach(parent, self, aux) + struct device *parent, *self; + void *aux; +{ + struct ioasicdev_attach_args *d = aux; + register struct le_softc *sc = (void *)self; + + sc->sc_r1 = (struct lereg1 *) + TC_DENSE_TO_SPARSE(TC_PHYS_TO_UNCACHED(d->iada_addr)); + sc->sc_mem = (void *)TC_PHYS_TO_UNCACHED(le_iomem); + + sc->sc_copytodesc = am7990_copytobuf_gap2; + sc->sc_copyfromdesc = am7990_copyfrombuf_gap2; + sc->sc_copytobuf = am7990_copytobuf_gap16; + sc->sc_copyfrombuf = am7990_copyfrombuf_gap16; + sc->sc_zerobuf = am7990_zerobuf_gap16; + + ioasic_lance_dma_setup(le_iomem); /* XXX more thought */ + + dec_le_common_attach(sc, ioasic_lance_ether_address()); + + ioasic_intr_establish(parent, d->iada_cookie, TC_IPL_NET, leintr, sc); +} diff --git a/sys/dev/tc/if_le_tc.c b/sys/dev/tc/if_le_tc.c new file mode 100644 index 00000000000..194a5e394d7 --- /dev/null +++ b/sys/dev/tc/if_le_tc.c @@ -0,0 +1,110 @@ +/* $NetBSD: if_le_tc.c,v 1.1 1996/04/18 00:50:14 cgd Exp $ */ + +/* + * Copyright (c) 1996 Carnegie-Mellon University. + * All rights reserved. + * + * Author: Chris G. Demetriou + * + * Permission to use, copy, modify and distribute this software and + * its documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation. + * + * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" + * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND + * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. + * + * Carnegie Mellon requests users of this software to return to + * + * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU + * School of Computer Science + * Carnegie Mellon University + * Pittsburgh PA 15213-3890 + * + * any improvements or extensions that they make and grant Carnegie the + * rights to redistribute these changes. + */ + +/* + * LANCE on TurboChannel. + */ + +#include +#include +#include +#include +#include +#include + +#include + +#ifdef INET +#include +#include +#endif + +#include +#include +#define LE_NEED_BUF_CONTIG +#include + +#include + +int le_tc_match __P((struct device *, void *, void *)); +void le_tc_attach __P((struct device *, struct device *, void *)); + +struct cfattach le_tc_ca = { + sizeof(struct le_softc), le_tc_match, le_tc_attach +}; + +#define LE_OFFSET_RAM 0x0 +#define LE_OFFSET_LANCE 0x100000 +#define LE_OFFSET_ROM 0x1c0000 + +int +le_tc_match(parent, match, aux) + struct device *parent; + void *match, *aux; +{ + struct tc_attach_args *d = aux; + + if (strncmp("PMAD-AA ", d->ta_modname, TC_ROM_LLEN) && + strncmp("PMAD-BA ", d->ta_modname, TC_ROM_LLEN)) + return (0); + + return (1); +} + +void +le_tc_attach(parent, self, aux) + struct device *parent, *self; + void *aux; +{ + register struct le_softc *sc = (void *)self; + struct tc_attach_args *d = aux; + + /* + * It's on the turbochannel proper, or a kn02 + * baseboard implementation of a TC option card. + */ + sc->sc_r1 = (struct lereg1 *)(d->ta_addr + LE_OFFSET_LANCE); + sc->sc_mem = (void *)(d->ta_addr + LE_OFFSET_RAM); + + sc->sc_copytodesc = am7990_copytobuf_contig; + sc->sc_copyfromdesc = am7990_copyfrombuf_contig; + sc->sc_copytobuf = am7990_copytobuf_contig; + sc->sc_copyfrombuf = am7990_copyfrombuf_contig; + sc->sc_zerobuf = am7990_zerobuf_contig; + + /* + * TC lance boards have onboard SRAM buffers. DMA + * between the onbard RAM and main memory is not possible, + * so DMA setup is not required. + */ + + dec_le_common_attach(sc, (u_char *)(d->ta_addr + LE_OFFSET_ROM + 2)); + + tc_intr_establish(parent, d->ta_cookie, TC_IPL_NET, leintr, sc); +} diff --git a/sys/dev/tc/if_levar.h b/sys/dev/tc/if_levar.h index 731df829faf..5d6f0c44e8f 100644 --- a/sys/dev/tc/if_levar.h +++ b/sys/dev/tc/if_levar.h @@ -1,4 +1,4 @@ -/* $NetBSD: if_levar.h,v 1.1 1995/12/20 00:52:18 cgd Exp $ */ +/* $NetBSD: if_levar.h,v 1.2 1996/04/18 00:50:15 cgd Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -63,8 +63,6 @@ struct le_softc { struct device sc_dev; /* base structure */ struct arpcom sc_arpcom; /* Ethernet common part */ - void *sc_cookie; /* bus interrupt/DMA cookie */ - void (*sc_copytodesc) /* Copy to descriptor */ __P((struct le_softc *, void *, int, int)); void (*sc_copyfromdesc) /* Copy from descriptor */ @@ -100,3 +98,6 @@ struct le_softc { struct lereg1 *sc_r1; /* LANCE registers */ }; + +int leintr __P((void *)); +void dec_le_common_attach __P((struct le_softc *, u_char *)); diff --git a/sys/dev/tc/tc.c b/sys/dev/tc/tc.c index 1b861c032be..490860c94e2 100644 --- a/sys/dev/tc/tc.c +++ b/sys/dev/tc/tc.c @@ -1,22 +1,22 @@ -/* $OpenBSD: tc.c,v 1.3 1996/04/21 22:26:28 deraadt Exp $ */ -/* $NetBSD: tc.c,v 1.13 1996/04/09 20:50:06 jonathan Exp $ */ +/* $OpenBSD: tc.c,v 1.4 1996/05/02 13:51:51 deraadt Exp $ */ +/* $NetBSD: tc.c,v 1.14 1996/04/18 01:12:41 cgd Exp $ */ /* * Copyright (c) 1994, 1995 Carnegie-Mellon University. * All rights reserved. * * Author: Chris G. Demetriou - * + * * Permission to use, copy, modify and distribute this software and * its documentation is hereby granted, provided that both the copyright * notice and this permission notice appear in all copies of the * software, derivative works or modified versions, and any portions * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND + * + * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" + * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * + * * Carnegie Mellon requests users of this software to return to * * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU @@ -36,8 +36,6 @@ #include #include -#include - struct tc_softc { struct device sc_dv; @@ -79,8 +77,6 @@ tcmatch(parent, cfdata, aux) if (strcmp(tba->tba_busname, cf->cf_driver->cd_name)) return (0); - /* XXX check other indicators */ - return (1); } @@ -139,7 +135,7 @@ tcattach(parent, self, aux) ta.ta_addr = tcaddr; ta.ta_cookie = builtin->tcb_cookie; ta.ta_busspeed = sc->sc_speed; - + /* * Mark the slot as used, so we don't check it later. */ @@ -200,17 +196,17 @@ tcprint(aux, pnp) if (pnp) { tc_devinfo(ta->ta_modname, devinfo); - printf("%s at %s", devinfo, pnp); + printf("%s at %s", devinfo, pnp); } printf(" slot %d offset 0x%lx", ta->ta_slot, (long)ta->ta_offset); return (UNCONF); } -int -tcsubmatch(parent, match, aux) - struct device *parent; - void *match, *aux; +int +tcsubmatch(parent, match, aux) + struct device *parent; + void *match, *aux; { struct cfdata *cf = match; struct tc_attach_args *d = aux; @@ -281,7 +277,7 @@ tc_intr_establish(dev, cookie, level, handler, arg) { struct tc_softc *sc = (struct tc_softc *)dev; - (*sc->sc_intr_establish)(sc->sc_dv.dv_parent, cookie, level, + (*sc->sc_intr_establish)(sc->sc_dv.dv_parent, cookie, level, handler, arg); } @@ -296,12 +292,12 @@ tc_intr_disestablish(dev, cookie) } #ifdef TCVERBOSE -/* +/* * Descriptions of of known devices. - */ + */ struct tc_knowndev { const char *id, *driver, *description; -}; +}; #include #endif /* TCVERBOSE */ -- 2.20.1