Re: patch to enable Nvidia v5336 on v2.6.11 kernel (was Re: inter_module_get and __symbol_get)

From: Zephaniah E. Hull
Date: Tue Jan 25 2005 - 15:58:20 EST


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....



--
1024D/E65A7801 Zephaniah E. Hull <warp@xxxxxxxxxxxxxxxx>
92ED 94E4 B1E6 3624 226D 5727 4453 008B E65A 7801
CCs of replies from mailing lists are requested.

<Mercury> Be warned, I have a keyboard I can use to beat luser's heads
in, and then continue to use... (=:]
<Deek> Mercury: Oh, an IBM. :)
diff -ur modules/nvidia-kernel/nv/nv-linux.h modules_new/nvidia-kernel/nv/nv-linux.h
--- modules/nvidia-kernel/nv/nv-linux.h 2004-11-12 14:14:20.000000000 -0500
+++ modules_new/nvidia-kernel/nv/nv-linux.h 2005-01-18 23:25:03.000000000 -0500
@@ -854,6 +854,9 @@

/* lock for linux-specific alloc queue */
struct semaphore at_lock;
+
+ /* AGP handle. */
+ struct agp_bridge_data *agp_bridge;
} nv_linux_state_t;


diff -ur modules/nvidia-kernel/nv/os-agp.c modules_new/nvidia-kernel/nv/os-agp.c
--- modules/nvidia-kernel/nv/os-agp.c 2004-11-12 14:14:20.000000000 -0500
+++ modules_new/nvidia-kernel/nv/os-agp.c 2005-01-18 23:22:51.000000000 -0500
@@ -70,6 +70,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));

@@ -82,7 +83,7 @@
* the memory controller.
*/

- if (drm_agp_p->acquire())
+ if (!(nvl->agp_bridge = drm_agp_p->acquire(nvl->dev)))
{
nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: backend in use\n");
inter_module_put("drm_agp");
@@ -110,7 +111,7 @@
*/
drm_agp_p->copy_info(&agpinfo);
#else
- if (drm_agp_p->copy_info(&agpinfo)) {
+ if (drm_agp_p->copy_info(nvl->agp_bridge, &agpinfo)) {
nv_printf(NV_DBG_ERRORS,
"NVRM: AGPGART: kernel reports chipset as unsupported\n");
goto failed;
@@ -170,7 +171,7 @@
if (!(agp_rate & 0x00000004)) agpinfo.mode &= ~0x00000004;
if (!(agp_rate & 0x00000002)) agpinfo.mode &= ~0x00000002;

- drm_agp_p->enable(agpinfo.mode);
+ drm_agp_p->enable(nvl->agp_bridge, agpinfo.mode);

*ap_phys_base = (void*) agpinfo.aper_base;
*ap_mapped_base = (void*) gart.aperture;
@@ -182,7 +183,7 @@

failed:
MTRR_DEL(gart); /* checks gart.mtrr */
- drm_agp_p->release();
+ drm_agp_p->release(nvl->agp_bridge);
inter_module_put("drm_agp");

return -1;
@@ -198,6 +199,7 @@
return 1;
#else
void *bitmap;
+ nv_linux_state_t *nvl = NV_GET_NVL_FROM_NV_STATE(nv);

/* sanity check to make sure we should actually be here. */
if (!gart.ready)
@@ -213,7 +215,7 @@
NV_IOUNMAP(gart.aperture, RM_PAGE_SIZE);
}

- drm_agp_p->release();
+ drm_agp_p->release(nvl->agp_bridge);

inter_module_put("drm_agp");

@@ -247,6 +249,7 @@
int err;
agp_priv_data *data;
RM_STATUS status;
+ nv_linux_state_t *nvl = NV_GET_NVL_FROM_NV_STATE(nv);

if (!gart.ready)
{
@@ -262,7 +265,7 @@
return RM_ERROR;
}

- ptr = drm_agp_p->allocate_memory(PageCount, AGP_NORMAL_MEMORY);
+ ptr = drm_agp_p->allocate_memory(nvl->agp_bridge, PageCount, AGP_NORMAL_MEMORY);
if (ptr == NULL)
{
*pAddress = (void*) 0;

Attachment: signature.asc
Description: Digital signature