xref: /titanic_50/usr/src/uts/sun/sys/ttymuxuser.h (revision 711890bc9379ceea66272dc8d4981812224ea86e)
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, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright (c) 2001 by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 #ifndef _TTYMUXUSER_H
28 #define	_TTYMUXUSER_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <sys/types.h>
33 #include <sys/param.h>
34 #include <sys/termios.h>
35 
36 #ifdef	__cplusplus
37 extern "C" {
38 #endif
39 
40 #define	TTYMUX_MOD_ID		(0x540d)	/* T^m */
41 #define	TTYMUX_DRVNAME		"ttymux"
42 
43 #define	TTYMUX_MAX_LINKS	(16)
44 /*
45  * Generic serial multiplexor ioctls.
46  */
47 #define	_TTYMUXIOC		(TTYMUX_MOD_ID<<8)
48 #define	TTYMUX_ASSOC		(_TTYMUXIOC | 1)
49 #define	TTYMUX_DISASSOC		(_TTYMUXIOC | 2)
50 #define	TTYMUX_LIST		(_TTYMUXIOC | 3)
51 #define	TTYMUX_GETLINK		(_TTYMUXIOC | 4)
52 /*
53  * Ioctls for serial multiplexors acting as the system console.
54  */
55 #define	TTYMUX_SETABORT		(_TTYMUXIOC | 100)
56 #define	TTYMUX_GETABORT		(_TTYMUXIOC | 101)
57 #define	TTYMUX_CONSDEV		(_TTYMUXIOC | 102)
58 #define	TTYMUX_GETABORTSTR	(_TTYMUXIOC | 103)
59 #define	TTYMUX_GETCONSOLES	(_TTYMUXIOC | 104)
60 /*
61  * Optional control ioctl.
62  */
63 #define	TTYMUX_SETCTL		(_TTYMUXIOC | 200)
64 #define	TTYMUX_GETCTL		(_TTYMUXIOC | 201)
65 
66 typedef	enum {FORINPUT = 1, FOROUTPUT = 2, FORIO = 3} io_mode_t;
67 
68 /*
69  * Create or destroy associations TTYMUX_ASSOC and TTYMUX_DISASSOC
70  */
71 #define	AMSTAG	(0x414d5354)
72 typedef struct ttymux_association {
73 	dev_t		ttymux_udev;	/* the upper device to be associated */
74 				/* the device type of a linked lower stream */
75 	dev_t		ttymux_ldev;
76 				/* the linkid of a linked lower stream */
77 	int		ttymux_linkid;
78 	ulong_t		ttymux_tag;	/* tagged association */
79 	io_mode_t	ttymux_ioflag; /* FORINPUT FOROUTPUT FORIO */
80 					/* OBP device path of ldev */
81 	char		ttymux_path[MAXPATHLEN];
82 } ttymux_assoc_t;
83 
84 /*
85  * List all links known to a mux driver TTYMUX_LIST
86  * If the user ioctl arg is NULL the return value is the
87  * number of links in the driver (to facilitate the user
88  * allocating enough space for the link information.
89  * Otherwise the ioctl arg should point to the following
90  * structure. nlinks indicates how many entries the user
91  * has allocated in the array. The return value indicates the
92  * number of entries that have been filled in.
93  * EINVAL if nlinks is < 1
94  * EAGAIN if no resources.
95  */
96 typedef struct ttymux_associations {
97 	ulong_t		ttymux_nlinks;
98 	ttymux_assoc_t	*ttymux_assocs;
99 } ttymux_assocs_t;
100 
101 /*
102  * Enable or disable aborting to the system monitor
103  * TTYMUX_SETABORT and TTYMUX_GETABORT
104  */
105 enum ttymux_break_type {SOFTWARE_BREAK, HARDWARE_BREAK, SOFTHARD_BREAK};
106 
107 typedef struct ttymux_abort {
108 			/* apply request to this device */
109 	dev_t			ttymux_ldev;
110 	enum ttymux_break_type	ttymux_method;
111 	uint_t			ttymux_enable;
112 } ttymux_abort_t;
113 
114 /*
115  * Ioctl acknowledgement policies.
116  */
117 #define	FIRSTACK	0
118 #define	LASTACK		1
119 #define	CONSENSUS	2
120 #define	PERIOCTL	3
121 
122 /*
123  * Set or get the ioctl acknowledgement policy and masking of control bits
124  * TTYMUX_SETCTL and TTYMUX_GETCTL
125  */
126 
127 struct ttymux_policy {
128 	dev_t		ttymux_udev;	/* apply the request to this device */
129 			/* determines the method used to ack M_IOCTLS */
130 	int		ttymux_policy;
131 	tcflag_t	ttymux_cmask;	/* never set these control bits */
132 };
133 
134 #ifdef	__cplusplus
135 }
136 #endif
137 
138 #endif	/* _TTYMUXUSER_H */
139