1 /* $NetBSD: ofisapc.c,v 1.9 2009/03/14 15:36:13 dsl Exp $ */
5 * Digital Equipment Corporation. All rights reserved.
7 * This software is furnished under license and may be used and
8 * copied only in accordance with the following terms and conditions.
9 * Subject to these conditions, you may download, copy, install,
10 * use, modify and distribute this software in source and/or binary
11 * form. No title or ownership is transferred hereby.
13 * 1) Any source code used, modified or distributed must reproduce
14 * and retain this copyright notice and list of conditions as
15 * they appear in the source file.
17 * 2) No right is granted to use any trade name, trademark, or logo of
18 * Digital Equipment Corporation. Neither the "Digital Equipment
19 * Corporation" name nor any trademark or logo of Digital Equipment
20 * Corporation may be used to endorse or promote products derived
21 * from this software without the prior written permission of
22 * Digital Equipment Corporation.
24 * 3) This software is provided "AS-IS" and any express or implied
25 * warranties, including but not limited to, any implied warranties
26 * of merchantability, fitness for a particular purpose, or
27 * non-infringement are disclaimed. In no event shall DIGITAL be
28 * liable for any damages whatsoever, and in particular, DIGITAL
29 * shall not be liable for special, indirect, consequential, or
30 * incidental damages or damages for lost profits, loss of
31 * revenue or loss of use, whether such damages arise in contract,
32 * negligence, tort, under statute, in equity, at law or otherwise,
33 * even if advised of the possibility of such damage.
37 * OFW Glue for PCCONS Driver
40 #include <sys/cdefs.h>
41 __KERNEL_RCSID(0, "$NetBSD: ofisapc.c,v 1.9 2009/03/14 15:36:13 dsl Exp $");
43 #include <sys/param.h>
44 #include <sys/device.h>
45 #include <sys/systm.h>
47 #include <machine/intr.h>
48 #include <machine/irqhandler.h>
50 #include <dev/ofw/openfirm.h>
51 #include <dev/isa/isavar.h>
52 #include <shark/shark/i8042reg.h>
53 #include <shark/shark/ns87307reg.h>
56 int ofisapcprobe(struct device
*, struct cfdata
*, void *);
57 void ofisapcattach(struct device
*, struct device
*, void *);
60 CFATTACH_DECL(ofisapc
, sizeof(struct device
),
61 ofisapcprobe
, ofisapcattach
, NULL
, NULL
);
63 extern struct cfdriver ofisapc_cd
;
67 ofisapcprobe(struct device
*parent
, struct cfdata
*cf
, void *aux
)
69 struct ofbus_attach_args
*oba
= aux
;
73 /* At a minimum, must match type and name properties. */
74 if ( OF_getprop(oba
->oba_phandle
, "device_type", type
,
75 sizeof(type
)) < 0 || strcmp(type
, "keyboard") != 0 ||
76 OF_getprop(oba
->oba_phandle
, "name", name
, sizeof(name
)) < 0 ||
77 strcmp(name
, "keyboard") != 0)
80 /* Better than a generic match. */
86 ofisapcattach(struct device
*parent
, struct device
*dev
, void *aux
)
88 struct ofbus_attach_args
*oba
= aux
;
89 static struct isa_attach_args ia
;
90 struct isa_io ia_io
[1];
91 struct isa_irq ia_irq
[1];
95 #define BASE_KEYBOARD 0x60
98 * Start with the Keyboard and mouse device configuration in the
101 (void)i87307KbdConfig(&isa_io_bs_tag
, BASE_KEYBOARD
, IRQ_KEYBOARD
);
102 (void)i87307MouseConfig (&isa_io_bs_tag
, IRQ_MOUSE
);
104 /* XXX - Hard-wire the ISA attach args for now. -JJK */
105 ia
.ia_iot
= &isa_io_bs_tag
;
106 ia
.ia_memt
= &isa_mem_bs_tag
;
107 ia
.ia_ic
= NULL
; /* not used */
111 ia
.ia_io
[0].ir_addr
= BASE_KEYBOARD
;
112 ia
.ia_io
[0].ir_size
= I8042_NPORTS
;
116 ia
.ia_irq
[0].ir_irq
= IRQ_KEYBOARD
;
121 ia
.ia_aux
= (void *)oba
->oba_phandle
;
123 config_found(dev
, &ia
, NULL
);