xref: /titanic_41/usr/src/uts/sun4u/starcat/sys/sc_cvcio.h (revision ad9a7bd3532cf0ef931ded51a5ffe5d0496aad88)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate  * with the License.
87c478bd9Sstevel@tonic-gate  *
97c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate  * and limitations under the License.
137c478bd9Sstevel@tonic-gate  *
147c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate  *
207c478bd9Sstevel@tonic-gate  * CDDL HEADER END
217c478bd9Sstevel@tonic-gate  */
227c478bd9Sstevel@tonic-gate /*
237c478bd9Sstevel@tonic-gate  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate #ifndef _SYS_SC_CVCIO_H
287c478bd9Sstevel@tonic-gate #define	_SYS_SC_CVCIO_H
297c478bd9Sstevel@tonic-gate 
30*ad9a7bd3SRichard Lowe #include <sys/sysmacros.h>
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate #ifdef __cplusplus
337c478bd9Sstevel@tonic-gate extern "C" {
347c478bd9Sstevel@tonic-gate #endif
357c478bd9Sstevel@tonic-gate 
367c478bd9Sstevel@tonic-gate /*
377c478bd9Sstevel@tonic-gate  * Layout of console IOSRAM chunks
387c478bd9Sstevel@tonic-gate  *         |---------------|
397c478bd9Sstevel@tonic-gate  *  CONC   |  cvc_ctl_t    |
407c478bd9Sstevel@tonic-gate  *         |  128 bytes    |
417c478bd9Sstevel@tonic-gate  *         |---------------|
427c478bd9Sstevel@tonic-gate  *
437c478bd9Sstevel@tonic-gate  *         |---------------|
447c478bd9Sstevel@tonic-gate  *  CONI   | input count   |
457c478bd9Sstevel@tonic-gate  *         |  2 bytes      |
467c478bd9Sstevel@tonic-gate  *         |---------------|
477c478bd9Sstevel@tonic-gate  *         | receive buffer|
487c478bd9Sstevel@tonic-gate  *         |  1022 bytes   |
497c478bd9Sstevel@tonic-gate  *         |---------------|
507c478bd9Sstevel@tonic-gate  *
517c478bd9Sstevel@tonic-gate  *         |---------------|
527c478bd9Sstevel@tonic-gate  *  CONO   | output count  |
537c478bd9Sstevel@tonic-gate  *         |  2 bytes      |
547c478bd9Sstevel@tonic-gate  *         |---------------|
557c478bd9Sstevel@tonic-gate  *         | send buffer   |
567c478bd9Sstevel@tonic-gate  *         | 1022 bytes    |
577c478bd9Sstevel@tonic-gate  *         |---------------|
587c478bd9Sstevel@tonic-gate  */
597c478bd9Sstevel@tonic-gate 
607c478bd9Sstevel@tonic-gate #define	IOSRAM_KEY_CONC 0x434F4E43
617c478bd9Sstevel@tonic-gate #define	IOSRAM_KEY_CONI 0x434F4E49
627c478bd9Sstevel@tonic-gate #define	IOSRAM_KEY_CONO 0x434F4E4F
637c478bd9Sstevel@tonic-gate 
647c478bd9Sstevel@tonic-gate #define	CONSBUF_IN_SIZE		1024
657c478bd9Sstevel@tonic-gate #define	CONSBUF_OUT_SIZE	1024
667c478bd9Sstevel@tonic-gate #define	CONSBUF_COUNT_SIZE	(sizeof (short))
677c478bd9Sstevel@tonic-gate 
687c478bd9Sstevel@tonic-gate #define	MAX_XFER_CINPUT		(CONSBUF_IN_SIZE - CONSBUF_COUNT_SIZE)
697c478bd9Sstevel@tonic-gate #define	MAX_XFER_COUTPUT	(CONSBUF_OUT_SIZE - CONSBUF_COUNT_SIZE)
707c478bd9Sstevel@tonic-gate #define	COUNT_OFFSET		0
717c478bd9Sstevel@tonic-gate #define	DATA_OFFSET		(CONSBUF_COUNT_SIZE)
727c478bd9Sstevel@tonic-gate 
737c478bd9Sstevel@tonic-gate #define	cvc_username		"sms"
747c478bd9Sstevel@tonic-gate #define	CVCD_SERVICE		"cvc_hostd"
757c478bd9Sstevel@tonic-gate #define	MAX_CONS_CONN		100
767c478bd9Sstevel@tonic-gate #define	MAXPKTSZ		4096
777c478bd9Sstevel@tonic-gate 
787c478bd9Sstevel@tonic-gate #define	TCP_DEV			"/dev/tcp"
797c478bd9Sstevel@tonic-gate #define	CVCREDIR_DEV		"/devices/pseudo/cvcredir@0:cvcredir"
807c478bd9Sstevel@tonic-gate 
817c478bd9Sstevel@tonic-gate 
827c478bd9Sstevel@tonic-gate /*
837c478bd9Sstevel@tonic-gate  * ioctl commands passed to cvcredir (and possibly on to cvc from there) by cvcd
847c478bd9Sstevel@tonic-gate  */
857c478bd9Sstevel@tonic-gate #define	CVC			'N'
867c478bd9Sstevel@tonic-gate #define	CVC_BREAK		((CVC<<8) | 0x00)
877c478bd9Sstevel@tonic-gate #define	CVC_DISCONNECT		((CVC<<8) | 0x01)
887c478bd9Sstevel@tonic-gate 
897c478bd9Sstevel@tonic-gate /*
907c478bd9Sstevel@tonic-gate  * DXS (the SC-side console traffic application) may send a few of these codes
917c478bd9Sstevel@tonic-gate  * to cvcd as expedited TLI traffic.  The rest are not used in domain-side
927c478bd9Sstevel@tonic-gate  * software, but SC-side software may use them.
937c478bd9Sstevel@tonic-gate  */
947c478bd9Sstevel@tonic-gate #define	CVC_CONN_BREAK		0x1	/* Break to OBP or kmdb */
957c478bd9Sstevel@tonic-gate #define	CVC_CONN_DIS		0x2	/* disconnect */
967c478bd9Sstevel@tonic-gate #define	CVC_CONN_STAT		0x4	/* status of CVC connects */
977c478bd9Sstevel@tonic-gate #define	CVC_CONN_WRITE		0x8	/* ask write permission */
987c478bd9Sstevel@tonic-gate #define	CVC_CONN_RELW		0x10    /* release write permission */
997c478bd9Sstevel@tonic-gate #define	CVC_CONN_WRLK		0x20    /* Lock the Write */
1007c478bd9Sstevel@tonic-gate #define	CVC_CONN_PRIVATE	0x40    /* Only one session is allowed */
1017c478bd9Sstevel@tonic-gate #define	CVC_CONN_SWITCH		0x41	/* Switch communication path */
1027c478bd9Sstevel@tonic-gate 
1037c478bd9Sstevel@tonic-gate /*
1047c478bd9Sstevel@tonic-gate  * This structure represents the layout of control data in the CONC chunk.
1057c478bd9Sstevel@tonic-gate  * It should NOT grow beyond 128 bytes, as that is the max size that was
1067c478bd9Sstevel@tonic-gate  * identified for the CONC chunk.
1077c478bd9Sstevel@tonic-gate  */
1087c478bd9Sstevel@tonic-gate typedef struct cvc_ctl {
1097c478bd9Sstevel@tonic-gate 	uint8_t		command;	/* CVC_IOSRAM_BREAK, etc */
1107c478bd9Sstevel@tonic-gate 	uint8_t		version;	/* currently unused */
1117c478bd9Sstevel@tonic-gate 	uint8_t		unused1[2];	/* currently unused */
1127c478bd9Sstevel@tonic-gate 	uint16_t	winsize_rows;
1137c478bd9Sstevel@tonic-gate 	uint16_t	winsize_cols;
1147c478bd9Sstevel@tonic-gate 	uint16_t	winsize_xpixels;
1157c478bd9Sstevel@tonic-gate 	uint16_t	winsize_ypixels;
1167c478bd9Sstevel@tonic-gate 	uint8_t		unused2[116];	/* currently unused */
1177c478bd9Sstevel@tonic-gate } cvc_ctl_t;
1187c478bd9Sstevel@tonic-gate 
1197c478bd9Sstevel@tonic-gate /*
1207c478bd9Sstevel@tonic-gate  * These macros can be used to determine the offset or size of any field in the
1217c478bd9Sstevel@tonic-gate  * CONC chunk.
1227c478bd9Sstevel@tonic-gate  */
123*ad9a7bd3SRichard Lowe #define	CVC_CTL_OFFSET(field)  offsetof(cvc_ctl_t, field)
1247c478bd9Sstevel@tonic-gate #define	CVC_CTL_SIZE(field)    (sizeof (((cvc_ctl_t *)0)->field))
1257c478bd9Sstevel@tonic-gate 
1267c478bd9Sstevel@tonic-gate /*
1277c478bd9Sstevel@tonic-gate  * Commands sent across IOSRAM from domain_server to cvc driver
1287c478bd9Sstevel@tonic-gate  */
1297c478bd9Sstevel@tonic-gate #define	CVC_IOSRAM_BREAK	1
1307c478bd9Sstevel@tonic-gate #define	CVC_IOSRAM_DISCONNECT	2
1317c478bd9Sstevel@tonic-gate #define	CVC_IOSRAM_VIA_NET	3
1327c478bd9Sstevel@tonic-gate #define	CVC_IOSRAM_VIA_IOSRAM	4
1337c478bd9Sstevel@tonic-gate #define	CVC_IOSRAM_WIN_RESIZE	5
1347c478bd9Sstevel@tonic-gate 
1357c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1367c478bd9Sstevel@tonic-gate }
1377c478bd9Sstevel@tonic-gate #endif
1387c478bd9Sstevel@tonic-gate 
1397c478bd9Sstevel@tonic-gate #endif	/* _SYS_SC_CVCIO_H */
140