pcconsvar.h revision 1.2 1 /* $NetBSD: pcconsvar.h,v 1.2 2003/08/07 16:26:49 agc 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 */
4
5 /*-
6 * Copyright (c) 1990 The Regents of the University of California.
7 * All rights reserved.
8 *
9 * This code is derived from software contributed to Berkeley by
10 * William Jolitz and Don Ahn.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
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.
23 *
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
34 * SUCH DAMAGE.
35 *
36 * @(#)pccons.c 5.11 (Berkeley) 5/21/91
37 */
38
39 /*-
40 * Copyright (c) 1993, 1994, 1995 Charles M. Hannum. All rights reserved.
41 *
42 * This code is derived from software contributed to Berkeley by
43 * William Jolitz and Don Ahn.
44 *
45 * Copyright (c) 1994 Charles M. Hannum.
46 * Copyright (c) 1992, 1993 Erik Forsberg.
47 *
48 * Redistribution and use in source and binary forms, with or without
49 * modification, are permitted provided that the following conditions
50 * are met:
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.
63 *
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
74 * SUCH DAMAGE.
75 *
76 * @(#)pccons.c 5.11 (Berkeley) 5/21/91
77 */
78
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;
83
84 void (*pc_init) __P((void));
85 };
86
87 struct pccons_kbd_context {
88 bus_space_tag_t pkc_iot;
89 bus_space_handle_t pkc_cmd_ioh, pkc_data_ioh;
90
91 int pkc_initialized;
92 };
93
94 struct pccons_context {
95 struct pccons_kbd_context pc_pkc;
96
97 bus_space_tag_t pc_crt_iot, pc_crt_memt;
98
99 bus_space_handle_t pc_6845_ioh, pc_crt_memh;
100
101 bus_space_handle_t pc_mono_ioh, pc_mono_memh;
102 bus_space_handle_t pc_cga_ioh, pc_cga_memh;
103
104 struct pccons_config *pc_config;
105
106 int pc_initialized;
107 };
108
109 struct tty;
110
111 struct pc_softc {
112 struct device sc_dev;
113 struct tty *sc_tty;
114
115 #if 0
116 struct pccons_context *sc_pc; /* pccons device software context */
117 #endif
118 };
119
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)
132
133 extern struct pccons_context pccons_console_context;
134
135 void kbd_context_init __P((bus_space_tag_t, struct pccons_config *));
136 int kbc_put8042cmd __P((u_char));
137 void kbd_flush_input __P((void));
138
139 int pccons_common_match __P((bus_space_tag_t,
140 bus_space_tag_t, bus_space_tag_t, struct pccons_config *));
141 void pccons_common_attach __P((struct pc_softc *, bus_space_tag_t,
142 bus_space_tag_t, bus_space_tag_t, struct pccons_config *));
143 void pccons_common_cnattach __P((bus_space_tag_t, bus_space_tag_t,
144 bus_space_tag_t, struct pccons_config *));
145 int pcintr __P((void *));
146