Home | History | Annotate | Line # | Download | only in tc
if_le_tc.c revision 1.6
      1  1.6  thorpej /*	$NetBSD: if_le_tc.c,v 1.6 1997/03/17 03:19:13 thorpej Exp $	*/
      2  1.1      cgd 
      3  1.1      cgd /*
      4  1.1      cgd  * Copyright (c) 1996 Carnegie-Mellon University.
      5  1.1      cgd  * All rights reserved.
      6  1.1      cgd  *
      7  1.1      cgd  * Author: Chris G. Demetriou
      8  1.1      cgd  *
      9  1.1      cgd  * Permission to use, copy, modify and distribute this software and
     10  1.1      cgd  * its documentation is hereby granted, provided that both the copyright
     11  1.1      cgd  * notice and this permission notice appear in all copies of the
     12  1.1      cgd  * software, derivative works or modified versions, and any portions
     13  1.1      cgd  * thereof, and that both notices appear in supporting documentation.
     14  1.1      cgd  *
     15  1.1      cgd  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
     16  1.1      cgd  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
     17  1.1      cgd  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
     18  1.1      cgd  *
     19  1.1      cgd  * Carnegie Mellon requests users of this software to return to
     20  1.1      cgd  *
     21  1.1      cgd  *  Software Distribution Coordinator  or  Software.Distribution (at) CS.CMU.EDU
     22  1.1      cgd  *  School of Computer Science
     23  1.1      cgd  *  Carnegie Mellon University
     24  1.1      cgd  *  Pittsburgh PA 15213-3890
     25  1.1      cgd  *
     26  1.1      cgd  * any improvements or extensions that they make and grant Carnegie the
     27  1.1      cgd  * rights to redistribute these changes.
     28  1.1      cgd  */
     29  1.1      cgd 
     30  1.1      cgd /*
     31  1.1      cgd  * LANCE on TurboChannel.
     32  1.1      cgd  */
     33  1.1      cgd 
     34  1.1      cgd #include <sys/param.h>
     35  1.1      cgd #include <sys/systm.h>
     36  1.1      cgd #include <sys/mbuf.h>
     37  1.1      cgd #include <sys/syslog.h>
     38  1.1      cgd #include <sys/socket.h>
     39  1.1      cgd #include <sys/device.h>
     40  1.1      cgd 
     41  1.1      cgd #include <net/if.h>
     42  1.5      cgd #include <net/if_ether.h>
     43  1.6  thorpej #include <net/if_media.h>
     44  1.1      cgd 
     45  1.1      cgd #ifdef INET
     46  1.1      cgd #include <netinet/in.h>
     47  1.4       is #include <netinet/if_inarp.h>
     48  1.1      cgd #endif
     49  1.1      cgd 
     50  1.1      cgd #include <dev/ic/am7990reg.h>
     51  1.1      cgd #include <dev/ic/am7990var.h>
     52  1.1      cgd 
     53  1.2  thorpej #include <dev/tc/if_levar.h>
     54  1.1      cgd #include <dev/tc/tcvar.h>
     55  1.1      cgd 
     56  1.3      cgd #ifdef __BROKEN_INDIRECT_CONFIG
     57  1.1      cgd int	le_tc_match __P((struct device *, void *, void *));
     58  1.3      cgd #else
     59  1.3      cgd int	le_tc_match __P((struct device *, struct cfdata *, void *));
     60  1.3      cgd #endif
     61  1.1      cgd void	le_tc_attach __P((struct device *, struct device *, void *));
     62  1.1      cgd 
     63  1.1      cgd struct cfattach le_tc_ca = {
     64  1.1      cgd 	sizeof(struct le_softc), le_tc_match, le_tc_attach
     65  1.1      cgd };
     66  1.1      cgd 
     67  1.1      cgd #define	LE_OFFSET_RAM		0x0
     68  1.1      cgd #define	LE_OFFSET_LANCE		0x100000
     69  1.1      cgd #define	LE_OFFSET_ROM		0x1c0000
     70  1.1      cgd 
     71  1.1      cgd int
     72  1.1      cgd le_tc_match(parent, match, aux)
     73  1.1      cgd 	struct device *parent;
     74  1.3      cgd #ifdef __BROKEN_INDIRECT_CONFIG
     75  1.3      cgd 	void *match;
     76  1.3      cgd #else
     77  1.3      cgd 	struct cfdata *match;
     78  1.3      cgd #endif
     79  1.3      cgd 	void *aux;
     80  1.1      cgd {
     81  1.1      cgd 	struct tc_attach_args *d = aux;
     82  1.1      cgd 
     83  1.1      cgd 	if (strncmp("PMAD-AA ", d->ta_modname, TC_ROM_LLEN) &&
     84  1.1      cgd 	    strncmp("PMAD-BA ", d->ta_modname, TC_ROM_LLEN))
     85  1.1      cgd 		return (0);
     86  1.1      cgd 
     87  1.1      cgd 	return (1);
     88  1.1      cgd }
     89  1.1      cgd 
     90  1.1      cgd void
     91  1.1      cgd le_tc_attach(parent, self, aux)
     92  1.1      cgd 	struct device *parent, *self;
     93  1.1      cgd 	void *aux;
     94  1.1      cgd {
     95  1.2  thorpej 	register struct le_softc *lesc = (void *)self;
     96  1.2  thorpej 	register struct am7990_softc *sc = &lesc->sc_am7990;
     97  1.1      cgd 	struct tc_attach_args *d = aux;
     98  1.1      cgd 
     99  1.1      cgd 	/*
    100  1.1      cgd 	 * It's on the turbochannel proper, or a kn02
    101  1.1      cgd 	 * baseboard implementation of a TC option card.
    102  1.1      cgd 	 */
    103  1.2  thorpej 	lesc->sc_r1 = (struct lereg1 *)(d->ta_addr + LE_OFFSET_LANCE);
    104  1.1      cgd 	sc->sc_mem = (void *)(d->ta_addr + LE_OFFSET_RAM);
    105  1.1      cgd 
    106  1.1      cgd 	sc->sc_copytodesc = am7990_copytobuf_contig;
    107  1.1      cgd 	sc->sc_copyfromdesc = am7990_copyfrombuf_contig;
    108  1.1      cgd 	sc->sc_copytobuf = am7990_copytobuf_contig;
    109  1.1      cgd 	sc->sc_copyfrombuf = am7990_copyfrombuf_contig;
    110  1.1      cgd 	sc->sc_zerobuf = am7990_zerobuf_contig;
    111  1.1      cgd 
    112  1.1      cgd 	/*
    113  1.1      cgd 	 * TC lance boards have onboard SRAM buffers.  DMA
    114  1.1      cgd 	 * between the onbard RAM and main memory is not possible,
    115  1.1      cgd 	 * so  DMA setup is not required.
    116  1.1      cgd 	 */
    117  1.1      cgd 
    118  1.1      cgd 	dec_le_common_attach(sc, (u_char *)(d->ta_addr + LE_OFFSET_ROM + 2));
    119  1.1      cgd 
    120  1.2  thorpej 	tc_intr_establish(parent, d->ta_cookie, TC_IPL_NET, am7990_intr, sc);
    121  1.1      cgd }
    122