2 * Copyright (C) Paul Mackerras 2005
3 * Copyright (C) Alan Hourihane 2005
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice (including the next
14 * paragraph) shall be included in all copies or substantial portions of the
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
26 * Paul Mackerras <paulus@samba.org>
27 * Alan Hourihane <alanh@fairlite.demon.co.uk>
30 #include <sys/cdefs.h>
31 __FBSDID("$FreeBSD$");
33 #ifdef COMPAT_FREEBSD32
35 /** @file i915_ioc32.c
36 * 32-bit ioctl compatibility routines for the i915 DRM.
39 #include <dev/drm2/drmP.h>
40 #include <dev/drm2/drm.h>
41 #include <dev/drm2/i915/i915_drm.h>
42 #include <dev/drm2/i915/i915_drv.h>
43 #include <dev/drm2/i915/intel_drv.h>
45 typedef struct _drm_i915_batchbuffer32 {
46 int start; /* agp offset */
47 int used; /* nr bytes in use */
48 int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */
49 int DR4; /* window origin for GFX_OP_DRAWRECT_INFO */
50 int num_cliprects; /* mulitpass with multiple cliprects? */
51 u32 cliprects; /* pointer to userspace cliprects */
52 } drm_i915_batchbuffer32_t;
54 static int compat_i915_batchbuffer(struct drm_device *dev, void *data, struct drm_file *file_priv)
56 drm_i915_batchbuffer32_t *batchbuffer32 = data;
57 drm_i915_batchbuffer_t batchbuffer;
59 batchbuffer.start = batchbuffer32->start;
60 batchbuffer.used = batchbuffer32->used;
61 batchbuffer.DR1 = batchbuffer32->DR1;
62 batchbuffer.DR4 = batchbuffer32->DR4;
63 batchbuffer.num_cliprects = batchbuffer32->num_cliprects;
64 batchbuffer.cliprects = (void *)(unsigned long)batchbuffer32->cliprects;
66 return i915_batchbuffer(dev, (void *)&batchbuffer, file_priv);
69 typedef struct _drm_i915_cmdbuffer32 {
70 u32 buf; /* pointer to userspace command buffer */
71 int sz; /* nr bytes in buf */
72 int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */
73 int DR4; /* window origin for GFX_OP_DRAWRECT_INFO */
74 int num_cliprects; /* mulitpass with multiple cliprects? */
75 u32 cliprects; /* pointer to userspace cliprects */
76 } drm_i915_cmdbuffer32_t;
78 static int compat_i915_cmdbuffer(struct drm_device *dev, void *data, struct drm_file *file_priv)
80 drm_i915_cmdbuffer32_t *cmdbuffer32 = data;
81 drm_i915_cmdbuffer_t cmdbuffer;
83 cmdbuffer.sz = cmdbuffer32->sz;
84 cmdbuffer.DR1 = cmdbuffer32->DR1;
85 cmdbuffer.DR4 = cmdbuffer32->DR4;
86 cmdbuffer.num_cliprects = cmdbuffer32->num_cliprects;
87 cmdbuffer.cliprects = (void *)(unsigned long)cmdbuffer32->cliprects;
89 return i915_cmdbuffer(dev, (void *)&cmdbuffer, file_priv);
92 typedef struct drm_i915_irq_emit32 {
94 } drm_i915_irq_emit32_t;
96 static int compat_i915_irq_emit(struct drm_device *dev, void *data, struct drm_file *file_priv)
98 drm_i915_irq_emit32_t *req32 = data;
99 drm_i915_irq_emit_t request;
101 request.irq_seq = (int *)(unsigned long)req32->irq_seq;
103 return i915_irq_emit(dev, (void *)&request, file_priv);
105 typedef struct drm_i915_getparam32 {
108 } drm_i915_getparam32_t;
110 static int compat_i915_getparam(struct drm_device *dev, void *data, struct drm_file *file_priv)
112 drm_i915_getparam32_t *req32 = data;
113 drm_i915_getparam_t request;
115 request.param = req32->param;
116 request.value = (void *)(unsigned long)req32->value;
118 return i915_getparam(dev, (void *)&request, file_priv);
121 typedef struct drm_i915_mem_alloc32 {
125 u32 region_offset; /* offset from start of fb or agp */
126 } drm_i915_mem_alloc32_t;
128 struct drm_ioctl_desc i915_compat_ioctls[] = {
129 DRM_IOCTL_DEF(DRM_I915_BATCHBUFFER, compat_i915_batchbuffer, DRM_AUTH),
130 DRM_IOCTL_DEF(DRM_I915_CMDBUFFER, compat_i915_cmdbuffer, DRM_AUTH),
131 DRM_IOCTL_DEF(DRM_I915_GETPARAM, compat_i915_getparam, DRM_AUTH),
132 DRM_IOCTL_DEF(DRM_I915_IRQ_EMIT, compat_i915_irq_emit, DRM_AUTH)
134 int i915_compat_ioctls_nr = ARRAY_SIZE(i915_compat_ioctls);