# This is an experimental patch to make nvidia 96.43.05 compile, install and run
# under Linux kernel 2.6.25. The patch applies to the extracted nvidia
# installation archive. Note that the kernel must be patched or configured to
# export an unused symbol. Detailed installation instructions are available at
# http://www.frogge.de/pepper/patch/patch.html#nvidia
#
# (c) 19/04/2008 Dr. Martin Rogge
# E-mail: marogge at onlinehome dot de
#
# Distributed under the terms of the GPL.
# Absolutely no warranty. Use at your own risk.

--- usr/src/nv/nv-linux.h.orig	2008-04-19 10:42:03.000000000 +0200
+++ usr/src/nv/nv-linux.h	2008-04-19 10:42:03.000000000 +0200
@@ -1105,7 +1105,7 @@
  * nvidia bug (and can still be triggered by agpgart). let's avoid
  * change_page_attr on those kernels.
  */
-#if defined(NV_CHANGE_PAGE_ATTR_PRESENT)
+#if 0
 extern int nv_use_cpa;
 
 #if defined(NVCPU_X86_64) && !defined(KERNEL_2_4) && \
--- usr/src/nv/nv-vm.c.orig	2008-04-19 10:42:03.000000000 +0200
+++ usr/src/nv/nv-vm.c	2008-04-19 10:42:03.000000000 +0200
@@ -53,7 +53,8 @@
 
 static inline void nv_set_page_attrib_uncached(nv_pte_t *page_ptr)
 {
-#if defined(NV_CHANGE_PAGE_ATTR_PRESENT)
+    set_memory_uc((__va(page_ptr->phys_addr)), 1);
+#if 0
     if (nv_use_cpa)
     {
         struct page *page = virt_to_page(__va(page_ptr->phys_addr));
@@ -68,7 +69,8 @@
 
 static inline void nv_set_page_attrib_cached(nv_pte_t *page_ptr)
 {
-#if defined(NV_CHANGE_PAGE_ATTR_PRESENT)
+    set_memory_wb((__va(page_ptr->phys_addr)), 1);
+#if 0
     if (nv_use_cpa)
     {
         struct page *page = virt_to_page(__va(page_ptr->phys_addr));
@@ -360,7 +362,7 @@
 #if defined(NV_CPA_NEEDS_FLUSHING)
     nv_execute_on_all_cpus(cache_flush, NULL);
 #endif
-    global_flush_tlb();
+//  global_flush_tlb();
 #endif
 }
 
--- usr/src/nv/nv.c.orig	2008-04-19 10:42:03.000000000 +0200
+++ usr/src/nv/nv.c	2008-04-19 10:42:03.000000000 +0200
@@ -77,7 +77,7 @@
     "e.g.: \"swiotlb=16384\".\n";
 #endif
 
-#if defined(NV_CHANGE_PAGE_ATTR_BUG_PRESENT)
+#if 0
 static const char *__cpgattr_warning = \
     "Your Linux kernel has known problems in its implementation of\n"
     "the change_page_attr() kernel interface.\n\n"
@@ -112,7 +112,7 @@
 unsigned int nv_remap_limit;
 #endif
 
-#if defined(NV_CHANGE_PAGE_ATTR_PRESENT)
+#if 0
 int nv_use_cpa = 1;
 #endif
 
@@ -920,7 +920,7 @@
 }
 
 
-#if defined(NV_CHANGE_PAGE_ATTR_BUG_PRESENT)
+#if 0
 
 /* nv_verify_cpa_interface - determine if the change_page_attr bug is fixed
  * in this kernel.
@@ -1080,7 +1080,7 @@
     unsigned long address;
     static int count = 0;
 
-#if defined(NV_CHANGE_PAGE_ATTR_PRESENT)
+#if 0
     if (!nv_use_cpa)
         return 0;
 #endif
@@ -1359,7 +1359,7 @@
     /* create /proc/driver/nvidia */
     nvos_proc_create();
 
-#if defined(NV_CHANGE_PAGE_ATTR_PRESENT)
+#if 0
     {
         int data;
 
@@ -3994,7 +3994,7 @@
     void
 )
 {
-#if defined(NV_CHANGE_PAGE_ATTR_PRESENT)
+#if 1
     return 1;
 #else
     return 0;

