Sync usage with man page.
[netbsd-mini2440.git] / sys / dev / xmi / bi_xmi.c
blobc6e55b6bf432bca02457f9cc7aebcb53b0c7960e
1 /* $NetBSD: bi_xmi.c,v 1.8 2009/05/12 13:22:58 cegger Exp $ */
3 /*
4 * Copyright (c) 2000 Ludd, University of Lule}, Sweden. All rights reserved.
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
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.
35 * DWMBA XMI-BI adapter.
38 #include <sys/cdefs.h>
39 __KERNEL_RCSID(0, "$NetBSD: bi_xmi.c,v 1.8 2009/05/12 13:22:58 cegger Exp $");
41 #include <sys/param.h>
42 #include <sys/device.h>
44 #include <sys/bus.h>
46 #include <dev/xmi/xmireg.h>
47 #include <dev/xmi/xmivar.h>
49 #include <dev/bi/bireg.h>
50 #include <dev/bi/bivar.h>
52 #include "locators.h"
54 static int
55 bi_xmi_match(device_t parent, cfdata_t cf, void *aux)
57 struct xmi_attach_args *xa = aux;
59 if (bus_space_read_2(xa->xa_iot, xa->xa_ioh, XMI_TYPE) != XMIDT_DWMBA)
60 return 0;
62 if (cf->cf_loc[XMICF_NODE] != XMICF_NODE_DEFAULT &&
63 cf->cf_loc[XMICF_NODE] != xa->xa_nodenr)
64 return 0;
66 return 1;
69 static void
70 bi_xmi_attach(device_t parent, device_t self, void *aux)
72 struct bi_softc *sc = device_private(self);
73 struct xmi_attach_args *xa = aux;
76 * Fill in bus specific data.
78 sc->sc_dev = self;
79 sc->sc_addr = (bus_addr_t)BI_BASE(xa->xa_nodenr, 0);
80 sc->sc_iot = xa->xa_iot; /* No special I/O handling */
81 sc->sc_dmat = xa->xa_dmat; /* No special DMA handling either */
82 sc->sc_intcpu = xa->xa_intcpu;
84 bi_attach(sc);
87 CFATTACH_DECL_NEW(bi_xmi, sizeof(struct bi_softc),
88 bi_xmi_match, bi_xmi_attach, NULL, NULL);