No empty .Rs/.Re
[netbsd-mini2440.git] / sys / arch / hp700 / dev / lpt_ssio.c
blob63e3160a404c21d5e2a85b604567849fb9bb6ddc
1 /* $OpenBSD: lpt_ssio.c,v 1.1 2007/06/20 18:22:15 kettenis Exp $ */
3 /*
4 * Copyright (c) 2007 Mark Kettenis
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 #include <sys/param.h>
20 #include <sys/systm.h>
21 #include <sys/device.h>
23 #include <machine/bus.h>
25 #include <dev/ic/lptreg.h>
26 #include <dev/ic/lptvar.h>
28 #include <hp700/dev/ssiovar.h>
30 int lpt_ssio_match(device_t, cfdata_t, void *);
31 void lpt_ssio_attach(device_t, device_t, void *);
33 CFATTACH_DECL_NEW(lpt_ssio, sizeof(struct lpt_softc),
34 lpt_ssio_match, lpt_ssio_attach, NULL, NULL);
36 int
37 lpt_ssio_match(device_t parent, cfdata_t match, void *aux)
39 cfdata_t cf = match;
40 struct ssio_attach_args *saa = aux;
42 if (strcmp(saa->saa_name, "lpt") != 0)
43 return (0);
45 /* Check locators. */
46 if (cf->ssiocf_irq != SSIO_UNK_IRQ && cf->ssiocf_irq != saa->saa_irq)
47 return (0);
49 return (1);
52 void
53 lpt_ssio_attach(device_t parent, device_t self, void *aux)
55 struct lpt_softc *sc = device_private(self);
56 struct ssio_attach_args *saa = aux;
58 sc->sc_dev = self;
59 sc->sc_iot = saa->saa_iot;
60 if (bus_space_map(sc->sc_iot, saa->saa_iobase, LPT_NPORTS,
61 0, &sc->sc_ioh)) {
62 aprint_error(": can't map i/o ports\n");
63 return;
66 lpt_attach_subr(sc);
68 sc->sc_ih = ssio_intr_establish(IPL_TTY, saa->saa_irq,
69 lptintr, sc, device_xname(self));
71 aprint_normal("\n");