diff options
-rw-r--r-- | arch/sparc64/kernel/ioctl32.c | 92 | ||||
-rw-r--r-- | drivers/video/bw2.c | 3 | ||||
-rw-r--r-- | drivers/video/cg14.c | 3 | ||||
-rw-r--r-- | drivers/video/cg3.c | 3 | ||||
-rw-r--r-- | drivers/video/cg6.c | 3 | ||||
-rw-r--r-- | drivers/video/ffb.c | 3 | ||||
-rw-r--r-- | drivers/video/leo.c | 3 | ||||
-rw-r--r-- | drivers/video/p9100.c | 3 | ||||
-rw-r--r-- | drivers/video/sbuslib.c | 107 | ||||
-rw-r--r-- | drivers/video/sbuslib.h | 2 | ||||
-rw-r--r-- | drivers/video/tcx.c | 3 |
11 files changed, 133 insertions, 92 deletions
diff --git a/arch/sparc64/kernel/ioctl32.c b/arch/sparc64/kernel/ioctl32.c index e62214354bb5..196b208665a2 100644 --- a/arch/sparc64/kernel/ioctl32.c +++ b/arch/sparc64/kernel/ioctl32.c | |||
@@ -12,86 +12,10 @@ | |||
12 | #define INCLUDES | 12 | #define INCLUDES |
13 | #include "compat_ioctl.c" | 13 | #include "compat_ioctl.c" |
14 | #include <linux/syscalls.h> | 14 | #include <linux/syscalls.h> |
15 | #include <asm/fbio.h> | ||
16 | |||
17 | /* Use this to get at 32-bit user passed pointers. | ||
18 | * See sys_sparc32.c for description about it. | ||
19 | */ | ||
20 | #define A(__x) compat_ptr(__x) | ||
21 | 15 | ||
22 | #define CODE | 16 | #define CODE |
23 | #include "compat_ioctl.c" | 17 | #include "compat_ioctl.c" |
24 | 18 | ||
25 | struct fbcmap32 { | ||
26 | int index; /* first element (0 origin) */ | ||
27 | int count; | ||
28 | u32 red; | ||
29 | u32 green; | ||
30 | u32 blue; | ||
31 | }; | ||
32 | |||
33 | #define FBIOPUTCMAP32 _IOW('F', 3, struct fbcmap32) | ||
34 | #define FBIOGETCMAP32 _IOW('F', 4, struct fbcmap32) | ||
35 | |||
36 | static int fbiogetputcmap(unsigned int fd, unsigned int cmd, unsigned long arg) | ||
37 | { | ||
38 | struct fbcmap32 __user *argp = (void __user *)arg; | ||
39 | struct fbcmap __user *p = compat_alloc_user_space(sizeof(*p)); | ||
40 | u32 addr; | ||
41 | int ret; | ||
42 | |||
43 | ret = copy_in_user(p, argp, 2 * sizeof(int)); | ||
44 | ret |= get_user(addr, &argp->red); | ||
45 | ret |= put_user(compat_ptr(addr), &p->red); | ||
46 | ret |= get_user(addr, &argp->green); | ||
47 | ret |= put_user(compat_ptr(addr), &p->green); | ||
48 | ret |= get_user(addr, &argp->blue); | ||
49 | ret |= put_user(compat_ptr(addr), &p->blue); | ||
50 | if (ret) | ||
51 | return -EFAULT; | ||
52 | return sys_ioctl(fd, (cmd == FBIOPUTCMAP32) ? FBIOPUTCMAP_SPARC : FBIOGETCMAP_SPARC, (unsigned long)p); | ||
53 | } | ||
54 | |||
55 | struct fbcursor32 { | ||
56 | short set; /* what to set, choose from the list above */ | ||
57 | short enable; /* cursor on/off */ | ||
58 | struct fbcurpos pos; /* cursor position */ | ||
59 | struct fbcurpos hot; /* cursor hot spot */ | ||
60 | struct fbcmap32 cmap; /* color map info */ | ||
61 | struct fbcurpos size; /* cursor bit map size */ | ||
62 | u32 image; /* cursor image bits */ | ||
63 | u32 mask; /* cursor mask bits */ | ||
64 | }; | ||
65 | |||
66 | #define FBIOSCURSOR32 _IOW('F', 24, struct fbcursor32) | ||
67 | #define FBIOGCURSOR32 _IOW('F', 25, struct fbcursor32) | ||
68 | |||
69 | static int fbiogscursor(unsigned int fd, unsigned int cmd, unsigned long arg) | ||
70 | { | ||
71 | struct fbcursor __user *p = compat_alloc_user_space(sizeof(*p)); | ||
72 | struct fbcursor32 __user *argp = (void __user *)arg; | ||
73 | compat_uptr_t addr; | ||
74 | int ret; | ||
75 | |||
76 | ret = copy_in_user(p, argp, | ||
77 | 2 * sizeof (short) + 2 * sizeof(struct fbcurpos)); | ||
78 | ret |= copy_in_user(&p->size, &argp->size, sizeof(struct fbcurpos)); | ||
79 | ret |= copy_in_user(&p->cmap, &argp->cmap, 2 * sizeof(int)); | ||
80 | ret |= get_user(addr, &argp->cmap.red); | ||
81 | ret |= put_user(compat_ptr(addr), &p->cmap.red); | ||
82 | ret |= get_user(addr, &argp->cmap.green); | ||
83 | ret |= put_user(compat_ptr(addr), &p->cmap.green); | ||
84 | ret |= get_user(addr, &argp->cmap.blue); | ||
85 | ret |= put_user(compat_ptr(addr), &p->cmap.blue); | ||
86 | ret |= get_user(addr, &argp->mask); | ||
87 | ret |= put_user(compat_ptr(addr), &p->mask); | ||
88 | ret |= get_user(addr, &argp->image); | ||
89 | ret |= put_user(compat_ptr(addr), &p->image); | ||
90 | if (ret) | ||
91 | return -EFAULT; | ||
92 | return sys_ioctl (fd, FBIOSCURSOR, (unsigned long)p); | ||
93 | } | ||
94 | |||
95 | #define COMPATIBLE_IOCTL(cmd) HANDLE_IOCTL((cmd),sys_ioctl) | 19 | #define COMPATIBLE_IOCTL(cmd) HANDLE_IOCTL((cmd),sys_ioctl) |
96 | #define HANDLE_IOCTL(cmd,handler) { (cmd), (ioctl_trans_handler_t)(handler), NULL }, | 20 | #define HANDLE_IOCTL(cmd,handler) { (cmd), (ioctl_trans_handler_t)(handler), NULL }, |
97 | #define IOCTL_TABLE_START \ | 21 | #define IOCTL_TABLE_START \ |
@@ -103,22 +27,6 @@ IOCTL_TABLE_START | |||
103 | #include <linux/compat_ioctl.h> | 27 | #include <linux/compat_ioctl.h> |
104 | #define DECLARES | 28 | #define DECLARES |
105 | #include "compat_ioctl.c" | 29 | #include "compat_ioctl.c" |
106 | COMPATIBLE_IOCTL(FBIOGTYPE) | ||
107 | COMPATIBLE_IOCTL(FBIOSATTR) | ||
108 | COMPATIBLE_IOCTL(FBIOGATTR) | ||
109 | COMPATIBLE_IOCTL(FBIOSVIDEO) | ||
110 | COMPATIBLE_IOCTL(FBIOGVIDEO) | ||
111 | COMPATIBLE_IOCTL(FBIOGCURSOR32) /* This is not implemented yet. Later it should be converted... */ | ||
112 | COMPATIBLE_IOCTL(FBIOSCURPOS) | ||
113 | COMPATIBLE_IOCTL(FBIOGCURPOS) | ||
114 | COMPATIBLE_IOCTL(FBIOGCURMAX) | ||
115 | /* Little k */ | ||
116 | /* Little v, the video4linux ioctls */ | ||
117 | /* And these ioctls need translation */ | ||
118 | /* Note SIOCRTMSG is no longer, so this is safe and * the user would have seen just an -EINVAL anyways. */ | ||
119 | HANDLE_IOCTL(FBIOPUTCMAP32, fbiogetputcmap) | ||
120 | HANDLE_IOCTL(FBIOGETCMAP32, fbiogetputcmap) | ||
121 | HANDLE_IOCTL(FBIOSCURSOR32, fbiogscursor) | ||
122 | #if 0 | 30 | #if 0 |
123 | HANDLE_IOCTL(RTC32_IRQP_READ, do_rtc_ioctl) | 31 | HANDLE_IOCTL(RTC32_IRQP_READ, do_rtc_ioctl) |
124 | HANDLE_IOCTL(RTC32_IRQP_SET, do_rtc_ioctl) | 32 | HANDLE_IOCTL(RTC32_IRQP_SET, do_rtc_ioctl) |
diff --git a/drivers/video/bw2.c b/drivers/video/bw2.c index f53bf3ba1278..d3728f60961e 100644 --- a/drivers/video/bw2.c +++ b/drivers/video/bw2.c | |||
@@ -51,6 +51,9 @@ static struct fb_ops bw2_ops = { | |||
51 | .fb_imageblit = cfb_imageblit, | 51 | .fb_imageblit = cfb_imageblit, |
52 | .fb_mmap = bw2_mmap, | 52 | .fb_mmap = bw2_mmap, |
53 | .fb_ioctl = bw2_ioctl, | 53 | .fb_ioctl = bw2_ioctl, |
54 | #ifdef CONFIG_COMPAT | ||
55 | .fb_compat_ioctl = sbusfb_compat_ioctl, | ||
56 | #endif | ||
54 | }; | 57 | }; |
55 | 58 | ||
56 | /* OBio addresses for the bwtwo registers */ | 59 | /* OBio addresses for the bwtwo registers */ |
diff --git a/drivers/video/cg14.c b/drivers/video/cg14.c index 030d4b13b1c2..1bed50f2a276 100644 --- a/drivers/video/cg14.c +++ b/drivers/video/cg14.c | |||
@@ -49,6 +49,9 @@ static struct fb_ops cg14_ops = { | |||
49 | .fb_imageblit = cfb_imageblit, | 49 | .fb_imageblit = cfb_imageblit, |
50 | .fb_mmap = cg14_mmap, | 50 | .fb_mmap = cg14_mmap, |
51 | .fb_ioctl = cg14_ioctl, | 51 | .fb_ioctl = cg14_ioctl, |
52 | #ifdef CONFIG_COMPAT | ||
53 | .fb_compat_ioctl = sbusfb_compat_ioctl, | ||
54 | #endif | ||
52 | }; | 55 | }; |
53 | 56 | ||
54 | #define CG14_MCR_INTENABLE_SHIFT 7 | 57 | #define CG14_MCR_INTENABLE_SHIFT 7 |
diff --git a/drivers/video/cg3.c b/drivers/video/cg3.c index b94eee8c42d5..a1354e7e0513 100644 --- a/drivers/video/cg3.c +++ b/drivers/video/cg3.c | |||
@@ -50,6 +50,9 @@ static struct fb_ops cg3_ops = { | |||
50 | .fb_imageblit = cfb_imageblit, | 50 | .fb_imageblit = cfb_imageblit, |
51 | .fb_mmap = cg3_mmap, | 51 | .fb_mmap = cg3_mmap, |
52 | .fb_ioctl = cg3_ioctl, | 52 | .fb_ioctl = cg3_ioctl, |
53 | #ifdef CONFIG_COMPAT | ||
54 | .fb_compat_ioctl = sbusfb_compat_ioctl, | ||
55 | #endif | ||
53 | }; | 56 | }; |
54 | 57 | ||
55 | 58 | ||
diff --git a/drivers/video/cg6.c b/drivers/video/cg6.c index 414c4409e924..9debe642fd2f 100644 --- a/drivers/video/cg6.c +++ b/drivers/video/cg6.c | |||
@@ -54,6 +54,9 @@ static struct fb_ops cg6_ops = { | |||
54 | .fb_sync = cg6_sync, | 54 | .fb_sync = cg6_sync, |
55 | .fb_mmap = cg6_mmap, | 55 | .fb_mmap = cg6_mmap, |
56 | .fb_ioctl = cg6_ioctl, | 56 | .fb_ioctl = cg6_ioctl, |
57 | #ifdef CONFIG_COMPAT | ||
58 | .fb_compat_ioctl = sbusfb_compat_ioctl, | ||
59 | #endif | ||
57 | }; | 60 | }; |
58 | 61 | ||
59 | /* Offset of interesting structures in the OBIO space */ | 62 | /* Offset of interesting structures in the OBIO space */ |
diff --git a/drivers/video/ffb.c b/drivers/video/ffb.c index 04417dc16c2e..2584daec7bbf 100644 --- a/drivers/video/ffb.c +++ b/drivers/video/ffb.c | |||
@@ -57,6 +57,9 @@ static struct fb_ops ffb_ops = { | |||
57 | .fb_sync = ffb_sync, | 57 | .fb_sync = ffb_sync, |
58 | .fb_mmap = ffb_mmap, | 58 | .fb_mmap = ffb_mmap, |
59 | .fb_ioctl = ffb_ioctl, | 59 | .fb_ioctl = ffb_ioctl, |
60 | #ifdef CONFIG_COMPAT | ||
61 | .fb_compat_ioctl = sbusfb_compat_ioctl, | ||
62 | #endif | ||
60 | }; | 63 | }; |
61 | 64 | ||
62 | /* Register layout and definitions */ | 65 | /* Register layout and definitions */ |
diff --git a/drivers/video/leo.c b/drivers/video/leo.c index 84a7fe435bb8..376d4a171ec7 100644 --- a/drivers/video/leo.c +++ b/drivers/video/leo.c | |||
@@ -51,6 +51,9 @@ static struct fb_ops leo_ops = { | |||
51 | .fb_imageblit = cfb_imageblit, | 51 | .fb_imageblit = cfb_imageblit, |
52 | .fb_mmap = leo_mmap, | 52 | .fb_mmap = leo_mmap, |
53 | .fb_ioctl = leo_ioctl, | 53 | .fb_ioctl = leo_ioctl, |
54 | #ifdef CONFIG_COMPAT | ||
55 | .fb_compat_ioctl = sbusfb_compat_ioctl, | ||
56 | #endif | ||
54 | }; | 57 | }; |
55 | 58 | ||
56 | #define LEO_OFF_LC_SS0_KRN 0x00200000UL | 59 | #define LEO_OFF_LC_SS0_KRN 0x00200000UL |
diff --git a/drivers/video/p9100.c b/drivers/video/p9100.c index 9aaf65fb623a..18bcda23d2cf 100644 --- a/drivers/video/p9100.c +++ b/drivers/video/p9100.c | |||
@@ -48,6 +48,9 @@ static struct fb_ops p9100_ops = { | |||
48 | .fb_imageblit = cfb_imageblit, | 48 | .fb_imageblit = cfb_imageblit, |
49 | .fb_mmap = p9100_mmap, | 49 | .fb_mmap = p9100_mmap, |
50 | .fb_ioctl = p9100_ioctl, | 50 | .fb_ioctl = p9100_ioctl, |
51 | #ifdef CONFIG_COMPAT | ||
52 | .fb_compat_ioctl = sbusfb_compat_ioctl, | ||
53 | #endif | ||
51 | }; | 54 | }; |
52 | 55 | ||
53 | /* P9100 control registers */ | 56 | /* P9100 control registers */ |
diff --git a/drivers/video/sbuslib.c b/drivers/video/sbuslib.c index 34f72edba820..646c43f921c5 100644 --- a/drivers/video/sbuslib.c +++ b/drivers/video/sbuslib.c | |||
@@ -3,6 +3,7 @@ | |||
3 | * Copyright (C) 2003 David S. Miller (davem@redhat.com) | 3 | * Copyright (C) 2003 David S. Miller (davem@redhat.com) |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <linux/compat.h> | ||
6 | #include <linux/kernel.h> | 7 | #include <linux/kernel.h> |
7 | #include <linux/module.h> | 8 | #include <linux/module.h> |
8 | #include <linux/string.h> | 9 | #include <linux/string.h> |
@@ -182,3 +183,109 @@ int sbusfb_ioctl_helper(unsigned long cmd, unsigned long arg, | |||
182 | }; | 183 | }; |
183 | } | 184 | } |
184 | EXPORT_SYMBOL(sbusfb_ioctl_helper); | 185 | EXPORT_SYMBOL(sbusfb_ioctl_helper); |
186 | |||
187 | #ifdef CONFIG_COMPAT | ||
188 | struct fbcmap32 { | ||
189 | int index; /* first element (0 origin) */ | ||
190 | int count; | ||
191 | u32 red; | ||
192 | u32 green; | ||
193 | u32 blue; | ||
194 | }; | ||
195 | |||
196 | #define FBIOPUTCMAP32 _IOW('F', 3, struct fbcmap32) | ||
197 | #define FBIOGETCMAP32 _IOW('F', 4, struct fbcmap32) | ||
198 | |||
199 | static int fbiogetputcmap(struct file *file, struct fb_info *info, | ||
200 | unsigned int cmd, unsigned long arg) | ||
201 | { | ||
202 | struct fbcmap32 __user *argp = (void __user *)arg; | ||
203 | struct fbcmap __user *p = compat_alloc_user_space(sizeof(*p)); | ||
204 | u32 addr; | ||
205 | int ret; | ||
206 | |||
207 | ret = copy_in_user(p, argp, 2 * sizeof(int)); | ||
208 | ret |= get_user(addr, &argp->red); | ||
209 | ret |= put_user(compat_ptr(addr), &p->red); | ||
210 | ret |= get_user(addr, &argp->green); | ||
211 | ret |= put_user(compat_ptr(addr), &p->green); | ||
212 | ret |= get_user(addr, &argp->blue); | ||
213 | ret |= put_user(compat_ptr(addr), &p->blue); | ||
214 | if (ret) | ||
215 | return -EFAULT; | ||
216 | return info->fbops->fb_ioctl(file->f_dentry->d_inode, file, | ||
217 | (cmd == FBIOPUTCMAP32) ? | ||
218 | FBIOPUTCMAP_SPARC : FBIOGETCMAP_SPARC, | ||
219 | (unsigned long)p, info); | ||
220 | } | ||
221 | |||
222 | struct fbcursor32 { | ||
223 | short set; /* what to set, choose from the list above */ | ||
224 | short enable; /* cursor on/off */ | ||
225 | struct fbcurpos pos; /* cursor position */ | ||
226 | struct fbcurpos hot; /* cursor hot spot */ | ||
227 | struct fbcmap32 cmap; /* color map info */ | ||
228 | struct fbcurpos size; /* cursor bit map size */ | ||
229 | u32 image; /* cursor image bits */ | ||
230 | u32 mask; /* cursor mask bits */ | ||
231 | }; | ||
232 | |||
233 | #define FBIOSCURSOR32 _IOW('F', 24, struct fbcursor32) | ||
234 | #define FBIOGCURSOR32 _IOW('F', 25, struct fbcursor32) | ||
235 | |||
236 | static int fbiogscursor(struct file *file, struct fb_info *info, | ||
237 | unsigned long arg) | ||
238 | { | ||
239 | struct fbcursor __user *p = compat_alloc_user_space(sizeof(*p)); | ||
240 | struct fbcursor32 __user *argp = (void __user *)arg; | ||
241 | compat_uptr_t addr; | ||
242 | int ret; | ||
243 | |||
244 | ret = copy_in_user(p, argp, | ||
245 | 2 * sizeof (short) + 2 * sizeof(struct fbcurpos)); | ||
246 | ret |= copy_in_user(&p->size, &argp->size, sizeof(struct fbcurpos)); | ||
247 | ret |= copy_in_user(&p->cmap, &argp->cmap, 2 * sizeof(int)); | ||
248 | ret |= get_user(addr, &argp->cmap.red); | ||
249 | ret |= put_user(compat_ptr(addr), &p->cmap.red); | ||
250 | ret |= get_user(addr, &argp->cmap.green); | ||
251 | ret |= put_user(compat_ptr(addr), &p->cmap.green); | ||
252 | ret |= get_user(addr, &argp->cmap.blue); | ||
253 | ret |= put_user(compat_ptr(addr), &p->cmap.blue); | ||
254 | ret |= get_user(addr, &argp->mask); | ||
255 | ret |= put_user(compat_ptr(addr), &p->mask); | ||
256 | ret |= get_user(addr, &argp->image); | ||
257 | ret |= put_user(compat_ptr(addr), &p->image); | ||
258 | if (ret) | ||
259 | return -EFAULT; | ||
260 | return info->fbops->fb_ioctl(file->f_dentry->d_inode, file, | ||
261 | FBIOSCURSOR, (unsigned long)p, info); | ||
262 | } | ||
263 | |||
264 | long sbusfb_compat_ioctl(struct file *file, unsigned int cmd, | ||
265 | unsigned long arg, struct fb_info *info) | ||
266 | { | ||
267 | switch (cmd) { | ||
268 | case FBIOGTYPE: | ||
269 | case FBIOSATTR: | ||
270 | case FBIOGATTR: | ||
271 | case FBIOSVIDEO: | ||
272 | case FBIOGVIDEO: | ||
273 | case FBIOGCURSOR32: /* This is not implemented yet. | ||
274 | Later it should be converted... */ | ||
275 | case FBIOSCURPOS: | ||
276 | case FBIOGCURPOS: | ||
277 | case FBIOGCURMAX: | ||
278 | return info->fbops->fb_ioctl(file->f_dentry->d_inode, | ||
279 | file, cmd, arg, info); | ||
280 | case FBIOPUTCMAP32: | ||
281 | return fbiogetputcmap(file, info, cmd, arg); | ||
282 | case FBIOGETCMAP32: | ||
283 | return fbiogetputcmap(file, info, cmd, arg); | ||
284 | case FBIOSCURSOR32: | ||
285 | return fbiogscursor(file, info, arg); | ||
286 | default: | ||
287 | return -ENOIOCTLCMD; | ||
288 | } | ||
289 | } | ||
290 | EXPORT_SYMBOL(sbusfb_compat_ioctl); | ||
291 | #endif | ||
diff --git a/drivers/video/sbuslib.h b/drivers/video/sbuslib.h index a6aa33ba09d6..b470e52ce9e2 100644 --- a/drivers/video/sbuslib.h +++ b/drivers/video/sbuslib.h | |||
@@ -20,5 +20,7 @@ extern int sbusfb_mmap_helper(struct sbus_mmap_map *map, | |||
20 | int sbusfb_ioctl_helper(unsigned long cmd, unsigned long arg, | 20 | int sbusfb_ioctl_helper(unsigned long cmd, unsigned long arg, |
21 | struct fb_info *info, | 21 | struct fb_info *info, |
22 | int type, int fb_depth, unsigned long fb_size); | 22 | int type, int fb_depth, unsigned long fb_size); |
23 | long sbusfb_compat_ioctl(struct file *file, unsigned int cmd, | ||
24 | unsigned long arg, struct fb_info *info); | ||
23 | 25 | ||
24 | #endif /* _SBUSLIB_H */ | 26 | #endif /* _SBUSLIB_H */ |
diff --git a/drivers/video/tcx.c b/drivers/video/tcx.c index 59fff29bc02e..fe4f63f3849d 100644 --- a/drivers/video/tcx.c +++ b/drivers/video/tcx.c | |||
@@ -52,6 +52,9 @@ static struct fb_ops tcx_ops = { | |||
52 | .fb_imageblit = cfb_imageblit, | 52 | .fb_imageblit = cfb_imageblit, |
53 | .fb_mmap = tcx_mmap, | 53 | .fb_mmap = tcx_mmap, |
54 | .fb_ioctl = tcx_ioctl, | 54 | .fb_ioctl = tcx_ioctl, |
55 | #ifdef CONFIG_COMPAT | ||
56 | .fb_compat_ioctl = sbusfb_compat_ioctl, | ||
57 | #endif | ||
55 | }; | 58 | }; |
56 | 59 | ||
57 | /* THC definitions */ | 60 | /* THC definitions */ |