xref: /titanic_52/usr/src/uts/sun4u/starfire/sys/cvc.h (revision 4bff34e37def8a90f9194d81bc345c52ba20086a)
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 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _CVC_H
28 #define	_CVC_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 #define	cvc_username		"ssp"
37 #define	CVCD_SERVICE		"cvc_hostd"
38 #define	CVC_CONN_SERVICE	"cvc"
39 #define	MAX_CVC_CONN		100
40 #define	MAXPKTSZ		4096
41 
42 #define	TRUE			1
43 #define	FALSE			0
44 
45 /*
46  * Network Redirection driver ioctl to jump into debugger.
47  */
48 #define	CVC	'N'
49 #define	CVC_BREAK	(CVC<<8)
50 #define	CVC_DISCONNECT	((CVC<<8)|0x1)
51 
52 #define	CVC_CONN_BREAK		0x1	/* Break to OBP or kmdb */
53 #define	CVC_CONN_DIS		0x2	/* disconnect */
54 #define	CVC_CONN_STAT		0x4	/* status of CVC connects */
55 #define	CVC_CONN_WRITE		0x8	/* ask write permission */
56 #define	CVC_CONN_RELW		0x10    /* release write permission */
57 #define	CVC_CONN_WRLK		0x20    /* Lock the Write */
58 #define	CVC_CONN_PRIVATE	0x40    /* Only one session is allowed */
59 #define	CVC_CONN_SWITCH		0x41	/* Switch communication path */
60 
61 
62 #define	TCP_DEV		"/dev/tcp"
63 #define	CVCREDIR_DEV	"/devices/pseudo/cvcredir@0:cvcredir"
64 
65 /*
66  * Layout of BBSRAM input and output buffers:
67  *
68  *
69  *         |---------------|
70  * 0x1f400 | control msg   |  Receive buffer is reduced by two bytes to
71  *         |    1 byte     |  accomodate a control msg area in which
72  *         |---------------|  information is sent from obp_helper to the
73  *         |  send buffer  |  cvc driver (e.g. break to obp) when
74  *         |               |  communication is over BBSRAM.
75  *         |  1020 bytes   |
76  *         |---------------|
77  *         | send  count   |
78  * 0x1f7fe |  2 bytes      |
79  *         |---------------|
80  *         | receive buffer|
81  *         |               |
82  *         | 1022 bytes    |
83  *         |---------------|
84  *         | output count  |
85  * 0x1fbfe |  2 bytes      |
86  *         |---------------|
87  *
88  */
89 
90 #define	BBSRAM_COUNT_SIZE	sizeof (short)
91 #define	CVC_IN_SIZE		256
92 #define	CVC_OUT_SIZE		1024
93 #define	MAX_XFER_INPUT		(CVC_IN_SIZE - BBSRAM_COUNT_SIZE)
94 #define	MAX_XFER_OUTPUT		(CVC_OUT_SIZE - BBSRAM_COUNT_SIZE)
95 
96 #define	BBSRAM_OUTPUT_COUNT_OFF (CVC_OUT_SIZE - BBSRAM_COUNT_SIZE)
97 #define	BBSRAM_INPUT_COUNT_OFF  (CVC_OUT_SIZE + CVC_IN_SIZE - BBSRAM_COUNT_SIZE)
98 
99 /*
100  * Control msgs sent across BBSRAM from obp_helper to cvc driver
101  */
102 #define	CVC_BBSRAM_BREAK	1
103 #define	CVC_BBSRAM_DISCONNECT	2
104 #define	CVC_BBSRAM_VIA_NET	3
105 #define	CVC_BBSRAM_VIA_BBSRAM	4
106 #define	CVC_BBSRAM_CLOSE_NET	5
107 
108 #ifdef _KERNEL
109 extern void	cvc_assign_iocpu(int cpu_id);
110 #endif /* _KERNEL */
111 
112 #ifdef	__cplusplus
113 }
114 #endif
115 
116 #endif	/* _CVC_H */
117