1 /* $NetBSD: lpt_mace.c,v 1.7 2008/03/07 17:15:51 cube Exp $ */
4 * Copyright (c) 2003 Christopher SEKIYA
5 * Copyright (c) 2000 Soren S. Jorvang
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. All advertising materials mentioning features or use of this software
17 * must display the following acknowledgement:
18 * This product includes software developed for the
19 * NetBSD Project. See http://www.NetBSD.org/ for
20 * information about NetBSD.
21 * 4. The name of the author may not be used to endorse or promote products
22 * derived from this software without specific prior written permission.
24 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
25 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
26 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
27 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
28 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
29 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
33 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 #include <sys/cdefs.h>
37 __KERNEL_RCSID(0, "$NetBSD: lpt_mace.c,v 1.7 2008/03/07 17:15:51 cube Exp $");
39 #include <sys/param.h>
40 #include <sys/systm.h>
41 #include <sys/ioctl.h>
42 #include <sys/select.h>
47 #include <sys/kernel.h>
48 #include <sys/syslog.h>
49 #include <sys/types.h>
50 #include <sys/device.h>
52 #include <machine/cpu.h>
53 #include <machine/locore.h>
54 #include <machine/autoconf.h>
55 #include <machine/bus.h>
56 #include <machine/machtype.h>
58 #include <sgimips/mace/macevar.h>
60 #include <dev/ic/lptreg.h>
61 #include <dev/ic/lptvar.h>
63 struct lpt_mace_softc
{
64 struct lpt_softc sc_lpt
;
69 static int lpt_mace_match(device_t
, cfdata_t
, void *);
70 static void lpt_mace_attach(device_t
, device_t
, void *);
72 CFATTACH_DECL_NEW(lpt_mace
, sizeof(struct lpt_mace_softc
),
73 lpt_mace_match
, lpt_mace_attach
, NULL
, NULL
);
76 lpt_mace_match(device_t parent
, cfdata_t match
, void *aux
)
83 lpt_mace_attach(device_t parent
, device_t self
, void *aux
)
85 struct lpt_mace_softc
*msc
= device_private(self
);
86 struct lpt_softc
*sc
= &msc
->sc_lpt
;
87 struct mace_attach_args
*maa
= aux
;
90 sc
->sc_iot
= maa
->maa_st
;
92 /* XXX should use bus_space_map() */
93 if (bus_space_subregion(sc
->sc_iot
, maa
->maa_sh
,
94 maa
->maa_offset
, LPT_NPORTS
, &sc
->sc_ioh
) != 0) {
95 aprint_error(": can't map i/o space\n");
103 cpu_intr_establish(maa
->maa_intr
, maa
->maa_intrmask
, lptintr
, sc
);