No empty .Rs/.Re
[netbsd-mini2440.git] / sys / arch / mvme68k / dev / vme_two_68k.c
blob966673edac7f9e065fdcec774363f2ae3902456b
1 /* $NetBSD: vme_two_68k.c,v 1.8 2008/01/12 09:54:27 tsutsui Exp $ */
3 /*-
4 * Copyright (c) 1999, 2002 The NetBSD Foundation, Inc.
5 * All rights reserved.
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Steve C. Woodford.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
33 * Front-end for the VMEchip2 found on the MVME-1[67][27] boards.
36 #include <sys/cdefs.h>
37 __KERNEL_RCSID(0, "$NetBSD: vme_two_68k.c,v 1.8 2008/01/12 09:54:27 tsutsui Exp $");
39 #include "vmetwo.h"
41 #include <sys/param.h>
42 #include <sys/kernel.h>
43 #include <sys/systm.h>
44 #include <sys/device.h>
46 #include <machine/cpu.h>
47 #include <machine/bus.h>
49 #include <dev/vme/vmereg.h>
50 #include <dev/vme/vmevar.h>
52 #include <mvme68k/mvme68k/isr.h>
53 #include <mvme68k/dev/mainbus.h>
55 #include <dev/mvme/mvmebus.h>
56 #include <dev/mvme/vme_tworeg.h>
57 #include <dev/mvme/vme_twovar.h>
59 #include "ioconf.h"
61 static void vmetwoisrlink(void *, int (*)(void *), void *,
62 int, int, struct evcnt *);
63 static void vmetwoisrunlink(void *, int);
64 static struct evcnt *vmetwoisrevcnt(void *, int);
66 #if NVMETWO > 0
68 int vmetwo_match(struct device *, struct cfdata *, void *);
69 void vmetwo_attach(struct device *, struct device *, void *);
71 CFATTACH_DECL(vmetwo, sizeof(struct vmetwo_softc),
72 vmetwo_match, vmetwo_attach, NULL, NULL);
75 /* ARGSUSED */
76 int
77 vmetwo_match(struct device *parent, struct cfdata *cf, void *aux)
79 struct mainbus_attach_args *ma;
80 static int matched = 0;
82 ma = aux;
84 if (strcmp(ma->ma_name, vmetwo_cd.cd_name))
85 return 0;
87 /* Only one VMEchip2, please. */
88 if (matched++)
89 return 0;
92 * Some mvme1[67]2 boards have a `no VMEchip2' build option...
94 return vmetwo_probe(ma->ma_bust, ma->ma_offset) ? 1 : 0;
97 /* ARGSUSED */
98 void
99 vmetwo_attach(struct device *parent, struct device *self, void *aux)
101 struct mainbus_attach_args *ma;
102 struct vmetwo_softc *sc;
104 sc = (struct vmetwo_softc *) self;
105 ma = aux;
108 * Map the local control registers
110 bus_space_map(ma->ma_bust, ma->ma_offset + VME2REG_LCSR_OFFSET,
111 VME2LCSR_SIZE, 0, &sc->sc_lcrh);
113 #ifdef notyet
115 * Map the global control registers
117 bus_space_map(ma->ma_bust, ma->ma_offset + VME2REG_GCSR_OFFSET,
118 VME2GCSR_SIZE, 0, &sc->sc_gcrh);
119 #endif
121 /* Initialise stuff for the common vme_two back-end */
122 sc->sc_mvmebus.sc_bust = ma->ma_bust;
123 sc->sc_mvmebus.sc_dmat = ma->ma_dmat;
125 vmetwo_init(sc);
128 #endif /* NVMETWO > 0 */
130 void
131 vmetwo_md_intr_init(struct vmetwo_softc *sc)
134 sc->sc_isrlink = vmetwoisrlink;
135 sc->sc_isrunlink = vmetwoisrunlink;
136 sc->sc_isrevcnt = vmetwoisrevcnt;
139 /* ARGSUSED */
140 static void
141 vmetwoisrlink(void *cookie, int (*fn)(void *), void *arg, int ipl, int vec,
142 struct evcnt *evcnt)
145 isrlink_vectored(fn, arg, ipl, vec, evcnt);
148 /* ARGSUSED */
149 static void
150 vmetwoisrunlink(void *cookie, int vec)
153 isrunlink_vectored(vec);
156 /* ARGSUSED */
157 static struct evcnt *
158 vmetwoisrevcnt(void *cookie, int ipl)
161 return isrlink_evcnt(ipl);