Annotation of sys/arch/hp300/dev/hil_intio.c, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: hil_intio.c,v 1.8 2007/01/06 20:10:57 miod Exp $ */
2:
3: /*
4: * Copyright (c) 2005, Miodrag Vallat.
5: * All rights reserved.
6: *
7: * Redistribution and use in source and binary forms, with or without
8: * modification, are permitted provided that the following conditions
9: * are met:
10: * 1. Redistributions of source code must retain the above copyright
11: * notice, this list of conditions and the following disclaimer.
12: * 2. Redistributions in binary form must reproduce the above copyright
13: * notice, this list of conditions and the following disclaimer in the
14: * documentation and/or other materials provided with the distribution.
15: *
16: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18: * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19: * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
20: * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21: * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22: * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
24: * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
25: * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26: * POSSIBILITY OF SUCH DAMAGE.
27: *
28: */
29:
30: #include <sys/param.h>
31: #include <sys/systm.h>
32: #include <sys/device.h>
33: #include <sys/conf.h>
34:
35: #include <machine/bus.h>
36: #include <machine/cpu.h>
37: #include <machine/intr.h>
38:
39: #include <dev/cons.h>
40:
41: #include <hp300/dev/intiovar.h>
42:
43: #include <machine/hil_machdep.h>
44: #include <machine/bus.h>
45: #include <dev/hil/hilvar.h>
46:
47: int hil_intio_match(struct device *, void *, void *);
48: void hil_intio_attach(struct device *, struct device *, void *);
49:
50: struct cfattach hil_intio_ca = {
51: sizeof(struct hil_softc), hil_intio_match, hil_intio_attach
52: };
53:
54: int
55: hil_intio_match(struct device *parent, void *match, void *aux)
56: {
57: struct intio_attach_args *ia = aux;
58: static int hil_matched = 0;
59:
60: /* Allow only one instance. */
61: if (hil_matched != 0)
62: return (0);
63:
64: if (badaddr((caddr_t)IIOV(HILADDR))) /* should not happen! */
65: return (0);
66:
67: ia->ia_addr = (caddr_t)HILADDR;
68: return (1);
69: }
70:
71: struct isr hil_isr;
72: int hil_is_console = -1; /* undecided */
73:
74: void
75: hil_intio_attach(struct device *parent, struct device *self, void *aux)
76: {
77: struct hil_softc *sc = (void *)self;
78: struct intio_attach_args *ia = aux;
79: extern struct consdev wsdisplay_cons;
80:
81: sc->sc_bst = ia->ia_tag;
82: if (bus_space_map(sc->sc_bst, HILADDR,
83: HILMAPSIZE, 0, &sc->sc_bsh) != 0) {
84: printf(": couldn't map hil controller\n");
85: return;
86: }
87:
88: /*
89: * Check that the configured console device is a wsdisplay.
90: */
91: if (cn_tab != &wsdisplay_cons)
92: hil_is_console = 0;
93:
94: hil_isr.isr_func = hil_intr;
95: hil_isr.isr_arg = sc;
96: hil_isr.isr_ipl = 1;
97: hil_isr.isr_priority = IPL_TTY;
98:
99: printf(" ipl %d", hil_isr.isr_ipl);
100:
101: hil_attach(sc, &hil_is_console);
102: intr_establish(&hil_isr, self->dv_xname);
103:
104: startuphook_establish(hil_attach_deferred, sc);
105: }
CVSweb