aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc64
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2005-11-07 17:13:27 -0500
committerDavid S. Miller <davem@davemloft.net>2005-11-07 17:13:27 -0500
commitf48497e38331464c25e564d9e76ee915ca55fea8 (patch)
tree0ef3b21b1954f4f12ad41cc5adf1081b952b7dca /arch/sparc64
parentb66621fef30e15810d459212bc8bdc274e08f14f (diff)
[SPARC64]: remove drm compat ioctl handling
drivers/drm/ now implements proper ->compat_ioctl methods, so this isn't needed anymore. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc64')
-rw-r--r--arch/sparc64/kernel/ioctl32.c384
1 files changed, 0 insertions, 384 deletions
diff --git a/arch/sparc64/kernel/ioctl32.c b/arch/sparc64/kernel/ioctl32.c
index 398ddbffc6a4..5eab41c1b1c7 100644
--- a/arch/sparc64/kernel/ioctl32.c
+++ b/arch/sparc64/kernel/ioctl32.c
@@ -97,357 +97,6 @@ static int fbiogscursor(unsigned int fd, unsigned int cmd, unsigned long arg)
97 return sys_ioctl (fd, FBIOSCURSOR, (unsigned long)p); 97 return sys_ioctl (fd, FBIOSCURSOR, (unsigned long)p);
98} 98}
99 99
100#if defined(CONFIG_DRM) || defined(CONFIG_DRM_MODULE)
101/* This really belongs in include/linux/drm.h -DaveM */
102#include "../../../drivers/char/drm/drm.h"
103
104typedef struct drm32_version {
105 int version_major; /* Major version */
106 int version_minor; /* Minor version */
107 int version_patchlevel;/* Patch level */
108 int name_len; /* Length of name buffer */
109 u32 name; /* Name of driver */
110 int date_len; /* Length of date buffer */
111 u32 date; /* User-space buffer to hold date */
112 int desc_len; /* Length of desc buffer */
113 u32 desc; /* User-space buffer to hold desc */
114} drm32_version_t;
115#define DRM32_IOCTL_VERSION DRM_IOWR(0x00, drm32_version_t)
116
117static int drm32_version(unsigned int fd, unsigned int cmd, unsigned long arg)
118{
119 drm32_version_t __user *uversion = (drm32_version_t __user *)arg;
120 drm_version_t __user *p = compat_alloc_user_space(sizeof(*p));
121 compat_uptr_t addr;
122 int n;
123 int ret;
124
125 if (clear_user(p, 3 * sizeof(int)) ||
126 get_user(n, &uversion->name_len) ||
127 put_user(n, &p->name_len) ||
128 get_user(addr, &uversion->name) ||
129 put_user(compat_ptr(addr), &p->name) ||
130 get_user(n, &uversion->date_len) ||
131 put_user(n, &p->date_len) ||
132 get_user(addr, &uversion->date) ||
133 put_user(compat_ptr(addr), &p->date) ||
134 get_user(n, &uversion->desc_len) ||
135 put_user(n, &p->desc_len) ||
136 get_user(addr, &uversion->desc) ||
137 put_user(compat_ptr(addr), &p->desc))
138 return -EFAULT;
139
140 ret = sys_ioctl(fd, DRM_IOCTL_VERSION, (unsigned long)p);
141 if (ret)
142 return ret;
143
144 if (copy_in_user(uversion, p, 3 * sizeof(int)) ||
145 get_user(n, &p->name_len) ||
146 put_user(n, &uversion->name_len) ||
147 get_user(n, &p->date_len) ||
148 put_user(n, &uversion->date_len) ||
149 get_user(n, &p->desc_len) ||
150 put_user(n, &uversion->desc_len))
151 return -EFAULT;
152
153 return 0;
154}
155
156typedef struct drm32_unique {
157 int unique_len; /* Length of unique */
158 u32 unique; /* Unique name for driver instantiation */
159} drm32_unique_t;
160#define DRM32_IOCTL_GET_UNIQUE DRM_IOWR(0x01, drm32_unique_t)
161#define DRM32_IOCTL_SET_UNIQUE DRM_IOW( 0x10, drm32_unique_t)
162
163static int drm32_getsetunique(unsigned int fd, unsigned int cmd, unsigned long arg)
164{
165 drm32_unique_t __user *uarg = (drm32_unique_t __user *)arg;
166 drm_unique_t __user *p = compat_alloc_user_space(sizeof(*p));
167 compat_uptr_t addr;
168 int n;
169 int ret;
170
171 if (get_user(n, &uarg->unique_len) ||
172 put_user(n, &p->unique_len) ||
173 get_user(addr, &uarg->unique) ||
174 put_user(compat_ptr(addr), &p->unique))
175 return -EFAULT;
176
177 if (cmd == DRM32_IOCTL_GET_UNIQUE)
178 ret = sys_ioctl (fd, DRM_IOCTL_GET_UNIQUE, (unsigned long)p);
179 else
180 ret = sys_ioctl (fd, DRM_IOCTL_SET_UNIQUE, (unsigned long)p);
181
182 if (ret)
183 return ret;
184
185 if (get_user(n, &p->unique_len) || put_user(n, &uarg->unique_len))
186 return -EFAULT;
187
188 return 0;
189}
190
191typedef struct drm32_map {
192 u32 offset; /* Requested physical address (0 for SAREA)*/
193 u32 size; /* Requested physical size (bytes) */
194 drm_map_type_t type; /* Type of memory to map */
195 drm_map_flags_t flags; /* Flags */
196 u32 handle; /* User-space: "Handle" to pass to mmap */
197 /* Kernel-space: kernel-virtual address */
198 int mtrr; /* MTRR slot used */
199 /* Private data */
200} drm32_map_t;
201#define DRM32_IOCTL_ADD_MAP DRM_IOWR(0x15, drm32_map_t)
202
203static int drm32_addmap(unsigned int fd, unsigned int cmd, unsigned long arg)
204{
205 drm32_map_t __user *uarg = (drm32_map_t __user *) arg;
206 drm_map_t karg;
207 mm_segment_t old_fs;
208 u32 tmp;
209 int ret;
210
211 ret = get_user(karg.offset, &uarg->offset);
212 ret |= get_user(karg.size, &uarg->size);
213 ret |= get_user(karg.type, &uarg->type);
214 ret |= get_user(karg.flags, &uarg->flags);
215 ret |= get_user(tmp, &uarg->handle);
216 ret |= get_user(karg.mtrr, &uarg->mtrr);
217 if (ret)
218 return -EFAULT;
219
220 karg.handle = (void *) (unsigned long) tmp;
221
222 old_fs = get_fs();
223 set_fs(KERNEL_DS);
224 ret = sys_ioctl(fd, DRM_IOCTL_ADD_MAP, (unsigned long) &karg);
225 set_fs(old_fs);
226
227 if (!ret) {
228 ret = put_user(karg.offset, &uarg->offset);
229 ret |= put_user(karg.size, &uarg->size);
230 ret |= put_user(karg.type, &uarg->type);
231 ret |= put_user(karg.flags, &uarg->flags);
232 tmp = (u32) (long)karg.handle;
233 ret |= put_user(tmp, &uarg->handle);
234 ret |= put_user(karg.mtrr, &uarg->mtrr);
235 if (ret)
236 ret = -EFAULT;
237 }
238
239 return ret;
240}
241
242typedef struct drm32_buf_info {
243 int count; /* Entries in list */
244 u32 list; /* (drm_buf_desc_t *) */
245} drm32_buf_info_t;
246#define DRM32_IOCTL_INFO_BUFS DRM_IOWR(0x18, drm32_buf_info_t)
247
248static int drm32_info_bufs(unsigned int fd, unsigned int cmd, unsigned long arg)
249{
250 drm32_buf_info_t __user *uarg = (drm32_buf_info_t __user *)arg;
251 drm_buf_info_t __user *p = compat_alloc_user_space(sizeof(*p));
252 compat_uptr_t addr;
253 int n;
254 int ret;
255
256 if (get_user(n, &uarg->count) || put_user(n, &p->count) ||
257 get_user(addr, &uarg->list) || put_user(compat_ptr(addr), &p->list))
258 return -EFAULT;
259
260 ret = sys_ioctl(fd, DRM_IOCTL_INFO_BUFS, (unsigned long)p);
261 if (ret)
262 return ret;
263
264 if (get_user(n, &p->count) || put_user(n, &uarg->count))
265 return -EFAULT;
266
267 return 0;
268}
269
270typedef struct drm32_buf_free {
271 int count;
272 u32 list; /* (int *) */
273} drm32_buf_free_t;
274#define DRM32_IOCTL_FREE_BUFS DRM_IOW( 0x1a, drm32_buf_free_t)
275
276static int drm32_free_bufs(unsigned int fd, unsigned int cmd, unsigned long arg)
277{
278 drm32_buf_free_t __user *uarg = (drm32_buf_free_t __user *)arg;
279 drm_buf_free_t __user *p = compat_alloc_user_space(sizeof(*p));
280 compat_uptr_t addr;
281 int n;
282
283 if (get_user(n, &uarg->count) || put_user(n, &p->count) ||
284 get_user(addr, &uarg->list) || put_user(compat_ptr(addr), &p->list))
285 return -EFAULT;
286
287 return sys_ioctl(fd, DRM_IOCTL_FREE_BUFS, (unsigned long)p);
288}
289
290typedef struct drm32_buf_pub {
291 int idx; /* Index into master buflist */
292 int total; /* Buffer size */
293 int used; /* Amount of buffer in use (for DMA) */
294 u32 address; /* Address of buffer (void *) */
295} drm32_buf_pub_t;
296
297typedef struct drm32_buf_map {
298 int count; /* Length of buflist */
299 u32 virtual; /* Mmaped area in user-virtual (void *) */
300 u32 list; /* Buffer information (drm_buf_pub_t *) */
301} drm32_buf_map_t;
302#define DRM32_IOCTL_MAP_BUFS DRM_IOWR(0x19, drm32_buf_map_t)
303
304static int drm32_map_bufs(unsigned int fd, unsigned int cmd, unsigned long arg)
305{
306 drm32_buf_map_t __user *uarg = (drm32_buf_map_t __user *)arg;
307 drm32_buf_pub_t __user *ulist;
308 drm_buf_map_t __user *arg64;
309 drm_buf_pub_t __user *list;
310 int orig_count, ret, i;
311 int n;
312 compat_uptr_t addr;
313
314 if (get_user(orig_count, &uarg->count))
315 return -EFAULT;
316
317 arg64 = compat_alloc_user_space(sizeof(drm_buf_map_t) +
318 (size_t)orig_count * sizeof(drm_buf_pub_t));
319 list = (void __user *)(arg64 + 1);
320
321 if (put_user(orig_count, &arg64->count) ||
322 put_user(list, &arg64->list) ||
323 get_user(addr, &uarg->virtual) ||
324 put_user(compat_ptr(addr), &arg64->virtual) ||
325 get_user(addr, &uarg->list))
326 return -EFAULT;
327
328 ulist = compat_ptr(addr);
329
330 for (i = 0; i < orig_count; i++) {
331 if (get_user(n, &ulist[i].idx) ||
332 put_user(n, &list[i].idx) ||
333 get_user(n, &ulist[i].total) ||
334 put_user(n, &list[i].total) ||
335 get_user(n, &ulist[i].used) ||
336 put_user(n, &list[i].used) ||
337 get_user(addr, &ulist[i].address) ||
338 put_user(compat_ptr(addr), &list[i].address))
339 return -EFAULT;
340 }
341
342 ret = sys_ioctl(fd, DRM_IOCTL_MAP_BUFS, (unsigned long) arg64);
343 if (ret)
344 return ret;
345
346 for (i = 0; i < orig_count; i++) {
347 void __user *p;
348 if (get_user(n, &list[i].idx) ||
349 put_user(n, &ulist[i].idx) ||
350 get_user(n, &list[i].total) ||
351 put_user(n, &ulist[i].total) ||
352 get_user(n, &list[i].used) ||
353 put_user(n, &ulist[i].used) ||
354 get_user(p, &list[i].address) ||
355 put_user((unsigned long)p, &ulist[i].address))
356 return -EFAULT;
357 }
358
359 if (get_user(n, &arg64->count) || put_user(n, &uarg->count))
360 return -EFAULT;
361
362 return 0;
363}
364
365typedef struct drm32_dma {
366 /* Indices here refer to the offset into
367 buflist in drm_buf_get_t. */
368 int context; /* Context handle */
369 int send_count; /* Number of buffers to send */
370 u32 send_indices; /* List of handles to buffers (int *) */
371 u32 send_sizes; /* Lengths of data to send (int *) */
372 drm_dma_flags_t flags; /* Flags */
373 int request_count; /* Number of buffers requested */
374 int request_size; /* Desired size for buffers */
375 u32 request_indices; /* Buffer information (int *) */
376 u32 request_sizes; /* (int *) */
377 int granted_count; /* Number of buffers granted */
378} drm32_dma_t;
379#define DRM32_IOCTL_DMA DRM_IOWR(0x29, drm32_dma_t)
380
381/* RED PEN The DRM layer blindly dereferences the send/request
382 * index/size arrays even though they are userland
383 * pointers. -DaveM
384 */
385static int drm32_dma(unsigned int fd, unsigned int cmd, unsigned long arg)
386{
387 drm32_dma_t __user *uarg = (drm32_dma_t __user *) arg;
388 drm_dma_t __user *p = compat_alloc_user_space(sizeof(*p));
389 compat_uptr_t addr;
390 int ret;
391
392 if (copy_in_user(p, uarg, 2 * sizeof(int)) ||
393 get_user(addr, &uarg->send_indices) ||
394 put_user(compat_ptr(addr), &p->send_indices) ||
395 get_user(addr, &uarg->send_sizes) ||
396 put_user(compat_ptr(addr), &p->send_sizes) ||
397 copy_in_user(&p->flags, &uarg->flags, sizeof(drm_dma_flags_t)) ||
398 copy_in_user(&p->request_count, &uarg->request_count, sizeof(int))||
399 copy_in_user(&p->request_size, &uarg->request_size, sizeof(int)) ||
400 get_user(addr, &uarg->request_indices) ||
401 put_user(compat_ptr(addr), &p->request_indices) ||
402 get_user(addr, &uarg->request_sizes) ||
403 put_user(compat_ptr(addr), &p->request_sizes) ||
404 copy_in_user(&p->granted_count, &uarg->granted_count, sizeof(int)))
405 return -EFAULT;
406
407 ret = sys_ioctl(fd, DRM_IOCTL_DMA, (unsigned long)p);
408 if (ret)
409 return ret;
410
411 if (copy_in_user(uarg, p, 2 * sizeof(int)) ||
412 copy_in_user(&uarg->flags, &p->flags, sizeof(drm_dma_flags_t)) ||
413 copy_in_user(&uarg->request_count, &p->request_count, sizeof(int))||
414 copy_in_user(&uarg->request_size, &p->request_size, sizeof(int)) ||
415 copy_in_user(&uarg->granted_count, &p->granted_count, sizeof(int)))
416 return -EFAULT;
417
418 return 0;
419}
420
421typedef struct drm32_ctx_res {
422 int count;
423 u32 contexts; /* (drm_ctx_t *) */
424} drm32_ctx_res_t;
425#define DRM32_IOCTL_RES_CTX DRM_IOWR(0x26, drm32_ctx_res_t)
426
427static int drm32_res_ctx(unsigned int fd, unsigned int cmd, unsigned long arg)
428{
429 drm32_ctx_res_t __user *uarg = (drm32_ctx_res_t __user *) arg;
430 drm_ctx_res_t __user *p = compat_alloc_user_space(sizeof(*p));
431 compat_uptr_t addr;
432 int ret;
433
434 if (copy_in_user(p, uarg, sizeof(int)) ||
435 get_user(addr, &uarg->contexts) ||
436 put_user(compat_ptr(addr), &p->contexts))
437 return -EFAULT;
438
439 ret = sys_ioctl(fd, DRM_IOCTL_RES_CTX, (unsigned long)p);
440 if (ret)
441 return ret;
442
443 if (copy_in_user(uarg, p, sizeof(int)))
444 return -EFAULT;
445
446 return 0;
447}
448
449#endif
450
451typedef int (* ioctl32_handler_t)(unsigned int, unsigned int, unsigned long, struct file *); 100typedef int (* ioctl32_handler_t)(unsigned int, unsigned int, unsigned long, struct file *);
452 101
453#define COMPATIBLE_IOCTL(cmd) HANDLE_IOCTL((cmd),sys_ioctl) 102#define COMPATIBLE_IOCTL(cmd) HANDLE_IOCTL((cmd),sys_ioctl)
@@ -474,44 +123,11 @@ COMPATIBLE_IOCTL(FBIOGCURMAX)
474/* Little v, the video4linux ioctls */ 123/* Little v, the video4linux ioctls */
475COMPATIBLE_IOCTL(_IOR('p', 20, int[7])) /* RTCGET */ 124COMPATIBLE_IOCTL(_IOR('p', 20, int[7])) /* RTCGET */
476COMPATIBLE_IOCTL(_IOW('p', 21, int[7])) /* RTCSET */ 125COMPATIBLE_IOCTL(_IOW('p', 21, int[7])) /* RTCSET */
477/* Big A */
478#if defined(CONFIG_DRM) || defined(CONFIG_DRM_MODULE)
479COMPATIBLE_IOCTL(DRM_IOCTL_GET_MAGIC)
480COMPATIBLE_IOCTL(DRM_IOCTL_IRQ_BUSID)
481COMPATIBLE_IOCTL(DRM_IOCTL_AUTH_MAGIC)
482COMPATIBLE_IOCTL(DRM_IOCTL_BLOCK)
483COMPATIBLE_IOCTL(DRM_IOCTL_UNBLOCK)
484COMPATIBLE_IOCTL(DRM_IOCTL_CONTROL)
485COMPATIBLE_IOCTL(DRM_IOCTL_ADD_BUFS)
486COMPATIBLE_IOCTL(DRM_IOCTL_MARK_BUFS)
487COMPATIBLE_IOCTL(DRM_IOCTL_ADD_CTX)
488COMPATIBLE_IOCTL(DRM_IOCTL_RM_CTX)
489COMPATIBLE_IOCTL(DRM_IOCTL_MOD_CTX)
490COMPATIBLE_IOCTL(DRM_IOCTL_GET_CTX)
491COMPATIBLE_IOCTL(DRM_IOCTL_SWITCH_CTX)
492COMPATIBLE_IOCTL(DRM_IOCTL_NEW_CTX)
493COMPATIBLE_IOCTL(DRM_IOCTL_ADD_DRAW)
494COMPATIBLE_IOCTL(DRM_IOCTL_RM_DRAW)
495COMPATIBLE_IOCTL(DRM_IOCTL_LOCK)
496COMPATIBLE_IOCTL(DRM_IOCTL_UNLOCK)
497COMPATIBLE_IOCTL(DRM_IOCTL_FINISH)
498#endif /* DRM */
499/* And these ioctls need translation */ 126/* And these ioctls need translation */
500/* Note SIOCRTMSG is no longer, so this is safe and * the user would have seen just an -EINVAL anyways. */ 127/* Note SIOCRTMSG is no longer, so this is safe and * the user would have seen just an -EINVAL anyways. */
501HANDLE_IOCTL(FBIOPUTCMAP32, fbiogetputcmap) 128HANDLE_IOCTL(FBIOPUTCMAP32, fbiogetputcmap)
502HANDLE_IOCTL(FBIOGETCMAP32, fbiogetputcmap) 129HANDLE_IOCTL(FBIOGETCMAP32, fbiogetputcmap)
503HANDLE_IOCTL(FBIOSCURSOR32, fbiogscursor) 130HANDLE_IOCTL(FBIOSCURSOR32, fbiogscursor)
504#if defined(CONFIG_DRM) || defined(CONFIG_DRM_MODULE)
505HANDLE_IOCTL(DRM32_IOCTL_VERSION, drm32_version)
506HANDLE_IOCTL(DRM32_IOCTL_GET_UNIQUE, drm32_getsetunique)
507HANDLE_IOCTL(DRM32_IOCTL_SET_UNIQUE, drm32_getsetunique)
508HANDLE_IOCTL(DRM32_IOCTL_ADD_MAP, drm32_addmap)
509HANDLE_IOCTL(DRM32_IOCTL_INFO_BUFS, drm32_info_bufs)
510HANDLE_IOCTL(DRM32_IOCTL_FREE_BUFS, drm32_free_bufs)
511HANDLE_IOCTL(DRM32_IOCTL_MAP_BUFS, drm32_map_bufs)
512HANDLE_IOCTL(DRM32_IOCTL_DMA, drm32_dma)
513HANDLE_IOCTL(DRM32_IOCTL_RES_CTX, drm32_res_ctx)
514#endif /* DRM */
515#if 0 131#if 0
516HANDLE_IOCTL(RTC32_IRQP_READ, do_rtc_ioctl) 132HANDLE_IOCTL(RTC32_IRQP_READ, do_rtc_ioctl)
517HANDLE_IOCTL(RTC32_IRQP_SET, do_rtc_ioctl) 133HANDLE_IOCTL(RTC32_IRQP_SET, do_rtc_ioctl)