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.
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.
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]
23 * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
26 #ifndef _SYS_VT_IMPL_H
27 #define _SYS_VT_IMPL_H
33 #include <sys/types.h>
34 #include <sys/stream.h>
44 #define WCS_INIT 0x00000001 /* tty is init */
45 #define WCS_ISOPEN 0x00000002 /* open is complete */
46 #define WCS_STOPPED 0x00000004 /* output is stopped */
47 #define WCS_DELAY 0x00000008 /* waiting for delay to finish */
48 #define WCS_BUSY 0x00000010 /* waiting for transmission to finish */
50 typedef struct vc_waitactive_msg
{
51 list_node_t wa_list_node
;
52 int wa_msg_minor
; /* minor number from which msg comes */
53 int wa_wait_minor
; /* which node we are waiting for */
55 } vc_waitactive_msg_t
;
57 /* virtual console soft state associated with each vt */
58 typedef struct vc_state
{
60 avl_node_t vc_avl_node
;
61 uchar_t vc_switch_mode
; /* VT_AUTO or VT_PROCESS */
72 tem_vt_state_t vc_tem
; /* Terminal emulator state */
73 tty_common_t vc_ttycommon
; /* data common to all tty drivers */
74 bufcall_id_t vc_bufcallid
; /* id returned by qbufcall */
75 timeout_id_t vc_timeoutid
; /* id returned by qtimeout */
77 queue_t
*vc_wq
; /* write queue */
79 #ifdef _HAVE_TEM_FIRMWARE
80 int vc_pendc
; /* pending output character */
81 #endif /* _HAVE_TEM_FIRMWARE */
84 * vc_state_lock is currently only used to protect vc_flags,
85 * more precisely, the state change of vc_state_t.
86 * The existence of this lock is because wc_modechg_cb().
87 * wc_modechg_cb() is a callback function which may result in
88 * multiple threads accessing vc_flags regardless the STREAMS
89 * periemters of wc module.
90 * Since wc_modechg_cb() only conducts read access to vc_flags,
91 * we only need to hold this lock when writing to vc_flags in
92 * wc module (except wc_modechg_cb()).
93 * See locking policy in wscons.c for more info.
95 kmutex_t vc_state_lock
;
97 _NOTE(MUTEX_PROTECTS_DATA(vc_state_t::vc_state_lock
, vc_state_t::vc_flags
))
99 #define VC_DEFAULT_COUNT 16
101 /* Invalid VT minor number */
102 #define VT_MINOR_INVALID ((minor_t)-1)
103 /* Argument to vt_minor2vc to get the softstate of the active VT */
104 #define VT_ACTIVE VT_MINOR_INVALID
107 * VC_INSTANCES_COUNT should be regarded as reading access to vc_avl_root
109 #define VC_INSTANCES_COUNT (avl_numnodes(&vc_avl_root))
111 void vt_ioctl(queue_t
*q
, mblk_t
*mp
);
112 void vt_miocdata(queue_t
*qp
, mblk_t
*mp
);
113 void vt_clean(queue_t
*q
, vc_state_t
*pvc
);
114 void vt_close(queue_t
*q
, vc_state_t
*pvc
, cred_t
*crp
);
115 int vt_open(minor_t minor
, queue_t
*rq
, cred_t
*crp
);
116 int vt_check_hotkeys(mblk_t
*mp
);
117 vc_state_t
*vt_minor2vc(minor_t
);
119 extern dev_info_t
*wc_dip
;
120 extern avl_tree_t vc_avl_root
;
121 extern minor_t vc_active_console
;
122 extern minor_t vc_cons_user
;
123 extern kmutex_t vc_lock
;
124 extern minor_t vc_last_console
;
126 major_t
vt_wc_attached(void);
127 void vt_getactive(char *, int);
128 void vt_getconsuser(char *, int);
129 boolean_t
vt_minor_valid(minor_t minor
);
130 void vt_resize(uint_t
);
131 void vt_attach(void);
138 #endif /* _SYS_VT_IMPL_H */