summaryrefslogtreecommitdiffstats
path: root/system/nvidia-legacy173-kernel/nvidia-legacy173_kernel-4.0.patch
diff options
context:
space:
mode:
Diffstat (limited to 'system/nvidia-legacy173-kernel/nvidia-legacy173_kernel-4.0.patch')
-rw-r--r--system/nvidia-legacy173-kernel/nvidia-legacy173_kernel-4.0.patch206
1 files changed, 206 insertions, 0 deletions
diff --git a/system/nvidia-legacy173-kernel/nvidia-legacy173_kernel-4.0.patch b/system/nvidia-legacy173-kernel/nvidia-legacy173_kernel-4.0.patch
new file mode 100644
index 0000000000..89ab9e592b
--- /dev/null
+++ b/system/nvidia-legacy173-kernel/nvidia-legacy173_kernel-4.0.patch
@@ -0,0 +1,206 @@
+diff -u -r NVIDIA-Linux-x86_64-173.14.38-pkg2/usr/src/nv/Makefile.kbuild NVIDIA-Linux-x86_64-173.14.38-pkg2-patched/usr/src/nv/Makefile.kbuild
+--- NVIDIA-Linux-x86_64-173.14.38-pkg2/usr/src/nv/Makefile.kbuild 2013-08-28 21:53:41.000000000 +0100
++++ NVIDIA-Linux-x86_64-173.14.38-pkg2-patched/usr/src/nv/Makefile.kbuild 2015-08-28 10:37:23.726119728 +0100
+@@ -163,7 +163,6 @@
+ ioremap_wc \
+ proc_dir_entry \
+ acpi_walk_namespace \
+- acpi_os_wait_events_complete \
+ agp_memory \
+ scatterlist \
+ file_operations \
+diff -u -r NVIDIA-Linux-x86_64-173.14.38-pkg2/usr/src/nv/conftest.sh NVIDIA-Linux-x86_64-173.14.38-pkg2-patched/usr/src/nv/conftest.sh
+--- NVIDIA-Linux-x86_64-173.14.38-pkg2/usr/src/nv/conftest.sh 2013-08-28 21:53:41.000000000 +0100
++++ NVIDIA-Linux-x86_64-173.14.38-pkg2-patched/usr/src/nv/conftest.sh 2015-08-28 10:37:29.870148375 +0100
+@@ -943,7 +943,7 @@
+ # and how many arguments it takes.
+ #
+ echo "$CONFTEST_PREAMBLE
+- #include <acpi/acpi.h>
++ #include <linux/acpi.h>
+ void conftest_acpi_walk_namespace(void) {
+ acpi_walk_namespace();
+ }" > conftest$$.c
+@@ -958,7 +958,7 @@
+ fi
+
+ echo "$CONFTEST_PREAMBLE
+- #include <acpi/acpi.h>
++ #include <linux/acpi.h>
+ void conftest_acpi_walk_namespace(void) {
+ acpi_walk_namespace(0, NULL, 0, NULL, NULL, NULL, NULL);
+ }" > conftest$$.c
+@@ -974,7 +974,7 @@
+ fi
+
+ echo "$CONFTEST_PREAMBLE
+- #include <acpi/acpi.h>
++ #include <linux/acpi.h>
+ void conftest_acpi_walk_namespace(void) {
+ acpi_walk_namespace(0, NULL, 0, NULL, NULL, NULL);
+ }" > conftest$$.c
+@@ -992,61 +992,6 @@
+ fi
+ ;;
+
+- acpi_os_wait_events_complete)
+- #
+- # Determine if the acpi_os_wait_events_complete() function
+- # is present and how many arguments it takes.
+- #
+- echo "$CONFTEST_PREAMBLE
+- #include <linux/acpi.h>
+- void conftest_acpi_os_wait_events_complete(void) {
+- acpi_os_wait_events_complete(NULL, NULL);
+- }" > conftest$$.c
+-
+- $CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
+- rm -f conftest$$.c
+-
+- if [ -f conftest$$.o ]; then
+- rm -f conftest$$.o
+- echo "#undef NV_ACPI_OS_WAIT_EVENTS_COMPLETE_PRESENT" >> conftest.h
+- return
+- fi
+-
+- echo "$CONFTEST_PREAMBLE
+- #include <linux/acpi.h>
+- void conftest_acpi_os_wait_events_complete(void) {
+- acpi_os_wait_events_complete(NULL);
+- }" > conftest$$.c
+-
+- $CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
+- rm -f conftest$$.c
+-
+- if [ -f conftest$$.o ]; then
+- rm -f conftest$$.o
+- echo "#define NV_ACPI_OS_WAIT_EVENTS_COMPLETE_PRESENT" >> conftest.h
+- echo "#define NV_ACPI_OS_WAIT_EVENTS_COMPLETE_ARGUMENT_COUNT 1" >> conftest.h
+- return
+- fi
+-
+- echo "$CONFTEST_PREAMBLE
+- #include <linux/acpi.h>
+- void conftest_acpi_os_wait_events_complete(void) {
+- acpi_os_wait_events_complete();
+- }" > conftest$$.c
+-
+- $CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
+- rm -f conftest$$.c
+-
+- if [ -f conftest$$.o ]; then
+- rm -f conftest$$.o
+- echo "#define NV_ACPI_OS_WAIT_EVENTS_COMPLETE_PRESENT" >> conftest.h
+- echo "#define NV_ACPI_OS_WAIT_EVENTS_COMPLETE_ARGUMENT_COUNT 0" >> conftest.h
+- return
+- else
+- echo "#error acpi_os_wait_events_complete() conftest failed!" >> conftest.h
+- fi
+- ;;
+-
+ ioremap_cache)
+ #
+ # Determine if the ioremap_cache() function is present.
+diff -u -r NVIDIA-Linux-x86_64-173.14.38-pkg2/usr/src/nv/nv-linux.h NVIDIA-Linux-x86_64-173.14.38-pkg2-patched/usr/src/nv/nv-linux.h
+--- NVIDIA-Linux-x86_64-173.14.38-pkg2/usr/src/nv/nv-linux.h 2013-08-28 21:53:41.000000000 +0100
++++ NVIDIA-Linux-x86_64-173.14.38-pkg2-patched/usr/src/nv/nv-linux.h 2015-08-28 10:37:23.727119733 +0100
+@@ -206,8 +206,7 @@
+ #endif
+
+ #if defined(CONFIG_ACPI)
+-#include <acpi/acpi.h>
+-#include <acpi/acpi_drivers.h>
++#include <linux/acpi.h>
+ #if defined(NV_ACPI_DEVICE_OPS_HAS_MATCH) || defined(ACPI_VIDEO_HID)
+ #define NV_LINUX_ACPI_EVENTS_SUPPORTED 1
+ #endif
+@@ -225,19 +224,6 @@
+ #error "NV_ACPI_WALK_NAMESPACE_ARGUMENT_COUNT value unrecognized!"
+ #endif
+
+-#if defined(NV_LINUX_ACPI_EVENTS_SUPPORTED)
+-#if defined(KERNEL_2_4) || \
+- (NV_ACPI_OS_WAIT_EVENTS_COMPLETE_ARGUMENT_COUNT == 1)
+-#define NV_ACPI_OS_WAIT_EVENTS_COMPLETE() \
+- acpi_os_wait_events_complete(NULL)
+-#elif (NV_ACPI_OS_WAIT_EVENTS_COMPLETE_ARGUMENT_COUNT == 0)
+-#define NV_ACPI_OS_WAIT_EVENTS_COMPLETE() \
+- acpi_os_wait_events_complete()
+-#else
+-#error "NV_ACPI_OS_WAIT_EVENTS_COMPLETE_ARGUMENT_COUNT value unrecognized!"
+-#endif
+-#endif
+-
+ #if defined(CONFIG_PREEMPT_RT)
+ typedef atomic_spinlock_t nv_spinlock_t;
+ #define NV_SPIN_LOCK_INIT(lock) atomic_spin_lock_init(lock)
+diff -u -r NVIDIA-Linux-x86_64-173.14.38-pkg2/usr/src/nv/nv.c NVIDIA-Linux-x86_64-173.14.38-pkg2-patched/usr/src/nv/nv.c
+--- NVIDIA-Linux-x86_64-173.14.38-pkg2/usr/src/nv/nv.c 2013-08-28 21:53:41.000000000 +0100
++++ NVIDIA-Linux-x86_64-173.14.38-pkg2-patched/usr/src/nv/nv.c 2015-08-28 10:37:41.374201994 +0100
+@@ -841,8 +841,13 @@
+ unsigned long cr0 = read_cr0();
+ write_cr0(((cr0 & (0xdfffffff)) | 0x40000000));
+ wbinvd();
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)
++ *cr4 = __read_cr4();
++ if (*cr4 & 0x80) __write_cr4(*cr4 & ~0x80);
++#else
+ *cr4 = read_cr4();
+ if (*cr4 & 0x80) write_cr4(*cr4 & ~0x80);
++#endif
+ __flush_tlb();
+ }
+
+@@ -852,7 +857,11 @@
+ wbinvd();
+ __flush_tlb();
+ write_cr0((cr0 & 0x9fffffff));
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)
++ if (cr4 & 0x80) __write_cr4(cr4);
++#else
+ if (cr4 & 0x80) write_cr4(cr4);
++#endif
+ }
+
+ static int __determine_pat_mode()
+@@ -2746,7 +2755,7 @@
+ unsigned long i_arg
+ )
+ {
+- return nv_kern_ioctl(file->f_dentry->d_inode, file, cmd, i_arg);
++ return nv_kern_ioctl(file->f_path.dentry->d_inode, file, cmd, i_arg);
+ }
+
+ long nv_kern_compat_ioctl(
+@@ -2755,7 +2764,7 @@
+ unsigned long i_arg
+ )
+ {
+- return nv_kern_ioctl(file->f_dentry->d_inode, file, cmd, i_arg);
++ return nv_kern_ioctl(file->f_path.dentry->d_inode, file, cmd, i_arg);
+ }
+
+ /*
+diff -u -r NVIDIA-Linux-x86_64-173.14.38-pkg2/usr/src/nv/nvacpi.c NVIDIA-Linux-x86_64-173.14.38-pkg2-patched/usr/src/nv/nvacpi.c
+--- NVIDIA-Linux-x86_64-173.14.38-pkg2/usr/src/nv/nvacpi.c 2013-08-28 21:53:41.000000000 +0100
++++ NVIDIA-Linux-x86_64-173.14.38-pkg2-patched/usr/src/nv/nvacpi.c 2015-08-28 10:37:23.726119728 +0100
+@@ -14,6 +14,10 @@
+ #include "os-interface.h"
+ #include "nv-linux.h"
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 13, 0) && defined(ACPI_HANDLE)
++#define DEVICE_ACPI_HANDLE(a) ACPI_HANDLE(a)
++#endif
++
+ #if defined(NV_LINUX_ACPI_EVENTS_SUPPORTED)
+
+ /*
+@@ -259,8 +263,6 @@
+
+ if (pNvAcpiObject->notify_handler_installed)
+ {
+- NV_ACPI_OS_WAIT_EVENTS_COMPLETE();
+-
+ // remove event notifier
+ status = acpi_remove_notify_handler(device->handle, ACPI_DEVICE_NOTIFY, nv_acpi_event);
+ }