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