xref: /titanic_41/usr/src/lib/libbc/inc/include/sys/ioccom.h (revision 5d54f3d8999eac1762fe0a8c7177d20f1f201fae)
17c478bd9Sstevel@tonic-gate /*
2*5d54f3d8Smuffin  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
37c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
47c478bd9Sstevel@tonic-gate  */
57c478bd9Sstevel@tonic-gate 
67c478bd9Sstevel@tonic-gate /*
77c478bd9Sstevel@tonic-gate  * Copyright (c) 1982, 1986 Regents of the University of California.
87c478bd9Sstevel@tonic-gate  * All rights reserved.  The Berkeley software License Agreement
97c478bd9Sstevel@tonic-gate  * specifies the terms and conditions for redistribution.
107c478bd9Sstevel@tonic-gate  */
117c478bd9Sstevel@tonic-gate 
127c478bd9Sstevel@tonic-gate #ifndef	__sys_ioccom_h
137c478bd9Sstevel@tonic-gate #define	__sys_ioccom_h
147c478bd9Sstevel@tonic-gate 
15*5d54f3d8Smuffin #pragma ident	"%Z%%M%	%I%	%E% SMI"
16*5d54f3d8Smuffin 
177c478bd9Sstevel@tonic-gate /*
187c478bd9Sstevel@tonic-gate  * Ioctl's have the command encoded in the lower word,
197c478bd9Sstevel@tonic-gate  * and the size of any in or out parameters in the upper
207c478bd9Sstevel@tonic-gate  * word.  The high 2 bits of the upper word are used
217c478bd9Sstevel@tonic-gate  * to encode the in/out status of the parameter; for now
227c478bd9Sstevel@tonic-gate  * we restrict parameters to at most 255 bytes.
237c478bd9Sstevel@tonic-gate  */
247c478bd9Sstevel@tonic-gate #define	_IOCPARM_MASK	0xff		/* parameters must be < 256 bytes */
257c478bd9Sstevel@tonic-gate #define	_IOC_VOID	0x20000000	/* no parameters */
267c478bd9Sstevel@tonic-gate #define	_IOC_OUT	0x40000000	/* copy out parameters */
277c478bd9Sstevel@tonic-gate #define	_IOC_IN		0x80000000	/* copy in parameters */
287c478bd9Sstevel@tonic-gate #define	_IOC_INOUT	(_IOC_IN|_IOC_OUT)
29*5d54f3d8Smuffin 
307c478bd9Sstevel@tonic-gate /* the 0x20000000 is so we can distinguish new ioctl's from old */
31*5d54f3d8Smuffin #define	_IO(x,y)	(_IOC_VOID|(x<<8)|y)
32*5d54f3d8Smuffin #define	_IOR(x,y,t)	(_IOC_OUT|((sizeof(t)&_IOCPARM_MASK)<<16)|(x<<8)|y)
33*5d54f3d8Smuffin #define	_IORN(x,y,t)	(_IOC_OUT|(((t)&_IOCPARM_MASK)<<16)|(x<<8)|y)
34*5d54f3d8Smuffin #define	_IOW(x,y,t)	(_IOC_IN|((sizeof(t)&_IOCPARM_MASK)<<16)|(x<<8)|y)
35*5d54f3d8Smuffin #define	_IOWN(x,y,t)	(_IOC_IN|(((t)&_IOCPARM_MASK)<<16)|(x<<8)|y)
367c478bd9Sstevel@tonic-gate /* this should be _IORW, but stdio got there first */
37*5d54f3d8Smuffin #define	_IOWR(x,y,t)	(_IOC_INOUT|((sizeof(t)&_IOCPARM_MASK)<<16)|(x<<8)|y)
38*5d54f3d8Smuffin #define	_IOWRN(x,y,t)	(_IOC_INOUT|(((t)&_IOCPARM_MASK)<<16)|(x<<8)|y)
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate /*
417c478bd9Sstevel@tonic-gate  * Registry of ioctl characters, culled from system sources
427c478bd9Sstevel@tonic-gate  *
437c478bd9Sstevel@tonic-gate  * char	file where defined		notes
447c478bd9Sstevel@tonic-gate  * ----	------------------		-----
457c478bd9Sstevel@tonic-gate  *   F	sun/fbio.h
467c478bd9Sstevel@tonic-gate  *   G	sun/gpio.h
477c478bd9Sstevel@tonic-gate  *   H	vaxif/if_hy.h
487c478bd9Sstevel@tonic-gate  *   M	sundev/mcpcmd.h			*overlap*
497c478bd9Sstevel@tonic-gate  *   M	sys/modem.h			*overlap*
507c478bd9Sstevel@tonic-gate  *   S	sys/stropts.h
517c478bd9Sstevel@tonic-gate  *   T	sys/termio.h			-no overlap-
527c478bd9Sstevel@tonic-gate  *   T	sys/termios.h			-no overlap-
537c478bd9Sstevel@tonic-gate  *   V	sundev/mdreg.h
547c478bd9Sstevel@tonic-gate  *   a	vaxuba/adreg.h
557c478bd9Sstevel@tonic-gate  *   d	sun/dkio.h			-no overlap with sys/des.h-
567c478bd9Sstevel@tonic-gate  *   d	sys/des.h			(possible overlap)
577c478bd9Sstevel@tonic-gate  *   d	vax/dkio.h			(possible overlap)
587c478bd9Sstevel@tonic-gate  *   d	vaxuba/rxreg.h			(possible overlap)
597c478bd9Sstevel@tonic-gate  *   f	sys/filio.h
607c478bd9Sstevel@tonic-gate  *   g	sunwindow/win_ioctl.h		-no overlap-
617c478bd9Sstevel@tonic-gate  *   g	sunwindowdev/winioctl.c		!no manifest constant! -no overlap-
627c478bd9Sstevel@tonic-gate  *   h	sundev/hrc_common.h
637c478bd9Sstevel@tonic-gate  *   i	sys/sockio.h			*overlap*
647c478bd9Sstevel@tonic-gate  *   i	vaxuba/ikreg.h			*overlap*
657c478bd9Sstevel@tonic-gate  *   k	sundev/kbio.h
667c478bd9Sstevel@tonic-gate  *   m	sundev/msio.h			(possible overlap)
677c478bd9Sstevel@tonic-gate  *   m	sundev/msreg.h			(possible overlap)
687c478bd9Sstevel@tonic-gate  *   m	sys/mtio.h			(possible overlap)
697c478bd9Sstevel@tonic-gate  *   n	sun/ndio.h
707c478bd9Sstevel@tonic-gate  *   p	net/nit_buf.h			(possible overlap)
717c478bd9Sstevel@tonic-gate  *   p	net/nit_if.h			(possible overlap)
727c478bd9Sstevel@tonic-gate  *   p	net/nit_pf.h			(possible overlap)
737c478bd9Sstevel@tonic-gate  *   p	sundev/fpareg.h			(possible overlap)
747c478bd9Sstevel@tonic-gate  *   p	sys/sockio.h			(possible overlap)
757c478bd9Sstevel@tonic-gate  *   p	vaxuba/psreg.h			(possible overlap)
767c478bd9Sstevel@tonic-gate  *   q	sun/sqz.h
777c478bd9Sstevel@tonic-gate  *   r	sys/sockio.h
787c478bd9Sstevel@tonic-gate  *   s	sys/sockio.h
797c478bd9Sstevel@tonic-gate  *   t	sys/ttold.h			(possible overlap)
807c478bd9Sstevel@tonic-gate  *   t	sys/ttycom.h			(possible overlap)
817c478bd9Sstevel@tonic-gate  *   v	sundev/vuid_event.h		*overlap*
827c478bd9Sstevel@tonic-gate  *   v	sys/vcmd.h			*overlap*
837c478bd9Sstevel@tonic-gate  *
847c478bd9Sstevel@tonic-gate  * End of Registry
857c478bd9Sstevel@tonic-gate  */
867c478bd9Sstevel@tonic-gate 
877c478bd9Sstevel@tonic-gate #endif /* !__sys_ioccom_h */
88