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