xref: /titanic_50/usr/src/uts/sun4v/sys/vcc.h (revision 7636cb21f250f0485ca6052ffadc80ace93e6358)
1 
2 /*
3  * CDDL HEADER START
4  *
5  * The contents of this file are subject to the terms of the
6  * Common Development and Distribution License (the "License").
7  * You may not use this file except in compliance 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 /*
24  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
25  * Use is subject to license terms.
26  */
27 
28 #ifndef _VCC_H
29 #define	_VCC_H
30 
31 #pragma ident	"%Z%%M%	%I%	%E% SMI"
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 #include <sys/stream.h>
38 #include <sys/ddi.h>
39 #include <sys/sunddi.h>
40 #include <sys/ioctl.h>
41 
42 /*
43  * vcc and vntsd exchange information using ioctl commands. When vntsd starts,
44  * it uses VCC_NUM_CONSOLE to get number of existing ports and
45  * VCC_CONS_TBL to obtain the table of existing consoles. In this table,
46  * vcc returns information about each of the console ports using vcc_console_t
47  * structure. Vntsd then sleeps on polling vcc control port.
48  *
49  * When there is a change in configuration, such as addtion or deletion
50  * of a console port, vcc wakes up vntsd via the poll events. Subsequently,
51  * vntsd uses VCC_INQUIRY ioctl to determine the reason for wakeup. In
52  * response to the inquiry, vcc provides a vcc_response_t structure
53  * containing reason and port number.
54  *
55  * If a port is being added or updated (group change), vntsd uses
56  * VCC_CONS_INFO ioctl with port number to obtain configuration of
57  * the port.
58  *
59  * If the port is being deleted, vntsd uses VCC_DEL_CONS_OK ioctl to notify
60  * vcc after its clean up is done. Vcc subsequently tears down
61  * its internal configuration and remove the associated TTY minor node.
62  *
63  * Only one open is allowd for each vcc port. If vntsd opens a port that is
64  * already open, vntsd will use VNTSD_FORCE_CLOSE to take port from other
65  * application
66  */
67 
68 /* VCC CNTRL IOCTL */
69 
70 #define	    VCC_IOCTL_CMD		('c' << 8)
71 
72 
73 #define	    VCC_NUM_CONSOLE	VCC_IOCTL_CMD | 0x1	/* num of consoles */
74 #define	    VCC_CONS_TBL	VCC_IOCTL_CMD | 0x2	/* config table */
75 #define	    VCC_INQUIRY		VCC_IOCTL_CMD | 0x3	/* inquiry by vntsd */
76 #define	    VCC_CONS_INFO	VCC_IOCTL_CMD | 0x4	/* config */
77 #define	    VCC_CONS_STATUS	VCC_IOCTL_CMD | 0x5	/* console status */
78 #define	    VCC_FORCE_CLOSE	VCC_IOCTL_CMD | 0x6	/* force to close */
79 
80 /* reasons to wake up vntsd */
81 typedef enum {
82 	VCC_CONS_ADDED,		    /* a port was added */
83 	VCC_CONS_DELETED,	    /* a port was removed */
84 	VCC_CONS_MISS_ADDED,	    /* wakeup after an added port was deleted */
85 	/* XXX not implemented yet */
86 	VCC_CONS_UPDATED	    /* a port configuration was changed */
87 } vcc_reason_t;
88 
89 /*
90  * structure that vcc returns to vntsd in response to VCC_CONS_TBL and
91  * VCC_CONS_INFO  ioctl call.
92  */
93 typedef struct vcc_console {
94 	int		cons_no;		    /* console port number  */
95 	uint64_t	tcp_port;		    /* tcp port for the group */
96 	char		domain_name[MAXPATHLEN];    /* domain name */
97 	char		group_name[MAXPATHLEN];	    /* group name */
98 	char		dev_name[MAXPATHLEN];
99 } vcc_console_t;
100 
101 /* structure that vcc sends to vntsd in response to wake up inquiry */
102 typedef struct vcc_response {
103 	int		cons_no;	/* console port number */
104 	vcc_reason_t	reason;		/* wake up reason */
105 } vcc_response_t;
106 
107 #ifdef __cplusplus
108 }
109 #endif
110 
111 #endif /* _VCC_H */
112