]> git.proxmox.com Git - mirror_edk2.git/blame - StdLib/Include/sys/ioccom.h
Vlv2TbltDevicePkg/PlatformFlashAccessLib: Fix IA32 build issues
[mirror_edk2.git] / StdLib / Include / sys / ioccom.h
CommitLineData
2aa62f2b 1/* $NetBSD: ioccom.h,v 1.8 2005/12/11 12:25:20 christos Exp $ */\r
2\r
3/*-\r
4 * Copyright (c) 1982, 1986, 1990, 1993, 1994\r
5 * The Regents of the University of California. All rights reserved.\r
6 *\r
7 * Redistribution and use in source and binary forms, with or without\r
8 * modification, are permitted provided that the following conditions\r
9 * are met:\r
10 * 1. Redistributions of source code must retain the above copyright\r
11 * notice, this list of conditions and the following disclaimer.\r
12 * 2. Redistributions in binary form must reproduce the above copyright\r
13 * notice, this list of conditions and the following disclaimer in the\r
14 * documentation and/or other materials provided with the distribution.\r
15 * 3. Neither the name of the University nor the names of its contributors\r
16 * may be used to endorse or promote products derived from this software\r
17 * without specific prior written permission.\r
18 *\r
19 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\r
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\r
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
29 * SUCH DAMAGE.\r
30 *\r
31 * @(#)ioccom.h 8.3 (Berkeley) 1/9/95\r
32 */\r
2aa62f2b 33#ifndef _SYS_IOCCOM_H_\r
34#define _SYS_IOCCOM_H_\r
35\r
36/*\r
37 * Ioctl's have the command encoded in the lower word, and the size of\r
38 * any in or out parameters in the upper word. The high 3 bits of the\r
39 * upper word are used to encode the in/out status of the parameter.\r
40 */\r
41#define IOCPARM_MASK 0x1fff /* parameter length, at most 13 bits */\r
d09ed37f 42\r
2aa62f2b 43#define IOCPARM_LEN(x) (((x) >> 16) & IOCPARM_MASK)\r
44#define IOCBASECMD(x) ((x) & ~(IOCPARM_MASK << 16))\r
45#define IOCGROUP(x) (((x) >> 8) & 0xff)\r
46\r
47#define IOCPARM_MAX NBPG /* max size of ioctl args, mult. of NBPG */\r
48 /* no parameters */\r
49#define IOC_VOID (unsigned long)0x20000000\r
50 /* copy parameters out */\r
51#define IOC_OUT (unsigned long)0x40000000\r
52 /* copy parameters in */\r
53#define IOC_IN (unsigned long)0x80000000\r
54 /* copy parameters in and out */\r
55#define IOC_INOUT (IOC_IN|IOC_OUT)\r
56 /* mask for IN/OUT/VOID */\r
57#define IOC_DIRMASK (unsigned long)0xe0000000\r
58\r
d09ed37f 59#define _IOC(inout,group,num,len) (inout | ((len & IOCPARM_MASK) << 16) | ((group) << 8) | (num))\r
60\r
2aa62f2b 61#define _IO(g,n) _IOC(IOC_VOID, (g), (n), 0)\r
62#define _IOR(g,n,t) _IOC(IOC_OUT, (g), (n), sizeof(t))\r
63#define _IOW(g,n,t) _IOC(IOC_IN, (g), (n), sizeof(t))\r
d09ed37f 64\r
2aa62f2b 65/* this should be _IORW, but stdio got there first */\r
66#define _IOWR(g,n,t) _IOC(IOC_INOUT, (g), (n), sizeof(t))\r
67\r
68#endif /* !_SYS_IOCCOM_H_ */\r