xref: /netbsd-src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ioc32.c (revision 627f7eb200a4419d89b531d55fccd2ee3ffdcde0)
1 /*	$NetBSD: amdgpu_ioc32.c,v 1.2 2018/08/27 04:58:19 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.2 2018/08/27 04:58:19 riastradh Exp $");
34 
35 #include <linux/compat.h>
36 
37 #include <drm/drmP.h>
38 #include <drm/amdgpu_drm.h>
39 #include "amdgpu_drv.h"
40 
41 long amdgpu_kms_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
42 {
43 	unsigned int nr = DRM_IOCTL_NR(cmd);
44 	int ret;
45 
46 	if (nr < DRM_COMMAND_BASE)
47 		return drm_compat_ioctl(filp, cmd, arg);
48 
49 	ret = amdgpu_drm_ioctl(filp, cmd, arg);
50 
51 	return ret;
52 }
53