FreeBSD/Linux Kernel Cross Reference
sys/dev/xmi/bi_xmi.c
1 /* $NetBSD: bi_xmi.c,v 1.5 2002/10/02 16:53:21 thorpej Exp $ */
2
3 /*
4 * Copyright (c) 2000 Ludd, University of Lule}, Sweden. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. All advertising materials mentioning features or use of this software
15 * must display the following acknowledgement:
16 * This product includes software developed at Ludd, University of
17 * Lule}, Sweden and its contributors.
18 * 4. The name of the author may not be used to endorse or promote products
19 * derived from this software without specific prior written permission
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33
34 /*
35 * DWMBA XMI-BI adapter.
36 */
37
38 #include <sys/cdefs.h>
39 __KERNEL_RCSID(0, "$NetBSD: bi_xmi.c,v 1.5 2002/10/02 16:53:21 thorpej Exp $");
40
41 #include <sys/param.h>
42 #include <sys/device.h>
43
44 #include <machine/bus.h>
45
46 #include <dev/xmi/xmireg.h>
47 #include <dev/xmi/xmivar.h>
48
49 #include <dev/bi/bireg.h>
50 #include <dev/bi/bivar.h>
51
52 #include "locators.h"
53
54 static int
55 bi_xmi_match(struct device *parent, struct cfdata *cf, void *aux)
56 {
57 struct xmi_attach_args *xa = aux;
58
59 if (bus_space_read_2(xa->xa_iot, xa->xa_ioh, XMI_TYPE) != XMIDT_DWMBA)
60 return 0;
61
62 if (cf->cf_loc[XMICF_NODE] != XMICF_NODE_DEFAULT &&
63 cf->cf_loc[XMICF_NODE] != xa->xa_nodenr)
64 return 0;
65
66 return 1;
67 }
68
69 static void
70 bi_xmi_attach(struct device *parent, struct device *self, void *aux)
71 {
72 struct bi_softc *sc = (void *)self;
73 struct xmi_attach_args *xa = aux;
74
75 /*
76 * Fill in bus specific data.
77 */
78 sc->sc_addr = (bus_addr_t)BI_BASE(xa->xa_nodenr, 0);
79 sc->sc_iot = xa->xa_iot; /* No special I/O handling */
80 sc->sc_dmat = xa->xa_dmat; /* No special DMA handling either */
81 sc->sc_intcpu = xa->xa_intcpu;
82
83 bi_attach(sc);
84 }
85
86 CFATTACH_DECL(bi_xmi, sizeof(struct bi_softc),
87 bi_xmi_match, bi_xmi_attach, NULL, NULL);
Cache object: 01c8631e8525cc1fd7788a88d5f1ff69
|