xref: /netbsd-src/sys/arch/arc/dev/pcconsvar.h (revision d710132b4b8ce7f7cccaaf660cb16aa16b4077a0)
1 /*	$NetBSD: pcconsvar.h,v 1.1 2001/06/13 15:05:43 soda 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) 1993, 1994, 1995 Charles M. Hannum.  All rights reserved.
7  * Copyright (c) 1990 The Regents of the University of California.
8  * All rights reserved.
9  *
10  * This code is derived from software contributed to Berkeley by
11  * William Jolitz and Don Ahn.
12  *
13  * Copyright (c) 1994 Charles M. Hannum.
14  * Copyright (c) 1992, 1993 Erik Forsberg.
15  *
16  * Redistribution and use in source and binary forms, with or without
17  * modification, are permitted provided that the following conditions
18  * are met:
19  * 1. Redistributions of source code must retain the above copyright
20  *    notice, this list of conditions and the following disclaimer.
21  * 2. Redistributions in binary form must reproduce the above copyright
22  *    notice, this list of conditions and the following disclaimer in the
23  *    documentation and/or other materials provided with the distribution.
24  * 3. All advertising materials mentioning features or use of this software
25  *    must display the following acknowledgement:
26  *	This product includes software developed by the University of
27  *	California, Berkeley and its contributors.
28  * 4. Neither the name of the University nor the names of its contributors
29  *    may be used to endorse or promote products derived from this software
30  *    without specific prior written permission.
31  *
32  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
33  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
34  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
35  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
36  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
40  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
41  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
42  * SUCH DAMAGE.
43  *
44  *	@(#)pccons.c	5.11 (Berkeley) 5/21/91
45  */
46 
47 struct pccons_config {
48 	bus_addr_t pc_mono_iobase, pc_mono_memaddr;
49 	bus_addr_t pc_cga_iobase, pc_cga_memaddr;
50 	bus_addr_t pc_kbd_cmdp, pc_kbd_datap;
51 
52 	void (*pc_init) __P((void));
53 };
54 
55 struct pccons_kbd_context {
56 	bus_space_tag_t pkc_iot;
57 	bus_space_handle_t pkc_cmd_ioh, pkc_data_ioh;
58 
59 	int pkc_initialized;
60 };
61 
62 struct pccons_context {
63 	struct pccons_kbd_context pc_pkc;
64 
65 	bus_space_tag_t pc_crt_iot, pc_crt_memt;
66 
67 	bus_space_handle_t pc_6845_ioh, pc_crt_memh;
68 
69 	bus_space_handle_t pc_mono_ioh, pc_mono_memh;
70 	bus_space_handle_t pc_cga_ioh, pc_cga_memh;
71 
72 	struct pccons_config *pc_config;
73 
74 	int pc_initialized;
75 };
76 
77 struct tty;
78 
79 struct pc_softc {
80 	struct	device sc_dev;
81 	struct	tty *sc_tty;
82 
83 #if 0
84 	struct	pccons_context *sc_pc;	/* pccons device software context */
85 #endif
86 };
87 
88 #define kbd_cmd_read_1() \
89 	bus_space_read_1(pccons_console_context.pc_pkc.pkc_iot, \
90 	    pccons_console_context.pc_pkc.pkc_cmd_ioh, 0)
91 #define kbd_data_read_1() \
92 	bus_space_read_1(pccons_console_context.pc_pkc.pkc_iot, \
93 	    pccons_console_context.pc_pkc.pkc_data_ioh, 0)
94 #define kbd_cmd_write_1(cmd) \
95 	bus_space_write_1(pccons_console_context.pc_pkc.pkc_iot, \
96 	    pccons_console_context.pc_pkc.pkc_cmd_ioh, 0, cmd)
97 #define kbd_data_write_1(data) \
98 	bus_space_write_1(pccons_console_context.pc_pkc.pkc_iot, \
99 	    pccons_console_context.pc_pkc.pkc_data_ioh, 0, data)
100 
101 extern struct pccons_context pccons_console_context;
102 
103 void kbd_context_init __P((bus_space_tag_t, struct pccons_config *));
104 int kbc_put8042cmd __P((u_char));
105 void kbd_flush_input __P((void));
106 
107 int pccons_common_match __P((bus_space_tag_t,
108 	bus_space_tag_t, bus_space_tag_t, struct pccons_config *));
109 void pccons_common_attach __P((struct pc_softc *, bus_space_tag_t,
110 	bus_space_tag_t, bus_space_tag_t, struct pccons_config *));
111 void pccons_common_cnattach __P((bus_space_tag_t, bus_space_tag_t,
112 	bus_space_tag_t, struct pccons_config *));
113 int pcintr __P((void *));
114