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