1 /* $NetBSD: pcconsvar.h,v 1.4 2005/12/11 12:16:39 christos Exp $ */
2 /* $OpenBSD: pccons.c,v 1.22 1999/01/30 22:39:37 imp Exp $ */
3 /* NetBSD: pccons.c,v 1.89 1995/05/04 19:35:20 cgd Exp */
6 * Copyright (c) 1990 The Regents of the University of California.
9 * This code is derived from software contributed to Berkeley by
10 * William Jolitz and Don Ahn.
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 * 3. Neither the name of the University nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * @(#)pccons.c 5.11 (Berkeley) 5/21/91
40 * Copyright (c) 1993, 1994, 1995 Charles M. Hannum. All rights reserved.
42 * This code is derived from software contributed to Berkeley by
43 * William Jolitz and Don Ahn.
45 * Copyright (c) 1994 Charles M. Hannum.
46 * Copyright (c) 1992, 1993 Erik Forsberg.
48 * Redistribution and use in source and binary forms, with or without
49 * modification, are permitted provided that the following conditions
51 * 1. Redistributions of source code must retain the above copyright
52 * notice, this list of conditions and the following disclaimer.
53 * 2. Redistributions in binary form must reproduce the above copyright
54 * notice, this list of conditions and the following disclaimer in the
55 * documentation and/or other materials provided with the distribution.
56 * 3. All advertising materials mentioning features or use of this software
57 * must display the following acknowledgement:
58 * This product includes software developed by the University of
59 * California, Berkeley and its contributors.
60 * 4. Neither the name of the University nor the names of its contributors
61 * may be used to endorse or promote products derived from this software
62 * without specific prior written permission.
64 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
65 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
66 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
67 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
68 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
69 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
70 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
71 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
72 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
73 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
76 * @(#)pccons.c 5.11 (Berkeley) 5/21/91
79 struct pccons_config
{
80 bus_addr_t pc_mono_iobase
, pc_mono_memaddr
;
81 bus_addr_t pc_cga_iobase
, pc_cga_memaddr
;
82 bus_addr_t pc_kbd_cmdp
, pc_kbd_datap
;
84 void (*pc_init
)(void);
87 struct pccons_kbd_context
{
88 bus_space_tag_t pkc_iot
;
89 bus_space_handle_t pkc_cmd_ioh
, pkc_data_ioh
;
94 struct pccons_context
{
95 struct pccons_kbd_context pc_pkc
;
97 bus_space_tag_t pc_crt_iot
, pc_crt_memt
;
99 bus_space_handle_t pc_6845_ioh
, pc_crt_memh
;
101 bus_space_handle_t pc_mono_ioh
, pc_mono_memh
;
102 bus_space_handle_t pc_cga_ioh
, pc_cga_memh
;
104 struct pccons_config
*pc_config
;
116 struct pccons_context
*sc_pc
; /* pccons device software context */
120 #define kbd_cmd_read_1() \
121 bus_space_read_1(pccons_console_context.pc_pkc.pkc_iot, \
122 pccons_console_context.pc_pkc.pkc_cmd_ioh, 0)
123 #define kbd_data_read_1() \
124 bus_space_read_1(pccons_console_context.pc_pkc.pkc_iot, \
125 pccons_console_context.pc_pkc.pkc_data_ioh, 0)
126 #define kbd_cmd_write_1(cmd) \
127 bus_space_write_1(pccons_console_context.pc_pkc.pkc_iot, \
128 pccons_console_context.pc_pkc.pkc_cmd_ioh, 0, cmd)
129 #define kbd_data_write_1(data) \
130 bus_space_write_1(pccons_console_context.pc_pkc.pkc_iot, \
131 pccons_console_context.pc_pkc.pkc_data_ioh, 0, data)
133 extern struct pccons_context pccons_console_context
;
135 void kbd_context_init(bus_space_tag_t
, struct pccons_config
*);
136 int kbc_put8042cmd(u_char
);
137 void kbd_flush_input(void);
139 int pccons_common_match(bus_space_tag_t
,
140 bus_space_tag_t
, bus_space_tag_t
, struct pccons_config
*);
141 void pccons_common_attach(struct pc_softc
*, bus_space_tag_t
,
142 bus_space_tag_t
, bus_space_tag_t
, struct pccons_config
*);
143 void pccons_common_cnattach(bus_space_tag_t
, bus_space_tag_t
,
144 bus_space_tag_t
, struct pccons_config
*);