summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@linux.ie>2007-06-07 18:40:41 +1000
committerDave Airlie <airlied@linux.ie>2007-06-07 18:41:18 +1000
commite22f428f5fa55400850951b32c6ed0e856bf836b (patch)
tree1dc3ae119021c2a8c9b9953838e49439778a69d7
parent39625f9621a56b4dde5d400615bba5217a75a24c (diff)
drm: fix radeon setparam alignment issues on 32/64-bit
-rw-r--r--linux-core/drm_compat.c2
-rw-r--r--linux-core/radeon_ioc32.c27
2 files changed, 29 insertions, 0 deletions
diff --git a/linux-core/drm_compat.c b/linux-core/drm_compat.c
index 9ac5658c..6c0cafc1 100644
--- a/linux-core/drm_compat.c
+++ b/linux-core/drm_compat.c
@@ -185,6 +185,7 @@ static int drm_pte_is_clear(struct vm_area_struct *vma,
return ret;
}
+#if 0
static int vm_insert_pfn(struct vm_area_struct *vma, unsigned long addr,
unsigned long pfn)
{
@@ -195,6 +196,7 @@ static int vm_insert_pfn(struct vm_area_struct *vma, unsigned long addr,
ret = io_remap_pfn_range(vma, addr, pfn, PAGE_SIZE, vma->vm_page_prot);
return ret;
}
+#endif
static struct page *drm_bo_vm_fault(struct vm_area_struct *vma,
struct fault_data *data)
diff --git a/linux-core/radeon_ioc32.c b/linux-core/radeon_ioc32.c
index 6fc5b1f3..1be50bd9 100644
--- a/linux-core/radeon_ioc32.c
+++ b/linux-core/radeon_ioc32.c
@@ -349,6 +349,32 @@ static int compat_radeon_irq_emit(struct file *file, unsigned int cmd,
DRM_IOCTL_RADEON_IRQ_EMIT, (unsigned long) request);
}
+typedef struct drm_radeon_setparam32 {
+ int param;
+ u64 value;
+} __attribute__((packed)) drm_radeon_setparam32_t;
+
+static int compat_radeon_cp_setparam(struct file *file, unsigned int cmd,
+ unsigned long arg)
+{
+ drm_radeon_setparam32_t req32;
+ drm_radeon_setparam_t __user *request;
+
+ if (copy_from_user(&req32, (void __user *) arg, sizeof(req32)))
+ return -EFAULT;
+
+ request = compat_alloc_user_space(sizeof(*request));
+ if (!access_ok(VERIFY_WRITE, request, sizeof(*request))
+ || __put_user(req32.param, &request->param)
+ || __put_user((void __user *)(unsigned long)req32.value,
+ &request->value))
+ return -EFAULT;
+
+ return drm_ioctl(file->f_dentry->d_inode, file,
+ DRM_IOCTL_RADEON_SETPARAM, (unsigned long) request);
+}
+
+
drm_ioctl_compat_t *radeon_compat_ioctls[] = {
[DRM_RADEON_CP_INIT] = compat_radeon_cp_init,
[DRM_RADEON_CLEAR] = compat_radeon_cp_clear,
@@ -357,6 +383,7 @@ drm_ioctl_compat_t *radeon_compat_ioctls[] = {
[DRM_RADEON_VERTEX2] = compat_radeon_cp_vertex2,
[DRM_RADEON_CMDBUF] = compat_radeon_cp_cmdbuf,
[DRM_RADEON_GETPARAM] = compat_radeon_cp_getparam,
+ [DRM_RADEON_SETPARAM] = compat_radeon_cp_setparam,
[DRM_RADEON_ALLOC] = compat_radeon_mem_alloc,
[DRM_RADEON_IRQ_EMIT] = compat_radeon_irq_emit,
};