diff options
author | Martin Schlemmer <azarah@gentoo.org> | 2004-12-19 15:52:47 +0000 |
---|---|---|
committer | Martin Schlemmer <azarah@gentoo.org> | 2004-12-19 15:52:47 +0000 |
commit | a1293872d17381bc58405040b491e4f5343f24df (patch) | |
tree | 0823f8aae40ef941305f7b3013f08567a88ec2eb /media-video/nvidia-kernel | |
parent | Version bump. (diff) | |
download | historical-a1293872d17381bc58405040b491e4f5343f24df.tar.gz historical-a1293872d17381bc58405040b491e4f5343f24df.tar.bz2 historical-a1293872d17381bc58405040b491e4f5343f24df.zip |
Update with patches from Zander (http://www.minion.de/files/1.0-6629/)
Diffstat (limited to 'media-video/nvidia-kernel')
11 files changed, 1150 insertions, 22 deletions
diff --git a/media-video/nvidia-kernel/ChangeLog b/media-video/nvidia-kernel/ChangeLog index 2111f9b5da6c..7c9385af8b26 100644 --- a/media-video/nvidia-kernel/ChangeLog +++ b/media-video/nvidia-kernel/ChangeLog @@ -1,6 +1,19 @@ # ChangeLog for media-video/nvidia-kernel # Copyright 2002-2004 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/media-video/nvidia-kernel/ChangeLog,v 1.103 2004/11/30 01:25:56 cyfred Exp $ +# $Header: /var/cvsroot/gentoo-x86/media-video/nvidia-kernel/ChangeLog,v 1.104 2004/12/19 15:52:47 azarah Exp $ + +*nvidia-kernel-1.0.6629-r1 (19 Dec 2004) + + 19 Dec 2004; Martin Schlemmer <azarah@gentoo.org> + +files/1.0.6629/NVIDIA_kernel-1.0-6629-1155389.patch, + +files/1.0.6629/NVIDIA_kernel-1.0-6629-1161283.patch, + +files/1.0.6629/NVIDIA_kernel-1.0-6629-1162524.patch, + +files/1.0.6629/NVIDIA_kernel-1.0-6629-1165235.patch, + +files/1.0.6629/NVIDIA_kernel-1.0-6629-1171869.patch, + +files/1.0.6629/NVIDIA_kernel-1.0-6629-1175225.patch, + +files/1.0.6629/nv-disable-preempt-on-smp_processor_id-2.patch, + +nvidia-kernel-1.0.6629-r1.ebuild: + Update with patches from Zander (http://www.minion.de/files/1.0-6629/) 30 Nov 2004; Andrew Bevitt <cyfred@gentoo.org> +files/nvidia, -files/nvidia-1.1, nvidia-kernel-1.0.6111-r3.ebuild, diff --git a/media-video/nvidia-kernel/Manifest b/media-video/nvidia-kernel/Manifest index af6e817df455..b2c75e3dbe91 100644 --- a/media-video/nvidia-kernel/Manifest +++ b/media-video/nvidia-kernel/Manifest @@ -1,31 +1,31 @@ ------BEGIN PGP SIGNED MESSAGE----- -Hash: SHA1 - -MD5 9e3d151cbb86b10e80feb4e57caf8a51 nvidia-kernel-1.0.6629.ebuild 4640 -MD5 6ec1ac8788c77524bd37df3829654c7f nvidia-kernel-1.0.6111-r3.ebuild 4487 +MD5 4df79e9edfe336694af48da89ad0e462 nvidia-kernel-1.0.6629-r1.ebuild 4851 MD5 dda9732bf59be952f0d0e3e89239096b ChangeLog 26695 +MD5 db3fd16fd2192da06fd9dda5170887af .nvidia-kernel-1.0.6629-r1.ebuild.swp 16384 MD5 c84a79e7d9b69a204003fb8c2dbaad01 metadata.xml 297 -MD5 ed1e098d85579c75542ef0a49ee4dd5c files/digest-nvidia-kernel-1.0.6111-r3 163 -MD5 8a4687b0fc3e7cc0b36c247697d94701 files/digest-nvidia-kernel-1.0.6629 163 +MD5 9e3d151cbb86b10e80feb4e57caf8a51 nvidia-kernel-1.0.6629.ebuild 4640 +MD5 6ec1ac8788c77524bd37df3829654c7f nvidia-kernel-1.0.6111-r3.ebuild 4487 MD5 d8fcf2021aa68584d4a4d9e96b671da0 files/nvidia 501 -MD5 762e6f6e16aa6dd5b2469e99fe8decd3 files/1.0.6111/nv-pci_find_class.patch 2903 -MD5 b5b7f947ffb9e6c19f7457ff7c14d0db files/1.0.6111/conftest_koutput_includes.patch 1082 +MD5 8a4687b0fc3e7cc0b36c247697d94701 files/digest-nvidia-kernel-1.0.6629-r1 163 +MD5 8a4687b0fc3e7cc0b36c247697d94701 files/digest-nvidia-kernel-1.0.6629 163 +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 5177339888e44bb5f4b6124fa5830e7f files/1.0.6111/vmalloc-reserve.patch 542 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 64d76075a90dedc83f1dc971389c910e files/1.0.6629/nv-shutup-warnings.patch 712 -MD5 c3d0a0f59fa6b06a5ee139fb01858287 files/1.0.6629/nv-disable-preempt-on-smp_processor_id.patch 542 +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 c3d0a0f59fa6b06a5ee139fb01858287 files/1.0.6629/nv-disable-preempt-on-smp_processor_id.patch 542 +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 ddeae194df6bb2112d7de723df8d84c2 files/1.0.6629/nv-fix-memory-limit.patch 18398 MD5 0009ccc8f3896f22bad06fd549639072 files/1.0.6629/nv-pgprot-speedup.patch 1518 -MD5 e70739410861defb6bf3d40f2706d554 files/1.0.6629/nv-pgd_offset.patch 3139 MD5 7c9db721d244f6ca709e2b8003ce4e0d files/1.0.6629/nv-vm_flags-no-VM_LOCKED.patch 677 ------BEGIN PGP SIGNATURE----- -Version: GnuPG v1.2.6 (GNU/Linux) - -iD8DBQFBswL5KiUX0BdHiZkRAgmaAJ9oI65QFKUI1wZdYPEL2Ms0LYRhmwCfRD1J -TjWr9Z7f0muTVHplwrRhLOQ= -=4tgu ------END PGP SIGNATURE----- +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 e7162316266722bc8550ecbc2c63023e files/1.0.6629/NVIDIA_kernel-1.0-6629-1175225.patch 1615 +MD5 c3d0a0f59fa6b06a5ee139fb01858287 files/1.0.6629/nv-disable-preempt-on-smp_processor_id-2.patch 542 diff --git a/media-video/nvidia-kernel/files/1.0.6629/NVIDIA_kernel-1.0-6629-1155389.patch b/media-video/nvidia-kernel/files/1.0.6629/NVIDIA_kernel-1.0-6629-1155389.patch new file mode 100644 index 000000000000..ee5707156598 --- /dev/null +++ b/media-video/nvidia-kernel/files/1.0.6629/NVIDIA_kernel-1.0-6629-1155389.patch @@ -0,0 +1,38 @@ +diff -ru usr/src/nv/nv-linux.h usr/src/nv.1155389/nv-linux.h +--- usr/src/nv/nv-linux.h 2004-11-03 22:53:00.000000000 +0100 ++++ usr/src/nv.1155389/nv-linux.h 2004-11-04 11:47:05.000000000 +0100 +@@ -729,12 +729,21 @@ + return order; + } + ++/* mark memory UC-, rather than UC (don't use _PAGE_PWT) */ ++static inline pgprot_t pgprot_noncached_weak(pgprot_t old_prot) ++ { ++ pgprot_t new_prot = old_prot; ++ if (boot_cpu_data.x86 > 3) ++ new_prot = __pgprot(pgprot_val(old_prot) | _PAGE_PCD); ++ return new_prot; ++ } ++ + #if !defined (pgprot_noncached) + static inline pgprot_t pgprot_noncached(pgprot_t old_prot) + { + pgprot_t new_prot = old_prot; + if (boot_cpu_data.x86 > 3) +- new_prot = __pgprot(pgprot_val(old_prot) | _PAGE_PCD); ++ new_prot = __pgprot(pgprot_val(old_prot) | _PAGE_PCD | _PAGE_PWT); + return new_prot; + } + #endif +diff -ru usr/src/nv/nv.c usr/src/nv.1155389/nv.c +--- usr/src/nv/nv.c 2004-11-03 22:53:00.000000000 +0100 ++++ usr/src/nv.1155389/nv.c 2004-11-04 11:47:05.000000000 +0100 +@@ -1551,7 +1551,7 @@ + /* NV fb space */ + else if (IS_FB_OFFSET(nv, NV_VMA_OFFSET(vma), vma->vm_end - vma->vm_start)) + { +- vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); ++ vma->vm_page_prot = pgprot_noncached_weak(vma->vm_page_prot); + if (NV_REMAP_PAGE_RANGE(vma->vm_start, + NV_VMA_OFFSET(vma), + vma->vm_end - vma->vm_start, diff --git a/media-video/nvidia-kernel/files/1.0.6629/NVIDIA_kernel-1.0-6629-1161283.patch b/media-video/nvidia-kernel/files/1.0.6629/NVIDIA_kernel-1.0-6629-1161283.patch new file mode 100644 index 000000000000..21c68a98aeb0 --- /dev/null +++ b/media-video/nvidia-kernel/files/1.0.6629/NVIDIA_kernel-1.0-6629-1161283.patch @@ -0,0 +1,548 @@ +diff -ru usr/src/nv/nv-linux.h usr/src/nv.1161283/nv-linux.h +--- usr/src/nv/nv-linux.h 2004-11-03 22:53:00.000000000 +0100 ++++ usr/src/nv.1161283/nv-linux.h 2004-11-16 22:56:41.000000000 +0100 +@@ -429,6 +429,30 @@ + free_pages(ptr, order); \ + } + ++#define NV_KMEM_CACHE_CREATE(kmem_cache, name, type) \ ++ { \ ++ kmem_cache = kmem_cache_create(name, sizeof(type), \ ++ 0, 0, NULL, NULL); \ ++ } ++ ++#define NV_KMEM_CACHE_DESTROY(kmem_cache) \ ++ { \ ++ kmem_cache_destroy(kmem_cache); \ ++ kmem_cache = NULL; \ ++ } ++ ++#define NV_KMEM_CACHE_ALLOC(ptr, kmem_cache, type) \ ++ { \ ++ (ptr) = kmem_cache_alloc(kmem_cache, GFP_KERNEL); \ ++ KM_ALLOC_RECORD(ptr, sizeof(type), "km_cache_alloc"); \ ++ } ++ ++#define NV_KMEM_CACHE_FREE(ptr, type, kmem_cache) \ ++ { \ ++ KM_FREE_RECORD(ptr, sizeof(type), "km_cache_free"); \ ++ kmem_cache_free(kmem_cache, ptr); \ ++ } ++ + #endif /* !defined NVWATCH */ + + +@@ -776,6 +800,9 @@ + unsigned long phys_addr; + unsigned long virt_addr; + dma_addr_t dma_addr; ++#ifdef NV_SG_MAP_BUFFERS ++ struct scatterlist sg_list; ++#endif + #ifdef CONFIG_SWIOTLB + unsigned long orig_phys_addr; + unsigned long orig_virt_addr; +@@ -789,15 +816,11 @@ + unsigned int num_pages; + unsigned int order; + unsigned int size; +- nv_pte_t *page_table; /* list of physical pages allocated */ ++ nv_pte_t **page_table; /* list of physical pages allocated */ + void *key_mapping; /* mapping used as a key for finding this nv_alloc_t */ + /* may be the same as page_table */ + unsigned int class; + void *priv_data; +-#if defined(NV_SG_MAP_BUFFERS) +- struct pci_dev *dev; +- struct scatterlist *sg_list; /* list of physical pages allocated */ +-#endif + } nv_alloc_t; + + +diff -ru usr/src/nv/nv-vm.c usr/src/nv.1161283/nv-vm.c +--- usr/src/nv/nv-vm.c 2004-11-03 22:53:00.000000000 +0100 ++++ usr/src/nv.1161283/nv-vm.c 2004-11-16 22:56:41.000000000 +0100 +@@ -138,13 +138,18 @@ + */ + + int nv_vm_malloc_pages( +- nv_alloc_t *at ++ nv_state_t *nv, ++ nv_alloc_t *at + ) + { + /* point page_ptr at the start of the actual page list */ +- nv_pte_t *page_ptr = at->page_table; ++ nv_pte_t *page_ptr = *at->page_table; + int i; + unsigned long virt_addr = 0, phys_addr; ++#if defined(NV_SG_MAP_BUFFERS) ++ nv_linux_state_t *nvl = NV_GET_NVL_FROM_NV_STATE(nv); ++ struct pci_dev *dev = nvl->dev; ++#endif + + nv_printf(NV_DBG_MEMINFO, "NVRM: VM: nv_vm_malloc_pages: %d pages\n", + at->num_pages); +@@ -175,7 +180,7 @@ + // for amd 64-bit platforms, remap pages to make them 32-bit addressable + // in this case, we need the final remapping to be contiguous, so we + // have to do the whole mapping at once, instead of page by page +- if (nv_sg_map_buffer(at->dev, &at->sg_list[0], ++ if (nv_sg_map_buffer(dev, &at->page_table[0]->sg_list, + (void *) virt_addr, at->num_pages)) + { + nv_printf(NV_DBG_ERRORS, +@@ -224,7 +229,7 @@ + /* lock the page for dma purposes */ + SetPageReserved(NV_GET_PAGE_STRUCT(phys_addr)); + +- page_ptr = &at->page_table[i]; ++ page_ptr = at->page_table[i]; + page_ptr->phys_addr = phys_addr; + page_ptr->virt_addr = virt_addr; + page_ptr->dma_addr = page_ptr->phys_addr; +@@ -235,7 +240,7 @@ + #if defined(NV_SG_MAP_BUFFERS) + if (!NV_ALLOC_MAPPING_CONTIG(at->flags)) + { +- if (nv_sg_map_buffer(at->dev, &at->sg_list[i], ++ if (nv_sg_map_buffer(dev, &at->page_table[i]->sg_list, + __va(page_ptr->phys_addr), 1)) + { + nv_printf(NV_DBG_ERRORS, +@@ -243,7 +248,7 @@ + goto failed; + } + } +- nv_sg_load(&at->sg_list[i], page_ptr); ++ nv_sg_load(&at->page_table[i]->sg_list, page_ptr); + #endif + virt_addr += PAGE_SIZE; + } +@@ -258,7 +263,7 @@ + + for (; i >= 0; i--) + { +- page_ptr = &at->page_table[i]; ++ page_ptr = at->page_table[i]; + + // if we failed when allocating this page, skip over it + // but if we failed pci_map_sg, make sure to free this page +@@ -267,7 +272,7 @@ + NV_UNLOCK_PAGE(page_ptr); + #if defined(NV_SG_MAP_BUFFERS) + if (!NV_ALLOC_MAPPING_CONTIG(at->flags)) +- nv_sg_unmap_buffer(at->dev, &at->sg_list[i], page_ptr); ++ nv_sg_unmap_buffer(dev, &at->page_table[i]->sg_list, page_ptr); + #endif + if (!NV_ALLOC_MAPPING_CACHED(at->flags)) + NV_SET_PAGE_ATTRIB_CACHED(page_ptr); +@@ -279,15 +284,15 @@ + + if (NV_ALLOC_MAPPING_CONTIG(at->flags)) + { +- page_ptr = at->page_table; ++ page_ptr = *at->page_table; + #if defined(NV_SG_MAP_BUFFERS) +- nv_sg_unmap_buffer(at->dev, &at->sg_list[0], page_ptr); ++ nv_sg_unmap_buffer(dev, &at->page_table[0]->sg_list, page_ptr); + #endif + NV_FREE_PAGES(page_ptr->virt_addr, at->order); + } + else if (NV_ALLOC_MAPPING_VMALLOC(at->flags)) + { +- page_ptr = at->page_table; ++ page_ptr = *at->page_table; + NV_VFREE((void *) page_ptr->virt_addr, at->size); + } + +@@ -296,7 +301,7 @@ + + // unlock the pages we've locked down for dma purposes + void nv_vm_unlock_pages( +- nv_alloc_t *at ++ nv_alloc_t *at + ) + { + nv_pte_t *page_ptr; +@@ -315,17 +320,22 @@ + + for (i = 0; i < at->num_pages; i++) + { +- page_ptr = &at->page_table[i]; ++ page_ptr = at->page_table[i]; + NV_UNLOCK_PAGE(page_ptr); + } + } + + void nv_vm_free_pages( +- nv_alloc_t *at ++ nv_state_t *nv, ++ nv_alloc_t *at + ) + { + nv_pte_t *page_ptr; + int i; ++#if defined(NV_SG_MAP_BUFFERS) ++ nv_linux_state_t *nvl = NV_GET_NVL_FROM_NV_STATE(nv); ++ struct pci_dev *dev = nvl->dev; ++#endif + + nv_printf(NV_DBG_MEMINFO, "NVRM: VM: nv_vm_free_pages: %d pages\n", + at->num_pages); +@@ -339,10 +349,10 @@ + + for (i = 0; i < at->num_pages; i++) + { +- page_ptr = &at->page_table[i]; ++ page_ptr = at->page_table[i]; + #if defined(NV_SG_MAP_BUFFERS) + if (!NV_ALLOC_MAPPING_CONTIG(at->flags)) +- nv_sg_unmap_buffer(at->dev, &at->sg_list[i], page_ptr); ++ nv_sg_unmap_buffer(dev, &at->page_table[i]->sg_list, page_ptr); + #endif + if (!NV_ALLOC_MAPPING_CACHED(at->flags)) + NV_SET_PAGE_ATTRIB_CACHED(page_ptr); +@@ -353,15 +363,15 @@ + + if (NV_ALLOC_MAPPING_CONTIG(at->flags)) + { +- page_ptr = at->page_table; ++ page_ptr = *at->page_table; + #if defined(NV_SG_MAP_BUFFERS) +- nv_sg_unmap_buffer(at->dev, &at->sg_list[0], page_ptr); ++ nv_sg_unmap_buffer(dev, &at->page_table[0]->sg_list, page_ptr); + #endif + NV_FREE_PAGES(page_ptr->virt_addr, at->order); + } + else if (NV_ALLOC_MAPPING_VMALLOC(at->flags)) + { +- page_ptr = at->page_table; ++ page_ptr = *at->page_table; + NV_VFREE((void *) page_ptr->virt_addr, at->size); + } + } +diff -ru usr/src/nv/nv-vm.h usr/src/nv.1161283/nv-vm.h +--- usr/src/nv/nv-vm.h 2004-11-03 22:53:00.000000000 +0100 ++++ usr/src/nv.1161283/nv-vm.h 2004-11-16 22:56:41.000000000 +0100 +@@ -11,9 +11,9 @@ + #ifndef _NV_VM_H_ + #define _NV_VM_H_ + +-int nv_vm_malloc_pages(nv_alloc_t *); ++int nv_vm_malloc_pages(nv_state_t *, nv_alloc_t *); + void nv_vm_unlock_pages(nv_alloc_t *); +-void nv_vm_free_pages(nv_alloc_t *); ++void nv_vm_free_pages(nv_state_t *, nv_alloc_t *); + + #if defined(NV_DBG_MEM) + void nv_vm_list_page_count(nv_pte_t *, unsigned long); +@@ -21,11 +21,12 @@ + #define nv_vm_list_page_count(page_ptr, num_pages) + #endif + +-#define nv_vm_unlock_and_free_pages(at_count, at) \ +- if (at->page_table) { \ +- if (at_count == 0) \ +- nv_vm_unlock_pages(at); \ +- nv_vm_free_pages(at); \ ++#define NV_VM_UNLOCK_AND_FREE_PAGES(nv, at_count, at) \ ++ if (at->page_table) \ ++ { \ ++ if (at_count == 0) \ ++ nv_vm_unlock_pages(at); \ ++ nv_vm_free_pages(nv, at); \ + } + + #endif +diff -ru usr/src/nv/nv.c usr/src/nv.1161283/nv.c +--- usr/src/nv/nv.c 2004-11-03 22:53:00.000000000 +0100 ++++ usr/src/nv.1161283/nv.c 2004-11-16 22:57:24.000000000 +0100 +@@ -63,6 +63,8 @@ + int nv_swiotlb = 0; + #endif + ++static kmem_cache_t *nv_pte_t_cache = NULL; ++ + // allow an easy way to convert all debug printfs related to events + // back and forth between 'info' and 'errors' + #if defined(NV_DBG_EVENTS) +@@ -266,42 +268,41 @@ + ) + { + nv_alloc_t *at; +- int pt_size; ++ unsigned int pt_size, i; + + NV_KMALLOC(at, sizeof(nv_alloc_t)); + if (at == NULL) + { +- nv_printf(NV_DBG_ERRORS, "NVRM: failed to allocate alloc_t\n"); ++ nv_printf(NV_DBG_ERRORS, "NVRM: failed to allocate alloc info\n"); + return NULL; + } + + memset(at, 0, sizeof(nv_alloc_t)); + +- pt_size = num_pages * sizeof(nv_pte_t); +- NV_KMALLOC(at->page_table, pt_size); +- if (at->page_table == NULL) ++ pt_size = num_pages * sizeof(nv_pte_t *); ++ if (os_alloc_mem((void **)&at->page_table, pt_size) != RM_OK) + { + nv_printf(NV_DBG_ERRORS, "NVRM: failed to allocate page table\n"); + NV_KFREE(at, sizeof(nv_alloc_t)); + return NULL; + } ++ + memset(at->page_table, 0, pt_size); + at->num_pages = num_pages; + NV_ATOMIC_SET(at->usage_count, 0); + +-#if defined(NV_SG_MAP_BUFFERS) +- at->dev = dev; +- pt_size = num_pages * sizeof(struct scatterlist); +- NV_KMALLOC(at->sg_list, pt_size); +- if (at->sg_list == NULL) ++ for (i = 0; i < at->num_pages; i++) + { +- nv_printf(NV_DBG_ERRORS, "NVRM: failed to allocate scatter gather list\n"); +- NV_KFREE(at->page_table, pt_size); +- NV_KFREE(at, sizeof(nv_alloc_t)); +- return NULL; ++ NV_KMEM_CACHE_ALLOC(at->page_table[i], nv_pte_t_cache, nv_pte_t); ++ if (at->page_table[i] == NULL) ++ { ++ nv_printf(NV_DBG_ERRORS, ++ "NVRM: failed to allocate page table entry\n"); ++ nvos_free_alloc(at); ++ return NULL; ++ } ++ memset(at->page_table[i], 0, sizeof(nv_pte_t)); + } +- memset(at->sg_list, 0, pt_size); +-#endif + + return at; + } +@@ -311,6 +312,8 @@ + nv_alloc_t *at + ) + { ++ unsigned int pt_size, i; ++ + if (at == NULL) + return -1; + +@@ -320,13 +323,16 @@ + // we keep the page_table around after freeing the pages + // for bookkeeping reasons. Free the page_table and assume + // the underlying pages are already unlocked and freed. +- if (at->page_table) +- NV_KFREE(at->page_table, at->num_pages * sizeof(nv_pte_t)); +- +-#if defined(NV_SG_MAP_BUFFERS) +- if (at->sg_list) +- NV_KFREE(at->sg_list, at->num_pages * sizeof(struct scatterlist)); +-#endif ++ if (at->page_table != NULL) ++ { ++ for (i = 0; i < at->num_pages; i++) ++ { ++ if (at->page_table[i] != NULL) ++ NV_KMEM_CACHE_FREE(at->page_table[i], nv_pte_t, nv_pte_t_cache); ++ } ++ pt_size = at->num_pages * sizeof(nv_pte_t *); ++ os_free_mem(at->page_table); ++ } + + NV_KFREE(at, sizeof(nv_alloc_t)); + +@@ -594,7 +600,7 @@ + int i; + for (i = 0; i < at->num_pages; i++) + { +- unsigned long offset = at->page_table[i].phys_addr; ++ unsigned long offset = at->page_table[i]->phys_addr; + if ((address >= offset) && + (address < (offset + PAGE_SIZE))) + return at; +@@ -931,6 +937,13 @@ + } + #endif + ++ NV_KMEM_CACHE_CREATE(nv_pte_t_cache, "nv_pte_t", nv_pte_t); ++ if (nv_pte_t_cache == NULL) ++ { ++ nv_printf(NV_DBG_ERRORS, "NVRM: pte cache allocation failed\n"); ++ goto failed; ++ } ++ + // Init the resource manager + if (!rm_init_rm()) + { +@@ -972,6 +985,14 @@ + return 0; + + failed: ++ if (nv_pte_t_cache != NULL) ++ NV_KMEM_CACHE_DESTROY(nv_pte_t_cache); ++ ++#if defined(NV_PM_SUPPORT_APM) ++ for (i = 0; i < num_nv_devices; i++) ++ if (apm_nv_dev[i] != NULL) pm_unregister(apm_nv_dev[i]); ++#endif ++ + #ifdef CONFIG_DEVFS_FS + NV_DEVFS_REMOVE_CONTROL(); + for (i = 0; i < num_nv_devices; i++) +@@ -1101,6 +1122,8 @@ + nv_printf(NV_DBG_ERRORS, "NVRM: final mem usage: vm 0x%x km 0x%x fp 0x%x\n", + vm_usage, km_usage, fp_usage); + #endif ++ ++ NV_KMEM_CACHE_DESTROY(nv_pte_t_cache); + } + + module_init(nvidia_init_module); +@@ -1249,15 +1272,15 @@ + index = (address - vma->vm_start)>>PAGE_SHIFT; + + // save that index into our page list (make sure it doesn't already exist) +- if (at->page_table[index].phys_addr) ++ if (at->page_table[index]->phys_addr) + { + nv_printf(NV_DBG_ERRORS, "NVRM: page slot already filled in nopage handler!\n"); + os_dbg_breakpoint(); + } + +- at->page_table[index].phys_addr = (page_to_pfn(page_ptr) << PAGE_SHIFT); +- at->page_table[index].dma_addr = (page_to_pfn(page_ptr) << PAGE_SHIFT); +- at->page_table[index].virt_addr = (unsigned long) __va(page_to_pfn(page_ptr) << PAGE_SHIFT); ++ at->page_table[index]->phys_addr = (page_to_pfn(page_ptr) << PAGE_SHIFT); ++ at->page_table[index]->dma_addr = (page_to_pfn(page_ptr) << PAGE_SHIFT); ++ at->page_table[index]->virt_addr = (unsigned long) __va(page_to_pfn(page_ptr) << PAGE_SHIFT); + + return page_ptr; + #endif +@@ -1670,7 +1693,7 @@ + start = vma->vm_start; + while (pages--) + { +- page = (unsigned long) at->page_table[i++].phys_addr; ++ page = (unsigned long) at->page_table[i++]->phys_addr; + if (NV_REMAP_PAGE_RANGE(start, page, PAGE_SIZE, vma->vm_page_prot)) + return -EAGAIN; + start += PAGE_SIZE; +@@ -2368,8 +2391,8 @@ + + for (i = 0; i < at->num_pages; i++) + { +- if (address == at->page_table[i].phys_addr) +- return (void *)(at->page_table[i].virt_addr + offset); ++ if (address == at->page_table[i]->phys_addr) ++ return (void *)(at->page_table[i]->virt_addr + offset); + } + } + +@@ -2400,8 +2423,8 @@ + + for (i = 0; i < at->num_pages; i++) + { +- if (address == at->page_table[i].phys_addr) +- return (unsigned long)at->page_table[i].dma_addr + offset; ++ if (address == at->page_table[i]->phys_addr) ++ return (unsigned long)at->page_table[i]->dma_addr + offset; + } + } + +@@ -2427,9 +2450,9 @@ + unsigned long address = dma_address & PAGE_MASK; + for (i = 0; i < at->num_pages; i++) + { +- if (address == at->page_table[i].dma_addr) ++ if (address == at->page_table[i]->dma_addr) + { +- return at->page_table[i].phys_addr + offset; ++ return at->page_table[i]->phys_addr + offset; + } + } + } +@@ -2466,7 +2489,7 @@ + int i; + for (i = 0; i < at->num_pages; i++) + { +- if (address == (unsigned long) at->page_table[i].dma_addr) ++ if (address == (unsigned long) at->page_table[i]->dma_addr) + { + return (void *)((unsigned long) at->key_mapping + + (i * PAGE_SIZE)); +@@ -2630,7 +2653,7 @@ + nvl_add_alloc(nvl, at); + } else { + /* use nvidia's nvagp support */ +- if (nv_vm_malloc_pages(at)) ++ if (nv_vm_malloc_pages(nv, at)) + goto failed; + + at->class = class; +@@ -2654,7 +2677,7 @@ + if (rm_status) + { + nvl_remove_alloc(nvl, at); +- nv_vm_unlock_and_free_pages(NV_ATOMIC_READ(at->usage_count), at); ++ NV_VM_UNLOCK_AND_FREE_PAGES(nv, NV_ATOMIC_READ(at->usage_count), at); + goto failed; + } + at->priv_data = *priv_data; +@@ -2666,12 +2689,12 @@ + else + { + +- if (nv_vm_malloc_pages(at)) ++ if (nv_vm_malloc_pages(nv, at)) + goto failed; + + if (kernel) + { +- *pAddress = (void *) at->page_table[0].virt_addr; ++ *pAddress = (void *) at->page_table[0]->virt_addr; + } + else + { +@@ -2679,7 +2702,7 @@ + * so use the first page, which is page-aligned. this way, our + * allocated page table does not need to be page-aligned + */ +- *pAddress = (void *) at->page_table[0].phys_addr; ++ *pAddress = (void *) at->page_table[0]->phys_addr; + } + + nvl_add_alloc(nvl, at); +@@ -2743,7 +2766,7 @@ + rmStatus = rm_free_agp_pages(nv, pAddress, priv_data); + if (rmStatus == RM_OK) + { +- nv_vm_unlock_and_free_pages(NV_ATOMIC_READ(at->usage_count), at); ++ NV_VM_UNLOCK_AND_FREE_PAGES(nv, NV_ATOMIC_READ(at->usage_count), at); + } + } + } else { +@@ -2759,7 +2782,7 @@ + + NV_ATOMIC_DEC(at->usage_count); + +- nv_vm_unlock_and_free_pages(NV_ATOMIC_READ(at->usage_count), at); ++ NV_VM_UNLOCK_AND_FREE_PAGES(nv, NV_ATOMIC_READ(at->usage_count), at); + } + + if (NV_ATOMIC_READ(at->usage_count) == 0) +@@ -3065,7 +3088,7 @@ + } + + /* get the physical address of this page */ +- *paddr = (U032) ((NV_UINTPTR_T)at->page_table[index].dma_addr); ++ *paddr = (U032) ((NV_UINTPTR_T)at->page_table[index]->dma_addr); + + return RM_OK; + } diff --git a/media-video/nvidia-kernel/files/1.0.6629/NVIDIA_kernel-1.0-6629-1162524.patch b/media-video/nvidia-kernel/files/1.0.6629/NVIDIA_kernel-1.0-6629-1162524.patch new file mode 100644 index 000000000000..f6045348b5b6 --- /dev/null +++ b/media-video/nvidia-kernel/files/1.0.6629/NVIDIA_kernel-1.0-6629-1162524.patch @@ -0,0 +1,251 @@ +diff -ru usr/src/nv/nv-linux.h usr/src/nv.1162524/nv-linux.h +--- usr/src/nv/nv-linux.h 2004-11-03 22:53:00.000000000 +0100 ++++ usr/src/nv.1162524/nv-linux.h 2004-12-03 13:04:29.000000000 +0100 +@@ -627,75 +627,136 @@ + #define NV_REMAP_PAGE_RANGE(x...) remap_page_range(x) + #endif + ++ ++#if defined(pml4_offset) ++#define NV_PML4_PGD_OFFSET(address, pml4, kernel) \ ++ ({ \ ++ pgd_t *__pgd; \ ++ if (!kernel) \ ++ __pgd = pml4_pgd_offset(pml4, address); \ ++ else \ ++ __pgd = pml4_pgd_offset_k(pml4, address); \ ++ __pgd; \ ++ }) ++ ++#define NV_PML4_PRESENT(pml4) \ ++ ({ \ ++ if (pml4 != NULL) \ ++ { \ ++ if (pml4_bad(*pml4)) \ ++ { \ ++ pml4_clear(pml4); \ ++ pml4 = NULL; /* mark invalid */ \ ++ } \ ++ else if (pml4_none(*pml4)) \ ++ pml4 = NULL; \ ++ } pml4 != NULL; \ ++ }) ++ ++#define NV_PGD_OFFSET(address, kernel, mm) \ ++ ({ \ ++ pml4_t *__pml4; \ ++ pgd_t *__pgd = NULL; \ ++ if (!kernel) \ ++ __pml4 = pml4_offset(mm, address); \ ++ else \ ++ __pml4 = pml4_offset_k(address); \ ++ if (NV_PML4_PRESENT(__pml4)) \ ++ __pgd = NV_PML4_PGD_OFFSET(address, \ ++ __pml4, kernel); \ ++ __pgd; \ ++ }) ++#else ++#define NV_PGD_OFFSET(address, kernel, mm) \ ++ ({ \ ++ pgd_t *__pgd; \ ++ if (!kernel) \ ++ __pgd = pgd_offset(mm, address); \ ++ else \ ++ __pgd = pgd_offset_k(address); \ ++ __pgd; \ ++ }) ++#endif ++ ++#define NV_PGD_PRESENT(pgd) \ ++ ({ \ ++ if ((pgd != NULL) && \ ++ (pgd_bad(*pgd) || pgd_none(*pgd))) \ ++ /* static */ pgd = NULL; \ ++ pgd != NULL; \ ++ }) ++ + #if defined(pmd_offset_map) +-#define NV_PMD_OFFSET(addres, pg_dir, pg_mid_dir) \ +- { \ +- pg_mid_dir = pmd_offset_map(pg_dir, address); \ +- } +-#define NV_PMD_UNMAP(pg_mid_dir) \ +- { \ +- pmd_unmap(pg_mid_dir); \ +- } ++#define NV_PMD_OFFSET(address, pgd) \ ++ ({ \ ++ pmd_t *__pmd; \ ++ __pmd = pmd_offset_map(pgd, address); \ ++ }) ++#define NV_PMD_UNMAP(pmd) pmd_unmap(pmd); + #else +-#define NV_PMD_OFFSET(addres, pg_dir, pg_mid_dir) \ +- { \ +- pg_mid_dir = pmd_offset(pg_dir, address); \ +- } +-#define NV_PMD_UNMAP(pg_mid_dir) ++#define NV_PMD_OFFSET(address, pgd) \ ++ ({ \ ++ pmd_t *__pmd; \ ++ __pmd = pmd_offset(pgd, address); \ ++ }) ++#define NV_PMD_UNMAP(pmd) + #endif + +-#define NV_PMD_PRESENT(pg_mid_dir) \ +- ({ \ +- if ( (pg_mid_dir) && (pmd_none(*pg_mid_dir))) { \ +- NV_PMD_UNMAP(pg_mid_dir); pg_mid_dir = NULL; \ +- } pg_mid_dir != NULL; \ ++#define NV_PMD_PRESENT(pmd) \ ++ ({ \ ++ if ((pmd != NULL) && \ ++ (pmd_bad(*pmd) || pmd_none(*pmd))) \ ++ { \ ++ NV_PMD_UNMAP(pmd); \ ++ pmd = NULL; /* mark invalid */ \ ++ } \ ++ pmd != NULL; \ + }) + + #if defined(pte_offset_atomic) +-#define NV_PTE_OFFSET(addres, pg_mid_dir, pte) \ +- { \ +- pte = pte_offset_atomic(pg_mid_dir, address); \ +- NV_PMD_UNMAP(pg_mid_dir); \ +- } +-#define NV_PTE_UNMAP(pte) \ +- { \ +- pte_kunmap(pte); \ +- } ++#define NV_PTE_OFFSET(address, pmd) \ ++ ({ \ ++ pte_t *__pte; \ ++ __pte = pte_offset_atomic(pmd, address); \ ++ NV_PMD_UNMAP(pmd); __pte; \ ++ }) ++#define NV_PTE_UNMAP(pte) pte_kunmap(pte); + #elif defined(pte_offset) +-#define NV_PTE_OFFSET(addres, pg_mid_dir, pte) \ +- { \ +- pte = pte_offset(pg_mid_dir, address); \ +- NV_PMD_UNMAP(pg_mid_dir); \ +- } ++#define NV_PTE_OFFSET(address, pmd) \ ++ ({ \ ++ pte_t *__pte; \ ++ __pte = pte_offset(pmd, address); \ ++ NV_PMD_UNMAP(pmd); __pte; \ ++ }) + #define NV_PTE_UNMAP(pte) + #else +-#define NV_PTE_OFFSET(addres, pg_mid_dir, pte) \ +- { \ +- pte = pte_offset_map(pg_mid_dir, address); \ +- NV_PMD_UNMAP(pg_mid_dir); \ +- } +-#define NV_PTE_UNMAP(pte) \ +- { \ +- pte_unmap(pte); \ +- } ++#define NV_PTE_OFFSET(address, pmd) \ ++ ({ \ ++ pte_t *__pte; \ ++ __pte = pte_offset_map(pmd, address); \ ++ NV_PMD_UNMAP(pmd); __pte; \ ++ }) ++#define NV_PTE_UNMAP(pte) pte_unmap(pte); + #endif + +-#define NV_PTE_PRESENT(pte) \ +- ({ \ +- if (pte) { \ +- if (!pte_present(*pte)) { \ +- NV_PTE_UNMAP(pte); pte = NULL; \ +- } \ +- } pte != NULL; \ +- }) +- +-#define NV_PTE_VALUE(pte) \ +- ({ \ +- unsigned long __pte_value = pte_val(*pte); \ +- NV_PTE_UNMAP(pte); \ +- __pte_value; \ ++#define NV_PTE_PRESENT(pte) \ ++ ({ \ ++ if ((pte != NULL) && !pte_present(*pte)) \ ++ { \ ++ NV_PTE_UNMAP(pte); \ ++ pte = NULL; /* mark invalid */ \ ++ } \ ++ pte != NULL; \ + }) + ++#define NV_PTE_VALUE(pte) \ ++ ({ \ ++ unsigned long __pte_value = pte_val(*pte); \ ++ NV_PTE_UNMAP(pte); \ ++ __pte_value; \ ++ }) ++ ++ + #define NV_PAGE_ALIGN(addr) ( ((addr) + PAGE_SIZE - 1) / PAGE_SIZE) + #define NV_MASK_OFFSET(addr) ( (addr) & (PAGE_SIZE - 1) ) + +diff -ru usr/src/nv/nv-vm.c usr/src/nv.1162524/nv-vm.c +--- usr/src/nv/nv-vm.c 2004-11-03 22:53:00.000000000 +0100 ++++ usr/src/nv.1162524/nv-vm.c 2004-12-03 13:04:34.000000000 +0100 +@@ -53,12 +53,13 @@ + * conflicts. we try to rely on the kernel's provided interfaces when possible, + * but need additional flushing on earlier kernels. + */ +- ++#if defined(KERNEL_2_4) + /* wrap CACHE_FLUSH so we can pass it to smp_call_function */ + static void cache_flush(void *p) + { + CACHE_FLUSH(); + } ++#endif + + /* + * 2.4 kernels handle flushing in the change_page_attr() call, but kernels +diff -ru usr/src/nv/nv.c usr/src/nv.1162524/nv.c +--- usr/src/nv/nv.c 2004-11-03 22:53:00.000000000 +0100 ++++ usr/src/nv.1162524/nv.c 2004-12-03 13:04:37.000000000 +0100 +@@ -2492,26 +2492,23 @@ + ) + { + struct mm_struct *mm; +- pgd_t *pg_dir; +- pmd_t *pg_mid_dir; +- pte_t *pte; ++ pgd_t *pgd = NULL; ++ pmd_t *pmd = NULL; ++ pte_t *pte = NULL; + unsigned long retval; + + mm = (kern) ? &init_mm : current->mm; + spin_lock(&mm->page_table_lock); + +- if (kern) pg_dir = pgd_offset_k(address); +- else pg_dir = pgd_offset(mm, address); +- +- if (!pg_dir || pgd_none(*pg_dir)) ++ pgd = NV_PGD_OFFSET(address, kern, mm); ++ if (!NV_PGD_PRESENT(pgd)) + goto failed; + +- NV_PMD_OFFSET(address, pg_dir, pg_mid_dir); +- if (!NV_PMD_PRESENT(pg_mid_dir)) ++ pmd = NV_PMD_OFFSET(address, pgd); ++ if (!NV_PMD_PRESENT(pmd)) + goto failed; + +- NV_PTE_OFFSET(address, pg_mid_dir, pte); +- ++ pte = NV_PTE_OFFSET(address, pmd); + if (!NV_PTE_PRESENT(pte)) + goto failed; + diff --git a/media-video/nvidia-kernel/files/1.0.6629/NVIDIA_kernel-1.0-6629-1165235.patch b/media-video/nvidia-kernel/files/1.0.6629/NVIDIA_kernel-1.0-6629-1165235.patch new file mode 100644 index 000000000000..ca8b2cb1314b --- /dev/null +++ b/media-video/nvidia-kernel/files/1.0.6629/NVIDIA_kernel-1.0-6629-1165235.patch @@ -0,0 +1,15 @@ +diff -ru usr/src/nv/nv.c usr/src/nv.1165235/nv.c +--- usr/src/nv/nv.c 2004-11-03 22:53:00.000000000 +0100 ++++ usr/src/nv.1165235/nv.c 2004-11-25 16:45:04.000000000 +0100 +@@ -1604,9 +1604,8 @@ + } + nv_vm_list_page_count(at->page_table, at->num_pages); + +- /* prevent the swapper from swapping it out */ +- /* mark the memory i/o so the buffers aren't dumped on core dumps */ +- vma->vm_flags |= (VM_LOCKED | VM_IO); ++ // mark it as IO so that we don't dump it on core dump ++ vma->vm_flags |= VM_IO; + } + + /* Magic allocator */ diff --git a/media-video/nvidia-kernel/files/1.0.6629/NVIDIA_kernel-1.0-6629-1171869.patch b/media-video/nvidia-kernel/files/1.0.6629/NVIDIA_kernel-1.0-6629-1171869.patch new file mode 100644 index 000000000000..3fbc404aef51 --- /dev/null +++ b/media-video/nvidia-kernel/files/1.0.6629/NVIDIA_kernel-1.0-6629-1171869.patch @@ -0,0 +1,41 @@ +diff -ru usr/src/nv/nv-linux.h usr/src/nv.1171869/nv-linux.h +--- usr/src/nv/nv-linux.h 2004-11-03 22:53:00.000000000 +0100 ++++ usr/src/nv.1171869/nv-linux.h 2004-12-03 11:34:45.000000000 +0100 +@@ -480,12 +480,22 @@ + #define NV_PCI_RESOURCE_SIZE(dev, bar) ((dev)->resource[(bar) - 1].end - (dev)->resource[(bar) - 1].start + 1) + + #define NV_PCI_BUS_NUMBER(dev) (dev)->bus->number +-#define NV_PCI_SLOT_NUMBER(dev) PCI_SLOT((dev)->devfn) ++#define NV_PCI_DEVFN(dev) (dev)->devfn ++#define NV_PCI_SLOT_NUMBER(dev) PCI_SLOT(NV_PCI_DEVFN(dev)) + + #ifdef NV_PCI_GET_CLASS_PRESENT + #define NV_PCI_DEV_PUT(dev) pci_dev_put(dev) + #define NV_PCI_GET_DEVICE(vendor,device,from) pci_get_device(vendor,device,from) +-#define NV_PCI_GET_SLOT(bus,devfn) pci_get_slot(pci_find_bus(0,bus),devfn) ++#define NV_PCI_GET_SLOT(bus,devfn) \ ++ ({ \ ++ struct pci_dev *__dev = NULL; \ ++ while ((__dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, __dev))) \ ++ { \ ++ if (NV_PCI_BUS_NUMBER(__dev) == bus \ ++ && NV_PCI_DEVFN(__dev) == devfn) break; \ ++ } \ ++ __dev; \ ++ }) + #define NV_PCI_GET_CLASS(class,from) pci_get_class(class,from) + #else + #define NV_PCI_DEV_PUT(dev) +diff -ru usr/src/nv/os-interface.c usr/src/nv.1171869/os-interface.c +--- usr/src/nv/os-interface.c 2004-11-03 22:53:00.000000000 +0100 ++++ usr/src/nv.1171869/os-interface.c 2004-12-03 11:34:51.000000000 +0100 +@@ -866,7 +866,8 @@ + ) + { + struct pci_dev *dev; +- dev = NV_PCI_GET_SLOT(bus, PCI_DEVFN(slot, function)); ++ unsigned int devfn = PCI_DEVFN(slot, function); ++ dev = NV_PCI_GET_SLOT(bus, devfn); + if (dev) { + if (vendor) *vendor = dev->vendor; + if (device) *device = dev->device; diff --git a/media-video/nvidia-kernel/files/1.0.6629/NVIDIA_kernel-1.0-6629-1175225.patch b/media-video/nvidia-kernel/files/1.0.6629/NVIDIA_kernel-1.0-6629-1175225.patch new file mode 100644 index 000000000000..1c6ca8c804ba --- /dev/null +++ b/media-video/nvidia-kernel/files/1.0.6629/NVIDIA_kernel-1.0-6629-1175225.patch @@ -0,0 +1,52 @@ +diff -ru usr/src/nv/nv-linux.h usr/src/nv.1175225/nv-linux.h +--- usr/src/nv/nv-linux.h 2004-11-03 22:53:00.000000000 +0100 ++++ usr/src/nv.1175225/nv-linux.h 2004-12-08 22:13:42.000000000 +0100 +@@ -533,6 +533,7 @@ + */ + #if defined(CONFIG_SWIOTLB) + #define NV_SWIOTLB 1 ++#define NV_SWIOTLB_MAX_RETRIES 16 + extern int nv_swiotlb; + #endif + +@@ -950,10 +951,40 @@ + sg_ptr->offset = (unsigned long)base & ~PAGE_MASK; + sg_ptr->length = num_pages * PAGE_SIZE; + ++#if defined(NV_SWIOTLB) ++ i = NV_SWIOTLB_MAX_RETRIES; ++ do { ++ if (pci_map_sg(dev, sg_ptr, 1, PCI_DMA_BIDIRECTIONAL) == 0) ++ return 1; ++ ++ if (sg_ptr->dma_address & ~PAGE_MASK) ++ { ++ struct scatterlist sg_tmp; ++ pci_unmap_sg(dev, sg_ptr, num_pages, PCI_DMA_BIDIRECTIONAL); ++ ++ memset(&sg_tmp, 0, sizeof(struct scatterlist)); ++ sg_tmp.page = sg_ptr->page; ++ sg_tmp.offset = sg_ptr->offset; ++ sg_tmp.length = 2048; ++ ++ if (pci_map_sg(dev, &sg_tmp, 1, PCI_DMA_BIDIRECTIONAL) == 0) ++ return 1; ++ ++ if (pci_map_sg(dev, sg_ptr, 1, PCI_DMA_BIDIRECTIONAL) == 0) ++ { ++ pci_unmap_sg(dev, &sg_tmp, num_pages, PCI_DMA_BIDIRECTIONAL); ++ return 1; ++ } ++ ++ pci_unmap_sg(dev, &sg_tmp, num_pages, PCI_DMA_BIDIRECTIONAL); ++ } ++ } while (i-- && sg_ptr->dma_address & ~PAGE_MASK); ++#else + if (pci_map_sg(dev, sg_ptr, 1, PCI_DMA_BIDIRECTIONAL) == 0) + { + return 1; + } ++#endif + + NV_FIXUP_SWIOTLB_VIRT_ADDR_BUG(sg_ptr->dma_address); + diff --git a/media-video/nvidia-kernel/files/1.0.6629/nv-disable-preempt-on-smp_processor_id-2.patch b/media-video/nvidia-kernel/files/1.0.6629/nv-disable-preempt-on-smp_processor_id-2.patch new file mode 100644 index 000000000000..bba01249cecf --- /dev/null +++ b/media-video/nvidia-kernel/files/1.0.6629/nv-disable-preempt-on-smp_processor_id-2.patch @@ -0,0 +1,20 @@ +--- 1/nv/nv.c 2004-12-19 17:08:46.000000000 +0200 ++++ 2/nv/nv.c 2004-12-19 17:09:07.000000000 +0200 +@@ -2821,7 +2821,7 @@ void NV_API_CALL nv_lock_rm( + nv_linux_state_t *nvl = NV_GET_NVL_FROM_NV_STATE(nv); + NO_COMPILER_WARNINGS(nvl); + +- if (nvl->rm_lock_cpu == smp_processor_id()) ++ if (nvl->rm_lock_cpu == _smp_processor_id()) + { + nvl->rm_lock_count++; + return; +@@ -2830,7 +2830,7 @@ void NV_API_CALL nv_lock_rm( + spin_unlock_wait(&nvl->rm_lock); + spin_lock_irq(&nvl->rm_lock); + +- nvl->rm_lock_cpu = smp_processor_id(); ++ nvl->rm_lock_cpu = _smp_processor_id(); + nvl->rm_lock_count = 1; + } + diff --git a/media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.6629-r1 b/media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.6629-r1 new file mode 100644 index 000000000000..9324510b4ef9 --- /dev/null +++ b/media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.6629-r1 @@ -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-r1.ebuild b/media-video/nvidia-kernel/nvidia-kernel-1.0.6629-r1.ebuild new file mode 100644 index 000000000000..7bf6235bbd07 --- /dev/null +++ b/media-video/nvidia-kernel/nvidia-kernel-1.0.6629-r1.ebuild @@ -0,0 +1,148 @@ +# Copyright 1999-2004 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-r1.ebuild,v 1.1 2004/12/19 15:52:47 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() { + # 2.6.10_rc1-mm{1,2,3} all EXPORT_SYMBOL_GPL the udev functions, this breaks loading + CS="$(grep -c EXPORT_SYMBOL\(class_simple_create\)\; ${KV_DIR}/drivers/base/class_simple.c)" + if [ "${CS}" == "0" ] + then + ewarn "Your current kernel uses EXPORT_SYMBOL_GPL() on some methods required by nvidia-kernel." + ewarn "This probably means you are using 2.6.10_rc1-mm*. Please change away from mm-sources until this is" + ewarn "revised and a solution released into the mm branch, development-sources will work." + die "Incompatible kernel export." + fi + + 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 + # Fix a limitation on available video memory bug #71684 + epatch ${FILESDIR}/${PV}/NVIDIA_kernel-1.0-6629-1161283.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 + + + # 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-2.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 +} |