if_le_ioasic.c revision 1.1 1 /* $NetBSD: if_le_ioasic.c,v 1.1 1996/04/18 00:50:13 cgd 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 (at) 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 DEC IOCTL ASIC.
32 */
33
34 #include <sys/param.h>
35 #include <sys/systm.h>
36 #include <sys/mbuf.h>
37 #include <sys/syslog.h>
38 #include <sys/socket.h>
39 #include <sys/device.h>
40
41 #include <net/if.h>
42
43 #ifdef INET
44 #include <netinet/in.h>
45 #include <netinet/if_ether.h>
46 #endif
47
48 #include <dev/tc/if_levar.h>
49 #include <dev/ic/am7990reg.h>
50 #define LE_NEED_BUF_GAP2
51 #define LE_NEED_BUF_GAP16
52 #include <dev/ic/am7990var.h>
53
54 #include <dev/tc/tcvar.h>
55 #include <dev/tc/ioasicvar.h>
56
57 extern caddr_t le_iomem;
58
59 int le_ioasic_match __P((struct device *, void *, void *));
60 void le_ioasic_attach __P((struct device *, struct device *, void *));
61
62 struct cfattach le_ioasic_ca = {
63 sizeof(struct le_softc), le_ioasic_match, le_ioasic_attach
64 };
65
66 int
67 le_ioasic_match(parent, match, aux)
68 struct device *parent;
69 void *match, *aux;
70 {
71 struct ioasicdev_attach_args *d = aux;
72
73 if (!ioasic_submatch(match, aux))
74 return (0);
75 if (strncmp("lance", d->iada_modname, TC_ROM_LLEN))
76 return (0);
77
78 return (1);
79 }
80
81 void
82 le_ioasic_attach(parent, self, aux)
83 struct device *parent, *self;
84 void *aux;
85 {
86 struct ioasicdev_attach_args *d = aux;
87 register struct le_softc *sc = (void *)self;
88
89 sc->sc_r1 = (struct lereg1 *)
90 TC_DENSE_TO_SPARSE(TC_PHYS_TO_UNCACHED(d->iada_addr));
91 sc->sc_mem = (void *)TC_PHYS_TO_UNCACHED(le_iomem);
92
93 sc->sc_copytodesc = am7990_copytobuf_gap2;
94 sc->sc_copyfromdesc = am7990_copyfrombuf_gap2;
95 sc->sc_copytobuf = am7990_copytobuf_gap16;
96 sc->sc_copyfrombuf = am7990_copyfrombuf_gap16;
97 sc->sc_zerobuf = am7990_zerobuf_gap16;
98
99 ioasic_lance_dma_setup(le_iomem); /* XXX more thought */
100
101 dec_le_common_attach(sc, ioasic_lance_ether_address());
102
103 ioasic_intr_establish(parent, d->iada_cookie, TC_IPL_NET, leintr, sc);
104 }
105