xref: /titanic_41/usr/src/uts/sun4u/starcat/sys/sc_cvcio.h (revision 35a5a3587fd94b666239c157d3722745250ccbd7)
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 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _SYS_SC_CVCIO_H
28 #define	_SYS_SC_CVCIO_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 /*
37  * Layout of console IOSRAM chunks
38  *         |---------------|
39  *  CONC   |  cvc_ctl_t    |
40  *         |  128 bytes    |
41  *         |---------------|
42  *
43  *         |---------------|
44  *  CONI   | input count   |
45  *         |  2 bytes      |
46  *         |---------------|
47  *         | receive buffer|
48  *         |  1022 bytes   |
49  *         |---------------|
50  *
51  *         |---------------|
52  *  CONO   | output count  |
53  *         |  2 bytes      |
54  *         |---------------|
55  *         | send buffer   |
56  *         | 1022 bytes    |
57  *         |---------------|
58  */
59 
60 #define	IOSRAM_KEY_CONC 0x434F4E43
61 #define	IOSRAM_KEY_CONI 0x434F4E49
62 #define	IOSRAM_KEY_CONO 0x434F4E4F
63 
64 #define	CONSBUF_IN_SIZE		1024
65 #define	CONSBUF_OUT_SIZE	1024
66 #define	CONSBUF_COUNT_SIZE	(sizeof (short))
67 
68 #define	MAX_XFER_CINPUT		(CONSBUF_IN_SIZE - CONSBUF_COUNT_SIZE)
69 #define	MAX_XFER_COUTPUT	(CONSBUF_OUT_SIZE - CONSBUF_COUNT_SIZE)
70 #define	COUNT_OFFSET		0
71 #define	DATA_OFFSET		(CONSBUF_COUNT_SIZE)
72 
73 #define	cvc_username		"sms"
74 #define	CVCD_SERVICE		"cvc_hostd"
75 #define	MAX_CONS_CONN		100
76 #define	MAXPKTSZ		4096
77 
78 #define	TCP_DEV			"/dev/tcp"
79 #define	CVCREDIR_DEV		"/devices/pseudo/cvcredir@0:cvcredir"
80 
81 
82 /*
83  * ioctl commands passed to cvcredir (and possibly on to cvc from there) by cvcd
84  */
85 #define	CVC			'N'
86 #define	CVC_BREAK		((CVC<<8) | 0x00)
87 #define	CVC_DISCONNECT		((CVC<<8) | 0x01)
88 
89 /*
90  * DXS (the SC-side console traffic application) may send a few of these codes
91  * to cvcd as expedited TLI traffic.  The rest are not used in domain-side
92  * software, but SC-side software may use them.
93  */
94 #define	CVC_CONN_BREAK		0x1	/* Break to OBP or kmdb */
95 #define	CVC_CONN_DIS		0x2	/* disconnect */
96 #define	CVC_CONN_STAT		0x4	/* status of CVC connects */
97 #define	CVC_CONN_WRITE		0x8	/* ask write permission */
98 #define	CVC_CONN_RELW		0x10    /* release write permission */
99 #define	CVC_CONN_WRLK		0x20    /* Lock the Write */
100 #define	CVC_CONN_PRIVATE	0x40    /* Only one session is allowed */
101 #define	CVC_CONN_SWITCH		0x41	/* Switch communication path */
102 
103 /*
104  * This structure represents the layout of control data in the CONC chunk.
105  * It should NOT grow beyond 128 bytes, as that is the max size that was
106  * identified for the CONC chunk.
107  */
108 typedef struct cvc_ctl {
109 	uint8_t		command;	/* CVC_IOSRAM_BREAK, etc */
110 	uint8_t		version;	/* currently unused */
111 	uint8_t		unused1[2];	/* currently unused */
112 	uint16_t	winsize_rows;
113 	uint16_t	winsize_cols;
114 	uint16_t	winsize_xpixels;
115 	uint16_t	winsize_ypixels;
116 	uint8_t		unused2[116];	/* currently unused */
117 } cvc_ctl_t;
118 
119 /*
120  * These macros can be used to determine the offset or size of any field in the
121  * CONC chunk.
122  */
123 #define	CVC_CTL_OFFSET(field)  ((uint32_t)&(((cvc_ctl_t *)0)->field))
124 #define	CVC_CTL_SIZE(field)    (sizeof (((cvc_ctl_t *)0)->field))
125 
126 /*
127  * Commands sent across IOSRAM from domain_server to cvc driver
128  */
129 #define	CVC_IOSRAM_BREAK	1
130 #define	CVC_IOSRAM_DISCONNECT	2
131 #define	CVC_IOSRAM_VIA_NET	3
132 #define	CVC_IOSRAM_VIA_IOSRAM	4
133 #define	CVC_IOSRAM_WIN_RESIZE	5
134 
135 #ifdef	__cplusplus
136 }
137 #endif
138 
139 #endif	/* _SYS_SC_CVCIO_H */
140