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