Expand PMF_FN_* macros.
[netbsd-mini2440.git] / sys / dev / tc / if_le_tc.c
blob4e8f2aca3b577b3717f87c94a94c16956dfc2e98
1 /* $NetBSD: if_le_tc.c,v 1.20 2006/03/31 17:39:33 thorpej Exp $ */
3 /*
4 * Copyright (c) 1996 Carnegie-Mellon University.
5 * All rights reserved.
7 * Author: Chris G. Demetriou
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.
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.
19 * Carnegie Mellon requests users of this software to return to
21 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
22 * School of Computer Science
23 * Carnegie Mellon University
24 * Pittsburgh PA 15213-3890
26 * any improvements or extensions that they make and grant Carnegie the
27 * rights to redistribute these changes.
31 * LANCE on TurboChannel.
34 #include <sys/cdefs.h>
35 __KERNEL_RCSID(0, "$NetBSD: if_le_tc.c,v 1.20 2006/03/31 17:39:33 thorpej Exp $");
37 #include "opt_inet.h"
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>
46 #include <net/if.h>
47 #include <net/if_ether.h>
48 #include <net/if_media.h>
50 #ifdef INET
51 #include <netinet/in.h>
52 #include <netinet/if_inarp.h>
53 #endif
55 #include <dev/ic/lancereg.h>
56 #include <dev/ic/lancevar.h>
57 #include <dev/ic/am7990reg.h>
58 #include <dev/ic/am7990var.h>
60 #include <dev/tc/if_levar.h>
61 #include <dev/tc/tcvar.h>
63 static int le_tc_match(device_t, cfdata_t, void *);
64 static void le_tc_attach(device_t, device_t, void *);
66 CFATTACH_DECL_NEW(le_tc, sizeof(struct le_softc),
67 le_tc_match, le_tc_attach, NULL, NULL);
69 #define LE_OFFSET_RAM 0x0
70 #define LE_OFFSET_LANCE 0x100000
71 #define LE_OFFSET_ROM 0x1c0000
73 static int
74 le_tc_match(device_t parent, cfdata_t cf, void *aux)
76 struct tc_attach_args *d = aux;
78 if (strncmp("PMAD-AA ", d->ta_modname, TC_ROM_LLEN) != 0)
79 return (0);
81 return (1);
84 static void
85 le_tc_attach(device_t parent, device_t self, void *aux)
87 struct le_softc *lesc = device_private(self);
88 struct lance_softc *sc = &lesc->sc_am7990.lsc;
89 struct tc_attach_args *d = aux;
91 sc->sc_dev = self;
94 * It's on the turbochannel proper, or a kn02
95 * baseboard implementation of a TC option card.
97 lesc->sc_r1 = (struct lereg1 *)
98 TC_DENSE_TO_SPARSE(TC_PHYS_TO_UNCACHED(d->ta_addr + LE_OFFSET_LANCE));
99 sc->sc_mem = (void *)(d->ta_addr + LE_OFFSET_RAM);
101 sc->sc_copytodesc = lance_copytobuf_contig;
102 sc->sc_copyfromdesc = lance_copyfrombuf_contig;
103 sc->sc_copytobuf = lance_copytobuf_contig;
104 sc->sc_copyfrombuf = lance_copyfrombuf_contig;
105 sc->sc_zerobuf = lance_zerobuf_contig;
108 * TC lance boards have onboard SRAM buffers. DMA
109 * between the onbard RAM and main memory is not possible,
110 * so DMA setup is not required.
113 dec_le_common_attach(&lesc->sc_am7990,
114 (uint8_t *)(d->ta_addr + LE_OFFSET_ROM + 2));
116 tc_intr_establish(parent, d->ta_cookie, TC_IPL_NET, am7990_intr, sc);