1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* 23*7c478bd9Sstevel@tonic-gate * Copyright (c) 2001 by Sun Microsystems, Inc. 24*7c478bd9Sstevel@tonic-gate * All rights reserved. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate #ifndef _TTYMUXUSER_H 28*7c478bd9Sstevel@tonic-gate #define _TTYMUXUSER_H 29*7c478bd9Sstevel@tonic-gate 30*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*7c478bd9Sstevel@tonic-gate 32*7c478bd9Sstevel@tonic-gate #include <sys/types.h> 33*7c478bd9Sstevel@tonic-gate #include <sys/param.h> 34*7c478bd9Sstevel@tonic-gate #include <sys/termios.h> 35*7c478bd9Sstevel@tonic-gate 36*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 37*7c478bd9Sstevel@tonic-gate extern "C" { 38*7c478bd9Sstevel@tonic-gate #endif 39*7c478bd9Sstevel@tonic-gate 40*7c478bd9Sstevel@tonic-gate #define TTYMUX_MOD_ID (0x540d) /* T^m */ 41*7c478bd9Sstevel@tonic-gate #define TTYMUX_DRVNAME "ttymux" 42*7c478bd9Sstevel@tonic-gate 43*7c478bd9Sstevel@tonic-gate #define TTYMUX_MAX_LINKS (16) 44*7c478bd9Sstevel@tonic-gate /* 45*7c478bd9Sstevel@tonic-gate * Generic serial multiplexor ioctls. 46*7c478bd9Sstevel@tonic-gate */ 47*7c478bd9Sstevel@tonic-gate #define _TTYMUXIOC (TTYMUX_MOD_ID<<8) 48*7c478bd9Sstevel@tonic-gate #define TTYMUX_ASSOC (_TTYMUXIOC | 1) 49*7c478bd9Sstevel@tonic-gate #define TTYMUX_DISASSOC (_TTYMUXIOC | 2) 50*7c478bd9Sstevel@tonic-gate #define TTYMUX_LIST (_TTYMUXIOC | 3) 51*7c478bd9Sstevel@tonic-gate #define TTYMUX_GETLINK (_TTYMUXIOC | 4) 52*7c478bd9Sstevel@tonic-gate /* 53*7c478bd9Sstevel@tonic-gate * Ioctls for serial multiplexors acting as the system console. 54*7c478bd9Sstevel@tonic-gate */ 55*7c478bd9Sstevel@tonic-gate #define TTYMUX_SETABORT (_TTYMUXIOC | 100) 56*7c478bd9Sstevel@tonic-gate #define TTYMUX_GETABORT (_TTYMUXIOC | 101) 57*7c478bd9Sstevel@tonic-gate #define TTYMUX_CONSDEV (_TTYMUXIOC | 102) 58*7c478bd9Sstevel@tonic-gate #define TTYMUX_GETABORTSTR (_TTYMUXIOC | 103) 59*7c478bd9Sstevel@tonic-gate #define TTYMUX_GETCONSOLES (_TTYMUXIOC | 104) 60*7c478bd9Sstevel@tonic-gate /* 61*7c478bd9Sstevel@tonic-gate * Optional control ioctl. 62*7c478bd9Sstevel@tonic-gate */ 63*7c478bd9Sstevel@tonic-gate #define TTYMUX_SETCTL (_TTYMUXIOC | 200) 64*7c478bd9Sstevel@tonic-gate #define TTYMUX_GETCTL (_TTYMUXIOC | 201) 65*7c478bd9Sstevel@tonic-gate 66*7c478bd9Sstevel@tonic-gate typedef enum {FORINPUT = 1, FOROUTPUT = 2, FORIO = 3} io_mode_t; 67*7c478bd9Sstevel@tonic-gate 68*7c478bd9Sstevel@tonic-gate /* 69*7c478bd9Sstevel@tonic-gate * Create or destroy associations TTYMUX_ASSOC and TTYMUX_DISASSOC 70*7c478bd9Sstevel@tonic-gate */ 71*7c478bd9Sstevel@tonic-gate #define AMSTAG (0x414d5354) 72*7c478bd9Sstevel@tonic-gate typedef struct ttymux_association { 73*7c478bd9Sstevel@tonic-gate dev_t ttymux_udev; /* the upper device to be associated */ 74*7c478bd9Sstevel@tonic-gate /* the device type of a linked lower stream */ 75*7c478bd9Sstevel@tonic-gate dev_t ttymux_ldev; 76*7c478bd9Sstevel@tonic-gate /* the linkid of a linked lower stream */ 77*7c478bd9Sstevel@tonic-gate int ttymux_linkid; 78*7c478bd9Sstevel@tonic-gate ulong_t ttymux_tag; /* tagged association */ 79*7c478bd9Sstevel@tonic-gate io_mode_t ttymux_ioflag; /* FORINPUT FOROUTPUT FORIO */ 80*7c478bd9Sstevel@tonic-gate /* OBP device path of ldev */ 81*7c478bd9Sstevel@tonic-gate char ttymux_path[MAXPATHLEN]; 82*7c478bd9Sstevel@tonic-gate } ttymux_assoc_t; 83*7c478bd9Sstevel@tonic-gate 84*7c478bd9Sstevel@tonic-gate /* 85*7c478bd9Sstevel@tonic-gate * List all links known to a mux driver TTYMUX_LIST 86*7c478bd9Sstevel@tonic-gate * If the user ioctl arg is NULL the return value is the 87*7c478bd9Sstevel@tonic-gate * number of links in the driver (to facilitate the user 88*7c478bd9Sstevel@tonic-gate * allocating enough space for the link information. 89*7c478bd9Sstevel@tonic-gate * Otherwise the ioctl arg should point to the following 90*7c478bd9Sstevel@tonic-gate * structure. nlinks indicates how many entries the user 91*7c478bd9Sstevel@tonic-gate * has allocated in the array. The return value indicates the 92*7c478bd9Sstevel@tonic-gate * number of entries that have been filled in. 93*7c478bd9Sstevel@tonic-gate * EINVAL if nlinks is < 1 94*7c478bd9Sstevel@tonic-gate * EAGAIN if no resources. 95*7c478bd9Sstevel@tonic-gate */ 96*7c478bd9Sstevel@tonic-gate typedef struct ttymux_associations { 97*7c478bd9Sstevel@tonic-gate ulong_t ttymux_nlinks; 98*7c478bd9Sstevel@tonic-gate ttymux_assoc_t *ttymux_assocs; 99*7c478bd9Sstevel@tonic-gate } ttymux_assocs_t; 100*7c478bd9Sstevel@tonic-gate 101*7c478bd9Sstevel@tonic-gate /* 102*7c478bd9Sstevel@tonic-gate * Enable or disable aborting to the system monitor 103*7c478bd9Sstevel@tonic-gate * TTYMUX_SETABORT and TTYMUX_GETABORT 104*7c478bd9Sstevel@tonic-gate */ 105*7c478bd9Sstevel@tonic-gate enum ttymux_break_type {SOFTWARE_BREAK, HARDWARE_BREAK, SOFTHARD_BREAK}; 106*7c478bd9Sstevel@tonic-gate 107*7c478bd9Sstevel@tonic-gate typedef struct ttymux_abort { 108*7c478bd9Sstevel@tonic-gate /* apply request to this device */ 109*7c478bd9Sstevel@tonic-gate dev_t ttymux_ldev; 110*7c478bd9Sstevel@tonic-gate enum ttymux_break_type ttymux_method; 111*7c478bd9Sstevel@tonic-gate uint_t ttymux_enable; 112*7c478bd9Sstevel@tonic-gate } ttymux_abort_t; 113*7c478bd9Sstevel@tonic-gate 114*7c478bd9Sstevel@tonic-gate /* 115*7c478bd9Sstevel@tonic-gate * Ioctl acknowledgement policies. 116*7c478bd9Sstevel@tonic-gate */ 117*7c478bd9Sstevel@tonic-gate #define FIRSTACK 0 118*7c478bd9Sstevel@tonic-gate #define LASTACK 1 119*7c478bd9Sstevel@tonic-gate #define CONSENSUS 2 120*7c478bd9Sstevel@tonic-gate #define PERIOCTL 3 121*7c478bd9Sstevel@tonic-gate 122*7c478bd9Sstevel@tonic-gate /* 123*7c478bd9Sstevel@tonic-gate * Set or get the ioctl acknowledgement policy and masking of control bits 124*7c478bd9Sstevel@tonic-gate * TTYMUX_SETCTL and TTYMUX_GETCTL 125*7c478bd9Sstevel@tonic-gate */ 126*7c478bd9Sstevel@tonic-gate 127*7c478bd9Sstevel@tonic-gate struct ttymux_policy { 128*7c478bd9Sstevel@tonic-gate dev_t ttymux_udev; /* apply the request to this device */ 129*7c478bd9Sstevel@tonic-gate /* determines the method used to ack M_IOCTLS */ 130*7c478bd9Sstevel@tonic-gate int ttymux_policy; 131*7c478bd9Sstevel@tonic-gate tcflag_t ttymux_cmask; /* never set these control bits */ 132*7c478bd9Sstevel@tonic-gate }; 133*7c478bd9Sstevel@tonic-gate 134*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 135*7c478bd9Sstevel@tonic-gate } 136*7c478bd9Sstevel@tonic-gate #endif 137*7c478bd9Sstevel@tonic-gate 138*7c478bd9Sstevel@tonic-gate #endif /* _TTYMUXUSER_H */ 139