Back to home page

OSCL-LXR

 
 

    


0001 /**
0002  * \file mga_ioc32.c
0003  *
0004  * 32-bit ioctl compatibility routines for the MGA DRM.
0005  *
0006  * \author Dave Airlie <airlied@linux.ie> with code from patches by Egbert Eich
0007  *
0008  *
0009  * Copyright (C) Paul Mackerras 2005
0010  * Copyright (C) Egbert Eich 2003,2004
0011  * Copyright (C) Dave Airlie 2005
0012  * All Rights Reserved.
0013  *
0014  * Permission is hereby granted, free of charge, to any person obtaining a
0015  * copy of this software and associated documentation files (the "Software"),
0016  * to deal in the Software without restriction, including without limitation
0017  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
0018  * and/or sell copies of the Software, and to permit persons to whom the
0019  * Software is furnished to do so, subject to the following conditions:
0020  *
0021  * The above copyright notice and this permission notice (including the next
0022  * paragraph) shall be included in all copies or substantial portions of the
0023  * Software.
0024  *
0025  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0026  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0027  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
0028  * THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
0029  * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
0030  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
0031  * IN THE SOFTWARE.
0032  */
0033 
0034 #include <linux/compat.h>
0035 
0036 #include <drm/drm.h>
0037 #include <drm/drm_ioctl.h>
0038 
0039 #include "nouveau_ioctl.h"
0040 
0041 /**
0042  * Called whenever a 32-bit process running under a 64-bit kernel
0043  * performs an ioctl on /dev/dri/card<n>.
0044  *
0045  * \param filp file pointer.
0046  * \param cmd command.
0047  * \param arg user argument.
0048  * \return zero on success or negative number on failure.
0049  */
0050 long nouveau_compat_ioctl(struct file *filp, unsigned int cmd,
0051              unsigned long arg)
0052 {
0053     unsigned int nr = DRM_IOCTL_NR(cmd);
0054     drm_ioctl_compat_t *fn = NULL;
0055     int ret;
0056 
0057     if (nr < DRM_COMMAND_BASE)
0058         return drm_compat_ioctl(filp, cmd, arg);
0059 
0060 #if 0
0061     if (nr < DRM_COMMAND_BASE + ARRAY_SIZE(mga_compat_ioctls))
0062         fn = nouveau_compat_ioctls[nr - DRM_COMMAND_BASE];
0063 #endif
0064     if (fn != NULL)
0065         ret = (*fn)(filp, cmd, arg);
0066     else
0067         ret = nouveau_drm_ioctl(filp, cmd, arg);
0068 
0069     return ret;
0070 }