32 #include <linux/export.h>
37 #define DRM_IOCTL_VERSION32 DRM_IOWR(0x00, drm_version32_t)
38 #define DRM_IOCTL_GET_UNIQUE32 DRM_IOWR(0x01, drm_unique32_t)
39 #define DRM_IOCTL_GET_MAP32 DRM_IOWR(0x04, drm_map32_t)
40 #define DRM_IOCTL_GET_CLIENT32 DRM_IOWR(0x05, drm_client32_t)
41 #define DRM_IOCTL_GET_STATS32 DRM_IOR( 0x06, drm_stats32_t)
43 #define DRM_IOCTL_SET_UNIQUE32 DRM_IOW( 0x10, drm_unique32_t)
44 #define DRM_IOCTL_ADD_MAP32 DRM_IOWR(0x15, drm_map32_t)
45 #define DRM_IOCTL_ADD_BUFS32 DRM_IOWR(0x16, drm_buf_desc32_t)
46 #define DRM_IOCTL_MARK_BUFS32 DRM_IOW( 0x17, drm_buf_desc32_t)
47 #define DRM_IOCTL_INFO_BUFS32 DRM_IOWR(0x18, drm_buf_info32_t)
48 #define DRM_IOCTL_MAP_BUFS32 DRM_IOWR(0x19, drm_buf_map32_t)
49 #define DRM_IOCTL_FREE_BUFS32 DRM_IOW( 0x1a, drm_buf_free32_t)
51 #define DRM_IOCTL_RM_MAP32 DRM_IOW( 0x1b, drm_map32_t)
53 #define DRM_IOCTL_SET_SAREA_CTX32 DRM_IOW( 0x1c, drm_ctx_priv_map32_t)
54 #define DRM_IOCTL_GET_SAREA_CTX32 DRM_IOWR(0x1d, drm_ctx_priv_map32_t)
56 #define DRM_IOCTL_RES_CTX32 DRM_IOWR(0x26, drm_ctx_res32_t)
57 #define DRM_IOCTL_DMA32 DRM_IOWR(0x29, drm_dma32_t)
59 #define DRM_IOCTL_AGP_ENABLE32 DRM_IOW( 0x32, drm_agp_mode32_t)
60 #define DRM_IOCTL_AGP_INFO32 DRM_IOR( 0x33, drm_agp_info32_t)
61 #define DRM_IOCTL_AGP_ALLOC32 DRM_IOWR(0x34, drm_agp_buffer32_t)
62 #define DRM_IOCTL_AGP_FREE32 DRM_IOW( 0x35, drm_agp_buffer32_t)
63 #define DRM_IOCTL_AGP_BIND32 DRM_IOW( 0x36, drm_agp_binding32_t)
64 #define DRM_IOCTL_AGP_UNBIND32 DRM_IOW( 0x37, drm_agp_binding32_t)
66 #define DRM_IOCTL_SG_ALLOC32 DRM_IOW( 0x38, drm_scatter_gather32_t)
67 #define DRM_IOCTL_SG_FREE32 DRM_IOW( 0x39, drm_scatter_gather32_t)
69 #define DRM_IOCTL_UPDATE_DRAW32 DRM_IOW( 0x3f, drm_update_draw32_t)
71 #define DRM_IOCTL_WAIT_VBLANK32 DRM_IOWR(0x3a, drm_wait_vblank32_t)
85 static int compat_drm_version(
struct file *
file,
unsigned int cmd,
122 if (
copy_to_user((
void __user *)arg, &v32,
sizeof(v32)))
132 static int compat_drm_getunique(
struct file *
file,
unsigned int cmd,
156 if (
copy_to_user((
void __user *)arg, &uq32,
sizeof(uq32)))
161 static int compat_drm_setunique(
struct file *
file,
unsigned int cmd,
190 static int compat_drm_getmap(
struct file *file,
unsigned int cmd,
227 static int compat_drm_addmap(
struct file *file,
unsigned int cmd,
260 " %p for type %d offset %x\n",
269 static int compat_drm_rmmap(
struct file *file,
unsigned int cmd,
276 if (
get_user(handle, &argp->handle))
297 static int compat_drm_getclient(
struct file *file,
unsigned int cmd,
339 static int compat_drm_getstats(
struct file *file,
unsigned int cmd,
357 for (i = 0; i < 15; ++
i)
376 static int compat_drm_addbufs(
struct file *file,
unsigned int cmd,
406 static int compat_drm_markbufs(
struct file *file,
unsigned int cmd,
433 static int compat_drm_infobufs(
struct file *file,
unsigned int cmd,
456 nbytes =
sizeof(*request) + count *
sizeof(
struct drm_buf_desc);
473 for (i = 0; i < actual; ++
i)
497 static int compat_drm_mapbufs(
struct file *file,
unsigned int cmd,
513 list32 = (
void __user *)(
unsigned long)req32.
list;
517 nbytes =
sizeof(*request) + count *
sizeof(
struct drm_buf_pub);
534 for (i = 0; i < actual; ++
i)
544 ||
__put_user((
unsigned long)addr, &argp->virtual))
555 static int compat_drm_freebufs(
struct file *file,
unsigned int cmd,
581 static int compat_drm_setsareactx(
struct file *file,
unsigned int cmd,
602 static int compat_drm_getsareactx(
struct file *file,
unsigned int cmd,
626 ||
__put_user((
unsigned long)handle, &argp->handle))
637 static int compat_drm_resctx(
struct file *file,
unsigned int cmd,
680 static int compat_drm_dma(
struct file *file,
unsigned int cmd,
723 typedef struct drm_agp_mode32 {
727 static int compat_drm_agp_enable(
struct file *file,
unsigned int cmd,
731 drm_agp_mode32_t m32;
734 if (
get_user(m32.mode, &argp->mode))
744 typedef struct drm_agp_info32 {
745 int agp_version_major;
746 int agp_version_minor;
754 unsigned short id_vendor;
755 unsigned short id_device;
758 static int compat_drm_agp_info(
struct file *file,
unsigned int cmd,
762 drm_agp_info32_t i32;
791 typedef struct drm_agp_buffer32 {
796 } drm_agp_buffer32_t;
798 static int compat_drm_agp_alloc(
struct file *file,
unsigned int cmd,
802 drm_agp_buffer32_t req32;
829 static int compat_drm_agp_free(
struct file *file,
unsigned int cmd,
845 typedef struct drm_agp_binding32 {
848 } drm_agp_binding32_t;
850 static int compat_drm_agp_bind(
struct file *file,
unsigned int cmd,
854 drm_agp_binding32_t req32;
869 static int compat_drm_agp_unbind(
struct file *file,
unsigned int cmd,
891 static int compat_drm_sg_alloc(
struct file *file,
unsigned int cmd,
918 static int compat_drm_sg_free(
struct file *file,
unsigned int cmd,
935 #if defined(CONFIG_X86) || defined(CONFIG_IA64)
936 typedef struct drm_update_draw32 {
944 static
int compat_drm_update_draw(
struct file *file,
unsigned int cmd,
947 drm_update_draw32_t update32;
951 if (
copy_from_user(&update32, (
void __user *)arg,
sizeof(update32)))
985 static int compat_drm_wait_vblank(
struct file *file,
unsigned int cmd,
1047 #if defined(CONFIG_X86) || defined(CONFIG_IA64)
1064 unsigned int nr = DRM_IOCTL_NR(cmd);
1065 drm_ioctl_compat_t *
fn;
1075 fn = drm_compat_ioctls[
nr];
1078 ret = (*fn) (filp,
cmd,
arg);