1 /* $NetBSD: opms_isa.c,v 1.9 2008/07/05 08:46:25 tsutsui Exp $ */
4 * Copyright (c) 1995, 1996 Carnegie-Mellon University.
7 * Author: Chris G. Demetriou
9 * Permission to use, copy, modify and distribute this software and
10 * its documentation is hereby granted, provided that both the copyright
11 * notice and this permission notice appear in all copies of the
12 * software, derivative works or modified versions, and any portions
13 * thereof, and that both notices appear in supporting documentation.
15 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
16 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
17 * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
19 * Carnegie Mellon requests users of this software to return to
21 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
22 * School of Computer Science
23 * Carnegie Mellon University
24 * Pittsburgh PA 15213-3890
26 * any improvements or extensions that they make and grant Carnegie the
27 * rights to redistribute these changes.
30 #include <sys/cdefs.h>
31 __KERNEL_RCSID(0, "$NetBSD: opms_isa.c,v 1.9 2008/07/05 08:46:25 tsutsui Exp $");
33 #include <sys/param.h>
34 #include <sys/systm.h>
36 #include <sys/device.h>
38 #include <machine/bus.h>
40 #include <dev/isa/isareg.h>
41 #include <dev/isa/isavar.h>
43 #include <arc/dev/pcconsvar.h>
44 #include <arc/dev/opmsvar.h>
46 static int opms_isa_match(device_t
, cfdata_t
, void *);
47 static void opms_isa_attach(device_t
, device_t
, void *);
49 CFATTACH_DECL_NEW(opms_isa
, sizeof(struct opms_softc
),
50 opms_isa_match
, opms_isa_attach
, NULL
, NULL
);
52 struct pccons_config
*pccons_isa_conf
; /* share stroage with pccons_isa.c */
55 opms_isa_match(device_t parent
, cfdata_t cf
, void *aux
)
57 struct isa_attach_args
*ia
= aux
;
58 bus_addr_t iobase
= IO_KBD
;
59 bus_size_t iosize
= IO_KBDSIZE
;
64 if (ia
->ia_io
[0].ir_addr
!= ISA_UNKNOWN_PORT
)
65 iobase
= ia
->ia_io
[0].ir_addr
;
67 if (ia
->ia_iosize
!= 0)
68 iosize
= ia
->ia_iosize
;
70 if (ia
->ia_irq
[0].ir_irq
!= ISA_UNKNOWN_IRQ
)
71 irq
= ia
->ia_irq
[0].ir_irq
;
74 /* If values are hardwired to something that they can't be, punt. */
75 if (iobase
!= IO_KBD
|| iosize
!= IO_KBDSIZE
||
76 ia
->ia_maddr
!= MADDRUNK
|| ia
->ia_msize
!= 0 ||
77 ia
->ia_irq
!= 1 || ia
->ia_drq
!= DRQUNK
)
81 if (pccons_isa_conf
== NULL
)
84 if (!opms_common_match(ia
->ia_iot
, pccons_isa_conf
))
88 ia
->ia_io
[0].ir_addr
= iobase
;
89 ia
->ia_io
[0].ir_size
= iosize
;
92 ia
->ia_irq
[0].ir_irq
= irq
;
101 opms_isa_attach(device_t parent
, device_t self
, void *aux
)
103 struct opms_softc
*sc
= device_private(self
);
104 struct isa_attach_args
*ia
= aux
;
110 isa_intr_establish(ia
->ia_ic
, ia
->ia_irq
[0].ir_irq
, IST_EDGE
, IPL_TTY
,
112 opms_common_attach(sc
, ia
->ia_iot
, pccons_isa_conf
);