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