diff options
author | Chris Zankel <czankel@tensilica.com> | 2005-06-24 01:01:26 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-24 03:05:22 -0400 |
commit | 9a8fd5589902153a134111ed7a40f9cca1f83254 (patch) | |
tree | 6f7a06de25bdf0b2d94623794c2cbbc66b5a77f6 /include/asm-xtensa/ioctl.h | |
parent | 3f65ce4d141e435e54c20ed2379d983d362a2cb5 (diff) |
[PATCH] xtensa: Architecture support for Tensilica Xtensa Part 6
The attached patches provides part 6 of an architecture implementation for the
Tensilica Xtensa CPU series.
Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/asm-xtensa/ioctl.h')
-rw-r--r-- | include/asm-xtensa/ioctl.h | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/include/asm-xtensa/ioctl.h b/include/asm-xtensa/ioctl.h new file mode 100644 index 000000000000..856c605d62b1 --- /dev/null +++ b/include/asm-xtensa/ioctl.h | |||
@@ -0,0 +1,83 @@ | |||
1 | /* | ||
2 | * include/asm-xtensa/ioctl.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2003 - 2005 Tensilica Inc. | ||
9 | * | ||
10 | * Derived from "include/asm-i386/ioctl.h" | ||
11 | */ | ||
12 | |||
13 | #ifndef _XTENSA_IOCTL_H | ||
14 | #define _XTENSA_IOCTL_H | ||
15 | |||
16 | |||
17 | /* ioctl command encoding: 32 bits total, command in lower 16 bits, | ||
18 | * size of the parameter structure in the lower 14 bits of the | ||
19 | * upper 16 bits. | ||
20 | * Encoding the size of the parameter structure in the ioctl request | ||
21 | * is useful for catching programs compiled with old versions | ||
22 | * and to avoid overwriting user space outside the user buffer area. | ||
23 | * The highest 2 bits are reserved for indicating the ``access mode''. | ||
24 | * NOTE: This limits the max parameter size to 16kB -1 ! | ||
25 | */ | ||
26 | |||
27 | /* | ||
28 | * The following is for compatibility across the various Linux | ||
29 | * platforms. The i386 ioctl numbering scheme doesn't really enforce | ||
30 | * a type field. De facto, however, the top 8 bits of the lower 16 | ||
31 | * bits are indeed used as a type field, so we might just as well make | ||
32 | * this explicit here. Please be sure to use the decoding macros | ||
33 | * below from now on. | ||
34 | */ | ||
35 | #define _IOC_NRBITS 8 | ||
36 | #define _IOC_TYPEBITS 8 | ||
37 | #define _IOC_SIZEBITS 14 | ||
38 | #define _IOC_DIRBITS 2 | ||
39 | |||
40 | #define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) | ||
41 | #define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) | ||
42 | #define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) | ||
43 | #define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) | ||
44 | |||
45 | #define _IOC_NRSHIFT 0 | ||
46 | #define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) | ||
47 | #define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) | ||
48 | #define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) | ||
49 | |||
50 | /* | ||
51 | * Direction bits. | ||
52 | */ | ||
53 | #define _IOC_NONE 0U | ||
54 | #define _IOC_WRITE 1U | ||
55 | #define _IOC_READ 2U | ||
56 | |||
57 | #define _IOC(dir,type,nr,size) \ | ||
58 | (((dir) << _IOC_DIRSHIFT) | \ | ||
59 | ((type) << _IOC_TYPESHIFT) | \ | ||
60 | ((nr) << _IOC_NRSHIFT) | \ | ||
61 | ((size) << _IOC_SIZESHIFT)) | ||
62 | |||
63 | /* used to create numbers */ | ||
64 | #define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) | ||
65 | #define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) | ||
66 | #define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size)) | ||
67 | #define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size)) | ||
68 | |||
69 | /* used to decode ioctl numbers.. */ | ||
70 | #define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) | ||
71 | #define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) | ||
72 | #define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) | ||
73 | #define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK) | ||
74 | |||
75 | /* ...and for the drivers/sound files... */ | ||
76 | |||
77 | #define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) | ||
78 | #define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) | ||
79 | #define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT) | ||
80 | #define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) | ||
81 | #define IOCSIZE_SHIFT (_IOC_SIZESHIFT) | ||
82 | |||
83 | #endif | ||