opms_isa.c revision 1.1.10.2 1 1.1.10.2 nathanw /* $NetBSD: opms_isa.c,v 1.1.10.2 2002/01/11 23:37:58 nathanw Exp $ */
2 1.1.10.2 nathanw
3 1.1.10.2 nathanw /*
4 1.1.10.2 nathanw * Copyright (c) 1995, 1996 Carnegie-Mellon University.
5 1.1.10.2 nathanw * All rights reserved.
6 1.1.10.2 nathanw *
7 1.1.10.2 nathanw * Author: Chris G. Demetriou
8 1.1.10.2 nathanw *
9 1.1.10.2 nathanw * Permission to use, copy, modify and distribute this software and
10 1.1.10.2 nathanw * its documentation is hereby granted, provided that both the copyright
11 1.1.10.2 nathanw * notice and this permission notice appear in all copies of the
12 1.1.10.2 nathanw * software, derivative works or modified versions, and any portions
13 1.1.10.2 nathanw * thereof, and that both notices appear in supporting documentation.
14 1.1.10.2 nathanw *
15 1.1.10.2 nathanw * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
16 1.1.10.2 nathanw * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
17 1.1.10.2 nathanw * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
18 1.1.10.2 nathanw *
19 1.1.10.2 nathanw * Carnegie Mellon requests users of this software to return to
20 1.1.10.2 nathanw *
21 1.1.10.2 nathanw * Software Distribution Coordinator or Software.Distribution (at) CS.CMU.EDU
22 1.1.10.2 nathanw * School of Computer Science
23 1.1.10.2 nathanw * Carnegie Mellon University
24 1.1.10.2 nathanw * Pittsburgh PA 15213-3890
25 1.1.10.2 nathanw *
26 1.1.10.2 nathanw * any improvements or extensions that they make and grant Carnegie the
27 1.1.10.2 nathanw * rights to redistribute these changes.
28 1.1.10.2 nathanw */
29 1.1.10.2 nathanw
30 1.1.10.2 nathanw #include <sys/param.h>
31 1.1.10.2 nathanw #include <sys/systm.h>
32 1.1.10.2 nathanw #include <sys/tty.h>
33 1.1.10.2 nathanw #include <sys/device.h>
34 1.1.10.2 nathanw
35 1.1.10.2 nathanw #include <machine/bus.h>
36 1.1.10.2 nathanw
37 1.1.10.2 nathanw #include <dev/isa/isareg.h>
38 1.1.10.2 nathanw #include <dev/isa/isavar.h>
39 1.1.10.2 nathanw
40 1.1.10.2 nathanw #include <arc/dev/pcconsvar.h>
41 1.1.10.2 nathanw #include <arc/dev/opmsvar.h>
42 1.1.10.2 nathanw
43 1.1.10.2 nathanw int opms_isa_match __P((struct device *, struct cfdata *, void *));
44 1.1.10.2 nathanw void opms_isa_attach __P((struct device *, struct device *, void *));
45 1.1.10.2 nathanw
46 1.1.10.2 nathanw struct cfattach opms_isa_ca = {
47 1.1.10.2 nathanw sizeof(struct opms_softc), opms_isa_match, opms_isa_attach,
48 1.1.10.2 nathanw };
49 1.1.10.2 nathanw
50 1.1.10.2 nathanw struct pccons_config *pccons_isa_conf; /* share stroage with pccons_isa.c */
51 1.1.10.2 nathanw
52 1.1.10.2 nathanw int
53 1.1.10.2 nathanw opms_isa_match(parent, match, aux)
54 1.1.10.2 nathanw struct device *parent;
55 1.1.10.2 nathanw struct cfdata *match;
56 1.1.10.2 nathanw void *aux;
57 1.1.10.2 nathanw {
58 1.1.10.2 nathanw struct isa_attach_args *ia = aux;
59 1.1.10.2 nathanw bus_addr_t iobase = IO_KBD;
60 1.1.10.2 nathanw bus_size_t iosize = IO_KBDSIZE;
61 1.1.10.2 nathanw int irq = 12;
62 1.1.10.2 nathanw
63 1.1.10.2 nathanw if (ia->ia_nio < 1)
64 1.1.10.2 nathanw return (0);
65 1.1.10.2 nathanw if (ia->ia_io[0].ir_addr != ISACF_PORT_DEFAULT)
66 1.1.10.2 nathanw iobase = ia->ia_io[0].ir_addr;
67 1.1.10.2 nathanw #if 0 /* XXX isa.c */
68 1.1.10.2 nathanw if (ia->ia_iosize != 0)
69 1.1.10.2 nathanw iosize = ia->ia_iosize;
70 1.1.10.2 nathanw #endif
71 1.1.10.2 nathanw if (ia->ia_irq[0].ir_irq != ISACF_IRQ_DEFAULT)
72 1.1.10.2 nathanw irq = ia->ia_irq[0].ir_irq;
73 1.1.10.2 nathanw
74 1.1.10.2 nathanw #if 0
75 1.1.10.2 nathanw /* If values are hardwired to something that they can't be, punt. */
76 1.1.10.2 nathanw if (iobase != IO_KBD || iosize != IO_KBDSIZE ||
77 1.1.10.2 nathanw ia->ia_maddr != MADDRUNK || ia->ia_msize != 0 ||
78 1.1.10.2 nathanw ia->ia_irq != 1 || ia->ia_drq != DRQUNK)
79 1.1.10.2 nathanw return (0);
80 1.1.10.2 nathanw #endif
81 1.1.10.2 nathanw
82 1.1.10.2 nathanw if (pccons_isa_conf == NULL)
83 1.1.10.2 nathanw return (0);
84 1.1.10.2 nathanw
85 1.1.10.2 nathanw if (!opms_common_match(ia->ia_iot, pccons_isa_conf))
86 1.1.10.2 nathanw return (0);
87 1.1.10.2 nathanw
88 1.1.10.2 nathanw ia->ia_nio = 1;
89 1.1.10.2 nathanw ia->ia_io[0].ir_addr = iobase;
90 1.1.10.2 nathanw ia->ia_io[0].ir_size = iosize;
91 1.1.10.2 nathanw
92 1.1.10.2 nathanw ia->ia_nirq = 1;
93 1.1.10.2 nathanw ia->ia_irq[0].ir_irq = irq;
94 1.1.10.2 nathanw
95 1.1.10.2 nathanw ia->ia_niomem = 0;
96 1.1.10.2 nathanw ia->ia_ndrq = 0;
97 1.1.10.2 nathanw
98 1.1.10.2 nathanw return (1);
99 1.1.10.2 nathanw }
100 1.1.10.2 nathanw
101 1.1.10.2 nathanw void
102 1.1.10.2 nathanw opms_isa_attach(parent, self, aux)
103 1.1.10.2 nathanw struct device *parent, *self;
104 1.1.10.2 nathanw void *aux;
105 1.1.10.2 nathanw {
106 1.1.10.2 nathanw struct opms_softc *sc = (struct opms_softc *)self;
107 1.1.10.2 nathanw struct isa_attach_args *ia = aux;
108 1.1.10.2 nathanw
109 1.1.10.2 nathanw printf("\n");
110 1.1.10.2 nathanw
111 1.1.10.2 nathanw isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, IST_EDGE, IPL_TTY,
112 1.1.10.2 nathanw pcintr, self);
113 1.1.10.2 nathanw opms_common_attach(sc, ia->ia_iot, pccons_isa_conf);
114 1.1.10.2 nathanw }
115