All of lore.kernel.org
 help / color / mirror / Atom feed
From: "J.A. Magallon" <jamagallon@able.es>
To: "Zephaniah E. Hull" <warp@babylon.d2dc.net>
Cc: davidm@hpl.hp.com, Lista Linux-Kernel <linux-kernel@vger.kernel.org>
Subject: Re: patch to enable Nvidia v5336 on v2.6.11 kernel (was Re: inter_module_get and __symbol_get)
Date: Wed, 26 Jan 2005 00:02:51 +0000	[thread overview]
Message-ID: <1106697771l.5485l.0l@werewolf.able.es> (raw)
In-Reply-To: <20050125205046.GA19738@babylon.d2dc.net> (from warp@babylon.d2dc.net on Tue Jan 25 21:50:47 2005)

[-- Attachment #1: Type: text/plain, Size: 9322 bytes --]


On 2005.01.25, Zephaniah E. Hull wrote:
> On Tue, Jan 25, 2005 at 12:56:25PM +0000, J.A. Magallon wrote:
> <snip>
> > You can use the latest drivers (6629) with this patches:
> > 
> > http://www.minion.de/files/1.0-6629/
> > 
> > They work fine up to -rc2.
> > 
> > If you want to use the driver with -mm, you have to kill the support
> > for AGPGART in nvidia driver, add -DNOAGPGART to EXTRA_CFLAGS in the
> > makefile. It will require a big change to use the multi-agp patches
> > in -mm. But you are restricted to those AGPs supported by nvidia
> > (ah, and don't load any agp related module...).
> 
> For values of big changes that equal the attached patch.
> 
> I'm using it on 2.6.10-mm3.  I sent it to Zander however since there is
> no way to detect the new multi-agp support barring some sick hacks it
> has not gone in.
> 
> It may conflict with the support for the 2.6.11-rc kernels, in which
> case when I next upgrade I'll find out and write a new one.
> > 
> > Ah, just a ton of workarounds....
> 

Hay, that gave me the clues I was missing !!!
With patch below, I get 6629 working on 2.6.10-rc2-mm1. Apply it on top of
all the patches in the link above.

I know, it is ugly as hell (all those superfluos parameters in NV_AGPGART
macros, unused drm_agp_p...), but perhaps someone  will rework all that
macro mesh. For the moment, it works....

diff -ruN nv-6629-jam/src/nv/nv-linux.h nv-6629-jam-2/src/nv/nv-linux.h
--- nv-6629-jam/src/nv/nv-linux.h	2005-01-24 23:16:46.000000000 +0100
+++ nv-6629-jam-2/src/nv/nv-linux.h	2005-01-26 00:25:10.000000000 +0100
@@ -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;
 
 
diff -ruN nv-6629-jam/src/nv/nv.c nv-6629-jam-2/src/nv/nv.c
--- nv-6629-jam/src/nv/nv.c	2005-01-24 23:16:46.000000000 +0100
+++ nv-6629-jam-2/src/nv/nv.c	2005-01-26 00:47:14.000000000 +0100
@@ -3011,10 +3011,11 @@
             return -1;
         }
 #elif defined(AGPGART)
-        int error;
-        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 -1;
diff -ruN nv-6629-jam/src/nv/os-agp.c nv-6629-jam-2/src/nv/os-agp.c
--- nv-6629-jam/src/nv/os-agp.c	2005-01-24 23:16:46.000000000 +0100
+++ nv-6629-jam-2/src/nv/os-agp.c	2005-01-26 00:49:01.000000000 +0100
@@ -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);

--
J.A. Magallon <jamagallon()able!es>     \               Software is like sex:
werewolf!able!es                         \         It's better when it's free
Mandrakelinux release 10.2 (Cooker) for i586
Linux 2.6.10-jam6 (gcc 3.4.3 (Mandrakelinux 10.2 3.4.3-3mdk)) #1


[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2005-01-26  0:06 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-06 21:32 inter_module_get and __symbol_get Terence Ripperda
2005-01-06 21:57 ` Brian Gerst
2005-01-06 22:51   ` Terence Ripperda
2005-01-08  4:00     ` Jon Smirl
2005-01-12 19:37       ` Terence Ripperda
2005-01-12 22:21         ` Brian Gerst
2005-01-08  3:10   ` Keith Owens
2005-01-24 22:36     ` David Mosberger
2005-01-24 22:44       ` Keith Owens
2005-01-24 22:52         ` David Mosberger
2005-01-24 22:54           ` Keith Owens
2005-01-24 22:58             ` David Mosberger
2005-01-24 23:03               ` Keith Owens
2005-01-25  0:51                 ` patch to enable Nvidia v5336 on v2.6.11 kernel (was Re: inter_module_get and __symbol_get) David Mosberger
2005-01-25  0:51                   ` David Mosberger
2005-01-25 12:56                   ` J.A. Magallon
2005-01-25 20:50                     ` Zephaniah E. Hull
2005-01-26  0:02                       ` J.A. Magallon [this message]
2005-01-26  0:25                         ` Zephaniah E. Hull
2005-01-26  0:25                       ` J.A. Magallon
2005-01-25  1:01                 ` inter_module_get and __symbol_get Jon Smirl
2005-01-24 23:19           ` Jon Smirl
2005-01-24 23:23             ` David Mosberger
2005-01-25  5:31         ` Terence Ripperda
2005-01-25  5:59           ` Chris Wedgwood

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1106697771l.5485l.0l@werewolf.able.es \
    --to=jamagallon@able.es \
    --cc=davidm@hpl.hp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=warp@babylon.d2dc.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.