1 /* _NVRM_COPYRIGHT_BEGIN_
3 * Copyright 2001-2002 by NVIDIA Corporation. All rights reserved. All
4 * information contained herein is proprietary and confidential to NVIDIA
5 * Corporation. Any use, reproduction, or disclosure without the written
6 * permission of NVIDIA Corporation is prohibited.
12 #include "os-interface.h"
14 #include "nv-freebsd.h"
16 #ifdef NV_SUPPORT_LINUX_COMPAT /* (COMPAT_LINUX || COMPAT_LINUX32) */
18 #define LINUX_IOCTL_NVIDIA_MIN 0x4600
19 #define LINUX_IOCTL_NVIDIA_MAX 0x46ff
21 #if defined(NVCPU_X86)
22 #include "machine/../linux/linux.h"
25 #if defined(NVCPU_X86_64)
26 #include "machine/../linux32/linux.h"
29 int linux_ioctl_nvidia(d_thread_t *, struct linux_ioctl_args *);
31 int linux_ioctl_nvidia(
33 struct linux_ioctl_args *args
37 * The range has already been checked, and the native NVIDIA ioctl()
38 * implementation will throw out any commands it does not recognize.
39 * There is no good reason why we should manually translate each and
40 * every one of the possible NVIDIA ioctl commands.
42 * Since the Linux driver uses the _IO macros to encode the required
43 * data, the native ioctl layer can determine the parameter size and
44 * copy the user data in/out correctly.
47 return (ioctl(td, (struct ioctl_args *) args));
50 struct linux_ioctl_handler nvidia_handler = {
52 LINUX_IOCTL_NVIDIA_MIN,
53 LINUX_IOCTL_NVIDIA_MAX
55 #endif /* NV_SUPPORT_LINUX_COMPAT */
58 void nvidia_linux_init(void)
60 #ifdef NV_SUPPORT_LINUX_COMPAT /* (COMPAT_LINUX || COMPAT_LINUX32) */
61 linux_ioctl_register_handler(&nvidia_handler);
65 void nvidia_linux_exit(void)
67 #ifdef NV_SUPPORT_LINUX_COMPAT /* (COMPAT_LINUX || COMPAT_LINUX32) */
68 linux_ioctl_unregister_handler(&nvidia_handler);