Here is a better patch that includes the new dpatch (with some extra tabs removed from the previous post), and the necessary changes to the debian/rules and 00list files. It should apply cleanly to the current nvidia-kernel-sources package.

Best Regards,

diff -ruN nvidia-kernel-orig/debian/patches/00list 
nvidia-kernel/debian/patches/00list
--- nvidia-kernel-orig/debian/patches/00list    2005-02-18 15:16:05.000000000 
-0800
+++ nvidia-kernel/debian/patches/00list 2005-03-08 11:53:11.000000000 -0800
@@ -2,3 +2,4 @@
 02_pcialias
 03_pci_get_class
 04_minion
+05_agp_bridge_data
diff -ruN nvidia-kernel-orig/debian/patches/05_agp_bridge_data 
nvidia-kernel/debian/patches/05_agp_bridge_data
--- nvidia-kernel-orig/debian/patches/05_agp_bridge_data        1969-12-31 
16:00:00.000000000 -0800
+++ nvidia-kernel/debian/patches/05_agp_bridge_data     2005-03-08 
11:52:27.000000000 -0800
@@ -0,0 +1,230 @@
+#!/bin/sh -e
+
+# Patch from accumulated from http://www.minion.de/files/1.0-6629/
+
+if [ $# -lt 1 ]; then
+    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+    exit 1
+fi
+
+patch_opts="-f -N --no-backup-if-mismatch -p2"
+
+echo $1
+
+case "$1" in
+        -patch) patch $patch_opts -p1 < $0;;
+        -unpatch) patch $patch_opts -p1 -R < $0;;
+        *)
+               echo >&2 "`basename $0`: script expects -patch|-unpatch as 
argument"
+                       exit 1;;
+esac
+
+exit 0
+
[EMAIL PROTECTED]@
+
+--- nvidia-kernel/nv/nv.c.orig 2005-03-08 11:33:00.000000000 -0800
++++ nvidia-kernel/nv/nv.c      2005-03-08 11:40:31.000000000 -0800
+@@ -3011,7 +3011,6 @@
+             return status;
+         }
+ #elif defined(AGPGART)
+-        int error;
+         /*
+          * We can only safely use NvAGP when no backend has been
+          * registered with the AGPGART frontend. This condition
+@@ -3020,9 +3019,11 @@
+          * Other return codes indicate that a backend is present
+          * and was either acquired, busy or else unavailable.
+          */
+-        if ((error = agp_backend_acquire()) != -EINVAL)
++        nv_linux_state_t *nvl = NV_GET_NVL_FROM_NV_STATE(nv);
++        nvl->agp_bridge = agp_backend_acquire(nvl->dev);
++        if (nvl->agp_bridge)
+         {
+-            if (!error) agp_backend_release();
++            agp_backend_release(nvl->agp_bridge);
+             nv_printf(NV_DBG_WARNINGS,
+                       "NVRM: not using NVAGP, an AGPGART backend is 
loaded!\n");
+             return status;
+--- nvidia-kernel/nv/nv-linux.h.orig   2005-03-08 11:37:41.000000000 -0800
++++ nvidia-kernel/nv/nv-linux.h        2005-03-08 11:40:31.000000000 -0800
+@@ -930,6 +930,9 @@
+ 
+     /* lock for linux-specific alloc queue */
+     struct semaphore at_lock;
++
++    /* AGP bridge handle */
++    struct agp_bridge_data *agp_bridge;
+ } nv_linux_state_t;
+ 
+ 
+--- nvidia-kernel/nv/os-agp.c.orig     2005-03-08 11:38:09.000000000 -0800
++++ nvidia-kernel/nv/os-agp.c  2005-03-08 11:40:31.000000000 -0800
+@@ -60,23 +60,23 @@
+ #endif
+ 
+ #if defined(KERNEL_2_6)
+-#define NV_AGPGART_BACKEND_ACQUIRE(o) agp_backend_acquire()
+-#define NV_AGPGART_BACKEND_ENABLE(o,mode) agp_enable(mode)
+-#define NV_AGPGART_BACKEND_RELEASE(o) agp_backend_release()
+-#define NV_AGPGART_COPY_INFO(o,p) agp_copy_info(p)
+-#define NV_AGPGART_ALLOCATE_MEMORY(o,count,type) 
agp_allocate_memory(count,type)
+-#define NV_AGPGART_FREE_MEMORY(o,p) agp_free_memory(p)
+-#define NV_AGPGART_BIND_MEMORY(o,p,offset) agp_bind_memory(p,offset)
+-#define NV_AGPGART_UNBIND_MEMORY(o,p) agp_unbind_memory(p)
++#define NV_AGPGART_BACKEND_ACQUIRE(nvl,o) ({ nvl->agp_bridge = 
agp_backend_acquire(nvl->dev); !nvl->agp_bridge; })
++#define NV_AGPGART_BACKEND_ENABLE(nvl,o,mode) agp_enable(nvl->agp_bridge,mode)
++#define NV_AGPGART_BACKEND_RELEASE(nvl,o) agp_backend_release(nvl->agp_bridge)
++#define NV_AGPGART_COPY_INFO(nvl,o,p) agp_copy_info(nvl->agp_bridge,p)
++#define NV_AGPGART_ALLOCATE_MEMORY(nvl,o,count,type) 
agp_allocate_memory(nvl->agp_bridge,count,type)
++#define NV_AGPGART_FREE_MEMORY(nvl,o,p) agp_free_memory(p)
++#define NV_AGPGART_BIND_MEMORY(nvl,o,p,offset) agp_bind_memory(p,offset)
++#define NV_AGPGART_UNBIND_MEMORY(nvl,o,p) agp_unbind_memory(p)
+ #elif defined(KERNEL_2_4)
+-#define NV_AGPGART_BACKEND_ACQUIRE(o) ({ (o)->acquire(); 0; })
+-#define NV_AGPGART_BACKEND_ENABLE(o,mode) (o)->enable(mode)
+-#define NV_AGPGART_BACKEND_RELEASE(o) ((o)->release())
+-#define NV_AGPGART_COPY_INFO(o,p) ({ (o)->copy_info(p); 0; })
+-#define NV_AGPGART_ALLOCATE_MEMORY(o,count,type) 
(o)->allocate_memory(count,type)
+-#define NV_AGPGART_FREE_MEMORY(o,p) (o)->free_memory(p)
+-#define NV_AGPGART_BIND_MEMORY(o,p,offset) (o)->bind_memory(p,offset)
+-#define NV_AGPGART_UNBIND_MEMORY(o,p) (o)->unbind_memory(p)
++#define NV_AGPGART_BACKEND_ACQUIRE(nvl,o) ({ (o)->acquire(); 0; })
++#define NV_AGPGART_BACKEND_ENABLE(nvl,o,mode) (o)->enable(mode)
++#define NV_AGPGART_BACKEND_RELEASE(nvl,o) ((o)->release())
++#define NV_AGPGART_COPY_INFO(nvl,o,p) ({ (o)->copy_info(p); 0; })
++#define NV_AGPGART_ALLOCATE_MEMORY(nvl,o,count,type) 
(o)->allocate_memory(count,type)
++#define NV_AGPGART_FREE_MEMORY(nvl,o,p) (o)->free_memory(p)
++#define NV_AGPGART_BIND_MEMORY(nvl,o,p,offset) (o)->bind_memory(p,offset)
++#define NV_AGPGART_UNBIND_MEMORY(nvl,o,p) (o)->unbind_memory(p)
+ #endif
+ 
+ #endif /* AGPGART */
+@@ -96,6 +96,7 @@
+     U032  agp_fw;
+     void *bitmap;
+     U032 bitmap_size;
++    nv_linux_state_t *nvl = NV_GET_NVL_FROM_NV_STATE(nv);
+ 
+     memset( (void *) &gart, 0, sizeof(agp_gart));
+ 
+@@ -110,7 +111,7 @@
+      * the memory controller.
+      */
+ 
+-    if (NV_AGPGART_BACKEND_ACQUIRE(drm_agp_p))
++    if (NV_AGPGART_BACKEND_ACQUIRE(nvl,drm_agp_p))
+     {
+         nv_printf(NV_DBG_INFO, "NVRM: AGPGART: no backend available\n");
+         goto bailout;
+@@ -128,7 +129,7 @@
+         agp_fw = 1;
+     agp_fw &= 0x00000001;
+ 
+-    if (NV_AGPGART_COPY_INFO(drm_agp_p, &agpinfo))
++    if (NV_AGPGART_COPY_INFO(nvl,drm_agp_p, &agpinfo))
+     {
+         nv_printf(NV_DBG_ERRORS,
+             "NVRM: AGPGART: kernel reports chipset as unsupported\n");
+@@ -188,7 +189,7 @@
+     if (!(agp_rate & 0x00000004)) agpinfo.mode &= ~0x00000004;
+     if (!(agp_rate & 0x00000002)) agpinfo.mode &= ~0x00000002;
+     
+-    NV_AGPGART_BACKEND_ENABLE(drm_agp_p, agpinfo.mode);
++    NV_AGPGART_BACKEND_ENABLE(nvl,drm_agp_p, agpinfo.mode);
+ 
+     *ap_phys_base   = (void*) agpinfo.aper_base;
+     *ap_mapped_base = (void*) gart.aperture;
+@@ -200,7 +201,7 @@
+ 
+ failed:
+     MTRR_DEL(gart); /* checks gart.mtrr */
+-    NV_AGPGART_BACKEND_RELEASE(drm_agp_p);
++    NV_AGPGART_BACKEND_RELEASE(nvl,drm_agp_p);
+ bailout:
+ #if defined(KERNEL_2_4)
+     inter_module_put("drm_agp");
+@@ -219,6 +220,7 @@
+     return 1;
+ #else
+     void *bitmap;
++    nv_linux_state_t *nvl;
+ 
+     /* sanity check to make sure we should actually be here. */
+     if (!gart.ready)
+@@ -234,7 +236,8 @@
+         NV_IOUNMAP(gart.aperture, RM_PAGE_SIZE);
+     }
+ 
+-    NV_AGPGART_BACKEND_RELEASE(drm_agp_p);
++    nvl = NV_GET_NVL_FROM_NV_STATE(nv);
++    NV_AGPGART_BACKEND_RELEASE(nvl,drm_agp_p);
+ #if defined(KERNEL_2_4)
+     inter_module_put("drm_agp");
+ #endif
+@@ -268,6 +271,7 @@
+     agp_memory *ptr;
+     agp_priv_data *data;
+     RM_STATUS status;
++    nv_linux_state_t *nvl;
+ 
+     if (!gart.ready)
+     {
+@@ -283,7 +287,8 @@
+         return RM_ERROR;
+     }
+ 
+-    ptr = NV_AGPGART_ALLOCATE_MEMORY(drm_agp_p, PageCount, AGP_NORMAL_MEMORY);
++    nvl = NV_GET_NVL_FROM_NV_STATE(nv);
++    ptr = NV_AGPGART_ALLOCATE_MEMORY(nvl,drm_agp_p, PageCount, 
AGP_NORMAL_MEMORY);
+     if (ptr == NULL)
+     {
+         *pAddress = (void*) 0;
+@@ -291,7 +296,7 @@
+         return RM_ERR_NO_FREE_MEM;
+     }
+     
+-    if (NV_AGPGART_BIND_MEMORY(drm_agp_p, ptr, *Offset))
++    if (NV_AGPGART_BIND_MEMORY(nvl,drm_agp_p, ptr, *Offset))
+     {
+         // this happens a lot when the aperture itself fills up..
+         // not a big deal, so don't alarm people with an error message
+@@ -304,7 +309,7 @@
+     if (status != RM_OK)
+     {
+         nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: memory allocation failed\n");
+-        NV_AGPGART_UNBIND_MEMORY(drm_agp_p, ptr);
++        NV_AGPGART_UNBIND_MEMORY(nvl,drm_agp_p, ptr);
+         goto fail;
+     }
+ 
+@@ -319,7 +324,7 @@
+     return RM_OK;
+ 
+ fail:
+-    NV_AGPGART_FREE_MEMORY(drm_agp_p, ptr);
++    NV_AGPGART_FREE_MEMORY(nvl,drm_agp_p, ptr);
+     *pAddress = (void*) 0;
+ 
+     return RM_ERROR;
+@@ -359,7 +364,7 @@
+     {
+         nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: unable to remap %lu pages\n",
+             (unsigned long)agp_data->num_pages);
+-        NV_AGPGART_UNBIND_MEMORY(drm_agp_p, agp_data->ptr);
++        NV_AGPGART_UNBIND_MEMORY(nvl,drm_agp_p, agp_data->ptr);
+         goto fail;
+     }
+     
+@@ -458,8 +463,8 @@
+     {
+         size_t pages = ptr->page_count;
+ 
+-        NV_AGPGART_UNBIND_MEMORY(drm_agp_p, ptr);
+-        NV_AGPGART_FREE_MEMORY(drm_agp_p, ptr);
++        NV_AGPGART_UNBIND_MEMORY(nvl,drm_agp_p, ptr);
++        NV_AGPGART_FREE_MEMORY(nvl,drm_agp_p, ptr);
+ 
+         nv_printf(NV_DBG_INFO, "NVRM: AGPGART: freed %ld pages\n",
+             (unsigned long)pages);
--- nvidia-kernel/debian/rules.orig     2005-03-08 12:01:52.000000000 -0800
+++ nvidia-kernel/debian/rules  2005-03-08 12:02:39.000000000 -0800
@@ -98,6 +98,7 @@
             cd .. ; \
             if [ $(NV_PATCH_MINION) = 1 ] ; then \
                dpatch apply 04_minion ; \
+               dpatch apply 05_agp_bridge_data ; \
             fi ; \
             if [ $(NV_PATCH_SYSFS) = 1 ]; then \
                dpatch apply 01_sysfs ; \

Reply via email to