xref: /titanic_51/usr/src/uts/sun4v/sys/vcc.h (revision 7636cb21f250f0485ca6052ffadc80ace93e6358)
11ae08745Sheppo 
21ae08745Sheppo /*
31ae08745Sheppo  * CDDL HEADER START
41ae08745Sheppo  *
51ae08745Sheppo  * The contents of this file are subject to the terms of the
61ae08745Sheppo  * Common Development and Distribution License (the "License").
71ae08745Sheppo  * You may not use this file except in compliance with the License.
81ae08745Sheppo  *
91ae08745Sheppo  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
101ae08745Sheppo  * or http://www.opensolaris.org/os/licensing.
111ae08745Sheppo  * See the License for the specific language governing permissions
121ae08745Sheppo  * and limitations under the License.
131ae08745Sheppo  *
141ae08745Sheppo  * When distributing Covered Code, include this CDDL HEADER in each
151ae08745Sheppo  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
161ae08745Sheppo  * If applicable, add the following below this CDDL HEADER, with the
171ae08745Sheppo  * fields enclosed by brackets "[]" replaced with your own identifying
181ae08745Sheppo  * information: Portions Copyright [yyyy] [name of copyright owner]
191ae08745Sheppo  *
201ae08745Sheppo  * CDDL HEADER END
211ae08745Sheppo  */
221ae08745Sheppo 
231ae08745Sheppo /*
241ae08745Sheppo  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
251ae08745Sheppo  * Use is subject to license terms.
261ae08745Sheppo  */
271ae08745Sheppo 
281ae08745Sheppo #ifndef _VCC_H
291ae08745Sheppo #define	_VCC_H
301ae08745Sheppo 
311ae08745Sheppo #pragma ident	"%Z%%M%	%I%	%E% SMI"
321ae08745Sheppo 
331ae08745Sheppo #ifdef __cplusplus
341ae08745Sheppo extern "C" {
351ae08745Sheppo #endif
361ae08745Sheppo 
371ae08745Sheppo #include <sys/stream.h>
381ae08745Sheppo #include <sys/ddi.h>
391ae08745Sheppo #include <sys/sunddi.h>
401ae08745Sheppo #include <sys/ioctl.h>
411ae08745Sheppo 
421ae08745Sheppo /*
431ae08745Sheppo  * vcc and vntsd exchange information using ioctl commands. When vntsd starts,
441ae08745Sheppo  * it uses VCC_NUM_CONSOLE to get number of existing ports and
451ae08745Sheppo  * VCC_CONS_TBL to obtain the table of existing consoles. In this table,
461ae08745Sheppo  * vcc returns information about each of the console ports using vcc_console_t
471ae08745Sheppo  * structure. Vntsd then sleeps on polling vcc control port.
481ae08745Sheppo  *
491ae08745Sheppo  * When there is a change in configuration, such as addtion or deletion
501ae08745Sheppo  * of a console port, vcc wakes up vntsd via the poll events. Subsequently,
511ae08745Sheppo  * vntsd uses VCC_INQUIRY ioctl to determine the reason for wakeup. In
521ae08745Sheppo  * response to the inquiry, vcc provides a vcc_response_t structure
531ae08745Sheppo  * containing reason and port number.
541ae08745Sheppo  *
551ae08745Sheppo  * If a port is being added or updated (group change), vntsd uses
561ae08745Sheppo  * VCC_CONS_INFO ioctl with port number to obtain configuration of
571ae08745Sheppo  * the port.
581ae08745Sheppo  *
591ae08745Sheppo  * If the port is being deleted, vntsd uses VCC_DEL_CONS_OK ioctl to notify
601ae08745Sheppo  * vcc after its clean up is done. Vcc subsequently tears down
611ae08745Sheppo  * its internal configuration and remove the associated TTY minor node.
621ae08745Sheppo  *
631ae08745Sheppo  * Only one open is allowd for each vcc port. If vntsd opens a port that is
641ae08745Sheppo  * already open, vntsd will use VNTSD_FORCE_CLOSE to take port from other
651ae08745Sheppo  * application
661ae08745Sheppo  */
671ae08745Sheppo 
681ae08745Sheppo /* VCC CNTRL IOCTL */
691ae08745Sheppo 
701ae08745Sheppo #define	    VCC_IOCTL_CMD		('c' << 8)
711ae08745Sheppo 
721ae08745Sheppo 
731ae08745Sheppo #define	    VCC_NUM_CONSOLE	VCC_IOCTL_CMD | 0x1	/* num of consoles */
741ae08745Sheppo #define	    VCC_CONS_TBL	VCC_IOCTL_CMD | 0x2	/* config table */
751ae08745Sheppo #define	    VCC_INQUIRY		VCC_IOCTL_CMD | 0x3	/* inquiry by vntsd */
761ae08745Sheppo #define	    VCC_CONS_INFO	VCC_IOCTL_CMD | 0x4	/* config */
771ae08745Sheppo #define	    VCC_CONS_STATUS	VCC_IOCTL_CMD | 0x5	/* console status */
781ae08745Sheppo #define	    VCC_FORCE_CLOSE	VCC_IOCTL_CMD | 0x6	/* force to close */
791ae08745Sheppo 
801ae08745Sheppo /* reasons to wake up vntsd */
811ae08745Sheppo typedef enum {
821ae08745Sheppo 	VCC_CONS_ADDED,		    /* a port was added */
831ae08745Sheppo 	VCC_CONS_DELETED,	    /* a port was removed */
84*7636cb21Slm66018 	VCC_CONS_MISS_ADDED,	    /* wakeup after an added port was deleted */
851ae08745Sheppo 	/* XXX not implemented yet */
861ae08745Sheppo 	VCC_CONS_UPDATED	    /* a port configuration was changed */
871ae08745Sheppo } vcc_reason_t;
881ae08745Sheppo 
891ae08745Sheppo /*
901ae08745Sheppo  * structure that vcc returns to vntsd in response to VCC_CONS_TBL and
911ae08745Sheppo  * VCC_CONS_INFO  ioctl call.
921ae08745Sheppo  */
931ae08745Sheppo typedef struct vcc_console {
941ae08745Sheppo 	int		cons_no;		    /* console port number  */
951ae08745Sheppo 	uint64_t	tcp_port;		    /* tcp port for the group */
961ae08745Sheppo 	char		domain_name[MAXPATHLEN];    /* domain name */
971ae08745Sheppo 	char		group_name[MAXPATHLEN];	    /* group name */
981ae08745Sheppo 	char		dev_name[MAXPATHLEN];
991ae08745Sheppo } vcc_console_t;
1001ae08745Sheppo 
1011ae08745Sheppo /* structure that vcc sends to vntsd in response to wake up inquiry */
1021ae08745Sheppo typedef struct vcc_response {
1031ae08745Sheppo 	int		cons_no;	/* console port number */
1041ae08745Sheppo 	vcc_reason_t	reason;		/* wake up reason */
1051ae08745Sheppo } vcc_response_t;
1061ae08745Sheppo 
1071ae08745Sheppo #ifdef __cplusplus
1081ae08745Sheppo }
1091ae08745Sheppo #endif
1101ae08745Sheppo 
1111ae08745Sheppo #endif /* _VCC_H */
112