1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_SYS_CONSCONFIG_DACF_H
28 #define	_SYS_CONSCONFIG_DACF_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 #define	CONS_MS		1
37 #define	CONS_KBD	2
38 
39 
40 /*
41  * This structure contains information about keyboard
42  * and mouse used for auto-configuration.
43  */
44 typedef struct cons_prop {
45 	struct cons_prop	*cp_next;
46 	int			cp_type;
47 	dev_t			cp_dev;
48 	int			cp_muxid;
49 	char			*cp_pushmod;
50 } cons_prop_t;
51 
52 /*
53  * This structure contains information about the console
54  */
55 typedef struct cons_state {
56 	char	*cons_keyboard_path;	/* Keyboard path */
57 	char	*cons_mouse_path;	/* Mouse path */
58 	char	*cons_stdin_path;	/* Standard input path */
59 	char	*cons_stdout_path;	/* Standard output path */
60 
61 	char	*cons_fb_path;		/* Frame Buffer path */
62 
63 	int	cons_input_type;	/* Type of console input (See below) */
64 	int	cons_keyboard_problem;	/* problem with console keyboard */
65 
66 	ldi_ident_t	cons_li;
67 	vnode_t		*cons_wc_vp;
68 
69 	ldi_handle_t	conskbd_lh;
70 	int		conskbd_muxid;
71 
72 	ldi_handle_t	consms_lh;
73 	dev_t		consms_dev;
74 
75 	kmutex_t	cons_lock;
76 
77 	cons_prop_t	*cons_km_prop;
78 	int		cons_tem_supported;
79 	int		cons_stdin_is_kbd;
80 	int		cons_stdout_is_fb;
81 } cons_state_t;
82 
83 /*
84  * Types of console input
85  */
86 #define	CONSOLE_LOCAL			0x1	/* keyboard */
87 #define	CONSOLE_TIP			0x2	/* serial line */
88 #define	CONSOLE_SERIAL_KEYBOARD		0x4	/* serial kbd */
89 
90 /*
91  * These macros indicate the state of the system while
92  * the console configuration is running.
93  * CONSCONFIG_BOOTING implies that the driver loading
94  * is in process during boot.  CONSCONFIG_DRIVERS_LOADED
95  * means that the driver loading during boot has completed.
96  *
97  * During driver loading while the boot is happening, the
98  * keyboard and mouse minor nodes that are hooked into the console
99  * stream must match those defined by the firmware.  After boot
100  * minor nodes are hooked according to a first come first serve
101  * basis.
102  */
103 #define	CONSCONFIG_BOOTING			1
104 #define	CONSCONFIG_DRIVERS_LOADED		0
105 
106 /*
107  * Debug information
108  * Severity levels for printing
109  */
110 #define	DPRINT_L0	0	/* print every message */
111 #define	DPRINT_L1	1	/* debug */
112 #define	DPRINT_L2	2	/* minor errors */
113 #define	DPRINT_L3	3	/* major errors */
114 #define	DPRINT_L4	4	/* catastrophic errors */
115 
116 #define	DPRINTF consconfig_dprintf
117 
118 /*
119  * Implementation functions from consplat
120  */
121 extern int	plat_use_polled_debug(void);
122 extern char	*plat_stdinpath(void);
123 extern char	*plat_stdoutpath(void);
124 extern char	*plat_fbpath(void);
125 extern char	*plat_kbdpath(void);
126 extern char	*plat_mousepath(void);
127 extern int	plat_stdout_is_framebuffer(void);
128 extern int	plat_stdin_is_keyboard(void);
129 extern int	plat_virtual_console_path(char **);
130 
131 extern void	plat_tem_get_inverses(int *, int *);
132 extern void	plat_tem_get_prom_font_size(int *, int *);
133 extern void	plat_tem_get_prom_size(size_t *, size_t *);
134 extern void	plat_tem_hide_prom_cursor(void);
135 extern void	plat_tem_get_prom_pos(uint32_t *, uint32_t *);
136 
137 
138 /*
139  * Other external functions
140  */
141 extern void	kadb_uses_kernel(void);
142 
143 
144 #ifdef	__cplusplus
145 }
146 #endif
147 
148 #endif	/* _SYS_CONSCONFIG_DACF_H */
149