summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Schlemmer <azarah@gentoo.org>2005-03-05 10:43:54 +0000
committerMartin Schlemmer <azarah@gentoo.org>2005-03-05 10:43:54 +0000
commitf97df5216d70493937454e9bb29a538215bf8d58 (patch)
tree480279bde5b62213eba5f7b35a22ec5c137e8610 /media-video/nvidia-kernel
parentStable on ppc64 (diff)
downloadgentoo-2-f97df5216d70493937454e9bb29a538215bf8d58.tar.gz
gentoo-2-f97df5216d70493937454e9bb29a538215bf8d58.tar.bz2
gentoo-2-f97df5216d70493937454e9bb29a538215bf8d58.zip
Add support for multi-agp with newer -mm kernels.
(Portage version: 2.0.51.19)
Diffstat (limited to 'media-video/nvidia-kernel')
-rw-r--r--media-video/nvidia-kernel/ChangeLog9
-rw-r--r--media-video/nvidia-kernel/Manifest45
-rw-r--r--media-video/nvidia-kernel/files/1.0.6629/NVIDIA_kernel-1.0-6629-agp_bridge_data.patch210
-rw-r--r--media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.6629-r42
-rw-r--r--media-video/nvidia-kernel/nvidia-kernel-1.0.6629-r4.ebuild144
5 files changed, 383 insertions, 27 deletions
diff --git a/media-video/nvidia-kernel/ChangeLog b/media-video/nvidia-kernel/ChangeLog
index 55dde469691b..571c60a26c0f 100644
--- a/media-video/nvidia-kernel/ChangeLog
+++ b/media-video/nvidia-kernel/ChangeLog
@@ -1,6 +1,13 @@
# ChangeLog for media-video/nvidia-kernel
# Copyright 2002-2005 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/media-video/nvidia-kernel/ChangeLog,v 1.108 2005/01/26 07:01:43 eradicator Exp $
+# $Header: /var/cvsroot/gentoo-x86/media-video/nvidia-kernel/ChangeLog,v 1.109 2005/03/05 10:43:53 azarah Exp $
+
+*nvidia-kernel-1.0.6629-r4 (05 Mar 2005)
+
+ 05 Mar 2005; Martin Schlemmer <azarah@gentoo.org>
+ +files/1.0.6629/NVIDIA_kernel-1.0-6629-agp_bridge_data.patch,
+ +nvidia-kernel-1.0.6629-r4.ebuild:
+ Add support for multi-agp with newer -mm kernels.
*nvidia-kernel-1.0.6629-r3 (25 Jan 2005)
diff --git a/media-video/nvidia-kernel/Manifest b/media-video/nvidia-kernel/Manifest
index 4b88a1c842fe..e1906fa03063 100644
--- a/media-video/nvidia-kernel/Manifest
+++ b/media-video/nvidia-kernel/Manifest
@@ -1,44 +1,37 @@
------BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA1
-
-MD5 216aeafe1ebb87f2a6b51db21e2bda94 ChangeLog 28401
-MD5 c84a79e7d9b69a204003fb8c2dbaad01 metadata.xml 297
-MD5 6efd7d5ad3c7739f685111aa84466b68 nvidia-kernel-1.0.6111-r3.ebuild 4488
MD5 17e5291b91d1eef96d55e54a2cba6d81 nvidia-kernel-1.0.6629-r1.ebuild 4748
+MD5 d2cc33a56813431a612ebb0c6e2a1d8d nvidia-kernel-1.0.6629-r4.ebuild 4483
+MD5 216aeafe1ebb87f2a6b51db21e2bda94 ChangeLog 28401
MD5 3915412914635df4d7329ad27323f4c5 nvidia-kernel-1.0.6629-r2.ebuild 4264
MD5 631e8deabfb0c7726b9b31259f1673a0 nvidia-kernel-1.0.6629-r3.ebuild 4330
-MD5 ed1e098d85579c75542ef0a49ee4dd5c files/digest-nvidia-kernel-1.0.6111-r3 163
+MD5 c84a79e7d9b69a204003fb8c2dbaad01 metadata.xml 297
+MD5 6efd7d5ad3c7739f685111aa84466b68 nvidia-kernel-1.0.6111-r3.ebuild 4488
+MD5 d8fcf2021aa68584d4a4d9e96b671da0 files/nvidia 501
MD5 8a4687b0fc3e7cc0b36c247697d94701 files/digest-nvidia-kernel-1.0.6629-r1 163
+MD5 8a4687b0fc3e7cc0b36c247697d94701 files/digest-nvidia-kernel-1.0.6629-r4 163
MD5 8a4687b0fc3e7cc0b36c247697d94701 files/digest-nvidia-kernel-1.0.6629-r2 163
-MD5 d8fcf2021aa68584d4a4d9e96b671da0 files/nvidia 501
MD5 8a4687b0fc3e7cc0b36c247697d94701 files/digest-nvidia-kernel-1.0.6629-r3 163
-MD5 b5b7f947ffb9e6c19f7457ff7c14d0db files/1.0.6111/conftest_koutput_includes.patch 1082
+MD5 ed1e098d85579c75542ef0a49ee4dd5c files/digest-nvidia-kernel-1.0.6111-r3 163
+MD5 14924b09123b075f910c73316baff848 files/1.0.6111/power-suspend-2.6.9-changes.patch 856
+MD5 29eafcaf7ab5d59dd90d3d3243bf57c3 files/1.0.6111/nv_enable_pci.patch 3640
MD5 762e6f6e16aa6dd5b2469e99fe8decd3 files/1.0.6111/nv-pci_find_class.patch 2903
MD5 c2b155f40d7b904f07550e8e326969c2 files/1.0.6111/nv-remap-range.patch 5715
-MD5 29eafcaf7ab5d59dd90d3d3243bf57c3 files/1.0.6111/nv_enable_pci.patch 3640
-MD5 14924b09123b075f910c73316baff848 files/1.0.6111/power-suspend-2.6.9-changes.patch 856
MD5 5177339888e44bb5f4b6124fa5830e7f files/1.0.6111/vmalloc-reserve.patch 542
+MD5 b5b7f947ffb9e6c19f7457ff7c14d0db files/1.0.6111/conftest_koutput_includes.patch 1082
+MD5 dbf80a2cbaf69a10521429e1b2a7e10c files/1.0.6629/conftest_koutput_includes.patch 1082
+MD5 c039797780f78262baa02ff488e822ff files/1.0.6629/nv-disable-preempt-on-smp_processor_id.patch 435
+MD5 e70739410861defb6bf3d40f2706d554 files/1.0.6629/nv-pgd_offset.patch 3139
+MD5 64d76075a90dedc83f1dc971389c910e files/1.0.6629/nv-shutup-warnings.patch 712
+MD5 5aef5c6a394896bbb8392816f6795147 files/1.0.6629/nv-amd64-shutup-warnings.patch 902
+MD5 0009ccc8f3896f22bad06fd549639072 files/1.0.6629/nv-pgprot-speedup.patch 1518
+MD5 7c9db721d244f6ca709e2b8003ce4e0d files/1.0.6629/nv-vm_flags-no-VM_LOCKED.patch 677
+MD5 ddeae194df6bb2112d7de723df8d84c2 files/1.0.6629/nv-fix-memory-limit.patch 18398
MD5 0009ccc8f3896f22bad06fd549639072 files/1.0.6629/NVIDIA_kernel-1.0-6629-1155389.patch 1518
MD5 ddeae194df6bb2112d7de723df8d84c2 files/1.0.6629/NVIDIA_kernel-1.0-6629-1161283.patch 18398
MD5 5a17c3fa427b4d0ff8e38f82e57cd817 files/1.0.6629/NVIDIA_kernel-1.0-6629-1162524.patch 9417
MD5 ada7d22def202e56c01c1e72c8000d45 files/1.0.6629/NVIDIA_kernel-1.0-6629-1165235.patch 581
MD5 f1a5a01593ef996b38fe70bc93fa7440 files/1.0.6629/NVIDIA_kernel-1.0-6629-1171869.patch 2160
MD5 59c5fa8340585303cd18362bbeb0086f files/1.0.6629/NVIDIA_kernel-1.0-6629-1175225.patch 1877
+MD5 6aeb1e968e901c208108d18644e5b09c files/1.0.6629/NVIDIA_kernel-1.0-6629-agp_bridge_data.patch 7448
MD5 d4e8ffdb0cc67c56884e6055d2045e51 files/1.0.6629/NVIDIA_kernel-1.0-6629-1182399.patch 2608
MD5 e210d99cae87c3f60120ea474b97fca7 files/1.0.6629/NVIDIA_kernel-1.0-6629-1189413.patch 8072
-MD5 dbf80a2cbaf69a10521429e1b2a7e10c files/1.0.6629/conftest_koutput_includes.patch 1082
-MD5 5aef5c6a394896bbb8392816f6795147 files/1.0.6629/nv-amd64-shutup-warnings.patch 902
-MD5 c039797780f78262baa02ff488e822ff files/1.0.6629/nv-disable-preempt-on-smp_processor_id.patch 435
-MD5 ddeae194df6bb2112d7de723df8d84c2 files/1.0.6629/nv-fix-memory-limit.patch 18398
-MD5 e70739410861defb6bf3d40f2706d554 files/1.0.6629/nv-pgd_offset.patch 3139
-MD5 0009ccc8f3896f22bad06fd549639072 files/1.0.6629/nv-pgprot-speedup.patch 1518
-MD5 64d76075a90dedc83f1dc971389c910e files/1.0.6629/nv-shutup-warnings.patch 712
-MD5 7c9db721d244f6ca709e2b8003ce4e0d files/1.0.6629/nv-vm_flags-no-VM_LOCKED.patch 677
MD5 da7644fcc801d40c26fb22b570a88835 files/1.0.6629/NVIDIA_kernel-1.0-6629-1201042.diff 9445
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1.4.0 (GNU/Linux)
-
-iD8DBQFB90CBArHZZzCEUG0RAmpRAJwJqXVZw9pM6BX4ho1PiugPSYV38wCgiheJ
-HfTNstC1MkFvuJbRjTcndLc=
-=+QKE
------END PGP SIGNATURE-----
diff --git a/media-video/nvidia-kernel/files/1.0.6629/NVIDIA_kernel-1.0-6629-agp_bridge_data.patch b/media-video/nvidia-kernel/files/1.0.6629/NVIDIA_kernel-1.0-6629-agp_bridge_data.patch
new file mode 100644
index 000000000000..f3ce61b31fca
--- /dev/null
+++ b/media-video/nvidia-kernel/files/1.0.6629/NVIDIA_kernel-1.0-6629-agp_bridge_data.patch
@@ -0,0 +1,210 @@
+diff -ruN nv-6629-jam/usr/src/nv/nv-linux.h nv-6629-jam-2/usr/src/nv/nv-linux.h
+--- nv-6629-jam/usr/src/nv/nv-linux.h 2005-01-24 23:16:46.000000000 +0100
++++ nv-6629-jam-2/usr/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/usr/src/nv/nv.c nv-6629-jam-2/usr/src/nv/nv.c
+--- nv-6629-jam/usr/src/nv/nv.c 2005-01-24 23:16:46.000000000 +0100
++++ nv-6629-jam-2/usr/src/nv/nv.c 2005-01-26 00:47:14.000000000 +0100
+@@ -3013,18 +3013,19 @@
+ return -1;
+ }
+ #elif defined(AGPGART)
+- int error;
+ /*
+ * We can only safely use NvAGP when no backend has been
+ * registered with the AGPGART frontend. This condition
+ * is only met when the acquire function returns -EINVAL.
+ *
+ * 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 -1;
+diff -ruN nv-6629-jam/usr/src/nv/os-agp.c nv-6629-jam-2/usr/src/nv/os-agp.c
+--- nv-6629-jam/usr/src/nv/os-agp.c 2005-01-24 23:16:46.000000000 +0100
++++ nv-6629-jam-2/usr/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);
+
diff --git a/media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.6629-r4 b/media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.6629-r4
new file mode 100644
index 000000000000..9324510b4ef9
--- /dev/null
+++ b/media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.6629-r4
@@ -0,0 +1,2 @@
+MD5 f7737c1e95371f37a4fd30da2f11e72c NVIDIA-Linux-x86-1.0-6629-pkg1.run 8725221
+MD5 652e69f549c81a7a3f2806daa74b9c36 NVIDIA-Linux-x86_64-1.0-6629-pkg2.run 7777882
diff --git a/media-video/nvidia-kernel/nvidia-kernel-1.0.6629-r4.ebuild b/media-video/nvidia-kernel/nvidia-kernel-1.0.6629-r4.ebuild
new file mode 100644
index 000000000000..0df21bcf1ba1
--- /dev/null
+++ b/media-video/nvidia-kernel/nvidia-kernel-1.0.6629-r4.ebuild
@@ -0,0 +1,144 @@
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/media-video/nvidia-kernel/nvidia-kernel-1.0.6629-r4.ebuild,v 1.1 2005/03/05 10:43:54 azarah Exp $
+
+inherit eutils linux-mod
+
+X86_PKG_V="pkg1"
+AMD64_PKG_V="pkg2"
+NV_V="${PV/1.0./1.0-}"
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${NV_V}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${NV_V}"
+
+DESCRIPTION="Linux kernel module for the NVIDIA X11 driver"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="x86? (ftp://download.nvidia.com/XFree86/Linux-x86/${NV_V}/${X86_NV_PACKAGE}-${X86_PKG_V}.run)
+ amd64? (http://download.nvidia.com/XFree86/Linux-x86_64/${NV_V}/${AMD64_NV_PACKAGE}-${AMD64_PKG_V}.run)"
+
+if use x86; then
+ PKG_V="${X86_PKG_V}"
+ NV_PACKAGE="${X86_NV_PACKAGE}"
+elif use amd64; then
+ PKG_V="${AMD64_PKG_V}"
+ NV_PACKAGE="${AMD64_NV_PACKAGE}"
+fi
+
+S="${WORKDIR}/${NV_PACKAGE}-${PKG_V}/usr/src/nv"
+
+LICENSE="NVIDIA"
+SLOT="0"
+KEYWORDS="-* ~x86 ~amd64"
+RESTRICT="nostrip"
+IUSE=""
+
+DEPEND="virtual/linux-sources"
+export _POSIX2_VERSION="199209"
+
+MODULE_NAMES="nvidia(video:${S})"
+BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} SYSOUT=${KV_OUT_DIR}"
+
+mtrr_check() {
+ ebegin "Checking for MTRR support"
+ linux_chkconfig_present MTRR
+ eend $?
+
+ if [ "$?" != 0 ]
+ then
+ eerror "This version needs MTRR support for most chipsets!"
+ eerror "Please enable MTRR support in your kernel config, found at:"
+ eerror
+ eerror " Processor type and features"
+ eerror " [*] MTRR (Memory Type Range Register) support"
+ eerror
+ eerror "and recompile your kernel ..."
+ die "MTRR support not detected!"
+ fi
+}
+
+pkg_setup() {
+ linux-mod_pkg_setup
+ mtrr_check;
+}
+
+src_unpack() {
+ if [ ${KV_MINOR} -ge 6 -a ${KV_PATCH} -lt 7 ]
+ then
+ echo
+ ewarn "Your kernel version is ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"
+ ewarn "This is not officially supported for ${P}. It is likely you"
+ ewarn "will not be able to compile or use the kernel module."
+ ewarn "It is recommended that you upgrade your kernel to a version >= 2.6.7"
+ echo
+ ewarn "DO NOT file bug reports for kernel versions less than 2.6.7 as they will be ignored."
+ fi
+
+ cd ${WORKDIR}
+ bash ${DISTDIR}/${NV_PACKAGE}-${PKG_V}.run --extract-only
+
+ # Add patches below, with a breif description.
+ cd ${S}
+ # Any general patches should go here
+ # Shutup pointer arith warnings
+ use x86 && epatch ${FILESDIR}/${PV}/nv-shutup-warnings.patch
+ use amd64 && epatch ${FILESDIR}/${PV}/nv-amd64-shutup-warnings.patch
+
+ # Patches from Zander (http://www.minion.de/files/1.0-6629/)
+ epatch ${FILESDIR}/${PV}/NVIDIA_kernel-1.0-6629-1155389.patch
+ #epatch ${FILESDIR}/${PV}/NVIDIA_kernel-1.0-6629-1162524.patch
+ epatch ${FILESDIR}/${PV}/NVIDIA_kernel-1.0-6629-1165235.patch
+ epatch ${FILESDIR}/${PV}/NVIDIA_kernel-1.0-6629-1171869.patch
+ epatch ${FILESDIR}/${PV}/NVIDIA_kernel-1.0-6629-1175225.patch
+ epatch ${FILESDIR}/${PV}/NVIDIA_kernel-1.0-6629-1182399.patch
+ epatch ${FILESDIR}/${PV}/NVIDIA_kernel-1.0-6629-1189413.patch
+ epatch ${FILESDIR}/${PV}/NVIDIA_kernel-1.0-6629-1201042.diff
+
+ # Now any patches specific to the 2.6 kernel should go here
+ if kernel_is 2 6
+ then
+ einfo "Applying 2.6 kernel patches"
+ # Fix the /usr/src/linux/include/asm not existing on koutput issue #58294
+ epatch ${FILESDIR}/${PV}/conftest_koutput_includes.patch
+ # Fix calling of smp_processor_id() when preempt is enabled
+ epatch ${FILESDIR}/${PV}/nv-disable-preempt-on-smp_processor_id.patch
+ # Fix a limitation on available video memory bug #71684
+ epatch ${FILESDIR}/${PV}/NVIDIA_kernel-1.0-6629-1161283.patch
+ # New multi-agp support with newer -mm kernels
+ # http://lkml.org/lkml/2005/1/25/349
+ [[ -n $(grep agp_bridge_data "${KV_DIR}/include/linux/agp_backend.h") ]] && \
+ epatch ${FILESDIR}/${PV}/NVIDIA_kernel-1.0-6629-agp_bridge_data.patch
+ fi
+
+ # if you set this then it's your own fault when stuff breaks :)
+ [ -n "${USE_CRAZY_OPTS}" ] && sed -i "s:-O:${CFLAGS}:" Makefile.*
+
+ # if greater than 2.6.5 use M= instead of SUBDIR=
+ convert_to_m ${S}/Makefile.kbuild
+}
+
+src_install() {
+ linux-mod_src_install
+
+ # Add the aliases
+ sed -e 's:\${PACKAGE}:'${PF}':g' ${FILESDIR}/nvidia > ${WORKDIR}/nvidia
+ insinto /etc/modules.d
+ newins ${WORKDIR}/nvidia nvidia
+
+ # Docs
+ dodoc ${S}/../../share/doc/README
+
+ # The device creation script
+ into /
+ newsbin ${S}/makedevices.sh NVmakedevices.sh
+}
+
+pkg_postinst() {
+ if [ "${ROOT}" = "/" ] && \
+ [ ! -e /dev/.devfsd ] && \
+ [ ! -e /dev/.udev ] && \
+ [ -x /sbin/NVmakedevices.sh ]
+ then
+ /sbin/NVmakedevices.sh >/dev/null 2>&1
+ fi
+
+ linux-mod_pkg_postinst
+}