Ben Skeggs | 6ee7386 | 2009-12-11 19:24:15 +1000 | [diff] [blame] | 1 | /** |
| 2 | * \file mga_ioc32.c |
| 3 | * |
| 4 | * 32-bit ioctl compatibility routines for the MGA DRM. |
| 5 | * |
| 6 | * \author Dave Airlie <airlied@linux.ie> with code from patches by Egbert Eich |
| 7 | * |
| 8 | * |
| 9 | * Copyright (C) Paul Mackerras 2005 |
| 10 | * Copyright (C) Egbert Eich 2003,2004 |
| 11 | * Copyright (C) Dave Airlie 2005 |
| 12 | * All Rights Reserved. |
| 13 | * |
| 14 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 15 | * copy of this software and associated documentation files (the "Software"), |
| 16 | * to deal in the Software without restriction, including without limitation |
| 17 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 18 | * and/or sell copies of the Software, and to permit persons to whom the |
| 19 | * Software is furnished to do so, subject to the following conditions: |
| 20 | * |
| 21 | * The above copyright notice and this permission notice (including the next |
| 22 | * paragraph) shall be included in all copies or substantial portions of the |
| 23 | * Software. |
| 24 | * |
| 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 26 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 27 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 28 | * THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
| 29 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 30 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS |
| 31 | * IN THE SOFTWARE. |
| 32 | */ |
| 33 | |
| 34 | #include <linux/compat.h> |
| 35 | |
David Howells | 760285e | 2012-10-02 18:01:07 +0100 | [diff] [blame] | 36 | #include <drm/drmP.h> |
Ben Skeggs | 6ee7386 | 2009-12-11 19:24:15 +1000 | [diff] [blame] | 37 | |
Ben Skeggs | fce875d | 2012-07-26 08:54:33 +1000 | [diff] [blame] | 38 | #include "nouveau_ioctl.h" |
Ben Skeggs | 6ee7386 | 2009-12-11 19:24:15 +1000 | [diff] [blame] | 39 | |
| 40 | /** |
| 41 | * Called whenever a 32-bit process running under a 64-bit kernel |
| 42 | * performs an ioctl on /dev/dri/card<n>. |
| 43 | * |
| 44 | * \param filp file pointer. |
| 45 | * \param cmd command. |
| 46 | * \param arg user argument. |
| 47 | * \return zero on success or negative number on failure. |
| 48 | */ |
| 49 | long nouveau_compat_ioctl(struct file *filp, unsigned int cmd, |
| 50 | unsigned long arg) |
| 51 | { |
| 52 | unsigned int nr = DRM_IOCTL_NR(cmd); |
| 53 | drm_ioctl_compat_t *fn = NULL; |
| 54 | int ret; |
| 55 | |
| 56 | if (nr < DRM_COMMAND_BASE) |
| 57 | return drm_compat_ioctl(filp, cmd, arg); |
| 58 | |
| 59 | #if 0 |
Damien Lespiau | f95aeb1 | 2014-06-09 14:39:49 +0100 | [diff] [blame] | 60 | if (nr < DRM_COMMAND_BASE + ARRAY_SIZE(mga_compat_ioctls)) |
Ben Skeggs | 6ee7386 | 2009-12-11 19:24:15 +1000 | [diff] [blame] | 61 | fn = nouveau_compat_ioctls[nr - DRM_COMMAND_BASE]; |
| 62 | #endif |
Ben Skeggs | 6ee7386 | 2009-12-11 19:24:15 +1000 | [diff] [blame] | 63 | if (fn != NULL) |
| 64 | ret = (*fn)(filp, cmd, arg); |
| 65 | else |
Dave Airlie | 2254f63 | 2013-09-02 09:52:55 +1000 | [diff] [blame] | 66 | ret = nouveau_drm_ioctl(filp, cmd, arg); |
Ben Skeggs | 6ee7386 | 2009-12-11 19:24:15 +1000 | [diff] [blame] | 67 | |
| 68 | return ret; |
| 69 | } |