162306a36Sopenharmony_ci/** 262306a36Sopenharmony_ci * \file mga_ioc32.c 362306a36Sopenharmony_ci * 462306a36Sopenharmony_ci * 32-bit ioctl compatibility routines for the MGA DRM. 562306a36Sopenharmony_ci * 662306a36Sopenharmony_ci * \author Dave Airlie <airlied@linux.ie> with code from patches by Egbert Eich 762306a36Sopenharmony_ci * 862306a36Sopenharmony_ci * 962306a36Sopenharmony_ci * Copyright (C) Paul Mackerras 2005 1062306a36Sopenharmony_ci * Copyright (C) Egbert Eich 2003,2004 1162306a36Sopenharmony_ci * Copyright (C) Dave Airlie 2005 1262306a36Sopenharmony_ci * All Rights Reserved. 1362306a36Sopenharmony_ci * 1462306a36Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a 1562306a36Sopenharmony_ci * copy of this software and associated documentation files (the "Software"), 1662306a36Sopenharmony_ci * to deal in the Software without restriction, including without limitation 1762306a36Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense, 1862306a36Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the 1962306a36Sopenharmony_ci * Software is furnished to do so, subject to the following conditions: 2062306a36Sopenharmony_ci * 2162306a36Sopenharmony_ci * The above copyright notice and this permission notice (including the next 2262306a36Sopenharmony_ci * paragraph) shall be included in all copies or substantial portions of the 2362306a36Sopenharmony_ci * Software. 2462306a36Sopenharmony_ci * 2562306a36Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 2662306a36Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 2762306a36Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 2862306a36Sopenharmony_ci * THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 2962306a36Sopenharmony_ci * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 3062306a36Sopenharmony_ci * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 3162306a36Sopenharmony_ci * IN THE SOFTWARE. 3262306a36Sopenharmony_ci */ 3362306a36Sopenharmony_ci 3462306a36Sopenharmony_ci#include <linux/compat.h> 3562306a36Sopenharmony_ci 3662306a36Sopenharmony_ci#include <drm/drm.h> 3762306a36Sopenharmony_ci#include <drm/drm_ioctl.h> 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_ci#include "nouveau_ioctl.h" 4062306a36Sopenharmony_ci 4162306a36Sopenharmony_ci/** 4262306a36Sopenharmony_ci * Called whenever a 32-bit process running under a 64-bit kernel 4362306a36Sopenharmony_ci * performs an ioctl on /dev/dri/card<n>. 4462306a36Sopenharmony_ci * 4562306a36Sopenharmony_ci * \param filp file pointer. 4662306a36Sopenharmony_ci * \param cmd command. 4762306a36Sopenharmony_ci * \param arg user argument. 4862306a36Sopenharmony_ci * \return zero on success or negative number on failure. 4962306a36Sopenharmony_ci */ 5062306a36Sopenharmony_cilong nouveau_compat_ioctl(struct file *filp, unsigned int cmd, 5162306a36Sopenharmony_ci unsigned long arg) 5262306a36Sopenharmony_ci{ 5362306a36Sopenharmony_ci unsigned int nr = DRM_IOCTL_NR(cmd); 5462306a36Sopenharmony_ci drm_ioctl_compat_t *fn = NULL; 5562306a36Sopenharmony_ci int ret; 5662306a36Sopenharmony_ci 5762306a36Sopenharmony_ci if (nr < DRM_COMMAND_BASE) 5862306a36Sopenharmony_ci return drm_compat_ioctl(filp, cmd, arg); 5962306a36Sopenharmony_ci 6062306a36Sopenharmony_ci#if 0 6162306a36Sopenharmony_ci if (nr < DRM_COMMAND_BASE + ARRAY_SIZE(mga_compat_ioctls)) 6262306a36Sopenharmony_ci fn = nouveau_compat_ioctls[nr - DRM_COMMAND_BASE]; 6362306a36Sopenharmony_ci#endif 6462306a36Sopenharmony_ci if (fn != NULL) 6562306a36Sopenharmony_ci ret = (*fn)(filp, cmd, arg); 6662306a36Sopenharmony_ci else 6762306a36Sopenharmony_ci ret = nouveau_drm_ioctl(filp, cmd, arg); 6862306a36Sopenharmony_ci 6962306a36Sopenharmony_ci return ret; 7062306a36Sopenharmony_ci} 71