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