xref: /onnv-gate/usr/src/uts/sun4v/sys/vcc.h (revision 2748:85615553b3bb)
11991Sheppo 
21991Sheppo /*
31991Sheppo  * CDDL HEADER START
41991Sheppo  *
51991Sheppo  * The contents of this file are subject to the terms of the
61991Sheppo  * Common Development and Distribution License (the "License").
71991Sheppo  * You may not use this file except in compliance with the License.
81991Sheppo  *
91991Sheppo  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
101991Sheppo  * or http://www.opensolaris.org/os/licensing.
111991Sheppo  * See the License for the specific language governing permissions
121991Sheppo  * and limitations under the License.
131991Sheppo  *
141991Sheppo  * When distributing Covered Code, include this CDDL HEADER in each
151991Sheppo  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
161991Sheppo  * If applicable, add the following below this CDDL HEADER, with the
171991Sheppo  * fields enclosed by brackets "[]" replaced with your own identifying
181991Sheppo  * information: Portions Copyright [yyyy] [name of copyright owner]
191991Sheppo  *
201991Sheppo  * CDDL HEADER END
211991Sheppo  */
221991Sheppo 
231991Sheppo /*
241991Sheppo  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
251991Sheppo  * Use is subject to license terms.
261991Sheppo  */
271991Sheppo 
281991Sheppo #ifndef _VCC_H
291991Sheppo #define	_VCC_H
301991Sheppo 
311991Sheppo #pragma ident	"%Z%%M%	%I%	%E% SMI"
321991Sheppo 
331991Sheppo #ifdef __cplusplus
341991Sheppo extern "C" {
351991Sheppo #endif
361991Sheppo 
371991Sheppo #include <sys/stream.h>
381991Sheppo #include <sys/ddi.h>
391991Sheppo #include <sys/sunddi.h>
401991Sheppo #include <sys/ioctl.h>
411991Sheppo 
421991Sheppo /*
431991Sheppo  * vcc and vntsd exchange information using ioctl commands. When vntsd starts,
441991Sheppo  * it uses VCC_NUM_CONSOLE to get number of existing ports and
451991Sheppo  * VCC_CONS_TBL to obtain the table of existing consoles. In this table,
461991Sheppo  * vcc returns information about each of the console ports using vcc_console_t
471991Sheppo  * structure. Vntsd then sleeps on polling vcc control port.
481991Sheppo  *
491991Sheppo  * When there is a change in configuration, such as addtion or deletion
501991Sheppo  * of a console port, vcc wakes up vntsd via the poll events. Subsequently,
511991Sheppo  * vntsd uses VCC_INQUIRY ioctl to determine the reason for wakeup. In
521991Sheppo  * response to the inquiry, vcc provides a vcc_response_t structure
531991Sheppo  * containing reason and port number.
541991Sheppo  *
551991Sheppo  * If a port is being added or updated (group change), vntsd uses
561991Sheppo  * VCC_CONS_INFO ioctl with port number to obtain configuration of
571991Sheppo  * the port.
581991Sheppo  *
591991Sheppo  * If the port is being deleted, vntsd uses VCC_DEL_CONS_OK ioctl to notify
601991Sheppo  * vcc after its clean up is done. Vcc subsequently tears down
611991Sheppo  * its internal configuration and remove the associated TTY minor node.
621991Sheppo  *
631991Sheppo  * Only one open is allowd for each vcc port. If vntsd opens a port that is
641991Sheppo  * already open, vntsd will use VNTSD_FORCE_CLOSE to take port from other
651991Sheppo  * application
661991Sheppo  */
671991Sheppo 
681991Sheppo /* VCC CNTRL IOCTL */
691991Sheppo 
701991Sheppo #define	    VCC_IOCTL_CMD		('c' << 8)
711991Sheppo 
721991Sheppo 
731991Sheppo #define	    VCC_NUM_CONSOLE	VCC_IOCTL_CMD | 0x1	/* num of consoles */
741991Sheppo #define	    VCC_CONS_TBL	VCC_IOCTL_CMD | 0x2	/* config table */
751991Sheppo #define	    VCC_INQUIRY		VCC_IOCTL_CMD | 0x3	/* inquiry by vntsd */
761991Sheppo #define	    VCC_CONS_INFO	VCC_IOCTL_CMD | 0x4	/* config */
771991Sheppo #define	    VCC_CONS_STATUS	VCC_IOCTL_CMD | 0x5	/* console status */
781991Sheppo #define	    VCC_FORCE_CLOSE	VCC_IOCTL_CMD | 0x6	/* force to close */
791991Sheppo 
801991Sheppo /* reasons to wake up vntsd */
811991Sheppo typedef enum {
821991Sheppo 	VCC_CONS_ADDED,		    /* a port was added */
831991Sheppo 	VCC_CONS_DELETED,	    /* a port was removed */
84*2748Slm66018 	VCC_CONS_MISS_ADDED,	    /* wakeup after an added port was deleted */
851991Sheppo 	/* XXX not implemented yet */
861991Sheppo 	VCC_CONS_UPDATED	    /* a port configuration was changed */
871991Sheppo } vcc_reason_t;
881991Sheppo 
891991Sheppo /*
901991Sheppo  * structure that vcc returns to vntsd in response to VCC_CONS_TBL and
911991Sheppo  * VCC_CONS_INFO  ioctl call.
921991Sheppo  */
931991Sheppo typedef struct vcc_console {
941991Sheppo 	int		cons_no;		    /* console port number  */
951991Sheppo 	uint64_t	tcp_port;		    /* tcp port for the group */
961991Sheppo 	char		domain_name[MAXPATHLEN];    /* domain name */
971991Sheppo 	char		group_name[MAXPATHLEN];	    /* group name */
981991Sheppo 	char		dev_name[MAXPATHLEN];
991991Sheppo } vcc_console_t;
1001991Sheppo 
1011991Sheppo /* structure that vcc sends to vntsd in response to wake up inquiry */
1021991Sheppo typedef struct vcc_response {
1031991Sheppo 	int		cons_no;	/* console port number */
1041991Sheppo 	vcc_reason_t	reason;		/* wake up reason */
1051991Sheppo } vcc_response_t;
1061991Sheppo 
1071991Sheppo #ifdef __cplusplus
1081991Sheppo }
1091991Sheppo #endif
1101991Sheppo 
1111991Sheppo #endif /* _VCC_H */
112