xref: /netbsd-src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ioc32.c (revision 41ec02673d281bbb3d38e6c78504ce6e30c228c1)
1 /*	$NetBSD: amdgpu_ioc32.c,v 1.3 2021/12/18 23:44:58 riastradh Exp $	*/
2 
3 /**
4  * \file amdgpu_ioc32.c
5  *
6  * 32-bit ioctl compatibility routines for the AMDGPU DRM.
7  *
8  * \author Paul Mackerras <paulus@samba.org>
9  *
10  * Copyright (C) Paul Mackerras 2005
11  * All Rights Reserved.
12  *
13  * Permission is hereby granted, free of charge, to any person obtaining a
14  * copy of this software and associated documentation files (the "Software"),
15  * to deal in the Software without restriction, including without limitation
16  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
17  * and/or sell copies of the Software, and to permit persons to whom the
18  * Software is furnished to do so, subject to the following conditions:
19  *
20  * The above copyright notice and this permission notice (including the next
21  * paragraph) shall be included in all copies or substantial portions of the
22  * Software.
23  *
24  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
27  * THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
28  * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
30  * IN THE SOFTWARE.
31  */
32 #include <sys/cdefs.h>
33 __KERNEL_RCSID(0, "$NetBSD: amdgpu_ioc32.c,v 1.3 2021/12/18 23:44:58 riastradh Exp $");
34 
35 #include <linux/compat.h>
36 
37 #include <drm/amdgpu_drm.h>
38 #include <drm/drm_ioctl.h>
39 
40 #include "amdgpu_drv.h"
41 
amdgpu_kms_compat_ioctl(struct file * filp,unsigned int cmd,unsigned long arg)42 long amdgpu_kms_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
43 {
44 	unsigned int nr = DRM_IOCTL_NR(cmd);
45 	int ret;
46 
47 	if (nr < DRM_COMMAND_BASE)
48 		return drm_compat_ioctl(filp, cmd, arg);
49 
50 	ret = amdgpu_drm_ioctl(filp, cmd, arg);
51 
52 	return ret;
53 }
54