Removing all the masked (deprecated) versions.
authorAndrew Bevitt <cyfred@gentoo.org>
Tue, 30 Nov 2004 00:37:44 +0000 (00:37 +0000)
committerAndrew Bevitt <cyfred@gentoo.org>
Tue, 30 Nov 2004 00:37:44 +0000 (00:37 +0000)
34 files changed:
media-video/nvidia-kernel/ChangeLog
media-video/nvidia-kernel/Manifest
media-video/nvidia-kernel/files/1.0.4363/NVIDIA_kernel-1.0-4363-2.5-20030714.diff [deleted file]
media-video/nvidia-kernel/files/1.0.4496/NVIDIA_kernel-1.0-4496-2.6-20030905.diff [deleted file]
media-video/nvidia-kernel/files/1.0.4496/NVIDIA_kernel-1.0-4496-2.6-20031026.diff [deleted file]
media-video/nvidia-kernel/files/1.0.4496/NVIDIA_kernel-1.0-4496-2.6-pci_name-20030905.diff [deleted file]
media-video/nvidia-kernel/files/1.0.4499/NVIDIA_kernel-1.0-4499-2.6-20031014.diff [deleted file]
media-video/nvidia-kernel/files/1.0.5328/NVIDIA_kernel-1.0-5328-2.4-via-chipset-fix.patch [deleted file]
media-video/nvidia-kernel/files/1.0.5328/NVIDIA_kernel-1.0-5328-2.6-20031226.diff [deleted file]
media-video/nvidia-kernel/files/1.0.5328/NVIDIA_kernel-1.0-5328-2.6-20040105.diff [deleted file]
media-video/nvidia-kernel/files/1.0.5332/NVIDIA-Linux-x86_64-1.0-5332-2.6.diff [deleted file]
media-video/nvidia-kernel/files/1.0.5336/Makefile [deleted file]
media-video/nvidia-kernel/files/1.0.5336/NVIDIA_kernel-1.0-5336-2.6-20040521.patch [deleted file]
media-video/nvidia-kernel/files/1.0.5336/NVIDIA_kernel-1.0-5336-basic-sysfs-support-v2.patch [deleted file]
media-video/nvidia-kernel/files/1.0.5336/NVIDIA_kernel-1.0-5336-basic-sysfs-support.patch [deleted file]
media-video/nvidia-kernel/files/1.0.5336/NVIDIA_kernel-1.0-5336-fix-makefile-for-2.6.patch [deleted file]
media-video/nvidia-kernel/files/1.0.5336/NVIDIA_kernel-1.0-5336-kbuild-koutput-support.patch [deleted file]
media-video/nvidia-kernel/files/1.0.6106/NVIDIA_kernel-1.0-6106-koutput-support.patch [deleted file]
media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.4363-r3 [deleted file]
media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.4496-r3 [deleted file]
media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.4499 [deleted file]
media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.5328-r1 [deleted file]
media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.5332-r1 [deleted file]
media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.5336-r4 [deleted file]
media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.6106-r1 [deleted file]
media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.6111-r2 [deleted file]
media-video/nvidia-kernel/nvidia-kernel-1.0.4363-r3.ebuild [deleted file]
media-video/nvidia-kernel/nvidia-kernel-1.0.4496-r3.ebuild [deleted file]
media-video/nvidia-kernel/nvidia-kernel-1.0.4499.ebuild [deleted file]
media-video/nvidia-kernel/nvidia-kernel-1.0.5328-r1.ebuild [deleted file]
media-video/nvidia-kernel/nvidia-kernel-1.0.5332-r1.ebuild [deleted file]
media-video/nvidia-kernel/nvidia-kernel-1.0.5336-r4.ebuild [deleted file]
media-video/nvidia-kernel/nvidia-kernel-1.0.6106-r1.ebuild [deleted file]
media-video/nvidia-kernel/nvidia-kernel-1.0.6111-r2.ebuild [deleted file]

index 3105b26e1611196f40691716a3cfff5a726b0b89..06c6fd13f37d7e4de4b4223442243d39b6088910 100644 (file)
@@ -1,6 +1,29 @@
 # 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.101 2004/11/28 12:43:20 johnm Exp $
+# $Header: /var/cvsroot/gentoo-x86/media-video/nvidia-kernel/ChangeLog,v 1.102 2004/11/30 00:37:44 cyfred Exp $
+
+  30 Nov 2004; Andrew Bevitt <cyfred@gentoo.org>
+  -files/1.0.4363/NVIDIA_kernel-1.0-4363-2.5-20030714.diff,
+  -files/1.0.4496/NVIDIA_kernel-1.0-4496-2.6-20030905.diff,
+  -files/1.0.4496/NVIDIA_kernel-1.0-4496-2.6-20031026.diff,
+  -files/1.0.4496/NVIDIA_kernel-1.0-4496-2.6-pci_name-20030905.diff,
+  -files/1.0.4499/NVIDIA_kernel-1.0-4499-2.6-20031014.diff,
+  -files/1.0.5328/NVIDIA_kernel-1.0-5328-2.4-via-chipset-fix.patch,
+  -files/1.0.5328/NVIDIA_kernel-1.0-5328-2.6-20031226.diff,
+  -files/1.0.5328/NVIDIA_kernel-1.0-5328-2.6-20040105.diff,
+  -files/1.0.5332/NVIDIA-Linux-x86_64-1.0-5332-2.6.diff,
+  -files/1.0.5336/Makefile,
+  -files/1.0.5336/NVIDIA_kernel-1.0-5336-2.6-20040521.patch,
+  -files/1.0.5336/NVIDIA_kernel-1.0-5336-basic-sysfs-support-v2.patch,
+  -files/1.0.5336/NVIDIA_kernel-1.0-5336-basic-sysfs-support.patch,
+  -files/1.0.5336/NVIDIA_kernel-1.0-5336-fix-makefile-for-2.6.patch,
+  -files/1.0.5336/NVIDIA_kernel-1.0-5336-kbuild-koutput-support.patch,
+  -files/1.0.6106/NVIDIA_kernel-1.0-6106-koutput-support.patch,
+  -nvidia-kernel-1.0.4363-r3.ebuild, -nvidia-kernel-1.0.4496-r3.ebuild,
+  -nvidia-kernel-1.0.4499.ebuild, -nvidia-kernel-1.0.5328-r1.ebuild,
+  -nvidia-kernel-1.0.5332-r1.ebuild, -nvidia-kernel-1.0.5336-r4.ebuild,
+  -nvidia-kernel-1.0.6106-r1.ebuild, -nvidia-kernel-1.0.6111-r2.ebuild:
+  Removing all the masked (deprecated) versions.
 
   28 Nov 2004; John Mylchreest <johnm@gentoo.org> :
   Forgot to update this so doing so now. after adding support for
index 1dd3d512b00e4a746362aac5f54e4177af3a4a43..a89497def10a83fd4c8205c22f4d8ac9ba10fae4 100644 (file)
@@ -1,63 +1,21 @@
------BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA1
-
-MD5 3aaa58176d80f6684f305e8a0240ef2f nvidia-kernel-1.0.6106-r1.ebuild 3623
+MD5 5bc9c55bbc50851ee7e545f62ed2b238 ChangeLog 26407
+MD5 c84a79e7d9b69a204003fb8c2dbaad01 metadata.xml 297
 MD5 20b06fba9299e6dd5c9a81afbbb44385 nvidia-kernel-1.0.6629.ebuild 4401
-MD5 b5275c8797b4ec75716a04c8c9273fa7 nvidia-kernel-1.0.4499.ebuild 4026
-MD5 9fd1bc7f640bcab70de6aecd7a6d5105 nvidia-kernel-1.0.6111-r2.ebuild 4113
-MD5 ca5b83d42ef85a76927ca4372fa527f2 nvidia-kernel-1.0.5332-r1.ebuild 4254
-MD5 629e2c50f2d8d26979decb9e58030ae2 nvidia-kernel-1.0.5328-r1.ebuild 4463
-MD5 3bf6bcd6581fce2df5e410cfc2acba3f nvidia-kernel-1.0.4496-r3.ebuild 4284
 MD5 63a5b30228e33e7d1fc441ad59ca5ea3 nvidia-kernel-1.0.6111-r3.ebuild 6305
-MD5 4e1d103a4e151f53d4bd38b12de4a592 nvidia-kernel-1.0.4363-r3.ebuild 4069
-MD5 1f38007839acacbeb6d04954e991a90c ChangeLog 25036
-MD5 c84a79e7d9b69a204003fb8c2dbaad01 metadata.xml 297
-MD5 4a752bd1eb81a261506593b82daaa8c7 nvidia-kernel-1.0.5336-r4.ebuild 4783
-MD5 497ffcbd6a91ed9447dfdf7b736925bd files/digest-nvidia-kernel-1.0.5328-r1 80
-MD5 cf7b2bb276c568f0f66d10951b4ce3ad files/digest-nvidia-kernel-1.0.5332-r1 83
-MD5 1316f73c0eecd8832bb362a3d5ca4892 files/digest-nvidia-kernel-1.0.5336-r4 80
-MD5 50ffea0f5eb12d252905f379bc7be2d6 files/digest-nvidia-kernel-1.0.6106-r1 163
-MD5 ed1e098d85579c75542ef0a49ee4dd5c files/digest-nvidia-kernel-1.0.6111-r2 163
-MD5 ed1e098d85579c75542ef0a49ee4dd5c files/digest-nvidia-kernel-1.0.6111-r3 163
-MD5 046ed3744551619863faea8c5c83db02 files/digest-nvidia-kernel-1.0.4499 74
 MD5 8a4687b0fc3e7cc0b36c247697d94701 files/digest-nvidia-kernel-1.0.6629 163
-MD5 56ebaa3ba92e9db848baea746a6aef1a files/digest-nvidia-kernel-1.0.4363-r3 74
-MD5 a88479c177f936b6ef19fc73bb39d149 files/digest-nvidia-kernel-1.0.4496-r3 80
+MD5 ed1e098d85579c75542ef0a49ee4dd5c files/digest-nvidia-kernel-1.0.6111-r3 163
 MD5 b6a9c4bdd3961980af4a70f57485d708 files/nvidia-1.1 441
-MD5 f7d7092e9eb9fbe926ff1b8aa9b3f50e files/1.0.4363/NVIDIA_kernel-1.0-4363-2.5-20030714.diff 79485
-MD5 183b64f528e98221291072f12db5859d files/1.0.4496/NVIDIA_kernel-1.0-4496-2.6-pci_name-20030905.diff 608
-MD5 c0f21cb76a7471671ec9665968dfaafb files/1.0.4496/NVIDIA_kernel-1.0-4496-2.6-20031026.diff 81900
-MD5 6d98825a3cf78f4a5ce42d4f4decab89 files/1.0.4496/NVIDIA_kernel-1.0-4496-2.6-20030905.diff 81553
-MD5 c2a29e883336157e1a3e99a0bceca549 files/1.0.4499/NVIDIA_kernel-1.0-4499-2.6-20031014.diff 69389
-MD5 e6571e952e13f13d9910b7ad29eaeb4a files/1.0.5328/NVIDIA_kernel-1.0-5328-2.4-via-chipset-fix.patch 970
-MD5 0d4e20c2320c685caad56e357cff0b0c files/1.0.5328/NVIDIA_kernel-1.0-5328-2.6-20040105.diff 95197
-MD5 f04497fe1a0f76fcc41a93b554072c4a files/1.0.5328/NVIDIA_kernel-1.0-5328-2.6-20031226.diff 77616
-MD5 4c7749ca72483547e15031a2af560415 files/1.0.5332/NVIDIA-Linux-x86_64-1.0-5332-2.6.diff 7216
-MD5 276907ebd8946791398f5f24c27e54c4 files/1.0.5336/NVIDIA_kernel-1.0-5336-basic-sysfs-support-v2.patch 5666
-MD5 6b364c4b64c6de0aea70163850fa3914 files/1.0.5336/Makefile 4410
-MD5 d48d291f79542df558588d1d3575d51c files/1.0.5336/NVIDIA_kernel-1.0-5336-kbuild-koutput-support.patch 1681
-MD5 442f1483c003d291a90dfcc87903b045 files/1.0.5336/NVIDIA_kernel-1.0-5336-2.6-20040521.patch 18711
-MD5 5dc4b9a2463cb459721ae3e642f6239f files/1.0.5336/NVIDIA_kernel-1.0-5336-fix-makefile-for-2.6.patch 886
-MD5 7bf40e44b8f2181a1047ddfd13acd6b3 files/1.0.5336/NVIDIA_kernel-1.0-5336-basic-sysfs-support.patch 5439
-MD5 bc61be48f85d84f91d2035fa3cc92a47 files/1.0.6106/NVIDIA_kernel-1.0-6106-koutput-support.patch 6659
 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 5177339888e44bb5f4b6124fa5830e7f files/1.0.6111/vmalloc-reserve.patch 542
 MD5 b5b7f947ffb9e6c19f7457ff7c14d0db files/1.0.6111/conftest_koutput_includes.patch 1082
 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 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 e70739410861defb6bf3d40f2706d554 files/1.0.6629/nv-pgd_offset.patch 3139
+MD5 0009ccc8f3896f22bad06fd549639072 files/1.0.6629/nv-pgprot-speedup.patch 1518
 MD5 dbf80a2cbaf69a10521429e1b2a7e10c files/1.0.6629/conftest_koutput_includes.patch 1082
 MD5 5aef5c6a394896bbb8392816f6795147 files/1.0.6629/nv-amd64-shutup-warnings.patch 902
+MD5 c3d0a0f59fa6b06a5ee139fb01858287 files/1.0.6629/nv-disable-preempt-on-smp_processor_id.patch 542
 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 64d76075a90dedc83f1dc971389c910e files/1.0.6629/nv-shutup-warnings.patch 712
 MD5 7c9db721d244f6ca709e2b8003ce4e0d files/1.0.6629/nv-vm_flags-no-VM_LOCKED.patch 677
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1.2.6 (GNU/Linux)
-
-iD8DBQFBqcfzKiUX0BdHiZkRApr6AJ4jJcUtDY8WjpHekSN0hYSxQcKdgQCg4C75
-tMXnL9IIIh1bs+yqTF7odCM=
-=vNss
------END PGP SIGNATURE-----
diff --git a/media-video/nvidia-kernel/files/1.0.4363/NVIDIA_kernel-1.0-4363-2.5-20030714.diff b/media-video/nvidia-kernel/files/1.0.4363/NVIDIA_kernel-1.0-4363-2.5-20030714.diff
deleted file mode 100644 (file)
index 40993cd..0000000
+++ /dev/null
@@ -1,2493 +0,0 @@
-diff -ruN NVIDIA_kernel-1.0-4363/Makefile NVIDIA_kernel-1.0-4363-2.5/Makefile
---- NVIDIA_kernel-1.0-4363/Makefile    2003-04-20 03:57:20.000000000 +0200
-+++ NVIDIA_kernel-1.0-4363-2.5/Makefile        1970-01-01 01:00:00.000000000 +0100
-@@ -1,169 +0,0 @@
--# This Makefile is automatically generated; do not edit
--#   Generated on 'builder3.nvidia.com' on Sat Apr 19 17:46:47 PDT 2003
--
--LINUX_MODULE=nv-linux.o
--DEFINES=-D__KERNEL__ -DMODULE -D_LOOSE_KERNEL_NAMES -DNTRM -D_GNU_SOURCE -D_LOOSE_KERNEL_NAMES -D__KERNEL__ -DMODULE  -DNV_MAJOR_VERSION=1 -DNV_MINOR_VERSION=0 -DNV_PATCHLEVEL=4363  -DNV_UNIX   -DNV_LINUX   -DNV_INT64_OK   -DNVCPU_X86     
--INCLUDES=-I.
--
--OBJECTS=nv.o os-agp.o os-interface.o os-registry.o 
--HEADERS=os-agp.h os-interface.h nv-linux.h nv-misc.h nv.h  rmretval.h nvtypes.h  $(VERSION_HDR)
--
--CFLAGS=-Wall -Wimplicit -Wreturn-type -Wswitch -Wformat -Wchar-subscripts -Wparentheses -Wpointer-arith -Wcast-qual -Wno-multichar  -O -MD $(DEFINES) $(INCLUDES) -Wno-cast-qual
--
--RESMAN_KERNEL_MODULE=nv-kernel.o
--
--KERNDIR=/lib/modules/$(shell uname -r)
--
--# check for newer paths. if found, use them, otherwise use old paths
--# these wouldn't work with the gnu make included with rh6.2
--# KERNINC=$(if -d $(KERNDIR)/build, $(KERNDIR)/build/include, /usr/src/linux/include)
--# INSTALLDIR=$(if -d $(KERNDIR)/kernel, $(KERNDIR)/kernel/drivers/video, $(KERNDIR)/video)
--
--# this is slightly more brain-dead, but works..
--ifeq ($(shell if test -d $(KERNDIR)/build; then echo yes; fi),yes)
--KERNINC=$(KERNDIR)/build/include
--else
--KERNINC=/usr/src/linux/include
--endif
--
--ifeq ($(shell if test -d $(KERNDIR)/kernel; then echo yes; fi),yes)
--INSTALLDIR=$(KERNDIR)/kernel/drivers/video
--else
--INSTALLDIR=$(KERNDIR)/video
--endif
--
--ifeq ($(shell echo $(NVDEBUG)),1)
--  ifeq ($(shell test -z $(RMDEBUG) && echo yes),yes)
--    RMDEBUG=1
--  endif
--endif
--
--ifeq ($(shell echo $(RMDEBUG)),1)
--CFLAGS += -DDEBUG -g -fno-common
--endif
--
--# this is just plain wrong, get rid of it
--BROKENDIR=$(KERNDIR)/kernel/video
--
--INSTALL=$(shell which install)
--
--# determine gcc versions used (kernel, nvidia.o)
--module_cc:=$(shell $(CC) -v 2>&1 | tail -1)
--version="^Linux version [^(]* (.*@.*) (\(.*\)) .*"
--kernel_cc:=$(shell cat /proc/version | sed "s/"$(version)"/\1/")
--
--module_cc:=$(shell echo "$(module_cc)" | cut -d ' ' -f 3)
--kernel_cc:=$(shell echo "$(kernel_cc)" | cut -d ' ' -f 3)
--
--# allow specification of alternate include file tree on command line and extra defines
--ifdef SYSINCLUDE
--INCLUDES += -I$(SYSINCLUDE)
--else
--INCLUDES += -I$(KERNINC)
--endif
--
--ifeq ($(shell sh conftest.sh remap_page_range $(INCLUDES)), 5)
--  DEFINES += -DREMAP_PAGE_RANGE_5
--endif
--
--ifeq ($(shell sh conftest.sh remap_page_range $(INCLUDES)), 4)
--  DEFINES += -DREMAP_PAGE_RANGE_4
--endif
--
--DEFINES+=$(EXTRA_DEFINES)
--
--# allow build parameters to be passed in through the environment
--ifdef BUILD_PARAMS
--    DEFINES+=-D$(BUILD_PARAMS)
--endif
--
--VERSION_HDR=nv_compiler.h
--
--all: install
--
--install: package-install
--
--package-install: nvidia.o rmmod-check
--      @if [ `id -ur` != 0 ]; then \
--              echo Please run \"make install\" as root.; \
--      else \
--              if [ -d $(BROKENDIR) ]; then \
--                      rm -f $(BROKENDIR)/NVdriver; \
--                      rmdir --ignore-fail-on-non-empty $(BROKENDIR); \
--              fi && \
--              mkdir -p $(INSTALLDIR) && \
--              rm -f $(INSTALLDIR)/NVdriver && \
--              $(INSTALL) -m 0664 -o root -g root nvidia.o $(INSTALLDIR)/nvidia.o$(O) && \
--              /sbin/depmod -a && \
--              /sbin/modprobe nvidia && \
--              sh makedevices.sh && \
--              echo "nvidia.o installed successfully."; \
--      fi
--
--RMMOD_ERROR=\
--      echo ""; \
--      echo "Unable to remove existing NVIDIA kernel module."; \
--      echo "Please be sure you have exited X before attempting"; \
--      echo "to install the NVIDIA kernel module."; \
--      echo ""; \
--      echo -en "\033[1;31m"; \
--      echo -e  "*** Failed rmmod sanity check. Bailing out! ***"; \
--      echo -en "\033[0m"; \
--      exit 1;
--
--rmmod-check:
--      @if /sbin/lsmod | grep nvidia > /dev/null; then \
--              if ! /sbin/rmmod nvidia > /dev/null; then $(RMMOD_ERROR) fi \
--      fi; \
--      if /sbin/lsmod | grep NVdriver > /dev/null; then \
--              if ! /sbin/rmmod NVdriver > /dev/null; then $(RMMOD_ERROR) fi \
--      fi
--
--gcc-check:
--      @if [ -z $(IGNORE_CC_MISMATCH) ]; then \
--       if [ $(kernel_cc) != $(module_cc) ]; then \
--      echo "                                                           "; \
--      echo "You appear to be compiling the NVIDIA kernel module with   "; \
--      echo "a compiler different from the one that was used to compile "; \
--      echo "the running kernel. This may be perfectly fine, but there  "; \
--      echo "are cases where this can lead to unexpected behaviour and  "; \
--      echo "system crashes.                                            "; \
--      echo "                                                           "; \
--      echo "If you know what you are doing and want to override this   "; \
--      echo "check, you can do so by setting IGNORE_CC_MISMATCH.        "; \
--      echo "                                                           "; \
--      echo "In any other case, set the CC environment variable to the  "; \
--      echo "name of the compiler that was used to compile the kernel.  "; \
--      echo "                                                           "; \
--      echo -en "\033[1;31m"; \
--      echo -e  "*** Failed cc sanity check. Bailing out! ***"; \
--      echo -en "\033[0m"; \
--      exit 1; \
--       fi \
--      fi
--
--nvidia.o: gcc-check $(LINUX_MODULE) $(RESMAN_KERNEL_MODULE) 
--      ld -r -o $@ $(LINUX_MODULE) $(RESMAN_KERNEL_MODULE)
--
--$(VERSION_HDR): 
--      echo \#define NV_COMPILER \"`$(CC) -v 2>&1 | tail -1`\" > $@
--
--$(LINUX_MODULE): $(OBJECTS)
--      ld -r -o $@ $(OBJECTS)
--
--%.o: %.c $(HEADERS)
--      $(CC) -c $(CFLAGS) $<
--
--# debug tool to preprocess the file and leave .i to make it easier to untangle #defines
--%.i: %.c
--      $(CC) $(CFLAGS) -E $< > $@
--
--%.s: %.c
--      $(CC) $(CFLAGS) -S $< > $@
--
--
--clean:
--      $(RM) $(OBJECTS) $(LINUX_MODULE) $(VERSION_HDR) *.d NVdriver nvidia.o
--
--
---include $(OBJECTS:%.o=%.d)
-diff -ruN NVIDIA_kernel-1.0-4363/Makefile.kbuild NVIDIA_kernel-1.0-4363-2.5/Makefile.kbuild
---- NVIDIA_kernel-1.0-4363/Makefile.kbuild     1970-01-01 01:00:00.000000000 +0100
-+++ NVIDIA_kernel-1.0-4363-2.5/Makefile.kbuild 2003-06-14 23:42:40.000000000 +0200
-@@ -0,0 +1,258 @@
-+#
-+# KBUILD Makefile for the NVIDIA Linux kernel module.
-+#
-+# The motivation for replacing the original Makefile is the hope that this
-+# version will simplify the build and installation process. In the past,
-+# many architectural and cosmetic changes to the Linux kernel have made it
-+# difficult to maintain compatibility or required duplication of logic.
-+#
-+# Linux 2.5 introduces numerous such changes, many of which impact modules.
-+# Relying on KBUILD, some aspects of the build system otherwise difficult
-+# to support (for example, module versioning) are abstracted away and dealt
-+# with elsewhere, making life significantly easier here.
-+#
-+# The new approach currently has its own share of problems, some of which
-+# are architectural difficulties with KBUILD, others minor annoyances. For
-+# this reason, an improved version of the NVIDIA Makefile is available to
-+# those experiencing difficulties.
-+#
-+# Please report any problems you may be experiencing with this experimental
-+# Makefile to either one (or, preferably, both) of us:
-+#
-+# Alistair J Strachan (alistair@devzero.co.uk) (first pass, enhancements)
-+# Christian Zander (zander@mail.minion.de) (enhancements)
-+#
-+
-+all: install
-+install: package-install
-+
-+#
-+# The NVIDIA kernel module base name and static file names. KBUILD will go
-+# ahead and append ".o" or ".ko" to form the final module name.
-+#
-+
-+MODULE_NAME := nvidia
-+VERSION_HEADER := nv_compiler.h
-+
-+#
-+# List of object files to link into NVIDIA kernel module; make sure KBUILD
-+# understands that we want a module.
-+#
-+
-+RESMAN_CORE_OBJS := nv-kernel.o
-+RESMAN_GLUE_OBJS := nv.o os-agp.o os-interface.o os-registry.o
-+
-+$(MODULE_NAME)-objs := $(RESMAN_CORE_OBJS) $(RESMAN_GLUE_OBJS)
-+
-+#
-+# A bug in KBUILD 2.4 means that leaving obj-m set in top-level context
-+# will cause Rules.make to call pathdown.sh, which is wrong. So, we only
-+# set this conditional of a kernel-level instance.
-+#
-+
-+ifdef TOPDIR
-+obj-m += $(MODULE_NAME).o
-+endif
-+
-+#
-+# Include local source directory in $(CC)'s include path and set disable any
-+# warning types that are of little interest to us.
-+#
-+
-+EXTRA_CFLAGS += -I$(src)
-+EXTRA_CFLAGS += -Wno-cast-qual -Wno-strict-prototypes
-+
-+#
-+# Determine location of the Linux kernel source tree. Allow users to override
-+# the default (i.e. automatically determined) kernel source location with the
-+# KERNDIR directive; this new directive replaces NVIDIA's SYSINCLUDE.
-+#
-+
-+ifdef KERNDIR
-+  KERNEL_SOURCES := $(KERNDIR)
-+  KERNEL_HEADERS := -I$(KERNEL_SOURCES)/include
-+  MODULE_ROOT    := /lib/modules/$(shell uname -r)/kernel/drivers # XXX
-+else
-+  KERNEL_SOURCES := /lib/modules/$(shell uname -r)/build
-+  KERNEL_HEADERS := -I$(KERNEL_SOURCES)/include
-+  MODULE_ROOT    := /lib/modules/$(shell uname -r)/kernel/drivers
-+endif
-+
-+#
-+# We rely on these two definitions below; if they aren't set, we set them to
-+# reasonable defaults (Linux 2.4's KBUILD, and top-level passes will not set
-+# these).
-+#
-+
-+src ?= .
-+obj ?= .
-+
-+#
-+# Sets any internal variables left unset by KBUILD (e.g. this happens during
-+# a top-level run).
-+#
-+
-+TOPDIR ?= $(KERNEL_SOURCES)
-+PATCHLEVEL ?= $(shell sh $(src)/conftest.sh kernel_patch_level $(TOPDIR))
-+
-+#
-+# Linux 2.4 uses the .o module extension. Linux 2.5, however, uses the .ko
-+# module extension. Handle these gracefully.
-+#
-+
-+ifeq ($(PATCHLEVEL), 4)
-+  MODULE_OBJECT := $(MODULE_NAME).o
-+else
-+  MODULE_OBJECT := $(MODULE_NAME).ko
-+endif
-+
-+#
-+# NVIDIA specific CFLAGS and #define's. The remap_page_range check has become
-+# necessary with the introduction of the five argument version to Linux 2.4
-+# distribution kernels; this conflicting change cannot be detected at compile
-+# time.
-+#
-+
-+EXTRA_CFLAGS += -DNTRM -D_LOOSE_KERNEL_NAMES -D__KERNEL__ -DMODULE  -DNV_MAJOR_VERSION=1 -DNV_MINOR_VERSION=0 -DNV_PATCHLEVEL=4348  -DNV_UNIX   -DNV_LINUX   -DNV_INT64_OK   -DNVCPU_X86
-+
-+ifeq ($(shell echo $(NVDEBUG)),1)
-+  ifeq ($(shell test -z $(RMDEBUG) && echo yes),yes)
-+    RMDEBUG=1
-+  endif
-+endif
-+
-+ifeq ($(shell echo $(RMDEBUG)),1)
-+  EXTRA_CFLAGS += -DDEBUG -g -fno-common
-+endif
-+
-+ifeq ($(shell sh $(src)/conftest.sh remap_page_range $(KERNEL_HEADERS)), 5)
-+  EXTRA_CFLAGS += -DREMAP_PAGE_RANGE_5
-+endif
-+
-+ifeq ($(shell sh $(src)/conftest.sh remap_page_range $(KERNEL_HEADERS)), 4)
-+  EXTRA_CFLAGS += -DREMAP_PAGE_RANGE_4
-+endif
-+
-+#
-+# NVIDIA binary object file includes .common section.
-+#
-+
-+EXTRA_LDFLAGS := -d
-+
-+#
-+# Miscellaneous NVIDIA kernel module build support targets. They are needed
-+# to satisfy KBUILD requirements and to support NVIDIA specifics.
-+#
-+
-+$(obj)/nv-kernel.o:
-+      cp $(src)/$(RESMAN_CORE_OBJS) $(obj)/$(RESMAN_CORE_OBJS)
-+
-+$(obj)/$(VERSION_HEADER):
-+      echo \#define NV_COMPILER \"`$(CC) -v 2>&1 | tail -n 1`\" > $@
-+
-+$(obj)/nv.o: $(obj)/$(VERSION_HEADER)
-+
-+#
-+# More quirks for Linux 2.4 KBUILD, which doesn't link automatically.
-+#
-+
-+ifeq ($(PATCHLEVEL), 4)
-+$(obj)/$(MODULE_NAME).o: $($(MODULE_NAME)-objs)
-+      $(LD) $(EXTRA_LDFLAGS) -r -o $@ $($(MODULE_NAME)-objs)
-+endif
-+
-+#
-+# KBUILD build parameters.
-+#
-+
-+KBUILD_PARAMS := -C $(KERNEL_SOURCES) SUBDIRS=$(PWD)
-+
-+#
-+# NVIDIA sanity checks.
-+#
-+
-+suser-sanity-check:
-+      @if ! sh conftest.sh suser_sanity_check; then \
-+        echo; \
-+        echo "You have insufficient privileges for this operation. Please "; \
-+        echo "run \"make install\" as root!                               "; \
-+        echo; \
-+        exit 1; \
-+      fi
-+
-+rmmod-sanity-check:
-+      @if ! sh conftest.sh rmmod_sanity_check $(MODULE_NAME); then \
-+        echo; \
-+        echo "Unable to unload the currently loaded NVIDIA kernel module! "; \
-+        echo "Please be certain that you have exited X before attempting  "; \
-+        echo "to install this version.                                    "; \
-+        echo; \
-+        exit 1; \
-+      fi
-+
-+cc-sanity-check:
-+      @if ! sh conftest.sh cc_sanity_check $(CC); then \
-+        echo; \
-+        echo "You appear to be building the NVIDIA kernel module with a  "; \
-+        echo "compiler different from the one that was used to build the "; \
-+        echo "running kernel. This may be perfectly fine, but there are  "; \
-+        echo "cases where this can lead to unexpected behaviour and      "; \
-+        echo "system crashes.                                            "; \
-+        echo; \
-+        echo "If you know what you are doing and want to override this   "; \
-+        echo "check, you can do so by setting IGNORE_CC_MISMATCH.        "; \
-+        echo; \
-+        echo "In any other case, set the CC environment variable to the  "; \
-+        echo "name of the compiler that was used to build the kernel.    "; \
-+        echo; \
-+        exit 1; \
-+      fi
-+
-+#
-+# Build the NVIDIA kernel module using Linux KBUILD. This target is used by
-+# the "package-install" target below.
-+#
-+
-+module: cc-sanity-check
-+      @make $(KBUILD_PARAMS) modules; \
-+      if ! [ -f $(MODULE_OBJECT) ]; then \
-+        echo "$(MODULE_OBJECT) failed to build!"; \
-+        exit 1; \
-+      fi
-+
-+#
-+# Build the NVIDIA kernel module with KBUILD. Verify that the user posesses
-+# sufficient privileges. Rebuild the module dependency file.
-+#
-+
-+module-install: suser-sanity-check module
-+      @mkdir -p $(MODULE_ROOT)/video; \
-+      install -m 0664 -o root -g root $(MODULE_OBJECT) $(MODULE_ROOT)/video; \
-+      /sbin/depmod -ae;
-+
-+#
-+# This target builds, then installs, then creates device nodes and inserts
-+# the module, if successful.
-+#
-+
-+package-install: module-install rmmod-sanity-check
-+      @sh makedevices.sh; \
-+      /sbin/modprobe $(MODULE_NAME) && \
-+      echo "$(MODULE_OBJECT) installed successfully.";
-+
-+#
-+# Support hack, KBUILD isn't prepared to clean up after external modules.
-+#
-+
-+clean:
-+      @rm -f $(RESMAN_GLUE_OBJS) .*.{cmd,flags}
-+      @rm -f $(MODULE_NAME).{o,ko,mod.{o,c}} built-in.o $(VERSION_HEADER) *~
-+
-+#
-+# Linux 2.4 KBUILD requires the inclusion of Rules.make; Linux 2.5's KBUILD
-+# includes dependencies automatically.
-+#
-+
-+ifeq ($(PATCHLEVEL), 4)
-+include $(KERNEL_SOURCES)/Rules.make
-+endif
-diff -ruN NVIDIA_kernel-1.0-4363/Makefile.nvidia NVIDIA_kernel-1.0-4363-2.5/Makefile.nvidia
---- NVIDIA_kernel-1.0-4363/Makefile.nvidia     1970-01-01 01:00:00.000000000 +0100
-+++ NVIDIA_kernel-1.0-4363-2.5/Makefile.nvidia 2003-06-02 00:10:13.000000000 +0200
-@@ -0,0 +1,154 @@
-+# This Makefile is automatically generated; do not edit
-+#   Generated on 'builder3.nvidia.com' on Mon Mar 24 16:36:51 PST 2003
-+
-+LINUX_MODULE=nv-linux.o
-+DEFINES=-D__KERNEL__ -DMODULE -D_LOOSE_KERNEL_NAMES -DKBUILD_MODNAME="nvidia" -DNTRM -D_GNU_SOURCE -D_LOOSE_KERNEL_NAMES -D__KERNEL__ -DMODULE  -DNV_MAJOR_VERSION=1 -DNV_MINOR_VERSION=0 -DNV_PATCHLEVEL=4348  -DNV_UNIX   -DNV_LINUX   -DNV_INT64_OK   -DNVCPU_X86     
-+INCLUDES=-I.
-+
-+OBJECTS=nv.o os-agp.o os-interface.o os-registry.o 
-+HEADERS=os-agp.h os-interface.h nv-linux.h nv-misc.h nv.h  rmretval.h nvtypes.h  $(VERSION_HDR)
-+
-+CFLAGS=-Wall -Wimplicit -Wreturn-type -Wswitch -Wformat -Wchar-subscripts -Wparentheses -Wcast-qual -Wno-multichar  -O -MD $(DEFINES) $(INCLUDES) -Wno-cast-qual
-+
-+RESMAN_KERNEL_MODULE=nv-kernel.o
-+
-+KERNDIR=/lib/modules/$(shell uname -r)
-+
-+# check for newer paths. if found, use them, otherwise use old paths
-+# these wouldn't work with the gnu make included with rh6.2
-+# KERNINC=$(if -d $(KERNDIR)/build, $(KERNDIR)/build/include, /usr/src/linux/include)
-+# INSTALLDIR=$(if -d $(KERNDIR)/kernel, $(KERNDIR)/kernel/drivers/video, $(KERNDIR)/video)
-+
-+# this is slightly more brain-dead, but works..
-+ifeq ($(shell if test -d $(KERNDIR)/build; then echo yes; fi),yes)
-+KERNINC=$(KERNDIR)/build/include
-+else
-+KERNINC=/usr/src/linux/include
-+endif
-+
-+ifeq ($(shell if test -d $(KERNDIR)/kernel; then echo yes; fi),yes)
-+INSTALLDIR=$(KERNDIR)/kernel/drivers/video
-+else
-+INSTALLDIR=$(KERNDIR)/video
-+endif
-+
-+ifeq ($(shell echo $(NVDEBUG)),1)
-+  ifeq ($(shell test -z $(RMDEBUG) && echo yes),yes)
-+    RMDEBUG=1
-+  endif
-+endif
-+
-+ifeq ($(shell echo $(RMDEBUG)),1)
-+CFLAGS += -DDEBUG -g -fno-common
-+endif
-+
-+# this is just plain wrong, get rid of it
-+BROKENDIR=$(KERNDIR)/kernel/video
-+
-+INSTALL=$(shell which install)
-+
-+# allow specification of alternate include file tree on command line and extra defines
-+ifdef SYSINCLUDE
-+INCLUDES += -I$(SYSINCLUDE)
-+INCLUDES += -I$(SYSINCLUDE)/asm/mach-default
-+else
-+INCLUDES += -I$(KERNINC)
-+INCLUDES += -I$(KERNINC)/asm/mach-default
-+endif
-+
-+ifeq ($(shell sh conftest.sh remap_page_range $(INCLUDES)), 5)
-+  DEFINES += -DREMAP_PAGE_RANGE_5
-+endif
-+
-+ifeq ($(shell sh conftest.sh remap_page_range $(INCLUDES)), 4)
-+  DEFINES += -DREMAP_PAGE_RANGE_4
-+endif
-+
-+DEFINES+=$(EXTRA_DEFINES)
-+
-+# allow build parameters to be passed in through the environment
-+ifdef BUILD_PARAMS
-+    DEFINES+=-D$(BUILD_PARAMS)
-+endif
-+
-+VERSION_HDR=nv_compiler.h
-+
-+all: install
-+
-+install: package-install
-+
-+suser-sanity-check:
-+      @if ! sh conftest.sh suser_sanity_check; then \
-+        echo; \
-+        echo "You have insufficient privileges for this operation. Please "; \
-+        echo "run \"make install\" as root!                               "; \
-+        echo; \
-+        exit 1; \
-+      fi
-+
-+rmmod-sanity-check:
-+      @if ! sh conftest.sh rmmod_sanity_check nvidia; then \
-+        echo; \
-+        echo "Unable to unload the currently loaded NVIDIA kernel module! "; \
-+        echo "Please be certain that you have exited X before attempting  "; \
-+        echo "to install this version.                                    "; \
-+        echo; \
-+        exit 1; \
-+      fi
-+
-+cc-sanity-check:
-+      @if ! sh conftest.sh cc_sanity_check $(CC); then \
-+        echo; \
-+        echo "You appear to be building the NVIDIA kernel module with a  "; \
-+        echo "compiler different from the one that was used to build the "; \
-+        echo "running kernel. This may be perfectly fine, but there are  "; \
-+        echo "cases where this can lead to unexpected behaviour and      "; \
-+        echo "system crashes.                                            "; \
-+        echo; \
-+        echo "If you know what you are doing and want to override this   "; \
-+        echo "check, you can do so by setting IGNORE_CC_MISMATCH.        "; \
-+        echo; \
-+        echo "In any other case, set the CC environment variable to the  "; \
-+        echo "name of the compiler that was used to build the kernel.    "; \
-+        echo; \
-+        exit 1; \
-+      fi
-+
-+package-install: suser-sanity-check nvidia.o rmmod-sanity-check
-+      if [ -d $(BROKENDIR) ]; then \
-+              rm -f $(BROKENDIR)/NVdriver; \
-+              rmdir --ignore-fail-on-non-empty $(BROKENDIR); \
-+      fi && \
-+      mkdir -p $(INSTALLDIR) && \
-+      rm -f $(INSTALLDIR)/NVdriver && \
-+      $(INSTALL) -m 0664 -o root -g root nvidia.o $(INSTALLDIR)/nvidia.o$(O) && \
-+      /sbin/depmod -a && \
-+      /sbin/modprobe nvidia && \
-+      sh makedevices.sh && \
-+      echo "nvidia.o installed successfully."; \
-+
-+nvidia.o: cc-sanity-check $(LINUX_MODULE) $(RESMAN_KERNEL_MODULE) 
-+      ld -d -r -o $@ $(LINUX_MODULE) $(RESMAN_KERNEL_MODULE)
-+
-+$(VERSION_HDR): 
-+      echo \#define NV_COMPILER \"`$(CC) -v 2>&1 | tail -n 1`\" > $@
-+
-+$(LINUX_MODULE): $(OBJECTS)
-+      ld -r -o $@ $(OBJECTS)
-+
-+%.o: %.c $(HEADERS)
-+      $(CC) -c $(CFLAGS) $<
-+
-+# debug tool to preprocess the file and leave .i to make it easier to untangle #defines
-+%.i: %.c
-+      $(CC) $(CFLAGS) -E $< > $@
-+
-+%.s: %.c
-+      $(CC) $(CFLAGS) -S $< > $@
-+
-+
-+clean:
-+      $(RM) $(OBJECTS) $(LINUX_MODULE) $(VERSION_HDR) *.d NVdriver nvidia.o
-+
-+
-+-include $(OBJECTS:%.o=%.d)
-diff -ruN NVIDIA_kernel-1.0-4363/conftest.sh NVIDIA_kernel-1.0-4363-2.5/conftest.sh
---- NVIDIA_kernel-1.0-4363/conftest.sh 2003-04-20 03:57:19.000000000 +0200
-+++ NVIDIA_kernel-1.0-4363-2.5/conftest.sh     2003-06-02 00:10:13.000000000 +0200
-@@ -37,5 +37,78 @@
-           exit 1
-         fi
-     ;;
-+
-+    cc_sanity_check)
-+        shift
-+        #
-+        # Verify that the same compiler is used for the kernel and kernel
-+        # module.
-+        #
-+        if test -n "$IGNORE_CC_MISMATCH"; then
-+          #
-+          # The user chose to disable this test; this may or may not be
-+          # a wise decision...
-+          #
-+          exit 0
-+        fi
-+
-+        VERSION="^Linux version [^(]* (.*@.*) (\(.*\)) .*"
-+        KERNEL=$(cat /proc/version | sed "s/$VERSION/\1/" | cut -d ' ' -f 3)
-+        MODULE=$($* -v 2>&1 | tail -n 1 | cut -d ' ' -f 3)
-+
-+        if test "$KERNEL" != "$MODULE"; then
-+          #
-+          # The kernel seems to have been built with a different version
-+          # of the C compiler, which may be a problem.
-+          #
-+          exit 1
-+        else
-+          exit 0
-+        fi
-+    ;;
-+
-+    kernel_patch_level)
-+        shift
-+        #
-+        # Determine the kernel's major patch level; this is only done if we
-+        # aren't told by KBUILD.
-+        #
-+        echo $(cat "$1"/Makefile | grep "PATCHLEVEL =" | cut -d " " -f 3)
-+        exit 0
-+    ;;
-+
-+    suser_sanity_check)
-+        shift
-+        #
-+        # Determine the caller's user id to determine if we have sufficient
-+        # privileges for the requested operation.
-+        #
-+        if test $(id -ur) != 0; then
-+          exit 1
-+        else
-+          exit 0
-+        fi
-+    ;;
-+
-+    rmmod_sanity_check)
-+        shift
-+        #
-+        # Make sure that any currently loaded NVIDIA kernel module can be
-+        # unloaded.
-+        #
-+        if /sbin/lsmod | grep -q "$1"; then
-+          /sbin/rmmod "$1" >& /dev/null
-+        fi
-+
-+        if /sbin/lsmod | grep -q "$1"; then
-+          #
-+          # The NVIDIA kernel module is still loaded, most likely because
-+          # it is busy.
-+          #
-+          exit 1
-+        else
-+          exit 0
-+        fi
-+    ;;
- esac
- 
-diff -ruN NVIDIA_kernel-1.0-4363/nv-linux.h NVIDIA_kernel-1.0-4363-2.5/nv-linux.h
---- NVIDIA_kernel-1.0-4363/nv-linux.h  2003-04-20 03:57:19.000000000 +0200
-+++ NVIDIA_kernel-1.0-4363-2.5/nv-linux.h      2003-07-14 19:50:22.000000000 +0200
-@@ -20,35 +20,23 @@
- #  define MODVERSIONS
- #endif
- 
--#if defined (MODVERSIONS)
--#include <linux/modversions.h>
--#endif
--
- #include <linux/kernel.h>
- #include <linux/module.h>
- #include <linux/version.h>
- 
--#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 2, 12)
--#  error This driver does not support 2.2.11 or earlier kernels!
--#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 3, 0)
--#  define KERNEL_2_2
--#  warning NVIDIA is considering dropping support for linux-2.2 
--#  warning kernels. While end users are free to maintain their 
--#  warning own patches, or stick with current drivers, our new 
--#  warning drivers will not work "out of the box." If you are 
--#  warning concerned about lack of support for 2.2 kernels, 
--#  warning please let us know at linux-bugs@nvidia.com; we would
--#  warning like to know how many users would be seriously 
--#  warning impacted by this decision.
-+#if   LINUX_VERSION_CODE < KERNEL_VERSION(2, 3, 0)
-+#  error This driver does not support 2.2.x kernels!
- #elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 0)
--#  error This driver does not support 2.3.x development kernels!
-+#  error This driver does not support 2.3.x kernels!
- #elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
- #  define KERNEL_2_4
- #elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
--#  error This driver does not support 2.5.x development kernels!
- #  define KERNEL_2_5
-+#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 7, 0)
-+#  define KERNEL_2_6
-+#  define KERNEL_2_5 /* XXX temporary kludge */
- #else
--#  error This driver does not support 2.6.x or newer kernels!
-+#  error This driver does not support development kernels!
- #endif
- 
- #if defined (__ia64)
-@@ -61,12 +49,15 @@
- #define __SMP__
- #endif
- 
-+#if defined (MODVERSIONS) && !defined (KERNEL_2_5)
-+#include <linux/modversions.h>
-+#endif
-+
- #include <linux/types.h>            /* pic_t, size_t, __u32, etc        */
- #include <linux/errno.h>            /* error codes                      */
- #include <linux/list.h>             /* circular linked list             */
- #include <linux/stddef.h>           /* NULL, offsetof                   */
- #include <linux/wait.h>             /* wait queues                      */
--#include <linux/tqueue.h>           /* struct tq_struct                 */
- 
- #include <linux/slab.h>             /* kmalloc, kfree, etc              */
- #include <linux/vmalloc.h>          /* vmalloc, vfree, etc              */
-@@ -74,9 +65,15 @@
- #include <linux/poll.h>             /* poll_wait                        */
- #include <linux/delay.h>            /* mdelay, udelay                   */
- 
-+#ifdef KERNEL_2_5
-+#include <linux/sched.h>            /* suser(), capable() replacement   */
-+#include <linux/moduleparam.h>      /* module_param()                   */
-+#include <linux/smp_lock.h>         /* kernel_locked                    */
-+#include <asm/kmap_types.h>         /* page table entry lookup          */
-+#endif
-+
- #include <linux/pci.h>              /* pci_find_class, etc              */
--#include <linux/wrapper.h>          /* mem_map_reserve                  */
--#include <linux/interrupt.h>        /* mark_bh, init_bh, remove_bh      */
-+#include <linux/interrupt.h>        /* tasklets, interrupt helpers      */
- #include <linux/timer.h>
- 
- #include <asm/system.h>             /* cli, sli, save_flags             */
-@@ -85,14 +82,9 @@
- #include <asm/page.h>               /* PAGE_OFFSET                      */
- #include <asm/pgtable.h>            /* pte bit definitions              */
- 
--#if !defined (KERNEL_2_2)
- #include <linux/spinlock.h>
- #include <asm/semaphore.h>
- #include <linux/highmem.h>
--#else
--#include <asm/spinlock.h>
--#include <asm/semaphore.h>
--#endif
- 
- #ifdef CONFIG_PROC_FS
- #include <linux/proc_fs.h>
-@@ -132,70 +124,165 @@
-         for (pos = (head)->next; pos != (head); pos = (pos)->next)
- #endif
- 
--#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 2, 18)
--#define vmalloc_32 vmalloc
--#endif
-+#define NV_VMA_OFFSET(vma)            (((vma)->vm_pgoff) << PAGE_SHIFT)
-+#define GET_MODULE_SYMBOL(mod,sym)    (const void *) inter_module_get(sym)
-+#define PUT_MODULE_SYMBOL(sym)        inter_module_put((char *) sym)
-+#define NV_VMA_PRIVATE(vma)           ((vma)->vm_private_data)
-+
-+#ifdef KERNEL_2_5
-+#  define NV_DEVICE_NUMBER(_minor)      ((kdev_val(_minor)) & 0x0f)
-+#  define NV_IS_CONTROL_DEVICE(_minor)  (((kdev_val(_minor)) & 0xff) == 0xff)
-+#  define NV_IS_SUSER()                 capable(CAP_SYS_ADMIN)
-+#  define NV_PCI_DEVICE_NAME(x)         ((x)->dev.name)
-+#  define NV_CLI()                      local_irq_disable()
-+#  define NV_SAVE_FLAGS(x)              local_save_flags(x)
-+#  define NV_RESTORE_FLAGS(x)           local_irq_restore(x)
-+#  define NV_MAY_SLEEP()                (!in_interrupt() && !in_atomic())
-+#  define NV_SMP_NUM_CPUS               num_online_cpus()
-+#  define NV_MODULE_PARAMETER(x)        module_param(x, int, 0)
-+#else
-+#  define NV_DEVICE_NUMBER(_minor)      ((_minor) & 0x0f)
-+#  define NV_IS_CONTROL_DEVICE(_minor)  (((_minor) & 0xff) == 0xff)
-+#  define NV_IS_SUSER()                 suser()
-+#  define NV_PCI_DEVICE_NAME(x)         ((x)->name)
-+#  define NV_CLI()                      cli()
-+#  define NV_SAVE_FLAGS(x)              save_flags(x)
-+#  define NV_RESTORE_FLAGS(x)           restore_flags(x)
-+#  define NV_MAY_SLEEP()                (!in_interrupt())
-+#  define NV_SMP_NUM_CPUS               smp_num_cpus
-+#  define NV_MODULE_PARAMETER(x)        MODULE_PARM(x, "i")
-+#endif
-+
-+#ifndef KERNEL_2_5
-+  typedef void irqreturn_t;
-+# define IRQ_NONE
-+# define IRQ_RETVAL(x)
-+# define IRQ_HANDLED
-+#else
-+#ifdef AGPGART
-+  typedef struct agp_kern_info agp_kern_info;
-+  typedef struct agp_memory agp_memory;
-+#endif
-+  typedef void* devfs_handle_t;
-+#endif
-+
-+#ifdef KERNEL_2_5
-+#define NV_DEVFS_REGISTER(_name, _minor)                            \
-+({                                                                  \
-+    devfs_handle_t __handle = NULL;                                 \
-+    devfs_mk_cdev(MKDEV(NV_MAJOR_DEVICE_NUMBER, _minor),            \
-+            S_IFCHR | S_IRUGO | S_IWUGO, _name);                    \
-+    __handle;                                                       \
-+})
-+
-+#define NV_DEVFS_REMOVE_DEVICE(i) devfs_remove("nvidia%d", i)
-+#define NV_DEVFS_REMOVE_CONTROL() devfs_remove("nvidiactl")
-+#else
-+#define NV_DEVFS_REGISTER(_name, _minor)                            \
-+({                                                                  \
-+    devfs_handle_t __handle =                                       \
-+        devfs_register(NULL, _name, DEVFS_FL_DEFAULT,               \
-+                NV_MAJOR_DEVICE_NUMBER, _minor,                     \
-+                S_IFCHR | S_IRUGO | S_IWUGO, &nv_fops, NULL);       \
-+    __handle;                                                       \
-+ })
- 
--#if !defined (KERNEL_2_2)
--#  define LINUX_VMA_OFFS(vma)           (((vma)->vm_pgoff) << PAGE_SHIFT)
--#  define GET_MODULE_SYMBOL(mod,sym)  (const void *) inter_module_get(sym)
--#  define PUT_MODULE_SYMBOL(sym)        inter_module_put((char *) sym)
--#  define GET_MAP_NR(phys_page)         virt_to_page(__va(phys_page))
--#  define MEM_MAP_READ_COUNT(map_nr)    (atomic_read(&(map_nr)->count))
--#  define MEM_MAP_INC_COUNT(map_nr)     (atomic_inc(&(map_nr)->count))
--#  define MEM_MAP_DEC_COUNT(map_nr)     (atomic_dec(&(map_nr)->count))
--#  define GET_EVENT_QUEUE(nv)           ((struct __wait_queue_head *) ((nv)->event_queue))
--#  define VMA_PRIVATE(vma)              ((vma)->vm_private_data)
--#else
--#  define in_irq()                      (local_irq_count[smp_processor_id()])
--#  define LINUX_VMA_OFFS(vma)           ((vma)->vm_offset)
--#  define GET_MODULE_SYMBOL(mod, sym)   (void*) get_module_symbol((mod), (sym))
--#  define PUT_MODULE_SYMBOL(sym)
--#  define GET_MAP_NR(phys_page)         MAP_NR(__va(phys_page))
--#  define MEM_MAP_READ_COUNT(map_nr)    (atomic_read(&mem_map[map_nr].count))
--#  define MEM_MAP_INC_COUNT(map_nr)     (atomic_inc(&mem_map[map_nr].count))
--#  define MEM_MAP_DEC_COUNT(map_nr)     (atomic_dec(&mem_map[map_nr].count))
--#  define GET_EVENT_QUEUE(nv)           ((struct wait_queue **) &((nv)->event_queue))
--#  define VMA_PRIVATE(vma)              ((void*)((vma)->vm_pte))
-+#define NV_DEVFS_REMOVE_DEVICE(i) devfs_unregister(nv_devfs_handles[i+1])
-+#define NV_DEVFS_REMOVE_CONTROL() devfs_unregister(nv_devfs_handles[0])
- #endif
- 
-+/*
-+ * Linux 2.5 introduced the five argument version of remap_page_range, all
-+ * relevant releases to date use it. This version was backported to 2.4 by
-+ * RedHat without means to identify the change, hence this hack.
-+ */
-+#ifdef KERNEL_2_5
-+#define NV_REMAP_PAGE_RANGE(a, b...) remap_page_range(vma, a, ## b)
-+#else
- #if defined(REMAP_PAGE_RANGE_5)
--#define NV_REMAP_PAGE_RANGE(a, b...)    remap_page_range(vma, a, ## b)
-+#define NV_REMAP_PAGE_RANGE(a, b...) remap_page_range(vma, a, ## b)
- #elif defined(REMAP_PAGE_RANGE_4)
--#define NV_REMAP_PAGE_RANGE(a, b...)    remap_page_range(a, ## b)
-+#define NV_REMAP_PAGE_RANGE(a, b...) remap_page_range(a, ## b)
- #else
--#error "Couldn't determine number of arguments expected by remap_page_range!"
-+#warning "conftest.sh failed, assuming old Linux 2.4 remap_page_range(4)!"
-+
-+#define NV_REMAP_PAGE_RANGE(a, b...) remap_page_range(a, ## b)
- #endif
-+#endif /* KERNEL_2_5 */
- 
--#if defined(pte_offset_atomic)
--#define NV_PTE_OFFSET(addres, pg_mid_dir, pte) \
-+#if defined(pmd_offset_map)
-+#define NV_PMD_OFFSET(address, pgd, pmd) \
-     { \
--        pte_t *pte__ = pte_offset_atomic(pg_mid_dir, address); \
--        pte = *pte__; \
--        pte_kunmap(pte__); \
-+        pmd = pmd_offset_map(pgd, address); \
-+    }
-+#define NV_PMD_UNMAP(pmd) \
-+    { \
-+        pmd_unmap(pmd); \
-     }
--#elif defined(pte_offset)
--#define NV_PTE_OFFSET(addres, pg_mid_dir, pte) \
--    pte = *pte_offset(pg_mid_dir, address)
- #else
--#define NV_PTE_OFFSET(addres, pg_mid_dir, pte) \
-+#define NV_PMD_OFFSET(address, pgd, pmd) \
-     { \
--        pte_t *pte__ = pte_offset_map(pg_mid_dir, address); \
--        pte = *pte__; \
--        pte_unmap(pte__); \
-+        pmd = pmd_offset(pgd, address); \
-     }
-+#define NV_PMD_UNMAP(pmd)
- #endif
- 
--#define NV_PAGE_ALIGN(addr)             ( ((addr) + PAGE_SIZE - 1) / PAGE_SIZE)
--#define NV_MASK_OFFSET(addr)            ( (addr) & (PAGE_SIZE - 1) )
-+#define NV_PMD_PRESENT(pmd) \
-+    ({ \
-+        if (pmd) { \
-+            if (pmd_none(*pmd)) { \
-+                NV_PMD_UNMAP(pmd); pmd = NULL; \
-+            } \
-+        } pmd != NULL; \
-+    })
- 
--#ifndef MAXMEM  /* temporary define for 2.2 kernels */
--#define MAXMEM  (-PAGE_OFFSET - (64 * 1024 * 1024))
-+#if defined (pte_offset_atomic)
-+#define NV_PTE_OFFSET(address, pmd, pte) \
-+    { \
-+        pte = pte_offset_atomic(pmd, address); \
-+        NV_PMD_UNMAP(pmd); \
-+    }
-+#define NV_PTE_UNMAP(pte) \
-+    { \
-+        pte_kunmap(pte); \
-+    }
-+#elif defined (pte_offset)
-+#define NV_PTE_OFFSET(address, pmd, pte) \
-+    { \
-+        pte = pte_offset(pmd, address); \
-+        NV_PMD_UNMAP(pmd); \
-+    }
-+#define NV_PTE_UNMAP(pte)
-+#else
-+#define NV_PTE_OFFSET(address, pmd, pte) \
-+    { \
-+        pte = pte_offset_map(pmd, address); \
-+        NV_PMD_UNMAP(pmd); \
-+    }
-+#define NV_PTE_UNMAP(pte) \
-+    { \
-+        pte_unmap(pte); \
-+    }
- #endif
- 
--#ifndef NV01_ROOT
--#define NV01_ROOT 0x00000000
--#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_PAGE_ALIGN(addr)             ( ((addr) + PAGE_SIZE - 1) / PAGE_SIZE)
-+#define NV_MASK_OFFSET(addr)            ( (addr) & (PAGE_SIZE - 1) )
- 
- #if defined(NVCPU_IA64)
- #define NV_GFP_HW (GFP_KERNEL | __GFP_DMA)
-@@ -252,7 +339,7 @@
- static inline int NV_IRQL_IS_RAISED()
-     {
-         unsigned long int eflags;
--        __save_flags(eflags);
-+        NV_SAVE_FLAGS(eflags);
-         return !(eflags & NV_CPU_INTERRUPT_FLAGS_BIT);
-     }
-  
-@@ -310,16 +397,17 @@
- 
-     nv_alloc_t *alloc_queue;
- 
--    // bottom half interrupt handler info; per device
--    /* keep track of any pending bottom-halves */
--    struct tq_struct *bh;
-+    /* keep track of any pending bottom halfes */
-+    struct tasklet_struct tasklet;
-+
-+    /* active bottom half counter */
-     atomic_t bh_count;
- 
-     U032 vblank_notifier;
-     U032 waiting_for_vblank;
- 
-     /* queue for for NV's OS events */
--    void *event_queue;
-+    wait_queue_head_t waitqueue;
- 
-     /* get a timer callback every second */
-     struct timer_list rc_timer;
-diff -ruN NVIDIA_kernel-1.0-4363/nv.c NVIDIA_kernel-1.0-4363-2.5/nv.c
---- NVIDIA_kernel-1.0-4363/nv.c        2003-04-20 03:57:19.000000000 +0200
-+++ NVIDIA_kernel-1.0-4363-2.5/nv.c    2003-07-14 19:51:20.000000000 +0200
-@@ -16,11 +16,14 @@
- #include "os-agp.h"
- 
- 
-+MODULE_LICENSE("NVIDIA");
-+
- /*
-  * our global state; one per device
-  */
- 
- nv_linux_state_t nv_linux_devices[NV_MAX_DEVICES] = { { { 0 } } };
-+static int nv_num_devices;
- 
- #ifdef CONFIG_PM
- /* XXX PM do we only need one, or one for each device? */
-@@ -36,27 +39,15 @@
- // keep track of opened clients and their process id so they
- //   can be free'd up on abnormal close
- nv_client_t       nv_clients[NV_MAX_CLIENTS];
--struct tq_struct  nv_bottom_halves[NV_MAX_CLIENTS];
- 
- #ifdef CONFIG_PROC_FS
- struct proc_dir_entry *proc_nvidia;
- #endif
- 
- #ifdef CONFIG_DEVFS_FS
--devfs_handle_t  nv_dev_handle[NV_MAX_DEVICES];
--devfs_handle_t  nv_ctl_handle;
-+devfs_handle_t nv_devfs_handles[NV_MAX_DEVICES+1];
- #endif
- 
--/*
-- * pick apart our minor device number
-- * low 3 bits is NV device
-- * if 255, then its the control device
-- */
--
--#define NV_DEVICE_NUMBER(_minor) ((_minor) & 0x0f)
--#define NV_DEVICE_IS_CONTROL_DEVICE(_minor) \
--             (((_minor) & 0xFF) == 0xFF)
--
- // #define NV_DBG_MEM 1
- #undef NV_DBG_MEM
- 
-@@ -107,10 +98,6 @@
-  *** EXPORTS to Linux Kernel
-  ***/
- 
--/* linux module interface functions (called by linux kernel) */
--int           init_module(void);
--void          cleanup_module(void);
--
- /* nv_kern_ functions, interfaces used by linux kernel */
- void          nv_kern_vma_open(struct vm_area_struct *vma);
- void          nv_kern_vma_release(struct vm_area_struct *vma);
-@@ -121,7 +108,7 @@
- unsigned int  nv_kern_poll(struct file *, poll_table *);
- int           nv_kern_ioctl(struct inode *, struct file *, unsigned int, unsigned long);
- void          nv_kern_bh(void *);
--void          nv_kern_isr(int, void *, struct pt_regs *);
-+irqreturn_t   nv_kern_isr(int, void *, struct pt_regs *);
- void          nv_kern_rc_timer(unsigned long);
- #ifdef CONFIG_PM
- int           nv_kern_pm(struct pm_dev *dev, pm_request_t rqst, void *data);
-@@ -144,6 +131,7 @@
- /* character driver entry points */
- 
- static struct file_operations nv_fops = {
-+    owner:          THIS_MODULE,
-     poll:           nv_kern_poll,
-     ioctl:          nv_kern_ioctl,
-     mmap:           nv_kern_mmap,
-@@ -298,8 +286,8 @@
-     {
-         nv_printf(NV_DBG_MEMINFO, "  0x%x: count %d flags 0x%x\n", 
-             *page_ptr, 
--            (GET_MAP_NR(*page_ptr))->count,
--            (GET_MAP_NR(*page_ptr))->flags);
-+            (virt_to_page(__va(*page_ptr)))->count,
-+            (virt_to_page(__va(*page_ptr)))->flags);
-         num_pages--;
-         page_ptr++;
-     }
-@@ -370,7 +358,7 @@
-         phys_addr = virt_to_phys((void *) virt_addr);
- 
-         /* lock the page for dma purposes */
--        mem_map_reserve(GET_MAP_NR(phys_addr));
-+        SetPageReserved(virt_to_page(__va(phys_addr)));
- 
-         *page_ptr++ = phys_addr;
-         pages_needed--;
-@@ -383,7 +371,7 @@
-     while (page_ptr != (unsigned long *) page_list)
-     {
-         page_ptr--;
--        mem_map_unreserve(GET_MAP_NR(*page_ptr));
-+        ClearPageReserved(virt_to_page(__va(*page_ptr)));
-         free_page((unsigned long) phys_to_virt(*page_ptr));
-     }
- 
-@@ -403,7 +391,7 @@
- 
-     while (pages_left)
-     {
--        mem_map_unreserve(GET_MAP_NR(*page_list));
-+        ClearPageReserved(virt_to_page(__va(*page_list)));
-         page_list++;
-         pages_left--;
-     }
-@@ -569,11 +557,6 @@
-     nv_linux_state_t *nvl;
-     nv_linux_state_t *nv_max_devices;
- 
--#if defined (KERNEL_2_2)
--    struct proc_dir_entry *proc_root_driver;
--    proc_root_driver = create_proc_entry("driver", flags, &proc_root);
--#endif
--
-     proc_nvidia = create_proc_entry("nvidia", flags, proc_root_driver);
-     proc_nvidia_cards = create_proc_entry("cards", flags, proc_nvidia);
-     proc_nvidia_agp = create_proc_entry("agp", flags, proc_nvidia);
-@@ -635,9 +618,6 @@
- {
- #ifdef CONFIG_PROC_FS
-     nvos_proc_remove_all(proc_nvidia);
--#if defined (KERNEL_2_2)
--    remove_proc_entry("driver", &proc_root);
--#endif
- #endif
- }
- 
-@@ -726,71 +706,75 @@
-  *** EXPORTS to Linux Kernel
-  ***/
- 
--int init_module(void)
-+static int __init nvidia_init_module(void)
- {
--    nv_linux_state_t *nvl;
--    int rc;
--    int num_devices;
-+    int i, rc;
- 
-     memset(nv_linux_devices, 0, sizeof(nv_linux_devices));
--    num_devices = nvos_probe_devices();
-+    nv_num_devices = nvos_probe_devices();
- 
--    if (num_devices == 0) {
-+    if (nv_num_devices == 0) {
-         nv_printf(NV_DBG_ERRORS, "nvidia: no NVIDIA graphics adapter found\n");
-         return -ENODEV;
-     }
- 
-     nv_printf(NV_DBG_ERRORS, "nvidia: loading %s\n", pNVRM_ID);
- 
--#ifdef CONFIG_DEVFS_FS
-+#if defined(CONFIG_DEVFS_FS) && !defined(KERNEL_2_5)
-     rc = devfs_register_chrdev(nv_major, "nvidia", &nv_fops);
- #else
-     rc = register_chrdev(nv_major, "nvidia", &nv_fops);
- #endif
- 
-     if (rc < 0) {
--        nv_printf(NV_DBG_ERRORS, "init_module: register failed\n");
-+        nv_printf(NV_DBG_ERRORS, "nvidia_init_module: register failed\n");
-         return rc;
-     }
- 
- #ifdef CONFIG_DEVFS_FS
--    memset(nv_dev_handle, 0, sizeof(devfs_handle_t) * NV_MAX_DEVICES);
-     do {
-+        /*
-+         * XXX This code isn't pretty, but neither is dealing with the
-+         * various Linux devfs implemenation(s). While Linux APIs are
-+         * known to be anything but stable and oftentimes anything but
-+         * well designed, the devfs interface has been more painful to
-+         * deal with than most other APIs.
-+         */
-         char name[10];
--        int i;
- 
--        nv_ctl_handle = devfs_register(NULL, "nvidiactl",
--                            DEVFS_FL_DEFAULT, nv_major, 255,
--                            S_IFCHR | S_IRUGO | S_IWUGO,
--                            &nv_fops, NULL);
-+        nv_devfs_handles[0] = NV_DEVFS_REGISTER("nvidiactl", 255);
- 
--        for (i = 0; i < num_devices; i++) {
-+        for (i = 0; i < nv_num_devices; i++) {
-             sprintf(name, "nvidia%d", i);
--            nv_dev_handle[i] = devfs_register(NULL, name,
--                                  DEVFS_FL_DEFAULT, nv_major, i,
--                                  S_IFCHR | S_IRUGO | S_IWUGO,
--                                  &nv_fops, NULL);
-+            nv_devfs_handles[i+1] = NV_DEVFS_REGISTER(name, i);
-         }
-     } while(0);
- #endif
- 
--    nv_printf(NV_DBG_INFO, "init_module: major number %d\n", nv_major);
-+    nv_printf(NV_DBG_INFO, "nvidia_init_module: major number %d\n", nv_major);
- 
--    // init all the bottom half structures
--    for (nvl = nv_linux_devices; nvl < nv_linux_devices + NV_MAX_DEVICES; nvl++)
--    {
--        nvl->bh = &nv_bottom_halves[nvl - nv_linux_devices];
--        nvl->bh->routine = nv_kern_bh;
--        nvl->bh->data = (void *) nvl;
--        nvl->bh->sync = 0;
-+    /* instantiate tasklets */
-+    for (i = 0; i < NV_MAX_DEVICES; i++) {
-+        /*
-+         * We keep one tasklet per card to avoid latency issues with more
-+         * than one device; no two instances of a single tasklet are ever
-+         * executed concurrently.
-+         */
-+        atomic_set(&nv_linux_devices[i].tasklet.count, 1);
-+
-+        /*
-+         * Initialize the event queue for this device. This only needs to
-+         * happen once for every device.
-+         */
-+        init_waitqueue_head(&nv_linux_devices[i].waitqueue);
-     }
- 
-     // init the nvidia control device
-     {
-         nv_state_t *nv_ctl = NV_STATE_PTR(&nv_ctl_device);
--        nv_ctl_device.event_queue = NULL;
-         nv_ctl->os_state = (void *) &nv_ctl_device;
-         nv_lock_init_locks(nv_ctl);
-+        init_waitqueue_head(&nv_ctl_device.waitqueue);
-     }
- 
- #ifdef CONFIG_PM
-@@ -815,14 +799,14 @@
-     /* create /proc/driver/nvidia */
-     nvos_proc_create();
- 
--#if defined(DEBUG) && !defined(KERNEL_2_2)
-+#if defined(DEBUG)
-     inter_module_register("nv_linux_devices", THIS_MODULE, nv_linux_devices);
- #endif
- 
-     return 0;
- 
-  failed:
--#ifdef CONFIG_DEVFS_FS
-+#if defined(CONFIG_DEVFS_FS) && !defined(KERNEL_2_5)
-     devfs_unregister_chrdev(nv_major, "nvidia");
- #else
-     unregister_chrdev(nv_major, "nvidia");
-@@ -830,18 +814,18 @@
-     return rc;
- }
- 
--void cleanup_module(void)
-+static void __exit nvidia_exit_module(void)
- {
--    int rc;
-     nv_linux_state_t *nvl;
-     nv_linux_state_t *max_devices;
-+    int rc;
- 
-     /* remove /proc/driver/nvidia */
-     nvos_proc_remove();
- 
--    nv_printf(NV_DBG_INFO, "cleanup_module\n");
-+    nv_printf(NV_DBG_INFO, "nvidia_exit_module\n");
- 
--#if defined(DEBUG) && !defined(KERNEL_2_2)
-+#if defined(DEBUG)
-     inter_module_unregister("nv_linux_devices");
- #endif
- 
-@@ -866,33 +850,34 @@
-                 continue;
- 
-             nv_printf(NV_DBG_ERRORS,
--                    "still have vm que at cleanup_module(): 0x%x to 0x%x\n",
-+                    "still have vm que at nvidia_exit_module(): 0x%x to 0x%x\n",
-                     nvl->alloc_queue->vma->vm_start,
-                     nvl->alloc_queue->vma->vm_end);
-         }
-     }
- 
--#ifdef CONFIG_DEVFS_FS
-+#if defined(CONFIG_DEVFS_FS) && !defined(KERNEL_2_5)
-     rc = devfs_unregister_chrdev(nv_major, "nvidia");
- #else
-     rc = unregister_chrdev(nv_major, "nvidia");
- #endif
- 
-     if (rc < 0) {
--        nv_printf(NV_DBG_ERRORS, "cleanup_module: unregister nv failed\n");
-+        nv_printf(NV_DBG_ERRORS, "nvidia_exit_module: unregister nv failed\n");
-     }
- 
- #ifdef CONFIG_DEVFS_FS
-     do {
-         int i;
--        for (i = 0; nv_dev_handle[i] != 0; i++) {
--            devfs_unregister(nv_dev_handle[i]);
--        }
--    } while(0);
--    devfs_unregister(nv_ctl_handle);
-+        NV_DEVFS_REMOVE_CONTROL();
-+        for (i = 0; i < nv_num_devices; i++)
-+            NV_DEVFS_REMOVE_DEVICE(i);
-+    } while (0);
- #endif
- }
- 
-+module_init(nvidia_init_module);
-+module_exit(nvidia_exit_module);
- 
- /* this is only called when the vmas are duplicated.
-  * this appears to only happen when the process is cloned to create
-@@ -906,11 +891,11 @@
- nv_kern_vma_open(struct vm_area_struct *vma)
- {
-     nv_printf(NV_DBG_MEMINFO, "vma_open for 0x%x - 0x%x, offset 0x%x\n",
--        vma->vm_start, vma->vm_end, LINUX_VMA_OFFS(vma));
-+        vma->vm_start, vma->vm_end, NV_VMA_OFFSET(vma));
- 
--    if (VMA_PRIVATE(vma))
-+    if (NV_VMA_PRIVATE(vma))
-     {
--        nv_alloc_t *at = (nv_alloc_t *) VMA_PRIVATE(vma);
-+        nv_alloc_t *at = (nv_alloc_t *) NV_VMA_PRIVATE(vma);
-         at->usage_count++;
- 
-         nv_printf(NV_DBG_MEMINFO, "  at 0x%x, usage count %d, page_table 0x%x\n",
-@@ -918,8 +903,6 @@
- 
-         nvos_list_page_count(at->page_table, at->num_pages);
-     }
--
--    MOD_INC_USE_COUNT;
- }
- 
- 
-@@ -927,11 +910,11 @@
- nv_kern_vma_release(struct vm_area_struct *vma)
- {
-     nv_printf(NV_DBG_MEMINFO, "vma_release for 0x%x - 0x%x, offset 0x%x\n",
--        vma->vm_start, vma->vm_end, LINUX_VMA_OFFS(vma));
-+        vma->vm_start, vma->vm_end, NV_VMA_OFFSET(vma));
- 
--    if (VMA_PRIVATE(vma))
-+    if (NV_VMA_PRIVATE(vma))
-     {
--        nv_alloc_t *at = (nv_alloc_t *) VMA_PRIVATE(vma);
-+        nv_alloc_t *at = (nv_alloc_t *) NV_VMA_PRIVATE(vma);
- 
-         at->usage_count--;
- 
-@@ -949,22 +932,12 @@
-             if (at->page_table)
-                 nvos_unlock_pages(at->page_table, at->num_pages);
-             nvos_free_alloc(at);
--            VMA_PRIVATE(vma) = NULL;
-+            NV_VMA_PRIVATE(vma) = NULL;
-         }
-     }
--
--    MOD_DEC_USE_COUNT;
- }
- 
- 
--/* at this point, this code just plain won't work with 2.2 kernels.
-- * additionally, only ia64 & the 460GX need a nopage handler, and 2.2 doesn't
-- * work on ia64 anyways. It's expected that at some point other agp chipsets
-- * will work similar to the 460GX (AGP 3.0 spec), so pre-emptively make sure
-- * this works on our standard ia32 driver.
-- */
--#if !defined(KERNEL_2_2)
--
- /* AGP allocations under the 460GX are not mapped to the aperture
-  * addresses by the CPU.  This nopage handler will fault on CPU
-  * accesses to AGP memory and map the address to the correct page.
-@@ -977,7 +950,7 @@
-     struct page *page_ptr;
-     int rm_status, index;
- 
--    at = VMA_PRIVATE(vma);
-+    at = NV_VMA_PRIVATE(vma);
-     if (at == NULL)
-     {
-         nv_printf(NV_DBG_ERRORS, "NVRM: nopage handler called without an at: "
-@@ -1016,7 +989,7 @@
-         // far again
-         nv_printf(NV_DBG_ERRORS, "NVRM: nopage handler called on a freed"
-                   "address: vm_start 0x%x, at 0x%x\n", vma->vm_start, at);
--        VMA_PRIVATE(vma) = NULL;
-+        NV_VMA_PRIVATE(vma) = NULL;
-         return NOPAGE_SIGBUS;
-     }
- 
-@@ -1038,14 +1011,11 @@
- 
-     return page_ptr;
- }
--#endif
- 
- struct vm_operations_struct nv_vm_ops = {
-     nv_kern_vma_open,
-     nv_kern_vma_release,  /* "close" */
--#if !defined(KERNEL_2_2)
-     nv_kern_vma_nopage,
--#endif
- };
- 
- 
-@@ -1076,7 +1046,7 @@
- 
-     /* for control device, just jump to its open routine */
-     /* after setting up the private data */
--    if (NV_DEVICE_IS_CONTROL_DEVICE(inode->i_rdev))
-+    if (NV_IS_CONTROL_DEVICE(inode->i_rdev))
-         return nv_kern_ctl_open(inode, file);
- 
-     /* what device are we talking about? */
-@@ -1087,9 +1057,6 @@
-         goto failed;
-     }
- 
--
--    MOD_INC_USE_COUNT;
--
-     nvl = &nv_linux_devices[devnum];
-     nv = NV_STATE_PTR(nvl);
- 
-@@ -1137,16 +1104,9 @@
-             goto failed;
-         }
- 
--#if !defined (KERNEL_2_2)
--        NV_KMALLOC(nvl->event_queue, sizeof(struct __wait_queue_head));
--        if (nvl->event_queue == NULL)
--            goto failed;
--        memset(nvl->event_queue, 0, sizeof(struct __wait_queue_head));
--
--        init_waitqueue_head(GET_EVENT_QUEUE(nvl));
--#else
--        nvl->event_queue = NULL;
--#endif
-+        nvl->tasklet.func = (void *) rm_isr_bh;
-+        nvl->tasklet.data = (unsigned long) nv->pdev;
-+        tasklet_enable(&nvl->tasklet);
- 
-         nv->flags |= NV_FLAG_OPEN;
-     }
-@@ -1157,7 +1117,6 @@
-     return rc;
- 
-  failed:
--    MOD_DEC_USE_COUNT;
-     nv_unlock_ldata(nv);
-     return rc;
- }
-@@ -1179,7 +1138,7 @@
- 
-     /* for control device, just jump to its open routine */
-     /* after setting up the private data */
--    if (NV_DEVICE_IS_CONTROL_DEVICE(inode->i_rdev))
-+    if (NV_IS_CONTROL_DEVICE(inode->i_rdev))
-         return nv_kern_ctl_close(inode, file);
- 
-     nv_printf(NV_DBG_INFO, "nv_kern_close on device %d\n", NV_DEVICE_NUMBER(inode->i_rdev));
-@@ -1189,28 +1148,22 @@
-     nv_lock_ldata(nv);
-     if (--nv->usage_count == 0)
-     {
--        int counter = 0;
--
--        /* turn off interrupts.
--        ** be careful to make sure any pending bottom half gets run
--        **  or disabled before calling rm_shutdown_adapter() since
--        **  it will free up the pdev.  This is hard to see on single
--        **  cpu systems, but easy on dual cpu :-)
--        */
-+        /*
-+         * The usage count for this device has dropped to zero, it can be shut
-+         * down safely; disable its interrupts.
-+         */
-         rm_disable_adapter(nv);
- 
--        /* give it a moment to allow any bottom half to run */
--
--#define MAX_BH_TASKS 10
--        while (NV_ATOMIC_READ(nvl->bh_count) && (counter < MAX_BH_TASKS))
--        {
--            current->state = TASK_INTERRUPTIBLE;
--            schedule_timeout(HZ/50);
--            counter++;
--        }
-+        /*
-+         * Disable this device's tasklet to make sure that no bottom half will
-+         * run with undefined device state.
-+         */
-+        tasklet_disable(&nvl->tasklet);
- 
--        /* free the irq, which may block until any pending interrupts */
--        /* are done being processed. */
-+        /*
-+         * Free the IRQ, which may block until all pending interrupt processing
-+         * has completed.
-+         */
-         free_irq(nv->interrupt_line, (void *) nv);
- 
-         rm_shutdown_adapter(nv);
-@@ -1230,12 +1183,6 @@
-             }
-         }
- 
--#if !defined (KERNEL_2_2)
--        /* this only needs to be freed on 2.4 and later kernels */
--        NV_KFREE(nvl->event_queue);
--        nvl->event_queue = NULL;
--#endif
--
-         /* leave INIT flag alone so we don't reinit every time */
-         nv->flags &= ~(NV_FLAG_OPEN | NV_FLAG_WAITING);
-     }
-@@ -1246,8 +1193,6 @@
-         NV_KFREE(file->private_data);
-     file->private_data = (void *) 0;
- 
--    MOD_DEC_USE_COUNT;
--
-     return 0;
- }
- 
-@@ -1264,10 +1209,10 @@
-     nv_printf(NV_DBG_INFO, "mmap([0x%lx-0x%lx] off=0x%lx)\n",
-         vma->vm_start,
-         vma->vm_end,
--        LINUX_VMA_OFFS(vma));
-+        NV_VMA_OFFSET(vma));
- 
-     // be a bit paranoid for now
--    if ((NV_MASK_OFFSET(LINUX_VMA_OFFS(vma))) ||
-+    if ((NV_MASK_OFFSET(NV_VMA_OFFSET(vma))) ||
-         (NV_MASK_OFFSET(vma->vm_start)) ||
-         (NV_MASK_OFFSET(vma->vm_end)))
-     {
-@@ -1285,7 +1230,7 @@
- 
- 
-     /* NV reg space */
--    if (IS_REG_OFFSET(nv, LINUX_VMA_OFFS(vma), vma->vm_end - vma->vm_start))
-+    if (IS_REG_OFFSET(nv, NV_VMA_OFFSET(vma), vma->vm_end - vma->vm_start))
-     {
-         /* truncate to size of registers */
-         if (pages > nv->regs->size / PAGE_SIZE)
-@@ -1293,7 +1238,7 @@
- 
-         vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
-         if (NV_REMAP_PAGE_RANGE(vma->vm_start,
--                             LINUX_VMA_OFFS(vma),
-+                             NV_VMA_OFFSET(vma),
-                              vma->vm_end - vma->vm_start,
-                              vma->vm_page_prot))
-             return -EAGAIN;
-@@ -1303,7 +1248,7 @@
-     }
- 
-     /* NV fb space */
--    else if (IS_FB_OFFSET(nv, LINUX_VMA_OFFS(vma), vma->vm_end - vma->vm_start))
-+    else if (IS_FB_OFFSET(nv, NV_VMA_OFFSET(vma), vma->vm_end - vma->vm_start))
-     {
- 
-         /* truncate to size of framebuffer */
-@@ -1312,7 +1257,7 @@
- 
-         vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
-         if (NV_REMAP_PAGE_RANGE(vma->vm_start,
--                             LINUX_VMA_OFFS(vma),
-+                             NV_VMA_OFFSET(vma),
-                              vma->vm_end - vma->vm_start,
-                              vma->vm_page_prot))
-             return -EAGAIN;
-@@ -1322,10 +1267,10 @@
-     }
- 
-     /* AGP allocator */
--    else if (IS_AGP_OFFSET(nv, LINUX_VMA_OFFS(vma), vma->vm_end - vma->vm_start))
-+    else if (IS_AGP_OFFSET(nv, NV_VMA_OFFSET(vma), vma->vm_end - vma->vm_start))
-     {
-         nv_lock_at(nv);
--        at = nvl_find_alloc(nvl, LINUX_VMA_OFFS(vma), NV_ALLOC_TYPE_AGP);
-+        at = nvl_find_alloc(nvl, NV_VMA_OFFSET(vma), NV_ALLOC_TYPE_AGP);
- 
-         if (at == NULL)
-         {
-@@ -1343,7 +1288,7 @@
-         }
- 
-         at->vma = vma;
--        VMA_PRIVATE(vma) = at;
-+        NV_VMA_PRIVATE(vma) = at;
-         at->usage_count++;
- 
-         if (NV_OSAGP_ENABLED(nv))
-@@ -1366,13 +1311,13 @@
-     }
- 
-     /* Magic allocator */
--    else // if (LINUX_VMA_OFFS(vma) == NV_MMAP_ALLOCATION_OFFSET)
-+    else // if (NV_VMA_OFFSET(vma) == NV_MMAP_ALLOCATION_OFFSET)
-     {
-         unsigned long page = 0, pos, start;
-         int i = 0;
- 
-         nv_lock_at(nv);
--        at = nvl_find_alloc(nvl, LINUX_VMA_OFFS(vma), NV_ALLOC_TYPE_PCI);
-+        at = nvl_find_alloc(nvl, NV_VMA_OFFSET(vma), NV_ALLOC_TYPE_PCI);
- 
-         if (at == NULL)
-         {
-@@ -1390,7 +1335,7 @@
-         }
- 
-         at->vma = vma;
--        VMA_PRIVATE(vma) = at;
-+        NV_VMA_PRIVATE(vma) = at;
-         at->usage_count++;
- 
-         nv_printf(NV_DBG_INFO, "remapping %d system pages for at 0x%x\n", pages, at);
-@@ -1412,9 +1357,6 @@
- 
-     vma->vm_file = file;
- 
--    /* just increment usage count, rather than calling vma_open */
--    MOD_INC_USE_COUNT;
--
-     return 0;
- }
- 
-@@ -1439,7 +1381,7 @@
-         return nv_kern_ctl_poll (file, wait);
- 
-     // add us to the list
--    poll_wait(file, GET_EVENT_QUEUE(nvl), wait);
-+    poll_wait(file, &nvl->waitqueue, wait);
- 
-     nv_lock_ldata(nv);
- 
-@@ -1519,12 +1461,13 @@
- 
-     switch (_IOC_NR(cmd))
-     {
-+#if !defined(KERNEL_2_5)
-         /* debug tool; zap the module use count so we can unload driver */
-         /*             even if it is confused */
-         case _IOC_NR(NV_IOCTL_MODULE_RESET):
-             atomic_set(&__this_module.uc.usecount, 1);
-             break;
--
-+#endif
-         /* pass out info about the card */
-         case _IOC_NR(NV_IOCTL_CARD_INFO):
-         {
-@@ -1651,7 +1594,7 @@
-  * driver receives an interrupt
-  *    if someone waiting, then hand it off.
-  */
--void nv_kern_isr(
-+irqreturn_t nv_kern_isr(
-     int   irq,
-     void *arg,
-     struct pt_regs *regs
-@@ -1665,9 +1608,10 @@
-     if (need_to_run_bottom_half)
-     {
-         NV_ATOMIC_INC(nvl->bh_count);
--        queue_task(nvl->bh, &tq_immediate);
--        mark_bh(IMMEDIATE_BH);
-+        tasklet_schedule(&nvl->tasklet);
-     }
-+
-+    return IRQ_HANDLED;
- }
- 
- void nv_kern_bh(
-@@ -1760,26 +1704,6 @@
-     /* save the nv away in file->private_data */
-     NV_HIDE_IN_FILEP(file, nv);
- 
--    MOD_INC_USE_COUNT;
--
--    /* if this is the first time the control device has been opened,
--     * allocate the wait queue
--     */
--
--    if (! nvl->event_queue) {
--
--#if !defined (KERNEL_2_2)
--        NV_KMALLOC(nvl->event_queue, sizeof(struct __wait_queue_head));
--        if (nvl->event_queue == NULL)
--            return -ENOMEM;
--        memset(nvl->event_queue, 0, sizeof(struct __wait_queue_head));
--
--        init_waitqueue_head(GET_EVENT_QUEUE(nvl));
--#else
--        nvl->event_queue = NULL;
--#endif
--    }
--
-     nv->flags |= NV_FLAG_OPEN + NV_FLAG_CONTROL;
- 
-     /* turn off the hotkey occurred bit */
-@@ -1807,15 +1731,7 @@
- 
-     nv_lock_ldata(nv);
-     if (--nv->usage_count == 0)
--    {
--#if !defined (KERNEL_2_2)
--        nv_linux_state_t *nvl = NV_GET_NVL_FROM_NV_STATE(nv);
--        /* this only needs to be freed on 2.4 and later kernels */
--        NV_KFREE(nvl->event_queue);
--        nvl->event_queue = 0;
--#endif
-         nv->flags = 0;
--    }
-     nv_unlock_ldata(nv);
- 
-     rm_free_unused_clients(nv, current->pid, (void *) file);
-@@ -1825,8 +1741,6 @@
-         NV_KFREE(file->private_data);
-     file->private_data = (void *) 0;
- 
--    MOD_DEC_USE_COUNT;
--
-     return 0;
- }
- 
-@@ -1851,7 +1765,7 @@
-     if (file->f_flags & O_NONBLOCK)
-         return -EAGAIN;
- 
--    poll_wait(file, GET_EVENT_QUEUE(nvl), wait);
-+    poll_wait(file, &nvl->waitqueue, wait);
- 
-     nv_lock_ldata(nv);
- 
-@@ -1881,7 +1795,7 @@
-     nv_ctl_device.nv_state.flags |= NV_FLAG_HOTKEY_OCCURRED;
-     nv_unlock_ldata(&(nv_ctl_device.nv_state));
- 
--    wake_up_interruptible(GET_EVENT_QUEUE(&nv_ctl_device));
-+    wake_up_interruptible(&nv_ctl_device.waitqueue);
- }
- 
- int nv_kern_read_cardinfo(char *page, char **start, off_t off,
-@@ -1960,7 +1874,7 @@
-         len += sprintf(page+len, "Host Bridge: \t ");
- 
- #if defined(CONFIG_PCI_NAMES)
--        len += sprintf(page+len, "%s\n", dev->name);
-+        len += sprintf(page+len, "%s\n", NV_PCI_DEVICE_NAME(dev));
- #else
-         len += sprintf(page+len, "PCI device %04x:%04x\n",
-                 dev->vendor, dev->device);
-@@ -2088,18 +2002,21 @@
-             {
-                 unsigned long retaddr = (unsigned long) at->page_table[i];
- 
--                if (retaddr <= MAXMEM)
--                {
--                    return __va((retaddr + offset));
--                }
--   
--                // if we've allocated via vmalloc on a highmem system, the 
--                // physical address may not be accessible via PAGE_OFFSET, 
--                // that's ok, we have a simple linear pointer already.
-+                /*
-+                 * XXX This routine should be more straight-forward; as it
-+                 * is, it returns a pointer into the kernel linear mapping if
-+                 * the incoming address belongs to a vmalloc() allocation or
-+                 * the kernel logical mapping of the corresponding page if it
-+                 * was allocated with alloc_pages(); third case below.
-+                 */
-                 if (at->flags & NV_ALLOC_TYPE_VMALLOC)
-                 {
-                     return (void *)((unsigned char *) at->key_mapping + (i << PAGE_SHIFT) + offset);
-                 }
-+                else if (!(at->flags & NV_ALLOC_TYPE_CONTIG))
-+                {
-+                    return __va((retaddr + offset));
-+                }
- 
-                 // ?? this may be a contiguous allocation, fall through
-                 // to below? or should I just check at->flag here?
-@@ -2169,9 +2086,9 @@
- unsigned long
- nv_get_phys_address(unsigned long address)
- {
--    pgd_t *pg_dir;
--    pmd_t *pg_mid_dir;
--    pte_t pte;
-+    pgd_t *pgd;
-+    pmd_t *pmd;
-+    pte_t *pte; 
- 
- #if defined(NVCPU_IA64)
-     if (address > __IA64_UNCACHED_OFFSET)
-@@ -2184,23 +2101,24 @@
-         return __pa(address);
- 
-     if (address > VMALLOC_START)
--       pg_dir = pgd_offset_k(address);
-+       pgd = pgd_offset_k(address);
-     else
--       pg_dir = pgd_offset(current->mm, address);
-+       pgd = pgd_offset(current->mm, address);
- 
--    if (pgd_none(*pg_dir))
-+    if (!pgd || pgd_none(*pgd))
-         goto failed;
- 
--    pg_mid_dir = pmd_offset(pg_dir, address);
--    if (pmd_none(*pg_mid_dir))
-+    NV_PMD_OFFSET(address, pgd, pmd);
-+ 
-+    if (!NV_PMD_PRESENT(pmd))
-         goto failed;
- 
--    NV_PTE_OFFSET(address, pg_mid_dir, pte);
-+    NV_PTE_OFFSET(address, pmd, pte);
- 
--    if (!pte_present(pte))
-+    if (!NV_PTE_PRESENT(pte))
-         goto failed;
--
--    return ((pte_val(pte) & KERN_PAGE_MASK) | NV_MASK_OFFSET(address));
-+ 
-+    return (NV_PTE_VALUE(pte) & KERN_PAGE_MASK) | NV_MASK_OFFSET(address);
- 
-   failed:
-     return (unsigned long) NULL;
-@@ -2567,7 +2485,7 @@
- 
-     nvfp->any_fired_notifiers++;
- 
--    wake_up_interruptible(GET_EVENT_QUEUE(nvl));
-+    wake_up_interruptible(&nvl->waitqueue);
- }
- 
- /*
-@@ -2584,7 +2502,7 @@
-     if (nvl->waiting_for_vblank)
-         nvl->vblank_notifier++;
- 
--    wake_up_interruptible(GET_EVENT_QUEUE(nvl));
-+    wake_up_interruptible(&nvl->waitqueue);
- }
- 
- 
-@@ -2633,12 +2551,8 @@
-     if ( (NV_AGP_DISABLED(nv)) && (config & NVOS_AGP_CONFIG_NVAGP) )
-     {
-         /* make sure the user does not have agpgart loaded */
--#if !defined (KERNEL_2_2)
-         if (inter_module_get("drm_agp")) {
-             inter_module_put("drm_agp");
--#else
--        if (GET_MODULE_SYMBOL(0, __MODULE_STRING(agp_enable))) {
--#endif
-             nv_printf(NV_DBG_WARNINGS, "NVRM: not using NVAGP, AGPGART is loaded!!\n");
-         } else
-             status = rm_init_agp(nv);
-diff -ruN NVIDIA_kernel-1.0-4363/os-agp.c NVIDIA_kernel-1.0-4363-2.5/os-agp.c
---- NVIDIA_kernel-1.0-4363/os-agp.c    2003-04-20 03:57:19.000000000 +0200
-+++ NVIDIA_kernel-1.0-4363-2.5/os-agp.c        2003-06-13 23:02:14.000000000 +0200
-@@ -45,44 +45,9 @@
-     int  ready;
- } agp_gart;
- 
--typedef struct {
--    int           (*backend_acquire)(void);
--    void          (*backend_release)(void);
--    void          (*copy_info)(agp_kern_info *);
--    agp_memory *  (*allocate_memory)(size_t, unsigned int);
--    void          (*free_memory)(agp_memory *);
--    int           (*bind_memory)(agp_memory *, off_t);
--    int           (*unbind_memory)(agp_memory *);
--    void          (*enable)(unsigned int);
--} agp_operations_struct;
--
--agp_operations_struct agp_ops;
- agp_kern_info         agpinfo;
- agp_gart              gart;
--#if !defined (KERNEL_2_2)
- const drm_agp_t       *drm_agp_p;
--#endif
--
--#if defined (KERNEL_2_2)
--    #define GET_AGPGART_SYMBOL(sym, sym_string)                     \
--        sym = (void*) GET_MODULE_SYMBOL(0, sym_string);             \
--        if (sym == NULL)                                            \
--        {                                                           \
--            nv_printf(NV_DBG_ERRORS,                                \
--                "NVRM: AGPGART: unable to retrieve symbol %s\n",    \
--                sym_string);                                        \
--            return 1;                                               \
--        }
--
--    #define AGP_BACKEND_ACQUIRE_SYM   __MODULE_STRING(agp_backend_acquire)
--    #define AGP_BACKEND_RELEASE_SYM   __MODULE_STRING(agp_backend_release)
--    #define AGP_COPY_INFO_SYM         __MODULE_STRING(agp_copy_info)
--    #define AGP_ALLOCATE_MEMORY_SYM   __MODULE_STRING(agp_allocate_memory)
--    #define AGP_FREE_MEMORY_SYM       __MODULE_STRING(agp_free_memory)
--    #define AGP_BIND_MEMORY_SYM       __MODULE_STRING(agp_bind_memory)
--    #define AGP_UNBIND_MEMORY_SYM     __MODULE_STRING(agp_unbind_memory)
--    #define AGP_ENABLE_SYM            __MODULE_STRING(agp_enable)
--#endif
- 
- #if defined(CONFIG_MTRR)
- #define MTRR_DEL(gart) if ((gart).mtrr > 0) mtrr_del((gart).mtrr, 0, 0);
-@@ -105,13 +70,17 @@
-     U032  agp_rate;
-     U032  agp_sba;
-     U032  agp_fw;
--    char* chipset;
-     VOID *bitmap;
-     U032 bitmap_size;
- 
-     memset( (void *) &gart, 0, sizeof(agp_gart));
- 
--#if !defined (KERNEL_2_2)
-+    /*
-+     * XXX The inter_module_* mechanism has been deprecated and replaced with
-+     * a different mechanism in Linux 2.5; it will go away eventually.
-+     * Also, the Linux 2.5 AGP GART driver is modularized, agpgart.o does not
-+     * include backend drivers.
-+     */
-     if (!(drm_agp_p = inter_module_get_request("drm_agp", "agpgart")))
-     {
-         nv_printf(NV_DBG_ERRORS,
-@@ -119,48 +88,13 @@
-         return 1;
-     }
-     
--    agp_ops.backend_acquire = drm_agp_p->acquire;
--    agp_ops.backend_release = drm_agp_p->release;
--    agp_ops.allocate_memory = drm_agp_p->allocate_memory;
--    agp_ops.free_memory     = drm_agp_p->free_memory;
--    agp_ops.bind_memory     = drm_agp_p->bind_memory;
--    agp_ops.unbind_memory   = drm_agp_p->unbind_memory;
--    agp_ops.enable          = drm_agp_p->enable;
--
--    // looks like some newer kernels (for example mandrake 9.0's 2.4.19-16mdk)
--    // have updated copy_info to return an integer value, and of course didn't
--    // bother bumping the agpgart revision up. The return value is pretty 
--    // harmless (backend_acquire would have already failed and caused us to
--    // bail), so cast the function pointer to avoid compiler warnings.
--    // we may need to revisit this in the future.
--    agp_ops.copy_info       = (void (*)(agp_kern_info *)) drm_agp_p->copy_info;
--
--#else
--#if defined(CONFIG_KMOD)
--    if ( request_module("agpgart") )
--    {
--        nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: not loading agpgart.o\n");
--        return 1;
--    }
--#endif
--
--    GET_AGPGART_SYMBOL(agp_ops.backend_acquire, AGP_BACKEND_ACQUIRE_SYM);
--    GET_AGPGART_SYMBOL(agp_ops.backend_release, AGP_BACKEND_RELEASE_SYM);
--    GET_AGPGART_SYMBOL(agp_ops.copy_info,       AGP_COPY_INFO_SYM);
--    GET_AGPGART_SYMBOL(agp_ops.allocate_memory, AGP_ALLOCATE_MEMORY_SYM);
--    GET_AGPGART_SYMBOL(agp_ops.free_memory,     AGP_FREE_MEMORY_SYM);
--    GET_AGPGART_SYMBOL(agp_ops.bind_memory,     AGP_BIND_MEMORY_SYM);
--    GET_AGPGART_SYMBOL(agp_ops.unbind_memory,   AGP_UNBIND_MEMORY_SYM);
--    GET_AGPGART_SYMBOL(agp_ops.enable,          AGP_ENABLE_SYM);
--#endif
--
-     /* NOTE: from here down, return an error code of '-1'
-      * that indicates that agpgart is loaded, but we failed to use it
-      * in some way. This is so we don't try to use nvagp and lock up
-      * the memory controller.
-      */
- 
--    if ( (*(agp_ops.backend_acquire))() )
-+    if (drm_agp_p->acquire())
-     {
-         nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: backend in use\n");
-         return -1;
-@@ -178,44 +112,21 @@
-         agp_fw = 1;
-     agp_fw &= 0x00000001;
-     
--    (*(agp_ops.copy_info))(&agpinfo);
--
--    switch ( agpinfo.chipset )
--    {
--        case INTEL_GENERIC:    chipset = "Intel";            break;
--        case INTEL_LX:         chipset = "Intel 440LX";      break;
--        case INTEL_BX:         chipset = "Intel 440BX";      break;
--        case INTEL_GX:         chipset = "Intel 440GX";      break;
--        case INTEL_I810:       chipset = "Intel i810";       break;
--        case INTEL_I840:       chipset = "Intel i840";       break;
--#if !defined (KERNEL_2_2)
--        case INTEL_I815:       chipset = "Intel i815";       break;
--#if !defined(__rh_config_h__)
--        case INTEL_I850:       chipset = "Intel i850";       break;
--#endif
--#endif
--#if defined(NVCPU_IA64)
--        case INTEL_460GX:      chipset = "Intel 460GX";      break;
--#endif
--        case VIA_GENERIC:      chipset = "VIA";              break;
--        case VIA_VP3:          chipset = "VIA VP3";          break;
--        case VIA_MVP3:         chipset = "VIA MVP3";         break;
--        case VIA_MVP4:         chipset = "VIA MVP4";         break;
--#if !defined (KERNEL_2_2)
--        case VIA_APOLLO_KX133: chipset = "VIA Apollo KX133"; break;
--        case VIA_APOLLO_KT133: chipset = "VIA Apollo KT133"; break;
--#endif
--        case VIA_APOLLO_PRO:   chipset = "VIA Apollo Pro";   break;
--        case SIS_GENERIC:      chipset = "SiS";              break;
--        case AMD_GENERIC:      chipset = "AMD";              break;
--        case AMD_IRONGATE:     chipset = "AMD Irongate";     break;
--        case ALI_M1541:        chipset = "ALi M1541";        break;
--        case ALI_GENERIC:      chipset = "ALi";              break;
--        case NOT_SUPPORTED:    chipset = "unsupported";      break;
--        default:               chipset = "unknown";
-+#if defined(KERNEL_2_4)
-+    /*
-+     * The original Linux 2.4 AGP GART driver interface declared copy_info to
-+     * return nothing. This changed in Linux 2.5, which reports unsupported
-+     * chipsets via this function. If this Linux 2.4 kernels behaves the same
-+     * way, we have no way to know.
-+     */
-+    drm_agp_p->copy_info(&agpinfo);
-+#else
-+    if (drm_agp_p->copy_info(&agpinfo)) {
-+        drm_agp_p->release();
-+        inter_module_put("drm_agp");
-+        return -1;
-     }
--
--    nv_printf(NV_DBG_SETUP, "NVRM: AGPGART: %s chipset\n", chipset);
-+#endif
- 
- #ifdef CONFIG_MTRR
-     if ((gart.mtrr = mtrr_add(agpinfo.aper_base,
-@@ -229,7 +140,8 @@
-          */
-         nv_printf(NV_DBG_ERRORS, 
-             "NVRM: AGPGART: unable to set MTRR write-combining\n");
--        (*(agp_ops.backend_release))();
-+        drm_agp_p->release();
-+        inter_module_put("drm_agp");
-         return -1;
-     }
- #endif
-@@ -244,7 +156,8 @@
-     {
-         nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: unable to remap aperture\n");
-         MTRR_DEL(gart);
--        (*(agp_ops.backend_release))();
-+        drm_agp_p->release();
-+        inter_module_put("drm_agp");
-         return -1;
-     }
- 
-@@ -255,7 +168,8 @@
-         nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: unable to allocate bitmap\n");
-         iounmap(gart.aperture);
-         MTRR_DEL(gart);
--        (*(agp_ops.backend_release))();
-+        drm_agp_p->release();
-+        inter_module_put("drm_agp");
-         return -1;
-     }
- 
-@@ -266,39 +180,19 @@
-         os_free_mem(bitmap);
-         iounmap(gart.aperture);
-         MTRR_DEL(gart);
--        (*(agp_ops.backend_release))();
-+        drm_agp_p->release();
-+        inter_module_put("drm_agp");
-         return -1;
-     }
- 
--    nv_printf(NV_DBG_SETUP,
--        "NVRM: AGPGART: aperture: %ldM @ 0x%08lx\n",
--        (unsigned long)agpinfo.aper_size,
--        (unsigned long)agpinfo.aper_base);
--
--    nv_printf(NV_DBG_SETUP, 
--        "NVRM: AGPGART: aperture mapped from 0x%08lx to 0x%08lx\n",
--        agpinfo.aper_base,
--        (unsigned long) gart.aperture);
--
-     if (!agp_sba) agpinfo.mode &= ~0x00000200;
-     if (!agp_fw)  agpinfo.mode &= ~0x00000010;
- 
-     if (!(agp_rate & 0x00000004)) agpinfo.mode &= ~0x00000004;
-     if (!(agp_rate & 0x00000002)) agpinfo.mode &= ~0x00000002;
-     
--    (*(agp_ops.enable))(agpinfo.mode);
-+    drm_agp_p->enable(agpinfo.mode);
-     
--    if (agpinfo.mode & 0x00000200)
--        nv_printf(NV_DBG_SETUP, "NVRM: AGPGART: backend supports sba\n");
--    if (agpinfo.mode & 0x00000010)
--        nv_printf(NV_DBG_SETUP, "NVRM: AGPGART: backend supports fw\n");
--    if (agpinfo.mode & 0x00000004)
--        nv_printf(NV_DBG_SETUP, "NVRM: AGPGART: mode 4x\n");
--    else if (agpinfo.mode & 0x00000002)
--        nv_printf(NV_DBG_SETUP, "NVRM: AGPGART: mode 2x\n");
--    else if (agpinfo.mode & 0x00000001)
--        nv_printf(NV_DBG_SETUP, "NVRM: AGPGART: mode 1x\n");
--
-     *ap_phys_base   = (void*) agpinfo.aper_base;
-     *ap_mapped_base = (void*) gart.aperture;
-     *apsize         = (agpinfo.aper_size * 0x100000) - 1;
-@@ -332,11 +226,13 @@
-         iounmap(gart.aperture);
-     }
- 
--    (*(agp_ops.backend_release))();
-+    drm_agp_p->release();
- 
--#if !defined (KERNEL_2_2)
-+    /*
-+     * XXX Same as above; the inter_module_* mechanism will go away at some
-+     * point, it has been deprecated in Linux 2.5.
-+     */
-     inter_module_put("drm_agp");
--#endif
- 
-     if (rm_clear_agp_bitmap(nv, &bitmap))
-     {
-@@ -383,7 +279,7 @@
-         return RM_ERROR;
-     }
- 
--    ptr = (*agp_ops.allocate_memory)(PageCount, AGP_NORMAL_MEMORY);
-+    ptr = drm_agp_p->allocate_memory(PageCount, AGP_NORMAL_MEMORY);
-     if (ptr == NULL)
-     {
-         *pAddress = (void*) 0;
-@@ -391,7 +287,7 @@
-         return RM_ERR_NO_FREE_MEM;
-     }
-     
--    err = (*(agp_ops.bind_memory))(ptr, *Offset);
-+    err = drm_agp_p->bind_memory(ptr, *Offset);
-     if (err)
-     {
-         // this happens a lot when the aperture itself fills up..
-@@ -408,7 +304,7 @@
-     if (status != RM_OK)
-     {
-         nv_printf(NV_DBG_ERRORS, "NVRM: memory allocation failed\n");
--        (*(agp_ops.unbind_memory))(ptr);
-+        drm_agp_p->unbind_memory(ptr);
-         goto fail;
-     }
- 
-@@ -423,7 +319,7 @@
-     return RM_OK;
- 
- fail:
--    (*(agp_ops.free_memory))(ptr);
-+    drm_agp_p->free_memory(ptr);
-     *pAddress = (void*) 0;
- 
-     return RM_ERROR;
-@@ -462,7 +358,7 @@
-     {
-         nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: unable to remap %lu pages\n",
-             (unsigned long)agp_data->num_pages);
--        (*(agp_ops.unbind_memory))(agp_data->ptr);
-+        drm_agp_p->unbind_memory(agp_data->ptr);
-         goto fail;
-     }
-     
-@@ -480,9 +376,6 @@
- #endif /* AGPGART */
- }
- 
--
--#if !defined(KERNEL_2_2)
--
- RM_STATUS 
- KernMapAGPNopage(
-     VOID *address,
-@@ -529,9 +422,6 @@
- #endif
- }
- 
--#endif /* !defined(KERNEL_2_2) */
--
--
- RM_STATUS KernFreeAGPPages(
-     nv_state_t *nv,
-     VOID **pAddress,
-@@ -557,8 +447,8 @@
-     {
-         size_t pages = ptr->page_count;
- 
--        (*(agp_ops.unbind_memory))(ptr);
--        (*(agp_ops.free_memory))(ptr);
-+        drm_agp_p->unbind_memory(ptr);
-+        drm_agp_p->free_memory(ptr);
- 
-         nv_printf(NV_DBG_INFO, "NVRM: AGPGART: freed %ld pages\n",
-             (unsigned long)pages);
-diff -ruN NVIDIA_kernel-1.0-4363/os-interface.c NVIDIA_kernel-1.0-4363-2.5/os-interface.c
---- NVIDIA_kernel-1.0-4363/os-interface.c      2003-04-20 03:57:19.000000000 +0200
-+++ NVIDIA_kernel-1.0-4363-2.5/os-interface.c  2003-06-02 00:10:13.000000000 +0200
-@@ -56,7 +56,7 @@
-     PHWINFO pDev
- )
- {
--    return suser();
-+    return NV_IS_SUSER();
- }
- 
- U032 os_get_page_size(VOID)
-@@ -209,6 +209,11 @@
-     U032 size
- )
- {
-+    /*
-+     * XXX This needs to be !NV_MAY_SLEEP() rather than in_interrupt(); that
-+     * requires quite a bit of locking to be rearranged, however, which is why
-+     * I'll leave it alone for now.
-+     */
-     if (in_interrupt()) {
-         if (size <= KMALLOC_LIMIT) {
-             /*
-@@ -286,7 +291,7 @@
-     *address = (void *) va;
- 
-     for (i = 0; i < count; i++) {
--        mem_map_reserve(GET_MAP_NR(__pa((va))));
-+        SetPageReserved(virt_to_page(va));
-         va += PAGE_SIZE;
-     }
- 
-@@ -310,7 +315,7 @@
-     unsigned long va = (unsigned long) address;
- 
-     for (i = 0; i < count; i++) {
--        mem_map_unreserve(GET_MAP_NR(__pa((va))));
-+        ClearPageReserved(virt_to_page(va));
-         va += PAGE_SIZE;
-     }
- 
-@@ -416,7 +421,7 @@
-     if (in_irq() && MilliSeconds > NV_MAX_ISR_MDELAY)
-         return RM_ERROR;
- 
--    if (in_interrupt()) 
-+    if (!NV_MAY_SLEEP()) 
-     {
-         mdelay(MilliSeconds);
-         return RM_OK;
-@@ -514,8 +519,8 @@
- // The current debug display level (default to maximum debug level)
- int cur_debuglevel = 0xaaaaaaaa;
- 
--MODULE_PARM(silence_nvidia_output, "1i");
- static int silence_nvidia_output = 0;
-+NV_MODULE_PARAMETER(silence_nvidia_output);
- 
- 
- //
-@@ -698,14 +703,14 @@
- 
- ULONG os_cli(ULONG flags)
- {
--    save_flags(flags);
--    cli();
-+    NV_SAVE_FLAGS(flags);
-+    NV_CLI();
-     return flags;
- }
- 
- ULONG os_sti(ULONG flags)
- {
--    restore_flags(flags);
-+    NV_RESTORE_FLAGS(flags);
-     return flags;
- }
- 
-@@ -838,16 +843,6 @@
-         vaddr = ioremap_nocache(start, size_bytes);
-     }
- 
--#if defined (KERNEL_2_2)
--    if ((vaddr == NULL)) // && (mode == NV_MEMORY_DEFAULT))
--    {
--        unsigned long map_nr = MAP_NR(__va(start));
--        if (map_nr < max_mapnr) {
--            vaddr = __va(start);
--        }
--    }
--#endif
--
- #ifdef DEBUG
-     if (mode == NV_MEMORY_WRITECOMBINED) {
-         nv_printf(NV_DBG_ERRORS, 
-@@ -868,16 +863,7 @@
-     U032 size_bytes
- )
- {
--#if defined (KERNEL_2_2)
--    if (MAP_NR(addr) < max_mapnr) {
--        // if we didn't want the memory cached, this isn't necessary
--        // but we shouldn't be in a timing critical piece of code.
--        asm volatile("wbinvd":::"memory");
--    } else 
--#endif
--    {
--        iounmap(addr);
--    }
-+    iounmap(addr);
- }
- 
- VOID* os_map_user_space(
-@@ -981,7 +967,7 @@
- 
- U032 os_get_cpu_count()
- {
--    return smp_num_cpus;
-+    return NV_SMP_NUM_CPUS;
- }
- 
- 
-@@ -1044,12 +1030,15 @@
-     if (sgi_funcs.add_barrier == NULL)
-     {
- #if defined(TESTING_SWAP)
--#if !defined (KERNEL_2_2)
-+        /*
-+         * XXX The inter_module_* mechanism has been deprecated in Linux 2.5, a
-+         * new mechanism is in place; this code will need to be updated at some
-+         * point.
-+         */
-         inter_module_register(ADD_BARRIER_FUNC,    THIS_MODULE, sgitest_add_barrier);
-         inter_module_register(REMOVE_BARRIER_FUNC, THIS_MODULE, sgitest_remove_barrier);
-         inter_module_register(SWAP_READY_FUNC,     THIS_MODULE, sgitest_swap_ready);
- #endif
--#endif
-         sgi_funcs.add_barrier = GET_MODULE_SYMBOL(0, ADD_BARRIER_FUNC);
-         sgi_funcs.remove_barrier = GET_MODULE_SYMBOL(0, REMOVE_BARRIER_FUNC);
-         sgi_funcs.swap_ready = GET_MODULE_SYMBOL(0, SWAP_READY_FUNC);
-diff -ruN NVIDIA_kernel-1.0-4363/os-registry.c NVIDIA_kernel-1.0-4363-2.5/os-registry.c
---- NVIDIA_kernel-1.0-4363/os-registry.c       2003-04-20 03:57:19.000000000 +0200
-+++ NVIDIA_kernel-1.0-4363-2.5/os-registry.c   2003-06-02 00:10:13.000000000 +0200
-@@ -48,24 +48,6 @@
-  *   This could be changed to work on a per-device basis.
-  */
- 
--/*
-- * The 2nd argument to MODULE_PARM is used to verify parameters passed
-- * to the module at load time. It should be a string in the following 
-- * format:
-- *
-- *    [min[-max]]{b,h,i,l,s}
-- *
-- * The MIN and MAX specifiers delimit the length of the array. If MAX
-- * is omitted, it defaults to MIN; if both are omitted, the default is
-- * 1. The final character is a type specifier.
-- *
-- *  b   byte
-- *  h   short
-- *  i   int
-- *  l   long
-- *  s   string
-- */
--
- /* 
-  * Option: VideoMemoryTypeOverride
-  * 
-@@ -92,7 +74,7 @@
-  */
- 
- static int NVreg_VideoMemoryTypeOverride = 1;
--MODULE_PARM(NVreg_VideoMemoryTypeOverride, "i");
-+NV_MODULE_PARAMETER(NVreg_VideoMemoryTypeOverride);
- 
- /*
-  * Option: EnableVia4x
-@@ -111,7 +93,7 @@
-  */
- 
- static int NVreg_EnableVia4x = 0;
--MODULE_PARM(NVreg_EnableVia4x, "i");
-+NV_MODULE_PARAMETER(NVreg_EnableVia4x);
- 
- /*
-  * Option: EnableALiAGP
-@@ -134,7 +116,7 @@
-  */
- 
- static int NVreg_EnableALiAGP = 0;
--MODULE_PARM(NVreg_EnableALiAGP, "i");
-+NV_MODULE_PARAMETER(NVreg_EnableALiAGP);
- 
- /* 
-  * Option: ReqAGPRate
-@@ -164,7 +146,7 @@
-  */
- 
- static int NVreg_ReqAGPRate = 7;
--MODULE_PARM(NVreg_ReqAGPRate, "i");
-+NV_MODULE_PARAMETER(NVreg_ReqAGPRate);
- 
- /* 
-  * Option: UpdateKernelAGP
-@@ -193,7 +175,7 @@
-  */
- 
- static int NVreg_UpdateKernelAGP = 1;
--MODULE_PARM(NVreg_UpdateKernelAGP, "i");
-+NV_MODULE_PARAMETER(NVreg_UpdateKernelAGP);
- 
- /* 
-  * Option: EnableAGPSBA
-@@ -226,7 +208,7 @@
- static int NVreg_EnableAGPSBA = 0;
- #endif
- 
--MODULE_PARM(NVreg_EnableAGPSBA, "i");
-+NV_MODULE_PARAMETER(NVreg_EnableAGPSBA);
- 
- /*
-  * Option: EnableAGPFW
-@@ -250,7 +232,7 @@
-  */
- 
- static int NVreg_EnableAGPFW = 0;
--MODULE_PARM(NVreg_EnableAGPFW, "i");
-+NV_MODULE_PARAMETER(NVreg_EnableAGPFW);
- 
- /*
-  * Option: SoftEDIDs
-@@ -269,7 +251,7 @@
-  */
- 
- static int NVreg_SoftEDIDs = 1;
--MODULE_PARM(NVreg_SoftEDIDs, "i");
-+NV_MODULE_PARAMETER(NVreg_SoftEDIDs);
- 
- /* 
-  * Option: Mobile
-@@ -293,14 +275,14 @@
-  */
- 
- static int NVreg_Mobile = ~0;
--MODULE_PARM(NVreg_Mobile, "i");
-+NV_MODULE_PARAMETER(NVreg_Mobile);
- 
- 
- static int NVreg_ResmanDebugLevel = ~0;
--MODULE_PARM(NVreg_ResmanDebugLevel, "i");
-+NV_MODULE_PARAMETER(NVreg_ResmanDebugLevel);
- 
- static int NVreg_FlatPanelMode = 0;
--MODULE_PARM(NVreg_FlatPanelMode, "i");
-+NV_MODULE_PARAMETER(NVreg_FlatPanelMode);
- 
- /*
-  * You can enable any of the registry options disabled by default by
diff --git a/media-video/nvidia-kernel/files/1.0.4496/NVIDIA_kernel-1.0-4496-2.6-20030905.diff b/media-video/nvidia-kernel/files/1.0.4496/NVIDIA_kernel-1.0-4496-2.6-20030905.diff
deleted file mode 100644 (file)
index 5e677a8..0000000
+++ /dev/null
@@ -1,2538 +0,0 @@
-diff -ruN NVIDIA_kernel-1.0-4496/Makefile NVIDIA_kernel-1.0-4496-2.6/Makefile
---- NVIDIA_kernel-1.0-4496/Makefile    2003-07-17 04:56:13.000000000 +0200
-+++ NVIDIA_kernel-1.0-4496-2.6/Makefile        1970-01-01 01:00:00.000000000 +0100
-@@ -1,169 +0,0 @@
--# This Makefile is automatically generated; do not edit
--#   Generated on 'builder3.nvidia.com' on Wed Jul 16 19:03:10 PDT 2003
--
--LINUX_MODULE=nv-linux.o
--DEFINES=-D__KERNEL__ -DMODULE -D_LOOSE_KERNEL_NAMES -DNTRM -D_GNU_SOURCE -D_LOOSE_KERNEL_NAMES -D__KERNEL__ -DMODULE  -DNV_MAJOR_VERSION=1 -DNV_MINOR_VERSION=0 -DNV_PATCHLEVEL=4496  -DNV_UNIX   -DNV_LINUX   -DNV_INT64_OK   -DNVCPU_X86     
--INCLUDES=-I.
--
--OBJECTS=nv.o os-agp.o os-interface.o os-registry.o 
--HEADERS=os-agp.h os-interface.h nv-linux.h nv-misc.h nv-memdbg.h nv.h  rmretval.h nvtypes.h  $(VERSION_HDR)
--
--CFLAGS=-Wall -Wimplicit -Wreturn-type -Wswitch -Wformat -Wchar-subscripts -Wparentheses -Wpointer-arith -Wcast-qual -Wno-multichar  -O -MD $(DEFINES) $(INCLUDES) -Wno-cast-qual
--
--RESMAN_KERNEL_MODULE=nv-kernel.o
--
--KERNDIR=/lib/modules/$(shell uname -r)
--
--# check for newer paths. if found, use them, otherwise use old paths
--# these wouldn't work with the gnu make included with rh6.2
--# KERNINC=$(if -d $(KERNDIR)/build, $(KERNDIR)/build/include, /usr/src/linux/include)
--# INSTALLDIR=$(if -d $(KERNDIR)/kernel, $(KERNDIR)/kernel/drivers/video, $(KERNDIR)/video)
--
--# this is slightly more brain-dead, but works..
--ifeq ($(shell if test -d $(KERNDIR)/build; then echo yes; fi),yes)
--KERNINC=$(KERNDIR)/build/include
--else
--KERNINC=/usr/src/linux/include
--endif
--
--ifeq ($(shell if test -d $(KERNDIR)/kernel; then echo yes; fi),yes)
--INSTALLDIR=$(KERNDIR)/kernel/drivers/video
--else
--INSTALLDIR=$(KERNDIR)/video
--endif
--
--ifeq ($(shell echo $(NVDEBUG)),1)
--  ifeq ($(shell test -z $(RMDEBUG) && echo yes),yes)
--    RMDEBUG=1
--  endif
--endif
--
--ifeq ($(shell echo $(RMDEBUG)),1)
--CFLAGS += -DDEBUG -g -fno-common
--endif
--
--# this is just plain wrong, get rid of it
--BROKENDIR=$(KERNDIR)/kernel/video
--
--INSTALL=$(shell which install)
--
--# determine gcc versions used (kernel, nvidia.o)
--module_cc:=$(shell $(CC) -v 2>&1 | tail -n 1)
--version="^Linux version [^(]* (.*@.*) (\(.*\)) .*"
--kernel_cc:=$(shell cat /proc/version | sed "s/"$(version)"/\1/")
--
--module_cc:=$(shell echo "$(module_cc)" | cut -d ' ' -f 3)
--kernel_cc:=$(shell echo "$(kernel_cc)" | cut -d ' ' -f 3)
--
--# allow specification of alternate include file tree on command line and extra defines
--ifdef SYSINCLUDE
--INCLUDES += -I$(SYSINCLUDE)
--else
--INCLUDES += -I$(KERNINC)
--endif
--
--ifeq ($(shell sh conftest.sh remap_page_range $(INCLUDES)), 5)
--  DEFINES += -DREMAP_PAGE_RANGE_5
--endif
--
--ifeq ($(shell sh conftest.sh remap_page_range $(INCLUDES)), 4)
--  DEFINES += -DREMAP_PAGE_RANGE_4
--endif
--
--DEFINES+=$(EXTRA_DEFINES)
--
--# allow build parameters to be passed in through the environment
--ifdef BUILD_PARAMS
--    DEFINES+=-D$(BUILD_PARAMS)
--endif
--
--VERSION_HDR=nv_compiler.h
--
--all: install
--
--install: package-install
--
--package-install: nvidia.o rmmod-check
--      @if [ `id -ur` != 0 ]; then \
--              echo Please run \"make install\" as root.; \
--      else \
--              if [ -d $(BROKENDIR) ]; then \
--                      rm -f $(BROKENDIR)/NVdriver; \
--                      rmdir --ignore-fail-on-non-empty $(BROKENDIR); \
--              fi && \
--              mkdir -p $(INSTALLDIR) && \
--              rm -f $(INSTALLDIR)/NVdriver && \
--              $(INSTALL) -m 0664 -o root -g root nvidia.o $(INSTALLDIR)/nvidia.o$(O) && \
--              PATH="$(PATH):/bin:/sbin" depmod -a && \
--                PATH="$(PATH):/bin:/sbin" modprobe nvidia && \
--              sh makedevices.sh && \
--              echo "nvidia.o installed successfully."; \
--      fi
--
--RMMOD_ERROR=\
--      echo ""; \
--      echo "Unable to remove existing NVIDIA kernel module."; \
--      echo "Please be sure you have exited X before attempting"; \
--      echo "to install the NVIDIA kernel module."; \
--      echo ""; \
--      echo -en "\033[1;31m"; \
--      echo -e  "*** Failed rmmod sanity check. Bailing out! ***"; \
--      echo -en "\033[0m"; \
--      exit 1;
--
--rmmod-check:
--      @if PATH="$(PATH):/bin:/sbin" lsmod | grep -w nvidia > /dev/null; then \
--              if ! PATH="($PATH):/bin:/sbin" rmmod nvidia > /dev/null; then $(RMMOD_ERROR) fi \
--      fi; \
--      if PATH="$(PATH):/bin:/sbin" lsmod | grep -w NVdriver > /dev/null; then \
--              if ! PATH="$(PATH):/bin:/sbin" rmmod NVdriver > /dev/null; then $(RMMOD_ERROR) fi \
--      fi
--
--gcc-check:
--      @if [ -z $(IGNORE_CC_MISMATCH) ]; then \
--       if [ "$(kernel_cc)" != "$(module_cc)" ]; then \
--      echo "                                                           "; \
--      echo "You appear to be compiling the NVIDIA kernel module with   "; \
--      echo "a compiler different from the one that was used to compile "; \
--      echo "the running kernel. This may be perfectly fine, but there  "; \
--      echo "are cases where this can lead to unexpected behaviour and  "; \
--      echo "system crashes.                                            "; \
--      echo "                                                           "; \
--      echo "If you know what you are doing and want to override this   "; \
--      echo "check, you can do so by setting IGNORE_CC_MISMATCH.        "; \
--      echo "                                                           "; \
--      echo "In any other case, set the CC environment variable to the  "; \
--      echo "name of the compiler that was used to compile the kernel.  "; \
--      echo "                                                           "; \
--      echo -en "\033[1;31m"; \
--      echo -e  "*** Failed cc sanity check. Bailing out! ***"; \
--      echo -en "\033[0m"; \
--      exit 1; \
--       fi \
--      fi
--
--nvidia.o: gcc-check $(LINUX_MODULE) $(RESMAN_KERNEL_MODULE) 
--      ld -r -o $@ $(LINUX_MODULE) $(RESMAN_KERNEL_MODULE)
--
--$(VERSION_HDR): 
--      echo \#define NV_COMPILER \"`$(CC) -v 2>&1 | tail -n 1`\" > $@
--
--$(LINUX_MODULE): $(OBJECTS)
--      ld -r -o $@ $(OBJECTS)
--
--%.o: %.c $(HEADERS)
--      $(CC) -c $(CFLAGS) $<
--
--# debug tool to preprocess the file and leave .i to make it easier to untangle #defines
--%.i: %.c
--      $(CC) $(CFLAGS) -E $< > $@
--
--%.s: %.c
--      $(CC) $(CFLAGS) -S $< > $@
--
--
--clean:
--      $(RM) $(OBJECTS) $(LINUX_MODULE) $(VERSION_HDR) *.d NVdriver nvidia.o
--
--
---include $(OBJECTS:%.o=%.d)
-diff -ruN NVIDIA_kernel-1.0-4496/Makefile.kbuild NVIDIA_kernel-1.0-4496-2.6/Makefile.kbuild
---- NVIDIA_kernel-1.0-4496/Makefile.kbuild     1970-01-01 01:00:00.000000000 +0100
-+++ NVIDIA_kernel-1.0-4496-2.6/Makefile.kbuild 2003-07-31 19:52:00.000000000 +0200
-@@ -0,0 +1,258 @@
-+#
-+# KBUILD Makefile for the NVIDIA Linux kernel module.
-+#
-+# The motivation for replacing the original Makefile is the hope that this
-+# version will simplify the build and installation process. In the past,
-+# many architectural and cosmetic changes to the Linux kernel have made it
-+# difficult to maintain compatibility or required duplication of logic.
-+#
-+# Linux 2.5 introduces numerous such changes, many of which impact modules.
-+# Relying on KBUILD, some aspects of the build system otherwise difficult
-+# to support (for example, module versioning) are abstracted away and dealt
-+# with elsewhere, making life significantly easier here.
-+#
-+# The new approach currently has its own share of problems, some of which
-+# are architectural difficulties with KBUILD, others minor annoyances. For
-+# this reason, an improved version of the NVIDIA Makefile is available to
-+# those experiencing difficulties.
-+#
-+# Please report any problems you may be experiencing with this experimental
-+# Makefile to either one (or, preferably, both) of us:
-+#
-+# Alistair J Strachan (alistair@devzero.co.uk) (first pass, enhancements)
-+# Christian Zander (zander@mail.minion.de) (enhancements)
-+#
-+
-+all: install
-+install: package-install
-+
-+#
-+# The NVIDIA kernel module base name and static file names. KBUILD will go
-+# ahead and append ".o" or ".ko" to form the final module name.
-+#
-+
-+MODULE_NAME := nvidia
-+VERSION_HEADER := nv_compiler.h
-+
-+#
-+# List of object files to link into NVIDIA kernel module; make sure KBUILD
-+# understands that we want a module.
-+#
-+
-+RESMAN_CORE_OBJS := nv-kernel.o
-+RESMAN_GLUE_OBJS := nv.o os-agp.o os-interface.o os-registry.o
-+
-+$(MODULE_NAME)-objs := $(RESMAN_CORE_OBJS) $(RESMAN_GLUE_OBJS)
-+
-+#
-+# A bug in KBUILD 2.4 means that leaving obj-m set in top-level context
-+# will cause Rules.make to call pathdown.sh, which is wrong. So, we only
-+# set this conditional of a kernel-level instance.
-+#
-+
-+ifdef TOPDIR
-+obj-m += $(MODULE_NAME).o
-+endif
-+
-+#
-+# Include local source directory in $(CC)'s include path and set disable any
-+# warning types that are of little interest to us.
-+#
-+
-+EXTRA_CFLAGS += -I$(src)
-+EXTRA_CFLAGS += -Wno-cast-qual -Wno-strict-prototypes
-+
-+#
-+# Determine location of the Linux kernel source tree. Allow users to override
-+# the default (i.e. automatically determined) kernel source location with the
-+# KERNDIR directive; this new directive replaces NVIDIA's SYSINCLUDE.
-+#
-+
-+ifdef KERNDIR
-+  KERNEL_SOURCES := $(KERNDIR)
-+  KERNEL_HEADERS := -I$(KERNEL_SOURCES)/include
-+  MODULE_ROOT    := /lib/modules/$(shell uname -r)/kernel/drivers # XXX
-+else
-+  KERNEL_SOURCES := /lib/modules/$(shell uname -r)/build
-+  KERNEL_HEADERS := -I$(KERNEL_SOURCES)/include
-+  MODULE_ROOT    := /lib/modules/$(shell uname -r)/kernel/drivers
-+endif
-+
-+#
-+# We rely on these two definitions below; if they aren't set, we set them to
-+# reasonable defaults (Linux 2.4's KBUILD, and top-level passes will not set
-+# these).
-+#
-+
-+src ?= .
-+obj ?= .
-+
-+#
-+# Sets any internal variables left unset by KBUILD (e.g. this happens during
-+# a top-level run).
-+#
-+
-+TOPDIR ?= $(KERNEL_SOURCES)
-+PATCHLEVEL ?= $(shell sh $(src)/conftest.sh kernel_patch_level $(TOPDIR))
-+
-+#
-+# Linux 2.4 uses the .o module extension. Linux 2.5, however, uses the .ko
-+# module extension. Handle these gracefully.
-+#
-+
-+ifeq ($(PATCHLEVEL), 4)
-+  MODULE_OBJECT := $(MODULE_NAME).o
-+else
-+  MODULE_OBJECT := $(MODULE_NAME).ko
-+endif
-+
-+#
-+# NVIDIA specific CFLAGS and #define's. The remap_page_range check has become
-+# necessary with the introduction of the five argument version to Linux 2.4
-+# distribution kernels; this conflicting change cannot be detected at compile
-+# time.
-+#
-+
-+EXTRA_CFLAGS += -DNTRM -D_LOOSE_KERNEL_NAMES -D__KERNEL__ -DMODULE  -DNV_MAJOR_VERSION=1 -DNV_MINOR_VERSION=0 -DNV_PATCHLEVEL=4496  -DNV_UNIX   -DNV_LINUX   -DNV_INT64_OK   -DNVCPU_X86  
-+
-+ifeq ($(shell echo $(NVDEBUG)),1)
-+  ifeq ($(shell test -z $(RMDEBUG) && echo yes),yes)
-+    RMDEBUG=1
-+  endif
-+endif
-+
-+ifeq ($(shell echo $(RMDEBUG)),1)
-+  EXTRA_CFLAGS += -DDEBUG -g -fno-common
-+endif
-+
-+ifeq ($(shell sh $(src)/conftest.sh remap_page_range $(KERNEL_HEADERS)), 5)
-+  EXTRA_CFLAGS += -DREMAP_PAGE_RANGE_5
-+endif
-+
-+ifeq ($(shell sh $(src)/conftest.sh remap_page_range $(KERNEL_HEADERS)), 4)
-+  EXTRA_CFLAGS += -DREMAP_PAGE_RANGE_4
-+endif
-+
-+#
-+# NVIDIA binary object file includes .common section.
-+#
-+
-+EXTRA_LDFLAGS := -d
-+
-+#
-+# Miscellaneous NVIDIA kernel module build support targets. They are needed
-+# to satisfy KBUILD requirements and to support NVIDIA specifics.
-+#
-+
-+$(obj)/nv-kernel.o:
-+      cp $(src)/$(RESMAN_CORE_OBJS) $(obj)/$(RESMAN_CORE_OBJS)
-+
-+$(obj)/$(VERSION_HEADER):
-+      echo \#define NV_COMPILER \"`$(CC) -v 2>&1 | tail -n 1`\" > $@
-+
-+$(obj)/nv.o: $(obj)/$(VERSION_HEADER)
-+
-+#
-+# More quirks for Linux 2.4 KBUILD, which doesn't link automatically.
-+#
-+
-+ifeq ($(PATCHLEVEL), 4)
-+$(obj)/$(MODULE_NAME).o: $($(MODULE_NAME)-objs)
-+      $(LD) $(EXTRA_LDFLAGS) -r -o $@ $($(MODULE_NAME)-objs)
-+endif
-+
-+#
-+# KBUILD build parameters.
-+#
-+
-+KBUILD_PARAMS := -C $(KERNEL_SOURCES) SUBDIRS=$(PWD)
-+
-+#
-+# NVIDIA sanity checks.
-+#
-+
-+suser-sanity-check:
-+      @if ! sh conftest.sh suser_sanity_check; then \
-+        echo; \
-+        echo "You have insufficient privileges for this operation. Please "; \
-+        echo "run \"make install\" as root!                               "; \
-+        echo; \
-+        exit 1; \
-+      fi
-+
-+rmmod-sanity-check:
-+      @if ! sh conftest.sh rmmod_sanity_check $(MODULE_NAME); then \
-+        echo; \
-+        echo "Unable to unload the currently loaded NVIDIA kernel module! "; \
-+        echo "Please be certain that you have exited X before attempting  "; \
-+        echo "to install this version.                                    "; \
-+        echo; \
-+        exit 1; \
-+      fi
-+
-+cc-sanity-check:
-+      @if ! sh conftest.sh cc_sanity_check $(CC); then \
-+        echo; \
-+        echo "You appear to be building the NVIDIA kernel module with a  "; \
-+        echo "compiler different from the one that was used to build the "; \
-+        echo "running kernel. This may be perfectly fine, but there are  "; \
-+        echo "cases where this can lead to unexpected behaviour and      "; \
-+        echo "system crashes.                                            "; \
-+        echo; \
-+        echo "If you know what you are doing and want to override this   "; \
-+        echo "check, you can do so by setting IGNORE_CC_MISMATCH.        "; \
-+        echo; \
-+        echo "In any other case, set the CC environment variable to the  "; \
-+        echo "name of the compiler that was used to build the kernel.    "; \
-+        echo; \
-+        exit 1; \
-+      fi
-+
-+#
-+# Build the NVIDIA kernel module using Linux KBUILD. This target is used by
-+# the "package-install" target below.
-+#
-+
-+module: cc-sanity-check
-+      @make $(KBUILD_PARAMS) modules; \
-+      if ! [ -f $(MODULE_OBJECT) ]; then \
-+        echo "$(MODULE_OBJECT) failed to build!"; \
-+        exit 1; \
-+      fi
-+
-+#
-+# Build the NVIDIA kernel module with KBUILD. Verify that the user posesses
-+# sufficient privileges. Rebuild the module dependency file.
-+#
-+
-+module-install: suser-sanity-check module
-+      @mkdir -p $(MODULE_ROOT)/video; \
-+      install -m 0664 -o root -g root $(MODULE_OBJECT) $(MODULE_ROOT)/video; \
-+      /sbin/depmod -ae;
-+
-+#
-+# This target builds, then installs, then creates device nodes and inserts
-+# the module, if successful.
-+#
-+
-+package-install: module-install rmmod-sanity-check
-+      @sh makedevices.sh; \
-+      /sbin/modprobe $(MODULE_NAME) && \
-+      echo "$(MODULE_OBJECT) installed successfully.";
-+
-+#
-+# Support hack, KBUILD isn't prepared to clean up after external modules.
-+#
-+
-+clean:
-+      @rm -f $(RESMAN_GLUE_OBJS) .*.{cmd,flags}
-+      @rm -f $(MODULE_NAME).{o,ko,mod.{o,c}} built-in.o $(VERSION_HEADER) *~
-+
-+#
-+# Linux 2.4 KBUILD requires the inclusion of Rules.make; Linux 2.5's KBUILD
-+# includes dependencies automatically.
-+#
-+
-+ifeq ($(PATCHLEVEL), 4)
-+include $(KERNEL_SOURCES)/Rules.make
-+endif
-diff -ruN NVIDIA_kernel-1.0-4496/Makefile.nvidia NVIDIA_kernel-1.0-4496-2.6/Makefile.nvidia
---- NVIDIA_kernel-1.0-4496/Makefile.nvidia     1970-01-01 01:00:00.000000000 +0100
-+++ NVIDIA_kernel-1.0-4496-2.6/Makefile.nvidia 2003-07-31 19:52:06.000000000 +0200
-@@ -0,0 +1,154 @@
-+# This Makefile is automatically generated; do not edit
-+#   Generated on 'builder3.nvidia.com' on Thu Jun 19 04:05:35 PDT 2003
-+
-+LINUX_MODULE=nv-linux.o
-+DEFINES=-D__KERNEL__ -DMODULE -D_LOOSE_KERNEL_NAMES -DKBUILD_MODNAME="nvidia" -DNTRM -D_GNU_SOURCE -D_LOOSE_KERNEL_NAMES -D__KERNEL__ -DMODULE  -DNV_MAJOR_VERSION=1 -DNV_MINOR_VERSION=0 -DNV_PATCHLEVEL=4480     -DNV_UNIX   -DNV_LINUX   -DNV_INT64_OK   -DNVCPU_X86  
-+INCLUDES=-I.
-+
-+OBJECTS=nv.o os-agp.o os-interface.o os-registry.o 
-+HEADERS=os-agp.h os-interface.h nv-linux.h nv-misc.h nv-memdbg.h nv.h  rmretval.h nvtypes.h  $(VERSION_HDR)
-+
-+CFLAGS=-Wall -Wimplicit -Wreturn-type -Wswitch -Wformat -Wchar-subscripts -Wparentheses -Wcast-qual -Wno-multichar  -O -MD $(DEFINES) $(INCLUDES) -Wno-cast-qual
-+
-+RESMAN_KERNEL_MODULE=nv-kernel.o
-+
-+KERNDIR=/lib/modules/$(shell uname -r)
-+
-+# check for newer paths. if found, use them, otherwise use old paths
-+# these wouldn't work with the gnu make included with rh6.2
-+# KERNINC=$(if -d $(KERNDIR)/build, $(KERNDIR)/build/include, /usr/src/linux/include)
-+# INSTALLDIR=$(if -d $(KERNDIR)/kernel, $(KERNDIR)/kernel/drivers/video, $(KERNDIR)/video)
-+
-+# this is slightly more brain-dead, but works..
-+ifeq ($(shell if test -d $(KERNDIR)/build; then echo yes; fi),yes)
-+KERNINC=$(KERNDIR)/build/include
-+else
-+KERNINC=/usr/src/linux/include
-+endif
-+
-+ifeq ($(shell if test -d $(KERNDIR)/kernel; then echo yes; fi),yes)
-+INSTALLDIR=$(KERNDIR)/kernel/drivers/video
-+else
-+INSTALLDIR=$(KERNDIR)/video
-+endif
-+
-+ifeq ($(shell echo $(NVDEBUG)),1)
-+  ifeq ($(shell test -z $(RMDEBUG) && echo yes),yes)
-+    RMDEBUG=1
-+  endif
-+endif
-+
-+ifeq ($(shell echo $(RMDEBUG)),1)
-+CFLAGS += -DDEBUG -g -fno-common
-+endif
-+
-+# this is just plain wrong, get rid of it
-+BROKENDIR=$(KERNDIR)/kernel/video
-+
-+INSTALL=$(shell which install)
-+
-+# allow specification of alternate include file tree on command line and extra defines
-+ifdef SYSINCLUDE
-+INCLUDES += -I$(SYSINCLUDE)
-+INCLUDES += -I$(SYSINCLUDE)/asm/mach-default
-+else
-+INCLUDES += -I$(KERNINC)
-+INCLUDES += -I$(KERNINC)/asm/mach-default
-+endif
-+
-+ifeq ($(shell sh conftest.sh remap_page_range $(INCLUDES)), 5)
-+  DEFINES += -DREMAP_PAGE_RANGE_5
-+endif
-+
-+ifeq ($(shell sh conftest.sh remap_page_range $(INCLUDES)), 4)
-+  DEFINES += -DREMAP_PAGE_RANGE_4
-+endif
-+
-+DEFINES+=$(EXTRA_DEFINES)
-+
-+# allow build parameters to be passed in through the environment
-+ifdef BUILD_PARAMS
-+    DEFINES+=-D$(BUILD_PARAMS)
-+endif
-+
-+VERSION_HDR=nv_compiler.h
-+
-+all: install
-+
-+install: package-install
-+
-+suser-sanity-check:
-+      @if ! sh conftest.sh suser_sanity_check; then \
-+        echo; \
-+        echo "You have insufficient privileges for this operation. Please "; \
-+        echo "run \"make install\" as root!                               "; \
-+        echo; \
-+        exit 1; \
-+      fi
-+
-+rmmod-sanity-check:
-+      @if ! sh conftest.sh rmmod_sanity_check nvidia; then \
-+        echo; \
-+        echo "Unable to unload the currently loaded NVIDIA kernel module! "; \
-+        echo "Please be certain that you have exited X before attempting  "; \
-+        echo "to install this version.                                    "; \
-+        echo; \
-+        exit 1; \
-+      fi
-+
-+cc-sanity-check:
-+      @if ! sh conftest.sh cc_sanity_check $(CC); then \
-+        echo; \
-+        echo "You appear to be building the NVIDIA kernel module with a  "; \
-+        echo "compiler different from the one that was used to build the "; \
-+        echo "running kernel. This may be perfectly fine, but there are  "; \
-+        echo "cases where this can lead to unexpected behaviour and      "; \
-+        echo "system crashes.                                            "; \
-+        echo; \
-+        echo "If you know what you are doing and want to override this   "; \
-+        echo "check, you can do so by setting IGNORE_CC_MISMATCH.        "; \
-+        echo; \
-+        echo "In any other case, set the CC environment variable to the  "; \
-+        echo "name of the compiler that was used to build the kernel.    "; \
-+        echo; \
-+        exit 1; \
-+      fi
-+
-+package-install: suser-sanity-check nvidia.o rmmod-sanity-check
-+      if [ -d $(BROKENDIR) ]; then \
-+              rm -f $(BROKENDIR)/NVdriver; \
-+              rmdir --ignore-fail-on-non-empty $(BROKENDIR); \
-+      fi && \
-+      mkdir -p $(INSTALLDIR) && \
-+      rm -f $(INSTALLDIR)/NVdriver && \
-+      $(INSTALL) -m 0664 -o root -g root nvidia.o $(INSTALLDIR)/nvidia.o$(O) && \
-+      /sbin/depmod -a && \
-+      /sbin/modprobe nvidia && \
-+      sh makedevices.sh && \
-+      echo "nvidia.o installed successfully."; \
-+
-+nvidia.o: cc-sanity-check $(LINUX_MODULE) $(RESMAN_KERNEL_MODULE) 
-+      ld -d -r -o $@ $(LINUX_MODULE) $(RESMAN_KERNEL_MODULE)
-+
-+$(VERSION_HDR): 
-+      echo \#define NV_COMPILER \"`$(CC) -v 2>&1 | tail -n 1`\" > $@
-+
-+$(LINUX_MODULE): $(OBJECTS)
-+      ld -r -o $@ $(OBJECTS)
-+
-+%.o: %.c $(HEADERS)
-+      $(CC) -c $(CFLAGS) $<
-+
-+# debug tool to preprocess the file and leave .i to make it easier to untangle #defines
-+%.i: %.c
-+      $(CC) $(CFLAGS) -E $< > $@
-+
-+%.s: %.c
-+      $(CC) $(CFLAGS) -S $< > $@
-+
-+
-+clean:
-+      $(RM) $(OBJECTS) $(LINUX_MODULE) $(VERSION_HDR) *.d NVdriver nvidia.o
-+
-+
-+-include $(OBJECTS:%.o=%.d)
-diff -ruN NVIDIA_kernel-1.0-4496/conftest.sh NVIDIA_kernel-1.0-4496-2.6/conftest.sh
---- NVIDIA_kernel-1.0-4496/conftest.sh 2003-07-17 04:56:13.000000000 +0200
-+++ NVIDIA_kernel-1.0-4496-2.6/conftest.sh     2003-08-23 22:21:06.000000000 +0200
-@@ -37,5 +37,79 @@
-           exit 1
-         fi
-     ;;
-+
-+    cc_sanity_check)
-+        shift
-+        #
-+        # Verify that the same compiler is used for the kernel and kernel
-+        # module.
-+        #
-+        if test -n "$IGNORE_CC_MISMATCH" -o -n "$KERNDIR"; then
-+          #
-+          # The user chose to disable the gcc sanity test or is building
-+          # the module for a kernel not currently running, which renders
-+          # our test meaningless.
-+          #
-+          exit 0
-+        fi
-+
-+        VERSION="^Linux version.* (.*) (\(gcc.*\)).*"
-+        KERNEL=$(cat /proc/version | sed "s/$VERSION/\1/")
-+        MODULE=$($* -v 2>&1 | tail -n 1)
-+
-+        if test "$KERNEL" != "$MODULE"; then
-+          #
-+          # The kernel seems to have been built with a different version
-+          # of the C compiler, which may be a problem.
-+          #
-+          exit 1
-+        else
-+          exit 0
-+        fi
-+    ;;
-+
-+    kernel_patch_level)
-+        shift
-+        #
-+        # Determine the kernel's major patch level; this is only done if we
-+        # aren't told by KBUILD.
-+        #
-+        echo $(cat "$1"/Makefile | grep "PATCHLEVEL =" | cut -d " " -f 3)
-+        exit 0
-+    ;;
-+
-+    suser_sanity_check)
-+        shift
-+        #
-+        # Determine the caller's user id to determine if we have sufficient
-+        # privileges for the requested operation.
-+        #
-+        if test $(id -ur) != 0; then
-+          exit 1
-+        else
-+          exit 0
-+        fi
-+    ;;
-+
-+    rmmod_sanity_check)
-+        shift
-+        #
-+        # Make sure that any currently loaded NVIDIA kernel module can be
-+        # unloaded.
-+        #
-+        if /sbin/lsmod | grep -q "$1"; then
-+          /sbin/rmmod "$1" >& /dev/null
-+        fi
-+
-+        if /sbin/lsmod | grep -q "$1"; then
-+          #
-+          # The NVIDIA kernel module is still loaded, most likely because
-+          # it is busy.
-+          #
-+          exit 1
-+        else
-+          exit 0
-+        fi
-+    ;;
- esac
- 
-diff -ruN NVIDIA_kernel-1.0-4496/makedevices.sh NVIDIA_kernel-1.0-4496-2.6/makedevices.sh
---- NVIDIA_kernel-1.0-4496/makedevices.sh      2003-07-17 04:56:13.000000000 +0200
-+++ NVIDIA_kernel-1.0-4496-2.6/makedevices.sh  2003-09-03 09:24:38.000000000 +0200
-@@ -8,39 +8,37 @@
- # create a temporary file
- tmp=`(mktemp -q /tmp/nvidia.XXXXXX) 2> /dev/null` || tmp="/tmp/nvidia.$$"
- 
--paths=" /etc/modutils/aliases    \
--        /etc/modules.conf        \
--        /etc/conf.modules        "
-+modconfs=" /etc/modutils/aliases    \
-+           /etc/modules.conf        \
-+           /etc/modprobe.d/aliases  \
-+           /etc/modprobe.conf       \
-+           /etc/conf.modules        "
- 
--modconf=""
--for path in $paths; do
--   if [ -f "$path" ]; then
--       modconf=$path
--       break
-+#
-+# Pass the -p option to cp to preserve the permissions of $modconf and
-+# /etc/rc.d/rc.modules across the update. Update all relevant files
-+# including those eventually regenerated to avoid the need for awkward
-+# logic here.
-+#
-+for modconf in $modconfs; do
-+   if [ -f "$modconf" ]; then
-+     cp -p $modconf $tmp
-+     sed '/^alias.*\(NVdriver\|nvidia\)/d'  < $modconf   > $tmp
-+     if [ -c /dev/.devfsd ]; then
-+       echo "alias /dev/nvidia* nvidia" >> $tmp
-+     else
-+       echo "alias char-major-195 nvidia" >> $tmp
-+     fi
-+     mv -f $tmp $modconf
-+     test -x /sbin/update-modules && /sbin/update-modules
-    fi
- done
- 
--if [ ! -z $modconf ]; then
--   # Initialize the permissions on $tmp so that we don't change the
--   # permissions of $modconf when we mv it into place
--   cp -p $modconf $tmp
--   sed '/^alias.*\(NVdriver\|nvidia\)/d'  < $modconf   > $tmp
--   if [ -c /dev/.devfsd ]; then
--     echo "alias /dev/nvidia*   nvidia" >> $tmp
--   else
--     echo "alias char-major-195 nvidia" >> $tmp
--   fi
--   mv -f $tmp $modconf
--   test -x /sbin/update-modules && /sbin/update-modules
--else
--  if [ -f /etc/rc.d/rc.modules ]; then
--    # Initialize the permissions on $tmp so that we don't change the
--    # permissions of /etc/rc.d/rc.modules when we mv it into place
--    cp -p /etc/rc.d/rc.modules $tmp
--    sed '/.*\(NVdriver\|nvidia\).*/d' < /etc/rc.d/rc.modules > $tmp
--    echo -e "\n/sbin/modprobe nvidia" >> $tmp
--    mv -f $tmp /etc/rc.d/rc.modules
--  fi
-+if [ -f /etc/rc.d/rc.modules ]; then
-+  cp -p /etc/rc.d/rc.modules $tmp
-+  sed '/.*\(NVdriver\|nvidia\).*/d' < /etc/rc.d/rc.modules > $tmp
-+  echo -e "\n/sbin/modprobe nvidia" >> $tmp
-+  mv -f $tmp /etc/rc.d/rc.modules
- fi
- 
- if [ ! -c /dev/.devfsd ]; then
-diff -ruN NVIDIA_kernel-1.0-4496/nv-linux.h NVIDIA_kernel-1.0-4496-2.6/nv-linux.h
---- NVIDIA_kernel-1.0-4496/nv-linux.h  2003-07-17 04:56:13.000000000 +0200
-+++ NVIDIA_kernel-1.0-4496-2.6/nv-linux.h      2003-09-05 16:59:47.000000000 +0200
-@@ -20,35 +20,22 @@
- #  define MODVERSIONS
- #endif
- 
--#if defined (MODVERSIONS)
--#include <linux/modversions.h>
--#endif
--
- #include <linux/kernel.h>
- #include <linux/module.h>
- #include <linux/version.h>
- 
--#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 2, 12)
--#  error This driver does not support 2.2.11 or earlier kernels!
--#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 3, 0)
--#  define KERNEL_2_2
--#  warning NVIDIA is considering dropping support for linux-2.2 
--#  warning kernels. While end users are free to maintain their 
--#  warning own patches, or stick with current drivers, our new 
--#  warning drivers will not work "out of the box." If you are 
--#  warning concerned about lack of support for 2.2 kernels, 
--#  warning please let us know at linux-bugs@nvidia.com; we would
--#  warning like to know how many users would be seriously 
--#  warning impacted by this decision.
-+#if   LINUX_VERSION_CODE < KERNEL_VERSION(2, 3, 0)
-+#  error This driver does not support 2.2.x kernels!
- #elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 0)
--#  error This driver does not support 2.3.x development kernels!
-+#  error This driver does not support 2.3.x kernels!
- #elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
- #  define KERNEL_2_4
- #elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
--#  error This driver does not support 2.5.x development kernels!
--#  define KERNEL_2_5
-+#  error This driver does not support 2.5.x kernels!
-+#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 7, 0)
-+#  define KERNEL_2_6
- #else
--#  error This driver does not support 2.6.x or newer kernels!
-+#  error This driver does not support development kernels!
- #endif
- 
- #if defined (__ia64)
-@@ -61,12 +48,15 @@
- #define __SMP__
- #endif
- 
-+#if defined (MODVERSIONS) && !defined (KERNEL_2_6)
-+#include <linux/modversions.h>
-+#endif
-+
- #include <linux/types.h>            /* pic_t, size_t, __u32, etc        */
- #include <linux/errno.h>            /* error codes                      */
- #include <linux/list.h>             /* circular linked list             */
- #include <linux/stddef.h>           /* NULL, offsetof                   */
- #include <linux/wait.h>             /* wait queues                      */
--#include <linux/tqueue.h>           /* struct tq_struct                 */
- 
- #include <linux/slab.h>             /* kmalloc, kfree, etc              */
- #include <linux/vmalloc.h>          /* vmalloc, vfree, etc              */
-@@ -74,9 +64,15 @@
- #include <linux/poll.h>             /* poll_wait                        */
- #include <linux/delay.h>            /* mdelay, udelay                   */
- 
-+#ifdef KERNEL_2_6
-+#include <linux/sched.h>            /* suser(), capable() replacement   */
-+#include <linux/moduleparam.h>      /* module_param()                   */
-+#include <linux/smp_lock.h>         /* kernel_locked                    */
-+#include <asm/kmap_types.h>         /* page table entry lookup          */
-+#endif
-+
- #include <linux/pci.h>              /* pci_find_class, etc              */
--#include <linux/wrapper.h>          /* mem_map_reserve                  */
--#include <linux/interrupt.h>        /* mark_bh, init_bh, remove_bh      */
-+#include <linux/interrupt.h>        /* tasklets, interrupt helpers      */
- #include <linux/timer.h>
- 
- #include <asm/system.h>             /* cli, sli, save_flags             */
-@@ -85,14 +81,9 @@
- #include <asm/page.h>               /* PAGE_OFFSET                      */
- #include <asm/pgtable.h>            /* pte bit definitions              */
- 
--#if !defined (KERNEL_2_2)
- #include <linux/spinlock.h>
- #include <asm/semaphore.h>
- #include <linux/highmem.h>
--#else
--#include <asm/spinlock.h>
--#include <asm/semaphore.h>
--#endif
- 
- #ifdef CONFIG_PROC_FS
- #include <linux/proc_fs.h>
-@@ -359,78 +350,172 @@
-         free_pages(ptr, order); \
-     }
- 
-+#define GET_MODULE_SYMBOL(mod,sym)      (const void *) inter_module_get(sym)
-+#define PUT_MODULE_SYMBOL(sym)          (inter_module_put((char *) sym))
- 
--#if !defined (KERNEL_2_2)
--#  define LINUX_VMA_OFFS(vma)           (((vma)->vm_pgoff) << PAGE_SHIFT)
--#  define GET_MODULE_SYMBOL(mod,sym)  (const void *) inter_module_get(sym)
--#  define PUT_MODULE_SYMBOL(sym)        inter_module_put((char *) sym)
--#  define GET_MAP_NR(phys_page)         virt_to_page(__va(phys_page))
--#  define MEM_MAP_READ_COUNT(map_nr)    (atomic_read(&(map_nr)->count))
--#  define MEM_MAP_INC_COUNT(map_nr)     (atomic_inc(&(map_nr)->count))
--#  define MEM_MAP_DEC_COUNT(map_nr)     (atomic_dec(&(map_nr)->count))
--#  define EVENT_QUEUE(ptr)               ((struct __wait_queue_head *)(ptr))
--#  define VMA_PRIVATE(vma)              ((vma)->vm_private_data)
--#  define INIT_EVENT_QUEUE(ptr) \
--     if (ptr == NULL) { \
--        NV_KMALLOC((ptr), sizeof(struct __wait_queue_head)); \
--        if (ptr) { \
--            memset((ptr), 0, sizeof(struct __wait_queue_head)); \
--            init_waitqueue_head((struct __wait_queue_head *)(ptr)); \
--        } \
--     }
--#  define FREE_EVENT_QUEUE(ptr)         NV_KFREE((ptr), sizeof(struct __wait_queue_head)); (ptr) = NULL;
--#else
--#  define in_irq()                      (local_irq_count[smp_processor_id()])
--#  define LINUX_VMA_OFFS(vma)           ((vma)->vm_offset)
--#  define GET_MODULE_SYMBOL(mod, sym)   (void*) get_module_symbol((mod), (sym))
--#  define PUT_MODULE_SYMBOL(sym)
--#  define GET_MAP_NR(phys_page)         MAP_NR(__va(phys_page))
--#  define MEM_MAP_READ_COUNT(map_nr)    (atomic_read(&mem_map[map_nr].count))
--#  define MEM_MAP_INC_COUNT(map_nr)     (atomic_inc(&mem_map[map_nr].count))
--#  define MEM_MAP_DEC_COUNT(map_nr)     (atomic_dec(&mem_map[map_nr].count))
--#  define EVENT_QUEUE(ptr)              ((struct wait_queue **) &(ptr))
--#  define VMA_PRIVATE(vma)              ((void*)((vma)->vm_pte))
--#  define INIT_EVENT_QUEUE(ptr)         if (ptr) { ((ptr) = NULL); }
--#  define FREE_EVENT_QUEUE(ptr)
-+#ifdef KERNEL_2_6
-+# define NV_IS_SUSER()                  capable(CAP_SYS_ADMIN)
-+# define NV_PCI_DEVICE_NAME(x)          ((x)->pretty_name)
-+# define NV_CLI()                       local_irq_disable()
-+# define NV_SAVE_FLAGS(x)               local_save_flags(x)
-+# define NV_RESTORE_FLAGS(x)            local_irq_restore(x)
-+# define NV_MAY_SLEEP()                 (!in_interrupt() && !in_atomic())
-+# define NV_SMP_NUM_CPUS                num_online_cpus()
-+# define NV_MODULE_PARAMETER(x)         module_param(x, int, 0)
-+#else
-+# define NV_IS_SUSER()                  suser()
-+# define NV_PCI_DEVICE_NAME(x)          ((x)->name)
-+# define NV_CLI()                       cli()
-+# define NV_SAVE_FLAGS(x)               save_flags(x)
-+# define NV_RESTORE_FLAGS(x)            restore_flags(x)
-+# define NV_MAY_SLEEP()                 (!in_interrupt())
-+# define NV_SMP_NUM_CPUS                smp_num_cpus
-+# define NV_MODULE_PARAMETER(x)         MODULE_PARM(x, "i")
-+#endif
-+
-+#define NV_DEVICE_NUMBER(x)             minor((x)->i_rdev)
-+#define NV_VMA_OFFSET(x)                (((x)->vm_pgoff) << PAGE_SHIFT)
-+#define NV_VMA_PRIVATE(x)               ((x)->vm_private_data)
-+#define NV_IS_CONTROL_DEVICE(x)         (minor((x)->i_rdev) == 255)
-+
-+#ifndef minor
-+/*
-+ * XXX Is this correct for all possible target kernels? We need this to
-+ * support older 2.4 and some 2.6 kernels.
-+ */
-+# define minor(x) MINOR(x)
- #endif
- 
-+#ifndef KERNEL_2_6
-+  typedef void irqreturn_t;
-+# define IRQ_NONE
-+# define IRQ_RETVAL(x)
-+# define IRQ_HANDLED
-+#else
-+#ifdef AGPGART
-+  typedef struct agp_kern_info agp_kern_info;
-+  typedef struct agp_memory agp_memory;
-+#endif
-+  typedef void* devfs_handle_t;
-+#endif
-+
-+#ifdef KERNEL_2_6
-+#define NV_DEVFS_REGISTER(_name, _minor)                            \
-+({                                                                  \
-+    devfs_handle_t __handle = NULL;                                 \
-+    devfs_mk_cdev(MKDEV(NV_MAJOR_DEVICE_NUMBER, _minor),            \
-+            S_IFCHR | S_IRUGO | S_IWUGO, _name);                    \
-+    __handle;                                                       \
-+})
-+
-+#define NV_DEVFS_REMOVE_DEVICE(i) devfs_remove("nvidia%d", i)
-+#define NV_DEVFS_REMOVE_CONTROL() devfs_remove("nvidiactl")
-+#else
-+#define NV_DEVFS_REGISTER(_name, _minor)                            \
-+({                                                                  \
-+    devfs_handle_t __handle =                                       \
-+        devfs_register(NULL, _name, DEVFS_FL_DEFAULT,               \
-+                NV_MAJOR_DEVICE_NUMBER, _minor,                     \
-+                S_IFCHR | S_IRUGO | S_IWUGO, &nv_fops, NULL);       \
-+    __handle;                                                       \
-+ })
-+
-+#define NV_DEVFS_REMOVE_DEVICE(i) devfs_unregister(nv_devfs_handles[i+1])
-+#define NV_DEVFS_REMOVE_CONTROL() devfs_unregister(nv_devfs_handles[0])
-+#endif
-+
-+/*
-+ * Linux 2.5 introduced the five argument version of remap_page_range, all
-+ * relevant releases to date use it. This version was backported to 2.4 by
-+ * RedHat without means to identify the change, hence this hack.
-+ */
-+#ifdef KERNEL_2_6
-+#define NV_REMAP_PAGE_RANGE(a, b...) remap_page_range(vma, a, ## b)
-+#else
- #if defined(REMAP_PAGE_RANGE_5)
--#define NV_REMAP_PAGE_RANGE(a, b...)    remap_page_range(vma, a, ## b)
-+#define NV_REMAP_PAGE_RANGE(a, b...) remap_page_range(vma, a, ## b)
- #elif defined(REMAP_PAGE_RANGE_4)
--#define NV_REMAP_PAGE_RANGE(a, b...)    remap_page_range(a, ## b)
-+#define NV_REMAP_PAGE_RANGE(a, b...) remap_page_range(a, ## b)
- #else
--#error "Couldn't determine number of arguments expected by remap_page_range!"
-+#warning "conftest.sh failed, assuming old Linux 2.4 remap_page_range(4)!"
-+
-+#define NV_REMAP_PAGE_RANGE(a, b...) remap_page_range(a, ## b)
- #endif
-+#endif /* KERNEL_2_6 */
- 
--#if defined(pte_offset_atomic)
--#define NV_PTE_OFFSET(addres, pg_mid_dir, pte) \
-+#if defined(pmd_offset_map)
-+#define NV_PMD_OFFSET(address, pgd, pmd) \
-     { \
--        pte_t *pte__ = pte_offset_atomic(pg_mid_dir, address); \
--        pte = *pte__; \
--        pte_kunmap(pte__); \
-+        pmd = pmd_offset_map(pgd, address); \
-+    }
-+#define NV_PMD_UNMAP(pmd) \
-+    { \
-+        pmd_unmap(pmd); \
-     }
--#elif defined(pte_offset)
--#define NV_PTE_OFFSET(addres, pg_mid_dir, pte) \
--    pte = *pte_offset(pg_mid_dir, address)
- #else
--#define NV_PTE_OFFSET(addres, pg_mid_dir, pte) \
-+#define NV_PMD_OFFSET(address, pgd, pmd) \
-     { \
--        pte_t *pte__ = pte_offset_map(pg_mid_dir, address); \
--        pte = *pte__; \
--        pte_unmap(pte__); \
-+        pmd = pmd_offset(pgd, address); \
-     }
-+#define NV_PMD_UNMAP(pmd)
- #endif
- 
--#define NV_PAGE_ALIGN(addr)             ( ((addr) + PAGE_SIZE - 1) / PAGE_SIZE)
--#define NV_MASK_OFFSET(addr)            ( (addr) & (PAGE_SIZE - 1) )
-+#define NV_PMD_PRESENT(pmd) \
-+    ({ \
-+        if (pmd) { \
-+            if (pmd_none(*pmd)) { \
-+                NV_PMD_UNMAP(pmd); pmd = NULL; \
-+            } \
-+        } pmd != NULL; \
-+    })
- 
--#ifndef MAXMEM  /* temporary define for 2.2 kernels */
--#define MAXMEM  (-PAGE_OFFSET - (64 * 1024 * 1024))
-+#if defined (pte_offset_atomic)
-+#define NV_PTE_OFFSET(address, pmd, pte) \
-+    { \
-+        pte = pte_offset_atomic(pmd, address); \
-+        NV_PMD_UNMAP(pmd); \
-+    }
-+#define NV_PTE_UNMAP(pte) \
-+    { \
-+        pte_kunmap(pte); \
-+    }
-+#elif defined (pte_offset)
-+#define NV_PTE_OFFSET(address, pmd, pte) \
-+    { \
-+        pte = pte_offset(pmd, address); \
-+        NV_PMD_UNMAP(pmd); \
-+    }
-+#define NV_PTE_UNMAP(pte)
-+#else
-+#define NV_PTE_OFFSET(address, pmd, pte) \
-+    { \
-+        pte = pte_offset_map(pmd, address); \
-+        NV_PMD_UNMAP(pmd); \
-+    }
-+#define NV_PTE_UNMAP(pte) \
-+    { \
-+        pte_unmap(pte); \
-+    }
- #endif
- 
--#ifndef NV01_ROOT
--#define NV01_ROOT 0x00000000
--#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_PAGE_ALIGN(addr)             ( ((addr) + PAGE_SIZE - 1) / PAGE_SIZE)
-+#define NV_MASK_OFFSET(addr)            ( (addr) & (PAGE_SIZE - 1) )
- 
- #if defined(NVCPU_IA64)
- #define NV_GFP_HW (GFP_KERNEL | __GFP_DMA)
-@@ -487,7 +572,7 @@
- static inline int NV_IRQL_IS_RAISED()
-     {
-         unsigned long int eflags;
--        __save_flags(eflags);
-+        NV_SAVE_FLAGS(eflags);
-         return !(eflags & NV_CPU_INTERRUPT_FLAGS_BIT);
-     }
-  
-@@ -545,9 +630,10 @@
- 
-     nv_alloc_t *alloc_queue;
- 
--    // bottom half interrupt handler info; per device
--    /* keep track of any pending bottom-halves */
--    struct tq_struct *bh;
-+     /* keep track of any pending bottom halfes */
-+     struct tasklet_struct tasklet;
-+
-+     /* active bottom half counter */
-     atomic_t bh_count;
- 
-     /* get a timer callback every second */
-@@ -583,7 +669,7 @@
-     U032 num_events;
-     U032 put, get;
-     spinlock_t fp_lock;
--    void *wqueue;               // wait_queue for polling
-+    wait_queue_head_t waitqueue;
-     nv_event_t *event_fifo;     // fifo for storing events
- } nv_file_private_t;
- 
-diff -ruN NVIDIA_kernel-1.0-4496/nv.c NVIDIA_kernel-1.0-4496-2.6/nv.c
---- NVIDIA_kernel-1.0-4496/nv.c        2003-07-17 04:56:13.000000000 +0200
-+++ NVIDIA_kernel-1.0-4496-2.6/nv.c    2003-09-05 16:51:55.000000000 +0200
-@@ -15,6 +15,7 @@
- #include "nv_compiler.h"
- #include "os-agp.h"
- 
-+MODULE_LICENSE("NVIDIA");
- 
- /*
-  * our global state; one per device
-@@ -33,32 +34,20 @@
-  */
- 
- nv_linux_state_t nv_ctl_device = { { 0 } };
--void *nv_ctl_wqueue = NULL;
-+wait_queue_head_t nv_ctl_waitqueue;
- 
- // keep track of opened clients and their process id so they
- //   can be free'd up on abnormal close
- nv_client_t       nv_clients[NV_MAX_CLIENTS];
--struct tq_struct  nv_bottom_halves[NV_MAX_CLIENTS];
- 
- #ifdef CONFIG_PROC_FS
- struct proc_dir_entry *proc_nvidia;
- #endif
- 
- #ifdef CONFIG_DEVFS_FS
--devfs_handle_t  nv_dev_handle[NV_MAX_DEVICES];
--devfs_handle_t  nv_ctl_handle;
-+devfs_handle_t nv_devfs_handles[NV_MAX_DEVICES+1];
- #endif
- 
--/*
-- * pick apart our minor device number
-- * low 3 bits is NV device
-- * if 255, then its the control device
-- */
--
--#define NV_DEVICE_NUMBER(_minor) ((_minor) & 0x0f)
--#define NV_DEVICE_IS_CONTROL_DEVICE(_minor) \
--             (((_minor) & 0xFF) == 0xFF)
--
- // #define NV_DBG_MEM 1
- #undef NV_DBG_MEM
- 
-@@ -118,10 +107,6 @@
-  *** EXPORTS to Linux Kernel
-  ***/
- 
--/* linux module interface functions (called by linux kernel) */
--int           init_module(void);
--void          cleanup_module(void);
--
- /* nv_kern_ functions, interfaces used by linux kernel */
- void          nv_kern_vma_open(struct vm_area_struct *vma);
- void          nv_kern_vma_release(struct vm_area_struct *vma);
-@@ -132,7 +117,7 @@
- unsigned int  nv_kern_poll(struct file *, poll_table *);
- int           nv_kern_ioctl(struct inode *, struct file *, unsigned int, unsigned long);
- void          nv_kern_bh(void *);
--void          nv_kern_isr(int, void *, struct pt_regs *);
-+irqreturn_t   nv_kern_isr(int, void *, struct pt_regs *);
- void          nv_kern_rc_timer(unsigned long);
- #ifdef CONFIG_PM
- int           nv_kern_pm(struct pm_dev *dev, pm_request_t rqst, void *data);
-@@ -155,6 +140,7 @@
- /* character driver entry points */
- 
- static struct file_operations nv_fops = {
-+    owner:          THIS_MODULE,
-     poll:           nv_kern_poll,
-     ioctl:          nv_kern_ioctl,
-     mmap:           nv_kern_mmap,
-@@ -325,8 +311,8 @@
-     {
-         nv_printf(NV_DBG_MEMINFO, "  0x%x: count %d flags 0x%x\n", 
-             *page_ptr, 
--            (GET_MAP_NR(*page_ptr))->count,
--            (GET_MAP_NR(*page_ptr))->flags);
-+            (virt_to_page(__va(*page_ptr)))->count,
-+            (virt_to_page(__va(*page_ptr)))->flags);
-         num_pages--;
-         page_ptr++;
-     }
-@@ -397,7 +383,7 @@
-         phys_addr = virt_to_phys((void *) virt_addr);
- 
-         /* lock the page for dma purposes */
--        mem_map_reserve(GET_MAP_NR(phys_addr));
-+        SetPageReserved(virt_to_page(__va(phys_addr)));
- 
-         *page_ptr++ = phys_addr;
-         pages_needed--;
-@@ -410,7 +396,7 @@
-     while (page_ptr != (unsigned long *) page_list)
-     {
-         page_ptr--;
--        mem_map_unreserve(GET_MAP_NR(*page_ptr));
-+        ClearPageReserved(virt_to_page(__va(*page_ptr)));
-         NV_FREE_PAGES((unsigned long) phys_to_virt(*page_ptr), 0);
-     }
- 
-@@ -430,7 +416,7 @@
- 
-     while (pages_left)
-     {
--        mem_map_unreserve(GET_MAP_NR(*page_list));
-+        ClearPageReserved(virt_to_page(__va(*page_list)));
-         page_list++;
-         pages_left--;
-     }
-@@ -596,11 +582,6 @@
-     nv_linux_state_t *nvl;
-     nv_linux_state_t *nv_max_devices;
- 
--#if defined (KERNEL_2_2)
--    struct proc_dir_entry *proc_root_driver;
--    proc_root_driver = create_proc_entry("driver", flags, &proc_root);
--#endif
--
-     proc_nvidia = create_proc_entry("nvidia", flags, proc_root_driver);
-     proc_nvidia_cards = create_proc_entry("cards", flags, proc_nvidia);
-     proc_nvidia_agp = create_proc_entry("agp", flags, proc_nvidia);
-@@ -662,9 +643,6 @@
- {
- #ifdef CONFIG_PROC_FS
-     nvos_proc_remove_all(proc_nvidia);
--#if defined (KERNEL_2_2)
--    remove_proc_entry("driver", &proc_root);
--#endif
- #endif
- }
- 
-@@ -753,9 +731,8 @@
-  *** EXPORTS to Linux Kernel
-  ***/
- 
--int init_module(void)
-+static int __init nvidia_init_module(void)
- {
--    nv_linux_state_t *nvl;
-     int rc, i;
- 
-     memset(nv_linux_devices, 0, sizeof(nv_linux_devices));
-@@ -768,7 +745,7 @@
- 
-     nv_printf(NV_DBG_ERRORS, "nvidia: loading %s\n", pNVRM_ID);
- 
--#ifdef CONFIG_DEVFS_FS
-+#if defined(CONFIG_DEVFS_FS) && !defined(KERNEL_2_6)
-     rc = devfs_register_chrdev(nv_major, "nvidia", &nv_fops);
- #else
-     rc = register_chrdev(nv_major, "nvidia", &nv_fops);
-@@ -780,34 +757,35 @@
-     }
- 
- #ifdef CONFIG_DEVFS_FS
--    memset(nv_dev_handle, 0, sizeof(devfs_handle_t) * NV_MAX_DEVICES);
-     do {
-+        /*
-+         * XXX This code isn't pretty, but neither is dealing with the
-+         * various Linux devfs implemenation(s). While Linux APIs are
-+         * known to be anything but stable and oftentimes anything but
-+         * well designed, the devfs interface has been more painful to
-+         * deal with than most other APIs.
-+         */
-         char name[10];
- 
--        nv_ctl_handle = devfs_register(NULL, "nvidiactl",
--                            DEVFS_FL_DEFAULT, nv_major, 255,
--                            S_IFCHR | S_IRUGO | S_IWUGO,
--                            &nv_fops, NULL);
-+        nv_devfs_handles[0] = NV_DEVFS_REGISTER("nvidiactl", 255);
- 
-         for (i = 0; i < num_nv_devices; i++) {
-             sprintf(name, "nvidia%d", i);
--            nv_dev_handle[i] = devfs_register(NULL, name,
--                                  DEVFS_FL_DEFAULT, nv_major, i,
--                                  S_IFCHR | S_IRUGO | S_IWUGO,
--                                  &nv_fops, NULL);
-+            nv_devfs_handles[i+1] = NV_DEVFS_REGISTER(name, i);
-         }
-     } while(0);
- #endif
- 
--    nv_printf(NV_DBG_INFO, "init_module: major number %d\n", nv_major);
-+    nv_printf(NV_DBG_INFO, "nvidia_init_module: major number %d\n", nv_major);
- 
--    // init all the bottom half structures
--    for (nvl = nv_linux_devices; nvl < nv_linux_devices + NV_MAX_DEVICES; nvl++)
--    {
--        nvl->bh = &nv_bottom_halves[nvl - nv_linux_devices];
--        nvl->bh->routine = nv_kern_bh;
--        nvl->bh->data = (void *) nvl;
--        nvl->bh->sync = 0;
-+    /* instantiate tasklets */
-+    for (i = 0; i < NV_MAX_DEVICES; i++) {
-+        /*
-+         * We keep one tasklet per card to avoid latency issues with more
-+         * than one device; no two instances of a single tasklet are ever
-+         * executed concurrently.
-+         */
-+        atomic_set(&nv_linux_devices[i].tasklet.count, 1);
-     }
- 
-     // init the nvidia control device
-@@ -815,6 +793,7 @@
-         nv_state_t *nv_ctl = NV_STATE_PTR(&nv_ctl_device);
-         nv_ctl->os_state = (void *) &nv_ctl_device;
-         nv_lock_init_locks(nv_ctl);
-+        init_waitqueue_head(&nv_ctl_waitqueue);
-     }
- 
- #ifdef CONFIG_PM
-@@ -841,14 +820,14 @@
-     /* create /proc/driver/nvidia */
-     nvos_proc_create();
- 
--#if defined(DEBUG) && !defined(KERNEL_2_2)
-+#if defined(DEBUG)
-     inter_module_register("nv_linux_devices", THIS_MODULE, nv_linux_devices);
- #endif
- 
-     return 0;
- 
-  failed:
--#ifdef CONFIG_DEVFS_FS
-+#if defined(CONFIG_DEVFS_FS) && !defined(KERNEL_2_6)
-     devfs_unregister_chrdev(nv_major, "nvidia");
- #else
-     unregister_chrdev(nv_major, "nvidia");
-@@ -856,26 +835,27 @@
-     return rc;
- }
- 
--void cleanup_module(void)
-+static void __exit nvidia_exit_module(void)
- {
--    int rc, i;
--    nv_linux_state_t *nvl;
--    nv_linux_state_t *max_devices;
-+    int rc;
-+    nv_linux_state_t *nvl, *max_devices;
- 
-     /* remove /proc/driver/nvidia */
-     nvos_proc_remove();
- 
--    nv_printf(NV_DBG_INFO, "cleanup_module\n");
-+    nv_printf(NV_DBG_INFO, "nvidia_exit_module\n");
- 
--#if defined(DEBUG) && !defined(KERNEL_2_2)
-+#if defined(DEBUG)
-     inter_module_unregister("nv_linux_devices");
- #endif
- 
- #ifdef CONFIG_PM
--    for (i = 0; i < num_nv_devices; i++)
--    {
--        pm_unregister(pm_nv_dev[i]);
--    }
-+    do {
-+        int i;
-+        for (i = 0; i < num_nv_devices; i++) {
-+            pm_unregister(pm_nv_dev[i]);
-+        }
-+    } while (0);
- #endif
- 
-     // Shutdown the resource manager
-@@ -894,30 +874,29 @@
-                 continue;
- 
-             nv_printf(NV_DBG_ERRORS,
--                    "still have vm que at cleanup_module(): 0x%x to 0x%x\n",
-+                    "still have vm que at nvidia_exit_module(): 0x%x to 0x%x\n",
-                     nvl->alloc_queue->vma->vm_start,
-                     nvl->alloc_queue->vma->vm_end);
-         }
-     }
- 
--#ifdef CONFIG_DEVFS_FS
-+#if defined(CONFIG_DEVFS_FS) && !defined(KERNEL_2_6)
-     rc = devfs_unregister_chrdev(nv_major, "nvidia");
- #else
-     rc = unregister_chrdev(nv_major, "nvidia");
- #endif
- 
-     if (rc < 0) {
--        nv_printf(NV_DBG_ERRORS, "cleanup_module: unregister nv failed\n");
-+        nv_printf(NV_DBG_ERRORS, "nvidia_exit_module: unregister nv failed\n");
-     }
- 
- #ifdef CONFIG_DEVFS_FS
-     do {
-         int i;
--        for (i = 0; nv_dev_handle[i] != 0; i++) {
--            devfs_unregister(nv_dev_handle[i]);
--        }
--    } while(0);
--    devfs_unregister(nv_ctl_handle);
-+        NV_DEVFS_REMOVE_CONTROL();
-+        for (i = 0; i < num_nv_devices; i++)
-+            NV_DEVFS_REMOVE_DEVICE(i);
-+    } while (0);
- #endif
- 
- #if NV_ENABLE_MEM_TRACKING
-@@ -929,6 +908,8 @@
- #endif
- }
- 
-+module_init(nvidia_init_module);
-+module_exit(nvidia_exit_module);
- 
- /* this is only called when the vmas are duplicated.
-  * this appears to only happen when the process is cloned to create
-@@ -942,11 +923,11 @@
- nv_kern_vma_open(struct vm_area_struct *vma)
- {
-     nv_printf(NV_DBG_MEMINFO, "vma_open for 0x%x - 0x%x, offset 0x%x\n",
--        vma->vm_start, vma->vm_end, LINUX_VMA_OFFS(vma));
-+        vma->vm_start, vma->vm_end, NV_VMA_OFFSET(vma));
- 
--    if (VMA_PRIVATE(vma))
-+    if (NV_VMA_PRIVATE(vma))
-     {
--        nv_alloc_t *at = (nv_alloc_t *) VMA_PRIVATE(vma);
-+        nv_alloc_t *at = (nv_alloc_t *) NV_VMA_PRIVATE(vma);
-         at->usage_count++;
- 
-         nv_printf(NV_DBG_MEMINFO, "  at 0x%x, usage count %d, page_table 0x%x\n",
-@@ -954,8 +935,6 @@
- 
-         nvos_list_page_count(at->page_table, at->num_pages);
-     }
--
--    MOD_INC_USE_COUNT;
- }
- 
- 
-@@ -963,11 +942,11 @@
- nv_kern_vma_release(struct vm_area_struct *vma)
- {
-     nv_printf(NV_DBG_MEMINFO, "vma_release for 0x%x - 0x%x, offset 0x%x\n",
--        vma->vm_start, vma->vm_end, LINUX_VMA_OFFS(vma));
-+        vma->vm_start, vma->vm_end, NV_VMA_OFFSET(vma));
- 
--    if (VMA_PRIVATE(vma))
-+    if (NV_VMA_PRIVATE(vma))
-     {
--        nv_alloc_t *at = (nv_alloc_t *) VMA_PRIVATE(vma);
-+        nv_alloc_t *at = (nv_alloc_t *) NV_VMA_PRIVATE(vma);
- 
-         at->usage_count--;
- 
-@@ -985,22 +964,12 @@
-             if (at->page_table)
-                 nvos_unlock_pages(at->page_table, at->num_pages);
-             nvos_free_alloc(at);
--            VMA_PRIVATE(vma) = NULL;
-+            NV_VMA_PRIVATE(vma) = NULL;
-         }
-     }
--
--    MOD_DEC_USE_COUNT;
- }
- 
- 
--/* at this point, this code just plain won't work with 2.2 kernels.
-- * additionally, only ia64 & the 460GX need a nopage handler, and 2.2 doesn't
-- * work on ia64 anyways. It's expected that at some point other agp chipsets
-- * will work similar to the 460GX (AGP 3.0 spec), so pre-emptively make sure
-- * this works on our standard ia32 driver.
-- */
--#if !defined(KERNEL_2_2)
--
- /* AGP allocations under the 460GX are not mapped to the aperture
-  * addresses by the CPU.  This nopage handler will fault on CPU
-  * accesses to AGP memory and map the address to the correct page.
-@@ -1013,7 +982,7 @@
-     struct page *page_ptr;
-     int rm_status, index;
- 
--    at = VMA_PRIVATE(vma);
-+    at = NV_VMA_PRIVATE(vma);
-     if (at == NULL)
-     {
-         nv_printf(NV_DBG_ERRORS, "NVRM: nopage handler called without an at: "
-@@ -1052,7 +1021,7 @@
-         // far again
-         nv_printf(NV_DBG_ERRORS, "NVRM: nopage handler called on a freed"
-                   "address: vm_start 0x%x, at 0x%x\n", vma->vm_start, at);
--        VMA_PRIVATE(vma) = NULL;
-+        NV_VMA_PRIVATE(vma) = NULL;
-         return NOPAGE_SIGBUS;
-     }
- 
-@@ -1074,14 +1043,11 @@
- 
-     return page_ptr;
- }
--#endif
- 
- struct vm_operations_struct nv_vm_ops = {
-     nv_kern_vma_open,
-     nv_kern_vma_release,  /* "close" */
--#if !defined(KERNEL_2_2)
-     nv_kern_vma_nopage,
--#endif
- };
- 
- static nv_file_private_t *
-@@ -1096,7 +1062,7 @@
-     memset(nvfp, 0, sizeof(nv_file_private_t));
- 
-     // initialize this file's event queue
--    INIT_EVENT_QUEUE(nvfp->wqueue);
-+    init_waitqueue_head(&nvfp->waitqueue);
- 
-     nv_init_lock(nvfp->fp_lock);
- 
-@@ -1116,7 +1082,6 @@
-     if (nvfp == NULL)
-         return;
- 
--    FREE_EVENT_QUEUE(nvfp->wqueue);
-     NV_VFREE(nvfp->event_fifo, sizeof(nv_event_t) * NV_EVENT_FIFO_SIZE);
-     NV_VFREE(nvfp, sizeof(nv_file_private_t));
- }
-@@ -1145,11 +1110,11 @@
- 
-     /* for control device, just jump to its open routine */
-     /* after setting up the private data */
--    if (NV_DEVICE_IS_CONTROL_DEVICE(inode->i_rdev))
-+    if (NV_IS_CONTROL_DEVICE(inode))
-         return nv_kern_ctl_open(inode, file);
- 
-     /* what device are we talking about? */
--    devnum = NV_DEVICE_NUMBER(inode->i_rdev);
-+    devnum = NV_DEVICE_NUMBER(inode);
-     if (devnum >= NV_MAX_DEVICES)
-     {
-         rc = -ENODEV;
-@@ -1202,12 +1167,14 @@
-             goto failed;
-         }
- 
-+        nvl->tasklet.func = (void *) rm_isr_bh;
-+        nvl->tasklet.data = (unsigned long) nv->pdev;
-+        tasklet_enable(&nvl->tasklet);
- 
-         nv->flags |= NV_FLAG_OPEN;
-     }
- 
-     nv->usage_count++;
--    MOD_INC_USE_COUNT;
- 
-  failed:
-     nv_unlock(nvl->ldata_lock);
-@@ -1238,38 +1205,32 @@
- 
-     /* for control device, just jump to its open routine */
-     /* after setting up the private data */
--    if (NV_DEVICE_IS_CONTROL_DEVICE(inode->i_rdev))
-+    if (NV_IS_CONTROL_DEVICE(inode))
-         return nv_kern_ctl_close(inode, file);
- 
--    nv_printf(NV_DBG_INFO, "nv_kern_close on device %d\n", NV_DEVICE_NUMBER(inode->i_rdev));
-+    nv_printf(NV_DBG_INFO, "nv_kern_close on device %d\n", NV_DEVICE_NUMBER(inode));
- 
-     rm_free_unused_clients(nv, current->pid, (void *) file);
- 
-     nv_lock(nvl->ldata_lock);
-     if (--nv->usage_count == 0)
-     {
--        int counter = 0;
--
--        /* turn off interrupts.
--        ** be careful to make sure any pending bottom half gets run
--        **  or disabled before calling rm_shutdown_adapter() since
--        **  it will free up the pdev.  This is hard to see on single
--        **  cpu systems, but easy on dual cpu :-)
--        */
-+        /*
-+         * The usage count for this device has dropped to zero, it can be shut
-+         * down safely; disable its interrupts.
-+         */
-         rm_disable_adapter(nv);
- 
--        /* give it a moment to allow any bottom half to run */
--
--#define MAX_BH_TASKS 10
--        while (NV_ATOMIC_READ(nvl->bh_count) && (counter < MAX_BH_TASKS))
--        {
--            current->state = TASK_INTERRUPTIBLE;
--            schedule_timeout(HZ/50);
--            counter++;
--        }
-+        /*
-+         * Disable this device's tasklet to make sure that no bottom half will
-+         * run with undefined device state.
-+         */
-+        tasklet_disable(&nvl->tasklet);
- 
--        /* free the irq, which may block until any pending interrupts */
--        /* are done being processed. */
-+        /*
-+         * Free the IRQ, which may block until all pending interrupt processing
-+         * has completed.
-+         */
-         free_irq(nv->interrupt_line, (void *) nv);
- 
-         rm_shutdown_adapter(nv);
-@@ -1300,8 +1261,6 @@
-         FILE_PRIVATE(file) = NULL;
-     }
- 
--    MOD_DEC_USE_COUNT;
--
-     return 0;
- }
- 
-@@ -1318,10 +1277,10 @@
-     nv_printf(NV_DBG_INFO, "mmap([0x%lx-0x%lx] off=0x%lx)\n",
-         vma->vm_start,
-         vma->vm_end,
--        LINUX_VMA_OFFS(vma));
-+        NV_VMA_OFFSET(vma));
- 
-     // be a bit paranoid for now
--    if ((NV_MASK_OFFSET(LINUX_VMA_OFFS(vma))) ||
-+    if ((NV_MASK_OFFSET(NV_VMA_OFFSET(vma))) ||
-         (NV_MASK_OFFSET(vma->vm_start)) ||
-         (NV_MASK_OFFSET(vma->vm_end)))
-     {
-@@ -1339,7 +1298,7 @@
- 
- 
-     /* NV reg space */
--    if (IS_REG_OFFSET(nv, LINUX_VMA_OFFS(vma), vma->vm_end - vma->vm_start))
-+    if (IS_REG_OFFSET(nv, NV_VMA_OFFSET(vma), vma->vm_end - vma->vm_start))
-     {
-         /* truncate to size of registers */
-         if (pages > nv->regs->size / PAGE_SIZE)
-@@ -1347,7 +1306,7 @@
- 
-         vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
-         if (NV_REMAP_PAGE_RANGE(vma->vm_start,
--                             LINUX_VMA_OFFS(vma),
-+                             NV_VMA_OFFSET(vma),
-                              vma->vm_end - vma->vm_start,
-                              vma->vm_page_prot))
-             return -EAGAIN;
-@@ -1357,7 +1316,7 @@
-     }
- 
-     /* NV fb space */
--    else if (IS_FB_OFFSET(nv, LINUX_VMA_OFFS(vma), vma->vm_end - vma->vm_start))
-+    else if (IS_FB_OFFSET(nv, NV_VMA_OFFSET(vma), vma->vm_end - vma->vm_start))
-     {
- 
-         /* truncate to size of framebuffer */
-@@ -1366,7 +1325,7 @@
- 
-         vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
-         if (NV_REMAP_PAGE_RANGE(vma->vm_start,
--                             LINUX_VMA_OFFS(vma),
-+                             NV_VMA_OFFSET(vma),
-                              vma->vm_end - vma->vm_start,
-                              vma->vm_page_prot))
-             return -EAGAIN;
-@@ -1376,10 +1335,10 @@
-     }
- 
-     /* AGP allocator */
--    else if (IS_AGP_OFFSET(nv, LINUX_VMA_OFFS(vma), vma->vm_end - vma->vm_start))
-+    else if (IS_AGP_OFFSET(nv, NV_VMA_OFFSET(vma), vma->vm_end - vma->vm_start))
-     {
-         nv_lock(nvl->at_lock);
--        at = nvl_find_alloc(nvl, LINUX_VMA_OFFS(vma), NV_ALLOC_TYPE_AGP);
-+        at = nvl_find_alloc(nvl, NV_VMA_OFFSET(vma), NV_ALLOC_TYPE_AGP);
- 
-         if (at == NULL)
-         {
-@@ -1397,7 +1356,7 @@
-         }
- 
-         at->vma = vma;
--        VMA_PRIVATE(vma) = at;
-+        NV_VMA_PRIVATE(vma) = at;
-         at->usage_count++;
- 
-         if (NV_OSAGP_ENABLED(nv))
-@@ -1420,13 +1379,13 @@
-     }
- 
-     /* Magic allocator */
--    else // if (LINUX_VMA_OFFS(vma) == NV_MMAP_ALLOCATION_OFFSET)
-+    else // if (NV_VMA_OFFSET(vma) == NV_MMAP_ALLOCATION_OFFSET)
-     {
-         unsigned long page = 0, pos, start;
-         int i = 0;
- 
-         nv_lock(nvl->at_lock);
--        at = nvl_find_alloc(nvl, LINUX_VMA_OFFS(vma), NV_ALLOC_TYPE_PCI);
-+        at = nvl_find_alloc(nvl, NV_VMA_OFFSET(vma), NV_ALLOC_TYPE_PCI);
- 
-         if (at == NULL)
-         {
-@@ -1444,7 +1403,7 @@
-         }
- 
-         at->vma = vma;
--        VMA_PRIVATE(vma) = at;
-+        NV_VMA_PRIVATE(vma) = at;
-         at->usage_count++;
- 
-         nv_printf(NV_DBG_INFO, "remapping %d system pages for at 0x%x\n", pages, at);
-@@ -1466,9 +1425,6 @@
- 
-     vma->vm_file = file;
- 
--    /* just increment usage count, rather than calling vma_open */
--    MOD_INC_USE_COUNT;
--
-     return 0;
- }
- 
-@@ -1494,7 +1450,7 @@
-     {
-         nv_printf(NV_DBG_EVENTINFO, "calling poll_wait\n");
-         // add us to the list
--        poll_wait(file, EVENT_QUEUE(nvfp->wqueue), wait);
-+        poll_wait(file, &nvfp->waitqueue, wait);
-     }
- 
-     nv_lock(nvfp->fp_lock);
-@@ -1562,12 +1518,13 @@
- 
-     switch (_IOC_NR(cmd))
-     {
-+#if !defined(KERNEL_2_6)
-         /* debug tool; zap the module use count so we can unload driver */
-         /*             even if it is confused */
-         case NV_ESC_MODULE_RESET:
-             atomic_set(&__this_module.uc.usecount, 1);
-             break;
--
-+#endif
-         /* pass out info about the card */
-         case NV_ESC_CARD_INFO:
-         {
-@@ -1694,7 +1651,7 @@
-  * driver receives an interrupt
-  *    if someone waiting, then hand it off.
-  */
--void nv_kern_isr(
-+irqreturn_t nv_kern_isr(
-     int   irq,
-     void *arg,
-     struct pt_regs *regs
-@@ -1708,9 +1665,10 @@
-     if (need_to_run_bottom_half)
-     {
-         NV_ATOMIC_INC(nvl->bh_count);
--        queue_task(nvl->bh, &tq_immediate);
--        mark_bh(IMMEDIATE_BH);
-+        tasklet_schedule(&nvl->tasklet);
-     }
-+
-+    return IRQ_HANDLED;
- }
- 
- void nv_kern_bh(
-@@ -1828,11 +1786,9 @@
- 
-     if (nv->usage_count == 0)
-     {
--        INIT_EVENT_QUEUE(nv_ctl_wqueue);
-+        init_waitqueue_head(&nv_ctl_waitqueue);
-     }
- 
--    MOD_INC_USE_COUNT;
--
-     nv->flags |= NV_FLAG_OPEN + NV_FLAG_CONTROL;
- 
-     /* turn off the hotkey occurred bit */
-@@ -1860,10 +1816,8 @@
- 
-     nv_lock(nvl->ldata_lock);
-     if (--nv->usage_count == 0)
--    {
--        FREE_EVENT_QUEUE(nv_ctl_wqueue);
-         nv->flags = 0;
--    }
-+
-     nv_unlock(nvl->ldata_lock);
- 
-     rm_free_unused_clients(nv, current->pid, (void *) file);
-@@ -1874,8 +1828,6 @@
-         FILE_PRIVATE(file) = NULL;
-     }
- 
--    MOD_DEC_USE_COUNT;
--
-     return 0;
- }
- 
-@@ -1899,7 +1851,7 @@
-     nv = NV_STATE_PTR(nvl);
- 
-     if ( !(file->f_flags & O_NONBLOCK) )
--        poll_wait(file, EVENT_QUEUE(nv_ctl_wqueue), wait);
-+        poll_wait(file, &nv_ctl_waitqueue, wait);
- 
-     nv_lock(nvl->ldata_lock);
- 
-@@ -1930,7 +1882,7 @@
-     nv_ctl_device.nv_state.flags |= NV_FLAG_HOTKEY_OCCURRED;
-     nv_unlock(nv_ctl_device.ldata_lock);
- 
--    wake_up_interruptible(EVENT_QUEUE(nv_ctl_wqueue));
-+    wake_up_interruptible(&nv_ctl_waitqueue);
- }
- 
- int nv_kern_read_cardinfo(char *page, char **start, off_t off,
-@@ -2009,7 +1961,7 @@
-         len += sprintf(page+len, "Host Bridge: \t ");
- 
- #if defined(CONFIG_PCI_NAMES)
--        len += sprintf(page+len, "%s\n", dev->name);
-+        len += sprintf(page+len, "%s\n", NV_PCI_DEVICE_NAME(dev));
- #else
-         len += sprintf(page+len, "PCI device %04x:%04x\n",
-                 dev->vendor, dev->device);
-@@ -2137,18 +2089,21 @@
-             {
-                 unsigned long retaddr = (unsigned long) at->page_table[i];
- 
--                if (retaddr <= MAXMEM)
--                {
--                    return __va((retaddr + offset));
--                }
--   
--                // if we've allocated via vmalloc on a highmem system, the 
--                // physical address may not be accessible via PAGE_OFFSET, 
--                // that's ok, we have a simple linear pointer already.
-+                /*
-+                 * XXX This routine should be more straight-forward; as it
-+                 * is, it returns a pointer into the kernel linear mapping if
-+                 * the incoming address belongs to a vmalloc() allocation or
-+                 * the kernel logical mapping of the corresponding page if it
-+                 * was allocated with alloc_pages(); third case below.
-+                 */ 
-                 if (at->flags & NV_ALLOC_TYPE_VMALLOC)
-                 {
-                     return (void *)((unsigned char *) at->key_mapping + (i << PAGE_SHIFT) + offset);
-                 }
-+                else if (!(at->flags & NV_ALLOC_TYPE_CONTIG))
-+                {
-+                    return __va((retaddr + offset));
-+                }
- 
-                 // ?? this may be a contiguous allocation, fall through
-                 // to below? or should I just check at->flag here?
-@@ -2218,9 +2173,9 @@
- unsigned long
- nv_get_phys_address(unsigned long address)
- {
--    pgd_t *pg_dir;
--    pmd_t *pg_mid_dir;
--    pte_t pte;
-+    pgd_t *pgd;
-+    pmd_t *pmd;
-+    pte_t *pte;
- 
- #if defined(NVCPU_IA64)
-     if (address > __IA64_UNCACHED_OFFSET)
-@@ -2233,23 +2188,24 @@
-         return __pa(address);
- 
-     if (address > VMALLOC_START)
--       pg_dir = pgd_offset_k(address);
-+       pgd = pgd_offset_k(address);
-     else
--       pg_dir = pgd_offset(current->mm, address);
-+       pgd = pgd_offset(current->mm, address);
- 
--    if (pgd_none(*pg_dir))
-+    if (!pgd || pgd_none(*pgd))
-         goto failed;
- 
--    pg_mid_dir = pmd_offset(pg_dir, address);
--    if (pmd_none(*pg_mid_dir))
-+    NV_PMD_OFFSET(address, pgd, pmd);
-+
-+    if (!NV_PMD_PRESENT(pmd))
-         goto failed;
- 
--    NV_PTE_OFFSET(address, pg_mid_dir, pte);
-+    NV_PTE_OFFSET(address, pmd, pte);
- 
--    if (!pte_present(pte))
-+    if (!NV_PTE_PRESENT(pte))
-         goto failed;
- 
--    return ((pte_val(pte) & KERN_PAGE_MASK) | NV_MASK_OFFSET(address));
-+    return (NV_PTE_VALUE(pte) & KERN_PAGE_MASK) | NV_MASK_OFFSET(address);
- 
-   failed:
-     return (unsigned long) NULL;
-@@ -2610,8 +2566,7 @@
-         nvfp->put = 0;
- 
-     nv_unlock(nvfp->fp_lock);
--
--    wake_up_interruptible(EVENT_QUEUE(nvfp->wqueue));
-+    wake_up_interruptible(&nvfp->waitqueue);
- }
- 
- int nv_get_event(
-@@ -2696,12 +2651,8 @@
-     if ( (NV_AGP_DISABLED(nv)) && (config & NVOS_AGP_CONFIG_NVAGP) )
-     {
-         /* make sure the user does not have agpgart loaded */
--#if !defined (KERNEL_2_2)
-         if (inter_module_get("drm_agp")) {
-             inter_module_put("drm_agp");
--#else
--        if (GET_MODULE_SYMBOL(0, __MODULE_STRING(agp_enable))) {
--#endif
-             nv_printf(NV_DBG_WARNINGS, "NVRM: not using NVAGP, AGPGART is loaded!!\n");
-         } else
-             status = rm_init_agp(nv);
-diff -ruN NVIDIA_kernel-1.0-4496/os-agp.c NVIDIA_kernel-1.0-4496-2.6/os-agp.c
---- NVIDIA_kernel-1.0-4496/os-agp.c    2003-07-17 04:56:13.000000000 +0200
-+++ NVIDIA_kernel-1.0-4496-2.6/os-agp.c        2003-07-29 00:02:15.000000000 +0200
-@@ -45,44 +45,9 @@
-     int  ready;
- } agp_gart;
- 
--typedef struct {
--    int           (*backend_acquire)(void);
--    void          (*backend_release)(void);
--    void          (*copy_info)(agp_kern_info *);
--    agp_memory *  (*allocate_memory)(size_t, unsigned int);
--    void          (*free_memory)(agp_memory *);
--    int           (*bind_memory)(agp_memory *, off_t);
--    int           (*unbind_memory)(agp_memory *);
--    void          (*enable)(unsigned int);
--} agp_operations_struct;
--
--agp_operations_struct agp_ops;
- agp_kern_info         agpinfo;
- agp_gart              gart;
--#if !defined (KERNEL_2_2)
- const drm_agp_t       *drm_agp_p;
--#endif
--
--#if defined (KERNEL_2_2)
--    #define GET_AGPGART_SYMBOL(sym, sym_string)                     \
--        sym = (void*) GET_MODULE_SYMBOL(0, sym_string);             \
--        if (sym == NULL)                                            \
--        {                                                           \
--            nv_printf(NV_DBG_ERRORS,                                \
--                "NVRM: AGPGART: unable to retrieve symbol %s\n",    \
--                sym_string);                                        \
--            return 1;                                               \
--        }
--
--    #define AGP_BACKEND_ACQUIRE_SYM   __MODULE_STRING(agp_backend_acquire)
--    #define AGP_BACKEND_RELEASE_SYM   __MODULE_STRING(agp_backend_release)
--    #define AGP_COPY_INFO_SYM         __MODULE_STRING(agp_copy_info)
--    #define AGP_ALLOCATE_MEMORY_SYM   __MODULE_STRING(agp_allocate_memory)
--    #define AGP_FREE_MEMORY_SYM       __MODULE_STRING(agp_free_memory)
--    #define AGP_BIND_MEMORY_SYM       __MODULE_STRING(agp_bind_memory)
--    #define AGP_UNBIND_MEMORY_SYM     __MODULE_STRING(agp_unbind_memory)
--    #define AGP_ENABLE_SYM            __MODULE_STRING(agp_enable)
--#endif
- 
- #if defined(CONFIG_MTRR)
- #define MTRR_DEL(gart) if ((gart).mtrr > 0) mtrr_del((gart).mtrr, 0, 0);
-@@ -105,13 +70,17 @@
-     U032  agp_rate;
-     U032  agp_sba;
-     U032  agp_fw;
--    char* chipset;
-     VOID *bitmap;
-     U032 bitmap_size;
- 
-     memset( (void *) &gart, 0, sizeof(agp_gart));
- 
--#if !defined (KERNEL_2_2)
-+    /*
-+     * XXX The inter_module_* mechanism has been deprecated and replaced with
-+     * a different mechanism in Linux 2.5; it will go away eventually.
-+     * Also, the Linux 2.5 AGP GART driver is modularized, agpgart.o does not
-+     * include backend drivers.
-+     */
-     if (!(drm_agp_p = inter_module_get_request("drm_agp", "agpgart")))
-     {
-         nv_printf(NV_DBG_ERRORS,
-@@ -119,48 +88,13 @@
-         return 1;
-     }
-     
--    agp_ops.backend_acquire = drm_agp_p->acquire;
--    agp_ops.backend_release = drm_agp_p->release;
--    agp_ops.allocate_memory = drm_agp_p->allocate_memory;
--    agp_ops.free_memory     = drm_agp_p->free_memory;
--    agp_ops.bind_memory     = drm_agp_p->bind_memory;
--    agp_ops.unbind_memory   = drm_agp_p->unbind_memory;
--    agp_ops.enable          = drm_agp_p->enable;
--
--    // looks like some newer kernels (for example mandrake 9.0's 2.4.19-16mdk)
--    // have updated copy_info to return an integer value, and of course didn't
--    // bother bumping the agpgart revision up. The return value is pretty 
--    // harmless (backend_acquire would have already failed and caused us to
--    // bail), so cast the function pointer to avoid compiler warnings.
--    // we may need to revisit this in the future.
--    agp_ops.copy_info       = (void (*)(agp_kern_info *)) drm_agp_p->copy_info;
--
--#else
--#if defined(CONFIG_KMOD)
--    if ( request_module("agpgart") )
--    {
--        nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: not loading agpgart.o\n");
--        return 1;
--    }
--#endif
--
--    GET_AGPGART_SYMBOL(agp_ops.backend_acquire, AGP_BACKEND_ACQUIRE_SYM);
--    GET_AGPGART_SYMBOL(agp_ops.backend_release, AGP_BACKEND_RELEASE_SYM);
--    GET_AGPGART_SYMBOL(agp_ops.copy_info,       AGP_COPY_INFO_SYM);
--    GET_AGPGART_SYMBOL(agp_ops.allocate_memory, AGP_ALLOCATE_MEMORY_SYM);
--    GET_AGPGART_SYMBOL(agp_ops.free_memory,     AGP_FREE_MEMORY_SYM);
--    GET_AGPGART_SYMBOL(agp_ops.bind_memory,     AGP_BIND_MEMORY_SYM);
--    GET_AGPGART_SYMBOL(agp_ops.unbind_memory,   AGP_UNBIND_MEMORY_SYM);
--    GET_AGPGART_SYMBOL(agp_ops.enable,          AGP_ENABLE_SYM);
--#endif
--
-     /* NOTE: from here down, return an error code of '-1'
-      * that indicates that agpgart is loaded, but we failed to use it
-      * in some way. This is so we don't try to use nvagp and lock up
-      * the memory controller.
-      */
- 
--    if ( (*(agp_ops.backend_acquire))() )
-+    if (drm_agp_p->acquire())
-     {
-         nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: backend in use\n");
-         return -1;
-@@ -178,44 +112,21 @@
-         agp_fw = 1;
-     agp_fw &= 0x00000001;
-     
--    (*(agp_ops.copy_info))(&agpinfo);
--
--    switch ( agpinfo.chipset )
--    {
--        case INTEL_GENERIC:    chipset = "Intel";            break;
--        case INTEL_LX:         chipset = "Intel 440LX";      break;
--        case INTEL_BX:         chipset = "Intel 440BX";      break;
--        case INTEL_GX:         chipset = "Intel 440GX";      break;
--        case INTEL_I810:       chipset = "Intel i810";       break;
--        case INTEL_I840:       chipset = "Intel i840";       break;
--#if !defined (KERNEL_2_2)
--        case INTEL_I815:       chipset = "Intel i815";       break;
--#if !defined(__rh_config_h__)
--        case INTEL_I850:       chipset = "Intel i850";       break;
--#endif
--#endif
--#if defined(NVCPU_IA64)
--        case INTEL_460GX:      chipset = "Intel 460GX";      break;
--#endif
--        case VIA_GENERIC:      chipset = "VIA";              break;
--        case VIA_VP3:          chipset = "VIA VP3";          break;
--        case VIA_MVP3:         chipset = "VIA MVP3";         break;
--        case VIA_MVP4:         chipset = "VIA MVP4";         break;
--#if !defined (KERNEL_2_2)
--        case VIA_APOLLO_KX133: chipset = "VIA Apollo KX133"; break;
--        case VIA_APOLLO_KT133: chipset = "VIA Apollo KT133"; break;
--#endif
--        case VIA_APOLLO_PRO:   chipset = "VIA Apollo Pro";   break;
--        case SIS_GENERIC:      chipset = "SiS";              break;
--        case AMD_GENERIC:      chipset = "AMD";              break;
--        case AMD_IRONGATE:     chipset = "AMD Irongate";     break;
--        case ALI_M1541:        chipset = "ALi M1541";        break;
--        case ALI_GENERIC:      chipset = "ALi";              break;
--        case NOT_SUPPORTED:    chipset = "unsupported";      break;
--        default:               chipset = "unknown";
-+#if defined(KERNEL_2_4)
-+    /*
-+     * The original Linux 2.4 AGP GART driver interface declared copy_info to
-+     * return nothing. This changed in Linux 2.5, which reports unsupported
-+     * chipsets via this function. If this Linux 2.4 kernels behaves the same
-+     * way, we have no way to know.
-+     */
-+    drm_agp_p->copy_info(&agpinfo);
-+#else
-+    if (drm_agp_p->copy_info(&agpinfo)) {
-+        drm_agp_p->release();
-+        inter_module_put("drm_agp");
-+        return -1;
-     }
--
--    nv_printf(NV_DBG_SETUP, "NVRM: AGPGART: %s chipset\n", chipset);
-+#endif
- 
- #ifdef CONFIG_MTRR
-     if ((gart.mtrr = mtrr_add(agpinfo.aper_base,
-@@ -229,7 +140,8 @@
-          */
-         nv_printf(NV_DBG_ERRORS, 
-             "NVRM: AGPGART: unable to set MTRR write-combining\n");
--        (*(agp_ops.backend_release))();
-+        drm_agp_p->release();
-+        inter_module_put("drm_agp");
-         return -1;
-     }
- #endif
-@@ -245,7 +157,8 @@
-     {
-         nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: unable to remap aperture\n");
-         MTRR_DEL(gart);
--        (*(agp_ops.backend_release))();
-+        drm_agp_p->release();
-+        inter_module_put("drm_agp");
-         return -1;
-     }
- 
-@@ -256,7 +169,8 @@
-         nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: unable to allocate bitmap\n");
-         NV_IOUNMAP(gart.aperture, RM_PAGE_SIZE);
-         MTRR_DEL(gart);
--        (*(agp_ops.backend_release))();
-+        drm_agp_p->release();
-+        inter_module_put("drm_agp");
-         return -1;
-     }
- 
-@@ -267,39 +181,19 @@
-         os_free_mem(bitmap);
-         NV_IOUNMAP(gart.aperture, RM_PAGE_SIZE);
-         MTRR_DEL(gart);
--        (*(agp_ops.backend_release))();
-+        drm_agp_p->release();
-+        inter_module_put("drm_agp");
-         return -1;
-     }
- 
--    nv_printf(NV_DBG_SETUP,
--        "NVRM: AGPGART: aperture: %ldM @ 0x%08lx\n",
--        (unsigned long)agpinfo.aper_size,
--        (unsigned long)agpinfo.aper_base);
--
--    nv_printf(NV_DBG_SETUP, 
--        "NVRM: AGPGART: aperture mapped from 0x%08lx to 0x%08lx\n",
--        agpinfo.aper_base,
--        (unsigned long) gart.aperture);
--
-     if (!agp_sba) agpinfo.mode &= ~0x00000200;
-     if (!agp_fw)  agpinfo.mode &= ~0x00000010;
- 
-     if (!(agp_rate & 0x00000004)) agpinfo.mode &= ~0x00000004;
-     if (!(agp_rate & 0x00000002)) agpinfo.mode &= ~0x00000002;
-     
--    (*(agp_ops.enable))(agpinfo.mode);
-+    drm_agp_p->enable(agpinfo.mode);
-     
--    if (agpinfo.mode & 0x00000200)
--        nv_printf(NV_DBG_SETUP, "NVRM: AGPGART: backend supports sba\n");
--    if (agpinfo.mode & 0x00000010)
--        nv_printf(NV_DBG_SETUP, "NVRM: AGPGART: backend supports fw\n");
--    if (agpinfo.mode & 0x00000004)
--        nv_printf(NV_DBG_SETUP, "NVRM: AGPGART: mode 4x\n");
--    else if (agpinfo.mode & 0x00000002)
--        nv_printf(NV_DBG_SETUP, "NVRM: AGPGART: mode 2x\n");
--    else if (agpinfo.mode & 0x00000001)
--        nv_printf(NV_DBG_SETUP, "NVRM: AGPGART: mode 1x\n");
--
-     *ap_phys_base   = (void*) agpinfo.aper_base;
-     *ap_mapped_base = (void*) gart.aperture;
-     *apsize         = (agpinfo.aper_size * 0x100000) - 1;
-@@ -333,11 +227,13 @@
-         NV_IOUNMAP(gart.aperture, RM_PAGE_SIZE);
-     }
- 
--    (*(agp_ops.backend_release))();
-+    drm_agp_p->release();
- 
--#if !defined (KERNEL_2_2)
-+    /*
-+     * XXX Same as above; the inter_module_* mechanism will go away at some
-+     * point, it has been deprecated in Linux 2.5.
-+     */
-     inter_module_put("drm_agp");
--#endif
- 
-     if (rm_clear_agp_bitmap(nv, &bitmap))
-     {
-@@ -384,7 +280,7 @@
-         return RM_ERROR;
-     }
- 
--    ptr = (*agp_ops.allocate_memory)(PageCount, AGP_NORMAL_MEMORY);
-+    ptr = drm_agp_p->allocate_memory(PageCount, AGP_NORMAL_MEMORY);
-     if (ptr == NULL)
-     {
-         *pAddress = (void*) 0;
-@@ -392,7 +288,7 @@
-         return RM_ERR_NO_FREE_MEM;
-     }
-     
--    err = (*(agp_ops.bind_memory))(ptr, *Offset);
-+    err = drm_agp_p->bind_memory(ptr, *Offset);
-     if (err)
-     {
-         // this happens a lot when the aperture itself fills up..
-@@ -409,7 +305,7 @@
-     if (status != RM_OK)
-     {
-         nv_printf(NV_DBG_ERRORS, "NVRM: memory allocation failed\n");
--        (*(agp_ops.unbind_memory))(ptr);
-+        drm_agp_p->unbind_memory(ptr);
-         goto fail;
-     }
- 
-@@ -424,7 +320,7 @@
-     return RM_OK;
- 
- fail:
--    (*(agp_ops.free_memory))(ptr);
-+    drm_agp_p->free_memory(ptr);
-     *pAddress = (void*) 0;
- 
-     return RM_ERROR;
-@@ -463,7 +359,7 @@
-     {
-         nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: unable to remap %lu pages\n",
-             (unsigned long)agp_data->num_pages);
--        (*(agp_ops.unbind_memory))(agp_data->ptr);
-+        drm_agp_p->unbind_memory(agp_data->ptr);
-         goto fail;
-     }
-     
-@@ -481,9 +377,6 @@
- #endif /* AGPGART */
- }
- 
--
--#if !defined(KERNEL_2_2)
--
- RM_STATUS 
- KernMapAGPNopage(
-     VOID *address,
-@@ -530,9 +423,6 @@
- #endif
- }
- 
--#endif /* !defined(KERNEL_2_2) */
--
--
- RM_STATUS KernFreeAGPPages(
-     nv_state_t *nv,
-     VOID **pAddress,
-@@ -558,8 +448,8 @@
-     {
-         size_t pages = ptr->page_count;
- 
--        (*(agp_ops.unbind_memory))(ptr);
--        (*(agp_ops.free_memory))(ptr);
-+        drm_agp_p->unbind_memory(ptr);
-+        drm_agp_p->free_memory(ptr);
- 
-         nv_printf(NV_DBG_INFO, "NVRM: AGPGART: freed %ld pages\n",
-             (unsigned long)pages);
-diff -ruN NVIDIA_kernel-1.0-4496/os-interface.c NVIDIA_kernel-1.0-4496-2.6/os-interface.c
---- NVIDIA_kernel-1.0-4496/os-interface.c      2003-07-17 04:56:13.000000000 +0200
-+++ NVIDIA_kernel-1.0-4496-2.6/os-interface.c  2003-07-29 00:02:15.000000000 +0200
-@@ -56,7 +56,7 @@
-     PHWINFO pDev
- )
- {
--    return suser();
-+    return NV_IS_SUSER();
- }
- 
- U032 os_get_page_size(VOID)
-@@ -211,6 +211,11 @@
- {
-     NV_MEM_TRACKING_PAD_SIZE(size);
- 
-+    /*
-+     * XXX This needs to be !NV_MAY_SLEEP() rather than in_interrupt(); that
-+     * requires quite a bit of locking to be rearranged, however, which is why
-+     * I'll leave it alone for now.
-+     */
-     if (in_interrupt()) {
-         if (size <= KMALLOC_LIMIT) {
-             /*
-@@ -296,7 +301,7 @@
-     *address = (void *) va;
- 
-     for (i = 0; i < count; i++) {
--        mem_map_reserve(GET_MAP_NR(__pa((va))));
-+        SetPageReserved(virt_to_page(va));
-         va += PAGE_SIZE;
-     }
- 
-@@ -320,7 +325,7 @@
-     unsigned long va = (unsigned long) address;
- 
-     for (i = 0; i < count; i++) {
--        mem_map_unreserve(GET_MAP_NR(__pa((va))));
-+        ClearPageReserved(virt_to_page(va));
-         va += PAGE_SIZE;
-     }
- 
-@@ -426,7 +431,7 @@
-     if (in_irq() && MilliSeconds > NV_MAX_ISR_MDELAY)
-         return RM_ERROR;
- 
--    if (in_interrupt()) 
-+    if (!NV_MAY_SLEEP()) 
-     {
-         mdelay(MilliSeconds);
-         return RM_OK;
-@@ -524,8 +529,8 @@
- // The current debug display level (default to maximum debug level)
- int cur_debuglevel = 0xaaaaaaaa;
- 
--MODULE_PARM(silence_nvidia_output, "1i");
- static int silence_nvidia_output = 0;
-+NV_MODULE_PARAMETER(silence_nvidia_output);
- 
- 
- //
-@@ -708,14 +713,14 @@
- 
- ULONG os_cli(ULONG flags)
- {
--    save_flags(flags);
--    cli();
-+    NV_SAVE_FLAGS(flags);
-+    NV_CLI();
-     return flags;
- }
- 
- ULONG os_sti(ULONG flags)
- {
--    restore_flags(flags);
-+    NV_RESTORE_FLAGS(flags);
-     return flags;
- }
- 
-@@ -848,16 +853,6 @@
-         NV_IOREMAP_NOCACHE(vaddr, start, size_bytes);
-     }
- 
--#if defined (KERNEL_2_2)
--    if ((vaddr == NULL)) // && (mode == NV_MEMORY_DEFAULT))
--    {
--        unsigned long map_nr = MAP_NR(__va(start));
--        if (map_nr < max_mapnr) {
--            vaddr = __va(start);
--        }
--    }
--#endif
--
- #ifdef DEBUG
-     if (mode == NV_MEMORY_WRITECOMBINED) {
-         nv_printf(NV_DBG_ERRORS, 
-@@ -878,16 +873,7 @@
-     U032 size_bytes
- )
- {
--#if defined (KERNEL_2_2)
--    if (MAP_NR(addr) < max_mapnr) {
--        // if we didn't want the memory cached, this isn't necessary
--        // but we shouldn't be in a timing critical piece of code.
--        asm volatile("wbinvd":::"memory");
--    } else 
--#endif
--    {
--        NV_IOUNMAP(addr, size_bytes);
--    }
-+    NV_IOUNMAP(addr, size_bytes);
- }
- 
- VOID* os_map_user_space(
-@@ -991,7 +977,7 @@
- 
- U032 os_get_cpu_count()
- {
--    return smp_num_cpus;
-+    return NV_SMP_NUM_CPUS;
- }
- 
- 
-@@ -1054,12 +1040,15 @@
-     if (sgi_funcs.add_barrier == NULL)
-     {
- #if defined(TESTING_SWAP)
--#if !defined (KERNEL_2_2)
-+        /*
-+         * XXX The inter_module_* mechanism has been deprecated in Linux 2.5, a
-+         * new mechanism is in place; this code will need to be updated at some
-+         * point.
-+         */
-         inter_module_register(ADD_BARRIER_FUNC,    THIS_MODULE, sgitest_add_barrier);
-         inter_module_register(REMOVE_BARRIER_FUNC, THIS_MODULE, sgitest_remove_barrier);
-         inter_module_register(SWAP_READY_FUNC,     THIS_MODULE, sgitest_swap_ready);
- #endif
--#endif
-         sgi_funcs.add_barrier = GET_MODULE_SYMBOL(0, ADD_BARRIER_FUNC);
-         sgi_funcs.remove_barrier = GET_MODULE_SYMBOL(0, REMOVE_BARRIER_FUNC);
-         sgi_funcs.swap_ready = GET_MODULE_SYMBOL(0, SWAP_READY_FUNC);
-diff -ruN NVIDIA_kernel-1.0-4496/os-registry.c NVIDIA_kernel-1.0-4496-2.6/os-registry.c
---- NVIDIA_kernel-1.0-4496/os-registry.c       2003-07-17 04:56:13.000000000 +0200
-+++ NVIDIA_kernel-1.0-4496-2.6/os-registry.c   2003-07-29 00:02:15.000000000 +0200
-@@ -48,24 +48,6 @@
-  *   This could be changed to work on a per-device basis.
-  */
- 
--/*
-- * The 2nd argument to MODULE_PARM is used to verify parameters passed
-- * to the module at load time. It should be a string in the following 
-- * format:
-- *
-- *    [min[-max]]{b,h,i,l,s}
-- *
-- * The MIN and MAX specifiers delimit the length of the array. If MAX
-- * is omitted, it defaults to MIN; if both are omitted, the default is
-- * 1. The final character is a type specifier.
-- *
-- *  b   byte
-- *  h   short
-- *  i   int
-- *  l   long
-- *  s   string
-- */
--
- /* 
-  * Option: VideoMemoryTypeOverride
-  * 
-@@ -92,7 +74,7 @@
-  */
- 
- static int NVreg_VideoMemoryTypeOverride = 1;
--MODULE_PARM(NVreg_VideoMemoryTypeOverride, "i");
-+NV_MODULE_PARAMETER(NVreg_VideoMemoryTypeOverride);
- 
- /*
-  * Option: EnableVia4x
-@@ -111,7 +93,7 @@
-  */
- 
- static int NVreg_EnableVia4x = 0;
--MODULE_PARM(NVreg_EnableVia4x, "i");
-+NV_MODULE_PARAMETER(NVreg_EnableVia4x);
- 
- /*
-  * Option: EnableALiAGP
-@@ -134,7 +116,7 @@
-  */
- 
- static int NVreg_EnableALiAGP = 0;
--MODULE_PARM(NVreg_EnableALiAGP, "i");
-+NV_MODULE_PARAMETER(NVreg_EnableALiAGP);
- 
- /* 
-  * Option: ReqAGPRate
-@@ -164,7 +146,7 @@
-  */
- 
- static int NVreg_ReqAGPRate = 7;
--MODULE_PARM(NVreg_ReqAGPRate, "i");
-+NV_MODULE_PARAMETER(NVreg_ReqAGPRate);
- 
- /* 
-  * Option: UpdateKernelAGP
-@@ -193,7 +175,7 @@
-  */
- 
- static int NVreg_UpdateKernelAGP = 1;
--MODULE_PARM(NVreg_UpdateKernelAGP, "i");
-+NV_MODULE_PARAMETER(NVreg_UpdateKernelAGP);
- 
- /* 
-  * Option: EnableAGPSBA
-@@ -226,7 +208,7 @@
- static int NVreg_EnableAGPSBA = 0;
- #endif
- 
--MODULE_PARM(NVreg_EnableAGPSBA, "i");
-+NV_MODULE_PARAMETER(NVreg_EnableAGPSBA);
- 
- /*
-  * Option: EnableAGPFW
-@@ -250,7 +232,7 @@
-  */
- 
- static int NVreg_EnableAGPFW = 0;
--MODULE_PARM(NVreg_EnableAGPFW, "i");
-+NV_MODULE_PARAMETER(NVreg_EnableAGPFW);
- 
- /*
-  * Option: SoftEDIDs
-@@ -269,7 +251,7 @@
-  */
- 
- static int NVreg_SoftEDIDs = 1;
--MODULE_PARM(NVreg_SoftEDIDs, "i");
-+NV_MODULE_PARAMETER(NVreg_SoftEDIDs);
- 
- /* 
-  * Option: Mobile
-@@ -293,14 +275,14 @@
-  */
- 
- static int NVreg_Mobile = ~0;
--MODULE_PARM(NVreg_Mobile, "i");
-+NV_MODULE_PARAMETER(NVreg_Mobile);
- 
- 
- static int NVreg_ResmanDebugLevel = ~0;
--MODULE_PARM(NVreg_ResmanDebugLevel, "i");
-+NV_MODULE_PARAMETER(NVreg_ResmanDebugLevel);
- 
- static int NVreg_FlatPanelMode = 0;
--MODULE_PARM(NVreg_FlatPanelMode, "i");
-+NV_MODULE_PARAMETER(NVreg_FlatPanelMode);
- 
- /*
-  * You can enable any of the registry options disabled by default by
diff --git a/media-video/nvidia-kernel/files/1.0.4496/NVIDIA_kernel-1.0-4496-2.6-20031026.diff b/media-video/nvidia-kernel/files/1.0.4496/NVIDIA_kernel-1.0-4496-2.6-20031026.diff
deleted file mode 100644 (file)
index f999e3d..0000000
+++ /dev/null
@@ -1,2547 +0,0 @@
-diff -ruN NVIDIA_kernel-1.0-4496/Makefile NVIDIA_kernel-1.0-4496-2.6/Makefile
---- NVIDIA_kernel-1.0-4496/Makefile    2003-07-17 04:56:13.000000000 +0200
-+++ NVIDIA_kernel-1.0-4496-2.6/Makefile        1970-01-01 01:00:00.000000000 +0100
-@@ -1,169 +0,0 @@
--# This Makefile is automatically generated; do not edit
--#   Generated on 'builder3.nvidia.com' on Wed Jul 16 19:03:10 PDT 2003
--
--LINUX_MODULE=nv-linux.o
--DEFINES=-D__KERNEL__ -DMODULE -D_LOOSE_KERNEL_NAMES -DNTRM -D_GNU_SOURCE -D_LOOSE_KERNEL_NAMES -D__KERNEL__ -DMODULE  -DNV_MAJOR_VERSION=1 -DNV_MINOR_VERSION=0 -DNV_PATCHLEVEL=4496  -DNV_UNIX   -DNV_LINUX   -DNV_INT64_OK   -DNVCPU_X86     
--INCLUDES=-I.
--
--OBJECTS=nv.o os-agp.o os-interface.o os-registry.o 
--HEADERS=os-agp.h os-interface.h nv-linux.h nv-misc.h nv-memdbg.h nv.h  rmretval.h nvtypes.h  $(VERSION_HDR)
--
--CFLAGS=-Wall -Wimplicit -Wreturn-type -Wswitch -Wformat -Wchar-subscripts -Wparentheses -Wpointer-arith -Wcast-qual -Wno-multichar  -O -MD $(DEFINES) $(INCLUDES) -Wno-cast-qual
--
--RESMAN_KERNEL_MODULE=nv-kernel.o
--
--KERNDIR=/lib/modules/$(shell uname -r)
--
--# check for newer paths. if found, use them, otherwise use old paths
--# these wouldn't work with the gnu make included with rh6.2
--# KERNINC=$(if -d $(KERNDIR)/build, $(KERNDIR)/build/include, /usr/src/linux/include)
--# INSTALLDIR=$(if -d $(KERNDIR)/kernel, $(KERNDIR)/kernel/drivers/video, $(KERNDIR)/video)
--
--# this is slightly more brain-dead, but works..
--ifeq ($(shell if test -d $(KERNDIR)/build; then echo yes; fi),yes)
--KERNINC=$(KERNDIR)/build/include
--else
--KERNINC=/usr/src/linux/include
--endif
--
--ifeq ($(shell if test -d $(KERNDIR)/kernel; then echo yes; fi),yes)
--INSTALLDIR=$(KERNDIR)/kernel/drivers/video
--else
--INSTALLDIR=$(KERNDIR)/video
--endif
--
--ifeq ($(shell echo $(NVDEBUG)),1)
--  ifeq ($(shell test -z $(RMDEBUG) && echo yes),yes)
--    RMDEBUG=1
--  endif
--endif
--
--ifeq ($(shell echo $(RMDEBUG)),1)
--CFLAGS += -DDEBUG -g -fno-common
--endif
--
--# this is just plain wrong, get rid of it
--BROKENDIR=$(KERNDIR)/kernel/video
--
--INSTALL=$(shell which install)
--
--# determine gcc versions used (kernel, nvidia.o)
--module_cc:=$(shell $(CC) -v 2>&1 | tail -n 1)
--version="^Linux version [^(]* (.*@.*) (\(.*\)) .*"
--kernel_cc:=$(shell cat /proc/version | sed "s/"$(version)"/\1/")
--
--module_cc:=$(shell echo "$(module_cc)" | cut -d ' ' -f 3)
--kernel_cc:=$(shell echo "$(kernel_cc)" | cut -d ' ' -f 3)
--
--# allow specification of alternate include file tree on command line and extra defines
--ifdef SYSINCLUDE
--INCLUDES += -I$(SYSINCLUDE)
--else
--INCLUDES += -I$(KERNINC)
--endif
--
--ifeq ($(shell sh conftest.sh remap_page_range $(INCLUDES)), 5)
--  DEFINES += -DREMAP_PAGE_RANGE_5
--endif
--
--ifeq ($(shell sh conftest.sh remap_page_range $(INCLUDES)), 4)
--  DEFINES += -DREMAP_PAGE_RANGE_4
--endif
--
--DEFINES+=$(EXTRA_DEFINES)
--
--# allow build parameters to be passed in through the environment
--ifdef BUILD_PARAMS
--    DEFINES+=-D$(BUILD_PARAMS)
--endif
--
--VERSION_HDR=nv_compiler.h
--
--all: install
--
--install: package-install
--
--package-install: nvidia.o rmmod-check
--      @if [ `id -ur` != 0 ]; then \
--              echo Please run \"make install\" as root.; \
--      else \
--              if [ -d $(BROKENDIR) ]; then \
--                      rm -f $(BROKENDIR)/NVdriver; \
--                      rmdir --ignore-fail-on-non-empty $(BROKENDIR); \
--              fi && \
--              mkdir -p $(INSTALLDIR) && \
--              rm -f $(INSTALLDIR)/NVdriver && \
--              $(INSTALL) -m 0664 -o root -g root nvidia.o $(INSTALLDIR)/nvidia.o$(O) && \
--              PATH="$(PATH):/bin:/sbin" depmod -a && \
--                PATH="$(PATH):/bin:/sbin" modprobe nvidia && \
--              sh makedevices.sh && \
--              echo "nvidia.o installed successfully."; \
--      fi
--
--RMMOD_ERROR=\
--      echo ""; \
--      echo "Unable to remove existing NVIDIA kernel module."; \
--      echo "Please be sure you have exited X before attempting"; \
--      echo "to install the NVIDIA kernel module."; \
--      echo ""; \
--      echo -en "\033[1;31m"; \
--      echo -e  "*** Failed rmmod sanity check. Bailing out! ***"; \
--      echo -en "\033[0m"; \
--      exit 1;
--
--rmmod-check:
--      @if PATH="$(PATH):/bin:/sbin" lsmod | grep -w nvidia > /dev/null; then \
--              if ! PATH="($PATH):/bin:/sbin" rmmod nvidia > /dev/null; then $(RMMOD_ERROR) fi \
--      fi; \
--      if PATH="$(PATH):/bin:/sbin" lsmod | grep -w NVdriver > /dev/null; then \
--              if ! PATH="$(PATH):/bin:/sbin" rmmod NVdriver > /dev/null; then $(RMMOD_ERROR) fi \
--      fi
--
--gcc-check:
--      @if [ -z $(IGNORE_CC_MISMATCH) ]; then \
--       if [ "$(kernel_cc)" != "$(module_cc)" ]; then \
--      echo "                                                           "; \
--      echo "You appear to be compiling the NVIDIA kernel module with   "; \
--      echo "a compiler different from the one that was used to compile "; \
--      echo "the running kernel. This may be perfectly fine, but there  "; \
--      echo "are cases where this can lead to unexpected behaviour and  "; \
--      echo "system crashes.                                            "; \
--      echo "                                                           "; \
--      echo "If you know what you are doing and want to override this   "; \
--      echo "check, you can do so by setting IGNORE_CC_MISMATCH.        "; \
--      echo "                                                           "; \
--      echo "In any other case, set the CC environment variable to the  "; \
--      echo "name of the compiler that was used to compile the kernel.  "; \
--      echo "                                                           "; \
--      echo -en "\033[1;31m"; \
--      echo -e  "*** Failed cc sanity check. Bailing out! ***"; \
--      echo -en "\033[0m"; \
--      exit 1; \
--       fi \
--      fi
--
--nvidia.o: gcc-check $(LINUX_MODULE) $(RESMAN_KERNEL_MODULE) 
--      ld -r -o $@ $(LINUX_MODULE) $(RESMAN_KERNEL_MODULE)
--
--$(VERSION_HDR): 
--      echo \#define NV_COMPILER \"`$(CC) -v 2>&1 | tail -n 1`\" > $@
--
--$(LINUX_MODULE): $(OBJECTS)
--      ld -r -o $@ $(OBJECTS)
--
--%.o: %.c $(HEADERS)
--      $(CC) -c $(CFLAGS) $<
--
--# debug tool to preprocess the file and leave .i to make it easier to untangle #defines
--%.i: %.c
--      $(CC) $(CFLAGS) -E $< > $@
--
--%.s: %.c
--      $(CC) $(CFLAGS) -S $< > $@
--
--
--clean:
--      $(RM) $(OBJECTS) $(LINUX_MODULE) $(VERSION_HDR) *.d NVdriver nvidia.o
--
--
---include $(OBJECTS:%.o=%.d)
-diff -ruN NVIDIA_kernel-1.0-4496/Makefile.kbuild NVIDIA_kernel-1.0-4496-2.6/Makefile.kbuild
---- NVIDIA_kernel-1.0-4496/Makefile.kbuild     1970-01-01 01:00:00.000000000 +0100
-+++ NVIDIA_kernel-1.0-4496-2.6/Makefile.kbuild 2003-07-31 19:52:00.000000000 +0200
-@@ -0,0 +1,258 @@
-+#
-+# KBUILD Makefile for the NVIDIA Linux kernel module.
-+#
-+# The motivation for replacing the original Makefile is the hope that this
-+# version will simplify the build and installation process. In the past,
-+# many architectural and cosmetic changes to the Linux kernel have made it
-+# difficult to maintain compatibility or required duplication of logic.
-+#
-+# Linux 2.5 introduces numerous such changes, many of which impact modules.
-+# Relying on KBUILD, some aspects of the build system otherwise difficult
-+# to support (for example, module versioning) are abstracted away and dealt
-+# with elsewhere, making life significantly easier here.
-+#
-+# The new approach currently has its own share of problems, some of which
-+# are architectural difficulties with KBUILD, others minor annoyances. For
-+# this reason, an improved version of the NVIDIA Makefile is available to
-+# those experiencing difficulties.
-+#
-+# Please report any problems you may be experiencing with this experimental
-+# Makefile to either one (or, preferably, both) of us:
-+#
-+# Alistair J Strachan (alistair@devzero.co.uk) (first pass, enhancements)
-+# Christian Zander (zander@mail.minion.de) (enhancements)
-+#
-+
-+all: install
-+install: package-install
-+
-+#
-+# The NVIDIA kernel module base name and static file names. KBUILD will go
-+# ahead and append ".o" or ".ko" to form the final module name.
-+#
-+
-+MODULE_NAME := nvidia
-+VERSION_HEADER := nv_compiler.h
-+
-+#
-+# List of object files to link into NVIDIA kernel module; make sure KBUILD
-+# understands that we want a module.
-+#
-+
-+RESMAN_CORE_OBJS := nv-kernel.o
-+RESMAN_GLUE_OBJS := nv.o os-agp.o os-interface.o os-registry.o
-+
-+$(MODULE_NAME)-objs := $(RESMAN_CORE_OBJS) $(RESMAN_GLUE_OBJS)
-+
-+#
-+# A bug in KBUILD 2.4 means that leaving obj-m set in top-level context
-+# will cause Rules.make to call pathdown.sh, which is wrong. So, we only
-+# set this conditional of a kernel-level instance.
-+#
-+
-+ifdef TOPDIR
-+obj-m += $(MODULE_NAME).o
-+endif
-+
-+#
-+# Include local source directory in $(CC)'s include path and set disable any
-+# warning types that are of little interest to us.
-+#
-+
-+EXTRA_CFLAGS += -I$(src)
-+EXTRA_CFLAGS += -Wno-cast-qual -Wno-strict-prototypes
-+
-+#
-+# Determine location of the Linux kernel source tree. Allow users to override
-+# the default (i.e. automatically determined) kernel source location with the
-+# KERNDIR directive; this new directive replaces NVIDIA's SYSINCLUDE.
-+#
-+
-+ifdef KERNDIR
-+  KERNEL_SOURCES := $(KERNDIR)
-+  KERNEL_HEADERS := -I$(KERNEL_SOURCES)/include
-+  MODULE_ROOT    := /lib/modules/$(shell uname -r)/kernel/drivers # XXX
-+else
-+  KERNEL_SOURCES := /lib/modules/$(shell uname -r)/build
-+  KERNEL_HEADERS := -I$(KERNEL_SOURCES)/include
-+  MODULE_ROOT    := /lib/modules/$(shell uname -r)/kernel/drivers
-+endif
-+
-+#
-+# We rely on these two definitions below; if they aren't set, we set them to
-+# reasonable defaults (Linux 2.4's KBUILD, and top-level passes will not set
-+# these).
-+#
-+
-+src ?= .
-+obj ?= .
-+
-+#
-+# Sets any internal variables left unset by KBUILD (e.g. this happens during
-+# a top-level run).
-+#
-+
-+TOPDIR ?= $(KERNEL_SOURCES)
-+PATCHLEVEL ?= $(shell sh $(src)/conftest.sh kernel_patch_level $(TOPDIR))
-+
-+#
-+# Linux 2.4 uses the .o module extension. Linux 2.5, however, uses the .ko
-+# module extension. Handle these gracefully.
-+#
-+
-+ifeq ($(PATCHLEVEL), 4)
-+  MODULE_OBJECT := $(MODULE_NAME).o
-+else
-+  MODULE_OBJECT := $(MODULE_NAME).ko
-+endif
-+
-+#
-+# NVIDIA specific CFLAGS and #define's. The remap_page_range check has become
-+# necessary with the introduction of the five argument version to Linux 2.4
-+# distribution kernels; this conflicting change cannot be detected at compile
-+# time.
-+#
-+
-+EXTRA_CFLAGS += -DNTRM -D_LOOSE_KERNEL_NAMES -D__KERNEL__ -DMODULE  -DNV_MAJOR_VERSION=1 -DNV_MINOR_VERSION=0 -DNV_PATCHLEVEL=4496  -DNV_UNIX   -DNV_LINUX   -DNV_INT64_OK   -DNVCPU_X86  
-+
-+ifeq ($(shell echo $(NVDEBUG)),1)
-+  ifeq ($(shell test -z $(RMDEBUG) && echo yes),yes)
-+    RMDEBUG=1
-+  endif
-+endif
-+
-+ifeq ($(shell echo $(RMDEBUG)),1)
-+  EXTRA_CFLAGS += -DDEBUG -g -fno-common
-+endif
-+
-+ifeq ($(shell sh $(src)/conftest.sh remap_page_range $(KERNEL_HEADERS)), 5)
-+  EXTRA_CFLAGS += -DREMAP_PAGE_RANGE_5
-+endif
-+
-+ifeq ($(shell sh $(src)/conftest.sh remap_page_range $(KERNEL_HEADERS)), 4)
-+  EXTRA_CFLAGS += -DREMAP_PAGE_RANGE_4
-+endif
-+
-+#
-+# NVIDIA binary object file includes .common section.
-+#
-+
-+EXTRA_LDFLAGS := -d
-+
-+#
-+# Miscellaneous NVIDIA kernel module build support targets. They are needed
-+# to satisfy KBUILD requirements and to support NVIDIA specifics.
-+#
-+
-+$(obj)/nv-kernel.o:
-+      cp $(src)/$(RESMAN_CORE_OBJS) $(obj)/$(RESMAN_CORE_OBJS)
-+
-+$(obj)/$(VERSION_HEADER):
-+      echo \#define NV_COMPILER \"`$(CC) -v 2>&1 | tail -n 1`\" > $@
-+
-+$(obj)/nv.o: $(obj)/$(VERSION_HEADER)
-+
-+#
-+# More quirks for Linux 2.4 KBUILD, which doesn't link automatically.
-+#
-+
-+ifeq ($(PATCHLEVEL), 4)
-+$(obj)/$(MODULE_NAME).o: $($(MODULE_NAME)-objs)
-+      $(LD) $(EXTRA_LDFLAGS) -r -o $@ $($(MODULE_NAME)-objs)
-+endif
-+
-+#
-+# KBUILD build parameters.
-+#
-+
-+KBUILD_PARAMS := -C $(KERNEL_SOURCES) SUBDIRS=$(PWD)
-+
-+#
-+# NVIDIA sanity checks.
-+#
-+
-+suser-sanity-check:
-+      @if ! sh conftest.sh suser_sanity_check; then \
-+        echo; \
-+        echo "You have insufficient privileges for this operation. Please "; \
-+        echo "run \"make install\" as root!                               "; \
-+        echo; \
-+        exit 1; \
-+      fi
-+
-+rmmod-sanity-check:
-+      @if ! sh conftest.sh rmmod_sanity_check $(MODULE_NAME); then \
-+        echo; \
-+        echo "Unable to unload the currently loaded NVIDIA kernel module! "; \
-+        echo "Please be certain that you have exited X before attempting  "; \
-+        echo "to install this version.                                    "; \
-+        echo; \
-+        exit 1; \
-+      fi
-+
-+cc-sanity-check:
-+      @if ! sh conftest.sh cc_sanity_check $(CC); then \
-+        echo; \
-+        echo "You appear to be building the NVIDIA kernel module with a  "; \
-+        echo "compiler different from the one that was used to build the "; \
-+        echo "running kernel. This may be perfectly fine, but there are  "; \
-+        echo "cases where this can lead to unexpected behaviour and      "; \
-+        echo "system crashes.                                            "; \
-+        echo; \
-+        echo "If you know what you are doing and want to override this   "; \
-+        echo "check, you can do so by setting IGNORE_CC_MISMATCH.        "; \
-+        echo; \
-+        echo "In any other case, set the CC environment variable to the  "; \
-+        echo "name of the compiler that was used to build the kernel.    "; \
-+        echo; \
-+        exit 1; \
-+      fi
-+
-+#
-+# Build the NVIDIA kernel module using Linux KBUILD. This target is used by
-+# the "package-install" target below.
-+#
-+
-+module: cc-sanity-check
-+      @make $(KBUILD_PARAMS) modules; \
-+      if ! [ -f $(MODULE_OBJECT) ]; then \
-+        echo "$(MODULE_OBJECT) failed to build!"; \
-+        exit 1; \
-+      fi
-+
-+#
-+# Build the NVIDIA kernel module with KBUILD. Verify that the user posesses
-+# sufficient privileges. Rebuild the module dependency file.
-+#
-+
-+module-install: suser-sanity-check module
-+      @mkdir -p $(MODULE_ROOT)/video; \
-+      install -m 0664 -o root -g root $(MODULE_OBJECT) $(MODULE_ROOT)/video; \
-+      /sbin/depmod -ae;
-+
-+#
-+# This target builds, then installs, then creates device nodes and inserts
-+# the module, if successful.
-+#
-+
-+package-install: module-install rmmod-sanity-check
-+      @sh makedevices.sh; \
-+      /sbin/modprobe $(MODULE_NAME) && \
-+      echo "$(MODULE_OBJECT) installed successfully.";
-+
-+#
-+# Support hack, KBUILD isn't prepared to clean up after external modules.
-+#
-+
-+clean:
-+      @rm -f $(RESMAN_GLUE_OBJS) .*.{cmd,flags}
-+      @rm -f $(MODULE_NAME).{o,ko,mod.{o,c}} built-in.o $(VERSION_HEADER) *~
-+
-+#
-+# Linux 2.4 KBUILD requires the inclusion of Rules.make; Linux 2.5's KBUILD
-+# includes dependencies automatically.
-+#
-+
-+ifeq ($(PATCHLEVEL), 4)
-+include $(KERNEL_SOURCES)/Rules.make
-+endif
-diff -ruN NVIDIA_kernel-1.0-4496/Makefile.nvidia NVIDIA_kernel-1.0-4496-2.6/Makefile.nvidia
---- NVIDIA_kernel-1.0-4496/Makefile.nvidia     1970-01-01 01:00:00.000000000 +0100
-+++ NVIDIA_kernel-1.0-4496-2.6/Makefile.nvidia 2003-07-31 19:52:06.000000000 +0200
-@@ -0,0 +1,154 @@
-+# This Makefile is automatically generated; do not edit
-+#   Generated on 'builder3.nvidia.com' on Thu Jun 19 04:05:35 PDT 2003
-+
-+LINUX_MODULE=nv-linux.o
-+DEFINES=-D__KERNEL__ -DMODULE -D_LOOSE_KERNEL_NAMES -DKBUILD_MODNAME="nvidia" -DNTRM -D_GNU_SOURCE -D_LOOSE_KERNEL_NAMES -D__KERNEL__ -DMODULE  -DNV_MAJOR_VERSION=1 -DNV_MINOR_VERSION=0 -DNV_PATCHLEVEL=4480     -DNV_UNIX   -DNV_LINUX   -DNV_INT64_OK   -DNVCPU_X86  
-+INCLUDES=-I.
-+
-+OBJECTS=nv.o os-agp.o os-interface.o os-registry.o 
-+HEADERS=os-agp.h os-interface.h nv-linux.h nv-misc.h nv-memdbg.h nv.h  rmretval.h nvtypes.h  $(VERSION_HDR)
-+
-+CFLAGS=-Wall -Wimplicit -Wreturn-type -Wswitch -Wformat -Wchar-subscripts -Wparentheses -Wcast-qual -Wno-multichar  -O -MD $(DEFINES) $(INCLUDES) -Wno-cast-qual
-+
-+RESMAN_KERNEL_MODULE=nv-kernel.o
-+
-+KERNDIR=/lib/modules/$(shell uname -r)
-+
-+# check for newer paths. if found, use them, otherwise use old paths
-+# these wouldn't work with the gnu make included with rh6.2
-+# KERNINC=$(if -d $(KERNDIR)/build, $(KERNDIR)/build/include, /usr/src/linux/include)
-+# INSTALLDIR=$(if -d $(KERNDIR)/kernel, $(KERNDIR)/kernel/drivers/video, $(KERNDIR)/video)
-+
-+# this is slightly more brain-dead, but works..
-+ifeq ($(shell if test -d $(KERNDIR)/build; then echo yes; fi),yes)
-+KERNINC=$(KERNDIR)/build/include
-+else
-+KERNINC=/usr/src/linux/include
-+endif
-+
-+ifeq ($(shell if test -d $(KERNDIR)/kernel; then echo yes; fi),yes)
-+INSTALLDIR=$(KERNDIR)/kernel/drivers/video
-+else
-+INSTALLDIR=$(KERNDIR)/video
-+endif
-+
-+ifeq ($(shell echo $(NVDEBUG)),1)
-+  ifeq ($(shell test -z $(RMDEBUG) && echo yes),yes)
-+    RMDEBUG=1
-+  endif
-+endif
-+
-+ifeq ($(shell echo $(RMDEBUG)),1)
-+CFLAGS += -DDEBUG -g -fno-common
-+endif
-+
-+# this is just plain wrong, get rid of it
-+BROKENDIR=$(KERNDIR)/kernel/video
-+
-+INSTALL=$(shell which install)
-+
-+# allow specification of alternate include file tree on command line and extra defines
-+ifdef SYSINCLUDE
-+INCLUDES += -I$(SYSINCLUDE)
-+INCLUDES += -I$(SYSINCLUDE)/asm/mach-default
-+else
-+INCLUDES += -I$(KERNINC)
-+INCLUDES += -I$(KERNINC)/asm/mach-default
-+endif
-+
-+ifeq ($(shell sh conftest.sh remap_page_range $(INCLUDES)), 5)
-+  DEFINES += -DREMAP_PAGE_RANGE_5
-+endif
-+
-+ifeq ($(shell sh conftest.sh remap_page_range $(INCLUDES)), 4)
-+  DEFINES += -DREMAP_PAGE_RANGE_4
-+endif
-+
-+DEFINES+=$(EXTRA_DEFINES)
-+
-+# allow build parameters to be passed in through the environment
-+ifdef BUILD_PARAMS
-+    DEFINES+=-D$(BUILD_PARAMS)
-+endif
-+
-+VERSION_HDR=nv_compiler.h
-+
-+all: install
-+
-+install: package-install
-+
-+suser-sanity-check:
-+      @if ! sh conftest.sh suser_sanity_check; then \
-+        echo; \
-+        echo "You have insufficient privileges for this operation. Please "; \
-+        echo "run \"make install\" as root!                               "; \
-+        echo; \
-+        exit 1; \
-+      fi
-+
-+rmmod-sanity-check:
-+      @if ! sh conftest.sh rmmod_sanity_check nvidia; then \
-+        echo; \
-+        echo "Unable to unload the currently loaded NVIDIA kernel module! "; \
-+        echo "Please be certain that you have exited X before attempting  "; \
-+        echo "to install this version.                                    "; \
-+        echo; \
-+        exit 1; \
-+      fi
-+
-+cc-sanity-check:
-+      @if ! sh conftest.sh cc_sanity_check $(CC); then \
-+        echo; \
-+        echo "You appear to be building the NVIDIA kernel module with a  "; \
-+        echo "compiler different from the one that was used to build the "; \
-+        echo "running kernel. This may be perfectly fine, but there are  "; \
-+        echo "cases where this can lead to unexpected behaviour and      "; \
-+        echo "system crashes.                                            "; \
-+        echo; \
-+        echo "If you know what you are doing and want to override this   "; \
-+        echo "check, you can do so by setting IGNORE_CC_MISMATCH.        "; \
-+        echo; \
-+        echo "In any other case, set the CC environment variable to the  "; \
-+        echo "name of the compiler that was used to build the kernel.    "; \
-+        echo; \
-+        exit 1; \
-+      fi
-+
-+package-install: suser-sanity-check nvidia.o rmmod-sanity-check
-+      if [ -d $(BROKENDIR) ]; then \
-+              rm -f $(BROKENDIR)/NVdriver; \
-+              rmdir --ignore-fail-on-non-empty $(BROKENDIR); \
-+      fi && \
-+      mkdir -p $(INSTALLDIR) && \
-+      rm -f $(INSTALLDIR)/NVdriver && \
-+      $(INSTALL) -m 0664 -o root -g root nvidia.o $(INSTALLDIR)/nvidia.o$(O) && \
-+      /sbin/depmod -a && \
-+      /sbin/modprobe nvidia && \
-+      sh makedevices.sh && \
-+      echo "nvidia.o installed successfully."; \
-+
-+nvidia.o: cc-sanity-check $(LINUX_MODULE) $(RESMAN_KERNEL_MODULE) 
-+      ld -d -r -o $@ $(LINUX_MODULE) $(RESMAN_KERNEL_MODULE)
-+
-+$(VERSION_HDR): 
-+      echo \#define NV_COMPILER \"`$(CC) -v 2>&1 | tail -n 1`\" > $@
-+
-+$(LINUX_MODULE): $(OBJECTS)
-+      ld -r -o $@ $(OBJECTS)
-+
-+%.o: %.c $(HEADERS)
-+      $(CC) -c $(CFLAGS) $<
-+
-+# debug tool to preprocess the file and leave .i to make it easier to untangle #defines
-+%.i: %.c
-+      $(CC) $(CFLAGS) -E $< > $@
-+
-+%.s: %.c
-+      $(CC) $(CFLAGS) -S $< > $@
-+
-+
-+clean:
-+      $(RM) $(OBJECTS) $(LINUX_MODULE) $(VERSION_HDR) *.d NVdriver nvidia.o
-+
-+
-+-include $(OBJECTS:%.o=%.d)
-diff -ruN NVIDIA_kernel-1.0-4496/conftest.sh NVIDIA_kernel-1.0-4496-2.6/conftest.sh
---- NVIDIA_kernel-1.0-4496/conftest.sh 2003-07-17 04:56:13.000000000 +0200
-+++ NVIDIA_kernel-1.0-4496-2.6/conftest.sh     2003-08-23 22:21:06.000000000 +0200
-@@ -37,5 +37,79 @@
-           exit 1
-         fi
-     ;;
-+
-+    cc_sanity_check)
-+        shift
-+        #
-+        # Verify that the same compiler is used for the kernel and kernel
-+        # module.
-+        #
-+        if test -n "$IGNORE_CC_MISMATCH" -o -n "$KERNDIR"; then
-+          #
-+          # The user chose to disable the gcc sanity test or is building
-+          # the module for a kernel not currently running, which renders
-+          # our test meaningless.
-+          #
-+          exit 0
-+        fi
-+
-+        VERSION="^Linux version.* (.*) (\(gcc.*\)).*"
-+        KERNEL=$(cat /proc/version | sed "s/$VERSION/\1/")
-+        MODULE=$($* -v 2>&1 | tail -n 1)
-+
-+        if test "$KERNEL" != "$MODULE"; then
-+          #
-+          # The kernel seems to have been built with a different version
-+          # of the C compiler, which may be a problem.
-+          #
-+          exit 1
-+        else
-+          exit 0
-+        fi
-+    ;;
-+
-+    kernel_patch_level)
-+        shift
-+        #
-+        # Determine the kernel's major patch level; this is only done if we
-+        # aren't told by KBUILD.
-+        #
-+        echo $(cat "$1"/Makefile | grep "PATCHLEVEL =" | cut -d " " -f 3)
-+        exit 0
-+    ;;
-+
-+    suser_sanity_check)
-+        shift
-+        #
-+        # Determine the caller's user id to determine if we have sufficient
-+        # privileges for the requested operation.
-+        #
-+        if test $(id -ur) != 0; then
-+          exit 1
-+        else
-+          exit 0
-+        fi
-+    ;;
-+
-+    rmmod_sanity_check)
-+        shift
-+        #
-+        # Make sure that any currently loaded NVIDIA kernel module can be
-+        # unloaded.
-+        #
-+        if /sbin/lsmod | grep -q "$1"; then
-+          /sbin/rmmod "$1" >& /dev/null
-+        fi
-+
-+        if /sbin/lsmod | grep -q "$1"; then
-+          #
-+          # The NVIDIA kernel module is still loaded, most likely because
-+          # it is busy.
-+          #
-+          exit 1
-+        else
-+          exit 0
-+        fi
-+    ;;
- esac
- 
-diff -ruN NVIDIA_kernel-1.0-4496/makedevices.sh NVIDIA_kernel-1.0-4496-2.6/makedevices.sh
---- NVIDIA_kernel-1.0-4496/makedevices.sh      2003-07-17 04:56:13.000000000 +0200
-+++ NVIDIA_kernel-1.0-4496-2.6/makedevices.sh  2003-09-03 09:24:38.000000000 +0200
-@@ -8,39 +8,37 @@
- # create a temporary file
- tmp=`(mktemp -q /tmp/nvidia.XXXXXX) 2> /dev/null` || tmp="/tmp/nvidia.$$"
- 
--paths=" /etc/modutils/aliases    \
--        /etc/modules.conf        \
--        /etc/conf.modules        "
-+modconfs=" /etc/modutils/aliases    \
-+           /etc/modules.conf        \
-+           /etc/modprobe.d/aliases  \
-+           /etc/modprobe.conf       \
-+           /etc/conf.modules        "
- 
--modconf=""
--for path in $paths; do
--   if [ -f "$path" ]; then
--       modconf=$path
--       break
-+#
-+# Pass the -p option to cp to preserve the permissions of $modconf and
-+# /etc/rc.d/rc.modules across the update. Update all relevant files
-+# including those eventually regenerated to avoid the need for awkward
-+# logic here.
-+#
-+for modconf in $modconfs; do
-+   if [ -f "$modconf" ]; then
-+     cp -p $modconf $tmp
-+     sed '/^alias.*\(NVdriver\|nvidia\)/d'  < $modconf   > $tmp
-+     if [ -c /dev/.devfsd ]; then
-+       echo "alias /dev/nvidia* nvidia" >> $tmp
-+     else
-+       echo "alias char-major-195 nvidia" >> $tmp
-+     fi
-+     mv -f $tmp $modconf
-+     test -x /sbin/update-modules && /sbin/update-modules
-    fi
- done
- 
--if [ ! -z $modconf ]; then
--   # Initialize the permissions on $tmp so that we don't change the
--   # permissions of $modconf when we mv it into place
--   cp -p $modconf $tmp
--   sed '/^alias.*\(NVdriver\|nvidia\)/d'  < $modconf   > $tmp
--   if [ -c /dev/.devfsd ]; then
--     echo "alias /dev/nvidia*   nvidia" >> $tmp
--   else
--     echo "alias char-major-195 nvidia" >> $tmp
--   fi
--   mv -f $tmp $modconf
--   test -x /sbin/update-modules && /sbin/update-modules
--else
--  if [ -f /etc/rc.d/rc.modules ]; then
--    # Initialize the permissions on $tmp so that we don't change the
--    # permissions of /etc/rc.d/rc.modules when we mv it into place
--    cp -p /etc/rc.d/rc.modules $tmp
--    sed '/.*\(NVdriver\|nvidia\).*/d' < /etc/rc.d/rc.modules > $tmp
--    echo -e "\n/sbin/modprobe nvidia" >> $tmp
--    mv -f $tmp /etc/rc.d/rc.modules
--  fi
-+if [ -f /etc/rc.d/rc.modules ]; then
-+  cp -p /etc/rc.d/rc.modules $tmp
-+  sed '/.*\(NVdriver\|nvidia\).*/d' < /etc/rc.d/rc.modules > $tmp
-+  echo -e "\n/sbin/modprobe nvidia" >> $tmp
-+  mv -f $tmp /etc/rc.d/rc.modules
- fi
- 
- if [ ! -c /dev/.devfsd ]; then
-diff -ruN NVIDIA_kernel-1.0-4496/nv-linux.h NVIDIA_kernel-1.0-4496-2.6/nv-linux.h
---- NVIDIA_kernel-1.0-4496/nv-linux.h  2003-07-17 04:56:13.000000000 +0200
-+++ NVIDIA_kernel-1.0-4496-2.6/nv-linux.h      2003-09-05 16:59:47.000000000 +0200
-@@ -20,35 +20,22 @@
- #  define MODVERSIONS
- #endif
- 
--#if defined (MODVERSIONS)
--#include <linux/modversions.h>
--#endif
--
- #include <linux/kernel.h>
- #include <linux/module.h>
- #include <linux/version.h>
- 
--#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 2, 12)
--#  error This driver does not support 2.2.11 or earlier kernels!
--#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 3, 0)
--#  define KERNEL_2_2
--#  warning NVIDIA is considering dropping support for linux-2.2 
--#  warning kernels. While end users are free to maintain their 
--#  warning own patches, or stick with current drivers, our new 
--#  warning drivers will not work "out of the box." If you are 
--#  warning concerned about lack of support for 2.2 kernels, 
--#  warning please let us know at linux-bugs@nvidia.com; we would
--#  warning like to know how many users would be seriously 
--#  warning impacted by this decision.
-+#if   LINUX_VERSION_CODE < KERNEL_VERSION(2, 3, 0)
-+#  error This driver does not support 2.2.x kernels!
- #elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 0)
--#  error This driver does not support 2.3.x development kernels!
-+#  error This driver does not support 2.3.x kernels!
- #elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
- #  define KERNEL_2_4
- #elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
--#  error This driver does not support 2.5.x development kernels!
--#  define KERNEL_2_5
-+#  error This driver does not support 2.5.x kernels!
-+#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 7, 0)
-+#  define KERNEL_2_6
- #else
--#  error This driver does not support 2.6.x or newer kernels!
-+#  error This driver does not support development kernels!
- #endif
- 
- #if defined (__ia64)
-@@ -61,12 +48,15 @@
- #define __SMP__
- #endif
- 
-+#if defined (MODVERSIONS) && !defined (KERNEL_2_6)
-+#include <linux/modversions.h>
-+#endif
-+
- #include <linux/types.h>            /* pic_t, size_t, __u32, etc        */
- #include <linux/errno.h>            /* error codes                      */
- #include <linux/list.h>             /* circular linked list             */
- #include <linux/stddef.h>           /* NULL, offsetof                   */
- #include <linux/wait.h>             /* wait queues                      */
--#include <linux/tqueue.h>           /* struct tq_struct                 */
- 
- #include <linux/slab.h>             /* kmalloc, kfree, etc              */
- #include <linux/vmalloc.h>          /* vmalloc, vfree, etc              */
-@@ -74,9 +64,15 @@
- #include <linux/poll.h>             /* poll_wait                        */
- #include <linux/delay.h>            /* mdelay, udelay                   */
- 
-+#ifdef KERNEL_2_6
-+#include <linux/sched.h>            /* suser(), capable() replacement   */
-+#include <linux/moduleparam.h>      /* module_param()                   */
-+#include <linux/smp_lock.h>         /* kernel_locked                    */
-+#include <asm/kmap_types.h>         /* page table entry lookup          */
-+#endif
-+
- #include <linux/pci.h>              /* pci_find_class, etc              */
--#include <linux/wrapper.h>          /* mem_map_reserve                  */
--#include <linux/interrupt.h>        /* mark_bh, init_bh, remove_bh      */
-+#include <linux/interrupt.h>        /* tasklets, interrupt helpers      */
- #include <linux/timer.h>
- 
- #include <asm/system.h>             /* cli, sli, save_flags             */
-@@ -85,14 +81,9 @@
- #include <asm/page.h>               /* PAGE_OFFSET                      */
- #include <asm/pgtable.h>            /* pte bit definitions              */
- 
--#if !defined (KERNEL_2_2)
- #include <linux/spinlock.h>
- #include <asm/semaphore.h>
- #include <linux/highmem.h>
--#else
--#include <asm/spinlock.h>
--#include <asm/semaphore.h>
--#endif
- 
- #ifdef CONFIG_PROC_FS
- #include <linux/proc_fs.h>
-@@ -359,78 +350,172 @@
-         free_pages(ptr, order); \
-     }
- 
-+#define GET_MODULE_SYMBOL(mod,sym)      (const void *) inter_module_get(sym)
-+#define PUT_MODULE_SYMBOL(sym)          (inter_module_put((char *) sym))
- 
--#if !defined (KERNEL_2_2)
--#  define LINUX_VMA_OFFS(vma)           (((vma)->vm_pgoff) << PAGE_SHIFT)
--#  define GET_MODULE_SYMBOL(mod,sym)  (const void *) inter_module_get(sym)
--#  define PUT_MODULE_SYMBOL(sym)        inter_module_put((char *) sym)
--#  define GET_MAP_NR(phys_page)         virt_to_page(__va(phys_page))
--#  define MEM_MAP_READ_COUNT(map_nr)    (atomic_read(&(map_nr)->count))
--#  define MEM_MAP_INC_COUNT(map_nr)     (atomic_inc(&(map_nr)->count))
--#  define MEM_MAP_DEC_COUNT(map_nr)     (atomic_dec(&(map_nr)->count))
--#  define EVENT_QUEUE(ptr)               ((struct __wait_queue_head *)(ptr))
--#  define VMA_PRIVATE(vma)              ((vma)->vm_private_data)
--#  define INIT_EVENT_QUEUE(ptr) \
--     if (ptr == NULL) { \
--        NV_KMALLOC((ptr), sizeof(struct __wait_queue_head)); \
--        if (ptr) { \
--            memset((ptr), 0, sizeof(struct __wait_queue_head)); \
--            init_waitqueue_head((struct __wait_queue_head *)(ptr)); \
--        } \
--     }
--#  define FREE_EVENT_QUEUE(ptr)         NV_KFREE((ptr), sizeof(struct __wait_queue_head)); (ptr) = NULL;
--#else
--#  define in_irq()                      (local_irq_count[smp_processor_id()])
--#  define LINUX_VMA_OFFS(vma)           ((vma)->vm_offset)
--#  define GET_MODULE_SYMBOL(mod, sym)   (void*) get_module_symbol((mod), (sym))
--#  define PUT_MODULE_SYMBOL(sym)
--#  define GET_MAP_NR(phys_page)         MAP_NR(__va(phys_page))
--#  define MEM_MAP_READ_COUNT(map_nr)    (atomic_read(&mem_map[map_nr].count))
--#  define MEM_MAP_INC_COUNT(map_nr)     (atomic_inc(&mem_map[map_nr].count))
--#  define MEM_MAP_DEC_COUNT(map_nr)     (atomic_dec(&mem_map[map_nr].count))
--#  define EVENT_QUEUE(ptr)              ((struct wait_queue **) &(ptr))
--#  define VMA_PRIVATE(vma)              ((void*)((vma)->vm_pte))
--#  define INIT_EVENT_QUEUE(ptr)         if (ptr) { ((ptr) = NULL); }
--#  define FREE_EVENT_QUEUE(ptr)
-+#ifdef KERNEL_2_6
-+# define NV_IS_SUSER()                  capable(CAP_SYS_ADMIN)
-+# define NV_PCI_DEVICE_NAME(x)          ((x)->pretty_name)
-+# define NV_CLI()                       local_irq_disable()
-+# define NV_SAVE_FLAGS(x)               local_save_flags(x)
-+# define NV_RESTORE_FLAGS(x)            local_irq_restore(x)
-+# define NV_MAY_SLEEP()                 (!in_interrupt() && !in_atomic())
-+# define NV_SMP_NUM_CPUS                num_online_cpus()
-+# define NV_MODULE_PARAMETER(x)         module_param(x, int, 0)
-+#else
-+# define NV_IS_SUSER()                  suser()
-+# define NV_PCI_DEVICE_NAME(x)          ((x)->name)
-+# define NV_CLI()                       cli()
-+# define NV_SAVE_FLAGS(x)               save_flags(x)
-+# define NV_RESTORE_FLAGS(x)            restore_flags(x)
-+# define NV_MAY_SLEEP()                 (!in_interrupt())
-+# define NV_SMP_NUM_CPUS                smp_num_cpus
-+# define NV_MODULE_PARAMETER(x)         MODULE_PARM(x, "i")
-+#endif
-+
-+#define NV_DEVICE_NUMBER(x)             minor((x)->i_rdev)
-+#define NV_VMA_OFFSET(x)                (((x)->vm_pgoff) << PAGE_SHIFT)
-+#define NV_VMA_PRIVATE(x)               ((x)->vm_private_data)
-+#define NV_IS_CONTROL_DEVICE(x)         (minor((x)->i_rdev) == 255)
-+
-+#ifndef minor
-+/*
-+ * XXX Is this correct for all possible target kernels? We need this to
-+ * support older 2.4 and some 2.6 kernels.
-+ */
-+# define minor(x) MINOR(x)
- #endif
- 
-+#ifndef KERNEL_2_6
-+  typedef void irqreturn_t;
-+# define IRQ_NONE
-+# define IRQ_RETVAL(x)
-+# define IRQ_HANDLED
-+#else
-+#ifdef AGPGART
-+  typedef struct agp_kern_info agp_kern_info;
-+  typedef struct agp_memory agp_memory;
-+#endif
-+  typedef void* devfs_handle_t;
-+#endif
-+
-+#ifdef KERNEL_2_6
-+#define NV_DEVFS_REGISTER(_name, _minor)                            \
-+({                                                                  \
-+    devfs_handle_t __handle = NULL;                                 \
-+    devfs_mk_cdev(MKDEV(NV_MAJOR_DEVICE_NUMBER, _minor),            \
-+            S_IFCHR | S_IRUGO | S_IWUGO, _name);                    \
-+    __handle;                                                       \
-+})
-+
-+#define NV_DEVFS_REMOVE_DEVICE(i) devfs_remove("nvidia%d", i)
-+#define NV_DEVFS_REMOVE_CONTROL() devfs_remove("nvidiactl")
-+#else
-+#define NV_DEVFS_REGISTER(_name, _minor)                            \
-+({                                                                  \
-+    devfs_handle_t __handle =                                       \
-+        devfs_register(NULL, _name, DEVFS_FL_DEFAULT,               \
-+                NV_MAJOR_DEVICE_NUMBER, _minor,                     \
-+                S_IFCHR | S_IRUGO | S_IWUGO, &nv_fops, NULL);       \
-+    __handle;                                                       \
-+ })
-+
-+#define NV_DEVFS_REMOVE_DEVICE(i) devfs_unregister(nv_devfs_handles[i+1])
-+#define NV_DEVFS_REMOVE_CONTROL() devfs_unregister(nv_devfs_handles[0])
-+#endif
-+
-+/*
-+ * Linux 2.5 introduced the five argument version of remap_page_range, all
-+ * relevant releases to date use it. This version was backported to 2.4 by
-+ * RedHat without means to identify the change, hence this hack.
-+ */
-+#ifdef KERNEL_2_6
-+#define NV_REMAP_PAGE_RANGE(a, b...) remap_page_range(vma, a, ## b)
-+#else
- #if defined(REMAP_PAGE_RANGE_5)
--#define NV_REMAP_PAGE_RANGE(a, b...)    remap_page_range(vma, a, ## b)
-+#define NV_REMAP_PAGE_RANGE(a, b...) remap_page_range(vma, a, ## b)
- #elif defined(REMAP_PAGE_RANGE_4)
--#define NV_REMAP_PAGE_RANGE(a, b...)    remap_page_range(a, ## b)
-+#define NV_REMAP_PAGE_RANGE(a, b...) remap_page_range(a, ## b)
- #else
--#error "Couldn't determine number of arguments expected by remap_page_range!"
-+#warning "conftest.sh failed, assuming old Linux 2.4 remap_page_range(4)!"
-+
-+#define NV_REMAP_PAGE_RANGE(a, b...) remap_page_range(a, ## b)
- #endif
-+#endif /* KERNEL_2_6 */
- 
--#if defined(pte_offset_atomic)
--#define NV_PTE_OFFSET(addres, pg_mid_dir, pte) \
-+#if defined(pmd_offset_map)
-+#define NV_PMD_OFFSET(address, pgd, pmd) \
-     { \
--        pte_t *pte__ = pte_offset_atomic(pg_mid_dir, address); \
--        pte = *pte__; \
--        pte_kunmap(pte__); \
-+        pmd = pmd_offset_map(pgd, address); \
-+    }
-+#define NV_PMD_UNMAP(pmd) \
-+    { \
-+        pmd_unmap(pmd); \
-     }
--#elif defined(pte_offset)
--#define NV_PTE_OFFSET(addres, pg_mid_dir, pte) \
--    pte = *pte_offset(pg_mid_dir, address)
- #else
--#define NV_PTE_OFFSET(addres, pg_mid_dir, pte) \
-+#define NV_PMD_OFFSET(address, pgd, pmd) \
-     { \
--        pte_t *pte__ = pte_offset_map(pg_mid_dir, address); \
--        pte = *pte__; \
--        pte_unmap(pte__); \
-+        pmd = pmd_offset(pgd, address); \
-     }
-+#define NV_PMD_UNMAP(pmd)
- #endif
- 
--#define NV_PAGE_ALIGN(addr)             ( ((addr) + PAGE_SIZE - 1) / PAGE_SIZE)
--#define NV_MASK_OFFSET(addr)            ( (addr) & (PAGE_SIZE - 1) )
-+#define NV_PMD_PRESENT(pmd) \
-+    ({ \
-+        if (pmd) { \
-+            if (pmd_none(*pmd)) { \
-+                NV_PMD_UNMAP(pmd); pmd = NULL; \
-+            } \
-+        } pmd != NULL; \
-+    })
- 
--#ifndef MAXMEM  /* temporary define for 2.2 kernels */
--#define MAXMEM  (-PAGE_OFFSET - (64 * 1024 * 1024))
-+#if defined (pte_offset_atomic)
-+#define NV_PTE_OFFSET(address, pmd, pte) \
-+    { \
-+        pte = pte_offset_atomic(pmd, address); \
-+        NV_PMD_UNMAP(pmd); \
-+    }
-+#define NV_PTE_UNMAP(pte) \
-+    { \
-+        pte_kunmap(pte); \
-+    }
-+#elif defined (pte_offset)
-+#define NV_PTE_OFFSET(address, pmd, pte) \
-+    { \
-+        pte = pte_offset(pmd, address); \
-+        NV_PMD_UNMAP(pmd); \
-+    }
-+#define NV_PTE_UNMAP(pte)
-+#else
-+#define NV_PTE_OFFSET(address, pmd, pte) \
-+    { \
-+        pte = pte_offset_map(pmd, address); \
-+        NV_PMD_UNMAP(pmd); \
-+    }
-+#define NV_PTE_UNMAP(pte) \
-+    { \
-+        pte_unmap(pte); \
-+    }
- #endif
- 
--#ifndef NV01_ROOT
--#define NV01_ROOT 0x00000000
--#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_PAGE_ALIGN(addr)             ( ((addr) + PAGE_SIZE - 1) / PAGE_SIZE)
-+#define NV_MASK_OFFSET(addr)            ( (addr) & (PAGE_SIZE - 1) )
- 
- #if defined(NVCPU_IA64)
- #define NV_GFP_HW (GFP_KERNEL | __GFP_DMA)
-@@ -487,7 +572,7 @@
- static inline int NV_IRQL_IS_RAISED()
-     {
-         unsigned long int eflags;
--        __save_flags(eflags);
-+        NV_SAVE_FLAGS(eflags);
-         return !(eflags & NV_CPU_INTERRUPT_FLAGS_BIT);
-     }
-  
-@@ -545,9 +630,10 @@
- 
-     nv_alloc_t *alloc_queue;
- 
--    // bottom half interrupt handler info; per device
--    /* keep track of any pending bottom-halves */
--    struct tq_struct *bh;
-+     /* keep track of any pending bottom halfes */
-+     struct tasklet_struct tasklet;
-+
-+     /* active bottom half counter */
-     atomic_t bh_count;
- 
-     /* get a timer callback every second */
-@@ -583,7 +669,7 @@
-     U032 num_events;
-     U032 put, get;
-     spinlock_t fp_lock;
--    void *wqueue;               // wait_queue for polling
-+    wait_queue_head_t waitqueue;
-     nv_event_t *event_fifo;     // fifo for storing events
- } nv_file_private_t;
- 
-diff -ruN NVIDIA_kernel-1.0-4496/nv.c NVIDIA_kernel-1.0-4496-2.6/nv.c
---- NVIDIA_kernel-1.0-4496/nv.c        2003-07-17 04:56:13.000000000 +0200
-+++ NVIDIA_kernel-1.0-4496-2.6/nv.c    2003-10-26 09:33:58.000000000 +0100
-@@ -15,6 +15,7 @@
- #include "nv_compiler.h"
- #include "os-agp.h"
- 
-+MODULE_LICENSE("NVIDIA");
- 
- /*
-  * our global state; one per device
-@@ -33,32 +34,20 @@
-  */
- 
- nv_linux_state_t nv_ctl_device = { { 0 } };
--void *nv_ctl_wqueue = NULL;
-+wait_queue_head_t nv_ctl_waitqueue;
- 
- // keep track of opened clients and their process id so they
- //   can be free'd up on abnormal close
- nv_client_t       nv_clients[NV_MAX_CLIENTS];
--struct tq_struct  nv_bottom_halves[NV_MAX_CLIENTS];
- 
- #ifdef CONFIG_PROC_FS
- struct proc_dir_entry *proc_nvidia;
- #endif
- 
- #ifdef CONFIG_DEVFS_FS
--devfs_handle_t  nv_dev_handle[NV_MAX_DEVICES];
--devfs_handle_t  nv_ctl_handle;
-+devfs_handle_t nv_devfs_handles[NV_MAX_DEVICES+1];
- #endif
- 
--/*
-- * pick apart our minor device number
-- * low 3 bits is NV device
-- * if 255, then its the control device
-- */
--
--#define NV_DEVICE_NUMBER(_minor) ((_minor) & 0x0f)
--#define NV_DEVICE_IS_CONTROL_DEVICE(_minor) \
--             (((_minor) & 0xFF) == 0xFF)
--
- // #define NV_DBG_MEM 1
- #undef NV_DBG_MEM
- 
-@@ -118,10 +107,6 @@
-  *** EXPORTS to Linux Kernel
-  ***/
- 
--/* linux module interface functions (called by linux kernel) */
--int           init_module(void);
--void          cleanup_module(void);
--
- /* nv_kern_ functions, interfaces used by linux kernel */
- void          nv_kern_vma_open(struct vm_area_struct *vma);
- void          nv_kern_vma_release(struct vm_area_struct *vma);
-@@ -132,7 +117,7 @@
- unsigned int  nv_kern_poll(struct file *, poll_table *);
- int           nv_kern_ioctl(struct inode *, struct file *, unsigned int, unsigned long);
- void          nv_kern_bh(void *);
--void          nv_kern_isr(int, void *, struct pt_regs *);
-+irqreturn_t   nv_kern_isr(int, void *, struct pt_regs *);
- void          nv_kern_rc_timer(unsigned long);
- #ifdef CONFIG_PM
- int           nv_kern_pm(struct pm_dev *dev, pm_request_t rqst, void *data);
-@@ -155,6 +140,7 @@
- /* character driver entry points */
- 
- static struct file_operations nv_fops = {
-+    owner:          THIS_MODULE,
-     poll:           nv_kern_poll,
-     ioctl:          nv_kern_ioctl,
-     mmap:           nv_kern_mmap,
-@@ -325,8 +311,8 @@
-     {
-         nv_printf(NV_DBG_MEMINFO, "  0x%x: count %d flags 0x%x\n", 
-             *page_ptr, 
--            (GET_MAP_NR(*page_ptr))->count,
--            (GET_MAP_NR(*page_ptr))->flags);
-+            (virt_to_page(__va(*page_ptr)))->count,
-+            (virt_to_page(__va(*page_ptr)))->flags);
-         num_pages--;
-         page_ptr++;
-     }
-@@ -397,7 +383,7 @@
-         phys_addr = virt_to_phys((void *) virt_addr);
- 
-         /* lock the page for dma purposes */
--        mem_map_reserve(GET_MAP_NR(phys_addr));
-+        SetPageReserved(virt_to_page(__va(phys_addr)));
- 
-         *page_ptr++ = phys_addr;
-         pages_needed--;
-@@ -410,7 +396,7 @@
-     while (page_ptr != (unsigned long *) page_list)
-     {
-         page_ptr--;
--        mem_map_unreserve(GET_MAP_NR(*page_ptr));
-+        ClearPageReserved(virt_to_page(__va(*page_ptr)));
-         NV_FREE_PAGES((unsigned long) phys_to_virt(*page_ptr), 0);
-     }
- 
-@@ -430,7 +416,7 @@
- 
-     while (pages_left)
-     {
--        mem_map_unreserve(GET_MAP_NR(*page_list));
-+        ClearPageReserved(virt_to_page(__va(*page_list)));
-         page_list++;
-         pages_left--;
-     }
-@@ -596,11 +582,6 @@
-     nv_linux_state_t *nvl;
-     nv_linux_state_t *nv_max_devices;
- 
--#if defined (KERNEL_2_2)
--    struct proc_dir_entry *proc_root_driver;
--    proc_root_driver = create_proc_entry("driver", flags, &proc_root);
--#endif
--
-     proc_nvidia = create_proc_entry("nvidia", flags, proc_root_driver);
-     proc_nvidia_cards = create_proc_entry("cards", flags, proc_nvidia);
-     proc_nvidia_agp = create_proc_entry("agp", flags, proc_nvidia);
-@@ -662,9 +643,6 @@
- {
- #ifdef CONFIG_PROC_FS
-     nvos_proc_remove_all(proc_nvidia);
--#if defined (KERNEL_2_2)
--    remove_proc_entry("driver", &proc_root);
--#endif
- #endif
- }
- 
-@@ -753,9 +731,8 @@
-  *** EXPORTS to Linux Kernel
-  ***/
- 
--int init_module(void)
-+static int __init nvidia_init_module(void)
- {
--    nv_linux_state_t *nvl;
-     int rc, i;
- 
-     memset(nv_linux_devices, 0, sizeof(nv_linux_devices));
-@@ -768,7 +745,7 @@
- 
-     nv_printf(NV_DBG_ERRORS, "nvidia: loading %s\n", pNVRM_ID);
- 
--#ifdef CONFIG_DEVFS_FS
-+#if defined(CONFIG_DEVFS_FS) && !defined(KERNEL_2_6)
-     rc = devfs_register_chrdev(nv_major, "nvidia", &nv_fops);
- #else
-     rc = register_chrdev(nv_major, "nvidia", &nv_fops);
-@@ -780,34 +757,35 @@
-     }
- 
- #ifdef CONFIG_DEVFS_FS
--    memset(nv_dev_handle, 0, sizeof(devfs_handle_t) * NV_MAX_DEVICES);
-     do {
-+        /*
-+         * XXX This code isn't pretty, but neither is dealing with the
-+         * various Linux devfs implemenation(s). While Linux APIs are
-+         * known to be anything but stable and oftentimes anything but
-+         * well designed, the devfs interface has been more painful to
-+         * deal with than most other APIs.
-+         */
-         char name[10];
- 
--        nv_ctl_handle = devfs_register(NULL, "nvidiactl",
--                            DEVFS_FL_DEFAULT, nv_major, 255,
--                            S_IFCHR | S_IRUGO | S_IWUGO,
--                            &nv_fops, NULL);
-+        nv_devfs_handles[0] = NV_DEVFS_REGISTER("nvidiactl", 255);
- 
-         for (i = 0; i < num_nv_devices; i++) {
-             sprintf(name, "nvidia%d", i);
--            nv_dev_handle[i] = devfs_register(NULL, name,
--                                  DEVFS_FL_DEFAULT, nv_major, i,
--                                  S_IFCHR | S_IRUGO | S_IWUGO,
--                                  &nv_fops, NULL);
-+            nv_devfs_handles[i+1] = NV_DEVFS_REGISTER(name, i);
-         }
-     } while(0);
- #endif
- 
--    nv_printf(NV_DBG_INFO, "init_module: major number %d\n", nv_major);
-+    nv_printf(NV_DBG_INFO, "nvidia_init_module: major number %d\n", nv_major);
- 
--    // init all the bottom half structures
--    for (nvl = nv_linux_devices; nvl < nv_linux_devices + NV_MAX_DEVICES; nvl++)
--    {
--        nvl->bh = &nv_bottom_halves[nvl - nv_linux_devices];
--        nvl->bh->routine = nv_kern_bh;
--        nvl->bh->data = (void *) nvl;
--        nvl->bh->sync = 0;
-+    /* instantiate tasklets */
-+    for (i = 0; i < NV_MAX_DEVICES; i++) {
-+        /*
-+         * We keep one tasklet per card to avoid latency issues with more
-+         * than one device; no two instances of a single tasklet are ever
-+         * executed concurrently.
-+         */
-+        atomic_set(&nv_linux_devices[i].tasklet.count, 1);
-     }
- 
-     // init the nvidia control device
-@@ -815,6 +793,7 @@
-         nv_state_t *nv_ctl = NV_STATE_PTR(&nv_ctl_device);
-         nv_ctl->os_state = (void *) &nv_ctl_device;
-         nv_lock_init_locks(nv_ctl);
-+        init_waitqueue_head(&nv_ctl_waitqueue);
-     }
- 
- #ifdef CONFIG_PM
-@@ -841,14 +820,14 @@
-     /* create /proc/driver/nvidia */
-     nvos_proc_create();
- 
--#if defined(DEBUG) && !defined(KERNEL_2_2)
-+#if defined(DEBUG)
-     inter_module_register("nv_linux_devices", THIS_MODULE, nv_linux_devices);
- #endif
- 
-     return 0;
- 
-  failed:
--#ifdef CONFIG_DEVFS_FS
-+#if defined(CONFIG_DEVFS_FS) && !defined(KERNEL_2_6)
-     devfs_unregister_chrdev(nv_major, "nvidia");
- #else
-     unregister_chrdev(nv_major, "nvidia");
-@@ -856,26 +835,27 @@
-     return rc;
- }
- 
--void cleanup_module(void)
-+static void __exit nvidia_exit_module(void)
- {
--    int rc, i;
--    nv_linux_state_t *nvl;
--    nv_linux_state_t *max_devices;
-+    int rc;
-+    nv_linux_state_t *nvl, *max_devices;
- 
-     /* remove /proc/driver/nvidia */
-     nvos_proc_remove();
- 
--    nv_printf(NV_DBG_INFO, "cleanup_module\n");
-+    nv_printf(NV_DBG_INFO, "nvidia_exit_module\n");
- 
--#if defined(DEBUG) && !defined(KERNEL_2_2)
-+#if defined(DEBUG)
-     inter_module_unregister("nv_linux_devices");
- #endif
- 
- #ifdef CONFIG_PM
--    for (i = 0; i < num_nv_devices; i++)
--    {
--        pm_unregister(pm_nv_dev[i]);
--    }
-+    do {
-+        int i;
-+        for (i = 0; i < num_nv_devices; i++) {
-+            pm_unregister(pm_nv_dev[i]);
-+        }
-+    } while (0);
- #endif
- 
-     // Shutdown the resource manager
-@@ -894,30 +874,29 @@
-                 continue;
- 
-             nv_printf(NV_DBG_ERRORS,
--                    "still have vm que at cleanup_module(): 0x%x to 0x%x\n",
-+                    "still have vm que at nvidia_exit_module(): 0x%x to 0x%x\n",
-                     nvl->alloc_queue->vma->vm_start,
-                     nvl->alloc_queue->vma->vm_end);
-         }
-     }
- 
--#ifdef CONFIG_DEVFS_FS
-+#if defined(CONFIG_DEVFS_FS) && !defined(KERNEL_2_6)
-     rc = devfs_unregister_chrdev(nv_major, "nvidia");
- #else
-     rc = unregister_chrdev(nv_major, "nvidia");
- #endif
- 
-     if (rc < 0) {
--        nv_printf(NV_DBG_ERRORS, "cleanup_module: unregister nv failed\n");
-+        nv_printf(NV_DBG_ERRORS, "nvidia_exit_module: unregister nv failed\n");
-     }
- 
- #ifdef CONFIG_DEVFS_FS
-     do {
-         int i;
--        for (i = 0; nv_dev_handle[i] != 0; i++) {
--            devfs_unregister(nv_dev_handle[i]);
--        }
--    } while(0);
--    devfs_unregister(nv_ctl_handle);
-+        NV_DEVFS_REMOVE_CONTROL();
-+        for (i = 0; i < num_nv_devices; i++)
-+            NV_DEVFS_REMOVE_DEVICE(i);
-+    } while (0);
- #endif
- 
- #if NV_ENABLE_MEM_TRACKING
-@@ -929,6 +908,8 @@
- #endif
- }
- 
-+module_init(nvidia_init_module);
-+module_exit(nvidia_exit_module);
- 
- /* this is only called when the vmas are duplicated.
-  * this appears to only happen when the process is cloned to create
-@@ -942,11 +923,11 @@
- nv_kern_vma_open(struct vm_area_struct *vma)
- {
-     nv_printf(NV_DBG_MEMINFO, "vma_open for 0x%x - 0x%x, offset 0x%x\n",
--        vma->vm_start, vma->vm_end, LINUX_VMA_OFFS(vma));
-+        vma->vm_start, vma->vm_end, NV_VMA_OFFSET(vma));
- 
--    if (VMA_PRIVATE(vma))
-+    if (NV_VMA_PRIVATE(vma))
-     {
--        nv_alloc_t *at = (nv_alloc_t *) VMA_PRIVATE(vma);
-+        nv_alloc_t *at = (nv_alloc_t *) NV_VMA_PRIVATE(vma);
-         at->usage_count++;
- 
-         nv_printf(NV_DBG_MEMINFO, "  at 0x%x, usage count %d, page_table 0x%x\n",
-@@ -954,8 +935,6 @@
- 
-         nvos_list_page_count(at->page_table, at->num_pages);
-     }
--
--    MOD_INC_USE_COUNT;
- }
- 
- 
-@@ -963,11 +942,11 @@
- nv_kern_vma_release(struct vm_area_struct *vma)
- {
-     nv_printf(NV_DBG_MEMINFO, "vma_release for 0x%x - 0x%x, offset 0x%x\n",
--        vma->vm_start, vma->vm_end, LINUX_VMA_OFFS(vma));
-+        vma->vm_start, vma->vm_end, NV_VMA_OFFSET(vma));
- 
--    if (VMA_PRIVATE(vma))
-+    if (NV_VMA_PRIVATE(vma))
-     {
--        nv_alloc_t *at = (nv_alloc_t *) VMA_PRIVATE(vma);
-+        nv_alloc_t *at = (nv_alloc_t *) NV_VMA_PRIVATE(vma);
- 
-         at->usage_count--;
- 
-@@ -985,35 +964,26 @@
-             if (at->page_table)
-                 nvos_unlock_pages(at->page_table, at->num_pages);
-             nvos_free_alloc(at);
--            VMA_PRIVATE(vma) = NULL;
-+            NV_VMA_PRIVATE(vma) = NULL;
-         }
-     }
--
--    MOD_DEC_USE_COUNT;
- }
- 
- 
--/* at this point, this code just plain won't work with 2.2 kernels.
-- * additionally, only ia64 & the 460GX need a nopage handler, and 2.2 doesn't
-- * work on ia64 anyways. It's expected that at some point other agp chipsets
-- * will work similar to the 460GX (AGP 3.0 spec), so pre-emptively make sure
-- * this works on our standard ia32 driver.
-- */
--#if !defined(KERNEL_2_2)
--
- /* AGP allocations under the 460GX are not mapped to the aperture
-  * addresses by the CPU.  This nopage handler will fault on CPU
-  * accesses to AGP memory and map the address to the correct page.
-  */
- struct page *nv_kern_vma_nopage(struct vm_area_struct *vma, unsigned long address, int write_access)
- {
-+#if defined(NVCPU_IA64) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 9))
-     nv_alloc_t *at, *tmp;
-     nv_linux_state_t *nvl;
-     nv_state_t *nv;
-     struct page *page_ptr;
-     int rm_status, index;
- 
--    at = VMA_PRIVATE(vma);
-+    at = NV_VMA_PRIVATE(vma);
-     if (at == NULL)
-     {
-         nv_printf(NV_DBG_ERRORS, "NVRM: nopage handler called without an at: "
-@@ -1052,7 +1022,7 @@
-         // far again
-         nv_printf(NV_DBG_ERRORS, "NVRM: nopage handler called on a freed"
-                   "address: vm_start 0x%x, at 0x%x\n", vma->vm_start, at);
--        VMA_PRIVATE(vma) = NULL;
-+        NV_VMA_PRIVATE(vma) = NULL;
-         return NOPAGE_SIGBUS;
-     }
- 
-@@ -1073,15 +1043,14 @@
-     at->page_table[index] = (void *) ((page_ptr - mem_map) << PAGE_SHIFT);
- 
-     return page_ptr;
--}
- #endif
-+    return NOPAGE_SIGBUS;
-+}
- 
- struct vm_operations_struct nv_vm_ops = {
-     nv_kern_vma_open,
-     nv_kern_vma_release,  /* "close" */
--#if !defined(KERNEL_2_2)
-     nv_kern_vma_nopage,
--#endif
- };
- 
- static nv_file_private_t *
-@@ -1096,7 +1065,7 @@
-     memset(nvfp, 0, sizeof(nv_file_private_t));
- 
-     // initialize this file's event queue
--    INIT_EVENT_QUEUE(nvfp->wqueue);
-+    init_waitqueue_head(&nvfp->waitqueue);
- 
-     nv_init_lock(nvfp->fp_lock);
- 
-@@ -1116,7 +1085,6 @@
-     if (nvfp == NULL)
-         return;
- 
--    FREE_EVENT_QUEUE(nvfp->wqueue);
-     NV_VFREE(nvfp->event_fifo, sizeof(nv_event_t) * NV_EVENT_FIFO_SIZE);
-     NV_VFREE(nvfp, sizeof(nv_file_private_t));
- }
-@@ -1145,11 +1113,11 @@
- 
-     /* for control device, just jump to its open routine */
-     /* after setting up the private data */
--    if (NV_DEVICE_IS_CONTROL_DEVICE(inode->i_rdev))
-+    if (NV_IS_CONTROL_DEVICE(inode))
-         return nv_kern_ctl_open(inode, file);
- 
-     /* what device are we talking about? */
--    devnum = NV_DEVICE_NUMBER(inode->i_rdev);
-+    devnum = NV_DEVICE_NUMBER(inode);
-     if (devnum >= NV_MAX_DEVICES)
-     {
-         rc = -ENODEV;
-@@ -1202,12 +1170,14 @@
-             goto failed;
-         }
- 
-+        nvl->tasklet.func = (void *) rm_isr_bh;
-+        nvl->tasklet.data = (unsigned long) nv->pdev;
-+        tasklet_enable(&nvl->tasklet);
- 
-         nv->flags |= NV_FLAG_OPEN;
-     }
- 
-     nv->usage_count++;
--    MOD_INC_USE_COUNT;
- 
-  failed:
-     nv_unlock(nvl->ldata_lock);
-@@ -1238,38 +1208,32 @@
- 
-     /* for control device, just jump to its open routine */
-     /* after setting up the private data */
--    if (NV_DEVICE_IS_CONTROL_DEVICE(inode->i_rdev))
-+    if (NV_IS_CONTROL_DEVICE(inode))
-         return nv_kern_ctl_close(inode, file);
- 
--    nv_printf(NV_DBG_INFO, "nv_kern_close on device %d\n", NV_DEVICE_NUMBER(inode->i_rdev));
-+    nv_printf(NV_DBG_INFO, "nv_kern_close on device %d\n", NV_DEVICE_NUMBER(inode));
- 
-     rm_free_unused_clients(nv, current->pid, (void *) file);
- 
-     nv_lock(nvl->ldata_lock);
-     if (--nv->usage_count == 0)
-     {
--        int counter = 0;
--
--        /* turn off interrupts.
--        ** be careful to make sure any pending bottom half gets run
--        **  or disabled before calling rm_shutdown_adapter() since
--        **  it will free up the pdev.  This is hard to see on single
--        **  cpu systems, but easy on dual cpu :-)
--        */
-+        /*
-+         * The usage count for this device has dropped to zero, it can be shut
-+         * down safely; disable its interrupts.
-+         */
-         rm_disable_adapter(nv);
- 
--        /* give it a moment to allow any bottom half to run */
--
--#define MAX_BH_TASKS 10
--        while (NV_ATOMIC_READ(nvl->bh_count) && (counter < MAX_BH_TASKS))
--        {
--            current->state = TASK_INTERRUPTIBLE;
--            schedule_timeout(HZ/50);
--            counter++;
--        }
-+        /*
-+         * Disable this device's tasklet to make sure that no bottom half will
-+         * run with undefined device state.
-+         */
-+        tasklet_disable(&nvl->tasklet);
- 
--        /* free the irq, which may block until any pending interrupts */
--        /* are done being processed. */
-+        /*
-+         * Free the IRQ, which may block until all pending interrupt processing
-+         * has completed.
-+         */
-         free_irq(nv->interrupt_line, (void *) nv);
- 
-         rm_shutdown_adapter(nv);
-@@ -1300,8 +1264,6 @@
-         FILE_PRIVATE(file) = NULL;
-     }
- 
--    MOD_DEC_USE_COUNT;
--
-     return 0;
- }
- 
-@@ -1318,10 +1280,10 @@
-     nv_printf(NV_DBG_INFO, "mmap([0x%lx-0x%lx] off=0x%lx)\n",
-         vma->vm_start,
-         vma->vm_end,
--        LINUX_VMA_OFFS(vma));
-+        NV_VMA_OFFSET(vma));
- 
-     // be a bit paranoid for now
--    if ((NV_MASK_OFFSET(LINUX_VMA_OFFS(vma))) ||
-+    if ((NV_MASK_OFFSET(NV_VMA_OFFSET(vma))) ||
-         (NV_MASK_OFFSET(vma->vm_start)) ||
-         (NV_MASK_OFFSET(vma->vm_end)))
-     {
-@@ -1339,7 +1301,7 @@
- 
- 
-     /* NV reg space */
--    if (IS_REG_OFFSET(nv, LINUX_VMA_OFFS(vma), vma->vm_end - vma->vm_start))
-+    if (IS_REG_OFFSET(nv, NV_VMA_OFFSET(vma), vma->vm_end - vma->vm_start))
-     {
-         /* truncate to size of registers */
-         if (pages > nv->regs->size / PAGE_SIZE)
-@@ -1347,7 +1309,7 @@
- 
-         vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
-         if (NV_REMAP_PAGE_RANGE(vma->vm_start,
--                             LINUX_VMA_OFFS(vma),
-+                             NV_VMA_OFFSET(vma),
-                              vma->vm_end - vma->vm_start,
-                              vma->vm_page_prot))
-             return -EAGAIN;
-@@ -1357,7 +1319,7 @@
-     }
- 
-     /* NV fb space */
--    else if (IS_FB_OFFSET(nv, LINUX_VMA_OFFS(vma), vma->vm_end - vma->vm_start))
-+    else if (IS_FB_OFFSET(nv, NV_VMA_OFFSET(vma), vma->vm_end - vma->vm_start))
-     {
- 
-         /* truncate to size of framebuffer */
-@@ -1366,7 +1328,7 @@
- 
-         vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
-         if (NV_REMAP_PAGE_RANGE(vma->vm_start,
--                             LINUX_VMA_OFFS(vma),
-+                             NV_VMA_OFFSET(vma),
-                              vma->vm_end - vma->vm_start,
-                              vma->vm_page_prot))
-             return -EAGAIN;
-@@ -1376,10 +1338,10 @@
-     }
- 
-     /* AGP allocator */
--    else if (IS_AGP_OFFSET(nv, LINUX_VMA_OFFS(vma), vma->vm_end - vma->vm_start))
-+    else if (IS_AGP_OFFSET(nv, NV_VMA_OFFSET(vma), vma->vm_end - vma->vm_start))
-     {
-         nv_lock(nvl->at_lock);
--        at = nvl_find_alloc(nvl, LINUX_VMA_OFFS(vma), NV_ALLOC_TYPE_AGP);
-+        at = nvl_find_alloc(nvl, NV_VMA_OFFSET(vma), NV_ALLOC_TYPE_AGP);
- 
-         if (at == NULL)
-         {
-@@ -1397,7 +1359,7 @@
-         }
- 
-         at->vma = vma;
--        VMA_PRIVATE(vma) = at;
-+        NV_VMA_PRIVATE(vma) = at;
-         at->usage_count++;
- 
-         if (NV_OSAGP_ENABLED(nv))
-@@ -1420,13 +1382,13 @@
-     }
- 
-     /* Magic allocator */
--    else // if (LINUX_VMA_OFFS(vma) == NV_MMAP_ALLOCATION_OFFSET)
-+    else // if (NV_VMA_OFFSET(vma) == NV_MMAP_ALLOCATION_OFFSET)
-     {
-         unsigned long page = 0, pos, start;
-         int i = 0;
- 
-         nv_lock(nvl->at_lock);
--        at = nvl_find_alloc(nvl, LINUX_VMA_OFFS(vma), NV_ALLOC_TYPE_PCI);
-+        at = nvl_find_alloc(nvl, NV_VMA_OFFSET(vma), NV_ALLOC_TYPE_PCI);
- 
-         if (at == NULL)
-         {
-@@ -1444,7 +1406,7 @@
-         }
- 
-         at->vma = vma;
--        VMA_PRIVATE(vma) = at;
-+        NV_VMA_PRIVATE(vma) = at;
-         at->usage_count++;
- 
-         nv_printf(NV_DBG_INFO, "remapping %d system pages for at 0x%x\n", pages, at);
-@@ -1466,9 +1428,6 @@
- 
-     vma->vm_file = file;
- 
--    /* just increment usage count, rather than calling vma_open */
--    MOD_INC_USE_COUNT;
--
-     return 0;
- }
- 
-@@ -1494,7 +1453,7 @@
-     {
-         nv_printf(NV_DBG_EVENTINFO, "calling poll_wait\n");
-         // add us to the list
--        poll_wait(file, EVENT_QUEUE(nvfp->wqueue), wait);
-+        poll_wait(file, &nvfp->waitqueue, wait);
-     }
- 
-     nv_lock(nvfp->fp_lock);
-@@ -1562,12 +1521,13 @@
- 
-     switch (_IOC_NR(cmd))
-     {
-+#if !defined(KERNEL_2_6)
-         /* debug tool; zap the module use count so we can unload driver */
-         /*             even if it is confused */
-         case NV_ESC_MODULE_RESET:
-             atomic_set(&__this_module.uc.usecount, 1);
-             break;
--
-+#endif
-         /* pass out info about the card */
-         case NV_ESC_CARD_INFO:
-         {
-@@ -1694,7 +1654,7 @@
-  * driver receives an interrupt
-  *    if someone waiting, then hand it off.
-  */
--void nv_kern_isr(
-+irqreturn_t nv_kern_isr(
-     int   irq,
-     void *arg,
-     struct pt_regs *regs
-@@ -1708,9 +1668,10 @@
-     if (need_to_run_bottom_half)
-     {
-         NV_ATOMIC_INC(nvl->bh_count);
--        queue_task(nvl->bh, &tq_immediate);
--        mark_bh(IMMEDIATE_BH);
-+        tasklet_schedule(&nvl->tasklet);
-     }
-+
-+    return IRQ_HANDLED;
- }
- 
- void nv_kern_bh(
-@@ -1828,11 +1789,9 @@
- 
-     if (nv->usage_count == 0)
-     {
--        INIT_EVENT_QUEUE(nv_ctl_wqueue);
-+        init_waitqueue_head(&nv_ctl_waitqueue);
-     }
- 
--    MOD_INC_USE_COUNT;
--
-     nv->flags |= NV_FLAG_OPEN + NV_FLAG_CONTROL;
- 
-     /* turn off the hotkey occurred bit */
-@@ -1860,10 +1819,8 @@
- 
-     nv_lock(nvl->ldata_lock);
-     if (--nv->usage_count == 0)
--    {
--        FREE_EVENT_QUEUE(nv_ctl_wqueue);
-         nv->flags = 0;
--    }
-+
-     nv_unlock(nvl->ldata_lock);
- 
-     rm_free_unused_clients(nv, current->pid, (void *) file);
-@@ -1874,8 +1831,6 @@
-         FILE_PRIVATE(file) = NULL;
-     }
- 
--    MOD_DEC_USE_COUNT;
--
-     return 0;
- }
- 
-@@ -1899,7 +1854,7 @@
-     nv = NV_STATE_PTR(nvl);
- 
-     if ( !(file->f_flags & O_NONBLOCK) )
--        poll_wait(file, EVENT_QUEUE(nv_ctl_wqueue), wait);
-+        poll_wait(file, &nv_ctl_waitqueue, wait);
- 
-     nv_lock(nvl->ldata_lock);
- 
-@@ -1930,7 +1885,7 @@
-     nv_ctl_device.nv_state.flags |= NV_FLAG_HOTKEY_OCCURRED;
-     nv_unlock(nv_ctl_device.ldata_lock);
- 
--    wake_up_interruptible(EVENT_QUEUE(nv_ctl_wqueue));
-+    wake_up_interruptible(&nv_ctl_waitqueue);
- }
- 
- int nv_kern_read_cardinfo(char *page, char **start, off_t off,
-@@ -2009,7 +1964,7 @@
-         len += sprintf(page+len, "Host Bridge: \t ");
- 
- #if defined(CONFIG_PCI_NAMES)
--        len += sprintf(page+len, "%s\n", dev->name);
-+        len += sprintf(page+len, "%s\n", NV_PCI_DEVICE_NAME(dev));
- #else
-         len += sprintf(page+len, "PCI device %04x:%04x\n",
-                 dev->vendor, dev->device);
-@@ -2137,18 +2092,21 @@
-             {
-                 unsigned long retaddr = (unsigned long) at->page_table[i];
- 
--                if (retaddr <= MAXMEM)
--                {
--                    return __va((retaddr + offset));
--                }
--   
--                // if we've allocated via vmalloc on a highmem system, the 
--                // physical address may not be accessible via PAGE_OFFSET, 
--                // that's ok, we have a simple linear pointer already.
-+                /*
-+                 * XXX This routine should be more straight-forward; as it
-+                 * is, it returns a pointer into the kernel linear mapping if
-+                 * the incoming address belongs to a vmalloc() allocation or
-+                 * the kernel logical mapping of the corresponding page if it
-+                 * was allocated with alloc_pages(); third case below.
-+                 */ 
-                 if (at->flags & NV_ALLOC_TYPE_VMALLOC)
-                 {
-                     return (void *)((unsigned char *) at->key_mapping + (i << PAGE_SHIFT) + offset);
-                 }
-+                else if (!(at->flags & NV_ALLOC_TYPE_CONTIG))
-+                {
-+                    return __va((retaddr + offset));
-+                }
- 
-                 // ?? this may be a contiguous allocation, fall through
-                 // to below? or should I just check at->flag here?
-@@ -2218,9 +2176,9 @@
- unsigned long
- nv_get_phys_address(unsigned long address)
- {
--    pgd_t *pg_dir;
--    pmd_t *pg_mid_dir;
--    pte_t pte;
-+    pgd_t *pgd;
-+    pmd_t *pmd;
-+    pte_t *pte;
- 
- #if defined(NVCPU_IA64)
-     if (address > __IA64_UNCACHED_OFFSET)
-@@ -2233,23 +2191,24 @@
-         return __pa(address);
- 
-     if (address > VMALLOC_START)
--       pg_dir = pgd_offset_k(address);
-+       pgd = pgd_offset_k(address);
-     else
--       pg_dir = pgd_offset(current->mm, address);
-+       pgd = pgd_offset(current->mm, address);
- 
--    if (pgd_none(*pg_dir))
-+    if (!pgd || pgd_none(*pgd))
-         goto failed;
- 
--    pg_mid_dir = pmd_offset(pg_dir, address);
--    if (pmd_none(*pg_mid_dir))
-+    NV_PMD_OFFSET(address, pgd, pmd);
-+
-+    if (!NV_PMD_PRESENT(pmd))
-         goto failed;
- 
--    NV_PTE_OFFSET(address, pg_mid_dir, pte);
-+    NV_PTE_OFFSET(address, pmd, pte);
- 
--    if (!pte_present(pte))
-+    if (!NV_PTE_PRESENT(pte))
-         goto failed;
- 
--    return ((pte_val(pte) & KERN_PAGE_MASK) | NV_MASK_OFFSET(address));
-+    return (NV_PTE_VALUE(pte) & KERN_PAGE_MASK) | NV_MASK_OFFSET(address);
- 
-   failed:
-     return (unsigned long) NULL;
-@@ -2610,8 +2569,7 @@
-         nvfp->put = 0;
- 
-     nv_unlock(nvfp->fp_lock);
--
--    wake_up_interruptible(EVENT_QUEUE(nvfp->wqueue));
-+    wake_up_interruptible(&nvfp->waitqueue);
- }
- 
- int nv_get_event(
-@@ -2696,12 +2654,8 @@
-     if ( (NV_AGP_DISABLED(nv)) && (config & NVOS_AGP_CONFIG_NVAGP) )
-     {
-         /* make sure the user does not have agpgart loaded */
--#if !defined (KERNEL_2_2)
-         if (inter_module_get("drm_agp")) {
-             inter_module_put("drm_agp");
--#else
--        if (GET_MODULE_SYMBOL(0, __MODULE_STRING(agp_enable))) {
--#endif
-             nv_printf(NV_DBG_WARNINGS, "NVRM: not using NVAGP, AGPGART is loaded!!\n");
-         } else
-             status = rm_init_agp(nv);
-diff -ruN NVIDIA_kernel-1.0-4496/os-agp.c NVIDIA_kernel-1.0-4496-2.6/os-agp.c
---- NVIDIA_kernel-1.0-4496/os-agp.c    2003-07-17 04:56:13.000000000 +0200
-+++ NVIDIA_kernel-1.0-4496-2.6/os-agp.c        2003-07-29 00:02:15.000000000 +0200
-@@ -45,44 +45,9 @@
-     int  ready;
- } agp_gart;
- 
--typedef struct {
--    int           (*backend_acquire)(void);
--    void          (*backend_release)(void);
--    void          (*copy_info)(agp_kern_info *);
--    agp_memory *  (*allocate_memory)(size_t, unsigned int);
--    void          (*free_memory)(agp_memory *);
--    int           (*bind_memory)(agp_memory *, off_t);
--    int           (*unbind_memory)(agp_memory *);
--    void          (*enable)(unsigned int);
--} agp_operations_struct;
--
--agp_operations_struct agp_ops;
- agp_kern_info         agpinfo;
- agp_gart              gart;
--#if !defined (KERNEL_2_2)
- const drm_agp_t       *drm_agp_p;
--#endif
--
--#if defined (KERNEL_2_2)
--    #define GET_AGPGART_SYMBOL(sym, sym_string)                     \
--        sym = (void*) GET_MODULE_SYMBOL(0, sym_string);             \
--        if (sym == NULL)                                            \
--        {                                                           \
--            nv_printf(NV_DBG_ERRORS,                                \
--                "NVRM: AGPGART: unable to retrieve symbol %s\n",    \
--                sym_string);                                        \
--            return 1;                                               \
--        }
--
--    #define AGP_BACKEND_ACQUIRE_SYM   __MODULE_STRING(agp_backend_acquire)
--    #define AGP_BACKEND_RELEASE_SYM   __MODULE_STRING(agp_backend_release)
--    #define AGP_COPY_INFO_SYM         __MODULE_STRING(agp_copy_info)
--    #define AGP_ALLOCATE_MEMORY_SYM   __MODULE_STRING(agp_allocate_memory)
--    #define AGP_FREE_MEMORY_SYM       __MODULE_STRING(agp_free_memory)
--    #define AGP_BIND_MEMORY_SYM       __MODULE_STRING(agp_bind_memory)
--    #define AGP_UNBIND_MEMORY_SYM     __MODULE_STRING(agp_unbind_memory)
--    #define AGP_ENABLE_SYM            __MODULE_STRING(agp_enable)
--#endif
- 
- #if defined(CONFIG_MTRR)
- #define MTRR_DEL(gart) if ((gart).mtrr > 0) mtrr_del((gart).mtrr, 0, 0);
-@@ -105,13 +70,17 @@
-     U032  agp_rate;
-     U032  agp_sba;
-     U032  agp_fw;
--    char* chipset;
-     VOID *bitmap;
-     U032 bitmap_size;
- 
-     memset( (void *) &gart, 0, sizeof(agp_gart));
- 
--#if !defined (KERNEL_2_2)
-+    /*
-+     * XXX The inter_module_* mechanism has been deprecated and replaced with
-+     * a different mechanism in Linux 2.5; it will go away eventually.
-+     * Also, the Linux 2.5 AGP GART driver is modularized, agpgart.o does not
-+     * include backend drivers.
-+     */
-     if (!(drm_agp_p = inter_module_get_request("drm_agp", "agpgart")))
-     {
-         nv_printf(NV_DBG_ERRORS,
-@@ -119,48 +88,13 @@
-         return 1;
-     }
-     
--    agp_ops.backend_acquire = drm_agp_p->acquire;
--    agp_ops.backend_release = drm_agp_p->release;
--    agp_ops.allocate_memory = drm_agp_p->allocate_memory;
--    agp_ops.free_memory     = drm_agp_p->free_memory;
--    agp_ops.bind_memory     = drm_agp_p->bind_memory;
--    agp_ops.unbind_memory   = drm_agp_p->unbind_memory;
--    agp_ops.enable          = drm_agp_p->enable;
--
--    // looks like some newer kernels (for example mandrake 9.0's 2.4.19-16mdk)
--    // have updated copy_info to return an integer value, and of course didn't
--    // bother bumping the agpgart revision up. The return value is pretty 
--    // harmless (backend_acquire would have already failed and caused us to
--    // bail), so cast the function pointer to avoid compiler warnings.
--    // we may need to revisit this in the future.
--    agp_ops.copy_info       = (void (*)(agp_kern_info *)) drm_agp_p->copy_info;
--
--#else
--#if defined(CONFIG_KMOD)
--    if ( request_module("agpgart") )
--    {
--        nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: not loading agpgart.o\n");
--        return 1;
--    }
--#endif
--
--    GET_AGPGART_SYMBOL(agp_ops.backend_acquire, AGP_BACKEND_ACQUIRE_SYM);
--    GET_AGPGART_SYMBOL(agp_ops.backend_release, AGP_BACKEND_RELEASE_SYM);
--    GET_AGPGART_SYMBOL(agp_ops.copy_info,       AGP_COPY_INFO_SYM);
--    GET_AGPGART_SYMBOL(agp_ops.allocate_memory, AGP_ALLOCATE_MEMORY_SYM);
--    GET_AGPGART_SYMBOL(agp_ops.free_memory,     AGP_FREE_MEMORY_SYM);
--    GET_AGPGART_SYMBOL(agp_ops.bind_memory,     AGP_BIND_MEMORY_SYM);
--    GET_AGPGART_SYMBOL(agp_ops.unbind_memory,   AGP_UNBIND_MEMORY_SYM);
--    GET_AGPGART_SYMBOL(agp_ops.enable,          AGP_ENABLE_SYM);
--#endif
--
-     /* NOTE: from here down, return an error code of '-1'
-      * that indicates that agpgart is loaded, but we failed to use it
-      * in some way. This is so we don't try to use nvagp and lock up
-      * the memory controller.
-      */
- 
--    if ( (*(agp_ops.backend_acquire))() )
-+    if (drm_agp_p->acquire())
-     {
-         nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: backend in use\n");
-         return -1;
-@@ -178,44 +112,21 @@
-         agp_fw = 1;
-     agp_fw &= 0x00000001;
-     
--    (*(agp_ops.copy_info))(&agpinfo);
--
--    switch ( agpinfo.chipset )
--    {
--        case INTEL_GENERIC:    chipset = "Intel";            break;
--        case INTEL_LX:         chipset = "Intel 440LX";      break;
--        case INTEL_BX:         chipset = "Intel 440BX";      break;
--        case INTEL_GX:         chipset = "Intel 440GX";      break;
--        case INTEL_I810:       chipset = "Intel i810";       break;
--        case INTEL_I840:       chipset = "Intel i840";       break;
--#if !defined (KERNEL_2_2)
--        case INTEL_I815:       chipset = "Intel i815";       break;
--#if !defined(__rh_config_h__)
--        case INTEL_I850:       chipset = "Intel i850";       break;
--#endif
--#endif
--#if defined(NVCPU_IA64)
--        case INTEL_460GX:      chipset = "Intel 460GX";      break;
--#endif
--        case VIA_GENERIC:      chipset = "VIA";              break;
--        case VIA_VP3:          chipset = "VIA VP3";          break;
--        case VIA_MVP3:         chipset = "VIA MVP3";         break;
--        case VIA_MVP4:         chipset = "VIA MVP4";         break;
--#if !defined (KERNEL_2_2)
--        case VIA_APOLLO_KX133: chipset = "VIA Apollo KX133"; break;
--        case VIA_APOLLO_KT133: chipset = "VIA Apollo KT133"; break;
--#endif
--        case VIA_APOLLO_PRO:   chipset = "VIA Apollo Pro";   break;
--        case SIS_GENERIC:      chipset = "SiS";              break;
--        case AMD_GENERIC:      chipset = "AMD";              break;
--        case AMD_IRONGATE:     chipset = "AMD Irongate";     break;
--        case ALI_M1541:        chipset = "ALi M1541";        break;
--        case ALI_GENERIC:      chipset = "ALi";              break;
--        case NOT_SUPPORTED:    chipset = "unsupported";      break;
--        default:               chipset = "unknown";
-+#if defined(KERNEL_2_4)
-+    /*
-+     * The original Linux 2.4 AGP GART driver interface declared copy_info to
-+     * return nothing. This changed in Linux 2.5, which reports unsupported
-+     * chipsets via this function. If this Linux 2.4 kernels behaves the same
-+     * way, we have no way to know.
-+     */
-+    drm_agp_p->copy_info(&agpinfo);
-+#else
-+    if (drm_agp_p->copy_info(&agpinfo)) {
-+        drm_agp_p->release();
-+        inter_module_put("drm_agp");
-+        return -1;
-     }
--
--    nv_printf(NV_DBG_SETUP, "NVRM: AGPGART: %s chipset\n", chipset);
-+#endif
- 
- #ifdef CONFIG_MTRR
-     if ((gart.mtrr = mtrr_add(agpinfo.aper_base,
-@@ -229,7 +140,8 @@
-          */
-         nv_printf(NV_DBG_ERRORS, 
-             "NVRM: AGPGART: unable to set MTRR write-combining\n");
--        (*(agp_ops.backend_release))();
-+        drm_agp_p->release();
-+        inter_module_put("drm_agp");
-         return -1;
-     }
- #endif
-@@ -245,7 +157,8 @@
-     {
-         nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: unable to remap aperture\n");
-         MTRR_DEL(gart);
--        (*(agp_ops.backend_release))();
-+        drm_agp_p->release();
-+        inter_module_put("drm_agp");
-         return -1;
-     }
- 
-@@ -256,7 +169,8 @@
-         nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: unable to allocate bitmap\n");
-         NV_IOUNMAP(gart.aperture, RM_PAGE_SIZE);
-         MTRR_DEL(gart);
--        (*(agp_ops.backend_release))();
-+        drm_agp_p->release();
-+        inter_module_put("drm_agp");
-         return -1;
-     }
- 
-@@ -267,39 +181,19 @@
-         os_free_mem(bitmap);
-         NV_IOUNMAP(gart.aperture, RM_PAGE_SIZE);
-         MTRR_DEL(gart);
--        (*(agp_ops.backend_release))();
-+        drm_agp_p->release();
-+        inter_module_put("drm_agp");
-         return -1;
-     }
- 
--    nv_printf(NV_DBG_SETUP,
--        "NVRM: AGPGART: aperture: %ldM @ 0x%08lx\n",
--        (unsigned long)agpinfo.aper_size,
--        (unsigned long)agpinfo.aper_base);
--
--    nv_printf(NV_DBG_SETUP, 
--        "NVRM: AGPGART: aperture mapped from 0x%08lx to 0x%08lx\n",
--        agpinfo.aper_base,
--        (unsigned long) gart.aperture);
--
-     if (!agp_sba) agpinfo.mode &= ~0x00000200;
-     if (!agp_fw)  agpinfo.mode &= ~0x00000010;
- 
-     if (!(agp_rate & 0x00000004)) agpinfo.mode &= ~0x00000004;
-     if (!(agp_rate & 0x00000002)) agpinfo.mode &= ~0x00000002;
-     
--    (*(agp_ops.enable))(agpinfo.mode);
-+    drm_agp_p->enable(agpinfo.mode);
-     
--    if (agpinfo.mode & 0x00000200)
--        nv_printf(NV_DBG_SETUP, "NVRM: AGPGART: backend supports sba\n");
--    if (agpinfo.mode & 0x00000010)
--        nv_printf(NV_DBG_SETUP, "NVRM: AGPGART: backend supports fw\n");
--    if (agpinfo.mode & 0x00000004)
--        nv_printf(NV_DBG_SETUP, "NVRM: AGPGART: mode 4x\n");
--    else if (agpinfo.mode & 0x00000002)
--        nv_printf(NV_DBG_SETUP, "NVRM: AGPGART: mode 2x\n");
--    else if (agpinfo.mode & 0x00000001)
--        nv_printf(NV_DBG_SETUP, "NVRM: AGPGART: mode 1x\n");
--
-     *ap_phys_base   = (void*) agpinfo.aper_base;
-     *ap_mapped_base = (void*) gart.aperture;
-     *apsize         = (agpinfo.aper_size * 0x100000) - 1;
-@@ -333,11 +227,13 @@
-         NV_IOUNMAP(gart.aperture, RM_PAGE_SIZE);
-     }
- 
--    (*(agp_ops.backend_release))();
-+    drm_agp_p->release();
- 
--#if !defined (KERNEL_2_2)
-+    /*
-+     * XXX Same as above; the inter_module_* mechanism will go away at some
-+     * point, it has been deprecated in Linux 2.5.
-+     */
-     inter_module_put("drm_agp");
--#endif
- 
-     if (rm_clear_agp_bitmap(nv, &bitmap))
-     {
-@@ -384,7 +280,7 @@
-         return RM_ERROR;
-     }
- 
--    ptr = (*agp_ops.allocate_memory)(PageCount, AGP_NORMAL_MEMORY);
-+    ptr = drm_agp_p->allocate_memory(PageCount, AGP_NORMAL_MEMORY);
-     if (ptr == NULL)
-     {
-         *pAddress = (void*) 0;
-@@ -392,7 +288,7 @@
-         return RM_ERR_NO_FREE_MEM;
-     }
-     
--    err = (*(agp_ops.bind_memory))(ptr, *Offset);
-+    err = drm_agp_p->bind_memory(ptr, *Offset);
-     if (err)
-     {
-         // this happens a lot when the aperture itself fills up..
-@@ -409,7 +305,7 @@
-     if (status != RM_OK)
-     {
-         nv_printf(NV_DBG_ERRORS, "NVRM: memory allocation failed\n");
--        (*(agp_ops.unbind_memory))(ptr);
-+        drm_agp_p->unbind_memory(ptr);
-         goto fail;
-     }
- 
-@@ -424,7 +320,7 @@
-     return RM_OK;
- 
- fail:
--    (*(agp_ops.free_memory))(ptr);
-+    drm_agp_p->free_memory(ptr);
-     *pAddress = (void*) 0;
- 
-     return RM_ERROR;
-@@ -463,7 +359,7 @@
-     {
-         nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: unable to remap %lu pages\n",
-             (unsigned long)agp_data->num_pages);
--        (*(agp_ops.unbind_memory))(agp_data->ptr);
-+        drm_agp_p->unbind_memory(agp_data->ptr);
-         goto fail;
-     }
-     
-@@ -481,9 +377,6 @@
- #endif /* AGPGART */
- }
- 
--
--#if !defined(KERNEL_2_2)
--
- RM_STATUS 
- KernMapAGPNopage(
-     VOID *address,
-@@ -530,9 +423,6 @@
- #endif
- }
- 
--#endif /* !defined(KERNEL_2_2) */
--
--
- RM_STATUS KernFreeAGPPages(
-     nv_state_t *nv,
-     VOID **pAddress,
-@@ -558,8 +448,8 @@
-     {
-         size_t pages = ptr->page_count;
- 
--        (*(agp_ops.unbind_memory))(ptr);
--        (*(agp_ops.free_memory))(ptr);
-+        drm_agp_p->unbind_memory(ptr);
-+        drm_agp_p->free_memory(ptr);
- 
-         nv_printf(NV_DBG_INFO, "NVRM: AGPGART: freed %ld pages\n",
-             (unsigned long)pages);
-diff -ruN NVIDIA_kernel-1.0-4496/os-interface.c NVIDIA_kernel-1.0-4496-2.6/os-interface.c
---- NVIDIA_kernel-1.0-4496/os-interface.c      2003-07-17 04:56:13.000000000 +0200
-+++ NVIDIA_kernel-1.0-4496-2.6/os-interface.c  2003-07-29 00:02:15.000000000 +0200
-@@ -56,7 +56,7 @@
-     PHWINFO pDev
- )
- {
--    return suser();
-+    return NV_IS_SUSER();
- }
- 
- U032 os_get_page_size(VOID)
-@@ -211,6 +211,11 @@
- {
-     NV_MEM_TRACKING_PAD_SIZE(size);
- 
-+    /*
-+     * XXX This needs to be !NV_MAY_SLEEP() rather than in_interrupt(); that
-+     * requires quite a bit of locking to be rearranged, however, which is why
-+     * I'll leave it alone for now.
-+     */
-     if (in_interrupt()) {
-         if (size <= KMALLOC_LIMIT) {
-             /*
-@@ -296,7 +301,7 @@
-     *address = (void *) va;
- 
-     for (i = 0; i < count; i++) {
--        mem_map_reserve(GET_MAP_NR(__pa((va))));
-+        SetPageReserved(virt_to_page(va));
-         va += PAGE_SIZE;
-     }
- 
-@@ -320,7 +325,7 @@
-     unsigned long va = (unsigned long) address;
- 
-     for (i = 0; i < count; i++) {
--        mem_map_unreserve(GET_MAP_NR(__pa((va))));
-+        ClearPageReserved(virt_to_page(va));
-         va += PAGE_SIZE;
-     }
- 
-@@ -426,7 +431,7 @@
-     if (in_irq() && MilliSeconds > NV_MAX_ISR_MDELAY)
-         return RM_ERROR;
- 
--    if (in_interrupt()) 
-+    if (!NV_MAY_SLEEP()) 
-     {
-         mdelay(MilliSeconds);
-         return RM_OK;
-@@ -524,8 +529,8 @@
- // The current debug display level (default to maximum debug level)
- int cur_debuglevel = 0xaaaaaaaa;
- 
--MODULE_PARM(silence_nvidia_output, "1i");
- static int silence_nvidia_output = 0;
-+NV_MODULE_PARAMETER(silence_nvidia_output);
- 
- 
- //
-@@ -708,14 +713,14 @@
- 
- ULONG os_cli(ULONG flags)
- {
--    save_flags(flags);
--    cli();
-+    NV_SAVE_FLAGS(flags);
-+    NV_CLI();
-     return flags;
- }
- 
- ULONG os_sti(ULONG flags)
- {
--    restore_flags(flags);
-+    NV_RESTORE_FLAGS(flags);
-     return flags;
- }
- 
-@@ -848,16 +853,6 @@
-         NV_IOREMAP_NOCACHE(vaddr, start, size_bytes);
-     }
- 
--#if defined (KERNEL_2_2)
--    if ((vaddr == NULL)) // && (mode == NV_MEMORY_DEFAULT))
--    {
--        unsigned long map_nr = MAP_NR(__va(start));
--        if (map_nr < max_mapnr) {
--            vaddr = __va(start);
--        }
--    }
--#endif
--
- #ifdef DEBUG
-     if (mode == NV_MEMORY_WRITECOMBINED) {
-         nv_printf(NV_DBG_ERRORS, 
-@@ -878,16 +873,7 @@
-     U032 size_bytes
- )
- {
--#if defined (KERNEL_2_2)
--    if (MAP_NR(addr) < max_mapnr) {
--        // if we didn't want the memory cached, this isn't necessary
--        // but we shouldn't be in a timing critical piece of code.
--        asm volatile("wbinvd":::"memory");
--    } else 
--#endif
--    {
--        NV_IOUNMAP(addr, size_bytes);
--    }
-+    NV_IOUNMAP(addr, size_bytes);
- }
- 
- VOID* os_map_user_space(
-@@ -991,7 +977,7 @@
- 
- U032 os_get_cpu_count()
- {
--    return smp_num_cpus;
-+    return NV_SMP_NUM_CPUS;
- }
- 
- 
-@@ -1054,12 +1040,15 @@
-     if (sgi_funcs.add_barrier == NULL)
-     {
- #if defined(TESTING_SWAP)
--#if !defined (KERNEL_2_2)
-+        /*
-+         * XXX The inter_module_* mechanism has been deprecated in Linux 2.5, a
-+         * new mechanism is in place; this code will need to be updated at some
-+         * point.
-+         */
-         inter_module_register(ADD_BARRIER_FUNC,    THIS_MODULE, sgitest_add_barrier);
-         inter_module_register(REMOVE_BARRIER_FUNC, THIS_MODULE, sgitest_remove_barrier);
-         inter_module_register(SWAP_READY_FUNC,     THIS_MODULE, sgitest_swap_ready);
- #endif
--#endif
-         sgi_funcs.add_barrier = GET_MODULE_SYMBOL(0, ADD_BARRIER_FUNC);
-         sgi_funcs.remove_barrier = GET_MODULE_SYMBOL(0, REMOVE_BARRIER_FUNC);
-         sgi_funcs.swap_ready = GET_MODULE_SYMBOL(0, SWAP_READY_FUNC);
-diff -ruN NVIDIA_kernel-1.0-4496/os-registry.c NVIDIA_kernel-1.0-4496-2.6/os-registry.c
---- NVIDIA_kernel-1.0-4496/os-registry.c       2003-07-17 04:56:13.000000000 +0200
-+++ NVIDIA_kernel-1.0-4496-2.6/os-registry.c   2003-07-29 00:02:15.000000000 +0200
-@@ -48,24 +48,6 @@
-  *   This could be changed to work on a per-device basis.
-  */
- 
--/*
-- * The 2nd argument to MODULE_PARM is used to verify parameters passed
-- * to the module at load time. It should be a string in the following 
-- * format:
-- *
-- *    [min[-max]]{b,h,i,l,s}
-- *
-- * The MIN and MAX specifiers delimit the length of the array. If MAX
-- * is omitted, it defaults to MIN; if both are omitted, the default is
-- * 1. The final character is a type specifier.
-- *
-- *  b   byte
-- *  h   short
-- *  i   int
-- *  l   long
-- *  s   string
-- */
--
- /* 
-  * Option: VideoMemoryTypeOverride
-  * 
-@@ -92,7 +74,7 @@
-  */
- 
- static int NVreg_VideoMemoryTypeOverride = 1;
--MODULE_PARM(NVreg_VideoMemoryTypeOverride, "i");
-+NV_MODULE_PARAMETER(NVreg_VideoMemoryTypeOverride);
- 
- /*
-  * Option: EnableVia4x
-@@ -111,7 +93,7 @@
-  */
- 
- static int NVreg_EnableVia4x = 0;
--MODULE_PARM(NVreg_EnableVia4x, "i");
-+NV_MODULE_PARAMETER(NVreg_EnableVia4x);
- 
- /*
-  * Option: EnableALiAGP
-@@ -134,7 +116,7 @@
-  */
- 
- static int NVreg_EnableALiAGP = 0;
--MODULE_PARM(NVreg_EnableALiAGP, "i");
-+NV_MODULE_PARAMETER(NVreg_EnableALiAGP);
- 
- /* 
-  * Option: ReqAGPRate
-@@ -164,7 +146,7 @@
-  */
- 
- static int NVreg_ReqAGPRate = 7;
--MODULE_PARM(NVreg_ReqAGPRate, "i");
-+NV_MODULE_PARAMETER(NVreg_ReqAGPRate);
- 
- /* 
-  * Option: UpdateKernelAGP
-@@ -193,7 +175,7 @@
-  */
- 
- static int NVreg_UpdateKernelAGP = 1;
--MODULE_PARM(NVreg_UpdateKernelAGP, "i");
-+NV_MODULE_PARAMETER(NVreg_UpdateKernelAGP);
- 
- /* 
-  * Option: EnableAGPSBA
-@@ -226,7 +208,7 @@
- static int NVreg_EnableAGPSBA = 0;
- #endif
- 
--MODULE_PARM(NVreg_EnableAGPSBA, "i");
-+NV_MODULE_PARAMETER(NVreg_EnableAGPSBA);
- 
- /*
-  * Option: EnableAGPFW
-@@ -250,7 +232,7 @@
-  */
- 
- static int NVreg_EnableAGPFW = 0;
--MODULE_PARM(NVreg_EnableAGPFW, "i");
-+NV_MODULE_PARAMETER(NVreg_EnableAGPFW);
- 
- /*
-  * Option: SoftEDIDs
-@@ -269,7 +251,7 @@
-  */
- 
- static int NVreg_SoftEDIDs = 1;
--MODULE_PARM(NVreg_SoftEDIDs, "i");
-+NV_MODULE_PARAMETER(NVreg_SoftEDIDs);
- 
- /* 
-  * Option: Mobile
-@@ -293,14 +275,14 @@
-  */
- 
- static int NVreg_Mobile = ~0;
--MODULE_PARM(NVreg_Mobile, "i");
-+NV_MODULE_PARAMETER(NVreg_Mobile);
- 
- 
- static int NVreg_ResmanDebugLevel = ~0;
--MODULE_PARM(NVreg_ResmanDebugLevel, "i");
-+NV_MODULE_PARAMETER(NVreg_ResmanDebugLevel);
- 
- static int NVreg_FlatPanelMode = 0;
--MODULE_PARM(NVreg_FlatPanelMode, "i");
-+NV_MODULE_PARAMETER(NVreg_FlatPanelMode);
- 
- /*
-  * You can enable any of the registry options disabled by default by
diff --git a/media-video/nvidia-kernel/files/1.0.4496/NVIDIA_kernel-1.0-4496-2.6-pci_name-20030905.diff b/media-video/nvidia-kernel/files/1.0.4496/NVIDIA_kernel-1.0-4496-2.6-pci_name-20030905.diff
deleted file mode 100644 (file)
index c2fd733..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
---- nv/nv-linux.h.orig 2003-09-07 16:26:25.713736184 +0200
-+++ nv/nv-linux.h      2003-09-07 16:27:06.230576688 +0200
-@@ -355,7 +355,11 @@
- 
- #ifdef KERNEL_2_6
- # define NV_IS_SUSER()                  capable(CAP_SYS_ADMIN)
--# define NV_PCI_DEVICE_NAME(x)          ((x)->pretty_name)
-+# ifdef CONFIG_PCI_NAMES
-+#  define NV_PCI_DEVICE_NAME(x)        ((x)->pretty_name)
-+# else
-+#  define NV_PCI_DEVICE_NAME(x)        ""
-+# endif
- # define NV_CLI()                       local_irq_disable()
- # define NV_SAVE_FLAGS(x)               local_save_flags(x)
- # define NV_RESTORE_FLAGS(x)            local_irq_restore(x)
diff --git a/media-video/nvidia-kernel/files/1.0.4499/NVIDIA_kernel-1.0-4499-2.6-20031014.diff b/media-video/nvidia-kernel/files/1.0.4499/NVIDIA_kernel-1.0-4499-2.6-20031014.diff
deleted file mode 100644 (file)
index 7e4ca64..0000000
+++ /dev/null
@@ -1,2109 +0,0 @@
-diff -u NVIDIA_kernel-1.0-4499/Makefile NVIDIA_kernel-1.0-4499-2.6/Makefile
---- NVIDIA_kernel-1.0-4499/Makefile    2003-09-18 00:22:12.000000000 +0000
-+++ NVIDIA_kernel-1.0-4499-2.6/Makefile        2003-10-14 01:56:21.038952024 +0000
-@@ -1,14 +1,14 @@
- # This Makefile is automatically generated; do not edit
--#   Generated on 'anji' on Wed Sep 17 17:03:05 PDT 2003
-+#   Generated on 'builder3.nvidia.com' on Thu Jun 19 04:05:35 PDT 2003
- 
- LINUX_MODULE=nv-linux.o
--DEFINES=-D__KERNEL__ -DMODULE -D_LOOSE_KERNEL_NAMES -mcmodel=kernel -DNTRM -D_GNU_SOURCE -D_LOOSE_KERNEL_NAMES -D__KERNEL__ -DMODULE  -DNV_MAJOR_VERSION=1 -DNV_MINOR_VERSION=0 -DNV_PATCHLEVEL=4499    -DNV_UNIX  -DNV_LINUX  -DNV_INT64_OK  -DNV_64_BITS  -DNVCPU_X86_64 
-+DEFINES=-D__KERNEL__ -DMODULE -D_LOOSE_KERNEL_NAMES -DKBUILD_MODNAME="nvidia" -DNTRM -D_GNU_SOURCE -D_LOOSE_KERNEL_NAMES -D__KERNEL__ -DMODULE  -DNV_MAJOR_VERSION=1 -DNV_MINOR_VERSION=0 -DNV_PATCHLEVEL=4499     -DNV_UNIX   -DNV_LINUX   -DNV_INT64_OK   -DNVCPU_X86_64 -DNV_64_BITS -DREMAP_PAGE_RANGE_5 -DKBUILD_MODNAME=nvidia
- INCLUDES=-I.
- 
- OBJECTS=nv.o os-agp.o os-interface.o os-registry.o 
- HEADERS=os-agp.h os-interface.h nv-linux.h nv-misc.h nv-memdbg.h nv.h  rmretval.h nvtypes.h  $(VERSION_HDR)
- 
--CFLAGS=-Wall -Wimplicit -Wreturn-type -Wswitch -Wformat -Wchar-subscripts -Wparentheses -Wpointer-arith -Wcast-qual -Wno-multichar  -O -MD $(DEFINES) $(INCLUDES) -Wno-cast-qual
-+CFLAGS=-Wall -Wimplicit -Wreturn-type -Wswitch -Wformat -Wchar-subscripts -Wparentheses -Wno-cast-qual -Wno-multichar  -O2 -MD $(DEFINES) $(INCLUDES) -Wno-cast-qual -mcmodel=kernel -nostdinc -iwithprefix include -fno-strict-aliasing -fno-common -mno-red-zone -mcmodel=kernel -pipe -fno-reorder-blocks -Wno-sign-compare -fno-asynchronous-unwind-tables -fomit-frame-pointer -Wdeclaration-after-statement -Wno-trigraphs -Wno-strict-prototypes 
- 
- RESMAN_KERNEL_MODULE=nv-kernel.o
- 
-@@ -47,19 +47,13 @@
- 
- INSTALL=$(shell which install)
- 
--# determine gcc versions used (kernel, nvidia.o)
--module_cc:=$(shell $(CC) -v 2>&1 | tail -n 1)
--version="^Linux version [^(]* (.*@.*) (\(.*\)) .*"
--kernel_cc:=$(shell cat /proc/version | sed "s/"$(version)"/\1/")
--
--module_cc:=$(shell echo "$(module_cc)" | cut -d ' ' -f 3)
--kernel_cc:=$(shell echo "$(kernel_cc)" | cut -d ' ' -f 3)
--
- # allow specification of alternate include file tree on command line and extra defines
- ifdef SYSINCLUDE
- INCLUDES += -I$(SYSINCLUDE)
-+INCLUDES += -I$(SYSINCLUDE)/asm/mach-default
- else
- INCLUDES += -I$(KERNINC)
-+INCLUDES += -I$(KERNINC)/asm/mach-default
- endif
- 
- ifeq ($(shell sh conftest.sh remap_page_range $(INCLUDES)), 5)
-@@ -83,67 +77,63 @@
- 
- install: package-install
- 
--package-install: nvidia.o rmmod-check
--      @if [ `id -ur` != 0 ]; then \
--              echo Please run \"make install\" as root.; \
--      else \
--              if [ -d $(BROKENDIR) ]; then \
--                      rm -f $(BROKENDIR)/NVdriver; \
--                      rmdir --ignore-fail-on-non-empty $(BROKENDIR); \
--              fi && \
--              mkdir -p $(INSTALLDIR) && \
--              rm -f $(INSTALLDIR)/NVdriver && \
--              $(INSTALL) -m 0664 -o root -g root nvidia.o $(INSTALLDIR)/nvidia.o$(O) && \
--              PATH="$(PATH):/bin:/sbin" depmod -a && \
--                PATH="$(PATH):/bin:/sbin" modprobe nvidia && \
--              sh makedevices.sh && \
--              echo "nvidia.o installed successfully."; \
-+suser-sanity-check:
-+      @if ! sh conftest.sh suser_sanity_check; then \
-+        echo; \
-+        echo "You have insufficient privileges for this operation. Please "; \
-+        echo "run \"make install\" as root!                               "; \
-+        echo; \
-+        exit 1; \
-       fi
- 
--RMMOD_ERROR=\
--      echo ""; \
--      echo "Unable to remove existing NVIDIA kernel module."; \
--      echo "Please be sure you have exited X before attempting"; \
--      echo "to install the NVIDIA kernel module."; \
--      echo ""; \
--      echo -en "\033[1;31m"; \
--      echo -e  "*** Failed rmmod sanity check. Bailing out! ***"; \
--      echo -en "\033[0m"; \
--      exit 1;
--
--rmmod-check:
--      @if PATH="$(PATH):/bin:/sbin" lsmod | grep -w nvidia > /dev/null; then \
--              if ! PATH="($PATH):/bin:/sbin" rmmod nvidia > /dev/null; then $(RMMOD_ERROR) fi \
--      fi; \
--      if PATH="$(PATH):/bin:/sbin" lsmod | grep -w NVdriver > /dev/null; then \
--              if ! PATH="$(PATH):/bin:/sbin" rmmod NVdriver > /dev/null; then $(RMMOD_ERROR) fi \
-+rmmod-sanity-check:
-+      @if ! sh conftest.sh rmmod_sanity_check nvidia; then \
-+        echo; \
-+        echo "Unable to unload the currently loaded NVIDIA kernel module! "; \
-+        echo "Please be certain that you have exited X before attempting  "; \
-+        echo "to install this version.                                    "; \
-+        echo; \
-+        exit 1; \
-       fi
- 
--gcc-check:
--      @if [ -z $(IGNORE_CC_MISMATCH) ]; then \
--       if [ "$(kernel_cc)" != "$(module_cc)" ]; then \
--      echo "                                                           "; \
--      echo "You appear to be compiling the NVIDIA kernel module with   "; \
--      echo "a compiler different from the one that was used to compile "; \
--      echo "the running kernel. This may be perfectly fine, but there  "; \
--      echo "are cases where this can lead to unexpected behaviour and  "; \
--      echo "system crashes.                                            "; \
--      echo "                                                           "; \
--      echo "If you know what you are doing and want to override this   "; \
--      echo "check, you can do so by setting IGNORE_CC_MISMATCH.        "; \
--      echo "                                                           "; \
--      echo "In any other case, set the CC environment variable to the  "; \
--      echo "name of the compiler that was used to compile the kernel.  "; \
--      echo "                                                           "; \
--      echo -en "\033[1;31m"; \
--      echo -e  "*** Failed cc sanity check. Bailing out! ***"; \
--      echo -en "\033[0m"; \
--      exit 1; \
--       fi \
-+cc-sanity-check:
-+      @if ! sh conftest.sh cc_sanity_check $(CC); then \
-+        echo; \
-+        echo "You appear to be building the NVIDIA kernel module with a  "; \
-+        echo "compiler different from the one that was used to build the "; \
-+        echo "running kernel. This may be perfectly fine, but there are  "; \
-+        echo "cases where this can lead to unexpected behaviour and      "; \
-+        echo "system crashes.                                            "; \
-+        echo; \
-+        echo "If you know what you are doing and want to override this   "; \
-+        echo "check, you can do so by setting IGNORE_CC_MISMATCH.        "; \
-+        echo; \
-+        echo "In any other case, set the CC environment variable to the  "; \
-+        echo "name of the compiler that was used to build the kernel.    "; \
-+        echo; \
-+        exit 1; \
-       fi
- 
--nvidia.o: gcc-check $(LINUX_MODULE) $(RESMAN_KERNEL_MODULE) 
--      ld -r -o $@ $(LINUX_MODULE) $(RESMAN_KERNEL_MODULE)
-+package-install: suser-sanity-check nvidia.o rmmod-sanity-check
-+      if [ -d $(BROKENDIR) ]; then \
-+              rm -f $(BROKENDIR)/NVdriver; \
-+              rmdir --ignore-fail-on-non-empty $(BROKENDIR); \
-+      fi && \
-+      mkdir -p $(INSTALLDIR) && \
-+      rm -f $(INSTALLDIR)/NVdriver && \
-+      $(INSTALL) -m 0664 -o root -g root nvidia.ko $(INSTALLDIR)/nvidia.ko$(O) && \
-+      /sbin/depmod -a && \
-+      /sbin/modprobe nvidia && \
-+      sh makedevices.sh && \
-+      echo "nvidia.ko installed successfully."; \
-+
-+nvidia.o: cc-sanity-check $(LINUX_MODULE) $(RESMAN_KERNEL_MODULE) 
-+      ld -d -r -o $@ $(LINUX_MODULE) $(RESMAN_KERNEL_MODULE)
-+      if [ -x /usr/src/linux/scripts/modpost ]; then \
-+              /usr/src/linux/scripts/modpost $@; \
-+              $(CC) -c $(CFLAGS) nvidia.mod.c; \
-+              ld -m elf_x86_64 -r -o nvidia.ko $@ nvidia.mod.o; \
-+      fi
- 
- $(VERSION_HDR): 
-       echo \#define NV_COMPILER \"`$(CC) -v 2>&1 | tail -n 1`\" > $@
-@@ -163,7 +153,7 @@
- 
- 
- clean:
--      $(RM) $(OBJECTS) $(LINUX_MODULE) $(VERSION_HDR) *.d NVdriver nvidia.o
-+      $(RM) $(OBJECTS) $(LINUX_MODULE) $(VERSION_HDR) *.d NVdriver nvidia.o nvidia.ko nvidia.mod.c nvidia.mod.o
- 
- 
- -include $(OBJECTS:%.o=%.d)
-diff -u NVIDIA_kernel-1.0-4499/conftest.sh NVIDIA_kernel-1.0-4499-2.6/conftest.sh
---- NVIDIA_kernel-1.0-4499/conftest.sh 2003-09-18 00:22:11.000000000 +0000
-+++ NVIDIA_kernel-1.0-4499-2.6/conftest.sh     2003-10-12 01:03:01.000000000 +0000
-@@ -37,5 +37,79 @@
-           exit 1
-         fi
-     ;;
-+
-+    cc_sanity_check)
-+        shift
-+        #
-+        # Verify that the same compiler is used for the kernel and kernel
-+        # module.
-+        #
-+        if test -n "$IGNORE_CC_MISMATCH" -o -n "$KERNDIR"; then
-+          #
-+          # The user chose to disable the gcc sanity test or is building
-+          # the module for a kernel not currently running, which renders
-+          # our test meaningless.
-+          #
-+          exit 0
-+        fi
-+
-+        VERSION="^Linux version.* (.*) (\(gcc.*\)).*"
-+        KERNEL=$(cat /proc/version | sed "s/$VERSION/\1/")
-+        MODULE=$($* -v 2>&1 | tail -n 1)
-+
-+        if test "$KERNEL" != "$MODULE"; then
-+          #
-+          # The kernel seems to have been built with a different version
-+          # of the C compiler, which may be a problem.
-+          #
-+          exit 1
-+        else
-+          exit 0
-+        fi
-+    ;;
-+
-+    kernel_patch_level)
-+        shift
-+        #
-+        # Determine the kernel's major patch level; this is only done if we
-+        # aren't told by KBUILD.
-+        #
-+        echo $(cat "$1"/Makefile | grep "PATCHLEVEL =" | cut -d " " -f 3)
-+        exit 0
-+    ;;
-+
-+    suser_sanity_check)
-+        shift
-+        #
-+        # Determine the caller's user id to determine if we have sufficient
-+        # privileges for the requested operation.
-+        #
-+        if test $(id -ur) != 0; then
-+          exit 1
-+        else
-+          exit 0
-+        fi
-+    ;;
-+
-+    rmmod_sanity_check)
-+        shift
-+        #
-+        # Make sure that any currently loaded NVIDIA kernel module can be
-+        # unloaded.
-+        #
-+        if /sbin/lsmod | grep -q "$1"; then
-+          /sbin/rmmod "$1" >& /dev/null
-+        fi
-+
-+        if /sbin/lsmod | grep -q "$1"; then
-+          #
-+          # The NVIDIA kernel module is still loaded, most likely because
-+          # it is busy.
-+          #
-+          exit 1
-+        else
-+          exit 0
-+        fi
-+    ;;
- esac
- 
-diff -u NVIDIA_kernel-1.0-4499/makedevices.sh NVIDIA_kernel-1.0-4499-2.6/makedevices.sh
---- NVIDIA_kernel-1.0-4499/makedevices.sh      2003-09-18 00:22:11.000000000 +0000
-+++ NVIDIA_kernel-1.0-4499-2.6/makedevices.sh  2003-10-12 01:03:01.000000000 +0000
-@@ -8,39 +8,37 @@
- # create a temporary file
- tmp=`(mktemp -q /tmp/nvidia.XXXXXX) 2> /dev/null` || tmp="/tmp/nvidia.$$"
- 
--paths=" /etc/modutils/aliases    \
--        /etc/modules.conf        \
--        /etc/conf.modules        "
-+modconfs=" /etc/modutils/aliases    \
-+           /etc/modules.conf        \
-+           /etc/modprobe.d/aliases  \
-+           /etc/modprobe.conf       \
-+           /etc/conf.modules        "
- 
--modconf=""
--for path in $paths; do
--   if [ -f "$path" ]; then
--       modconf=$path
--       break
-+#
-+# Pass the -p option to cp to preserve the permissions of $modconf and
-+# /etc/rc.d/rc.modules across the update. Update all relevant files
-+# including those eventually regenerated to avoid the need for awkward
-+# logic here.
-+#
-+for modconf in $modconfs; do
-+   if [ -f "$modconf" ]; then
-+     cp -p $modconf $tmp
-+     sed '/^alias.*\(NVdriver\|nvidia\)/d'  < $modconf   > $tmp
-+     if [ -c /dev/.devfsd ]; then
-+       echo "alias /dev/nvidia* nvidia" >> $tmp
-+     else
-+       echo "alias char-major-195 nvidia" >> $tmp
-+     fi
-+     mv -f $tmp $modconf
-+     test -x /sbin/update-modules && /sbin/update-modules
-    fi
- done
- 
--if [ ! -z $modconf ]; then
--   # Initialize the permissions on $tmp so that we don't change the
--   # permissions of $modconf when we mv it into place
--   cp -p $modconf $tmp
--   sed '/^alias.*\(NVdriver\|nvidia\)/d'  < $modconf   > $tmp
--   if [ -c /dev/.devfsd ]; then
--     echo "alias /dev/nvidia*   nvidia" >> $tmp
--   else
--     echo "alias char-major-195 nvidia" >> $tmp
--   fi
--   mv -f $tmp $modconf
--   test -x /sbin/update-modules && /sbin/update-modules
--else
--  if [ -f /etc/rc.d/rc.modules ]; then
--    # Initialize the permissions on $tmp so that we don't change the
--    # permissions of /etc/rc.d/rc.modules when we mv it into place
--    cp -p /etc/rc.d/rc.modules $tmp
--    sed '/.*\(NVdriver\|nvidia\).*/d' < /etc/rc.d/rc.modules > $tmp
--    echo -e "\n/sbin/modprobe nvidia" >> $tmp
--    mv -f $tmp /etc/rc.d/rc.modules
--  fi
-+if [ -f /etc/rc.d/rc.modules ]; then
-+  cp -p /etc/rc.d/rc.modules $tmp
-+  sed '/.*\(NVdriver\|nvidia\).*/d' < /etc/rc.d/rc.modules > $tmp
-+  echo -e "\n/sbin/modprobe nvidia" >> $tmp
-+  mv -f $tmp /etc/rc.d/rc.modules
- fi
- 
- if [ ! -c /dev/.devfsd ]; then
-diff -u NVIDIA_kernel-1.0-4499/nv-linux.h NVIDIA_kernel-1.0-4499-2.6/nv-linux.h
---- NVIDIA_kernel-1.0-4499/nv-linux.h  2003-09-18 00:22:11.000000000 +0000
-+++ NVIDIA_kernel-1.0-4499-2.6/nv-linux.h      2003-10-12 01:03:01.000000000 +0000
-@@ -20,35 +20,22 @@
- #  define MODVERSIONS
- #endif
- 
--#if defined (MODVERSIONS)
--#include <linux/modversions.h>
--#endif
--
- #include <linux/kernel.h>
- #include <linux/module.h>
- #include <linux/version.h>
- 
--#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 2, 12)
--#  error This driver does not support 2.2.11 or earlier kernels!
--#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 3, 0)
--#  define KERNEL_2_2
--#  warning NVIDIA is considering dropping support for linux-2.2 
--#  warning kernels. While end users are free to maintain their 
--#  warning own patches, or stick with current drivers, our new 
--#  warning drivers will not work "out of the box." If you are 
--#  warning concerned about lack of support for 2.2 kernels, 
--#  warning please let us know at linux-bugs@nvidia.com; we would
--#  warning like to know how many users would be seriously 
--#  warning impacted by this decision.
-+#if   LINUX_VERSION_CODE < KERNEL_VERSION(2, 3, 0)
-+#  error This driver does not support 2.2.x kernels!
- #elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 0)
--#  error This driver does not support 2.3.x development kernels!
-+#  error This driver does not support 2.3.x kernels!
- #elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
- #  define KERNEL_2_4
- #elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
--#  error This driver does not support 2.5.x development kernels!
--#  define KERNEL_2_5
-+#  error This driver does not support 2.5.x kernels!
-+#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 7, 0)
-+#  define KERNEL_2_6
- #else
--#  error This driver does not support 2.6.x or newer kernels!
-+#  error This driver does not support development kernels!
- #endif
- 
- #if defined (__ia64)
-@@ -61,12 +48,15 @@
- #define __SMP__
- #endif
- 
-+#if defined (MODVERSIONS) && !defined (KERNEL_2_6)
-+#include <linux/modversions.h>
-+#endif
-+
- #include <linux/types.h>            /* pic_t, size_t, __u32, etc        */
- #include <linux/errno.h>            /* error codes                      */
- #include <linux/list.h>             /* circular linked list             */
- #include <linux/stddef.h>           /* NULL, offsetof                   */
- #include <linux/wait.h>             /* wait queues                      */
--#include <linux/tqueue.h>           /* struct tq_struct                 */
- 
- #include <linux/slab.h>             /* kmalloc, kfree, etc              */
- #include <linux/vmalloc.h>          /* vmalloc, vfree, etc              */
-@@ -74,9 +64,15 @@
- #include <linux/poll.h>             /* poll_wait                        */
- #include <linux/delay.h>            /* mdelay, udelay                   */
- 
-+#ifdef KERNEL_2_6
-+#include <linux/sched.h>            /* suser(), capable() replacement   */
-+#include <linux/moduleparam.h>      /* module_param()                   */
-+#include <linux/smp_lock.h>         /* kernel_locked                    */
-+#include <asm/kmap_types.h>         /* page table entry lookup          */
-+#endif
-+
- #include <linux/pci.h>              /* pci_find_class, etc              */
--#include <linux/wrapper.h>          /* mem_map_reserve                  */
--#include <linux/interrupt.h>        /* mark_bh, init_bh, remove_bh      */
-+#include <linux/interrupt.h>        /* tasklets, interrupt helpers      */
- #include <linux/timer.h>
- 
- #include <asm/system.h>             /* cli, sli, save_flags             */
-@@ -85,14 +81,9 @@
- #include <asm/page.h>               /* PAGE_OFFSET                      */
- #include <asm/pgtable.h>            /* pte bit definitions              */
- 
--#if !defined (KERNEL_2_2)
- #include <linux/spinlock.h>
- #include <asm/semaphore.h>
- #include <linux/highmem.h>
--#else
--#include <asm/spinlock.h>
--#include <asm/semaphore.h>
--#endif
- 
- #ifdef CONFIG_PROC_FS
- #include <linux/proc_fs.h>
-@@ -359,78 +350,172 @@
-         free_pages(ptr, order); \
-     }
- 
-+#define GET_MODULE_SYMBOL(mod,sym)      (const void *) inter_module_get(sym)
-+#define PUT_MODULE_SYMBOL(sym)          (inter_module_put((char *) sym))
- 
--#if !defined (KERNEL_2_2)
--#  define LINUX_VMA_OFFS(vma)           (((vma)->vm_pgoff) << PAGE_SHIFT)
--#  define GET_MODULE_SYMBOL(mod,sym)  (const void *) inter_module_get(sym)
--#  define PUT_MODULE_SYMBOL(sym)        inter_module_put((char *) sym)
--#  define GET_MAP_NR(phys_page)         virt_to_page(__va(phys_page))
--#  define MEM_MAP_READ_COUNT(map_nr)    (atomic_read(&(map_nr)->count))
--#  define MEM_MAP_INC_COUNT(map_nr)     (atomic_inc(&(map_nr)->count))
--#  define MEM_MAP_DEC_COUNT(map_nr)     (atomic_dec(&(map_nr)->count))
--#  define EVENT_QUEUE(ptr)               ((struct __wait_queue_head *)(ptr))
--#  define VMA_PRIVATE(vma)              ((vma)->vm_private_data)
--#  define INIT_EVENT_QUEUE(ptr) \
--     if (ptr == NULL) { \
--        NV_KMALLOC((ptr), sizeof(struct __wait_queue_head)); \
--        if (ptr) { \
--            memset((ptr), 0, sizeof(struct __wait_queue_head)); \
--            init_waitqueue_head((struct __wait_queue_head *)(ptr)); \
--        } \
--     }
--#  define FREE_EVENT_QUEUE(ptr)         NV_KFREE((ptr), sizeof(struct __wait_queue_head)); (ptr) = NULL;
--#else
--#  define in_irq()                      (local_irq_count[smp_processor_id()])
--#  define LINUX_VMA_OFFS(vma)           ((vma)->vm_offset)
--#  define GET_MODULE_SYMBOL(mod, sym)   (void*) get_module_symbol((mod), (sym))
--#  define PUT_MODULE_SYMBOL(sym)
--#  define GET_MAP_NR(phys_page)         MAP_NR(__va(phys_page))
--#  define MEM_MAP_READ_COUNT(map_nr)    (atomic_read(&mem_map[map_nr].count))
--#  define MEM_MAP_INC_COUNT(map_nr)     (atomic_inc(&mem_map[map_nr].count))
--#  define MEM_MAP_DEC_COUNT(map_nr)     (atomic_dec(&mem_map[map_nr].count))
--#  define EVENT_QUEUE(ptr)              ((struct wait_queue **) &(ptr))
--#  define VMA_PRIVATE(vma)              ((void*)((vma)->vm_pte))
--#  define INIT_EVENT_QUEUE(ptr)         if (ptr) { ((ptr) = NULL); }
--#  define FREE_EVENT_QUEUE(ptr)
-+#ifdef KERNEL_2_6
-+# define NV_IS_SUSER()                  capable(CAP_SYS_ADMIN)
-+# define NV_PCI_DEVICE_NAME(x)          ((x)->pretty_name)
-+# define NV_CLI()                       local_irq_disable()
-+# define NV_SAVE_FLAGS(x)               local_save_flags(x)
-+# define NV_RESTORE_FLAGS(x)            local_irq_restore(x)
-+# define NV_MAY_SLEEP()                 (!in_interrupt() && !in_atomic())
-+# define NV_SMP_NUM_CPUS                num_online_cpus()
-+# define NV_MODULE_PARAMETER(x)         module_param(x, int, 0)
-+#else
-+# define NV_IS_SUSER()                  suser()
-+# define NV_PCI_DEVICE_NAME(x)          ((x)->name)
-+# define NV_CLI()                       cli()
-+# define NV_SAVE_FLAGS(x)               save_flags(x)
-+# define NV_RESTORE_FLAGS(x)            restore_flags(x)
-+# define NV_MAY_SLEEP()                 (!in_interrupt())
-+# define NV_SMP_NUM_CPUS                smp_num_cpus
-+# define NV_MODULE_PARAMETER(x)         MODULE_PARM(x, "i")
-+#endif
-+
-+#define NV_DEVICE_NUMBER(x)             minor((x)->i_rdev)
-+#define NV_VMA_OFFSET(x)                (((x)->vm_pgoff) << PAGE_SHIFT)
-+#define NV_VMA_PRIVATE(x)               ((x)->vm_private_data)
-+#define NV_IS_CONTROL_DEVICE(x)         (minor((x)->i_rdev) == 255)
-+
-+#ifndef minor
-+/*
-+ * XXX Is this correct for all possible target kernels? We need this to
-+ * support older 2.4 and some 2.6 kernels.
-+ */
-+# define minor(x) MINOR(x)
- #endif
- 
-+#ifndef KERNEL_2_6
-+  typedef void irqreturn_t;
-+# define IRQ_NONE
-+# define IRQ_RETVAL(x)
-+# define IRQ_HANDLED
-+#else
-+#ifdef AGPGART
-+  typedef struct agp_kern_info agp_kern_info;
-+  typedef struct agp_memory agp_memory;
-+#endif
-+  typedef void* devfs_handle_t;
-+#endif
-+
-+#ifdef KERNEL_2_6
-+#define NV_DEVFS_REGISTER(_name, _minor)                            \
-+({                                                                  \
-+    devfs_handle_t __handle = NULL;                                 \
-+    devfs_mk_cdev(MKDEV(NV_MAJOR_DEVICE_NUMBER, _minor),            \
-+            S_IFCHR | S_IRUGO | S_IWUGO, _name);                    \
-+    __handle;                                                       \
-+})
-+
-+#define NV_DEVFS_REMOVE_DEVICE(i) devfs_remove("nvidia%d", i)
-+#define NV_DEVFS_REMOVE_CONTROL() devfs_remove("nvidiactl")
-+#else
-+#define NV_DEVFS_REGISTER(_name, _minor)                            \
-+({                                                                  \
-+    devfs_handle_t __handle =                                       \
-+        devfs_register(NULL, _name, DEVFS_FL_DEFAULT,               \
-+                NV_MAJOR_DEVICE_NUMBER, _minor,                     \
-+                S_IFCHR | S_IRUGO | S_IWUGO, &nv_fops, NULL);       \
-+    __handle;                                                       \
-+ })
-+
-+#define NV_DEVFS_REMOVE_DEVICE(i) devfs_unregister(nv_devfs_handles[i+1])
-+#define NV_DEVFS_REMOVE_CONTROL() devfs_unregister(nv_devfs_handles[0])
-+#endif
-+
-+/*
-+ * Linux 2.5 introduced the five argument version of remap_page_range, all
-+ * relevant releases to date use it. This version was backported to 2.4 by
-+ * RedHat without means to identify the change, hence this hack.
-+ */
-+#ifdef KERNEL_2_6
-+#define NV_REMAP_PAGE_RANGE(a, b...) remap_page_range(vma, a, ## b)
-+#else
- #if defined(REMAP_PAGE_RANGE_5)
--#define NV_REMAP_PAGE_RANGE(a, b...)    remap_page_range(vma, a, ## b)
-+#define NV_REMAP_PAGE_RANGE(a, b...) remap_page_range(vma, a, ## b)
- #elif defined(REMAP_PAGE_RANGE_4)
--#define NV_REMAP_PAGE_RANGE(a, b...)    remap_page_range(a, ## b)
-+#define NV_REMAP_PAGE_RANGE(a, b...) remap_page_range(a, ## b)
- #else
--#error "Couldn't determine number of arguments expected by remap_page_range!"
-+#warning "conftest.sh failed, assuming old Linux 2.4 remap_page_range(4)!"
-+
-+#define NV_REMAP_PAGE_RANGE(a, b...) remap_page_range(a, ## b)
- #endif
-+#endif /* KERNEL_2_6 */
- 
--#if defined(pte_offset_atomic)
--#define NV_PTE_OFFSET(addres, pg_mid_dir, pte) \
-+#if defined(pmd_offset_map)
-+#define NV_PMD_OFFSET(address, pgd, pmd) \
-     { \
--        pte_t *pte__ = pte_offset_atomic(pg_mid_dir, address); \
--        pte = *pte__; \
--        pte_kunmap(pte__); \
-+        pmd = pmd_offset_map(pgd, address); \
-+    }
-+#define NV_PMD_UNMAP(pmd) \
-+    { \
-+        pmd_unmap(pmd); \
-     }
--#elif defined(pte_offset)
--#define NV_PTE_OFFSET(addres, pg_mid_dir, pte) \
--    pte = *pte_offset(pg_mid_dir, address)
- #else
--#define NV_PTE_OFFSET(addres, pg_mid_dir, pte) \
-+#define NV_PMD_OFFSET(address, pgd, pmd) \
-     { \
--        pte_t *pte__ = pte_offset_map(pg_mid_dir, address); \
--        pte = *pte__; \
--        pte_unmap(pte__); \
-+        pmd = pmd_offset(pgd, address); \
-     }
-+#define NV_PMD_UNMAP(pmd)
- #endif
- 
--#define NV_PAGE_ALIGN(addr)             ( ((addr) + PAGE_SIZE - 1) / PAGE_SIZE)
--#define NV_MASK_OFFSET(addr)            ( (addr) & (PAGE_SIZE - 1) )
-+#define NV_PMD_PRESENT(pmd) \
-+    ({ \
-+        if (pmd) { \
-+            if (pmd_none(*pmd)) { \
-+                NV_PMD_UNMAP(pmd); pmd = NULL; \
-+            } \
-+        } pmd != NULL; \
-+    })
- 
--#ifndef MAXMEM  /* temporary define for 2.2 kernels */
--#define MAXMEM  (-PAGE_OFFSET - (64 * 1024 * 1024))
-+#if defined (pte_offset_atomic)
-+#define NV_PTE_OFFSET(address, pmd, pte) \
-+    { \
-+        pte = pte_offset_atomic(pmd, address); \
-+        NV_PMD_UNMAP(pmd); \
-+    }
-+#define NV_PTE_UNMAP(pte) \
-+    { \
-+        pte_kunmap(pte); \
-+    }
-+#elif defined (pte_offset)
-+#define NV_PTE_OFFSET(address, pmd, pte) \
-+    { \
-+        pte = pte_offset(pmd, address); \
-+        NV_PMD_UNMAP(pmd); \
-+    }
-+#define NV_PTE_UNMAP(pte)
-+#else
-+#define NV_PTE_OFFSET(address, pmd, pte) \
-+    { \
-+        pte = pte_offset_map(pmd, address); \
-+        NV_PMD_UNMAP(pmd); \
-+    }
-+#define NV_PTE_UNMAP(pte) \
-+    { \
-+        pte_unmap(pte); \
-+    }
- #endif
- 
--#ifndef NV01_ROOT
--#define NV01_ROOT 0x00000000
--#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_PAGE_ALIGN(addr)             ( ((addr) + PAGE_SIZE - 1) / PAGE_SIZE)
-+#define NV_MASK_OFFSET(addr)            ( (addr) & (PAGE_SIZE - 1) )
- 
- #if defined(NVCPU_IA64)
- #define NV_GFP_HW (GFP_KERNEL | __GFP_DMA)
-@@ -487,7 +572,7 @@
- static inline int NV_IRQL_IS_RAISED()
-     {
-         unsigned long int eflags;
--        __save_flags(eflags);
-+        NV_SAVE_FLAGS(eflags);
-         return !(eflags & NV_CPU_INTERRUPT_FLAGS_BIT);
-     }
-  
-@@ -545,9 +630,10 @@
- 
-     nv_alloc_t *alloc_queue;
- 
--    // bottom half interrupt handler info; per device
--    /* keep track of any pending bottom-halves */
--    struct tq_struct *bh;
-+     /* keep track of any pending bottom halfes */
-+     struct tasklet_struct tasklet;
-+
-+     /* active bottom half counter */
-     atomic_t bh_count;
- 
-     /* get a timer callback every second */
-@@ -583,7 +669,7 @@
-     U032 num_events;
-     U032 put, get;
-     spinlock_t fp_lock;
--    void *wqueue;               // wait_queue for polling
-+    wait_queue_head_t waitqueue;
-     nv_event_t *event_fifo;     // fifo for storing events
- } nv_file_private_t;
- 
-diff -u NVIDIA_kernel-1.0-4499/nv.c NVIDIA_kernel-1.0-4499-2.6/nv.c
---- NVIDIA_kernel-1.0-4499/nv.c        2003-09-18 00:22:11.000000000 +0000
-+++ NVIDIA_kernel-1.0-4499-2.6/nv.c    2003-10-12 01:03:01.000000000 +0000
-@@ -15,6 +15,7 @@
- #include "nv_compiler.h"
- #include "os-agp.h"
- 
-+MODULE_LICENSE("NVIDIA");
- 
- /*
-  * our global state; one per device
-@@ -33,32 +34,20 @@
-  */
- 
- nv_linux_state_t nv_ctl_device = { { 0 } };
--void *nv_ctl_wqueue = NULL;
-+wait_queue_head_t nv_ctl_waitqueue;
- 
- // keep track of opened clients and their process id so they
- //   can be free'd up on abnormal close
- nv_client_t       nv_clients[NV_MAX_CLIENTS];
--struct tq_struct  nv_bottom_halves[NV_MAX_CLIENTS];
- 
- #ifdef CONFIG_PROC_FS
- struct proc_dir_entry *proc_nvidia;
- #endif
- 
- #ifdef CONFIG_DEVFS_FS
--devfs_handle_t  nv_dev_handle[NV_MAX_DEVICES];
--devfs_handle_t  nv_ctl_handle;
-+devfs_handle_t nv_devfs_handles[NV_MAX_DEVICES+1];
- #endif
- 
--/*
-- * pick apart our minor device number
-- * low 3 bits is NV device
-- * if 255, then its the control device
-- */
--
--#define NV_DEVICE_NUMBER(_minor) ((_minor) & 0x0f)
--#define NV_DEVICE_IS_CONTROL_DEVICE(_minor) \
--             (((_minor) & 0xFF) == 0xFF)
--
- // #define NV_DBG_MEM 1
- #undef NV_DBG_MEM
- 
-@@ -118,10 +107,6 @@
-  *** EXPORTS to Linux Kernel
-  ***/
- 
--/* linux module interface functions (called by linux kernel) */
--int           init_module(void);
--void          cleanup_module(void);
--
- /* nv_kern_ functions, interfaces used by linux kernel */
- void          nv_kern_vma_open(struct vm_area_struct *vma);
- void          nv_kern_vma_release(struct vm_area_struct *vma);
-@@ -132,7 +117,7 @@
- unsigned int  nv_kern_poll(struct file *, poll_table *);
- int           nv_kern_ioctl(struct inode *, struct file *, unsigned int, unsigned long);
- void          nv_kern_bh(void *);
--void          nv_kern_isr(int, void *, struct pt_regs *);
-+irqreturn_t   nv_kern_isr(int, void *, struct pt_regs *);
- void          nv_kern_rc_timer(unsigned long);
- #ifdef CONFIG_PM
- int           nv_kern_pm(struct pm_dev *dev, pm_request_t rqst, void *data);
-@@ -155,6 +140,7 @@
- /* character driver entry points */
- 
- static struct file_operations nv_fops = {
-+    owner:          THIS_MODULE,
-     poll:           nv_kern_poll,
-     ioctl:          nv_kern_ioctl,
-     mmap:           nv_kern_mmap,
-@@ -325,8 +311,8 @@
-     {
-         nv_printf(NV_DBG_MEMINFO, "  0x%x: count %d flags 0x%x\n", 
-             *page_ptr, 
--            (GET_MAP_NR(*page_ptr))->count,
--            (GET_MAP_NR(*page_ptr))->flags);
-+            (virt_to_page(__va(*page_ptr)))->count,
-+            (virt_to_page(__va(*page_ptr)))->flags);
-         num_pages--;
-         page_ptr++;
-     }
-@@ -397,7 +383,7 @@
-         phys_addr = virt_to_phys((void *) virt_addr);
- 
-         /* lock the page for dma purposes */
--        mem_map_reserve(GET_MAP_NR(phys_addr));
-+        SetPageReserved(virt_to_page(__va(phys_addr)));
- 
-         *page_ptr++ = phys_addr;
-         pages_needed--;
-@@ -410,7 +396,7 @@
-     while (page_ptr != (unsigned long *) page_list)
-     {
-         page_ptr--;
--        mem_map_unreserve(GET_MAP_NR(*page_ptr));
-+        ClearPageReserved(virt_to_page(__va(*page_ptr)));
-         NV_FREE_PAGES((unsigned long) phys_to_virt(*page_ptr), 0);
-     }
- 
-@@ -430,7 +416,7 @@
- 
-     while (pages_left)
-     {
--        mem_map_unreserve(GET_MAP_NR(*page_list));
-+        ClearPageReserved(virt_to_page(__va(*page_list)));
-         page_list++;
-         pages_left--;
-     }
-@@ -596,11 +582,6 @@
-     nv_linux_state_t *nvl;
-     nv_linux_state_t *nv_max_devices;
- 
--#if defined (KERNEL_2_2)
--    struct proc_dir_entry *proc_root_driver;
--    proc_root_driver = create_proc_entry("driver", flags, &proc_root);
--#endif
--
-     proc_nvidia = create_proc_entry("nvidia", flags, proc_root_driver);
-     proc_nvidia_cards = create_proc_entry("cards", flags, proc_nvidia);
-     proc_nvidia_agp = create_proc_entry("agp", flags, proc_nvidia);
-@@ -662,9 +643,6 @@
- {
- #ifdef CONFIG_PROC_FS
-     nvos_proc_remove_all(proc_nvidia);
--#if defined (KERNEL_2_2)
--    remove_proc_entry("driver", &proc_root);
--#endif
- #endif
- }
- 
-@@ -753,9 +731,8 @@
-  *** EXPORTS to Linux Kernel
-  ***/
- 
--int init_module(void)
-+static int __init nvidia_init_module(void)
- {
--    nv_linux_state_t *nvl;
-     int rc, i;
- 
-     memset(nv_linux_devices, 0, sizeof(nv_linux_devices));
-@@ -768,7 +745,7 @@
- 
-     nv_printf(NV_DBG_ERRORS, "nvidia: loading %s\n", pNVRM_ID);
- 
--#ifdef CONFIG_DEVFS_FS
-+#if defined(CONFIG_DEVFS_FS) && !defined(KERNEL_2_6)
-     rc = devfs_register_chrdev(nv_major, "nvidia", &nv_fops);
- #else
-     rc = register_chrdev(nv_major, "nvidia", &nv_fops);
-@@ -780,34 +757,35 @@
-     }
- 
- #ifdef CONFIG_DEVFS_FS
--    memset(nv_dev_handle, 0, sizeof(devfs_handle_t) * NV_MAX_DEVICES);
-     do {
-+        /*
-+         * XXX This code isn't pretty, but neither is dealing with the
-+         * various Linux devfs implemenation(s). While Linux APIs are
-+         * known to be anything but stable and oftentimes anything but
-+         * well designed, the devfs interface has been more painful to
-+         * deal with than most other APIs.
-+         */
-         char name[10];
- 
--        nv_ctl_handle = devfs_register(NULL, "nvidiactl",
--                            DEVFS_FL_DEFAULT, nv_major, 255,
--                            S_IFCHR | S_IRUGO | S_IWUGO,
--                            &nv_fops, NULL);
-+        nv_devfs_handles[0] = NV_DEVFS_REGISTER("nvidiactl", 255);
- 
-         for (i = 0; i < num_nv_devices; i++) {
-             sprintf(name, "nvidia%d", i);
--            nv_dev_handle[i] = devfs_register(NULL, name,
--                                  DEVFS_FL_DEFAULT, nv_major, i,
--                                  S_IFCHR | S_IRUGO | S_IWUGO,
--                                  &nv_fops, NULL);
-+            nv_devfs_handles[i+1] = NV_DEVFS_REGISTER(name, i);
-         }
-     } while(0);
- #endif
- 
--    nv_printf(NV_DBG_INFO, "init_module: major number %d\n", nv_major);
-+    nv_printf(NV_DBG_INFO, "nvidia_init_module: major number %d\n", nv_major);
- 
--    // init all the bottom half structures
--    for (nvl = nv_linux_devices; nvl < nv_linux_devices + NV_MAX_DEVICES; nvl++)
--    {
--        nvl->bh = &nv_bottom_halves[nvl - nv_linux_devices];
--        nvl->bh->routine = nv_kern_bh;
--        nvl->bh->data = (void *) nvl;
--        nvl->bh->sync = 0;
-+    /* instantiate tasklets */
-+    for (i = 0; i < NV_MAX_DEVICES; i++) {
-+        /*
-+         * We keep one tasklet per card to avoid latency issues with more
-+         * than one device; no two instances of a single tasklet are ever
-+         * executed concurrently.
-+         */
-+        atomic_set(&nv_linux_devices[i].tasklet.count, 1);
-     }
- 
-     // init the nvidia control device
-@@ -815,6 +793,7 @@
-         nv_state_t *nv_ctl = NV_STATE_PTR(&nv_ctl_device);
-         nv_ctl->os_state = (void *) &nv_ctl_device;
-         nv_lock_init_locks(nv_ctl);
-+        init_waitqueue_head(&nv_ctl_waitqueue);
-     }
- 
- #ifdef CONFIG_PM
-@@ -841,14 +820,14 @@
-     /* create /proc/driver/nvidia */
-     nvos_proc_create();
- 
--#if defined(DEBUG) && !defined(KERNEL_2_2)
-+#if defined(DEBUG)
-     inter_module_register("nv_linux_devices", THIS_MODULE, nv_linux_devices);
- #endif
- 
-     return 0;
- 
-  failed:
--#ifdef CONFIG_DEVFS_FS
-+#if defined(CONFIG_DEVFS_FS) && !defined(KERNEL_2_6)
-     devfs_unregister_chrdev(nv_major, "nvidia");
- #else
-     unregister_chrdev(nv_major, "nvidia");
-@@ -856,26 +835,27 @@
-     return rc;
- }
- 
--void cleanup_module(void)
-+static void __exit nvidia_exit_module(void)
- {
--    int rc, i;
--    nv_linux_state_t *nvl;
--    nv_linux_state_t *max_devices;
-+    int rc;
-+    nv_linux_state_t *nvl, *max_devices;
- 
-     /* remove /proc/driver/nvidia */
-     nvos_proc_remove();
- 
--    nv_printf(NV_DBG_INFO, "cleanup_module\n");
-+    nv_printf(NV_DBG_INFO, "nvidia_exit_module\n");
- 
--#if defined(DEBUG) && !defined(KERNEL_2_2)
-+#if defined(DEBUG)
-     inter_module_unregister("nv_linux_devices");
- #endif
- 
- #ifdef CONFIG_PM
--    for (i = 0; i < num_nv_devices; i++)
--    {
--        pm_unregister(pm_nv_dev[i]);
--    }
-+    do {
-+        int i;
-+        for (i = 0; i < num_nv_devices; i++) {
-+            pm_unregister(pm_nv_dev[i]);
-+        }
-+    } while (0);
- #endif
- 
-     // Shutdown the resource manager
-@@ -894,30 +874,29 @@
-                 continue;
- 
-             nv_printf(NV_DBG_ERRORS,
--                    "still have vm que at cleanup_module(): 0x%x to 0x%x\n",
-+                    "still have vm que at nvidia_exit_module(): 0x%x to 0x%x\n",
-                     nvl->alloc_queue->vma->vm_start,
-                     nvl->alloc_queue->vma->vm_end);
-         }
-     }
- 
--#ifdef CONFIG_DEVFS_FS
-+#if defined(CONFIG_DEVFS_FS) && !defined(KERNEL_2_6)
-     rc = devfs_unregister_chrdev(nv_major, "nvidia");
- #else
-     rc = unregister_chrdev(nv_major, "nvidia");
- #endif
- 
-     if (rc < 0) {
--        nv_printf(NV_DBG_ERRORS, "cleanup_module: unregister nv failed\n");
-+        nv_printf(NV_DBG_ERRORS, "nvidia_exit_module: unregister nv failed\n");
-     }
- 
- #ifdef CONFIG_DEVFS_FS
-     do {
-         int i;
--        for (i = 0; nv_dev_handle[i] != 0; i++) {
--            devfs_unregister(nv_dev_handle[i]);
--        }
--    } while(0);
--    devfs_unregister(nv_ctl_handle);
-+        NV_DEVFS_REMOVE_CONTROL();
-+        for (i = 0; i < num_nv_devices; i++)
-+            NV_DEVFS_REMOVE_DEVICE(i);
-+    } while (0);
- #endif
- 
- #if NV_ENABLE_MEM_TRACKING
-@@ -929,6 +908,8 @@
- #endif
- }
- 
-+module_init(nvidia_init_module);
-+module_exit(nvidia_exit_module);
- 
- /* this is only called when the vmas are duplicated.
-  * this appears to only happen when the process is cloned to create
-@@ -942,11 +923,11 @@
- nv_kern_vma_open(struct vm_area_struct *vma)
- {
-     nv_printf(NV_DBG_MEMINFO, "vma_open for 0x%x - 0x%x, offset 0x%x\n",
--        vma->vm_start, vma->vm_end, LINUX_VMA_OFFS(vma));
-+        vma->vm_start, vma->vm_end, NV_VMA_OFFSET(vma));
- 
--    if (VMA_PRIVATE(vma))
-+    if (NV_VMA_PRIVATE(vma))
-     {
--        nv_alloc_t *at = (nv_alloc_t *) VMA_PRIVATE(vma);
-+        nv_alloc_t *at = (nv_alloc_t *) NV_VMA_PRIVATE(vma);
-         at->usage_count++;
- 
-         nv_printf(NV_DBG_MEMINFO, "  at 0x%x, usage count %d, page_table 0x%x\n",
-@@ -954,8 +935,6 @@
- 
-         nvos_list_page_count(at->page_table, at->num_pages);
-     }
--
--    MOD_INC_USE_COUNT;
- }
- 
- 
-@@ -963,11 +942,11 @@
- nv_kern_vma_release(struct vm_area_struct *vma)
- {
-     nv_printf(NV_DBG_MEMINFO, "vma_release for 0x%x - 0x%x, offset 0x%x\n",
--        vma->vm_start, vma->vm_end, LINUX_VMA_OFFS(vma));
-+        vma->vm_start, vma->vm_end, NV_VMA_OFFSET(vma));
- 
--    if (VMA_PRIVATE(vma))
-+    if (NV_VMA_PRIVATE(vma))
-     {
--        nv_alloc_t *at = (nv_alloc_t *) VMA_PRIVATE(vma);
-+        nv_alloc_t *at = (nv_alloc_t *) NV_VMA_PRIVATE(vma);
- 
-         at->usage_count--;
- 
-@@ -985,22 +964,12 @@
-             if (at->page_table)
-                 nvos_unlock_pages(at->page_table, at->num_pages);
-             nvos_free_alloc(at);
--            VMA_PRIVATE(vma) = NULL;
-+            NV_VMA_PRIVATE(vma) = NULL;
-         }
-     }
--
--    MOD_DEC_USE_COUNT;
- }
- 
--
--/* at this point, this code just plain won't work with 2.2 kernels.
-- * additionally, only ia64 & the 460GX need a nopage handler, and 2.2 doesn't
-- * work on ia64 anyways. It's expected that at some point other agp chipsets
-- * will work similar to the 460GX (AGP 3.0 spec), so pre-emptively make sure
-- * this works on our standard ia32 driver.
-- */
--#if !defined(KERNEL_2_2)
--
-+#if 0
- /* AGP allocations under the 460GX are not mapped to the aperture
-  * addresses by the CPU.  This nopage handler will fault on CPU
-  * accesses to AGP memory and map the address to the correct page.
-@@ -1013,7 +982,7 @@
-     struct page *page_ptr;
-     int rm_status, index;
- 
--    at = VMA_PRIVATE(vma);
-+    at = NV_VMA_PRIVATE(vma);
-     if (at == NULL)
-     {
-         nv_printf(NV_DBG_ERRORS, "NVRM: nopage handler called without an at: "
-@@ -1052,7 +1021,7 @@
-         // far again
-         nv_printf(NV_DBG_ERRORS, "NVRM: nopage handler called on a freed"
-                   "address: vm_start 0x%x, at 0x%x\n", vma->vm_start, at);
--        VMA_PRIVATE(vma) = NULL;
-+        NV_VMA_PRIVATE(vma) = NULL;
-         return NOPAGE_SIGBUS;
-     }
- 
-@@ -1078,10 +1047,8 @@
- 
- struct vm_operations_struct nv_vm_ops = {
-     nv_kern_vma_open,
--    nv_kern_vma_release,  /* "close" */
--#if !defined(KERNEL_2_2)
--    nv_kern_vma_nopage,
--#endif
-+    nv_kern_vma_release  /* "close" */
-+    /* , nv_kern_vma_nopage */
- };
- 
- static nv_file_private_t *
-@@ -1096,7 +1063,7 @@
-     memset(nvfp, 0, sizeof(nv_file_private_t));
- 
-     // initialize this file's event queue
--    INIT_EVENT_QUEUE(nvfp->wqueue);
-+    init_waitqueue_head(&nvfp->waitqueue);
- 
-     nv_init_lock(nvfp->fp_lock);
- 
-@@ -1116,7 +1083,6 @@
-     if (nvfp == NULL)
-         return;
- 
--    FREE_EVENT_QUEUE(nvfp->wqueue);
-     NV_VFREE(nvfp->event_fifo, sizeof(nv_event_t) * NV_EVENT_FIFO_SIZE);
-     NV_VFREE(nvfp, sizeof(nv_file_private_t));
- }
-@@ -1145,11 +1111,11 @@
- 
-     /* for control device, just jump to its open routine */
-     /* after setting up the private data */
--    if (NV_DEVICE_IS_CONTROL_DEVICE(inode->i_rdev))
-+    if (NV_IS_CONTROL_DEVICE(inode))
-         return nv_kern_ctl_open(inode, file);
- 
-     /* what device are we talking about? */
--    devnum = NV_DEVICE_NUMBER(inode->i_rdev);
-+    devnum = NV_DEVICE_NUMBER(inode);
-     if (devnum >= NV_MAX_DEVICES)
-     {
-         rc = -ENODEV;
-@@ -1202,12 +1168,14 @@
-             goto failed;
-         }
- 
-+        nvl->tasklet.func = (void *) rm_isr_bh;
-+        nvl->tasklet.data = (unsigned long) nv->pdev;
-+        tasklet_enable(&nvl->tasklet);
- 
-         nv->flags |= NV_FLAG_OPEN;
-     }
- 
-     nv->usage_count++;
--    MOD_INC_USE_COUNT;
- 
-  failed:
-     nv_unlock(nvl->ldata_lock);
-@@ -1238,38 +1206,32 @@
- 
-     /* for control device, just jump to its open routine */
-     /* after setting up the private data */
--    if (NV_DEVICE_IS_CONTROL_DEVICE(inode->i_rdev))
-+    if (NV_IS_CONTROL_DEVICE(inode))
-         return nv_kern_ctl_close(inode, file);
- 
--    nv_printf(NV_DBG_INFO, "nv_kern_close on device %d\n", NV_DEVICE_NUMBER(inode->i_rdev));
-+    nv_printf(NV_DBG_INFO, "nv_kern_close on device %d\n", NV_DEVICE_NUMBER(inode));
- 
-     rm_free_unused_clients(nv, current->pid, (void *) file);
- 
-     nv_lock(nvl->ldata_lock);
-     if (--nv->usage_count == 0)
-     {
--        int counter = 0;
--
--        /* turn off interrupts.
--        ** be careful to make sure any pending bottom half gets run
--        **  or disabled before calling rm_shutdown_adapter() since
--        **  it will free up the pdev.  This is hard to see on single
--        **  cpu systems, but easy on dual cpu :-)
--        */
-+        /*
-+         * The usage count for this device has dropped to zero, it can be shut
-+         * down safely; disable its interrupts.
-+         */
-         rm_disable_adapter(nv);
- 
--        /* give it a moment to allow any bottom half to run */
--
--#define MAX_BH_TASKS 10
--        while (NV_ATOMIC_READ(nvl->bh_count) && (counter < MAX_BH_TASKS))
--        {
--            current->state = TASK_INTERRUPTIBLE;
--            schedule_timeout(HZ/50);
--            counter++;
--        }
-+        /*
-+         * Disable this device's tasklet to make sure that no bottom half will
-+         * run with undefined device state.
-+         */
-+        tasklet_disable(&nvl->tasklet);
- 
--        /* free the irq, which may block until any pending interrupts */
--        /* are done being processed. */
-+        /*
-+         * Free the IRQ, which may block until all pending interrupt processing
-+         * has completed.
-+         */
-         free_irq(nv->interrupt_line, (void *) nv);
- 
-         rm_shutdown_adapter(nv);
-@@ -1300,8 +1262,6 @@
-         FILE_PRIVATE(file) = NULL;
-     }
- 
--    MOD_DEC_USE_COUNT;
--
-     return 0;
- }
- 
-@@ -1318,10 +1278,10 @@
-     nv_printf(NV_DBG_INFO, "mmap([0x%p-0x%p] off=0x%lx)\n",
-         vma->vm_start,
-         vma->vm_end,
--        LINUX_VMA_OFFS(vma));
-+        NV_VMA_OFFSET(vma));
- 
-     // be a bit paranoid for now
--    if ((NV_MASK_OFFSET(LINUX_VMA_OFFS(vma))) ||
-+    if ((NV_MASK_OFFSET(NV_VMA_OFFSET(vma))) ||
-         (NV_MASK_OFFSET(vma->vm_start)) ||
-         (NV_MASK_OFFSET(vma->vm_end)))
-     {
-@@ -1339,7 +1299,7 @@
- 
- 
-     /* NV reg space */
--    if (IS_REG_OFFSET(nv, LINUX_VMA_OFFS(vma), vma->vm_end - vma->vm_start))
-+    if (IS_REG_OFFSET(nv, NV_VMA_OFFSET(vma), vma->vm_end - vma->vm_start))
-     {
-         /* truncate to size of registers */
-         if (pages > nv->regs->size / PAGE_SIZE)
-@@ -1347,7 +1307,7 @@
- 
-         vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
-         if (NV_REMAP_PAGE_RANGE(vma->vm_start,
--                             LINUX_VMA_OFFS(vma),
-+                             NV_VMA_OFFSET(vma),
-                              vma->vm_end - vma->vm_start,
-                              vma->vm_page_prot))
-             return -EAGAIN;
-@@ -1357,7 +1317,7 @@
-     }
- 
-     /* NV fb space */
--    else if (IS_FB_OFFSET(nv, LINUX_VMA_OFFS(vma), vma->vm_end - vma->vm_start))
-+    else if (IS_FB_OFFSET(nv, NV_VMA_OFFSET(vma), vma->vm_end - vma->vm_start))
-     {
- 
-         /* truncate to size of framebuffer */
-@@ -1366,7 +1326,7 @@
- 
-         vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
-         if (NV_REMAP_PAGE_RANGE(vma->vm_start,
--                             LINUX_VMA_OFFS(vma),
-+                             NV_VMA_OFFSET(vma),
-                              vma->vm_end - vma->vm_start,
-                              vma->vm_page_prot))
-             return -EAGAIN;
-@@ -1376,10 +1336,10 @@
-     }
- 
-     /* AGP allocator */
--    else if (IS_AGP_OFFSET(nv, LINUX_VMA_OFFS(vma), vma->vm_end - vma->vm_start))
-+    else if (IS_AGP_OFFSET(nv, NV_VMA_OFFSET(vma), vma->vm_end - vma->vm_start))
-     {
-         nv_lock(nvl->at_lock);
--        at = nvl_find_alloc(nvl, LINUX_VMA_OFFS(vma), NV_ALLOC_TYPE_AGP);
-+        at = nvl_find_alloc(nvl, NV_VMA_OFFSET(vma), NV_ALLOC_TYPE_AGP);
- 
-         if (at == NULL)
-         {
-@@ -1397,7 +1357,7 @@
-         }
- 
-         at->vma = vma;
--        VMA_PRIVATE(vma) = at;
-+        NV_VMA_PRIVATE(vma) = at;
-         at->usage_count++;
- 
-         if (NV_OSAGP_ENABLED(nv))
-@@ -1420,13 +1380,13 @@
-     }
- 
-     /* Magic allocator */
--    else // if (LINUX_VMA_OFFS(vma) == NV_MMAP_ALLOCATION_OFFSET)
-+    else // if (NV_VMA_OFFSET(vma) == NV_MMAP_ALLOCATION_OFFSET)
-     {
-         unsigned long page = 0, pos, start;
-         int i = 0;
- 
-         nv_lock(nvl->at_lock);
--        at = nvl_find_alloc(nvl, LINUX_VMA_OFFS(vma), NV_ALLOC_TYPE_PCI);
-+        at = nvl_find_alloc(nvl, NV_VMA_OFFSET(vma), NV_ALLOC_TYPE_PCI);
- 
-         if (at == NULL)
-         {
-@@ -1444,7 +1404,7 @@
-         }
- 
-         at->vma = vma;
--        VMA_PRIVATE(vma) = at;
-+        NV_VMA_PRIVATE(vma) = at;
-         at->usage_count++;
- 
-         nv_printf(NV_DBG_INFO, "remapping %d system pages for at 0x%x\n", pages, at);
-@@ -1466,9 +1426,6 @@
- 
-     vma->vm_file = file;
- 
--    /* just increment usage count, rather than calling vma_open */
--    MOD_INC_USE_COUNT;
--
-     return 0;
- }
- 
-@@ -1494,7 +1451,7 @@
-     {
-         nv_printf(NV_DBG_EVENTINFO, "calling poll_wait\n");
-         // add us to the list
--        poll_wait(file, EVENT_QUEUE(nvfp->wqueue), wait);
-+        poll_wait(file, &nvfp->waitqueue, wait);
-     }
- 
-     nv_lock(nvfp->fp_lock);
-@@ -1562,12 +1519,13 @@
- 
-     switch (_IOC_NR(cmd))
-     {
-+#if !defined(KERNEL_2_6)
-         /* debug tool; zap the module use count so we can unload driver */
-         /*             even if it is confused */
-         case NV_ESC_MODULE_RESET:
-             atomic_set(&__this_module.uc.usecount, 1);
-             break;
--
-+#endif
-         /* pass out info about the card */
-         case NV_ESC_CARD_INFO:
-         {
-@@ -1694,7 +1652,7 @@
-  * driver receives an interrupt
-  *    if someone waiting, then hand it off.
-  */
--void nv_kern_isr(
-+irqreturn_t nv_kern_isr(
-     int   irq,
-     void *arg,
-     struct pt_regs *regs
-@@ -1708,9 +1666,10 @@
-     if (need_to_run_bottom_half)
-     {
-         NV_ATOMIC_INC(nvl->bh_count);
--        queue_task(nvl->bh, &tq_immediate);
--        mark_bh(IMMEDIATE_BH);
-+        tasklet_schedule(&nvl->tasklet);
-     }
-+
-+    return IRQ_HANDLED;
- }
- 
- void nv_kern_bh(
-@@ -1828,11 +1787,9 @@
- 
-     if (nv->usage_count == 0)
-     {
--        INIT_EVENT_QUEUE(nv_ctl_wqueue);
-+        init_waitqueue_head(&nv_ctl_waitqueue);
-     }
- 
--    MOD_INC_USE_COUNT;
--
-     nv->flags |= NV_FLAG_OPEN + NV_FLAG_CONTROL;
- 
-     /* turn off the hotkey occurred bit */
-@@ -1860,10 +1817,8 @@
- 
-     nv_lock(nvl->ldata_lock);
-     if (--nv->usage_count == 0)
--    {
--        FREE_EVENT_QUEUE(nv_ctl_wqueue);
-         nv->flags = 0;
--    }
-+
-     nv_unlock(nvl->ldata_lock);
- 
-     rm_free_unused_clients(nv, current->pid, (void *) file);
-@@ -1874,8 +1829,6 @@
-         FILE_PRIVATE(file) = NULL;
-     }
- 
--    MOD_DEC_USE_COUNT;
--
-     return 0;
- }
- 
-@@ -1899,7 +1852,7 @@
-     nv = NV_STATE_PTR(nvl);
- 
-     if ( !(file->f_flags & O_NONBLOCK) )
--        poll_wait(file, EVENT_QUEUE(nv_ctl_wqueue), wait);
-+        poll_wait(file, &nv_ctl_waitqueue, wait);
- 
-     nv_lock(nvl->ldata_lock);
- 
-@@ -1930,7 +1883,7 @@
-     nv_ctl_device.nv_state.flags |= NV_FLAG_HOTKEY_OCCURRED;
-     nv_unlock(nv_ctl_device.ldata_lock);
- 
--    wake_up_interruptible(EVENT_QUEUE(nv_ctl_wqueue));
-+    wake_up_interruptible(&nv_ctl_waitqueue);
- }
- 
- int nv_kern_read_cardinfo(char *page, char **start, off_t off,
-@@ -2009,7 +1962,7 @@
-         len += sprintf(page+len, "Host Bridge: \t ");
- 
- #if defined(CONFIG_PCI_NAMES)
--        len += sprintf(page+len, "%s\n", dev->name);
-+        len += sprintf(page+len, "%s\n", NV_PCI_DEVICE_NAME(dev));
- #else
-         len += sprintf(page+len, "PCI device %04x:%04x\n",
-                 dev->vendor, dev->device);
-@@ -2137,18 +2090,15 @@
-             {
-                 unsigned long retaddr = (unsigned long) at->page_table[i];
- 
--                // if we've allocated via vmalloc on a highmem system, the 
--                // physical address may not be accessible via PAGE_OFFSET, 
--                // that's ok, we have a simple linear pointer already.
-                 if (at->flags & NV_ALLOC_TYPE_VMALLOC)
-                 {
-                     return (void *)((unsigned char *) at->key_mapping + (i << PAGE_SHIFT) + offset);
-                 }
--
--                if (retaddr <= MAXMEM)
--                {
--                    return __va((retaddr + offset));
--                }
-+              else if (!(at->flags & NV_ALLOC_TYPE_CONTIG))
-+              {
-+                  return __va((retaddr + offset));
-+              }
-+              
- 
-                 // ?? this may be a contiguous allocation, fall through
-                 // to below? or should I just check at->flag here?
-@@ -2218,9 +2168,9 @@
- unsigned long
- nv_get_phys_address(unsigned long address)
- {
--    pgd_t *pg_dir;
--    pmd_t *pg_mid_dir;
--    pte_t pte;
-+    pgd_t *pgd;
-+    pmd_t *pmd;
-+    pte_t *pte;
-     unsigned long retval;
- 
- #if defined(NVCPU_IA64)
-@@ -2234,23 +2184,24 @@
-         return __pa(address);
- 
-     if (address > VMALLOC_START)
--       pg_dir = pgd_offset_k(address);
-+       pgd = pgd_offset_k(address);
-     else
--       pg_dir = pgd_offset(current->mm, address);
-+       pgd = pgd_offset(current->mm, address);
- 
--    if (pgd_none(*pg_dir))
-+    if (!pgd || pgd_none(*pgd))
-         goto failed;
- 
--    pg_mid_dir = pmd_offset(pg_dir, address);
--    if (pmd_none(*pg_mid_dir))
-+    NV_PMD_OFFSET(address, pgd, pmd);
-+
-+    if (!NV_PMD_PRESENT(pmd))
-         goto failed;
- 
--    NV_PTE_OFFSET(address, pg_mid_dir, pte);
-+    NV_PTE_OFFSET(address, pmd, pte);
- 
--    if (!pte_present(pte))
-+    if (!NV_PTE_PRESENT(pte))
-         goto failed;
- 
--    retval = ((pte_val(pte) & KERN_PAGE_MASK) | NV_MASK_OFFSET(address));
-+    retval = (NV_PTE_VALUE(pte) & KERN_PAGE_MASK) | NV_MASK_OFFSET(address);
- 
- #if defined(NVCPU_X86_64) && defined(_PAGE_NX)
-     // mask out the non-executable page bit for the true physical address
-@@ -2618,8 +2569,7 @@
-         nvfp->put = 0;
- 
-     nv_unlock(nvfp->fp_lock);
--
--    wake_up_interruptible(EVENT_QUEUE(nvfp->wqueue));
-+    wake_up_interruptible(&nvfp->waitqueue);
- }
- 
- int nv_get_event(
-@@ -2704,12 +2654,8 @@
-     if ( (NV_AGP_DISABLED(nv)) && (config & NVOS_AGP_CONFIG_NVAGP) )
-     {
-         /* make sure the user does not have agpgart loaded */
--#if !defined (KERNEL_2_2)
-         if (inter_module_get("drm_agp")) {
-             inter_module_put("drm_agp");
--#else
--        if (GET_MODULE_SYMBOL(0, __MODULE_STRING(agp_enable))) {
--#endif
-             nv_printf(NV_DBG_WARNINGS, "NVRM: not using NVAGP, AGPGART is loaded!!\n");
-         } else
-             status = rm_init_agp(nv);
-diff -u NVIDIA_kernel-1.0-4499/os-agp.c NVIDIA_kernel-1.0-4499-2.6/os-agp.c
---- NVIDIA_kernel-1.0-4499/os-agp.c    2003-09-18 00:22:11.000000000 +0000
-+++ NVIDIA_kernel-1.0-4499-2.6/os-agp.c        2003-10-12 01:03:01.000000000 +0000
-@@ -45,44 +45,9 @@
-     int  ready;
- } agp_gart;
- 
--typedef struct {
--    int           (*backend_acquire)(void);
--    void          (*backend_release)(void);
--    void          (*copy_info)(agp_kern_info *);
--    agp_memory *  (*allocate_memory)(size_t, unsigned int);
--    void          (*free_memory)(agp_memory *);
--    int           (*bind_memory)(agp_memory *, off_t);
--    int           (*unbind_memory)(agp_memory *);
--    void          (*enable)(unsigned int);
--} agp_operations_struct;
--
--agp_operations_struct agp_ops;
- agp_kern_info         agpinfo;
- agp_gart              gart;
--#if !defined (KERNEL_2_2)
- const drm_agp_t       *drm_agp_p;
--#endif
--
--#if defined (KERNEL_2_2)
--    #define GET_AGPGART_SYMBOL(sym, sym_string)                     \
--        sym = (void*) GET_MODULE_SYMBOL(0, sym_string);             \
--        if (sym == NULL)                                            \
--        {                                                           \
--            nv_printf(NV_DBG_ERRORS,                                \
--                "NVRM: AGPGART: unable to retrieve symbol %s\n",    \
--                sym_string);                                        \
--            return 1;                                               \
--        }
--
--    #define AGP_BACKEND_ACQUIRE_SYM   __MODULE_STRING(agp_backend_acquire)
--    #define AGP_BACKEND_RELEASE_SYM   __MODULE_STRING(agp_backend_release)
--    #define AGP_COPY_INFO_SYM         __MODULE_STRING(agp_copy_info)
--    #define AGP_ALLOCATE_MEMORY_SYM   __MODULE_STRING(agp_allocate_memory)
--    #define AGP_FREE_MEMORY_SYM       __MODULE_STRING(agp_free_memory)
--    #define AGP_BIND_MEMORY_SYM       __MODULE_STRING(agp_bind_memory)
--    #define AGP_UNBIND_MEMORY_SYM     __MODULE_STRING(agp_unbind_memory)
--    #define AGP_ENABLE_SYM            __MODULE_STRING(agp_enable)
--#endif
- 
- #if defined(CONFIG_MTRR)
- #define MTRR_DEL(gart) if ((gart).mtrr > 0) mtrr_del((gart).mtrr, 0, 0);
-@@ -105,13 +70,17 @@
-     U032  agp_rate;
-     U032  agp_sba;
-     U032  agp_fw;
--    char* chipset;
-     VOID *bitmap;
-     U032 bitmap_size;
- 
-     memset( (void *) &gart, 0, sizeof(agp_gart));
- 
--#if !defined (KERNEL_2_2)
-+    /*
-+     * XXX The inter_module_* mechanism has been deprecated and replaced with
-+     * a different mechanism in Linux 2.5; it will go away eventually.
-+     * Also, the Linux 2.5 AGP GART driver is modularized, agpgart.o does not
-+     * include backend drivers.
-+     */
-     if (!(drm_agp_p = inter_module_get_request("drm_agp", "agpgart")))
-     {
-         nv_printf(NV_DBG_ERRORS,
-@@ -119,48 +88,13 @@
-         return 1;
-     }
-     
--    agp_ops.backend_acquire = drm_agp_p->acquire;
--    agp_ops.backend_release = drm_agp_p->release;
--    agp_ops.allocate_memory = drm_agp_p->allocate_memory;
--    agp_ops.free_memory     = drm_agp_p->free_memory;
--    agp_ops.bind_memory     = drm_agp_p->bind_memory;
--    agp_ops.unbind_memory   = drm_agp_p->unbind_memory;
--    agp_ops.enable          = drm_agp_p->enable;
--
--    // looks like some newer kernels (for example mandrake 9.0's 2.4.19-16mdk)
--    // have updated copy_info to return an integer value, and of course didn't
--    // bother bumping the agpgart revision up. The return value is pretty 
--    // harmless (backend_acquire would have already failed and caused us to
--    // bail), so cast the function pointer to avoid compiler warnings.
--    // we may need to revisit this in the future.
--    agp_ops.copy_info       = (void (*)(agp_kern_info *)) drm_agp_p->copy_info;
--
--#else
--#if defined(CONFIG_KMOD)
--    if ( request_module("agpgart") )
--    {
--        nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: not loading agpgart.o\n");
--        return 1;
--    }
--#endif
--
--    GET_AGPGART_SYMBOL(agp_ops.backend_acquire, AGP_BACKEND_ACQUIRE_SYM);
--    GET_AGPGART_SYMBOL(agp_ops.backend_release, AGP_BACKEND_RELEASE_SYM);
--    GET_AGPGART_SYMBOL(agp_ops.copy_info,       AGP_COPY_INFO_SYM);
--    GET_AGPGART_SYMBOL(agp_ops.allocate_memory, AGP_ALLOCATE_MEMORY_SYM);
--    GET_AGPGART_SYMBOL(agp_ops.free_memory,     AGP_FREE_MEMORY_SYM);
--    GET_AGPGART_SYMBOL(agp_ops.bind_memory,     AGP_BIND_MEMORY_SYM);
--    GET_AGPGART_SYMBOL(agp_ops.unbind_memory,   AGP_UNBIND_MEMORY_SYM);
--    GET_AGPGART_SYMBOL(agp_ops.enable,          AGP_ENABLE_SYM);
--#endif
--
-     /* NOTE: from here down, return an error code of '-1'
-      * that indicates that agpgart is loaded, but we failed to use it
-      * in some way. This is so we don't try to use nvagp and lock up
-      * the memory controller.
-      */
- 
--    if ( (*(agp_ops.backend_acquire))() )
-+    if (drm_agp_p->acquire())
-     {
-         nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: backend in use\n");
-         return -1;
-@@ -178,44 +112,21 @@
-         agp_fw = 1;
-     agp_fw &= 0x00000001;
-     
--    (*(agp_ops.copy_info))(&agpinfo);
--
--    switch ( agpinfo.chipset )
--    {
--        case INTEL_GENERIC:    chipset = "Intel";            break;
--        case INTEL_LX:         chipset = "Intel 440LX";      break;
--        case INTEL_BX:         chipset = "Intel 440BX";      break;
--        case INTEL_GX:         chipset = "Intel 440GX";      break;
--        case INTEL_I810:       chipset = "Intel i810";       break;
--        case INTEL_I840:       chipset = "Intel i840";       break;
--#if !defined (KERNEL_2_2)
--        case INTEL_I815:       chipset = "Intel i815";       break;
--#if !defined(__rh_config_h__)
--        case INTEL_I850:       chipset = "Intel i850";       break;
--#endif
--#endif
--#if defined(NVCPU_IA64)
--        case INTEL_460GX:      chipset = "Intel 460GX";      break;
--#endif
--        case VIA_GENERIC:      chipset = "VIA";              break;
--        case VIA_VP3:          chipset = "VIA VP3";          break;
--        case VIA_MVP3:         chipset = "VIA MVP3";         break;
--        case VIA_MVP4:         chipset = "VIA MVP4";         break;
--#if !defined (KERNEL_2_2)
--        case VIA_APOLLO_KX133: chipset = "VIA Apollo KX133"; break;
--        case VIA_APOLLO_KT133: chipset = "VIA Apollo KT133"; break;
--#endif
--        case VIA_APOLLO_PRO:   chipset = "VIA Apollo Pro";   break;
--        case SIS_GENERIC:      chipset = "SiS";              break;
--        case AMD_GENERIC:      chipset = "AMD";              break;
--        case AMD_IRONGATE:     chipset = "AMD Irongate";     break;
--        case ALI_M1541:        chipset = "ALi M1541";        break;
--        case ALI_GENERIC:      chipset = "ALi";              break;
--        case NOT_SUPPORTED:    chipset = "unsupported";      break;
--        default:               chipset = "unknown";
-+#if defined(KERNEL_2_4)
-+    /*
-+     * The original Linux 2.4 AGP GART driver interface declared copy_info to
-+     * return nothing. This changed in Linux 2.5, which reports unsupported
-+     * chipsets via this function. If this Linux 2.4 kernels behaves the same
-+     * way, we have no way to know.
-+     */
-+    drm_agp_p->copy_info(&agpinfo);
-+#else
-+    if (drm_agp_p->copy_info(&agpinfo)) {
-+        drm_agp_p->release();
-+        inter_module_put("drm_agp");
-+        return -1;
-     }
--
--    nv_printf(NV_DBG_SETUP, "NVRM: AGPGART: %s chipset\n", chipset);
-+#endif
- 
- #ifdef CONFIG_MTRR
-     if ((gart.mtrr = mtrr_add(agpinfo.aper_base,
-@@ -229,7 +140,8 @@
-          */
-         nv_printf(NV_DBG_ERRORS, 
-             "NVRM: AGPGART: unable to set MTRR write-combining\n");
--        (*(agp_ops.backend_release))();
-+        drm_agp_p->release();
-+        inter_module_put("drm_agp");
-         return -1;
-     }
- #endif
-@@ -245,7 +157,8 @@
-     {
-         nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: unable to remap aperture\n");
-         MTRR_DEL(gart);
--        (*(agp_ops.backend_release))();
-+        drm_agp_p->release();
-+        inter_module_put("drm_agp");
-         return -1;
-     }
- 
-@@ -256,7 +169,8 @@
-         nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: unable to allocate bitmap\n");
-         NV_IOUNMAP(gart.aperture, RM_PAGE_SIZE);
-         MTRR_DEL(gart);
--        (*(agp_ops.backend_release))();
-+        drm_agp_p->release();
-+        inter_module_put("drm_agp");
-         return -1;
-     }
- 
-@@ -267,39 +181,19 @@
-         os_free_mem(bitmap);
-         NV_IOUNMAP(gart.aperture, RM_PAGE_SIZE);
-         MTRR_DEL(gart);
--        (*(agp_ops.backend_release))();
-+        drm_agp_p->release();
-+        inter_module_put("drm_agp");
-         return -1;
-     }
- 
--    nv_printf(NV_DBG_SETUP,
--        "NVRM: AGPGART: aperture: %ldM @ 0x%08lx\n",
--        (unsigned long)agpinfo.aper_size,
--        (unsigned long)agpinfo.aper_base);
--
--    nv_printf(NV_DBG_SETUP, 
--        "NVRM: AGPGART: aperture mapped from 0x%08lx to 0x%08lx\n",
--        agpinfo.aper_base,
--        (unsigned long) gart.aperture);
--
-     if (!agp_sba) agpinfo.mode &= ~0x00000200;
-     if (!agp_fw)  agpinfo.mode &= ~0x00000010;
- 
-     if (!(agp_rate & 0x00000004)) agpinfo.mode &= ~0x00000004;
-     if (!(agp_rate & 0x00000002)) agpinfo.mode &= ~0x00000002;
-     
--    (*(agp_ops.enable))(agpinfo.mode);
-+    drm_agp_p->enable(agpinfo.mode);
-     
--    if (agpinfo.mode & 0x00000200)
--        nv_printf(NV_DBG_SETUP, "NVRM: AGPGART: backend supports sba\n");
--    if (agpinfo.mode & 0x00000010)
--        nv_printf(NV_DBG_SETUP, "NVRM: AGPGART: backend supports fw\n");
--    if (agpinfo.mode & 0x00000004)
--        nv_printf(NV_DBG_SETUP, "NVRM: AGPGART: mode 4x\n");
--    else if (agpinfo.mode & 0x00000002)
--        nv_printf(NV_DBG_SETUP, "NVRM: AGPGART: mode 2x\n");
--    else if (agpinfo.mode & 0x00000001)
--        nv_printf(NV_DBG_SETUP, "NVRM: AGPGART: mode 1x\n");
--
-     *ap_phys_base   = (void*) agpinfo.aper_base;
-     *ap_mapped_base = (void*) gart.aperture;
-     *apsize         = (agpinfo.aper_size * 0x100000) - 1;
-@@ -333,11 +227,13 @@
-         NV_IOUNMAP(gart.aperture, RM_PAGE_SIZE);
-     }
- 
--    (*(agp_ops.backend_release))();
-+    drm_agp_p->release();
- 
--#if !defined (KERNEL_2_2)
-+    /*
-+     * XXX Same as above; the inter_module_* mechanism will go away at some
-+     * point, it has been deprecated in Linux 2.5.
-+     */
-     inter_module_put("drm_agp");
--#endif
- 
-     if (rm_clear_agp_bitmap(nv, &bitmap))
-     {
-@@ -384,7 +280,7 @@
-         return RM_ERROR;
-     }
- 
--    ptr = (*agp_ops.allocate_memory)(PageCount, AGP_NORMAL_MEMORY);
-+    ptr = drm_agp_p->allocate_memory(PageCount, AGP_NORMAL_MEMORY);
-     if (ptr == NULL)
-     {
-         *pAddress = (void*) 0;
-@@ -392,7 +288,7 @@
-         return RM_ERR_NO_FREE_MEM;
-     }
-     
--    err = (*(agp_ops.bind_memory))(ptr, *Offset);
-+    err = drm_agp_p->bind_memory(ptr, *Offset);
-     if (err)
-     {
-         // this happens a lot when the aperture itself fills up..
-@@ -409,7 +305,7 @@
-     if (status != RM_OK)
-     {
-         nv_printf(NV_DBG_ERRORS, "NVRM: memory allocation failed\n");
--        (*(agp_ops.unbind_memory))(ptr);
-+        drm_agp_p->unbind_memory(ptr);
-         goto fail;
-     }
- 
-@@ -424,7 +320,7 @@
-     return RM_OK;
- 
- fail:
--    (*(agp_ops.free_memory))(ptr);
-+    drm_agp_p->free_memory(ptr);
-     *pAddress = (void*) 0;
- 
-     return RM_ERROR;
-@@ -463,7 +359,7 @@
-     {
-         nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: unable to remap %lu pages\n",
-             (unsigned long)agp_data->num_pages);
--        (*(agp_ops.unbind_memory))(agp_data->ptr);
-+        drm_agp_p->unbind_memory(agp_data->ptr);
-         goto fail;
-     }
-     
-@@ -481,9 +377,6 @@
- #endif /* AGPGART */
- }
- 
--
--#if !defined(KERNEL_2_2)
--
- RM_STATUS 
- KernMapAGPNopage(
-     VOID *address,
-@@ -530,9 +423,6 @@
- #endif
- }
- 
--#endif /* !defined(KERNEL_2_2) */
--
--
- RM_STATUS KernFreeAGPPages(
-     nv_state_t *nv,
-     VOID **pAddress,
-@@ -558,8 +448,8 @@
-     {
-         size_t pages = ptr->page_count;
- 
--        (*(agp_ops.unbind_memory))(ptr);
--        (*(agp_ops.free_memory))(ptr);
-+        drm_agp_p->unbind_memory(ptr);
-+        drm_agp_p->free_memory(ptr);
- 
-         nv_printf(NV_DBG_INFO, "NVRM: AGPGART: freed %ld pages\n",
-             (unsigned long)pages);
-diff -u NVIDIA_kernel-1.0-4499/os-interface.c NVIDIA_kernel-1.0-4499-2.6/os-interface.c
---- NVIDIA_kernel-1.0-4499/os-interface.c      2003-09-18 00:22:11.000000000 +0000
-+++ NVIDIA_kernel-1.0-4499-2.6/os-interface.c  2003-10-12 01:03:01.000000000 +0000
-@@ -56,7 +56,7 @@
-     PHWINFO pDev
- )
- {
--    return suser();
-+    return NV_IS_SUSER();
- }
- 
- U032 os_get_page_size(VOID)
-@@ -211,6 +211,11 @@
- {
-     NV_MEM_TRACKING_PAD_SIZE(size);
- 
-+    /*
-+     * XXX This needs to be !NV_MAY_SLEEP() rather than in_interrupt(); that
-+     * requires quite a bit of locking to be rearranged, however, which is why
-+     * I'll leave it alone for now.
-+     */
-     if (in_interrupt()) {
-         if (size <= KMALLOC_LIMIT) {
-             /*
-@@ -296,7 +301,7 @@
-     *address = (void *) va;
- 
-     for (i = 0; i < count; i++) {
--        mem_map_reserve(GET_MAP_NR(__pa((va))));
-+        SetPageReserved(virt_to_page(va));
-         va += PAGE_SIZE;
-     }
- 
-@@ -320,7 +325,7 @@
-     unsigned long va = (unsigned long) address;
- 
-     for (i = 0; i < count; i++) {
--        mem_map_unreserve(GET_MAP_NR(__pa((va))));
-+        ClearPageReserved(virt_to_page(va));
-         va += PAGE_SIZE;
-     }
- 
-@@ -426,7 +431,7 @@
-     if (in_irq() && MilliSeconds > NV_MAX_ISR_MDELAY)
-         return RM_ERROR;
- 
--    if (in_interrupt()) 
-+    if (!NV_MAY_SLEEP()) 
-     {
-         mdelay(MilliSeconds);
-         return RM_OK;
-@@ -524,8 +529,8 @@
- // The current debug display level (default to maximum debug level)
- int cur_debuglevel = 0xaaaaaaaa;
- 
--MODULE_PARM(silence_nvidia_output, "1i");
- static int silence_nvidia_output = 0;
-+NV_MODULE_PARAMETER(silence_nvidia_output);
- 
- 
- //
-@@ -708,14 +713,14 @@
- 
- ULONG os_cli(ULONG flags)
- {
--    save_flags(flags);
--    cli();
-+    NV_SAVE_FLAGS(flags);
-+    NV_CLI();
-     return flags;
- }
- 
- ULONG os_sti(ULONG flags)
- {
--    restore_flags(flags);
-+    NV_RESTORE_FLAGS(flags);
-     return flags;
- }
- 
-@@ -848,16 +853,6 @@
-         NV_IOREMAP_NOCACHE(vaddr, start, size_bytes);
-     }
- 
--#if defined (KERNEL_2_2)
--    if ((vaddr == NULL)) // && (mode == NV_MEMORY_DEFAULT))
--    {
--        unsigned long map_nr = MAP_NR(__va(start));
--        if (map_nr < max_mapnr) {
--            vaddr = __va(start);
--        }
--    }
--#endif
--
- #ifdef DEBUG
-     if (mode == NV_MEMORY_WRITECOMBINED) {
-         nv_printf(NV_DBG_ERRORS, 
-@@ -878,16 +873,7 @@
-     U032 size_bytes
- )
- {
--#if defined (KERNEL_2_2)
--    if (MAP_NR(addr) < max_mapnr) {
--        // if we didn't want the memory cached, this isn't necessary
--        // but we shouldn't be in a timing critical piece of code.
--        asm volatile("wbinvd":::"memory");
--    } else 
--#endif
--    {
--        NV_IOUNMAP(addr, size_bytes);
--    }
-+    NV_IOUNMAP(addr, size_bytes);
- }
- 
- VOID* os_map_user_space(
-@@ -991,7 +977,7 @@
- 
- U032 os_get_cpu_count()
- {
--    return smp_num_cpus;
-+    return NV_SMP_NUM_CPUS;
- }
- 
- 
-@@ -1054,12 +1040,15 @@
-     if (sgi_funcs.add_barrier == NULL)
-     {
- #if defined(TESTING_SWAP)
--#if !defined (KERNEL_2_2)
-+        /*
-+         * XXX The inter_module_* mechanism has been deprecated in Linux 2.5, a
-+         * new mechanism is in place; this code will need to be updated at some
-+         * point.
-+         */
-         inter_module_register(ADD_BARRIER_FUNC,    THIS_MODULE, sgitest_add_barrier);
-         inter_module_register(REMOVE_BARRIER_FUNC, THIS_MODULE, sgitest_remove_barrier);
-         inter_module_register(SWAP_READY_FUNC,     THIS_MODULE, sgitest_swap_ready);
- #endif
--#endif
-         sgi_funcs.add_barrier = GET_MODULE_SYMBOL(0, ADD_BARRIER_FUNC);
-         sgi_funcs.remove_barrier = GET_MODULE_SYMBOL(0, REMOVE_BARRIER_FUNC);
-         sgi_funcs.swap_ready = GET_MODULE_SYMBOL(0, SWAP_READY_FUNC);
-diff -u NVIDIA_kernel-1.0-4499/os-registry.c NVIDIA_kernel-1.0-4499-2.6/os-registry.c
---- NVIDIA_kernel-1.0-4499/os-registry.c       2003-09-18 00:22:11.000000000 +0000
-+++ NVIDIA_kernel-1.0-4499-2.6/os-registry.c   2003-10-12 01:03:01.000000000 +0000
-@@ -48,24 +48,6 @@
-  *   This could be changed to work on a per-device basis.
-  */
- 
--/*
-- * The 2nd argument to MODULE_PARM is used to verify parameters passed
-- * to the module at load time. It should be a string in the following 
-- * format:
-- *
-- *    [min[-max]]{b,h,i,l,s}
-- *
-- * The MIN and MAX specifiers delimit the length of the array. If MAX
-- * is omitted, it defaults to MIN; if both are omitted, the default is
-- * 1. The final character is a type specifier.
-- *
-- *  b   byte
-- *  h   short
-- *  i   int
-- *  l   long
-- *  s   string
-- */
--
- /* 
-  * Option: VideoMemoryTypeOverride
-  * 
-@@ -92,7 +74,7 @@
-  */
- 
- static int NVreg_VideoMemoryTypeOverride = 1;
--MODULE_PARM(NVreg_VideoMemoryTypeOverride, "i");
-+NV_MODULE_PARAMETER(NVreg_VideoMemoryTypeOverride);
- 
- /*
-  * Option: EnableVia4x
-@@ -111,7 +93,7 @@
-  */
- 
- static int NVreg_EnableVia4x = 0;
--MODULE_PARM(NVreg_EnableVia4x, "i");
-+NV_MODULE_PARAMETER(NVreg_EnableVia4x);
- 
- /*
-  * Option: EnableALiAGP
-@@ -134,7 +116,7 @@
-  */
- 
- static int NVreg_EnableALiAGP = 0;
--MODULE_PARM(NVreg_EnableALiAGP, "i");
-+NV_MODULE_PARAMETER(NVreg_EnableALiAGP);
- 
- /* 
-  * Option: ReqAGPRate
-@@ -164,7 +146,7 @@
-  */
- 
- static int NVreg_ReqAGPRate = 7;
--MODULE_PARM(NVreg_ReqAGPRate, "i");
-+NV_MODULE_PARAMETER(NVreg_ReqAGPRate);
- 
- /* 
-  * Option: UpdateKernelAGP
-@@ -193,7 +175,7 @@
-  */
- 
- static int NVreg_UpdateKernelAGP = 1;
--MODULE_PARM(NVreg_UpdateKernelAGP, "i");
-+NV_MODULE_PARAMETER(NVreg_UpdateKernelAGP);
- 
- /* 
-  * Option: EnableAGPSBA
-@@ -226,7 +208,7 @@
- static int NVreg_EnableAGPSBA = 0;
- #endif
- 
--MODULE_PARM(NVreg_EnableAGPSBA, "i");
-+NV_MODULE_PARAMETER(NVreg_EnableAGPSBA);
- 
- /*
-  * Option: EnableAGPFW
-@@ -250,7 +232,7 @@
-  */
- 
- static int NVreg_EnableAGPFW = 0;
--MODULE_PARM(NVreg_EnableAGPFW, "i");
-+NV_MODULE_PARAMETER(NVreg_EnableAGPFW);
- 
- /*
-  * Option: SoftEDIDs
-@@ -269,7 +251,7 @@
-  */
- 
- static int NVreg_SoftEDIDs = 1;
--MODULE_PARM(NVreg_SoftEDIDs, "i");
-+NV_MODULE_PARAMETER(NVreg_SoftEDIDs);
- 
- /* 
-  * Option: Mobile
-@@ -293,14 +275,14 @@
-  */
- 
- static int NVreg_Mobile = ~0;
--MODULE_PARM(NVreg_Mobile, "i");
-+NV_MODULE_PARAMETER(NVreg_Mobile);
- 
- 
- static int NVreg_ResmanDebugLevel = ~0;
--MODULE_PARM(NVreg_ResmanDebugLevel, "i");
-+NV_MODULE_PARAMETER(NVreg_ResmanDebugLevel);
- 
- static int NVreg_FlatPanelMode = 0;
--MODULE_PARM(NVreg_FlatPanelMode, "i");
-+NV_MODULE_PARAMETER(NVreg_FlatPanelMode);
- 
- /*
-  * You can enable any of the registry options disabled by default by
diff --git a/media-video/nvidia-kernel/files/1.0.5328/NVIDIA_kernel-1.0-5328-2.4-via-chipset-fix.patch b/media-video/nvidia-kernel/files/1.0.5328/NVIDIA_kernel-1.0-5328-2.4-via-chipset-fix.patch
deleted file mode 100644 (file)
index 611dd2e..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
---- NVIDIA-Linux-x86-1.0-5328-pkg1/usr/src/nv/os-interface.c.orig      2003-12-17 17:54:59.000000000 -0500
-+++ NVIDIA-Linux-x86-1.0-5328-pkg1/usr/src/nv/os-interface.c   2003-12-25 15:19:29.000000000 -0500
-@@ -618,12 +618,28 @@
-     return value;
- }
- 
-+struct pci_dev* nvos_find_agp_by_class(unsigned int);
-+
- U032 os_pci_read_dword(
-     VOID *handle,
-     U008 offset
- ) 
- {
-     U032 value;
-+    if (!handle) {
-+        /*
-+         * XXX: This hack works around a bug in the NVIDIA AGP
-+         * GART driver, which calls us with an invalid handle
-+         * on newer Via chipsets. What we need here instead is
-+         * a handle for the AGP graphics card.
-+         */
-+        handle = nvos_find_agp_by_class(PCI_CLASS_DISPLAY_VGA);
-+
-+        if (!handle) {
-+            printk("NVRM: os_pci_read_dword(): bad handle!\n");
-+            return 0;
-+        }
-+    }
-     pci_read_config_dword( (struct pci_dev *) handle, offset, (u32 *) &value);
-     return value;
- }
diff --git a/media-video/nvidia-kernel/files/1.0.5328/NVIDIA_kernel-1.0-5328-2.6-20031226.diff b/media-video/nvidia-kernel/files/1.0.5328/NVIDIA_kernel-1.0-5328-2.6-20031226.diff
deleted file mode 100644 (file)
index 05de47d..0000000
+++ /dev/null
@@ -1,2479 +0,0 @@
-diff -ruN NVIDIA_kernel-1.0-5328/Makefile NVIDIA_kernel-1.0-5328-2.6/Makefile
---- NVIDIA_kernel-1.0-5328/Makefile    2003-12-17 23:55:01.000000000 +0100
-+++ NVIDIA_kernel-1.0-5328-2.6/Makefile        1970-01-01 01:00:00.000000000 +0100
-@@ -1,141 +0,0 @@
--# This Makefile is automatically generated; do not edit
--#   Generated on 'builder3.nvidia.com' on Wed Dec 17 13:54:52 PST 2003
--
--LINUX_MODULE=nv-linux.o
--DEFINES=-D__KERNEL__ -DMODULE -D_LOOSE_KERNEL_NAMES -DNTRM -D_GNU_SOURCE -D_LOOSE_KERNEL_NAMES -D__KERNEL__ -DMODULE  -DNV_MAJOR_VERSION=1 -DNV_MINOR_VERSION=0 -DNV_PATCHLEVEL=5328  -DNV_UNIX   -DNV_LINUX   -DNV_INT64_OK   -DNVCPU_X86     
--INCLUDES=-I.
--
--OBJECTS=nv.o os-agp.o os-interface.o os-registry.o 
--HEADERS=os-agp.h os-interface.h nv-linux.h nv-misc.h nv-memdbg.h nv.h  rmretval.h nvtypes.h  $(VERSION_HDR)
--
--CFLAGS=-Wall -Wimplicit -Wreturn-type -Wswitch -Wformat -Wchar-subscripts -Wparentheses -Wpointer-arith  -Wno-multichar  -Werror -O -MD $(DEFINES) $(INCLUDES) -Wno-cast-qual -Wno-error
--
--RESMAN_KERNEL_MODULE=nv-kernel.o
--
--KERNDIR=/lib/modules/$(shell uname -r)
--
--# check for newer paths. if found, use them, otherwise use old paths
--# these wouldn't work with the gnu make included with rh6.2
--# KERNINC=$(if -d $(KERNDIR)/build, $(KERNDIR)/build/include, /usr/src/linux/include)
--# INSTALLDIR=$(if -d $(KERNDIR)/kernel, $(KERNDIR)/kernel/drivers/video, $(KERNDIR)/video)
--
--# this is slightly more brain-dead, but works..
--ifeq ($(shell if test -d $(KERNDIR)/build; then echo yes; fi),yes)
--KERNINC=$(KERNDIR)/build/include
--else
--KERNINC=/usr/src/linux/include
--endif
--
--ifeq ($(shell if test -d $(KERNDIR)/kernel; then echo yes; fi),yes)
--INSTALLDIR=$(KERNDIR)/kernel/drivers/video
--else
--INSTALLDIR=$(KERNDIR)/video
--endif
--
--ifeq ($(shell echo $(NVDEBUG)),1)
--  ifeq ($(shell test -z $(RMDEBUG) && echo yes),yes)
--    RMDEBUG=1
--  endif
--endif
--
--ifeq ($(shell echo $(RMDEBUG)),1)
--CFLAGS += -DDEBUG -g -fno-common
--endif
--
--# this is just plain wrong, get rid of it
--BROKENDIR=$(KERNDIR)/kernel/video
--
--INSTALL=$(shell which install)
--
--# allow specification of alternate include file tree on command line and extra defines
--ifdef SYSINCLUDE
--INCLUDES += -I$(SYSINCLUDE)
--else
--INCLUDES += -I$(KERNINC)
--endif
--
--ifeq ($(shell sh conftest.sh remap_page_range $(INCLUDES)), 5)
--  DEFINES += -DREMAP_PAGE_RANGE_5
--endif
--
--ifeq ($(shell sh conftest.sh remap_page_range $(INCLUDES)), 4)
--  DEFINES += -DREMAP_PAGE_RANGE_4
--endif
--
--DEFINES+=$(EXTRA_DEFINES)
--
--# allow build parameters to be passed in through the environment
--ifdef BUILD_PARAMS
--    DEFINES+=-D$(BUILD_PARAMS)
--endif
--
--VERSION_HDR=nv_compiler.h
--
--all: install
--
--install: package-install
--
--package-install: nvidia.o rmmod-check
--      @if [ `id -ur` != 0 ]; then \
--              echo Please run \"make install\" as root.; \
--      else \
--              if [ -d $(BROKENDIR) ]; then \
--                      rm -f $(BROKENDIR)/NVdriver; \
--                      rmdir --ignore-fail-on-non-empty $(BROKENDIR); \
--              fi && \
--              mkdir -p $(INSTALLDIR) && \
--              rm -f $(INSTALLDIR)/NVdriver && \
--              $(INSTALL) -m 0664 -o root -g root nvidia.o $(INSTALLDIR)/nvidia.o$(O) && \
--              PATH="$(PATH):/bin:/sbin" depmod -a && \
--                PATH="$(PATH):/bin:/sbin" modprobe nvidia && \
--              sh makedevices.sh && \
--              echo "nvidia.o installed successfully."; \
--      fi
--
--RMMOD_ERROR=\
--      echo ""; \
--      echo "Unable to remove existing NVIDIA kernel module."; \
--      echo "Please be sure you have exited X before attempting"; \
--      echo "to install the NVIDIA kernel module."; \
--      echo ""; \
--      echo -en "\033[1;31m"; \
--      echo -e  "*** Failed rmmod sanity check. Bailing out! ***"; \
--      echo -en "\033[0m"; \
--      exit 1;
--
--rmmod-check:
--      @if PATH="$(PATH):/bin:/sbin" lsmod | grep -w nvidia > /dev/null; then \
--              if ! PATH="($PATH):/bin:/sbin" rmmod nvidia > /dev/null; then $(RMMOD_ERROR) fi \
--      fi; \
--      if PATH="$(PATH):/bin:/sbin" lsmod | grep -w NVdriver > /dev/null; then \
--              if ! PATH="$(PATH):/bin:/sbin" rmmod NVdriver > /dev/null; then $(RMMOD_ERROR) fi \
--      fi
--
--gcc-check:
--      @if ! sh conftest.sh cc_sanity_check full_output $(CC); then exit 1; fi
--
--nvidia.o: gcc-check $(LINUX_MODULE) $(RESMAN_KERNEL_MODULE) 
--      ld -r -o $@ $(LINUX_MODULE) $(RESMAN_KERNEL_MODULE)
--
--$(VERSION_HDR): 
--      echo \#define NV_COMPILER \"`$(CC) -v 2>&1 | tail -n 1`\" > $@
--
--$(LINUX_MODULE): $(OBJECTS)
--      ld -r -o $@ $(OBJECTS)
--
--%.o: %.c $(HEADERS)
--      $(CC) -c $(CFLAGS) $<
--
--# debug tool to preprocess the file and leave .i to make it easier to untangle #defines
--%.i: %.c
--      $(CC) $(CFLAGS) -E $< > $@
--
--%.s: %.c
--      $(CC) $(CFLAGS) -S $< > $@
--
--
--clean:
--      $(RM) $(OBJECTS) $(LINUX_MODULE) $(VERSION_HDR) *.d NVdriver nvidia.o
--
--
---include $(OBJECTS:%.o=%.d)
-diff -ruN NVIDIA_kernel-1.0-5328/Makefile.kbuild NVIDIA_kernel-1.0-5328-2.6/Makefile.kbuild
---- NVIDIA_kernel-1.0-5328/Makefile.kbuild     1970-01-01 01:00:00.000000000 +0100
-+++ NVIDIA_kernel-1.0-5328-2.6/Makefile.kbuild 2003-12-22 10:52:22.000000000 +0100
-@@ -0,0 +1,245 @@
-+#
-+# KBUILD Makefile for the NVIDIA Linux kernel module.
-+#
-+# The motivation for replacing the original Makefile is the hope that this
-+# version will simplify the build and installation process. In the past,
-+# many architectural and cosmetic changes to the Linux kernel have made it
-+# difficult to maintain compatibility or required duplication of logic.
-+#
-+# Linux 2.5 introduces numerous such changes, many of which impact modules.
-+# Relying on KBUILD, some aspects of the build system otherwise difficult
-+# to support (for example, module versioning) are abstracted away and dealt
-+# with elsewhere, making life significantly easier here.
-+#
-+# The new approach currently has its own share of problems, some of which
-+# are architectural difficulties with KBUILD, others minor annoyances. For
-+# this reason, an improved version of the NVIDIA Makefile is available to
-+# those experiencing difficulties.
-+#
-+# Please report any problems you may be experiencing with this experimental
-+# Makefile to either one (or, preferably, both) of us:
-+#
-+# Alistair J Strachan (alistair@devzero.co.uk) (first pass, enhancements)
-+# Christian Zander (zander@mail.minion.de) (enhancements)
-+#
-+
-+all: install
-+install: package-install
-+
-+#
-+# The NVIDIA kernel module base name and static file names. KBUILD will go
-+# ahead and append ".o" or ".ko" to form the final module name.
-+#
-+
-+MODULE_NAME := nvidia
-+VERSION_HEADER := nv_compiler.h
-+
-+#
-+# List of object files to link into NVIDIA kernel module; make sure KBUILD
-+# understands that we want a module.
-+#
-+
-+RESMAN_CORE_OBJS := nv-kernel.o
-+RESMAN_GLUE_OBJS := nv.o os-agp.o os-interface.o os-registry.o
-+
-+$(MODULE_NAME)-objs := $(RESMAN_CORE_OBJS) $(RESMAN_GLUE_OBJS)
-+
-+#
-+# A bug in KBUILD 2.4 means that leaving obj-m set in top-level context
-+# will cause Rules.make to call pathdown.sh, which is wrong. So, we only
-+# set this conditional of a kernel-level instance.
-+#
-+
-+ifdef TOPDIR
-+obj-m += $(MODULE_NAME).o
-+endif
-+
-+#
-+# Include local source directory in $(CC)'s include path and set disable any
-+# warning types that are of little interest to us.
-+#
-+
-+EXTRA_CFLAGS += -I$(src)
-+EXTRA_CFLAGS += -Wno-cast-qual -Wno-strict-prototypes
-+
-+#
-+# Determine location of the Linux kernel source tree. Allow users to override
-+# the default (i.e. automatically determined) kernel source location with the
-+# KERNDIR directive; this new directive replaces NVIDIA's SYSINCLUDE.
-+#
-+
-+ifdef KERNDIR
-+  KERNEL_SOURCES := $(KERNDIR)
-+  KERNEL_HEADERS := -I$(KERNEL_SOURCES)/include
-+  MODULE_ROOT    := /lib/modules/$(shell uname -r)/kernel/drivers # XXX
-+else
-+  KERNEL_SOURCES := /lib/modules/$(shell uname -r)/build
-+  KERNEL_HEADERS := -I$(KERNEL_SOURCES)/include
-+  MODULE_ROOT    := /lib/modules/$(shell uname -r)/kernel/drivers
-+endif
-+
-+#
-+# We rely on these two definitions below; if they aren't set, we set them to
-+# reasonable defaults (Linux 2.4's KBUILD, and top-level passes will not set
-+# these).
-+#
-+
-+src ?= .
-+obj ?= .
-+
-+#
-+# Sets any internal variables left unset by KBUILD (e.g. this happens during
-+# a top-level run).
-+#
-+
-+TOPDIR ?= $(KERNEL_SOURCES)
-+PATCHLEVEL ?= $(shell sh $(src)/conftest.sh kernel_patch_level $(TOPDIR))
-+
-+#
-+# Linux 2.4 uses the .o module extension. Linux 2.5, however, uses the .ko
-+# module extension. Handle these gracefully.
-+#
-+
-+ifeq ($(PATCHLEVEL), 4)
-+  MODULE_OBJECT := $(MODULE_NAME).o
-+else
-+  MODULE_OBJECT := $(MODULE_NAME).ko
-+endif
-+
-+#
-+# NVIDIA specific CFLAGS and #define's. The remap_page_range check has become
-+# necessary with the introduction of the five argument version to Linux 2.4
-+# distribution kernels; this conflicting change cannot be detected at compile
-+# time.
-+#
-+
-+EXTRA_CFLAGS += -D__KERNEL__ -DMODULE -D_LOOSE_KERNEL_NAMES -DNTRM -D_GNU_SOURCE -D_LOOSE_KERNEL_NAMES -D__KERNEL__ -DMODULE  -DNV_MAJOR_VERSION=1 -DNV_MINOR_VERSION=0 -DNV_PATCHLEVEL=5328  -DNV_UNIX   -DNV_LINUX   -DNV_INT64_OK   -DNVCPU_X86
-+
-+ifeq ($(shell echo $(NVDEBUG)),1)
-+  ifeq ($(shell test -z $(RMDEBUG) && echo yes),yes)
-+    RMDEBUG=1
-+  endif
-+endif
-+
-+ifeq ($(shell echo $(RMDEBUG)),1)
-+  EXTRA_CFLAGS += -DDEBUG -g -fno-common
-+endif
-+
-+ifeq ($(shell sh $(src)/conftest.sh remap_page_range $(KERNEL_HEADERS)), 5)
-+  EXTRA_CFLAGS += -DREMAP_PAGE_RANGE_5
-+endif
-+
-+ifeq ($(shell sh $(src)/conftest.sh remap_page_range $(KERNEL_HEADERS)), 4)
-+  EXTRA_CFLAGS += -DREMAP_PAGE_RANGE_4
-+endif
-+
-+#
-+# NVIDIA binary object file includes .common section.
-+#
-+
-+EXTRA_LDFLAGS := -d
-+
-+#
-+# Miscellaneous NVIDIA kernel module build support targets. They are needed
-+# to satisfy KBUILD requirements and to support NVIDIA specifics.
-+#
-+
-+$(obj)/nv-kernel.o:
-+      cp $(src)/$(RESMAN_CORE_OBJS) $(obj)/$(RESMAN_CORE_OBJS)
-+
-+$(obj)/$(VERSION_HEADER):
-+      echo \#define NV_COMPILER \"`$(CC) -v 2>&1 | tail -n 1`\" > $@
-+
-+$(obj)/nv.o: $(obj)/$(VERSION_HEADER)
-+
-+#
-+# More quirks for Linux 2.4 KBUILD, which doesn't link automatically.
-+#
-+
-+ifeq ($(PATCHLEVEL), 4)
-+$(obj)/$(MODULE_NAME).o: $($(MODULE_NAME)-objs)
-+      $(LD) $(EXTRA_LDFLAGS) -r -o $@ $($(MODULE_NAME)-objs)
-+endif
-+
-+#
-+# KBUILD build parameters.
-+#
-+
-+KBUILD_PARAMS := -C $(KERNEL_SOURCES) SUBDIRS=$(PWD)
-+
-+#
-+# NVIDIA sanity checks.
-+#
-+
-+suser-sanity-check:
-+      @if ! sh conftest.sh suser_sanity_check; then \
-+        echo; \
-+        echo "You have insufficient privileges for this operation. Please "; \
-+        echo "run \"make install\" as root!                               "; \
-+        echo; \
-+        exit 1; \
-+      fi
-+
-+rmmod-sanity-check:
-+      @if ! sh conftest.sh rmmod_sanity_check $(MODULE_NAME); then \
-+        echo; \
-+        echo "Unable to unload the currently loaded NVIDIA kernel module! "; \
-+        echo "Please be certain that you have exited X before attempting  "; \
-+        echo "to install this version.                                    "; \
-+        echo; \
-+        exit 1; \
-+      fi
-+
-+cc-sanity-check:
-+      @if ! sh conftest.sh cc_sanity_check full_output $(CC); then \
-+              exit 1; \
-+      fi
-+
-+#
-+# Build the NVIDIA kernel module using Linux KBUILD. This target is used by
-+# the "package-install" target below.
-+#
-+
-+module: cc-sanity-check
-+      @make $(KBUILD_PARAMS) modules; \
-+      if ! [ -f $(MODULE_OBJECT) ]; then \
-+        echo "$(MODULE_OBJECT) failed to build!"; \
-+        exit 1; \
-+      fi
-+
-+#
-+# Build the NVIDIA kernel module with KBUILD. Verify that the user posesses
-+# sufficient privileges. Rebuild the module dependency file.
-+#
-+
-+module-install: suser-sanity-check module
-+      @mkdir -p $(MODULE_ROOT)/video; \
-+      install -m 0664 -o root -g root $(MODULE_OBJECT) $(MODULE_ROOT)/video; \
-+      /sbin/depmod -ae;
-+
-+#
-+# This target builds, then installs, then creates device nodes and inserts
-+# the module, if successful.
-+#
-+
-+package-install: module-install rmmod-sanity-check
-+      @sh makedevices.sh; \
-+      /sbin/modprobe $(MODULE_NAME) && \
-+      echo "$(MODULE_OBJECT) installed successfully.";
-+
-+#
-+# Support hack, KBUILD isn't prepared to clean up after external modules.
-+#
-+
-+clean:
-+      @rm -f $(RESMAN_GLUE_OBJS) .*.{cmd,flags}
-+      @rm -f $(MODULE_NAME).{o,ko,mod.{o,c}} built-in.o $(VERSION_HEADER) *~
-+
-+#
-+# Linux 2.4 KBUILD requires the inclusion of Rules.make; Linux 2.5's KBUILD
-+# includes dependencies automatically.
-+#
-+
-+ifeq ($(PATCHLEVEL), 4)
-+include $(KERNEL_SOURCES)/Rules.make
-+endif
-diff -ruN NVIDIA_kernel-1.0-5328/Makefile.nvidia NVIDIA_kernel-1.0-5328-2.6/Makefile.nvidia
---- NVIDIA_kernel-1.0-5328/Makefile.nvidia     1970-01-01 01:00:00.000000000 +0100
-+++ NVIDIA_kernel-1.0-5328-2.6/Makefile.nvidia 2003-12-18 13:24:15.000000000 +0100
-@@ -0,0 +1,139 @@
-+# This Makefile is automatically generated; do not edit
-+#   Generated on 'builder3.nvidia.com' on Thu Jun 19 04:05:35 PDT 2003
-+
-+LINUX_MODULE=nv-linux.o
-+DEFINES=-D__KERNEL__ -DMODULE -D_LOOSE_KERNEL_NAMES -DKBUILD_MODNAME="nvidia" -DNTRM -D_GNU_SOURCE -D_LOOSE_KERNEL_NAMES -D__KERNEL__ -DMODULE  -DNV_MAJOR_VERSION=1 -DNV_MINOR_VERSION=0 -DNV_PATCHLEVEL=5328     -DNV_UNIX   -DNV_LINUX   -DNV_INT64_OK   -DNVCPU_X86
-+INCLUDES=-I.
-+
-+OBJECTS=nv.o os-agp.o os-interface.o os-registry.o 
-+HEADERS=os-agp.h os-interface.h nv-linux.h nv-misc.h nv-memdbg.h nv.h  rmretval.h nvtypes.h  $(VERSION_HDR)
-+
-+CFLAGS=-Wall -Wimplicit -Wreturn-type -Wswitch -Wformat -Wchar-subscripts -Wparentheses -Wcast-qual -Wno-multichar  -O -MD $(DEFINES) $(INCLUDES) -Wno-cast-qual
-+
-+RESMAN_KERNEL_MODULE=nv-kernel.o
-+
-+KERNDIR=/lib/modules/$(shell uname -r)
-+
-+# check for newer paths. if found, use them, otherwise use old paths
-+# these wouldn't work with the gnu make included with rh6.2
-+# KERNINC=$(if -d $(KERNDIR)/build, $(KERNDIR)/build/include, /usr/src/linux/include)
-+# INSTALLDIR=$(if -d $(KERNDIR)/kernel, $(KERNDIR)/kernel/drivers/video, $(KERNDIR)/video)
-+
-+# this is slightly more brain-dead, but works..
-+ifeq ($(shell if test -d $(KERNDIR)/build; then echo yes; fi),yes)
-+KERNINC=$(KERNDIR)/build/include
-+else
-+KERNINC=/usr/src/linux/include
-+endif
-+
-+ifeq ($(shell if test -d $(KERNDIR)/kernel; then echo yes; fi),yes)
-+INSTALLDIR=$(KERNDIR)/kernel/drivers/video
-+else
-+INSTALLDIR=$(KERNDIR)/video
-+endif
-+
-+ifeq ($(shell echo $(NVDEBUG)),1)
-+  ifeq ($(shell test -z $(RMDEBUG) && echo yes),yes)
-+    RMDEBUG=1
-+  endif
-+endif
-+
-+ifeq ($(shell echo $(RMDEBUG)),1)
-+CFLAGS += -DDEBUG -g -fno-common
-+endif
-+
-+# this is just plain wrong, get rid of it
-+BROKENDIR=$(KERNDIR)/kernel/video
-+
-+INSTALL=$(shell which install)
-+
-+# allow specification of alternate include file tree on command line and extra defines
-+ifdef SYSINCLUDE
-+INCLUDES += -I$(SYSINCLUDE)
-+INCLUDES += -I$(SYSINCLUDE)/asm/mach-default
-+else
-+INCLUDES += -I$(KERNINC)
-+INCLUDES += -I$(KERNINC)/asm/mach-default
-+endif
-+
-+ifeq ($(shell sh conftest.sh remap_page_range $(INCLUDES)), 5)
-+  DEFINES += -DREMAP_PAGE_RANGE_5
-+endif
-+
-+ifeq ($(shell sh conftest.sh remap_page_range $(INCLUDES)), 4)
-+  DEFINES += -DREMAP_PAGE_RANGE_4
-+endif
-+
-+DEFINES+=$(EXTRA_DEFINES)
-+
-+# allow build parameters to be passed in through the environment
-+ifdef BUILD_PARAMS
-+    DEFINES+=-D$(BUILD_PARAMS)
-+endif
-+
-+VERSION_HDR=nv_compiler.h
-+
-+all: install
-+
-+install: package-install
-+
-+suser-sanity-check:
-+      @if ! sh conftest.sh suser_sanity_check; then \
-+        echo; \
-+        echo "You have insufficient privileges for this operation. Please "; \
-+        echo "run \"make install\" as root!                               "; \
-+        echo; \
-+        exit 1; \
-+      fi
-+
-+rmmod-sanity-check:
-+      @if ! sh conftest.sh rmmod_sanity_check nvidia; then \
-+        echo; \
-+        echo "Unable to unload the currently loaded NVIDIA kernel module! "; \
-+        echo "Please be certain that you have exited X before attempting  "; \
-+        echo "to install this version.                                    "; \
-+        echo; \
-+        exit 1; \
-+      fi
-+
-+cc-sanity-check:
-+      @if ! sh conftest.sh cc_sanity_check full_output $(CC); then exit 1; fi
-+
-+package-install: suser-sanity-check nvidia.o rmmod-sanity-check
-+      if [ -d $(BROKENDIR) ]; then \
-+              rm -f $(BROKENDIR)/NVdriver; \
-+              rmdir --ignore-fail-on-non-empty $(BROKENDIR); \
-+      fi && \
-+      mkdir -p $(INSTALLDIR) && \
-+      rm -f $(INSTALLDIR)/NVdriver && \
-+      $(INSTALL) -m 0664 -o root -g root nvidia.o $(INSTALLDIR)/nvidia.o$(O) && \
-+      /sbin/depmod -a && \
-+      /sbin/modprobe nvidia && \
-+      sh makedevices.sh && \
-+      echo "nvidia.o installed successfully."; \
-+
-+nvidia.o: cc-sanity-check $(LINUX_MODULE) $(RESMAN_KERNEL_MODULE) 
-+      ld -d -r -o $@ $(LINUX_MODULE) $(RESMAN_KERNEL_MODULE)
-+
-+$(VERSION_HDR): 
-+      echo \#define NV_COMPILER \"`$(CC) -v 2>&1 | tail -n 1`\" > $@
-+
-+$(LINUX_MODULE): $(OBJECTS)
-+      ld -r -o $@ $(OBJECTS)
-+
-+%.o: %.c $(HEADERS)
-+      $(CC) -c $(CFLAGS) $<
-+
-+# debug tool to preprocess the file and leave .i to make it easier to untangle #defines
-+%.i: %.c
-+      $(CC) $(CFLAGS) -E $< > $@
-+
-+%.s: %.c
-+      $(CC) $(CFLAGS) -S $< > $@
-+
-+
-+clean:
-+      $(RM) $(OBJECTS) $(LINUX_MODULE) $(VERSION_HDR) *.d NVdriver nvidia.o
-+
-+
-+-include $(OBJECTS:%.o=%.d)
-diff -ruN NVIDIA_kernel-1.0-5328/conftest.sh NVIDIA_kernel-1.0-5328-2.6/conftest.sh
---- NVIDIA_kernel-1.0-5328/conftest.sh 2003-12-17 23:55:00.000000000 +0100
-+++ NVIDIA_kernel-1.0-5328-2.6/conftest.sh     2003-12-18 13:22:54.000000000 +0100
-@@ -104,5 +104,79 @@
-             exit 0
-         fi
-     ;;
-+
-+    cc_sanity_check)
-+        shift
-+        #
-+        # Verify that the same compiler is used for the kernel and kernel
-+        # module.
-+        #
-+        if test -n "$IGNORE_CC_MISMATCH" -o -n "$KERNDIR"; then
-+          #
-+          # The user chose to disable the gcc sanity test or is building
-+          # the module for a kernel not currently running, which renders
-+          # our test meaningless.
-+          #
-+          exit 0
-+        fi
-+
-+        VERSION="^Linux version.* (.*) (\(gcc.*\)).*"
-+        KERNEL=$(cat /proc/version | sed "s/$VERSION/\1/")
-+        MODULE=$($* -v 2>&1 | tail -n 1)
-+
-+        if test "$KERNEL" != "$MODULE"; then
-+          #
-+          # The kernel seems to have been built with a different version
-+          # of the C compiler, which may be a problem.
-+          #
-+          exit 1
-+        else
-+          exit 0
-+        fi
-+    ;;
-+
-+    kernel_patch_level)
-+        shift
-+        #
-+        # Determine the kernel's major patch level; this is only done if we
-+        # aren't told by KBUILD.
-+        #
-+        echo $(cat "$1"/Makefile | grep "PATCHLEVEL =" | cut -d " " -f 3)
-+        exit 0
-+    ;;
-+
-+    suser_sanity_check)
-+        shift
-+        #
-+        # Determine the caller's user id to determine if we have sufficient
-+        # privileges for the requested operation.
-+        #
-+        if test $(id -ur) != 0; then
-+          exit 1
-+        else
-+          exit 0
-+        fi
-+    ;;
-+
-+    rmmod_sanity_check)
-+        shift
-+        #
-+        # Make sure that any currently loaded NVIDIA kernel module can be
-+        # unloaded.
-+        #
-+        if /sbin/lsmod | grep -q "$1"; then
-+          /sbin/rmmod "$1" >& /dev/null
-+        fi
-+
-+        if /sbin/lsmod | grep -q "$1"; then
-+          #
-+          # The NVIDIA kernel module is still loaded, most likely because
-+          # it is busy.
-+          #
-+          exit 1
-+        else
-+          exit 0
-+        fi
-+    ;;
- esac
- 
-diff -ruN NVIDIA_kernel-1.0-5328/makedevices.sh NVIDIA_kernel-1.0-5328-2.6/makedevices.sh
---- NVIDIA_kernel-1.0-5328/makedevices.sh      2003-12-17 23:54:59.000000000 +0100
-+++ NVIDIA_kernel-1.0-5328-2.6/makedevices.sh  2003-12-18 13:22:54.000000000 +0100
-@@ -8,47 +8,49 @@
- # create a temporary file
- tmp=`(mktemp -q /tmp/nvidia.XXXXXX) 2> /dev/null` || tmp="/tmp/nvidia.$$"
- 
--paths=" /etc/modutils/aliases    \
--        /etc/modules.conf        \
--        /etc/conf.modules        "
--
--modconf=""
--for path in $paths; do
--   if [ -f "$path" ]; then
--       modconf=$path
--       break
-+modconfs=" /etc/modutils/aliases    \
-+           /etc/modules.conf        \
-+           /etc/modprobe.d/aliases  \
-+           /etc/modprobe.conf       \
-+           /etc/conf.modules        "
-+
-+#
-+# Pass the -p option to cp to preserve the permissions of $modconf and
-+# /etc/rc.d/rc.modules across the update. Update all relevant files
-+# including those eventually regenerated to avoid the need for awkward
-+# logic here.
-+#
-+for modconf in $modconfs; do
-+   if [ -f "$modconf" ]; then
-+     cp -p $modconf $tmp
-+     sed '/^alias.*\(NVdriver\|nvidia\)/d'  < $modconf   > $tmp
-+
-+     # make sure the last character in the file is a newline
-+     [ `tail -n 1 $tmp | wc -l` = 0 ] && echo "" >> $tmp
-+
-+     if [ -c /dev/.devfsd ]; then
-+       echo "alias /dev/nvidia* nvidia" >> $tmp
-+     else
-+       if [ `uname -r | cut -d '.' -f 2` = 6 ]; then
-+           echo "alias        char-major-195* nvidia" >> $tmp
-+       else
-+           echo "alias        char-major-195  nvidia" >> $tmp
-+       fi
-+     fi
-+     mv -f $tmp $modconf
-+     test -x /sbin/update-modules && /sbin/update-modules
-    fi
- done
- 
--if [ ! -z $modconf ]; then
--   # Initialize the permissions on $tmp so that we don't change the
--   # permissions of $modconf when we mv it into place
--   cp -p $modconf $tmp
--   sed '/^alias.*\(NVdriver\|nvidia\)/d'  < $modconf   > $tmp
--   
--   # make sure the last character in the file is a newline
--   [ `tail -n 1 $tmp | wc -l` = 0 ] && echo "" >> $tmp
--
--   if [ -c /dev/.devfsd ]; then
--     echo "alias /dev/nvidia*   nvidia" >> $tmp
--   else
--     echo "alias char-major-195 nvidia" >> $tmp
--   fi
--   mv -f $tmp $modconf
--   test -x /sbin/update-modules && /sbin/update-modules
--else
--  if [ -f /etc/rc.d/rc.modules ]; then
--    # Initialize the permissions on $tmp so that we don't change the
--    # permissions of /etc/rc.d/rc.modules when we mv it into place
--    cp -p /etc/rc.d/rc.modules $tmp
--    sed '/.*\(NVdriver\|nvidia\).*/d' < /etc/rc.d/rc.modules > $tmp
--
--    # make sure the last character in the file is a newline
--    [ `tail -n 1 $tmp | wc -l` = 0 ] && echo "" >> $tmp 
--
--    echo "/sbin/modprobe nvidia" >> $tmp
--    mv -f $tmp /etc/rc.d/rc.modules
--  fi
-+if [ -f /etc/rc.d/rc.modules ]; then
-+  cp -p /etc/rc.d/rc.modules $tmp
-+  sed '/.*\(NVdriver\|nvidia\).*/d' < /etc/rc.d/rc.modules > $tmp
-+
-+  # make sure the last character in the file is a newline
-+  [ `tail -n 1 $tmp | wc -l` = 0 ] && echo "" >> $tmp
-+
-+  echo -e "\n/sbin/modprobe nvidia" >> $tmp
-+  mv -f $tmp /etc/rc.d/rc.modules
- fi
- 
- if [ ! -c /dev/.devfsd ]; then
-diff -ruN NVIDIA_kernel-1.0-5328/nv-linux.h NVIDIA_kernel-1.0-5328-2.6/nv-linux.h
---- NVIDIA_kernel-1.0-5328/nv-linux.h  2003-12-17 23:55:00.000000000 +0100
-+++ NVIDIA_kernel-1.0-5328-2.6/nv-linux.h      2003-12-23 10:50:21.000000000 +0100
-@@ -21,34 +21,21 @@
- #  define MODVERSIONS
- #endif
- 
--#if defined (MODVERSIONS)
--#include <linux/modversions.h>
--#endif
--
- #include <linux/kernel.h>
- #include <linux/module.h>
- 
--#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 2, 12)
--#  error This driver does not support 2.2.11 or earlier kernels!
--#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 3, 0)
--#  define KERNEL_2_2
--#  warning NVIDIA is considering dropping support for linux-2.2 
--#  warning kernels. While end users are free to maintain their 
--#  warning own patches, or stick with current drivers, our new 
--#  warning drivers will not work "out of the box." If you are 
--#  warning concerned about lack of support for 2.2 kernels, 
--#  warning please let us know at linux-bugs@nvidia.com; we would
--#  warning like to know how many users would be seriously 
--#  warning impacted by this decision.
-+#if   LINUX_VERSION_CODE < KERNEL_VERSION(2, 3, 0)
-+#  error This driver does not support 2.2.x kernels!
- #elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 0)
--#  error This driver does not support 2.3.x development kernels!
-+#  error This driver does not support 2.3.x kernels!
- #elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
- #  define KERNEL_2_4
- #elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
--#  error This driver does not support 2.5.x development kernels!
--#  define KERNEL_2_5
-+#  error This driver does not support 2.5.x kernels!
-+#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 7, 0)
-+#  define KERNEL_2_6
- #else
--#  error This driver does not support 2.6.x or newer kernels!
-+#  error This driver does not support development kernels!
- #endif
- 
- #if defined (__ia64)
-@@ -61,12 +48,15 @@
- #define __SMP__
- #endif
- 
-+#if defined (MODVERSIONS) && !defined (KERNEL_2_6)
-+#include <linux/modversions.h>
-+#endif
-+
- #include <linux/types.h>            /* pic_t, size_t, __u32, etc        */
- #include <linux/errno.h>            /* error codes                      */
- #include <linux/list.h>             /* circular linked list             */
- #include <linux/stddef.h>           /* NULL, offsetof                   */
- #include <linux/wait.h>             /* wait queues                      */
--#include <linux/tqueue.h>           /* struct tq_struct                 */
- 
- #include <linux/slab.h>             /* kmalloc, kfree, etc              */
- #include <linux/vmalloc.h>          /* vmalloc, vfree, etc              */
-@@ -74,9 +64,15 @@
- #include <linux/poll.h>             /* poll_wait                        */
- #include <linux/delay.h>            /* mdelay, udelay                   */
- 
-+#ifdef KERNEL_2_6
-+#include <linux/sched.h>            /* suser(), capable() replacement   */
-+#include <linux/moduleparam.h>      /* module_param()                   */
-+#include <linux/smp_lock.h>         /* kernel_locked                    */
-+#include <asm/kmap_types.h>         /* page table entry lookup          */
-+#endif
-+
- #include <linux/pci.h>              /* pci_find_class, etc              */
--#include <linux/wrapper.h>          /* mem_map_reserve                  */
--#include <linux/interrupt.h>        /* mark_bh, init_bh, remove_bh      */
-+#include <linux/interrupt.h>        /* tasklets, interrupt helpers      */
- #include <linux/timer.h>
- 
- #include <asm/system.h>             /* cli, sli, save_flags             */
-@@ -85,14 +81,9 @@
- #include <asm/page.h>               /* PAGE_OFFSET                      */
- #include <asm/pgtable.h>            /* pte bit definitions              */
- 
--#if !defined (KERNEL_2_2)
- #include <linux/spinlock.h>
- #include <asm/semaphore.h>
- #include <linux/highmem.h>
--#else
--#include <asm/spinlock.h>
--#include <asm/semaphore.h>
--#endif
- 
- #ifdef CONFIG_PROC_FS
- #include <linux/proc_fs.h>
-@@ -299,13 +290,7 @@
-  * DMA use with the hardware.  This has to be done differently for
-  * different platforms and kernel versions.
-  */
--#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 2, 18)
--#define NV_VMALLOC(ptr, size) \
--    { \
--        (void *) (ptr) = vmalloc(size); \
--        VM_ALLOC_RECORD(ptr, size, "vm_alloc"); \
--    }
--#elif defined(NVCPU_IA64)
-+#if defined(NVCPU_IA64)
- #define NV_VMALLOC(ptr, size) \
-     { \
-         (void *) (ptr) = vmalloc_dma(size); \
-@@ -377,78 +362,174 @@
- 
- #endif /* !defined NVWATCH */
- 
-+#define GET_MODULE_SYMBOL(mod,sym)      (const void *) inter_module_get(sym)
-+#define PUT_MODULE_SYMBOL(sym)          (inter_module_put((char *) sym))
- 
--#if !defined (KERNEL_2_2)
--#  define LINUX_VMA_OFFS(vma)           (((vma)->vm_pgoff) << PAGE_SHIFT)
--#  define GET_MODULE_SYMBOL(mod,sym)  (const void *) inter_module_get(sym)
--#  define PUT_MODULE_SYMBOL(sym)        inter_module_put((char *) sym)
--#  define GET_MAP_NR(phys_page)         virt_to_page(__va(phys_page))
--#  define MEM_MAP_READ_COUNT(map_nr)    (atomic_read(&(map_nr)->count))
--#  define MEM_MAP_INC_COUNT(map_nr)     (atomic_inc(&(map_nr)->count))
--#  define MEM_MAP_DEC_COUNT(map_nr)     (atomic_dec(&(map_nr)->count))
--#  define EVENT_QUEUE(ptr)               ((struct __wait_queue_head *)(ptr))
--#  define VMA_PRIVATE(vma)              ((vma)->vm_private_data)
--#  define INIT_EVENT_QUEUE(ptr) \
--     if (ptr == NULL) { \
--        NV_KMALLOC((ptr), sizeof(struct __wait_queue_head)); \
--        if (ptr) { \
--            memset((ptr), 0, sizeof(struct __wait_queue_head)); \
--            init_waitqueue_head((struct __wait_queue_head *)(ptr)); \
--        } \
--     }
--#  define FREE_EVENT_QUEUE(ptr)         NV_KFREE((ptr), sizeof(struct __wait_queue_head)); (ptr) = NULL;
--#else
--#  define in_irq()                      (local_irq_count[smp_processor_id()])
--#  define LINUX_VMA_OFFS(vma)           ((vma)->vm_offset)
--#  define GET_MODULE_SYMBOL(mod, sym)   (void*) get_module_symbol((mod), (sym))
--#  define PUT_MODULE_SYMBOL(sym)
--#  define GET_MAP_NR(phys_page)         MAP_NR(__va(phys_page))
--#  define MEM_MAP_READ_COUNT(map_nr)    (atomic_read(&mem_map[map_nr].count))
--#  define MEM_MAP_INC_COUNT(map_nr)     (atomic_inc(&mem_map[map_nr].count))
--#  define MEM_MAP_DEC_COUNT(map_nr)     (atomic_dec(&mem_map[map_nr].count))
--#  define EVENT_QUEUE(ptr)              ((struct wait_queue **) &(ptr))
--#  define VMA_PRIVATE(vma)              ((void*)((vma)->vm_pte))
--#  define INIT_EVENT_QUEUE(ptr)         if (ptr) { ((ptr) = NULL); }
--#  define FREE_EVENT_QUEUE(ptr)
-+#ifdef KERNEL_2_6
-+# define NV_IS_SUSER()                  capable(CAP_SYS_ADMIN)
-+# define NV_PCI_DEVICE_NAME(x)          ((x)->pretty_name)
-+# define NV_CLI()                       local_irq_disable()
-+# define NV_SAVE_FLAGS(x)               local_save_flags(x)
-+# define NV_RESTORE_FLAGS(x)            local_irq_restore(x)
-+# define NV_MAY_SLEEP()                 (!in_interrupt() && !in_atomic())
-+# define NV_SMP_NUM_CPUS                num_online_cpus()
-+# define NV_MODULE_PARAMETER(x)         module_param(x, int, 0)
-+#else
-+# define NV_IS_SUSER()                  suser()
-+# define NV_PCI_DEVICE_NAME(x)          ((x)->name)
-+# define NV_CLI()                       cli()
-+# define NV_SAVE_FLAGS(x)               save_flags(x)
-+# define NV_RESTORE_FLAGS(x)            restore_flags(x)
-+# define NV_MAY_SLEEP()                 (!in_interrupt())
-+# define NV_SMP_NUM_CPUS                smp_num_cpus
-+# define NV_MODULE_PARAMETER(x)         MODULE_PARM(x, "i")
-+#endif
-+
-+#define NV_DEVICE_NUMBER(x)             minor((x)->i_rdev)
-+#define NV_VMA_OFFSET(x)                (((x)->vm_pgoff) << PAGE_SHIFT)
-+#define NV_VMA_PRIVATE(x)               ((x)->vm_private_data)
-+#define NV_IS_CONTROL_DEVICE(x)         (minor((x)->i_rdev) == 255)
-+
-+#ifndef minor
-+/*
-+ * XXX Is this correct for all possible target kernels? We need this to
-+ * support older 2.4 and some 2.6 kernels.
-+ */
-+# define minor(x) MINOR(x)
-+#endif
-+
-+#ifndef KERNEL_2_6
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 23)
-+  typedef void irqreturn_t;
-+#endif
-+# define IRQ_NONE
-+# define IRQ_RETVAL(x)
-+# define IRQ_HANDLED
-+#else
-+#ifdef AGPGART
-+  typedef struct agp_kern_info agp_kern_info;
-+  typedef struct agp_memory agp_memory;
-+#endif
-+  typedef void* devfs_handle_t;
-+#endif
-+
-+#ifdef KERNEL_2_6
-+#define NV_DEVFS_REGISTER(_name, _minor)                            \
-+({                                                                  \
-+    devfs_handle_t __handle = NULL;                                 \
-+    devfs_mk_cdev(MKDEV(NV_MAJOR_DEVICE_NUMBER, _minor),            \
-+            S_IFCHR | S_IRUGO | S_IWUGO, _name);                    \
-+    __handle;                                                       \
-+})
-+
-+#define NV_DEVFS_REMOVE_DEVICE(i) devfs_remove("nvidia%d", i)
-+#define NV_DEVFS_REMOVE_CONTROL() devfs_remove("nvidiactl")
-+#else
-+#define NV_DEVFS_REGISTER(_name, _minor)                            \
-+({                                                                  \
-+    devfs_handle_t __handle =                                       \
-+        devfs_register(NULL, _name, DEVFS_FL_DEFAULT,               \
-+                NV_MAJOR_DEVICE_NUMBER, _minor,                     \
-+                S_IFCHR | S_IRUGO | S_IWUGO, &nv_fops, NULL);       \
-+    __handle;                                                       \
-+ })
-+
-+#define NV_DEVFS_REMOVE_DEVICE(i) devfs_unregister(nv_devfs_handles[i+1])
-+#define NV_DEVFS_REMOVE_CONTROL() devfs_unregister(nv_devfs_handles[0])
- #endif
- 
-+/*
-+ * Linux 2.5 introduced the five argument version of remap_page_range, all
-+ * relevant releases to date use it. This version was backported to 2.4 by
-+ * RedHat without means to identify the change, hence this hack.
-+ */
-+#ifdef KERNEL_2_6
-+#define NV_REMAP_PAGE_RANGE(a, b...) remap_page_range(vma, a, ## b)
-+#else
- #if defined(REMAP_PAGE_RANGE_5)
--#define NV_REMAP_PAGE_RANGE(a, b...)    remap_page_range(vma, a, ## b)
-+#define NV_REMAP_PAGE_RANGE(a, b...) remap_page_range(vma, a, ## b)
- #elif defined(REMAP_PAGE_RANGE_4)
--#define NV_REMAP_PAGE_RANGE(a, b...)    remap_page_range(a, ## b)
-+#define NV_REMAP_PAGE_RANGE(a, b...) remap_page_range(a, ## b)
- #else
--#error "Couldn't determine number of arguments expected by remap_page_range!"
-+#warning "conftest.sh failed, assuming old Linux 2.4 remap_page_range(4)!"
-+
-+#define NV_REMAP_PAGE_RANGE(a, b...) remap_page_range(a, ## b)
- #endif
-+#endif /* KERNEL_2_6 */
- 
--#if defined(pte_offset_atomic)
--#define NV_PTE_OFFSET(addres, pg_mid_dir, pte) \
-+#if defined(pmd_offset_map)
-+#define NV_PMD_OFFSET(address, pgd, pmd) \
-+    { \
-+        pmd = pmd_offset_map(pgd, address); \
-+    }
-+#define NV_PMD_UNMAP(pmd) \
-     { \
--        pte_t *pte__ = pte_offset_atomic(pg_mid_dir, address); \
--        pte = *pte__; \
--        pte_kunmap(pte__); \
-+        pmd_unmap(pmd); \
-     }
--#elif defined(pte_offset)
--#define NV_PTE_OFFSET(addres, pg_mid_dir, pte) \
--    pte = *pte_offset(pg_mid_dir, address)
- #else
--#define NV_PTE_OFFSET(addres, pg_mid_dir, pte) \
-+#define NV_PMD_OFFSET(address, pgd, pmd) \
-     { \
--        pte_t *pte__ = pte_offset_map(pg_mid_dir, address); \
--        pte = *pte__; \
--        pte_unmap(pte__); \
-+        pmd = pmd_offset(pgd, address); \
-     }
-+#define NV_PMD_UNMAP(pmd)
- #endif
- 
--#define NV_PAGE_ALIGN(addr)             ( ((addr) + PAGE_SIZE - 1) / PAGE_SIZE)
--#define NV_MASK_OFFSET(addr)            ( (addr) & (PAGE_SIZE - 1) )
-+#define NV_PMD_PRESENT(pmd) \
-+    ({ \
-+        if (pmd) { \
-+            if (pmd_none(*pmd)) { \
-+                NV_PMD_UNMAP(pmd); pmd = NULL; \
-+            } \
-+        } pmd != NULL; \
-+    })
- 
--#ifndef MAXMEM  /* temporary define for 2.2 kernels */
--#define MAXMEM  (-PAGE_OFFSET - (64 * 1024 * 1024))
-+#if defined (pte_offset_atomic)
-+#define NV_PTE_OFFSET(address, pmd, pte) \
-+    { \
-+        pte = pte_offset_atomic(pmd, address); \
-+        NV_PMD_UNMAP(pmd); \
-+    }
-+#define NV_PTE_UNMAP(pte) \
-+    { \
-+        pte_kunmap(pte); \
-+    }
-+#elif defined (pte_offset)
-+#define NV_PTE_OFFSET(address, pmd, pte) \
-+    { \
-+        pte = pte_offset(pmd, address); \
-+        NV_PMD_UNMAP(pmd); \
-+    }
-+#define NV_PTE_UNMAP(pte)
-+#else
-+#define NV_PTE_OFFSET(address, pmd, pte) \
-+    { \
-+        pte = pte_offset_map(pmd, address); \
-+        NV_PMD_UNMAP(pmd); \
-+    }
-+#define NV_PTE_UNMAP(pte) \
-+    { \
-+        pte_unmap(pte); \
-+    }
- #endif
- 
--#ifndef NV01_ROOT
--#define NV01_ROOT 0x00000000
--#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_PAGE_ALIGN(addr)             ( ((addr) + PAGE_SIZE - 1) / PAGE_SIZE)
-+#define NV_MASK_OFFSET(addr)            ( (addr) & (PAGE_SIZE - 1) )
- 
- #if defined(NVCPU_IA64)
- #define NV_GFP_HW (GFP_KERNEL | __GFP_DMA)
-@@ -475,7 +556,7 @@
- static inline int NV_IRQL_IS_RAISED()
-     {
-         unsigned long int eflags;
--        __save_flags(eflags);
-+        NV_SAVE_FLAGS(eflags);
-         return !(eflags & NV_CPU_INTERRUPT_FLAGS_BIT);
-     }
-  
-@@ -557,9 +638,10 @@
-     struct pci_dev *dev;
-     nv_alloc_t *alloc_queue;
- 
--    // bottom half interrupt handler info; per device
--    /* keep track of any pending bottom-halves */
--    struct tq_struct *bh;
-+     /* keep track of any pending bottom halfes */
-+     struct tasklet_struct tasklet;
-+
-+     /* active bottom half counter */
-     atomic_t bh_count;
- 
-     /* get a timer callback every second */
-@@ -597,7 +679,7 @@
-     U032 num_events;
-     U032 put, get;
-     spinlock_t fp_lock;
--    void *wqueue;               // wait_queue for polling
-+    wait_queue_head_t waitqueue;
-     nv_event_t *event_fifo;     // fifo for storing events
- } nv_file_private_t;
- 
-diff -ruN NVIDIA_kernel-1.0-5328/nv.c NVIDIA_kernel-1.0-5328-2.6/nv.c
---- NVIDIA_kernel-1.0-5328/nv.c        2003-12-17 23:54:59.000000000 +0100
-+++ NVIDIA_kernel-1.0-5328-2.6/nv.c    2003-12-22 23:31:31.000000000 +0100
-@@ -15,6 +15,7 @@
- #include "nv_compiler.h"
- #include "os-agp.h"
- 
-+MODULE_LICENSE("NVIDIA");
- 
- /*
-  * our global state; one per device
-@@ -33,32 +34,20 @@
-  */
- 
- nv_linux_state_t nv_ctl_device = { { 0 } };
--void *nv_ctl_wqueue = NULL;
-+wait_queue_head_t nv_ctl_waitqueue;
- 
- // keep track of opened clients and their process id so they
- //   can be free'd up on abnormal close
- nv_client_t       nv_clients[NV_MAX_CLIENTS];
--struct tq_struct  nv_bottom_halves[NV_MAX_CLIENTS];
- 
- #ifdef CONFIG_PROC_FS
- struct proc_dir_entry *proc_nvidia;
- #endif
- 
- #ifdef CONFIG_DEVFS_FS
--devfs_handle_t  nv_dev_handle[NV_MAX_DEVICES];
--devfs_handle_t  nv_ctl_handle;
-+devfs_handle_t nv_devfs_handles[NV_MAX_DEVICES+1];
- #endif
- 
--/*
-- * pick apart our minor device number
-- * low 3 bits is NV device
-- * if 255, then its the control device
-- */
--
--#define NV_DEVICE_NUMBER(_minor) ((_minor) & 0x0f)
--#define NV_DEVICE_IS_CONTROL_DEVICE(_minor) \
--             (((_minor) & 0xFF) == 0xFF)
--
- // #define NV_DBG_MEM 1
- #undef NV_DBG_MEM
- 
-@@ -121,10 +110,6 @@
-  *** EXPORTS to Linux Kernel
-  ***/
- 
--/* linux module interface functions (called by linux kernel) */
--int           init_module(void);
--void          cleanup_module(void);
--
- /* nv_kern_ functions, interfaces used by linux kernel */
- void          nv_kern_vma_open(struct vm_area_struct *vma);
- void          nv_kern_vma_release(struct vm_area_struct *vma);
-@@ -135,7 +120,7 @@
- unsigned int  nv_kern_poll(struct file *, poll_table *);
- int           nv_kern_ioctl(struct inode *, struct file *, unsigned int, unsigned long);
- void          nv_kern_bh(void *);
--void          nv_kern_isr(int, void *, struct pt_regs *);
-+irqreturn_t   nv_kern_isr(int, void *, struct pt_regs *);
- void          nv_kern_rc_timer(unsigned long);
- #ifdef CONFIG_PM
- int           nv_kern_pm(struct pm_dev *dev, pm_request_t rqst, void *data);
-@@ -158,6 +143,7 @@
- /* character driver entry points */
- 
- static struct file_operations nv_fops = {
-+    owner:          THIS_MODULE,
-     poll:           nv_kern_poll,
-     ioctl:          nv_kern_ioctl,
-     mmap:           nv_kern_mmap,
-@@ -329,8 +315,8 @@
-     {
-         nv_printf(NV_DBG_MEMINFO, "  0x%x (0x%x): count %d flags 0x%x\n", 
-             page_ptr->phys_addr, page_ptr->dma_addr,
--            (GET_MAP_NR(page_ptr->phys_addr))->count,
--            (GET_MAP_NR(page_ptr->phys_addr))->flags);
-+            (virt_to_page(__va(page_ptr->phys_addr)))->count,
-+            (virt_to_page(__va(page_ptr->phys_addr)))->flags);
-         num_pages--;
-         page_ptr++;
-     }
-@@ -401,7 +387,7 @@
-         phys_addr = virt_to_phys((void *) virt_addr);
- 
-         /* lock the page for dma purposes */
--        mem_map_reserve(GET_MAP_NR(phys_addr));
-+        SetPageReserved(virt_to_page(__va(phys_addr)));
- 
-         page_ptr->phys_addr = phys_addr;
-         page_ptr->virt_addr = virt_addr;
-@@ -447,7 +433,7 @@
-         // but if we failed pci_map_sg, make sure to free this page
-         if (page_ptr->virt_addr)
-         {
--            mem_map_unreserve(GET_MAP_NR(page_ptr->phys_addr));
-+            ClearPageReserved(virt_to_page(__va(page_ptr->phys_addr)));
-             NV_SET_PAGE_ATTRIB_CACHED(page_ptr);
- #if defined(NVCPU_X86_64)
-             // only unmap the page if it really was mapped through
-@@ -481,7 +467,7 @@
- 
-     while (pages_left)
-     {
--        mem_map_unreserve(GET_MAP_NR(page_ptr->phys_addr));
-+        ClearPageReserved(virt_to_page(__va(page_ptr->phys_addr)));
-         page_ptr++;
-         pages_left--;
-     }
-@@ -616,7 +602,7 @@
-     return 0;
- }
- 
--static struct pci_dev* nvos_find_agp_by_class(unsigned int class)
-+struct pci_dev* nvos_find_agp_by_class(unsigned int class)
- {
-     struct pci_dev *dev, *fn;
-     u8     cap_ptr;
-@@ -674,11 +660,6 @@
-     nv_linux_state_t *nvl;
-     nv_linux_state_t *nv_max_devices;
- 
--#if defined (KERNEL_2_2)
--    struct proc_dir_entry *proc_root_driver;
--    proc_root_driver = create_proc_entry("driver", flags, &proc_root);
--#endif
--
-     proc_nvidia = create_proc_entry("nvidia", flags, proc_root_driver);
-     proc_nvidia_cards = create_proc_entry("cards", flags, proc_nvidia);
-     proc_nvidia_agp = create_proc_entry("agp", flags, proc_nvidia);
-@@ -740,9 +721,6 @@
- {
- #ifdef CONFIG_PROC_FS
-     nvos_proc_remove_all(proc_nvidia);
--#if defined (KERNEL_2_2)
--    remove_proc_entry("driver", &proc_root);
--#endif
- #endif
- }
- 
-@@ -831,9 +809,8 @@
-  *** EXPORTS to Linux Kernel
-  ***/
- 
--int init_module(void)
-+static int __init nvidia_init_module(void)
- {
--    nv_linux_state_t *nvl;
-     int rc, i;
- 
-     memset(nv_linux_devices, 0, sizeof(nv_linux_devices));
-@@ -846,7 +823,7 @@
- 
-     nv_printf(NV_DBG_ERRORS, "nvidia: loading %s\n", pNVRM_ID);
- 
--#ifdef CONFIG_DEVFS_FS
-+#if defined(CONFIG_DEVFS_FS) && !defined(KERNEL_2_6)
-     rc = devfs_register_chrdev(nv_major, "nvidia", &nv_fops);
- #else
-     rc = register_chrdev(nv_major, "nvidia", &nv_fops);
-@@ -858,34 +835,35 @@
-     }
- 
- #ifdef CONFIG_DEVFS_FS
--    memset(nv_dev_handle, 0, sizeof(devfs_handle_t) * NV_MAX_DEVICES);
-     do {
-+        /*
-+         * XXX This code isn't pretty, but neither is dealing with the
-+         * various Linux devfs implemenation(s). While Linux APIs are
-+         * known to be anything but stable and oftentimes anything but
-+         * well designed, the devfs interface has been more painful to
-+         * deal with than most other APIs.
-+         */
-         char name[10];
- 
--        nv_ctl_handle = devfs_register(NULL, "nvidiactl",
--                            DEVFS_FL_DEFAULT, nv_major, 255,
--                            S_IFCHR | S_IRUGO | S_IWUGO,
--                            &nv_fops, NULL);
-+        nv_devfs_handles[0] = NV_DEVFS_REGISTER("nvidiactl", 255);
- 
-         for (i = 0; i < num_nv_devices; i++) {
-             sprintf(name, "nvidia%d", i);
--            nv_dev_handle[i] = devfs_register(NULL, name,
--                                  DEVFS_FL_DEFAULT, nv_major, i,
--                                  S_IFCHR | S_IRUGO | S_IWUGO,
--                                  &nv_fops, NULL);
-+            nv_devfs_handles[i+1] = NV_DEVFS_REGISTER(name, i);
-         }
-     } while(0);
- #endif
- 
--    nv_printf(NV_DBG_INFO, "init_module: major number %d\n", nv_major);
-+    nv_printf(NV_DBG_INFO, "nvidia_init_module: major number %d\n", nv_major);
- 
--    // init all the bottom half structures
--    for (nvl = nv_linux_devices; nvl < nv_linux_devices + NV_MAX_DEVICES; nvl++)
--    {
--        nvl->bh = &nv_bottom_halves[nvl - nv_linux_devices];
--        nvl->bh->routine = nv_kern_bh;
--        nvl->bh->data = (void *) nvl;
--        nvl->bh->sync = 0;
-+    /* instantiate tasklets */
-+    for (i = 0; i < NV_MAX_DEVICES; i++) {
-+        /*
-+         * We keep one tasklet per card to avoid latency issues with more
-+         * than one device; no two instances of a single tasklet are ever
-+         * executed concurrently.
-+         */
-+        atomic_set(&nv_linux_devices[i].tasklet.count, 1);
-     }
- 
-     // init the nvidia control device
-@@ -893,6 +871,7 @@
-         nv_state_t *nv_ctl = NV_STATE_PTR(&nv_ctl_device);
-         nv_ctl->os_state = (void *) &nv_ctl_device;
-         nv_lock_init_locks(nv_ctl);
-+        init_waitqueue_head(&nv_ctl_waitqueue);
-     }
- 
- #ifdef CONFIG_PM
-@@ -919,14 +898,14 @@
-     /* create /proc/driver/nvidia */
-     nvos_proc_create();
- 
--#if defined(DEBUG) && !defined(KERNEL_2_2)
-+#if defined(DEBUG)
-     inter_module_register("nv_linux_devices", THIS_MODULE, nv_linux_devices);
- #endif
- 
-     return 0;
- 
-  failed:
--#ifdef CONFIG_DEVFS_FS
-+#if defined(CONFIG_DEVFS_FS) && !defined(KERNEL_2_6)
-     devfs_unregister_chrdev(nv_major, "nvidia");
- #else
-     unregister_chrdev(nv_major, "nvidia");
-@@ -934,26 +913,27 @@
-     return rc;
- }
- 
--void cleanup_module(void)
-+static void __exit nvidia_exit_module(void)
- {
--    int rc, i;
--    nv_linux_state_t *nvl;
--    nv_linux_state_t *max_devices;
-+    int rc;
-+    nv_linux_state_t *nvl, *max_devices;
- 
-     /* remove /proc/driver/nvidia */
-     nvos_proc_remove();
- 
--    nv_printf(NV_DBG_INFO, "cleanup_module\n");
-+    nv_printf(NV_DBG_INFO, "nvidia_exit_module\n");
- 
--#if defined(DEBUG) && !defined(KERNEL_2_2)
-+#if defined(DEBUG)
-     inter_module_unregister("nv_linux_devices");
- #endif
- 
- #ifdef CONFIG_PM
--    for (i = 0; i < num_nv_devices; i++)
--    {
--        pm_unregister(pm_nv_dev[i]);
--    }
-+    do {
-+        int i;
-+        for (i = 0; i < num_nv_devices; i++) {
-+            pm_unregister(pm_nv_dev[i]);
-+        }
-+    } while (0);
- #endif
- 
-     // Shutdown the resource manager
-@@ -972,30 +952,29 @@
-                 continue;
- 
-             nv_printf(NV_DBG_ERRORS,
--                    "still have vm que at cleanup_module(): 0x%x to 0x%x\n",
-+                    "still have vm que at nvidia_exit_module(): 0x%x to 0x%x\n",
-                     nvl->alloc_queue->vma->vm_start,
-                     nvl->alloc_queue->vma->vm_end);
-         }
-     }
- 
--#ifdef CONFIG_DEVFS_FS
-+#if defined(CONFIG_DEVFS_FS) && !defined(KERNEL_2_6)
-     rc = devfs_unregister_chrdev(nv_major, "nvidia");
- #else
-     rc = unregister_chrdev(nv_major, "nvidia");
- #endif
- 
-     if (rc < 0) {
--        nv_printf(NV_DBG_ERRORS, "cleanup_module: unregister nv failed\n");
-+        nv_printf(NV_DBG_ERRORS, "nvidia_exit_module: unregister nv failed\n");
-     }
- 
- #ifdef CONFIG_DEVFS_FS
-     do {
-         int i;
--        for (i = 0; nv_dev_handle[i] != 0; i++) {
--            devfs_unregister(nv_dev_handle[i]);
--        }
--    } while(0);
--    devfs_unregister(nv_ctl_handle);
-+        NV_DEVFS_REMOVE_CONTROL();
-+        for (i = 0; i < num_nv_devices; i++)
-+            NV_DEVFS_REMOVE_DEVICE(i);
-+    } while (0);
- #endif
- 
- #if NV_ENABLE_MEM_TRACKING
-@@ -1007,6 +986,8 @@
- #endif
- }
- 
-+module_init(nvidia_init_module);
-+module_exit(nvidia_exit_module);
- 
- /* this is only called when the vmas are duplicated.
-  * this appears to only happen when the process is cloned to create
-@@ -1020,11 +1001,11 @@
- nv_kern_vma_open(struct vm_area_struct *vma)
- {
-     nv_printf(NV_DBG_MEMINFO, "vma_open for 0x%x - 0x%x, offset 0x%x\n",
--        vma->vm_start, vma->vm_end, LINUX_VMA_OFFS(vma));
-+        vma->vm_start, vma->vm_end, NV_VMA_OFFSET(vma));
- 
--    if (VMA_PRIVATE(vma))
-+    if (NV_VMA_PRIVATE(vma))
-     {
--        nv_alloc_t *at = (nv_alloc_t *) VMA_PRIVATE(vma);
-+        nv_alloc_t *at = (nv_alloc_t *) NV_VMA_PRIVATE(vma);
-         at->usage_count++;
- 
-         nv_printf(NV_DBG_MEMINFO, "  at 0x%x, usage count %d, page_table 0x%x\n",
-@@ -1032,8 +1013,6 @@
- 
-         nvos_list_page_count(at->page_table, at->num_pages);
-     }
--
--    MOD_INC_USE_COUNT;
- }
- 
- 
-@@ -1041,11 +1020,11 @@
- nv_kern_vma_release(struct vm_area_struct *vma)
- {
-     nv_printf(NV_DBG_MEMINFO, "vma_release for 0x%x - 0x%x, offset 0x%x\n",
--        vma->vm_start, vma->vm_end, LINUX_VMA_OFFS(vma));
-+        vma->vm_start, vma->vm_end, NV_VMA_OFFSET(vma));
- 
--    if (VMA_PRIVATE(vma))
-+    if (NV_VMA_PRIVATE(vma))
-     {
--        nv_alloc_t *at = (nv_alloc_t *) VMA_PRIVATE(vma);
-+        nv_alloc_t *at = (nv_alloc_t *) NV_VMA_PRIVATE(vma);
- 
-         at->usage_count--;
- 
-@@ -1063,35 +1042,26 @@
-             if (at->page_table)
-                 nvos_unlock_pages(at);
-             nvos_free_alloc(at);
--            VMA_PRIVATE(vma) = NULL;
-+            NV_VMA_PRIVATE(vma) = NULL;
-         }
-     }
--
--    MOD_DEC_USE_COUNT;
- }
- 
- 
--/* at this point, this code just plain won't work with 2.2 kernels.
-- * additionally, only ia64 & the 460GX need a nopage handler, and 2.2 doesn't
-- * work on ia64 anyways. It's expected that at some point other agp chipsets
-- * will work similar to the 460GX (AGP 3.0 spec), so pre-emptively make sure
-- * this works on our standard ia32 driver.
-- */
--#if !defined(KERNEL_2_2)
--
- /* AGP allocations under the 460GX are not mapped to the aperture
-  * addresses by the CPU.  This nopage handler will fault on CPU
-  * accesses to AGP memory and map the address to the correct page.
-  */
- struct page *nv_kern_vma_nopage(struct vm_area_struct *vma, unsigned long address, int write_access)
- {
-+#if defined(NVCPU_IA64) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 9))
-     nv_alloc_t *at, *tmp;
-     nv_linux_state_t *nvl;
-     nv_state_t *nv;
-     struct page *page_ptr;
-     int rm_status, index;
- 
--    at = VMA_PRIVATE(vma);
-+    at = NV_VMA_PRIVATE(vma);
-     if (at == NULL)
-     {
-         nv_printf(NV_DBG_ERRORS, "NVRM: nopage handler called without an at: "
-@@ -1130,7 +1100,7 @@
-         // far again
-         nv_printf(NV_DBG_ERRORS, "NVRM: nopage handler called on a freed"
-                   "address: vm_start 0x%x, at 0x%x\n", vma->vm_start, at);
--        VMA_PRIVATE(vma) = NULL;
-+        NV_VMA_PRIVATE(vma) = NULL;
-         return NOPAGE_SIGBUS;
-     }
- 
-@@ -1154,15 +1124,14 @@
-     at->page_table[index].virt_addr = (unsigned long) __va(page_to_pfn(page_ptr) << PAGE_SHIFT);
- 
-     return page_ptr;
--}
- #endif
-+    return NOPAGE_SIGBUS;
-+}
- 
- struct vm_operations_struct nv_vm_ops = {
-     nv_kern_vma_open,
-     nv_kern_vma_release,  /* "close" */
--#if !defined(KERNEL_2_2)
-     nv_kern_vma_nopage,
--#endif
- };
- 
- static nv_file_private_t *
-@@ -1177,7 +1146,7 @@
-     memset(nvfp, 0, sizeof(nv_file_private_t));
- 
-     // initialize this file's event queue
--    INIT_EVENT_QUEUE(nvfp->wqueue);
-+    init_waitqueue_head(&nvfp->waitqueue);
- 
-     nv_init_lock(nvfp->fp_lock);
- 
-@@ -1197,7 +1166,6 @@
-     if (nvfp == NULL)
-         return;
- 
--    FREE_EVENT_QUEUE(nvfp->wqueue);
-     NV_VFREE(nvfp->event_fifo, sizeof(nv_event_t) * NV_EVENT_FIFO_SIZE);
-     NV_VFREE(nvfp, sizeof(nv_file_private_t));
- }
-@@ -1226,11 +1194,11 @@
- 
-     /* for control device, just jump to its open routine */
-     /* after setting up the private data */
--    if (NV_DEVICE_IS_CONTROL_DEVICE(inode->i_rdev))
-+    if (NV_IS_CONTROL_DEVICE(inode))
-         return nv_kern_ctl_open(inode, file);
- 
-     /* what device are we talking about? */
--    devnum = NV_DEVICE_NUMBER(inode->i_rdev);
-+    devnum = NV_DEVICE_NUMBER(inode);
-     if (devnum >= NV_MAX_DEVICES)
-     {
-         rc = -ENODEV;
-@@ -1283,12 +1251,14 @@
-             goto failed;
-         }
- 
-+        nvl->tasklet.func = (void *) rm_isr_bh;
-+        nvl->tasklet.data = (unsigned long) nv->pdev;
-+        tasklet_enable(&nvl->tasklet);
- 
-         nv->flags |= NV_FLAG_OPEN;
-     }
- 
-     nv->usage_count++;
--    MOD_INC_USE_COUNT;
- 
-  failed:
-     nv_unlock(nvl->ldata_lock);
-@@ -1319,38 +1289,32 @@
- 
-     /* for control device, just jump to its open routine */
-     /* after setting up the private data */
--    if (NV_DEVICE_IS_CONTROL_DEVICE(inode->i_rdev))
-+    if (NV_IS_CONTROL_DEVICE(inode))
-         return nv_kern_ctl_close(inode, file);
- 
--    nv_printf(NV_DBG_INFO, "nv_kern_close on device %d\n", NV_DEVICE_NUMBER(inode->i_rdev));
-+    nv_printf(NV_DBG_INFO, "nv_kern_close on device %d\n", NV_DEVICE_NUMBER(inode));
- 
-     rm_free_unused_clients(nv, current->pid, (void *) file);
- 
-     nv_lock(nvl->ldata_lock);
-     if (--nv->usage_count == 0)
-     {
--        int counter = 0;
--
--        /* turn off interrupts.
--        ** be careful to make sure any pending bottom half gets run
--        **  or disabled before calling rm_shutdown_adapter() since
--        **  it will free up the pdev.  This is hard to see on single
--        **  cpu systems, but easy on dual cpu :-)
--        */
-+        /*
-+         * The usage count for this device has dropped to zero, it can be shut
-+         * down safely; disable its interrupts.
-+         */
-         rm_disable_adapter(nv);
- 
--        /* give it a moment to allow any bottom half to run */
--
--#define MAX_BH_TASKS 10
--        while (NV_ATOMIC_READ(nvl->bh_count) && (counter < MAX_BH_TASKS))
--        {
--            current->state = TASK_INTERRUPTIBLE;
--            schedule_timeout(HZ/50);
--            counter++;
--        }
-+        /*
-+         * Disable this device's tasklet to make sure that no bottom half will
-+         * run with undefined device state.
-+         */
-+        tasklet_disable(&nvl->tasklet);
- 
--        /* free the irq, which may block until any pending interrupts */
--        /* are done being processed. */
-+        /*
-+         * Free the IRQ, which may block until all pending interrupt processing
-+         * has completed.
-+         */
-         free_irq(nv->interrupt_line, (void *) nv);
- 
-         rm_shutdown_adapter(nv);
-@@ -1381,8 +1345,6 @@
-         FILE_PRIVATE(file) = NULL;
-     }
- 
--    MOD_DEC_USE_COUNT;
--
-     return 0;
- }
- 
-@@ -1399,10 +1361,10 @@
-     nv_printf(NV_DBG_INFO, "mmap([0x%p-0x%p] off=0x%lx)\n",
-         vma->vm_start,
-         vma->vm_end,
--        LINUX_VMA_OFFS(vma));
-+        NV_VMA_OFFSET(vma));
- 
-     // be a bit paranoid for now
--    if ((NV_MASK_OFFSET(LINUX_VMA_OFFS(vma))) ||
-+    if ((NV_MASK_OFFSET(NV_VMA_OFFSET(vma))) ||
-         (NV_MASK_OFFSET(vma->vm_start)) ||
-         (NV_MASK_OFFSET(vma->vm_end)))
-     {
-@@ -1420,7 +1382,7 @@
- 
- 
-     /* NV reg space */
--    if (IS_REG_OFFSET(nv, LINUX_VMA_OFFS(vma), vma->vm_end - vma->vm_start))
-+    if (IS_REG_OFFSET(nv, NV_VMA_OFFSET(vma), vma->vm_end - vma->vm_start))
-     {
-         /* truncate to size of registers */
-         if (pages > nv->regs->size / PAGE_SIZE)
-@@ -1428,7 +1390,7 @@
- 
-         vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
-         if (NV_REMAP_PAGE_RANGE(vma->vm_start,
--                             phys_to_uncached(LINUX_VMA_OFFS(vma)),
-+                             phys_to_uncached(NV_VMA_OFFSET(vma)),
-                              vma->vm_end - vma->vm_start,
-                              vma->vm_page_prot))
-             return -EAGAIN;
-@@ -1438,7 +1400,7 @@
-     }
- 
-     /* NV fb space */
--    else if (IS_FB_OFFSET(nv, LINUX_VMA_OFFS(vma), vma->vm_end - vma->vm_start))
-+    else if (IS_FB_OFFSET(nv, NV_VMA_OFFSET(vma), vma->vm_end - vma->vm_start))
-     {
- 
-         /* truncate to size of framebuffer */
-@@ -1447,7 +1409,7 @@
- 
-         vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
-         if (NV_REMAP_PAGE_RANGE(vma->vm_start,
--                             phys_to_uncached(LINUX_VMA_OFFS(vma)),
-+                             phys_to_uncached(NV_VMA_OFFSET(vma)),
-                              vma->vm_end - vma->vm_start,
-                              vma->vm_page_prot))
-             return -EAGAIN;
-@@ -1457,10 +1419,10 @@
-     }
- 
-     /* AGP allocator */
--    else if (IS_AGP_OFFSET(nv, LINUX_VMA_OFFS(vma), vma->vm_end - vma->vm_start))
-+    else if (IS_AGP_OFFSET(nv, NV_VMA_OFFSET(vma), vma->vm_end - vma->vm_start))
-     {
-         nv_lock(nvl->at_lock);
--        at = nvl_find_alloc(nvl, LINUX_VMA_OFFS(vma), NV_ALLOC_TYPE_AGP);
-+        at = nvl_find_alloc(nvl, NV_VMA_OFFSET(vma), NV_ALLOC_TYPE_AGP);
- 
-         if (at == NULL)
-         {
-@@ -1478,7 +1440,7 @@
-         }
- 
-         at->vma = vma;
--        VMA_PRIVATE(vma) = at;
-+        NV_VMA_PRIVATE(vma) = at;
-         at->usage_count++;
- 
-         if (NV_OSAGP_ENABLED(nv))
-@@ -1502,13 +1464,13 @@
-     }
- 
-     /* Magic allocator */
--    else // if (LINUX_VMA_OFFS(vma) == NV_MMAP_ALLOCATION_OFFSET)
-+    else // if (NV_VMA_OFFSET(vma) == NV_MMAP_ALLOCATION_OFFSET)
-     {
-         unsigned long page = 0, pos, start;
-         int i = 0;
- 
-         nv_lock(nvl->at_lock);
--        at = nvl_find_alloc(nvl, LINUX_VMA_OFFS(vma), NV_ALLOC_TYPE_PCI);
-+        at = nvl_find_alloc(nvl, NV_VMA_OFFSET(vma), NV_ALLOC_TYPE_PCI);
- 
-         if (at == NULL)
-         {
-@@ -1526,7 +1488,7 @@
-         }
- 
-         at->vma = vma;
--        VMA_PRIVATE(vma) = at;
-+        NV_VMA_PRIVATE(vma) = at;
-         at->usage_count++;
- 
-         nv_printf(NV_DBG_INFO, "remapping %d system pages for at 0x%x\n", pages, at);
-@@ -1548,9 +1510,6 @@
- 
-     vma->vm_file = file;
- 
--    /* just increment usage count, rather than calling vma_open */
--    MOD_INC_USE_COUNT;
--
-     return 0;
- }
- 
-@@ -1577,7 +1536,7 @@
-     {
-         nv_printf(NV_DBG_EVENTINFO, "calling poll_wait\n");
-         // add us to the list
--        poll_wait(file, EVENT_QUEUE(nvfp->wqueue), wait);
-+        poll_wait(file, &nvfp->waitqueue, wait);
-     }
- 
-     nv_lock_irq(nvfp->fp_lock, eflags);
-@@ -1645,12 +1604,13 @@
- 
-     switch (_IOC_NR(cmd))
-     {
-+#if !defined(KERNEL_2_6)
-         /* debug tool; zap the module use count so we can unload driver */
-         /*             even if it is confused */
-         case NV_ESC_MODULE_RESET:
-             atomic_set(&__this_module.uc.usecount, 1);
-             break;
--
-+#endif
-         /* pass out info about the card */
-         case NV_ESC_CARD_INFO:
-         {
-@@ -1777,7 +1737,7 @@
-  * driver receives an interrupt
-  *    if someone waiting, then hand it off.
-  */
--void nv_kern_isr(
-+irqreturn_t nv_kern_isr(
-     int   irq,
-     void *arg,
-     struct pt_regs *regs
-@@ -1791,9 +1751,10 @@
-     if (need_to_run_bottom_half)
-     {
-         NV_ATOMIC_INC(nvl->bh_count);
--        queue_task(nvl->bh, &tq_immediate);
--        mark_bh(IMMEDIATE_BH);
-+        tasklet_schedule(&nvl->tasklet);
-     }
-+
-+    return IRQ_HANDLED;
- }
- 
- void nv_kern_bh(
-@@ -1911,11 +1872,9 @@
- 
-     if (nv->usage_count == 0)
-     {
--        INIT_EVENT_QUEUE(nv_ctl_wqueue);
-+        init_waitqueue_head(&nv_ctl_waitqueue);
-     }
- 
--    MOD_INC_USE_COUNT;
--
-     nv->flags |= NV_FLAG_OPEN + NV_FLAG_CONTROL;
- 
-     /* turn off the hotkey occurred bit */
-@@ -1943,10 +1902,8 @@
- 
-     nv_lock(nvl->ldata_lock);
-     if (--nv->usage_count == 0)
--    {
--        FREE_EVENT_QUEUE(nv_ctl_wqueue);
-         nv->flags = 0;
--    }
-+
-     nv_unlock(nvl->ldata_lock);
- 
-     rm_free_unused_clients(nv, current->pid, (void *) file);
-@@ -1957,8 +1914,6 @@
-         FILE_PRIVATE(file) = NULL;
-     }
- 
--    MOD_DEC_USE_COUNT;
--
-     return 0;
- }
- 
-@@ -1982,7 +1937,7 @@
-     nv = NV_STATE_PTR(nvl);
- 
-     if ( !(file->f_flags & O_NONBLOCK) )
--        poll_wait(file, EVENT_QUEUE(nv_ctl_wqueue), wait);
-+        poll_wait(file, &nv_ctl_waitqueue, wait);
- 
-     nv_lock(nvl->ldata_lock);
- 
-@@ -2013,7 +1968,7 @@
-     nv_ctl_device.nv_state.flags |= NV_FLAG_HOTKEY_OCCURRED;
-     nv_unlock(nv_ctl_device.ldata_lock);
- 
--    wake_up_interruptible(EVENT_QUEUE(nv_ctl_wqueue));
-+    wake_up_interruptible(&nv_ctl_waitqueue);
- }
- 
- int nv_kern_read_cardinfo(char *page, char **start, off_t off,
-@@ -2092,7 +2047,7 @@
-         len += sprintf(page+len, "Host Bridge: \t ");
- 
- #if defined(CONFIG_PCI_NAMES)
--        len += sprintf(page+len, "%s\n", dev->name);
-+        len += sprintf(page+len, "%s\n", NV_PCI_DEVICE_NAME(dev));
- #else
-         len += sprintf(page+len, "PCI device %04x:%04x\n",
-                 dev->vendor, dev->device);
-@@ -2304,27 +2259,30 @@
-     int kern
- )
- {
--    pgd_t *pg_dir;
--    pmd_t *pg_mid_dir;
--    pte_t pte;
-+    pgd_t *pgd;
-+    pmd_t *pmd;
-+    pte_t *pte;
-     unsigned long retval;
- 
--    if (kern) pg_dir = pgd_offset_k(address);
--    else      pg_dir = pgd_offset(current->mm, address);
-+    if (kern)
-+        pgd = pgd_offset_k(address);
-+    else
-+        pgd = pgd_offset(current->mm, address);
- 
--    if (pgd_none(*pg_dir))
-+    if (!pgd || pgd_none(*pgd))
-         goto failed;
- 
--    pg_mid_dir = pmd_offset(pg_dir, address);
--    if (pmd_none(*pg_mid_dir))
-+    NV_PMD_OFFSET(address, pgd, pmd);
-+
-+    if (!NV_PMD_PRESENT(pmd))
-         goto failed;
- 
--    NV_PTE_OFFSET(address, pg_mid_dir, pte);
-+    NV_PTE_OFFSET(address, pmd, pte);
- 
--    if (!pte_present(pte))
-+    if (!NV_PTE_PRESENT(pte))
-         goto failed;
- 
--    retval = ((pte_val(pte) & KERN_PAGE_MASK) | NV_MASK_OFFSET(address));
-+    retval = ((NV_PTE_VALUE(pte) & KERN_PAGE_MASK) | NV_MASK_OFFSET(address));
- 
- #if defined(NVCPU_X86_64) && defined(_PAGE_NX)
-     // mask out the non-executable page bit for the true physical address
-@@ -2759,7 +2717,7 @@
- 
-     if (nvfp->num_events == NV_EVENT_FIFO_SIZE)
-     {
--        wake_up_interruptible(EVENT_QUEUE(nvfp->wqueue));
-+        wake_up_interruptible(&nvfp->waitqueue);
-         nv_unlock_irq(nvfp->fp_lock, eflags);
-         return;
-     }
-@@ -2776,7 +2734,7 @@
-     if (nvfp->put >= NV_EVENT_FIFO_SIZE)
-         nvfp->put = 0;
- 
--    wake_up_interruptible(EVENT_QUEUE(nvfp->wqueue));
-+    wake_up_interruptible(&nvfp->waitqueue);
-     nv_unlock_irq(nvfp->fp_lock, eflags);
- }
- 
-@@ -2866,12 +2824,8 @@
-     if ( (NV_AGP_DISABLED(nv)) && (config & NVOS_AGP_CONFIG_NVAGP) )
-     {
-         /* make sure the user does not have agpgart loaded */
--#if !defined (KERNEL_2_2)
-         if (inter_module_get("drm_agp")) {
-             inter_module_put("drm_agp");
--#else
--        if (GET_MODULE_SYMBOL(0, __MODULE_STRING(agp_enable))) {
--#endif
-             nv_printf(NV_DBG_WARNINGS, "NVRM: not using NVAGP, AGPGART is loaded!!\n");
-         } else {
- #if defined(CONFIG_X86_64) && defined(CONFIG_GART_IOMMU)
-diff -ruN NVIDIA_kernel-1.0-5328/os-agp.c NVIDIA_kernel-1.0-5328-2.6/os-agp.c
---- NVIDIA_kernel-1.0-5328/os-agp.c    2003-12-17 23:54:59.000000000 +0100
-+++ NVIDIA_kernel-1.0-5328-2.6/os-agp.c        2003-12-18 13:22:54.000000000 +0100
-@@ -45,44 +45,9 @@
-     int  ready;
- } agp_gart;
- 
--typedef struct {
--    int           (*backend_acquire)(void);
--    void          (*backend_release)(void);
--    void          (*copy_info)(agp_kern_info *);
--    agp_memory *  (*allocate_memory)(size_t, unsigned int);
--    void          (*free_memory)(agp_memory *);
--    int           (*bind_memory)(agp_memory *, off_t);
--    int           (*unbind_memory)(agp_memory *);
--    void          (*enable)(unsigned int);
--} agp_operations_struct;
--
--agp_operations_struct agp_ops;
- agp_kern_info         agpinfo;
- agp_gart              gart;
--#if !defined (KERNEL_2_2)
- const drm_agp_t       *drm_agp_p;
--#endif
--
--#if defined (KERNEL_2_2)
--    #define GET_AGPGART_SYMBOL(sym, sym_string)                     \
--        sym = (void*) GET_MODULE_SYMBOL(0, sym_string);             \
--        if (sym == NULL)                                            \
--        {                                                           \
--            nv_printf(NV_DBG_ERRORS,                                \
--                "NVRM: AGPGART: unable to retrieve symbol %s\n",    \
--                sym_string);                                        \
--            return 1;                                               \
--        }
--
--    #define AGP_BACKEND_ACQUIRE_SYM   __MODULE_STRING(agp_backend_acquire)
--    #define AGP_BACKEND_RELEASE_SYM   __MODULE_STRING(agp_backend_release)
--    #define AGP_COPY_INFO_SYM         __MODULE_STRING(agp_copy_info)
--    #define AGP_ALLOCATE_MEMORY_SYM   __MODULE_STRING(agp_allocate_memory)
--    #define AGP_FREE_MEMORY_SYM       __MODULE_STRING(agp_free_memory)
--    #define AGP_BIND_MEMORY_SYM       __MODULE_STRING(agp_bind_memory)
--    #define AGP_UNBIND_MEMORY_SYM     __MODULE_STRING(agp_unbind_memory)
--    #define AGP_ENABLE_SYM            __MODULE_STRING(agp_enable)
--#endif
- 
- #if defined(CONFIG_MTRR)
- #define MTRR_DEL(gart) if ((gart).mtrr > 0) mtrr_del((gart).mtrr, 0, 0);
-@@ -110,48 +75,18 @@
- 
-     memset( (void *) &gart, 0, sizeof(agp_gart));
- 
--#if !defined (KERNEL_2_2)
-+    /*
-+     * XXX The inter_module_* mechanism has been deprecated and replaced with
-+     * a different mechanism in Linux 2.5; it will go away eventually.
-+     * Also, the Linux 2.5 AGP GART driver is modularized, agpgart.o does not
-+     * include backend drivers.
-+     */
-     if (!(drm_agp_p = inter_module_get_request("drm_agp", "agpgart")))
-     {
-         nv_printf(NV_DBG_ERRORS,
-             "NVRM: AGPGART: unable to retrieve symbol table\n");
-         return 1;
-     }
--    
--    agp_ops.backend_acquire = drm_agp_p->acquire;
--    agp_ops.backend_release = drm_agp_p->release;
--    agp_ops.allocate_memory = drm_agp_p->allocate_memory;
--    agp_ops.free_memory     = drm_agp_p->free_memory;
--    agp_ops.bind_memory     = drm_agp_p->bind_memory;
--    agp_ops.unbind_memory   = drm_agp_p->unbind_memory;
--    agp_ops.enable          = drm_agp_p->enable;
--
--    // looks like some newer kernels (for example mandrake 9.0's 2.4.19-16mdk)
--    // have updated copy_info to return an integer value, and of course didn't
--    // bother bumping the agpgart revision up. The return value is pretty 
--    // harmless (backend_acquire would have already failed and caused us to
--    // bail), so cast the function pointer to avoid compiler warnings.
--    // we may need to revisit this in the future.
--    agp_ops.copy_info       = (void (*)(agp_kern_info *)) drm_agp_p->copy_info;
--
--#else
--#if defined(CONFIG_KMOD)
--    if ( request_module("agpgart") )
--    {
--        nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: not loading agpgart.o\n");
--        return 1;
--    }
--#endif
--
--    GET_AGPGART_SYMBOL(agp_ops.backend_acquire, AGP_BACKEND_ACQUIRE_SYM);
--    GET_AGPGART_SYMBOL(agp_ops.backend_release, AGP_BACKEND_RELEASE_SYM);
--    GET_AGPGART_SYMBOL(agp_ops.copy_info,       AGP_COPY_INFO_SYM);
--    GET_AGPGART_SYMBOL(agp_ops.allocate_memory, AGP_ALLOCATE_MEMORY_SYM);
--    GET_AGPGART_SYMBOL(agp_ops.free_memory,     AGP_FREE_MEMORY_SYM);
--    GET_AGPGART_SYMBOL(agp_ops.bind_memory,     AGP_BIND_MEMORY_SYM);
--    GET_AGPGART_SYMBOL(agp_ops.unbind_memory,   AGP_UNBIND_MEMORY_SYM);
--    GET_AGPGART_SYMBOL(agp_ops.enable,          AGP_ENABLE_SYM);
--#endif
- 
-     /* NOTE: from here down, return an error code of '-1'
-      * that indicates that agpgart is loaded, but we failed to use it
-@@ -159,7 +94,7 @@
-      * the memory controller.
-      */
- 
--    if ( (*(agp_ops.backend_acquire))() )
-+    if (drm_agp_p->acquire())
-     {
-         nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: backend in use\n");
-         return -1;
-@@ -177,7 +112,21 @@
-         agp_fw = 1;
-     agp_fw &= 0x00000001;
-     
--    (*(agp_ops.copy_info))(&agpinfo);
-+#if defined(KERNEL_2_4)
-+    /*
-+     * The original Linux 2.4 AGP GART driver interface declared copy_info to
-+     * return nothing. This changed in Linux 2.5, which reports unsupported
-+     * chipsets via this function. If this Linux 2.4 kernels behaves the same
-+     * way, we have no way to know.
-+     */
-+    drm_agp_p->copy_info(&agpinfo);
-+#else
-+    if (drm_agp_p->copy_info(&agpinfo)) {
-+        drm_agp_p->release();
-+        inter_module_put("drm_agp");
-+        return -1;
-+    }
-+#endif
- 
- #ifdef CONFIG_MTRR
-     if ((gart.mtrr = mtrr_add(agpinfo.aper_base,
-@@ -191,7 +140,8 @@
-          */
-         nv_printf(NV_DBG_ERRORS, 
-             "NVRM: AGPGART: unable to set MTRR write-combining\n");
--        (*(agp_ops.backend_release))();
-+        drm_agp_p->release();
-+        inter_module_put("drm_agp");
-         return -1;
-     }
- #endif
-@@ -207,7 +157,8 @@
-     {
-         nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: unable to remap aperture\n");
-         MTRR_DEL(gart);
--        (*(agp_ops.backend_release))();
-+        drm_agp_p->release();
-+        inter_module_put("drm_agp");
-         return -1;
-     }
- 
-@@ -218,7 +169,8 @@
-         nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: unable to allocate bitmap\n");
-         NV_IOUNMAP(gart.aperture, RM_PAGE_SIZE);
-         MTRR_DEL(gart);
--        (*(agp_ops.backend_release))();
-+        drm_agp_p->release();
-+        inter_module_put("drm_agp");
-         return -1;
-     }
- 
-@@ -229,39 +181,19 @@
-         os_free_mem(bitmap);
-         NV_IOUNMAP(gart.aperture, RM_PAGE_SIZE);
-         MTRR_DEL(gart);
--        (*(agp_ops.backend_release))();
-+        drm_agp_p->release();
-+        inter_module_put("drm_agp");
-         return -1;
-     }
- 
--    nv_printf(NV_DBG_SETUP,
--        "NVRM: AGPGART: aperture: %ldM @ 0x%08lx\n",
--        (unsigned long)agpinfo.aper_size,
--        (unsigned long)agpinfo.aper_base);
--
--    nv_printf(NV_DBG_SETUP, 
--        "NVRM: AGPGART: aperture mapped from 0x%08lx to 0x%08lx\n",
--        agpinfo.aper_base,
--        (unsigned long) gart.aperture);
--
-     if (!agp_sba) agpinfo.mode &= ~0x00000200;
-     if (!agp_fw)  agpinfo.mode &= ~0x00000010;
- 
-     if (!(agp_rate & 0x00000004)) agpinfo.mode &= ~0x00000004;
-     if (!(agp_rate & 0x00000002)) agpinfo.mode &= ~0x00000002;
-     
--    (*(agp_ops.enable))(agpinfo.mode);
-+    drm_agp_p->enable(agpinfo.mode);
-     
--    if (agpinfo.mode & 0x00000200)
--        nv_printf(NV_DBG_SETUP, "NVRM: AGPGART: backend supports sba\n");
--    if (agpinfo.mode & 0x00000010)
--        nv_printf(NV_DBG_SETUP, "NVRM: AGPGART: backend supports fw\n");
--    if (agpinfo.mode & 0x00000004)
--        nv_printf(NV_DBG_SETUP, "NVRM: AGPGART: mode 4x\n");
--    else if (agpinfo.mode & 0x00000002)
--        nv_printf(NV_DBG_SETUP, "NVRM: AGPGART: mode 2x\n");
--    else if (agpinfo.mode & 0x00000001)
--        nv_printf(NV_DBG_SETUP, "NVRM: AGPGART: mode 1x\n");
--
-     *ap_phys_base   = (void*) agpinfo.aper_base;
-     *ap_mapped_base = (void*) gart.aperture;
-     *apsize         = (agpinfo.aper_size * 0x100000) - 1;
-@@ -295,11 +227,13 @@
-         NV_IOUNMAP(gart.aperture, RM_PAGE_SIZE);
-     }
- 
--    (*(agp_ops.backend_release))();
-+    drm_agp_p->release();
- 
--#if !defined (KERNEL_2_2)
-+    /*
-+     * XXX Same as above; the inter_module_* mechanism will go away at some
-+     * point, it has been deprecated in Linux 2.5.
-+     */
-     inter_module_put("drm_agp");
--#endif
- 
-     if (rm_clear_agp_bitmap(nv, &bitmap))
-     {
-@@ -346,7 +280,7 @@
-         return RM_ERROR;
-     }
- 
--    ptr = (*agp_ops.allocate_memory)(PageCount, AGP_NORMAL_MEMORY);
-+    ptr = drm_agp_p->allocate_memory(PageCount, AGP_NORMAL_MEMORY);
-     if (ptr == NULL)
-     {
-         *pAddress = (void*) 0;
-@@ -354,7 +288,7 @@
-         return RM_ERR_NO_FREE_MEM;
-     }
-     
--    err = (*(agp_ops.bind_memory))(ptr, *Offset);
-+    err = drm_agp_p->bind_memory(ptr, *Offset);
-     if (err)
-     {
-         // this happens a lot when the aperture itself fills up..
-@@ -371,7 +305,7 @@
-     if (status != RM_OK)
-     {
-         nv_printf(NV_DBG_ERRORS, "NVRM: memory allocation failed\n");
--        (*(agp_ops.unbind_memory))(ptr);
-+        drm_agp_p->unbind_memory(ptr);
-         goto fail;
-     }
- 
-@@ -386,7 +320,7 @@
-     return RM_OK;
- 
- fail:
--    (*(agp_ops.free_memory))(ptr);
-+    drm_agp_p->free_memory(ptr);
-     *pAddress = (void*) 0;
- 
-     return RM_ERROR;
-@@ -426,7 +360,7 @@
-     {
-         nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: unable to remap %lu pages\n",
-             (unsigned long)agp_data->num_pages);
--        (*(agp_ops.unbind_memory))(agp_data->ptr);
-+        drm_agp_p->unbind_memory(agp_data->ptr);
-         goto fail;
-     }
-     
-@@ -445,8 +379,6 @@
- }
- #endif
- 
--#if !defined(KERNEL_2_2)
--
- RM_STATUS 
- KernMapAGPNopage(
-     VOID *address,
-@@ -501,9 +433,6 @@
- #endif
- }
- 
--#endif /* !defined(KERNEL_2_2) */
--
--
- RM_STATUS KernFreeAGPPages(
-     nv_state_t *nv,
-     VOID **pAddress,
-@@ -529,8 +458,8 @@
-     {
-         size_t pages = ptr->page_count;
- 
--        (*(agp_ops.unbind_memory))(ptr);
--        (*(agp_ops.free_memory))(ptr);
-+        drm_agp_p->unbind_memory(ptr);
-+        drm_agp_p->free_memory(ptr);
- 
-         nv_printf(NV_DBG_INFO, "NVRM: AGPGART: freed %ld pages\n",
-             (unsigned long)pages);
-diff -ruN NVIDIA_kernel-1.0-5328/os-interface.c NVIDIA_kernel-1.0-5328-2.6/os-interface.c
---- NVIDIA_kernel-1.0-5328/os-interface.c      2003-12-17 23:54:59.000000000 +0100
-+++ NVIDIA_kernel-1.0-5328-2.6/os-interface.c  2003-12-23 10:46:50.000000000 +0100
-@@ -56,7 +56,7 @@
-     PHWINFO pDev
- )
- {
--    return suser();
-+    return NV_IS_SUSER();
- }
- 
- U032 os_get_page_size(VOID)
-@@ -211,6 +211,11 @@
- {
-     NV_MEM_TRACKING_PAD_SIZE(size);
- 
-+    /*
-+     * XXX This needs to be !NV_MAY_SLEEP() rather than in_interrupt(); that
-+     * requires quite a bit of locking to be rearranged, however, which is why
-+     * I'll leave it alone for now.
-+     */
-     if (in_interrupt()) {
-         if (size <= KMALLOC_LIMIT) {
-             /*
-@@ -296,7 +301,7 @@
-     *address = (void *) va;
- 
-     for (i = 0; i < count; i++) {
--        mem_map_reserve(GET_MAP_NR(__pa((va))));
-+        SetPageReserved(virt_to_page(va));
-         va += PAGE_SIZE;
-     }
- 
-@@ -320,7 +325,7 @@
-     unsigned long va = (unsigned long) address;
- 
-     for (i = 0; i < count; i++) {
--        mem_map_unreserve(GET_MAP_NR(__pa((va))));
-+        ClearPageReserved(virt_to_page(va));
-         va += PAGE_SIZE;
-     }
- 
-@@ -426,7 +431,7 @@
-     if (in_irq() && MilliSeconds > NV_MAX_ISR_MDELAY)
-         return RM_ERROR;
- 
--    if (in_interrupt()) 
-+    if (!NV_MAY_SLEEP()) 
-     {
-         mdelay(MilliSeconds);
-         return RM_OK;
-@@ -524,8 +529,8 @@
- // The current debug display level (default to maximum debug level)
- int cur_debuglevel = 0xaaaaaaaa;
- 
--MODULE_PARM(silence_nvidia_output, "1i");
- static int silence_nvidia_output = 0;
-+NV_MODULE_PARAMETER(silence_nvidia_output);
- 
- 
- //
-@@ -618,12 +623,28 @@
-     return value;
- }
- 
-+struct pci_dev* nvos_find_agp_by_class(unsigned int);
-+
- U032 os_pci_read_dword(
-     VOID *handle,
-     U008 offset
- ) 
- {
-     U032 value;
-+    if (!handle) {
-+        /*
-+         * XXX: This hack works around a bug in the NVIDIA AGP
-+         * GART driver, which calls us with an invalid handle
-+         * on newer Via chipsets. What we need here instead is
-+         * a handle for the AGP graphics card.
-+         */
-+        handle = nvos_find_agp_by_class(PCI_CLASS_DISPLAY_VGA);
-+
-+        if (!handle) {
-+            printk("NVRM: os_pci_read_dword(): bad handle!\n");
-+            return 0;
-+        }
-+    }
-     pci_read_config_dword( (struct pci_dev *) handle, offset, (u32 *) &value);
-     return value;
- }
-@@ -708,14 +729,14 @@
- 
- ULONG os_cli(ULONG flags)
- {
--    save_flags(flags);
--    cli();
-+    NV_SAVE_FLAGS(flags);
-+    NV_CLI();
-     return flags;
- }
- 
- ULONG os_sti(ULONG flags)
- {
--    restore_flags(flags);
-+    NV_RESTORE_FLAGS(flags);
-     return flags;
- }
- 
-@@ -848,16 +869,6 @@
-         NV_IOREMAP_NOCACHE(vaddr, start, size_bytes);
-     }
- 
--#if defined (KERNEL_2_2)
--    if ((vaddr == NULL)) // && (mode == NV_MEMORY_DEFAULT))
--    {
--        unsigned long map_nr = MAP_NR(__va(start));
--        if (map_nr < max_mapnr) {
--            vaddr = __va(start);
--        }
--    }
--#endif
--
-     return vaddr;
- }
- 
-@@ -866,16 +877,7 @@
-     U032 size_bytes
- )
- {
--#if defined (KERNEL_2_2)
--    if (MAP_NR(addr) < max_mapnr) {
--        // if we didn't want the memory cached, this isn't necessary
--        // but we shouldn't be in a timing critical piece of code.
--        asm volatile("wbinvd":::"memory");
--    } else 
--#endif
--    {
--        NV_IOUNMAP(addr, size_bytes);
--    }
-+    NV_IOUNMAP(addr, size_bytes);
- }
- 
- VOID* os_map_user_space(
-@@ -979,7 +981,7 @@
- 
- U032 os_get_cpu_count()
- {
--    return smp_num_cpus;
-+    return NV_SMP_NUM_CPUS;
- }
- 
- #if defined(DEBUG) && !defined(NVCPU_IA64)
-diff -ruN NVIDIA_kernel-1.0-5328/os-registry.c NVIDIA_kernel-1.0-5328-2.6/os-registry.c
---- NVIDIA_kernel-1.0-5328/os-registry.c       2003-12-17 23:54:59.000000000 +0100
-+++ NVIDIA_kernel-1.0-5328-2.6/os-registry.c   2003-12-18 13:22:54.000000000 +0100
-@@ -48,24 +48,6 @@
-  *   This could be changed to work on a per-device basis.
-  */
- 
--/*
-- * The 2nd argument to MODULE_PARM is used to verify parameters passed
-- * to the module at load time. It should be a string in the following 
-- * format:
-- *
-- *    [min[-max]]{b,h,i,l,s}
-- *
-- * The MIN and MAX specifiers delimit the length of the array. If MAX
-- * is omitted, it defaults to MIN; if both are omitted, the default is
-- * 1. The final character is a type specifier.
-- *
-- *  b   byte
-- *  h   short
-- *  i   int
-- *  l   long
-- *  s   string
-- */
--
- /* 
-  * Option: VideoMemoryTypeOverride
-  * 
-@@ -92,7 +74,7 @@
-  */
- 
- static int NVreg_VideoMemoryTypeOverride = 1;
--MODULE_PARM(NVreg_VideoMemoryTypeOverride, "i");
-+NV_MODULE_PARAMETER(NVreg_VideoMemoryTypeOverride);
- 
- /*
-  * Option: EnableVia4x
-@@ -111,7 +93,7 @@
-  */
- 
- static int NVreg_EnableVia4x = 0;
--MODULE_PARM(NVreg_EnableVia4x, "i");
-+NV_MODULE_PARAMETER(NVreg_EnableVia4x);
- 
- /*
-  * Option: EnableALiAGP
-@@ -134,7 +116,7 @@
-  */
- 
- static int NVreg_EnableALiAGP = 0;
--MODULE_PARM(NVreg_EnableALiAGP, "i");
-+NV_MODULE_PARAMETER(NVreg_EnableALiAGP);
- 
- /* 
-  * Option: ReqAGPRate
-@@ -164,7 +146,7 @@
-  */
- 
- static int NVreg_ReqAGPRate = 7;
--MODULE_PARM(NVreg_ReqAGPRate, "i");
-+NV_MODULE_PARAMETER(NVreg_ReqAGPRate);
- 
- /* 
-  * Option: UpdateKernelAGP
-@@ -193,7 +175,7 @@
-  */
- 
- static int NVreg_UpdateKernelAGP = 1;
--MODULE_PARM(NVreg_UpdateKernelAGP, "i");
-+NV_MODULE_PARAMETER(NVreg_UpdateKernelAGP);
- 
- /* 
-  * Option: EnableAGPSBA
-@@ -226,7 +208,7 @@
- static int NVreg_EnableAGPSBA = 0;
- #endif
- 
--MODULE_PARM(NVreg_EnableAGPSBA, "i");
-+NV_MODULE_PARAMETER(NVreg_EnableAGPSBA);
- 
- /*
-  * Option: EnableAGPFW
-@@ -250,7 +232,7 @@
-  */
- 
- static int NVreg_EnableAGPFW = 0;
--MODULE_PARM(NVreg_EnableAGPFW, "i");
-+NV_MODULE_PARAMETER(NVreg_EnableAGPFW);
- 
- /*
-  * Option: SoftEDIDs
-@@ -269,7 +251,7 @@
-  */
- 
- static int NVreg_SoftEDIDs = 1;
--MODULE_PARM(NVreg_SoftEDIDs, "i");
-+NV_MODULE_PARAMETER(NVreg_SoftEDIDs);
- 
- /* 
-  * Option: Mobile
-@@ -293,14 +275,14 @@
-  */
- 
- static int NVreg_Mobile = ~0;
--MODULE_PARM(NVreg_Mobile, "i");
-+NV_MODULE_PARAMETER(NVreg_Mobile);
- 
- 
- static int NVreg_ResmanDebugLevel = ~0;
--MODULE_PARM(NVreg_ResmanDebugLevel, "i");
-+NV_MODULE_PARAMETER(NVreg_ResmanDebugLevel);
- 
- static int NVreg_FlatPanelMode = 0;
--MODULE_PARM(NVreg_FlatPanelMode, "i");
-+NV_MODULE_PARAMETER(NVreg_FlatPanelMode);
- 
- /*
-  * You can enable any of the registry options disabled by default by
diff --git a/media-video/nvidia-kernel/files/1.0.5328/NVIDIA_kernel-1.0-5328-2.6-20040105.diff b/media-video/nvidia-kernel/files/1.0.5328/NVIDIA_kernel-1.0-5328-2.6-20040105.diff
deleted file mode 100644 (file)
index 300cbd0..0000000
+++ /dev/null
@@ -1,2808 +0,0 @@
-diff -ruN NVIDIA_kernel-1.0-5328/Makefile NVIDIA_kernel-1.0-5328-2.6/Makefile
---- NVIDIA_kernel-1.0-5328/Makefile    2003-12-17 23:55:01.000000000 +0100
-+++ NVIDIA_kernel-1.0-5328-2.6/Makefile        1970-01-01 01:00:00.000000000 +0100
-@@ -1,141 +0,0 @@
--# This Makefile is automatically generated; do not edit
--#   Generated on 'builder3.nvidia.com' on Wed Dec 17 13:54:52 PST 2003
--
--LINUX_MODULE=nv-linux.o
--DEFINES=-D__KERNEL__ -DMODULE -D_LOOSE_KERNEL_NAMES -DNTRM -D_GNU_SOURCE -D_LOOSE_KERNEL_NAMES -D__KERNEL__ -DMODULE  -DNV_MAJOR_VERSION=1 -DNV_MINOR_VERSION=0 -DNV_PATCHLEVEL=5328  -DNV_UNIX   -DNV_LINUX   -DNV_INT64_OK   -DNVCPU_X86     
--INCLUDES=-I.
--
--OBJECTS=nv.o os-agp.o os-interface.o os-registry.o 
--HEADERS=os-agp.h os-interface.h nv-linux.h nv-misc.h nv-memdbg.h nv.h  rmretval.h nvtypes.h  $(VERSION_HDR)
--
--CFLAGS=-Wall -Wimplicit -Wreturn-type -Wswitch -Wformat -Wchar-subscripts -Wparentheses -Wpointer-arith  -Wno-multichar  -Werror -O -MD $(DEFINES) $(INCLUDES) -Wno-cast-qual -Wno-error
--
--RESMAN_KERNEL_MODULE=nv-kernel.o
--
--KERNDIR=/lib/modules/$(shell uname -r)
--
--# check for newer paths. if found, use them, otherwise use old paths
--# these wouldn't work with the gnu make included with rh6.2
--# KERNINC=$(if -d $(KERNDIR)/build, $(KERNDIR)/build/include, /usr/src/linux/include)
--# INSTALLDIR=$(if -d $(KERNDIR)/kernel, $(KERNDIR)/kernel/drivers/video, $(KERNDIR)/video)
--
--# this is slightly more brain-dead, but works..
--ifeq ($(shell if test -d $(KERNDIR)/build; then echo yes; fi),yes)
--KERNINC=$(KERNDIR)/build/include
--else
--KERNINC=/usr/src/linux/include
--endif
--
--ifeq ($(shell if test -d $(KERNDIR)/kernel; then echo yes; fi),yes)
--INSTALLDIR=$(KERNDIR)/kernel/drivers/video
--else
--INSTALLDIR=$(KERNDIR)/video
--endif
--
--ifeq ($(shell echo $(NVDEBUG)),1)
--  ifeq ($(shell test -z $(RMDEBUG) && echo yes),yes)
--    RMDEBUG=1
--  endif
--endif
--
--ifeq ($(shell echo $(RMDEBUG)),1)
--CFLAGS += -DDEBUG -g -fno-common
--endif
--
--# this is just plain wrong, get rid of it
--BROKENDIR=$(KERNDIR)/kernel/video
--
--INSTALL=$(shell which install)
--
--# allow specification of alternate include file tree on command line and extra defines
--ifdef SYSINCLUDE
--INCLUDES += -I$(SYSINCLUDE)
--else
--INCLUDES += -I$(KERNINC)
--endif
--
--ifeq ($(shell sh conftest.sh remap_page_range $(INCLUDES)), 5)
--  DEFINES += -DREMAP_PAGE_RANGE_5
--endif
--
--ifeq ($(shell sh conftest.sh remap_page_range $(INCLUDES)), 4)
--  DEFINES += -DREMAP_PAGE_RANGE_4
--endif
--
--DEFINES+=$(EXTRA_DEFINES)
--
--# allow build parameters to be passed in through the environment
--ifdef BUILD_PARAMS
--    DEFINES+=-D$(BUILD_PARAMS)
--endif
--
--VERSION_HDR=nv_compiler.h
--
--all: install
--
--install: package-install
--
--package-install: nvidia.o rmmod-check
--      @if [ `id -ur` != 0 ]; then \
--              echo Please run \"make install\" as root.; \
--      else \
--              if [ -d $(BROKENDIR) ]; then \
--                      rm -f $(BROKENDIR)/NVdriver; \
--                      rmdir --ignore-fail-on-non-empty $(BROKENDIR); \
--              fi && \
--              mkdir -p $(INSTALLDIR) && \
--              rm -f $(INSTALLDIR)/NVdriver && \
--              $(INSTALL) -m 0664 -o root -g root nvidia.o $(INSTALLDIR)/nvidia.o$(O) && \
--              PATH="$(PATH):/bin:/sbin" depmod -a && \
--                PATH="$(PATH):/bin:/sbin" modprobe nvidia && \
--              sh makedevices.sh && \
--              echo "nvidia.o installed successfully."; \
--      fi
--
--RMMOD_ERROR=\
--      echo ""; \
--      echo "Unable to remove existing NVIDIA kernel module."; \
--      echo "Please be sure you have exited X before attempting"; \
--      echo "to install the NVIDIA kernel module."; \
--      echo ""; \
--      echo -en "\033[1;31m"; \
--      echo -e  "*** Failed rmmod sanity check. Bailing out! ***"; \
--      echo -en "\033[0m"; \
--      exit 1;
--
--rmmod-check:
--      @if PATH="$(PATH):/bin:/sbin" lsmod | grep -w nvidia > /dev/null; then \
--              if ! PATH="($PATH):/bin:/sbin" rmmod nvidia > /dev/null; then $(RMMOD_ERROR) fi \
--      fi; \
--      if PATH="$(PATH):/bin:/sbin" lsmod | grep -w NVdriver > /dev/null; then \
--              if ! PATH="$(PATH):/bin:/sbin" rmmod NVdriver > /dev/null; then $(RMMOD_ERROR) fi \
--      fi
--
--gcc-check:
--      @if ! sh conftest.sh cc_sanity_check full_output $(CC); then exit 1; fi
--
--nvidia.o: gcc-check $(LINUX_MODULE) $(RESMAN_KERNEL_MODULE) 
--      ld -r -o $@ $(LINUX_MODULE) $(RESMAN_KERNEL_MODULE)
--
--$(VERSION_HDR): 
--      echo \#define NV_COMPILER \"`$(CC) -v 2>&1 | tail -n 1`\" > $@
--
--$(LINUX_MODULE): $(OBJECTS)
--      ld -r -o $@ $(OBJECTS)
--
--%.o: %.c $(HEADERS)
--      $(CC) -c $(CFLAGS) $<
--
--# debug tool to preprocess the file and leave .i to make it easier to untangle #defines
--%.i: %.c
--      $(CC) $(CFLAGS) -E $< > $@
--
--%.s: %.c
--      $(CC) $(CFLAGS) -S $< > $@
--
--
--clean:
--      $(RM) $(OBJECTS) $(LINUX_MODULE) $(VERSION_HDR) *.d NVdriver nvidia.o
--
--
---include $(OBJECTS:%.o=%.d)
-diff -ruN NVIDIA_kernel-1.0-5328/Makefile.kbuild NVIDIA_kernel-1.0-5328-2.6/Makefile.kbuild
---- NVIDIA_kernel-1.0-5328/Makefile.kbuild     1970-01-01 01:00:00.000000000 +0100
-+++ NVIDIA_kernel-1.0-5328-2.6/Makefile.kbuild 2003-12-31 12:44:13.000000000 +0100
-@@ -0,0 +1,261 @@
-+#
-+# KBUILD Makefile for the NVIDIA Linux kernel module.
-+#
-+# The motivation for replacing the original Makefile is the hope that this
-+# version will simplify the build and installation process. In the past,
-+# many architectural and cosmetic changes to the Linux kernel have made it
-+# difficult to maintain compatibility or required duplication of logic.
-+#
-+# Linux 2.5 introduces numerous such changes, many of which impact modules.
-+# Relying on KBUILD, some aspects of the build system otherwise difficult
-+# to support (for example, module versioning) are abstracted away and dealt
-+# with elsewhere, making life significantly easier here.
-+#
-+# The new approach currently has its own share of problems, some of which
-+# are architectural difficulties with KBUILD, others minor annoyances. For
-+# this reason, an improved version of the NVIDIA Makefile is available to
-+# those experiencing difficulties.
-+#
-+# Please report any problems you may be experiencing with this experimental
-+# Makefile to either one (or, preferably, both) of us:
-+#
-+# Alistair J Strachan (alistair@devzero.co.uk) (first pass, enhancements)
-+# Christian Zander (zander@mail.minion.de) (enhancements)
-+#
-+
-+all: install
-+install: package-install
-+
-+#
-+# The NVIDIA kernel module base name and static file names. KBUILD will go
-+# ahead and append ".o" or ".ko" to form the final module name.
-+#
-+
-+MODULE_NAME := nvidia
-+VERSION_HEADER := nv_compiler.h
-+
-+#
-+# List of object files to link into NVIDIA kernel module; make sure KBUILD
-+# understands that we want a module.
-+#
-+
-+RESMAN_CORE_OBJS := nv-kernel.o
-+RESMAN_GLUE_OBJS := nv.o os-agp.o os-interface.o os-registry.o
-+
-+$(MODULE_NAME)-objs := $(RESMAN_CORE_OBJS) $(RESMAN_GLUE_OBJS)
-+
-+#
-+# The precompiled kernel module build process requires a separation of the
-+# closed source and open source object files.
-+#
-+
-+KERNEL_GLUE_NAME := nv-linux.o
-+KERNEL_GLUE_OBJS := $(RESMAN_GLUE_OBJS) $(MODULE_NAME).mod.o
-+
-+#
-+# A bug in KBUILD 2.4 means that leaving obj-m set in top-level context
-+# will cause Rules.make to call pathdown.sh, which is wrong. So, we only
-+# set this conditional of a kernel-level instance.
-+#
-+
-+ifdef TOPDIR
-+obj-m += $(MODULE_NAME).o
-+endif
-+
-+#
-+# Include local source directory in $(CC)'s include path and set disable any
-+# warning types that are of little interest to us.
-+#
-+
-+EXTRA_CFLAGS += -I$(src)
-+EXTRA_CFLAGS += -Wno-cast-qual -Wno-strict-prototypes
-+
-+#
-+# Determine location of the Linux kernel source tree. Allow users to override
-+# the default (i.e. automatically determined) kernel source location with the
-+# SYSSRC directive; this new directive replaces NVIDIA's SYSINCLUDE.
-+#
-+
-+ifdef SYSSRC
-+  KERNEL_SOURCES := $(SYSSRC)
-+  KERNEL_HEADERS := -I$(KERNEL_SOURCES)/include
-+  MODULE_ROOT    := /lib/modules/$(shell uname -r)/kernel/drivers # XXX
-+else
-+  KERNEL_SOURCES := /lib/modules/$(shell uname -r)/build
-+  KERNEL_HEADERS := -I$(KERNEL_SOURCES)/include
-+  MODULE_ROOT    := /lib/modules/$(shell uname -r)/kernel/drivers
-+endif
-+
-+#
-+# We rely on these two definitions below; if they aren't set, we set them to
-+# reasonable defaults (Linux 2.4's KBUILD, and top-level passes will not set
-+# these).
-+#
-+
-+src ?= .
-+obj ?= .
-+
-+#
-+# Sets any internal variables left unset by KBUILD (e.g. this happens during
-+# a top-level run).
-+#
-+
-+TOPDIR ?= $(KERNEL_SOURCES)
-+PATCHLEVEL ?= $(shell sh $(src)/conftest.sh kernel_patch_level $(TOPDIR))
-+
-+#
-+# Linux 2.4 uses the .o module extension. Linux 2.5, however, uses the .ko
-+# module extension. Handle these gracefully.
-+#
-+
-+ifeq ($(PATCHLEVEL), 4)
-+  MODULE_OBJECT := $(MODULE_NAME).o
-+else
-+  MODULE_OBJECT := $(MODULE_NAME).ko
-+endif
-+
-+#
-+# NVIDIA specific CFLAGS and #define's. The remap_page_range check has become
-+# necessary with the introduction of the five argument version to Linux 2.4
-+# distribution kernels; this conflicting change cannot be detected at compile
-+# time.
-+#
-+
-+EXTRA_CFLAGS += -D__KERNEL__ -DMODULE -D_LOOSE_KERNEL_NAMES -DNTRM -D_GNU_SOURCE -D_LOOSE_KERNEL_NAMES -D__KERNEL__ -DMODULE  -DNV_MAJOR_VERSION=1 -DNV_MINOR_VERSION=0 -DNV_PATCHLEVEL=5328  -DNV_UNIX   -DNV_LINUX   -DNV_INT64_OK   -DNVCPU_X86
-+
-+ifeq ($(shell echo $(NVDEBUG)),1)
-+  ifeq ($(shell test -z $(RMDEBUG) && echo yes),yes)
-+    RMDEBUG=1
-+  endif
-+endif
-+
-+ifeq ($(shell echo $(RMDEBUG)),1)
-+  EXTRA_CFLAGS += -DDEBUG -g -fno-common
-+endif
-+
-+ifeq ($(shell sh $(src)/conftest.sh remap_page_range $(KERNEL_HEADERS)), 5)
-+  EXTRA_CFLAGS += -DREMAP_PAGE_RANGE_5
-+endif
-+
-+ifeq ($(shell sh $(src)/conftest.sh remap_page_range $(KERNEL_HEADERS)), 4)
-+  EXTRA_CFLAGS += -DREMAP_PAGE_RANGE_4
-+endif
-+
-+#
-+# NVIDIA binary object file includes .common section.
-+#
-+
-+EXTRA_LDFLAGS := -d
-+
-+#
-+# Miscellaneous NVIDIA kernel module build support targets. They are needed
-+# to satisfy KBUILD requirements and to support NVIDIA specifics.
-+#
-+
-+$(obj)/nv-kernel.o:
-+      cp $(src)/$(RESMAN_CORE_OBJS) $(obj)/$(RESMAN_CORE_OBJS)
-+
-+$(obj)/$(VERSION_HEADER):
-+      echo \#define NV_COMPILER \"`$(CC) -v 2>&1 | tail -n 1`\" > $@
-+
-+$(obj)/nv.o: $(obj)/$(VERSION_HEADER)
-+
-+#
-+# More quirks for Linux 2.4 KBUILD, which doesn't link automatically.
-+#
-+
-+ifeq ($(PATCHLEVEL), 4)
-+$(obj)/$(MODULE_NAME).o: $($(MODULE_NAME)-objs)
-+      $(LD) $(EXTRA_LDFLAGS) -r -o $@ $($(MODULE_NAME)-objs)
-+endif
-+
-+#
-+# KBUILD build parameters.
-+#
-+
-+KBUILD_PARAMS := -C $(KERNEL_SOURCES) SUBDIRS=$(PWD)
-+
-+#
-+# NVIDIA sanity checks.
-+#
-+
-+suser-sanity-check:
-+      @if ! sh conftest.sh suser_sanity_check; then \
-+        echo; \
-+        echo "You have insufficient privileges for this operation. Please "; \
-+        echo "run \"make install\" as root!                               "; \
-+        echo; \
-+        exit 1; \
-+      fi
-+
-+rmmod-sanity-check:
-+      @if ! sh conftest.sh rmmod_sanity_check $(MODULE_NAME); then \
-+        echo; \
-+        echo "Unable to unload the currently loaded NVIDIA kernel module! "; \
-+        echo "Please be certain that you have exited X before attempting  "; \
-+        echo "to install this version.                                    "; \
-+        echo; \
-+        exit 1; \
-+      fi
-+
-+cc-sanity-check:
-+      @if ! sh conftest.sh cc_sanity_check full_output $(CC); then \
-+              exit 1; \
-+      fi
-+
-+#
-+# Build the NVIDIA kernel module using Linux KBUILD. This target is used by
-+# the "package-install" target below.
-+#
-+
-+$(MODULE_OBJECT): cc-sanity-check
-+      @make $(KBUILD_PARAMS) modules; \
-+      if ! [ -f $(MODULE_OBJECT) ]; then \
-+        echo "$(MODULE_OBJECT) failed to build!"; \
-+        exit 1; \
-+      fi
-+
-+#
-+# Build the NVIDIA kernel module with KBUILD. Verify that the user posesses
-+# sufficient privileges. Rebuild the module dependency file.
-+#
-+
-+module-install: suser-sanity-check $(MODULE_OBJECT)
-+      @mkdir -p $(MODULE_ROOT)/video; \
-+      install -m 0664 -o root -g root $(MODULE_OBJECT) $(MODULE_ROOT)/video; \
-+      /sbin/depmod -ae;
-+
-+#
-+# This target builds, then installs, then creates device nodes and inserts
-+# the module, if successful.
-+#
-+
-+package-install: module-install rmmod-sanity-check
-+      @sh makedevices.sh; \
-+      /sbin/modprobe $(MODULE_NAME) && \
-+      echo "$(MODULE_OBJECT) installed successfully.";
-+
-+#
-+# Build an object file suitable for further processing by the installer and
-+# inclusion as a precompiled kernel interface file.
-+#
-+
-+$(KERNEL_GLUE_NAME): $(MODULE_OBJECT)
-+      @ld -r -o $(KERNEL_GLUE_NAME) $(KERNEL_GLUE_OBJS)
-+
-+#
-+# Support hack, KBUILD isn't prepared to clean up after external modules.
-+#
-+
-+clean:
-+      @rm -f $(RESMAN_GLUE_OBJS) .*.{cmd,flags}
-+      @rm -f $(MODULE_NAME).{o,ko,mod.{o,c}} built-in.o $(VERSION_HEADER) *~
-+
-+#
-+# Linux 2.4 KBUILD requires the inclusion of Rules.make; Linux 2.5's KBUILD
-+# includes dependencies automatically.
-+#
-+
-+ifeq ($(PATCHLEVEL), 4)
-+include $(KERNEL_SOURCES)/Rules.make
-+endif
-diff -ruN NVIDIA_kernel-1.0-5328/Makefile.nvidia NVIDIA_kernel-1.0-5328-2.6/Makefile.nvidia
---- NVIDIA_kernel-1.0-5328/Makefile.nvidia     1970-01-01 01:00:00.000000000 +0100
-+++ NVIDIA_kernel-1.0-5328-2.6/Makefile.nvidia 2003-12-18 13:24:15.000000000 +0100
-@@ -0,0 +1,139 @@
-+# This Makefile is automatically generated; do not edit
-+#   Generated on 'builder3.nvidia.com' on Thu Jun 19 04:05:35 PDT 2003
-+
-+LINUX_MODULE=nv-linux.o
-+DEFINES=-D__KERNEL__ -DMODULE -D_LOOSE_KERNEL_NAMES -DKBUILD_MODNAME="nvidia" -DNTRM -D_GNU_SOURCE -D_LOOSE_KERNEL_NAMES -D__KERNEL__ -DMODULE  -DNV_MAJOR_VERSION=1 -DNV_MINOR_VERSION=0 -DNV_PATCHLEVEL=5328     -DNV_UNIX   -DNV_LINUX   -DNV_INT64_OK   -DNVCPU_X86
-+INCLUDES=-I.
-+
-+OBJECTS=nv.o os-agp.o os-interface.o os-registry.o 
-+HEADERS=os-agp.h os-interface.h nv-linux.h nv-misc.h nv-memdbg.h nv.h  rmretval.h nvtypes.h  $(VERSION_HDR)
-+
-+CFLAGS=-Wall -Wimplicit -Wreturn-type -Wswitch -Wformat -Wchar-subscripts -Wparentheses -Wcast-qual -Wno-multichar  -O -MD $(DEFINES) $(INCLUDES) -Wno-cast-qual
-+
-+RESMAN_KERNEL_MODULE=nv-kernel.o
-+
-+KERNDIR=/lib/modules/$(shell uname -r)
-+
-+# check for newer paths. if found, use them, otherwise use old paths
-+# these wouldn't work with the gnu make included with rh6.2
-+# KERNINC=$(if -d $(KERNDIR)/build, $(KERNDIR)/build/include, /usr/src/linux/include)
-+# INSTALLDIR=$(if -d $(KERNDIR)/kernel, $(KERNDIR)/kernel/drivers/video, $(KERNDIR)/video)
-+
-+# this is slightly more brain-dead, but works..
-+ifeq ($(shell if test -d $(KERNDIR)/build; then echo yes; fi),yes)
-+KERNINC=$(KERNDIR)/build/include
-+else
-+KERNINC=/usr/src/linux/include
-+endif
-+
-+ifeq ($(shell if test -d $(KERNDIR)/kernel; then echo yes; fi),yes)
-+INSTALLDIR=$(KERNDIR)/kernel/drivers/video
-+else
-+INSTALLDIR=$(KERNDIR)/video
-+endif
-+
-+ifeq ($(shell echo $(NVDEBUG)),1)
-+  ifeq ($(shell test -z $(RMDEBUG) && echo yes),yes)
-+    RMDEBUG=1
-+  endif
-+endif
-+
-+ifeq ($(shell echo $(RMDEBUG)),1)
-+CFLAGS += -DDEBUG -g -fno-common
-+endif
-+
-+# this is just plain wrong, get rid of it
-+BROKENDIR=$(KERNDIR)/kernel/video
-+
-+INSTALL=$(shell which install)
-+
-+# allow specification of alternate include file tree on command line and extra defines
-+ifdef SYSINCLUDE
-+INCLUDES += -I$(SYSINCLUDE)
-+INCLUDES += -I$(SYSINCLUDE)/asm/mach-default
-+else
-+INCLUDES += -I$(KERNINC)
-+INCLUDES += -I$(KERNINC)/asm/mach-default
-+endif
-+
-+ifeq ($(shell sh conftest.sh remap_page_range $(INCLUDES)), 5)
-+  DEFINES += -DREMAP_PAGE_RANGE_5
-+endif
-+
-+ifeq ($(shell sh conftest.sh remap_page_range $(INCLUDES)), 4)
-+  DEFINES += -DREMAP_PAGE_RANGE_4
-+endif
-+
-+DEFINES+=$(EXTRA_DEFINES)
-+
-+# allow build parameters to be passed in through the environment
-+ifdef BUILD_PARAMS
-+    DEFINES+=-D$(BUILD_PARAMS)
-+endif
-+
-+VERSION_HDR=nv_compiler.h
-+
-+all: install
-+
-+install: package-install
-+
-+suser-sanity-check:
-+      @if ! sh conftest.sh suser_sanity_check; then \
-+        echo; \
-+        echo "You have insufficient privileges for this operation. Please "; \
-+        echo "run \"make install\" as root!                               "; \
-+        echo; \
-+        exit 1; \
-+      fi
-+
-+rmmod-sanity-check:
-+      @if ! sh conftest.sh rmmod_sanity_check nvidia; then \
-+        echo; \
-+        echo "Unable to unload the currently loaded NVIDIA kernel module! "; \
-+        echo "Please be certain that you have exited X before attempting  "; \
-+        echo "to install this version.                                    "; \
-+        echo; \
-+        exit 1; \
-+      fi
-+
-+cc-sanity-check:
-+      @if ! sh conftest.sh cc_sanity_check full_output $(CC); then exit 1; fi
-+
-+package-install: suser-sanity-check nvidia.o rmmod-sanity-check
-+      if [ -d $(BROKENDIR) ]; then \
-+              rm -f $(BROKENDIR)/NVdriver; \
-+              rmdir --ignore-fail-on-non-empty $(BROKENDIR); \
-+      fi && \
-+      mkdir -p $(INSTALLDIR) && \
-+      rm -f $(INSTALLDIR)/NVdriver && \
-+      $(INSTALL) -m 0664 -o root -g root nvidia.o $(INSTALLDIR)/nvidia.o$(O) && \
-+      /sbin/depmod -a && \
-+      /sbin/modprobe nvidia && \
-+      sh makedevices.sh && \
-+      echo "nvidia.o installed successfully."; \
-+
-+nvidia.o: cc-sanity-check $(LINUX_MODULE) $(RESMAN_KERNEL_MODULE) 
-+      ld -d -r -o $@ $(LINUX_MODULE) $(RESMAN_KERNEL_MODULE)
-+
-+$(VERSION_HDR): 
-+      echo \#define NV_COMPILER \"`$(CC) -v 2>&1 | tail -n 1`\" > $@
-+
-+$(LINUX_MODULE): $(OBJECTS)
-+      ld -r -o $@ $(OBJECTS)
-+
-+%.o: %.c $(HEADERS)
-+      $(CC) -c $(CFLAGS) $<
-+
-+# debug tool to preprocess the file and leave .i to make it easier to untangle #defines
-+%.i: %.c
-+      $(CC) $(CFLAGS) -E $< > $@
-+
-+%.s: %.c
-+      $(CC) $(CFLAGS) -S $< > $@
-+
-+
-+clean:
-+      $(RM) $(OBJECTS) $(LINUX_MODULE) $(VERSION_HDR) *.d NVdriver nvidia.o
-+
-+
-+-include $(OBJECTS:%.o=%.d)
-diff -ruN NVIDIA_kernel-1.0-5328/conftest.sh NVIDIA_kernel-1.0-5328-2.6/conftest.sh
---- NVIDIA_kernel-1.0-5328/conftest.sh 2003-12-17 23:55:00.000000000 +0100
-+++ NVIDIA_kernel-1.0-5328-2.6/conftest.sh     2003-12-18 13:22:54.000000000 +0100
-@@ -104,5 +104,79 @@
-             exit 0
-         fi
-     ;;
-+
-+    cc_sanity_check)
-+        shift
-+        #
-+        # Verify that the same compiler is used for the kernel and kernel
-+        # module.
-+        #
-+        if test -n "$IGNORE_CC_MISMATCH" -o -n "$KERNDIR"; then
-+          #
-+          # The user chose to disable the gcc sanity test or is building
-+          # the module for a kernel not currently running, which renders
-+          # our test meaningless.
-+          #
-+          exit 0
-+        fi
-+
-+        VERSION="^Linux version.* (.*) (\(gcc.*\)).*"
-+        KERNEL=$(cat /proc/version | sed "s/$VERSION/\1/")
-+        MODULE=$($* -v 2>&1 | tail -n 1)
-+
-+        if test "$KERNEL" != "$MODULE"; then
-+          #
-+          # The kernel seems to have been built with a different version
-+          # of the C compiler, which may be a problem.
-+          #
-+          exit 1
-+        else
-+          exit 0
-+        fi
-+    ;;
-+
-+    kernel_patch_level)
-+        shift
-+        #
-+        # Determine the kernel's major patch level; this is only done if we
-+        # aren't told by KBUILD.
-+        #
-+        echo $(cat "$1"/Makefile | grep "PATCHLEVEL =" | cut -d " " -f 3)
-+        exit 0
-+    ;;
-+
-+    suser_sanity_check)
-+        shift
-+        #
-+        # Determine the caller's user id to determine if we have sufficient
-+        # privileges for the requested operation.
-+        #
-+        if test $(id -ur) != 0; then
-+          exit 1
-+        else
-+          exit 0
-+        fi
-+    ;;
-+
-+    rmmod_sanity_check)
-+        shift
-+        #
-+        # Make sure that any currently loaded NVIDIA kernel module can be
-+        # unloaded.
-+        #
-+        if /sbin/lsmod | grep -q "$1"; then
-+          /sbin/rmmod "$1" >& /dev/null
-+        fi
-+
-+        if /sbin/lsmod | grep -q "$1"; then
-+          #
-+          # The NVIDIA kernel module is still loaded, most likely because
-+          # it is busy.
-+          #
-+          exit 1
-+        else
-+          exit 0
-+        fi
-+    ;;
- esac
- 
-diff -ruN NVIDIA_kernel-1.0-5328/makedevices.sh NVIDIA_kernel-1.0-5328-2.6/makedevices.sh
---- NVIDIA_kernel-1.0-5328/makedevices.sh      2003-12-17 23:54:59.000000000 +0100
-+++ NVIDIA_kernel-1.0-5328-2.6/makedevices.sh  2003-12-18 13:22:54.000000000 +0100
-@@ -8,47 +8,49 @@
- # create a temporary file
- tmp=`(mktemp -q /tmp/nvidia.XXXXXX) 2> /dev/null` || tmp="/tmp/nvidia.$$"
- 
--paths=" /etc/modutils/aliases    \
--        /etc/modules.conf        \
--        /etc/conf.modules        "
--
--modconf=""
--for path in $paths; do
--   if [ -f "$path" ]; then
--       modconf=$path
--       break
-+modconfs=" /etc/modutils/aliases    \
-+           /etc/modules.conf        \
-+           /etc/modprobe.d/aliases  \
-+           /etc/modprobe.conf       \
-+           /etc/conf.modules        "
-+
-+#
-+# Pass the -p option to cp to preserve the permissions of $modconf and
-+# /etc/rc.d/rc.modules across the update. Update all relevant files
-+# including those eventually regenerated to avoid the need for awkward
-+# logic here.
-+#
-+for modconf in $modconfs; do
-+   if [ -f "$modconf" ]; then
-+     cp -p $modconf $tmp
-+     sed '/^alias.*\(NVdriver\|nvidia\)/d'  < $modconf   > $tmp
-+
-+     # make sure the last character in the file is a newline
-+     [ `tail -n 1 $tmp | wc -l` = 0 ] && echo "" >> $tmp
-+
-+     if [ -c /dev/.devfsd ]; then
-+       echo "alias /dev/nvidia* nvidia" >> $tmp
-+     else
-+       if [ `uname -r | cut -d '.' -f 2` = 6 ]; then
-+           echo "alias        char-major-195* nvidia" >> $tmp
-+       else
-+           echo "alias        char-major-195  nvidia" >> $tmp
-+       fi
-+     fi
-+     mv -f $tmp $modconf
-+     test -x /sbin/update-modules && /sbin/update-modules
-    fi
- done
- 
--if [ ! -z $modconf ]; then
--   # Initialize the permissions on $tmp so that we don't change the
--   # permissions of $modconf when we mv it into place
--   cp -p $modconf $tmp
--   sed '/^alias.*\(NVdriver\|nvidia\)/d'  < $modconf   > $tmp
--   
--   # make sure the last character in the file is a newline
--   [ `tail -n 1 $tmp | wc -l` = 0 ] && echo "" >> $tmp
--
--   if [ -c /dev/.devfsd ]; then
--     echo "alias /dev/nvidia*   nvidia" >> $tmp
--   else
--     echo "alias char-major-195 nvidia" >> $tmp
--   fi
--   mv -f $tmp $modconf
--   test -x /sbin/update-modules && /sbin/update-modules
--else
--  if [ -f /etc/rc.d/rc.modules ]; then
--    # Initialize the permissions on $tmp so that we don't change the
--    # permissions of /etc/rc.d/rc.modules when we mv it into place
--    cp -p /etc/rc.d/rc.modules $tmp
--    sed '/.*\(NVdriver\|nvidia\).*/d' < /etc/rc.d/rc.modules > $tmp
--
--    # make sure the last character in the file is a newline
--    [ `tail -n 1 $tmp | wc -l` = 0 ] && echo "" >> $tmp 
--
--    echo "/sbin/modprobe nvidia" >> $tmp
--    mv -f $tmp /etc/rc.d/rc.modules
--  fi
-+if [ -f /etc/rc.d/rc.modules ]; then
-+  cp -p /etc/rc.d/rc.modules $tmp
-+  sed '/.*\(NVdriver\|nvidia\).*/d' < /etc/rc.d/rc.modules > $tmp
-+
-+  # make sure the last character in the file is a newline
-+  [ `tail -n 1 $tmp | wc -l` = 0 ] && echo "" >> $tmp
-+
-+  echo -e "\n/sbin/modprobe nvidia" >> $tmp
-+  mv -f $tmp /etc/rc.d/rc.modules
- fi
- 
- if [ ! -c /dev/.devfsd ]; then
-diff -ruN NVIDIA_kernel-1.0-5328/nv-linux.h NVIDIA_kernel-1.0-5328-2.6/nv-linux.h
---- NVIDIA_kernel-1.0-5328/nv-linux.h  2003-12-17 23:55:00.000000000 +0100
-+++ NVIDIA_kernel-1.0-5328-2.6/nv-linux.h      2003-12-23 10:50:21.000000000 +0100
-@@ -21,34 +21,21 @@
- #  define MODVERSIONS
- #endif
- 
--#if defined (MODVERSIONS)
--#include <linux/modversions.h>
--#endif
--
- #include <linux/kernel.h>
- #include <linux/module.h>
- 
--#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 2, 12)
--#  error This driver does not support 2.2.11 or earlier kernels!
--#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 3, 0)
--#  define KERNEL_2_2
--#  warning NVIDIA is considering dropping support for linux-2.2 
--#  warning kernels. While end users are free to maintain their 
--#  warning own patches, or stick with current drivers, our new 
--#  warning drivers will not work "out of the box." If you are 
--#  warning concerned about lack of support for 2.2 kernels, 
--#  warning please let us know at linux-bugs@nvidia.com; we would
--#  warning like to know how many users would be seriously 
--#  warning impacted by this decision.
-+#if   LINUX_VERSION_CODE < KERNEL_VERSION(2, 3, 0)
-+#  error This driver does not support 2.2.x kernels!
- #elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 0)
--#  error This driver does not support 2.3.x development kernels!
-+#  error This driver does not support 2.3.x kernels!
- #elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
- #  define KERNEL_2_4
- #elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
--#  error This driver does not support 2.5.x development kernels!
--#  define KERNEL_2_5
-+#  error This driver does not support 2.5.x kernels!
-+#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 7, 0)
-+#  define KERNEL_2_6
- #else
--#  error This driver does not support 2.6.x or newer kernels!
-+#  error This driver does not support development kernels!
- #endif
- 
- #if defined (__ia64)
-@@ -61,12 +48,15 @@
- #define __SMP__
- #endif
- 
-+#if defined (MODVERSIONS) && !defined (KERNEL_2_6)
-+#include <linux/modversions.h>
-+#endif
-+
- #include <linux/types.h>            /* pic_t, size_t, __u32, etc        */
- #include <linux/errno.h>            /* error codes                      */
- #include <linux/list.h>             /* circular linked list             */
- #include <linux/stddef.h>           /* NULL, offsetof                   */
- #include <linux/wait.h>             /* wait queues                      */
--#include <linux/tqueue.h>           /* struct tq_struct                 */
- 
- #include <linux/slab.h>             /* kmalloc, kfree, etc              */
- #include <linux/vmalloc.h>          /* vmalloc, vfree, etc              */
-@@ -74,9 +64,15 @@
- #include <linux/poll.h>             /* poll_wait                        */
- #include <linux/delay.h>            /* mdelay, udelay                   */
- 
-+#ifdef KERNEL_2_6
-+#include <linux/sched.h>            /* suser(), capable() replacement   */
-+#include <linux/moduleparam.h>      /* module_param()                   */
-+#include <linux/smp_lock.h>         /* kernel_locked                    */
-+#include <asm/kmap_types.h>         /* page table entry lookup          */
-+#endif
-+
- #include <linux/pci.h>              /* pci_find_class, etc              */
--#include <linux/wrapper.h>          /* mem_map_reserve                  */
--#include <linux/interrupt.h>        /* mark_bh, init_bh, remove_bh      */
-+#include <linux/interrupt.h>        /* tasklets, interrupt helpers      */
- #include <linux/timer.h>
- 
- #include <asm/system.h>             /* cli, sli, save_flags             */
-@@ -85,14 +81,9 @@
- #include <asm/page.h>               /* PAGE_OFFSET                      */
- #include <asm/pgtable.h>            /* pte bit definitions              */
- 
--#if !defined (KERNEL_2_2)
- #include <linux/spinlock.h>
- #include <asm/semaphore.h>
- #include <linux/highmem.h>
--#else
--#include <asm/spinlock.h>
--#include <asm/semaphore.h>
--#endif
- 
- #ifdef CONFIG_PROC_FS
- #include <linux/proc_fs.h>
-@@ -299,13 +290,7 @@
-  * DMA use with the hardware.  This has to be done differently for
-  * different platforms and kernel versions.
-  */
--#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 2, 18)
--#define NV_VMALLOC(ptr, size) \
--    { \
--        (void *) (ptr) = vmalloc(size); \
--        VM_ALLOC_RECORD(ptr, size, "vm_alloc"); \
--    }
--#elif defined(NVCPU_IA64)
-+#if defined(NVCPU_IA64)
- #define NV_VMALLOC(ptr, size) \
-     { \
-         (void *) (ptr) = vmalloc_dma(size); \
-@@ -377,78 +362,174 @@
- 
- #endif /* !defined NVWATCH */
- 
-+#define GET_MODULE_SYMBOL(mod,sym)      (const void *) inter_module_get(sym)
-+#define PUT_MODULE_SYMBOL(sym)          (inter_module_put((char *) sym))
- 
--#if !defined (KERNEL_2_2)
--#  define LINUX_VMA_OFFS(vma)           (((vma)->vm_pgoff) << PAGE_SHIFT)
--#  define GET_MODULE_SYMBOL(mod,sym)  (const void *) inter_module_get(sym)
--#  define PUT_MODULE_SYMBOL(sym)        inter_module_put((char *) sym)
--#  define GET_MAP_NR(phys_page)         virt_to_page(__va(phys_page))
--#  define MEM_MAP_READ_COUNT(map_nr)    (atomic_read(&(map_nr)->count))
--#  define MEM_MAP_INC_COUNT(map_nr)     (atomic_inc(&(map_nr)->count))
--#  define MEM_MAP_DEC_COUNT(map_nr)     (atomic_dec(&(map_nr)->count))
--#  define EVENT_QUEUE(ptr)               ((struct __wait_queue_head *)(ptr))
--#  define VMA_PRIVATE(vma)              ((vma)->vm_private_data)
--#  define INIT_EVENT_QUEUE(ptr) \
--     if (ptr == NULL) { \
--        NV_KMALLOC((ptr), sizeof(struct __wait_queue_head)); \
--        if (ptr) { \
--            memset((ptr), 0, sizeof(struct __wait_queue_head)); \
--            init_waitqueue_head((struct __wait_queue_head *)(ptr)); \
--        } \
--     }
--#  define FREE_EVENT_QUEUE(ptr)         NV_KFREE((ptr), sizeof(struct __wait_queue_head)); (ptr) = NULL;
--#else
--#  define in_irq()                      (local_irq_count[smp_processor_id()])
--#  define LINUX_VMA_OFFS(vma)           ((vma)->vm_offset)
--#  define GET_MODULE_SYMBOL(mod, sym)   (void*) get_module_symbol((mod), (sym))
--#  define PUT_MODULE_SYMBOL(sym)
--#  define GET_MAP_NR(phys_page)         MAP_NR(__va(phys_page))
--#  define MEM_MAP_READ_COUNT(map_nr)    (atomic_read(&mem_map[map_nr].count))
--#  define MEM_MAP_INC_COUNT(map_nr)     (atomic_inc(&mem_map[map_nr].count))
--#  define MEM_MAP_DEC_COUNT(map_nr)     (atomic_dec(&mem_map[map_nr].count))
--#  define EVENT_QUEUE(ptr)              ((struct wait_queue **) &(ptr))
--#  define VMA_PRIVATE(vma)              ((void*)((vma)->vm_pte))
--#  define INIT_EVENT_QUEUE(ptr)         if (ptr) { ((ptr) = NULL); }
--#  define FREE_EVENT_QUEUE(ptr)
-+#ifdef KERNEL_2_6
-+# define NV_IS_SUSER()                  capable(CAP_SYS_ADMIN)
-+# define NV_PCI_DEVICE_NAME(x)          ((x)->pretty_name)
-+# define NV_CLI()                       local_irq_disable()
-+# define NV_SAVE_FLAGS(x)               local_save_flags(x)
-+# define NV_RESTORE_FLAGS(x)            local_irq_restore(x)
-+# define NV_MAY_SLEEP()                 (!in_interrupt() && !in_atomic())
-+# define NV_SMP_NUM_CPUS                num_online_cpus()
-+# define NV_MODULE_PARAMETER(x)         module_param(x, int, 0)
-+#else
-+# define NV_IS_SUSER()                  suser()
-+# define NV_PCI_DEVICE_NAME(x)          ((x)->name)
-+# define NV_CLI()                       cli()
-+# define NV_SAVE_FLAGS(x)               save_flags(x)
-+# define NV_RESTORE_FLAGS(x)            restore_flags(x)
-+# define NV_MAY_SLEEP()                 (!in_interrupt())
-+# define NV_SMP_NUM_CPUS                smp_num_cpus
-+# define NV_MODULE_PARAMETER(x)         MODULE_PARM(x, "i")
-+#endif
-+
-+#define NV_DEVICE_NUMBER(x)             minor((x)->i_rdev)
-+#define NV_VMA_OFFSET(x)                (((x)->vm_pgoff) << PAGE_SHIFT)
-+#define NV_VMA_PRIVATE(x)               ((x)->vm_private_data)
-+#define NV_IS_CONTROL_DEVICE(x)         (minor((x)->i_rdev) == 255)
-+
-+#ifndef minor
-+/*
-+ * XXX Is this correct for all possible target kernels? We need this to
-+ * support older 2.4 and some 2.6 kernels.
-+ */
-+# define minor(x) MINOR(x)
-+#endif
-+
-+#ifndef KERNEL_2_6
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 23)
-+  typedef void irqreturn_t;
-+#endif
-+# define IRQ_NONE
-+# define IRQ_RETVAL(x)
-+# define IRQ_HANDLED
-+#else
-+#ifdef AGPGART
-+  typedef struct agp_kern_info agp_kern_info;
-+  typedef struct agp_memory agp_memory;
-+#endif
-+  typedef void* devfs_handle_t;
-+#endif
-+
-+#ifdef KERNEL_2_6
-+#define NV_DEVFS_REGISTER(_name, _minor)                            \
-+({                                                                  \
-+    devfs_handle_t __handle = NULL;                                 \
-+    devfs_mk_cdev(MKDEV(NV_MAJOR_DEVICE_NUMBER, _minor),            \
-+            S_IFCHR | S_IRUGO | S_IWUGO, _name);                    \
-+    __handle;                                                       \
-+})
-+
-+#define NV_DEVFS_REMOVE_DEVICE(i) devfs_remove("nvidia%d", i)
-+#define NV_DEVFS_REMOVE_CONTROL() devfs_remove("nvidiactl")
-+#else
-+#define NV_DEVFS_REGISTER(_name, _minor)                            \
-+({                                                                  \
-+    devfs_handle_t __handle =                                       \
-+        devfs_register(NULL, _name, DEVFS_FL_DEFAULT,               \
-+                NV_MAJOR_DEVICE_NUMBER, _minor,                     \
-+                S_IFCHR | S_IRUGO | S_IWUGO, &nv_fops, NULL);       \
-+    __handle;                                                       \
-+ })
-+
-+#define NV_DEVFS_REMOVE_DEVICE(i) devfs_unregister(nv_devfs_handles[i+1])
-+#define NV_DEVFS_REMOVE_CONTROL() devfs_unregister(nv_devfs_handles[0])
- #endif
- 
-+/*
-+ * Linux 2.5 introduced the five argument version of remap_page_range, all
-+ * relevant releases to date use it. This version was backported to 2.4 by
-+ * RedHat without means to identify the change, hence this hack.
-+ */
-+#ifdef KERNEL_2_6
-+#define NV_REMAP_PAGE_RANGE(a, b...) remap_page_range(vma, a, ## b)
-+#else
- #if defined(REMAP_PAGE_RANGE_5)
--#define NV_REMAP_PAGE_RANGE(a, b...)    remap_page_range(vma, a, ## b)
-+#define NV_REMAP_PAGE_RANGE(a, b...) remap_page_range(vma, a, ## b)
- #elif defined(REMAP_PAGE_RANGE_4)
--#define NV_REMAP_PAGE_RANGE(a, b...)    remap_page_range(a, ## b)
-+#define NV_REMAP_PAGE_RANGE(a, b...) remap_page_range(a, ## b)
- #else
--#error "Couldn't determine number of arguments expected by remap_page_range!"
-+#warning "conftest.sh failed, assuming old Linux 2.4 remap_page_range(4)!"
-+
-+#define NV_REMAP_PAGE_RANGE(a, b...) remap_page_range(a, ## b)
- #endif
-+#endif /* KERNEL_2_6 */
- 
--#if defined(pte_offset_atomic)
--#define NV_PTE_OFFSET(addres, pg_mid_dir, pte) \
-+#if defined(pmd_offset_map)
-+#define NV_PMD_OFFSET(address, pgd, pmd) \
-+    { \
-+        pmd = pmd_offset_map(pgd, address); \
-+    }
-+#define NV_PMD_UNMAP(pmd) \
-     { \
--        pte_t *pte__ = pte_offset_atomic(pg_mid_dir, address); \
--        pte = *pte__; \
--        pte_kunmap(pte__); \
-+        pmd_unmap(pmd); \
-     }
--#elif defined(pte_offset)
--#define NV_PTE_OFFSET(addres, pg_mid_dir, pte) \
--    pte = *pte_offset(pg_mid_dir, address)
- #else
--#define NV_PTE_OFFSET(addres, pg_mid_dir, pte) \
-+#define NV_PMD_OFFSET(address, pgd, pmd) \
-     { \
--        pte_t *pte__ = pte_offset_map(pg_mid_dir, address); \
--        pte = *pte__; \
--        pte_unmap(pte__); \
-+        pmd = pmd_offset(pgd, address); \
-     }
-+#define NV_PMD_UNMAP(pmd)
- #endif
- 
--#define NV_PAGE_ALIGN(addr)             ( ((addr) + PAGE_SIZE - 1) / PAGE_SIZE)
--#define NV_MASK_OFFSET(addr)            ( (addr) & (PAGE_SIZE - 1) )
-+#define NV_PMD_PRESENT(pmd) \
-+    ({ \
-+        if (pmd) { \
-+            if (pmd_none(*pmd)) { \
-+                NV_PMD_UNMAP(pmd); pmd = NULL; \
-+            } \
-+        } pmd != NULL; \
-+    })
- 
--#ifndef MAXMEM  /* temporary define for 2.2 kernels */
--#define MAXMEM  (-PAGE_OFFSET - (64 * 1024 * 1024))
-+#if defined (pte_offset_atomic)
-+#define NV_PTE_OFFSET(address, pmd, pte) \
-+    { \
-+        pte = pte_offset_atomic(pmd, address); \
-+        NV_PMD_UNMAP(pmd); \
-+    }
-+#define NV_PTE_UNMAP(pte) \
-+    { \
-+        pte_kunmap(pte); \
-+    }
-+#elif defined (pte_offset)
-+#define NV_PTE_OFFSET(address, pmd, pte) \
-+    { \
-+        pte = pte_offset(pmd, address); \
-+        NV_PMD_UNMAP(pmd); \
-+    }
-+#define NV_PTE_UNMAP(pte)
-+#else
-+#define NV_PTE_OFFSET(address, pmd, pte) \
-+    { \
-+        pte = pte_offset_map(pmd, address); \
-+        NV_PMD_UNMAP(pmd); \
-+    }
-+#define NV_PTE_UNMAP(pte) \
-+    { \
-+        pte_unmap(pte); \
-+    }
- #endif
- 
--#ifndef NV01_ROOT
--#define NV01_ROOT 0x00000000
--#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_PAGE_ALIGN(addr)             ( ((addr) + PAGE_SIZE - 1) / PAGE_SIZE)
-+#define NV_MASK_OFFSET(addr)            ( (addr) & (PAGE_SIZE - 1) )
- 
- #if defined(NVCPU_IA64)
- #define NV_GFP_HW (GFP_KERNEL | __GFP_DMA)
-@@ -475,7 +556,7 @@
- static inline int NV_IRQL_IS_RAISED()
-     {
-         unsigned long int eflags;
--        __save_flags(eflags);
-+        NV_SAVE_FLAGS(eflags);
-         return !(eflags & NV_CPU_INTERRUPT_FLAGS_BIT);
-     }
-  
-@@ -557,9 +638,10 @@
-     struct pci_dev *dev;
-     nv_alloc_t *alloc_queue;
- 
--    // bottom half interrupt handler info; per device
--    /* keep track of any pending bottom-halves */
--    struct tq_struct *bh;
-+     /* keep track of any pending bottom halfes */
-+     struct tasklet_struct tasklet;
-+
-+     /* active bottom half counter */
-     atomic_t bh_count;
- 
-     /* get a timer callback every second */
-@@ -597,7 +679,7 @@
-     U032 num_events;
-     U032 put, get;
-     spinlock_t fp_lock;
--    void *wqueue;               // wait_queue for polling
-+    wait_queue_head_t waitqueue;
-     nv_event_t *event_fifo;     // fifo for storing events
- } nv_file_private_t;
- 
-diff -ruN NVIDIA_kernel-1.0-5328/nv-misc.h NVIDIA_kernel-1.0-5328-2.6/nv-misc.h
---- NVIDIA_kernel-1.0-5328/nv-misc.h   2003-12-17 23:55:00.000000000 +0100
-+++ NVIDIA_kernel-1.0-5328-2.6/nv-misc.h       2003-12-31 11:45:04.000000000 +0100
-@@ -53,5 +53,11 @@
- 
- typedef void *PHWINFO;
- 
-+/*
-+ * XXX: Make sure that arguments to and from the core resource
-+ * manager are passed and expected on the stack. Is this a good
-+ * place for this?
-+ */
-+#define NV_API_CALL __attribute__((regparm(0)))
- 
- #endif /* _NV_MISC_H_ */
-diff -ruN NVIDIA_kernel-1.0-5328/nv.c NVIDIA_kernel-1.0-5328-2.6/nv.c
---- NVIDIA_kernel-1.0-5328/nv.c        2003-12-17 23:54:59.000000000 +0100
-+++ NVIDIA_kernel-1.0-5328-2.6/nv.c    2003-12-31 14:01:09.000000000 +0100
-@@ -15,6 +15,7 @@
- #include "nv_compiler.h"
- #include "os-agp.h"
- 
-+MODULE_LICENSE("NVIDIA");
- 
- /*
-  * our global state; one per device
-@@ -33,32 +34,20 @@
-  */
- 
- nv_linux_state_t nv_ctl_device = { { 0 } };
--void *nv_ctl_wqueue = NULL;
-+wait_queue_head_t nv_ctl_waitqueue;
- 
- // keep track of opened clients and their process id so they
- //   can be free'd up on abnormal close
- nv_client_t       nv_clients[NV_MAX_CLIENTS];
--struct tq_struct  nv_bottom_halves[NV_MAX_CLIENTS];
- 
- #ifdef CONFIG_PROC_FS
- struct proc_dir_entry *proc_nvidia;
- #endif
- 
- #ifdef CONFIG_DEVFS_FS
--devfs_handle_t  nv_dev_handle[NV_MAX_DEVICES];
--devfs_handle_t  nv_ctl_handle;
-+devfs_handle_t nv_devfs_handles[NV_MAX_DEVICES+1];
- #endif
- 
--/*
-- * pick apart our minor device number
-- * low 3 bits is NV device
-- * if 255, then its the control device
-- */
--
--#define NV_DEVICE_NUMBER(_minor) ((_minor) & 0x0f)
--#define NV_DEVICE_IS_CONTROL_DEVICE(_minor) \
--             (((_minor) & 0xFF) == 0xFF)
--
- // #define NV_DBG_MEM 1
- #undef NV_DBG_MEM
- 
-@@ -121,10 +110,6 @@
-  *** EXPORTS to Linux Kernel
-  ***/
- 
--/* linux module interface functions (called by linux kernel) */
--int           init_module(void);
--void          cleanup_module(void);
--
- /* nv_kern_ functions, interfaces used by linux kernel */
- void          nv_kern_vma_open(struct vm_area_struct *vma);
- void          nv_kern_vma_release(struct vm_area_struct *vma);
-@@ -135,7 +120,8 @@
- unsigned int  nv_kern_poll(struct file *, poll_table *);
- int           nv_kern_ioctl(struct inode *, struct file *, unsigned int, unsigned long);
- void          nv_kern_bh(void *);
--void          nv_kern_isr(int, void *, struct pt_regs *);
-+void          nv_kern_isr_bh(unsigned long);
-+irqreturn_t   nv_kern_isr(int, void *, struct pt_regs *);
- void          nv_kern_rc_timer(unsigned long);
- #ifdef CONFIG_PM
- int           nv_kern_pm(struct pm_dev *dev, pm_request_t rqst, void *data);
-@@ -158,6 +144,7 @@
- /* character driver entry points */
- 
- static struct file_operations nv_fops = {
-+    owner:          THIS_MODULE,
-     poll:           nv_kern_poll,
-     ioctl:          nv_kern_ioctl,
-     mmap:           nv_kern_mmap,
-@@ -329,8 +316,8 @@
-     {
-         nv_printf(NV_DBG_MEMINFO, "  0x%x (0x%x): count %d flags 0x%x\n", 
-             page_ptr->phys_addr, page_ptr->dma_addr,
--            (GET_MAP_NR(page_ptr->phys_addr))->count,
--            (GET_MAP_NR(page_ptr->phys_addr))->flags);
-+            (virt_to_page(__va(page_ptr->phys_addr)))->count,
-+            (virt_to_page(__va(page_ptr->phys_addr)))->flags);
-         num_pages--;
-         page_ptr++;
-     }
-@@ -401,7 +388,7 @@
-         phys_addr = virt_to_phys((void *) virt_addr);
- 
-         /* lock the page for dma purposes */
--        mem_map_reserve(GET_MAP_NR(phys_addr));
-+        SetPageReserved(virt_to_page(__va(phys_addr)));
- 
-         page_ptr->phys_addr = phys_addr;
-         page_ptr->virt_addr = virt_addr;
-@@ -447,7 +434,7 @@
-         // but if we failed pci_map_sg, make sure to free this page
-         if (page_ptr->virt_addr)
-         {
--            mem_map_unreserve(GET_MAP_NR(page_ptr->phys_addr));
-+            ClearPageReserved(virt_to_page(__va(page_ptr->phys_addr)));
-             NV_SET_PAGE_ATTRIB_CACHED(page_ptr);
- #if defined(NVCPU_X86_64)
-             // only unmap the page if it really was mapped through
-@@ -481,7 +468,7 @@
- 
-     while (pages_left)
-     {
--        mem_map_unreserve(GET_MAP_NR(page_ptr->phys_addr));
-+        ClearPageReserved(virt_to_page(__va(page_ptr->phys_addr)));
-         page_ptr++;
-         pages_left--;
-     }
-@@ -616,7 +603,7 @@
-     return 0;
- }
- 
--static struct pci_dev* nvos_find_agp_by_class(unsigned int class)
-+struct pci_dev* nvos_find_agp_by_class(unsigned int class)
- {
-     struct pci_dev *dev, *fn;
-     u8     cap_ptr;
-@@ -674,11 +661,6 @@
-     nv_linux_state_t *nvl;
-     nv_linux_state_t *nv_max_devices;
- 
--#if defined (KERNEL_2_2)
--    struct proc_dir_entry *proc_root_driver;
--    proc_root_driver = create_proc_entry("driver", flags, &proc_root);
--#endif
--
-     proc_nvidia = create_proc_entry("nvidia", flags, proc_root_driver);
-     proc_nvidia_cards = create_proc_entry("cards", flags, proc_nvidia);
-     proc_nvidia_agp = create_proc_entry("agp", flags, proc_nvidia);
-@@ -740,9 +722,6 @@
- {
- #ifdef CONFIG_PROC_FS
-     nvos_proc_remove_all(proc_nvidia);
--#if defined (KERNEL_2_2)
--    remove_proc_entry("driver", &proc_root);
--#endif
- #endif
- }
- 
-@@ -831,9 +810,8 @@
-  *** EXPORTS to Linux Kernel
-  ***/
- 
--int init_module(void)
-+static int __init nvidia_init_module(void)
- {
--    nv_linux_state_t *nvl;
-     int rc, i;
- 
-     memset(nv_linux_devices, 0, sizeof(nv_linux_devices));
-@@ -846,7 +824,7 @@
- 
-     nv_printf(NV_DBG_ERRORS, "nvidia: loading %s\n", pNVRM_ID);
- 
--#ifdef CONFIG_DEVFS_FS
-+#if defined(CONFIG_DEVFS_FS) && !defined(KERNEL_2_6)
-     rc = devfs_register_chrdev(nv_major, "nvidia", &nv_fops);
- #else
-     rc = register_chrdev(nv_major, "nvidia", &nv_fops);
-@@ -858,34 +836,35 @@
-     }
- 
- #ifdef CONFIG_DEVFS_FS
--    memset(nv_dev_handle, 0, sizeof(devfs_handle_t) * NV_MAX_DEVICES);
-     do {
-+        /*
-+         * XXX This code isn't pretty, but neither is dealing with the
-+         * various Linux devfs implemenation(s). While Linux APIs are
-+         * known to be anything but stable and oftentimes anything but
-+         * well designed, the devfs interface has been more painful to
-+         * deal with than most other APIs.
-+         */
-         char name[10];
- 
--        nv_ctl_handle = devfs_register(NULL, "nvidiactl",
--                            DEVFS_FL_DEFAULT, nv_major, 255,
--                            S_IFCHR | S_IRUGO | S_IWUGO,
--                            &nv_fops, NULL);
-+        nv_devfs_handles[0] = NV_DEVFS_REGISTER("nvidiactl", 255);
- 
-         for (i = 0; i < num_nv_devices; i++) {
-             sprintf(name, "nvidia%d", i);
--            nv_dev_handle[i] = devfs_register(NULL, name,
--                                  DEVFS_FL_DEFAULT, nv_major, i,
--                                  S_IFCHR | S_IRUGO | S_IWUGO,
--                                  &nv_fops, NULL);
-+            nv_devfs_handles[i+1] = NV_DEVFS_REGISTER(name, i);
-         }
-     } while(0);
- #endif
- 
--    nv_printf(NV_DBG_INFO, "init_module: major number %d\n", nv_major);
-+    nv_printf(NV_DBG_INFO, "nvidia_init_module: major number %d\n", nv_major);
- 
--    // init all the bottom half structures
--    for (nvl = nv_linux_devices; nvl < nv_linux_devices + NV_MAX_DEVICES; nvl++)
--    {
--        nvl->bh = &nv_bottom_halves[nvl - nv_linux_devices];
--        nvl->bh->routine = nv_kern_bh;
--        nvl->bh->data = (void *) nvl;
--        nvl->bh->sync = 0;
-+    /* instantiate tasklets */
-+    for (i = 0; i < NV_MAX_DEVICES; i++) {
-+        /*
-+         * We keep one tasklet per card to avoid latency issues with more
-+         * than one device; no two instances of a single tasklet are ever
-+         * executed concurrently.
-+         */
-+        atomic_set(&nv_linux_devices[i].tasklet.count, 1);
-     }
- 
-     // init the nvidia control device
-@@ -893,6 +872,7 @@
-         nv_state_t *nv_ctl = NV_STATE_PTR(&nv_ctl_device);
-         nv_ctl->os_state = (void *) &nv_ctl_device;
-         nv_lock_init_locks(nv_ctl);
-+        init_waitqueue_head(&nv_ctl_waitqueue);
-     }
- 
- #ifdef CONFIG_PM
-@@ -919,14 +899,14 @@
-     /* create /proc/driver/nvidia */
-     nvos_proc_create();
- 
--#if defined(DEBUG) && !defined(KERNEL_2_2)
-+#if defined(DEBUG)
-     inter_module_register("nv_linux_devices", THIS_MODULE, nv_linux_devices);
- #endif
- 
-     return 0;
- 
-  failed:
--#ifdef CONFIG_DEVFS_FS
-+#if defined(CONFIG_DEVFS_FS) && !defined(KERNEL_2_6)
-     devfs_unregister_chrdev(nv_major, "nvidia");
- #else
-     unregister_chrdev(nv_major, "nvidia");
-@@ -934,26 +914,27 @@
-     return rc;
- }
- 
--void cleanup_module(void)
-+static void __exit nvidia_exit_module(void)
- {
--    int rc, i;
--    nv_linux_state_t *nvl;
--    nv_linux_state_t *max_devices;
-+    int rc;
-+    nv_linux_state_t *nvl, *max_devices;
- 
-     /* remove /proc/driver/nvidia */
-     nvos_proc_remove();
- 
--    nv_printf(NV_DBG_INFO, "cleanup_module\n");
-+    nv_printf(NV_DBG_INFO, "nvidia_exit_module\n");
- 
--#if defined(DEBUG) && !defined(KERNEL_2_2)
-+#if defined(DEBUG)
-     inter_module_unregister("nv_linux_devices");
- #endif
- 
- #ifdef CONFIG_PM
--    for (i = 0; i < num_nv_devices; i++)
--    {
--        pm_unregister(pm_nv_dev[i]);
--    }
-+    do {
-+        int i;
-+        for (i = 0; i < num_nv_devices; i++) {
-+            pm_unregister(pm_nv_dev[i]);
-+        }
-+    } while (0);
- #endif
- 
-     // Shutdown the resource manager
-@@ -972,30 +953,29 @@
-                 continue;
- 
-             nv_printf(NV_DBG_ERRORS,
--                    "still have vm que at cleanup_module(): 0x%x to 0x%x\n",
-+                    "still have vm que at nvidia_exit_module(): 0x%x to 0x%x\n",
-                     nvl->alloc_queue->vma->vm_start,
-                     nvl->alloc_queue->vma->vm_end);
-         }
-     }
- 
--#ifdef CONFIG_DEVFS_FS
-+#if defined(CONFIG_DEVFS_FS) && !defined(KERNEL_2_6)
-     rc = devfs_unregister_chrdev(nv_major, "nvidia");
- #else
-     rc = unregister_chrdev(nv_major, "nvidia");
- #endif
- 
-     if (rc < 0) {
--        nv_printf(NV_DBG_ERRORS, "cleanup_module: unregister nv failed\n");
-+        nv_printf(NV_DBG_ERRORS, "nvidia_exit_module: unregister nv failed\n");
-     }
- 
- #ifdef CONFIG_DEVFS_FS
-     do {
-         int i;
--        for (i = 0; nv_dev_handle[i] != 0; i++) {
--            devfs_unregister(nv_dev_handle[i]);
--        }
--    } while(0);
--    devfs_unregister(nv_ctl_handle);
-+        NV_DEVFS_REMOVE_CONTROL();
-+        for (i = 0; i < num_nv_devices; i++)
-+            NV_DEVFS_REMOVE_DEVICE(i);
-+    } while (0);
- #endif
- 
- #if NV_ENABLE_MEM_TRACKING
-@@ -1007,6 +987,8 @@
- #endif
- }
- 
-+module_init(nvidia_init_module);
-+module_exit(nvidia_exit_module);
- 
- /* this is only called when the vmas are duplicated.
-  * this appears to only happen when the process is cloned to create
-@@ -1020,11 +1002,11 @@
- nv_kern_vma_open(struct vm_area_struct *vma)
- {
-     nv_printf(NV_DBG_MEMINFO, "vma_open for 0x%x - 0x%x, offset 0x%x\n",
--        vma->vm_start, vma->vm_end, LINUX_VMA_OFFS(vma));
-+        vma->vm_start, vma->vm_end, NV_VMA_OFFSET(vma));
- 
--    if (VMA_PRIVATE(vma))
-+    if (NV_VMA_PRIVATE(vma))
-     {
--        nv_alloc_t *at = (nv_alloc_t *) VMA_PRIVATE(vma);
-+        nv_alloc_t *at = (nv_alloc_t *) NV_VMA_PRIVATE(vma);
-         at->usage_count++;
- 
-         nv_printf(NV_DBG_MEMINFO, "  at 0x%x, usage count %d, page_table 0x%x\n",
-@@ -1032,8 +1014,6 @@
- 
-         nvos_list_page_count(at->page_table, at->num_pages);
-     }
--
--    MOD_INC_USE_COUNT;
- }
- 
- 
-@@ -1041,11 +1021,11 @@
- nv_kern_vma_release(struct vm_area_struct *vma)
- {
-     nv_printf(NV_DBG_MEMINFO, "vma_release for 0x%x - 0x%x, offset 0x%x\n",
--        vma->vm_start, vma->vm_end, LINUX_VMA_OFFS(vma));
-+        vma->vm_start, vma->vm_end, NV_VMA_OFFSET(vma));
- 
--    if (VMA_PRIVATE(vma))
-+    if (NV_VMA_PRIVATE(vma))
-     {
--        nv_alloc_t *at = (nv_alloc_t *) VMA_PRIVATE(vma);
-+        nv_alloc_t *at = (nv_alloc_t *) NV_VMA_PRIVATE(vma);
- 
-         at->usage_count--;
- 
-@@ -1063,35 +1043,26 @@
-             if (at->page_table)
-                 nvos_unlock_pages(at);
-             nvos_free_alloc(at);
--            VMA_PRIVATE(vma) = NULL;
-+            NV_VMA_PRIVATE(vma) = NULL;
-         }
-     }
--
--    MOD_DEC_USE_COUNT;
- }
- 
- 
--/* at this point, this code just plain won't work with 2.2 kernels.
-- * additionally, only ia64 & the 460GX need a nopage handler, and 2.2 doesn't
-- * work on ia64 anyways. It's expected that at some point other agp chipsets
-- * will work similar to the 460GX (AGP 3.0 spec), so pre-emptively make sure
-- * this works on our standard ia32 driver.
-- */
--#if !defined(KERNEL_2_2)
--
- /* AGP allocations under the 460GX are not mapped to the aperture
-  * addresses by the CPU.  This nopage handler will fault on CPU
-  * accesses to AGP memory and map the address to the correct page.
-  */
- struct page *nv_kern_vma_nopage(struct vm_area_struct *vma, unsigned long address, int write_access)
- {
-+#if defined(NVCPU_IA64) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 9))
-     nv_alloc_t *at, *tmp;
-     nv_linux_state_t *nvl;
-     nv_state_t *nv;
-     struct page *page_ptr;
-     int rm_status, index;
- 
--    at = VMA_PRIVATE(vma);
-+    at = NV_VMA_PRIVATE(vma);
-     if (at == NULL)
-     {
-         nv_printf(NV_DBG_ERRORS, "NVRM: nopage handler called without an at: "
-@@ -1130,7 +1101,7 @@
-         // far again
-         nv_printf(NV_DBG_ERRORS, "NVRM: nopage handler called on a freed"
-                   "address: vm_start 0x%x, at 0x%x\n", vma->vm_start, at);
--        VMA_PRIVATE(vma) = NULL;
-+        NV_VMA_PRIVATE(vma) = NULL;
-         return NOPAGE_SIGBUS;
-     }
- 
-@@ -1154,15 +1125,14 @@
-     at->page_table[index].virt_addr = (unsigned long) __va(page_to_pfn(page_ptr) << PAGE_SHIFT);
- 
-     return page_ptr;
--}
- #endif
-+    return NOPAGE_SIGBUS;
-+}
- 
- struct vm_operations_struct nv_vm_ops = {
-     nv_kern_vma_open,
-     nv_kern_vma_release,  /* "close" */
--#if !defined(KERNEL_2_2)
-     nv_kern_vma_nopage,
--#endif
- };
- 
- static nv_file_private_t *
-@@ -1177,7 +1147,7 @@
-     memset(nvfp, 0, sizeof(nv_file_private_t));
- 
-     // initialize this file's event queue
--    INIT_EVENT_QUEUE(nvfp->wqueue);
-+    init_waitqueue_head(&nvfp->waitqueue);
- 
-     nv_init_lock(nvfp->fp_lock);
- 
-@@ -1197,11 +1167,19 @@
-     if (nvfp == NULL)
-         return;
- 
--    FREE_EVENT_QUEUE(nvfp->wqueue);
-     NV_VFREE(nvfp->event_fifo, sizeof(nv_event_t) * NV_EVENT_FIFO_SIZE);
-     NV_VFREE(nvfp, sizeof(nv_file_private_t));
- }
- 
-+void nv_kern_isr_bh(unsigned long data)
-+{
-+    /*
-+     * XXX: This level of indirection is necessary to work around
-+     * problems with Linux kernels using a non-standard calling
-+     * convention, i.e. Arjan van de Ven's/RedHat's 2.6.0 kernels.
-+     */
-+    rm_isr_bh((VOID *) data);
-+}
- 
- /*
- ** nv_kern_open
-@@ -1226,11 +1204,11 @@
- 
-     /* for control device, just jump to its open routine */
-     /* after setting up the private data */
--    if (NV_DEVICE_IS_CONTROL_DEVICE(inode->i_rdev))
-+    if (NV_IS_CONTROL_DEVICE(inode))
-         return nv_kern_ctl_open(inode, file);
- 
-     /* what device are we talking about? */
--    devnum = NV_DEVICE_NUMBER(inode->i_rdev);
-+    devnum = NV_DEVICE_NUMBER(inode);
-     if (devnum >= NV_MAX_DEVICES)
-     {
-         rc = -ENODEV;
-@@ -1283,12 +1261,14 @@
-             goto failed;
-         }
- 
-+        nvl->tasklet.func = nv_kern_isr_bh;
-+        nvl->tasklet.data = (unsigned long) nv->pdev;
-+        tasklet_enable(&nvl->tasklet);
- 
-         nv->flags |= NV_FLAG_OPEN;
-     }
- 
-     nv->usage_count++;
--    MOD_INC_USE_COUNT;
- 
-  failed:
-     nv_unlock(nvl->ldata_lock);
-@@ -1319,38 +1299,32 @@
- 
-     /* for control device, just jump to its open routine */
-     /* after setting up the private data */
--    if (NV_DEVICE_IS_CONTROL_DEVICE(inode->i_rdev))
-+    if (NV_IS_CONTROL_DEVICE(inode))
-         return nv_kern_ctl_close(inode, file);
- 
--    nv_printf(NV_DBG_INFO, "nv_kern_close on device %d\n", NV_DEVICE_NUMBER(inode->i_rdev));
-+    nv_printf(NV_DBG_INFO, "nv_kern_close on device %d\n", NV_DEVICE_NUMBER(inode));
- 
-     rm_free_unused_clients(nv, current->pid, (void *) file);
- 
-     nv_lock(nvl->ldata_lock);
-     if (--nv->usage_count == 0)
-     {
--        int counter = 0;
--
--        /* turn off interrupts.
--        ** be careful to make sure any pending bottom half gets run
--        **  or disabled before calling rm_shutdown_adapter() since
--        **  it will free up the pdev.  This is hard to see on single
--        **  cpu systems, but easy on dual cpu :-)
--        */
-+        /*
-+         * The usage count for this device has dropped to zero, it can be shut
-+         * down safely; disable its interrupts.
-+         */
-         rm_disable_adapter(nv);
- 
--        /* give it a moment to allow any bottom half to run */
--
--#define MAX_BH_TASKS 10
--        while (NV_ATOMIC_READ(nvl->bh_count) && (counter < MAX_BH_TASKS))
--        {
--            current->state = TASK_INTERRUPTIBLE;
--            schedule_timeout(HZ/50);
--            counter++;
--        }
-+        /*
-+         * Disable this device's tasklet to make sure that no bottom half will
-+         * run with undefined device state.
-+         */
-+        tasklet_disable(&nvl->tasklet);
- 
--        /* free the irq, which may block until any pending interrupts */
--        /* are done being processed. */
-+        /*
-+         * Free the IRQ, which may block until all pending interrupt processing
-+         * has completed.
-+         */
-         free_irq(nv->interrupt_line, (void *) nv);
- 
-         rm_shutdown_adapter(nv);
-@@ -1381,8 +1355,6 @@
-         FILE_PRIVATE(file) = NULL;
-     }
- 
--    MOD_DEC_USE_COUNT;
--
-     return 0;
- }
- 
-@@ -1399,10 +1371,10 @@
-     nv_printf(NV_DBG_INFO, "mmap([0x%p-0x%p] off=0x%lx)\n",
-         vma->vm_start,
-         vma->vm_end,
--        LINUX_VMA_OFFS(vma));
-+        NV_VMA_OFFSET(vma));
- 
-     // be a bit paranoid for now
--    if ((NV_MASK_OFFSET(LINUX_VMA_OFFS(vma))) ||
-+    if ((NV_MASK_OFFSET(NV_VMA_OFFSET(vma))) ||
-         (NV_MASK_OFFSET(vma->vm_start)) ||
-         (NV_MASK_OFFSET(vma->vm_end)))
-     {
-@@ -1420,7 +1392,7 @@
- 
- 
-     /* NV reg space */
--    if (IS_REG_OFFSET(nv, LINUX_VMA_OFFS(vma), vma->vm_end - vma->vm_start))
-+    if (IS_REG_OFFSET(nv, NV_VMA_OFFSET(vma), vma->vm_end - vma->vm_start))
-     {
-         /* truncate to size of registers */
-         if (pages > nv->regs->size / PAGE_SIZE)
-@@ -1428,7 +1400,7 @@
- 
-         vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
-         if (NV_REMAP_PAGE_RANGE(vma->vm_start,
--                             phys_to_uncached(LINUX_VMA_OFFS(vma)),
-+                             phys_to_uncached(NV_VMA_OFFSET(vma)),
-                              vma->vm_end - vma->vm_start,
-                              vma->vm_page_prot))
-             return -EAGAIN;
-@@ -1438,7 +1410,7 @@
-     }
- 
-     /* NV fb space */
--    else if (IS_FB_OFFSET(nv, LINUX_VMA_OFFS(vma), vma->vm_end - vma->vm_start))
-+    else if (IS_FB_OFFSET(nv, NV_VMA_OFFSET(vma), vma->vm_end - vma->vm_start))
-     {
- 
-         /* truncate to size of framebuffer */
-@@ -1447,7 +1419,7 @@
- 
-         vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
-         if (NV_REMAP_PAGE_RANGE(vma->vm_start,
--                             phys_to_uncached(LINUX_VMA_OFFS(vma)),
-+                             phys_to_uncached(NV_VMA_OFFSET(vma)),
-                              vma->vm_end - vma->vm_start,
-                              vma->vm_page_prot))
-             return -EAGAIN;
-@@ -1457,10 +1429,10 @@
-     }
- 
-     /* AGP allocator */
--    else if (IS_AGP_OFFSET(nv, LINUX_VMA_OFFS(vma), vma->vm_end - vma->vm_start))
-+    else if (IS_AGP_OFFSET(nv, NV_VMA_OFFSET(vma), vma->vm_end - vma->vm_start))
-     {
-         nv_lock(nvl->at_lock);
--        at = nvl_find_alloc(nvl, LINUX_VMA_OFFS(vma), NV_ALLOC_TYPE_AGP);
-+        at = nvl_find_alloc(nvl, NV_VMA_OFFSET(vma), NV_ALLOC_TYPE_AGP);
- 
-         if (at == NULL)
-         {
-@@ -1478,7 +1450,7 @@
-         }
- 
-         at->vma = vma;
--        VMA_PRIVATE(vma) = at;
-+        NV_VMA_PRIVATE(vma) = at;
-         at->usage_count++;
- 
-         if (NV_OSAGP_ENABLED(nv))
-@@ -1502,13 +1474,13 @@
-     }
- 
-     /* Magic allocator */
--    else // if (LINUX_VMA_OFFS(vma) == NV_MMAP_ALLOCATION_OFFSET)
-+    else // if (NV_VMA_OFFSET(vma) == NV_MMAP_ALLOCATION_OFFSET)
-     {
-         unsigned long page = 0, pos, start;
-         int i = 0;
- 
-         nv_lock(nvl->at_lock);
--        at = nvl_find_alloc(nvl, LINUX_VMA_OFFS(vma), NV_ALLOC_TYPE_PCI);
-+        at = nvl_find_alloc(nvl, NV_VMA_OFFSET(vma), NV_ALLOC_TYPE_PCI);
- 
-         if (at == NULL)
-         {
-@@ -1526,7 +1498,7 @@
-         }
- 
-         at->vma = vma;
--        VMA_PRIVATE(vma) = at;
-+        NV_VMA_PRIVATE(vma) = at;
-         at->usage_count++;
- 
-         nv_printf(NV_DBG_INFO, "remapping %d system pages for at 0x%x\n", pages, at);
-@@ -1548,9 +1520,6 @@
- 
-     vma->vm_file = file;
- 
--    /* just increment usage count, rather than calling vma_open */
--    MOD_INC_USE_COUNT;
--
-     return 0;
- }
- 
-@@ -1577,7 +1546,7 @@
-     {
-         nv_printf(NV_DBG_EVENTINFO, "calling poll_wait\n");
-         // add us to the list
--        poll_wait(file, EVENT_QUEUE(nvfp->wqueue), wait);
-+        poll_wait(file, &nvfp->waitqueue, wait);
-     }
- 
-     nv_lock_irq(nvfp->fp_lock, eflags);
-@@ -1645,12 +1614,13 @@
- 
-     switch (_IOC_NR(cmd))
-     {
-+#if !defined(KERNEL_2_6)
-         /* debug tool; zap the module use count so we can unload driver */
-         /*             even if it is confused */
-         case NV_ESC_MODULE_RESET:
-             atomic_set(&__this_module.uc.usecount, 1);
-             break;
--
-+#endif
-         /* pass out info about the card */
-         case NV_ESC_CARD_INFO:
-         {
-@@ -1777,7 +1747,7 @@
-  * driver receives an interrupt
-  *    if someone waiting, then hand it off.
-  */
--void nv_kern_isr(
-+irqreturn_t nv_kern_isr(
-     int   irq,
-     void *arg,
-     struct pt_regs *regs
-@@ -1791,9 +1761,10 @@
-     if (need_to_run_bottom_half)
-     {
-         NV_ATOMIC_INC(nvl->bh_count);
--        queue_task(nvl->bh, &tq_immediate);
--        mark_bh(IMMEDIATE_BH);
-+        tasklet_schedule(&nvl->tasklet);
-     }
-+
-+    return IRQ_HANDLED;
- }
- 
- void nv_kern_bh(
-@@ -1911,11 +1882,9 @@
- 
-     if (nv->usage_count == 0)
-     {
--        INIT_EVENT_QUEUE(nv_ctl_wqueue);
-+        init_waitqueue_head(&nv_ctl_waitqueue);
-     }
- 
--    MOD_INC_USE_COUNT;
--
-     nv->flags |= NV_FLAG_OPEN + NV_FLAG_CONTROL;
- 
-     /* turn off the hotkey occurred bit */
-@@ -1943,10 +1912,8 @@
- 
-     nv_lock(nvl->ldata_lock);
-     if (--nv->usage_count == 0)
--    {
--        FREE_EVENT_QUEUE(nv_ctl_wqueue);
-         nv->flags = 0;
--    }
-+
-     nv_unlock(nvl->ldata_lock);
- 
-     rm_free_unused_clients(nv, current->pid, (void *) file);
-@@ -1957,8 +1924,6 @@
-         FILE_PRIVATE(file) = NULL;
-     }
- 
--    MOD_DEC_USE_COUNT;
--
-     return 0;
- }
- 
-@@ -1982,7 +1947,7 @@
-     nv = NV_STATE_PTR(nvl);
- 
-     if ( !(file->f_flags & O_NONBLOCK) )
--        poll_wait(file, EVENT_QUEUE(nv_ctl_wqueue), wait);
-+        poll_wait(file, &nv_ctl_waitqueue, wait);
- 
-     nv_lock(nvl->ldata_lock);
- 
-@@ -2013,7 +1978,7 @@
-     nv_ctl_device.nv_state.flags |= NV_FLAG_HOTKEY_OCCURRED;
-     nv_unlock(nv_ctl_device.ldata_lock);
- 
--    wake_up_interruptible(EVENT_QUEUE(nv_ctl_wqueue));
-+    wake_up_interruptible(&nv_ctl_waitqueue);
- }
- 
- int nv_kern_read_cardinfo(char *page, char **start, off_t off,
-@@ -2092,7 +2057,7 @@
-         len += sprintf(page+len, "Host Bridge: \t ");
- 
- #if defined(CONFIG_PCI_NAMES)
--        len += sprintf(page+len, "%s\n", dev->name);
-+        len += sprintf(page+len, "%s\n", NV_PCI_DEVICE_NAME(dev));
- #else
-         len += sprintf(page+len, "PCI device %04x:%04x\n",
-                 dev->vendor, dev->device);
-@@ -2304,27 +2269,30 @@
-     int kern
- )
- {
--    pgd_t *pg_dir;
--    pmd_t *pg_mid_dir;
--    pte_t pte;
-+    pgd_t *pgd;
-+    pmd_t *pmd;
-+    pte_t *pte;
-     unsigned long retval;
- 
--    if (kern) pg_dir = pgd_offset_k(address);
--    else      pg_dir = pgd_offset(current->mm, address);
-+    if (kern)
-+        pgd = pgd_offset_k(address);
-+    else
-+        pgd = pgd_offset(current->mm, address);
- 
--    if (pgd_none(*pg_dir))
-+    if (!pgd || pgd_none(*pgd))
-         goto failed;
- 
--    pg_mid_dir = pmd_offset(pg_dir, address);
--    if (pmd_none(*pg_mid_dir))
-+    NV_PMD_OFFSET(address, pgd, pmd);
-+
-+    if (!NV_PMD_PRESENT(pmd))
-         goto failed;
- 
--    NV_PTE_OFFSET(address, pg_mid_dir, pte);
-+    NV_PTE_OFFSET(address, pmd, pte);
- 
--    if (!pte_present(pte))
-+    if (!NV_PTE_PRESENT(pte))
-         goto failed;
- 
--    retval = ((pte_val(pte) & KERN_PAGE_MASK) | NV_MASK_OFFSET(address));
-+    retval = ((NV_PTE_VALUE(pte) & KERN_PAGE_MASK) | NV_MASK_OFFSET(address));
- 
- #if defined(NVCPU_X86_64) && defined(_PAGE_NX)
-     // mask out the non-executable page bit for the true physical address
-@@ -2759,7 +2727,7 @@
- 
-     if (nvfp->num_events == NV_EVENT_FIFO_SIZE)
-     {
--        wake_up_interruptible(EVENT_QUEUE(nvfp->wqueue));
-+        wake_up_interruptible(&nvfp->waitqueue);
-         nv_unlock_irq(nvfp->fp_lock, eflags);
-         return;
-     }
-@@ -2776,7 +2744,7 @@
-     if (nvfp->put >= NV_EVENT_FIFO_SIZE)
-         nvfp->put = 0;
- 
--    wake_up_interruptible(EVENT_QUEUE(nvfp->wqueue));
-+    wake_up_interruptible(&nvfp->waitqueue);
-     nv_unlock_irq(nvfp->fp_lock, eflags);
- }
- 
-@@ -2866,12 +2834,8 @@
-     if ( (NV_AGP_DISABLED(nv)) && (config & NVOS_AGP_CONFIG_NVAGP) )
-     {
-         /* make sure the user does not have agpgart loaded */
--#if !defined (KERNEL_2_2)
-         if (inter_module_get("drm_agp")) {
-             inter_module_put("drm_agp");
--#else
--        if (GET_MODULE_SYMBOL(0, __MODULE_STRING(agp_enable))) {
--#endif
-             nv_printf(NV_DBG_WARNINGS, "NVRM: not using NVAGP, AGPGART is loaded!!\n");
-         } else {
- #if defined(CONFIG_X86_64) && defined(CONFIG_GART_IOMMU)
-diff -ruN NVIDIA_kernel-1.0-5328/nv.h NVIDIA_kernel-1.0-5328-2.6/nv.h
---- NVIDIA_kernel-1.0-5328/nv.h        2003-12-17 23:55:00.000000000 +0100
-+++ NVIDIA_kernel-1.0-5328-2.6/nv.h    2003-12-31 11:38:22.000000000 +0100
-@@ -327,31 +327,31 @@
-  * ---------------------------------------------------------------------------
-  */
- 
--VOID*  nv_find_nv_mapping           (nv_state_t *, unsigned long); 
--VOID*  nv_find_agp_kernel_mapping   (nv_state_t *, unsigned long); 
--ULONG  nv_get_kern_phys_address     (ULONG);
--ULONG  nv_get_user_phys_address     (ULONG);
--
--VOID   nv_lock_rm                   (nv_state_t *);
--VOID   nv_unlock_rm                 (nv_state_t *);
--VOID   nv_lock_heap                 (nv_state_t *);
--VOID   nv_unlock_heap               (nv_state_t *);
--
--VOID   nv_set_hotkey_occurred_flag  (VOID);
--S032   nv_int10h_call               (nv_state_t *, U032 *, U032 *, U032 *, U032 *, VOID *);
--
--S032   nv_alloc_pages               (nv_state_t *, VOID **, U032, U032, U032, U032, U032, U032, VOID **);
--S032   nv_free_pages                (nv_state_t *, VOID **, U032, U032, VOID *);
--
--S032   nv_agp_init                  (nv_state_t *, VOID **, VOID **, VOID *, U032);
--S032   nv_agp_teardown              (nv_state_t *);
--S032   nv_agp_translate_address     (nv_state_t *, VOID *, U032, U032 *);
-+VOID*  NV_API_CALL  nv_find_nv_mapping           (nv_state_t *, unsigned long); 
-+VOID*  NV_API_CALL  nv_find_agp_kernel_mapping   (nv_state_t *, unsigned long); 
-+ULONG  NV_API_CALL  nv_get_kern_phys_address     (ULONG);
-+ULONG  NV_API_CALL  nv_get_user_phys_address     (ULONG);
-+
-+VOID   NV_API_CALL  nv_lock_rm                   (nv_state_t *);
-+VOID   NV_API_CALL  nv_unlock_rm                 (nv_state_t *);
-+VOID   NV_API_CALL  nv_lock_heap                 (nv_state_t *);
-+VOID   NV_API_CALL  nv_unlock_heap               (nv_state_t *);
-+
-+VOID   NV_API_CALL  nv_set_hotkey_occurred_flag  (VOID);
-+S032   NV_API_CALL  nv_int10h_call               (nv_state_t *, U032 *, U032 *, U032 *, U032 *, VOID *);
-+
-+S032   NV_API_CALL  nv_alloc_pages               (nv_state_t *, VOID **, U032, U032, U032, U032, U032, U032, VOID **);
-+S032   NV_API_CALL  nv_free_pages                (nv_state_t *, VOID **, U032, U032, VOID *);
-+
-+S032   NV_API_CALL  nv_agp_init                  (nv_state_t *, VOID **, VOID **, VOID *, U032);
-+S032   NV_API_CALL  nv_agp_teardown              (nv_state_t *);
-+S032   NV_API_CALL  nv_agp_translate_address     (nv_state_t *, VOID *, U032, U032 *);
- 
--S032   nv_start_rc_timer            (nv_state_t *);
--S032   nv_stop_rc_timer             (nv_state_t *);
-+S032   NV_API_CALL  nv_start_rc_timer            (nv_state_t *);
-+S032   NV_API_CALL  nv_stop_rc_timer             (nv_state_t *);
- 
--VOID   nv_post_event                (nv_state_t *, nv_event_t *, U032, U032);
--S032   nv_get_event                 (nv_state_t *, VOID *, nv_event_t *, U032 *);
-+VOID   NV_API_CALL  nv_post_event                (nv_state_t *, nv_event_t *, U032, U032);
-+S032   NV_API_CALL  nv_get_event                 (nv_state_t *, VOID *, nv_event_t *, U032 *);
- 
- 
- /*
-@@ -362,41 +362,41 @@
-  * ---------------------------------------------------------------------------
-  */
- 
--BOOL       rm_init_rm               (VOID);
--BOOL       rm_shutdown_rm           (VOID);
--BOOL       rm_init_adapter          (nv_state_t *);
--BOOL       rm_disable_adapter       (nv_state_t *);
--BOOL       rm_shutdown_adapter      (nv_state_t *);
--BOOL       rm_ioctl                 (nv_state_t *, VOID *, U032, VOID *);
--BOOL       rm_isr                   (U032, U032 *);
--VOID       rm_isr_bh                (VOID *);
--RM_STATUS  rm_power_management      (nv_state_t *, U032, U032);
--U032       rm_get_vbios_version     (nv_state_t *, U032 *, U032 *, U032 *, U032 *, U032 *);
--VOID       rm_free_unused_clients   (nv_state_t *, U032, VOID *);
--
--VOID       rm_update_agp_config     (nv_state_t *);
--RM_STATUS  rm_init_agp              (nv_state_t *);
--RM_STATUS  rm_teardown_agp          (nv_state_t *);
--
--RM_STATUS  rm_alloc_agp_pages       (nv_state_t *, VOID **, U032, U032, VOID **, U032 *);
--RM_STATUS  rm_map_agp_pages         (nv_state_t *, VOID **, U032, VOID *);
--RM_STATUS  rm_free_agp_pages        (nv_state_t *, VOID **, VOID *);
--
--RM_STATUS  rm_alloc_agp_bitmap      (nv_state_t *, U032, U032 *);
--RM_STATUS  rm_free_agp_bitmap       (nv_state_t *, U032, U032);
--RM_STATUS  rm_set_agp_bitmap        (nv_state_t *, VOID *);
--RM_STATUS  rm_clear_agp_bitmap      (nv_state_t *, VOID **);
--
--RM_STATUS  rm_load_registry         (nv_parm_t *);
--RM_STATUS  rm_read_registry_dword   (nv_state_t *, U008 *, U008 *, U032 *);
--RM_STATUS  rm_write_registry_dword  (nv_state_t *, U008 *, U008 *, U032);
--RM_STATUS  rm_read_registry_binary  (nv_state_t *, U008 *, U008 *, U008 *, U032 *);
--RM_STATUS  rm_write_registry_binary (nv_state_t *, U008 *, U008 *, U008 *, U032);
-+BOOL       NV_API_CALL  rm_init_rm               (VOID);
-+BOOL       NV_API_CALL  rm_shutdown_rm           (VOID);
-+BOOL       NV_API_CALL  rm_init_adapter          (nv_state_t *);
-+BOOL       NV_API_CALL  rm_disable_adapter       (nv_state_t *);
-+BOOL       NV_API_CALL  rm_shutdown_adapter      (nv_state_t *);
-+BOOL       NV_API_CALL  rm_ioctl                 (nv_state_t *, VOID *, U032, VOID *);
-+BOOL       NV_API_CALL  rm_isr                   (U032, U032 *);
-+VOID       NV_API_CALL  rm_isr_bh                (VOID *);
-+RM_STATUS  NV_API_CALL  rm_power_management      (nv_state_t *, U032, U032);
-+U032       NV_API_CALL  rm_get_vbios_version     (nv_state_t *, U032 *, U032 *, U032 *, U032 *, U032 *);
-+VOID       NV_API_CALL  rm_free_unused_clients   (nv_state_t *, U032, VOID *);
-+
-+VOID       NV_API_CALL  rm_update_agp_config     (nv_state_t *);
-+RM_STATUS  NV_API_CALL  rm_init_agp              (nv_state_t *);
-+RM_STATUS  NV_API_CALL  rm_teardown_agp          (nv_state_t *);
-+
-+RM_STATUS  NV_API_CALL  rm_alloc_agp_pages       (nv_state_t *, VOID **, U032, U032, VOID **, U032 *);
-+RM_STATUS  NV_API_CALL  rm_map_agp_pages         (nv_state_t *, VOID **, U032, VOID *);
-+RM_STATUS  NV_API_CALL  rm_free_agp_pages        (nv_state_t *, VOID **, VOID *);
-+
-+RM_STATUS  NV_API_CALL  rm_alloc_agp_bitmap      (nv_state_t *, U032, U032 *);
-+RM_STATUS  NV_API_CALL  rm_free_agp_bitmap       (nv_state_t *, U032, U032);
-+RM_STATUS  NV_API_CALL  rm_set_agp_bitmap        (nv_state_t *, VOID *);
-+RM_STATUS  NV_API_CALL  rm_clear_agp_bitmap      (nv_state_t *, VOID **);
-+
-+RM_STATUS  NV_API_CALL  rm_load_registry         (nv_parm_t *);
-+RM_STATUS  NV_API_CALL  rm_read_registry_dword   (nv_state_t *, U008 *, U008 *, U032 *);
-+RM_STATUS  NV_API_CALL  rm_write_registry_dword  (nv_state_t *, U008 *, U008 *, U032);
-+RM_STATUS  NV_API_CALL  rm_read_registry_binary  (nv_state_t *, U008 *, U008 *, U008 *, U032 *);
-+RM_STATUS  NV_API_CALL  rm_write_registry_binary (nv_state_t *, U008 *, U008 *, U008 *, U032);
- 
--RM_STATUS  rm_run_rc_callback       (nv_state_t *);
--RM_STATUS  rm_get_device_name       (U032, U032, U008*);
-+RM_STATUS  NV_API_CALL  rm_run_rc_callback       (nv_state_t *);
-+RM_STATUS  NV_API_CALL  rm_get_device_name       (U032, U032, U008*);
- 
--NvUI64     nv_rdtsc                 (VOID);
-+NvUI64     NV_API_CALL  nv_rdtsc                 (VOID);
- 
- #endif /* NVWATCH */
- 
-diff -ruN NVIDIA_kernel-1.0-5328/os-agp.c NVIDIA_kernel-1.0-5328-2.6/os-agp.c
---- NVIDIA_kernel-1.0-5328/os-agp.c    2003-12-17 23:54:59.000000000 +0100
-+++ NVIDIA_kernel-1.0-5328-2.6/os-agp.c        2003-12-18 13:22:54.000000000 +0100
-@@ -45,44 +45,9 @@
-     int  ready;
- } agp_gart;
- 
--typedef struct {
--    int           (*backend_acquire)(void);
--    void          (*backend_release)(void);
--    void          (*copy_info)(agp_kern_info *);
--    agp_memory *  (*allocate_memory)(size_t, unsigned int);
--    void          (*free_memory)(agp_memory *);
--    int           (*bind_memory)(agp_memory *, off_t);
--    int           (*unbind_memory)(agp_memory *);
--    void          (*enable)(unsigned int);
--} agp_operations_struct;
--
--agp_operations_struct agp_ops;
- agp_kern_info         agpinfo;
- agp_gart              gart;
--#if !defined (KERNEL_2_2)
- const drm_agp_t       *drm_agp_p;
--#endif
--
--#if defined (KERNEL_2_2)
--    #define GET_AGPGART_SYMBOL(sym, sym_string)                     \
--        sym = (void*) GET_MODULE_SYMBOL(0, sym_string);             \
--        if (sym == NULL)                                            \
--        {                                                           \
--            nv_printf(NV_DBG_ERRORS,                                \
--                "NVRM: AGPGART: unable to retrieve symbol %s\n",    \
--                sym_string);                                        \
--            return 1;                                               \
--        }
--
--    #define AGP_BACKEND_ACQUIRE_SYM   __MODULE_STRING(agp_backend_acquire)
--    #define AGP_BACKEND_RELEASE_SYM   __MODULE_STRING(agp_backend_release)
--    #define AGP_COPY_INFO_SYM         __MODULE_STRING(agp_copy_info)
--    #define AGP_ALLOCATE_MEMORY_SYM   __MODULE_STRING(agp_allocate_memory)
--    #define AGP_FREE_MEMORY_SYM       __MODULE_STRING(agp_free_memory)
--    #define AGP_BIND_MEMORY_SYM       __MODULE_STRING(agp_bind_memory)
--    #define AGP_UNBIND_MEMORY_SYM     __MODULE_STRING(agp_unbind_memory)
--    #define AGP_ENABLE_SYM            __MODULE_STRING(agp_enable)
--#endif
- 
- #if defined(CONFIG_MTRR)
- #define MTRR_DEL(gart) if ((gart).mtrr > 0) mtrr_del((gart).mtrr, 0, 0);
-@@ -110,48 +75,18 @@
- 
-     memset( (void *) &gart, 0, sizeof(agp_gart));
- 
--#if !defined (KERNEL_2_2)
-+    /*
-+     * XXX The inter_module_* mechanism has been deprecated and replaced with
-+     * a different mechanism in Linux 2.5; it will go away eventually.
-+     * Also, the Linux 2.5 AGP GART driver is modularized, agpgart.o does not
-+     * include backend drivers.
-+     */
-     if (!(drm_agp_p = inter_module_get_request("drm_agp", "agpgart")))
-     {
-         nv_printf(NV_DBG_ERRORS,
-             "NVRM: AGPGART: unable to retrieve symbol table\n");
-         return 1;
-     }
--    
--    agp_ops.backend_acquire = drm_agp_p->acquire;
--    agp_ops.backend_release = drm_agp_p->release;
--    agp_ops.allocate_memory = drm_agp_p->allocate_memory;
--    agp_ops.free_memory     = drm_agp_p->free_memory;
--    agp_ops.bind_memory     = drm_agp_p->bind_memory;
--    agp_ops.unbind_memory   = drm_agp_p->unbind_memory;
--    agp_ops.enable          = drm_agp_p->enable;
--
--    // looks like some newer kernels (for example mandrake 9.0's 2.4.19-16mdk)
--    // have updated copy_info to return an integer value, and of course didn't
--    // bother bumping the agpgart revision up. The return value is pretty 
--    // harmless (backend_acquire would have already failed and caused us to
--    // bail), so cast the function pointer to avoid compiler warnings.
--    // we may need to revisit this in the future.
--    agp_ops.copy_info       = (void (*)(agp_kern_info *)) drm_agp_p->copy_info;
--
--#else
--#if defined(CONFIG_KMOD)
--    if ( request_module("agpgart") )
--    {
--        nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: not loading agpgart.o\n");
--        return 1;
--    }
--#endif
--
--    GET_AGPGART_SYMBOL(agp_ops.backend_acquire, AGP_BACKEND_ACQUIRE_SYM);
--    GET_AGPGART_SYMBOL(agp_ops.backend_release, AGP_BACKEND_RELEASE_SYM);
--    GET_AGPGART_SYMBOL(agp_ops.copy_info,       AGP_COPY_INFO_SYM);
--    GET_AGPGART_SYMBOL(agp_ops.allocate_memory, AGP_ALLOCATE_MEMORY_SYM);
--    GET_AGPGART_SYMBOL(agp_ops.free_memory,     AGP_FREE_MEMORY_SYM);
--    GET_AGPGART_SYMBOL(agp_ops.bind_memory,     AGP_BIND_MEMORY_SYM);
--    GET_AGPGART_SYMBOL(agp_ops.unbind_memory,   AGP_UNBIND_MEMORY_SYM);
--    GET_AGPGART_SYMBOL(agp_ops.enable,          AGP_ENABLE_SYM);
--#endif
- 
-     /* NOTE: from here down, return an error code of '-1'
-      * that indicates that agpgart is loaded, but we failed to use it
-@@ -159,7 +94,7 @@
-      * the memory controller.
-      */
- 
--    if ( (*(agp_ops.backend_acquire))() )
-+    if (drm_agp_p->acquire())
-     {
-         nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: backend in use\n");
-         return -1;
-@@ -177,7 +112,21 @@
-         agp_fw = 1;
-     agp_fw &= 0x00000001;
-     
--    (*(agp_ops.copy_info))(&agpinfo);
-+#if defined(KERNEL_2_4)
-+    /*
-+     * The original Linux 2.4 AGP GART driver interface declared copy_info to
-+     * return nothing. This changed in Linux 2.5, which reports unsupported
-+     * chipsets via this function. If this Linux 2.4 kernels behaves the same
-+     * way, we have no way to know.
-+     */
-+    drm_agp_p->copy_info(&agpinfo);
-+#else
-+    if (drm_agp_p->copy_info(&agpinfo)) {
-+        drm_agp_p->release();
-+        inter_module_put("drm_agp");
-+        return -1;
-+    }
-+#endif
- 
- #ifdef CONFIG_MTRR
-     if ((gart.mtrr = mtrr_add(agpinfo.aper_base,
-@@ -191,7 +140,8 @@
-          */
-         nv_printf(NV_DBG_ERRORS, 
-             "NVRM: AGPGART: unable to set MTRR write-combining\n");
--        (*(agp_ops.backend_release))();
-+        drm_agp_p->release();
-+        inter_module_put("drm_agp");
-         return -1;
-     }
- #endif
-@@ -207,7 +157,8 @@
-     {
-         nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: unable to remap aperture\n");
-         MTRR_DEL(gart);
--        (*(agp_ops.backend_release))();
-+        drm_agp_p->release();
-+        inter_module_put("drm_agp");
-         return -1;
-     }
- 
-@@ -218,7 +169,8 @@
-         nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: unable to allocate bitmap\n");
-         NV_IOUNMAP(gart.aperture, RM_PAGE_SIZE);
-         MTRR_DEL(gart);
--        (*(agp_ops.backend_release))();
-+        drm_agp_p->release();
-+        inter_module_put("drm_agp");
-         return -1;
-     }
- 
-@@ -229,39 +181,19 @@
-         os_free_mem(bitmap);
-         NV_IOUNMAP(gart.aperture, RM_PAGE_SIZE);
-         MTRR_DEL(gart);
--        (*(agp_ops.backend_release))();
-+        drm_agp_p->release();
-+        inter_module_put("drm_agp");
-         return -1;
-     }
- 
--    nv_printf(NV_DBG_SETUP,
--        "NVRM: AGPGART: aperture: %ldM @ 0x%08lx\n",
--        (unsigned long)agpinfo.aper_size,
--        (unsigned long)agpinfo.aper_base);
--
--    nv_printf(NV_DBG_SETUP, 
--        "NVRM: AGPGART: aperture mapped from 0x%08lx to 0x%08lx\n",
--        agpinfo.aper_base,
--        (unsigned long) gart.aperture);
--
-     if (!agp_sba) agpinfo.mode &= ~0x00000200;
-     if (!agp_fw)  agpinfo.mode &= ~0x00000010;
- 
-     if (!(agp_rate & 0x00000004)) agpinfo.mode &= ~0x00000004;
-     if (!(agp_rate & 0x00000002)) agpinfo.mode &= ~0x00000002;
-     
--    (*(agp_ops.enable))(agpinfo.mode);
-+    drm_agp_p->enable(agpinfo.mode);
-     
--    if (agpinfo.mode & 0x00000200)
--        nv_printf(NV_DBG_SETUP, "NVRM: AGPGART: backend supports sba\n");
--    if (agpinfo.mode & 0x00000010)
--        nv_printf(NV_DBG_SETUP, "NVRM: AGPGART: backend supports fw\n");
--    if (agpinfo.mode & 0x00000004)
--        nv_printf(NV_DBG_SETUP, "NVRM: AGPGART: mode 4x\n");
--    else if (agpinfo.mode & 0x00000002)
--        nv_printf(NV_DBG_SETUP, "NVRM: AGPGART: mode 2x\n");
--    else if (agpinfo.mode & 0x00000001)
--        nv_printf(NV_DBG_SETUP, "NVRM: AGPGART: mode 1x\n");
--
-     *ap_phys_base   = (void*) agpinfo.aper_base;
-     *ap_mapped_base = (void*) gart.aperture;
-     *apsize         = (agpinfo.aper_size * 0x100000) - 1;
-@@ -295,11 +227,13 @@
-         NV_IOUNMAP(gart.aperture, RM_PAGE_SIZE);
-     }
- 
--    (*(agp_ops.backend_release))();
-+    drm_agp_p->release();
- 
--#if !defined (KERNEL_2_2)
-+    /*
-+     * XXX Same as above; the inter_module_* mechanism will go away at some
-+     * point, it has been deprecated in Linux 2.5.
-+     */
-     inter_module_put("drm_agp");
--#endif
- 
-     if (rm_clear_agp_bitmap(nv, &bitmap))
-     {
-@@ -346,7 +280,7 @@
-         return RM_ERROR;
-     }
- 
--    ptr = (*agp_ops.allocate_memory)(PageCount, AGP_NORMAL_MEMORY);
-+    ptr = drm_agp_p->allocate_memory(PageCount, AGP_NORMAL_MEMORY);
-     if (ptr == NULL)
-     {
-         *pAddress = (void*) 0;
-@@ -354,7 +288,7 @@
-         return RM_ERR_NO_FREE_MEM;
-     }
-     
--    err = (*(agp_ops.bind_memory))(ptr, *Offset);
-+    err = drm_agp_p->bind_memory(ptr, *Offset);
-     if (err)
-     {
-         // this happens a lot when the aperture itself fills up..
-@@ -371,7 +305,7 @@
-     if (status != RM_OK)
-     {
-         nv_printf(NV_DBG_ERRORS, "NVRM: memory allocation failed\n");
--        (*(agp_ops.unbind_memory))(ptr);
-+        drm_agp_p->unbind_memory(ptr);
-         goto fail;
-     }
- 
-@@ -386,7 +320,7 @@
-     return RM_OK;
- 
- fail:
--    (*(agp_ops.free_memory))(ptr);
-+    drm_agp_p->free_memory(ptr);
-     *pAddress = (void*) 0;
- 
-     return RM_ERROR;
-@@ -426,7 +360,7 @@
-     {
-         nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: unable to remap %lu pages\n",
-             (unsigned long)agp_data->num_pages);
--        (*(agp_ops.unbind_memory))(agp_data->ptr);
-+        drm_agp_p->unbind_memory(agp_data->ptr);
-         goto fail;
-     }
-     
-@@ -445,8 +379,6 @@
- }
- #endif
- 
--#if !defined(KERNEL_2_2)
--
- RM_STATUS 
- KernMapAGPNopage(
-     VOID *address,
-@@ -501,9 +433,6 @@
- #endif
- }
- 
--#endif /* !defined(KERNEL_2_2) */
--
--
- RM_STATUS KernFreeAGPPages(
-     nv_state_t *nv,
-     VOID **pAddress,
-@@ -529,8 +458,8 @@
-     {
-         size_t pages = ptr->page_count;
- 
--        (*(agp_ops.unbind_memory))(ptr);
--        (*(agp_ops.free_memory))(ptr);
-+        drm_agp_p->unbind_memory(ptr);
-+        drm_agp_p->free_memory(ptr);
- 
-         nv_printf(NV_DBG_INFO, "NVRM: AGPGART: freed %ld pages\n",
-             (unsigned long)pages);
-diff -ruN NVIDIA_kernel-1.0-5328/os-interface.c NVIDIA_kernel-1.0-5328-2.6/os-interface.c
---- NVIDIA_kernel-1.0-5328/os-interface.c      2003-12-17 23:54:59.000000000 +0100
-+++ NVIDIA_kernel-1.0-5328-2.6/os-interface.c  2003-12-23 10:46:50.000000000 +0100
-@@ -56,7 +56,7 @@
-     PHWINFO pDev
- )
- {
--    return suser();
-+    return NV_IS_SUSER();
- }
- 
- U032 os_get_page_size(VOID)
-@@ -211,6 +211,11 @@
- {
-     NV_MEM_TRACKING_PAD_SIZE(size);
- 
-+    /*
-+     * XXX This needs to be !NV_MAY_SLEEP() rather than in_interrupt(); that
-+     * requires quite a bit of locking to be rearranged, however, which is why
-+     * I'll leave it alone for now.
-+     */
-     if (in_interrupt()) {
-         if (size <= KMALLOC_LIMIT) {
-             /*
-@@ -296,7 +301,7 @@
-     *address = (void *) va;
- 
-     for (i = 0; i < count; i++) {
--        mem_map_reserve(GET_MAP_NR(__pa((va))));
-+        SetPageReserved(virt_to_page(va));
-         va += PAGE_SIZE;
-     }
- 
-@@ -320,7 +325,7 @@
-     unsigned long va = (unsigned long) address;
- 
-     for (i = 0; i < count; i++) {
--        mem_map_unreserve(GET_MAP_NR(__pa((va))));
-+        ClearPageReserved(virt_to_page(va));
-         va += PAGE_SIZE;
-     }
- 
-@@ -426,7 +431,7 @@
-     if (in_irq() && MilliSeconds > NV_MAX_ISR_MDELAY)
-         return RM_ERROR;
- 
--    if (in_interrupt()) 
-+    if (!NV_MAY_SLEEP()) 
-     {
-         mdelay(MilliSeconds);
-         return RM_OK;
-@@ -524,8 +529,8 @@
- // The current debug display level (default to maximum debug level)
- int cur_debuglevel = 0xaaaaaaaa;
- 
--MODULE_PARM(silence_nvidia_output, "1i");
- static int silence_nvidia_output = 0;
-+NV_MODULE_PARAMETER(silence_nvidia_output);
- 
- 
- //
-@@ -618,12 +623,28 @@
-     return value;
- }
- 
-+struct pci_dev* nvos_find_agp_by_class(unsigned int);
-+
- U032 os_pci_read_dword(
-     VOID *handle,
-     U008 offset
- ) 
- {
-     U032 value;
-+    if (!handle) {
-+        /*
-+         * XXX: This hack works around a bug in the NVIDIA AGP
-+         * GART driver, which calls us with an invalid handle
-+         * on newer Via chipsets. What we need here instead is
-+         * a handle for the AGP graphics card.
-+         */
-+        handle = nvos_find_agp_by_class(PCI_CLASS_DISPLAY_VGA);
-+
-+        if (!handle) {
-+            printk("NVRM: os_pci_read_dword(): bad handle!\n");
-+            return 0;
-+        }
-+    }
-     pci_read_config_dword( (struct pci_dev *) handle, offset, (u32 *) &value);
-     return value;
- }
-@@ -708,14 +729,14 @@
- 
- ULONG os_cli(ULONG flags)
- {
--    save_flags(flags);
--    cli();
-+    NV_SAVE_FLAGS(flags);
-+    NV_CLI();
-     return flags;
- }
- 
- ULONG os_sti(ULONG flags)
- {
--    restore_flags(flags);
-+    NV_RESTORE_FLAGS(flags);
-     return flags;
- }
- 
-@@ -848,16 +869,6 @@
-         NV_IOREMAP_NOCACHE(vaddr, start, size_bytes);
-     }
- 
--#if defined (KERNEL_2_2)
--    if ((vaddr == NULL)) // && (mode == NV_MEMORY_DEFAULT))
--    {
--        unsigned long map_nr = MAP_NR(__va(start));
--        if (map_nr < max_mapnr) {
--            vaddr = __va(start);
--        }
--    }
--#endif
--
-     return vaddr;
- }
- 
-@@ -866,16 +877,7 @@
-     U032 size_bytes
- )
- {
--#if defined (KERNEL_2_2)
--    if (MAP_NR(addr) < max_mapnr) {
--        // if we didn't want the memory cached, this isn't necessary
--        // but we shouldn't be in a timing critical piece of code.
--        asm volatile("wbinvd":::"memory");
--    } else 
--#endif
--    {
--        NV_IOUNMAP(addr, size_bytes);
--    }
-+    NV_IOUNMAP(addr, size_bytes);
- }
- 
- VOID* os_map_user_space(
-@@ -979,7 +981,7 @@
- 
- U032 os_get_cpu_count()
- {
--    return smp_num_cpus;
-+    return NV_SMP_NUM_CPUS;
- }
- 
- #if defined(DEBUG) && !defined(NVCPU_IA64)
-diff -ruN NVIDIA_kernel-1.0-5328/os-interface.h NVIDIA_kernel-1.0-5328-2.6/os-interface.h
---- NVIDIA_kernel-1.0-5328/os-interface.h      2003-12-17 23:55:00.000000000 +0100
-+++ NVIDIA_kernel-1.0-5328-2.6/os-interface.h  2003-12-31 13:42:00.000000000 +0100
-@@ -40,66 +40,66 @@
-  * ---------------------------------------------------------------------------
-  */
- 
--U032        os_get_page_size            (VOID);
--ULONG       os_get_page_mask            (VOID);
--RM_STATUS   os_alloc_mem                (VOID **, U032);
--VOID        os_free_mem                 (VOID *);
--RM_STATUS   os_alloc_contig_pages       (VOID **, U032);
--VOID        os_free_contig_pages        (VOID *, U032);
--RM_STATUS   os_get_current_time         (U032 *, U032 *);
--RM_STATUS   os_delay                    (U032);
--RM_STATUS   os_delay_us                 (U032);
--U032        os_get_cpu_frequency        (VOID);
--RM_STATUS   os_get_current_process      (U032 *);
--RM_STATUS   os_kill_process             (U032, U032);
--U008*       os_string_copy              (U008 *, const U008 *);
--RM_STATUS   os_strncpy_from_user        (U008 *, const U008 *, U032);
--S032        os_string_compare           (const U008 *, const U008 *);
--U032        os_string_length            (const U008 *);
--U008*       os_mem_copy                 (U008 *, const U008 *, U032);
--RM_STATUS   os_memcpy_from_user         (VOID *, const VOID *, U032);
--RM_STATUS   os_memcpy_to_user           (void *, const VOID *, U032);
--VOID*       os_mem_set                  (VOID *, U008, U032);
--S032        os_mem_cmp                  (const U008 *, const U008 *, U032);
--VOID*       os_pci_init_handle          (U008, U008, U008, U016 *, U016 *);
--U008        os_pci_read_byte            (VOID *, U008);
--U016        os_pci_read_word            (VOID *, U008);
--U032        os_pci_read_dword           (VOID *, U008);
--VOID        os_pci_write_byte           (VOID *, U008, U008);
--VOID        os_pci_write_word           (VOID *, U008, U016);
--VOID        os_pci_write_dword          (VOID *, U008, U032);
--VOID*       os_map_kernel_space         (U032, U032, U032);
--VOID        os_unmap_kernel_space       (VOID *, U032);
--VOID*       os_map_user_space           (VOID *, VOID **, U032, U032);
--VOID        os_unmap_user_space         (VOID *, VOID *);
--VOID*       os_map_io_space             (U032, U032, VOID **, U032, U032);
--VOID        os_unmap_io_space           (VOID *, U032, VOID *, U032);
--RM_STATUS   os_flush_cpu_cache          (VOID);
--RM_STATUS   os_set_mem_range            (U032, U032, U032);
--RM_STATUS   os_unset_mem_range          (U032, U032);
--BOOL        os_pci_device_present       (U016, U016);
--U008        os_io_read_byte             (PHWINFO, U032);
--U016        os_io_read_word             (PHWINFO, U032);
--U032        os_io_read_dword            (PHWINFO, U032);
--VOID        os_io_write_byte            (PHWINFO, U032, U008);
--VOID        os_io_write_word            (PHWINFO, U032, U016);
--VOID        os_io_write_dword           (PHWINFO, U032, U032);
--ULONG       os_cli                      (ULONG);
--ULONG       os_sti                      (ULONG);
--VOID*       os_copy_in_ioctl_param      (VOID *, VOID *, U032);
--VOID*       os_copy_out_ioctl_param     (VOID *, VOID *, U032);
--VOID*       os_registry_lookup          (PHWINFO, U008 *, U008 *);
--RM_STATUS   os_swap_barrier             (U032, VOID (*)(VOID *), VOID *);
--BOOL        os_is_administrator         (PHWINFO);
--VOID        os_dbg_init                 (VOID);
--VOID        os_dbg_breakpoint           (VOID);
--VOID        os_dbg_set_level            (U032);
--U032        os_get_cpu_count            (VOID);
--RM_STATUS   os_raise_smp_barrier        (VOID);
--RM_STATUS   os_clear_smp_barrier        (VOID);
-+U032        NV_API_CALL  os_get_page_size            (VOID);
-+ULONG       NV_API_CALL  os_get_page_mask            (VOID);
-+RM_STATUS   NV_API_CALL  os_alloc_mem                (VOID **, U032);
-+VOID        NV_API_CALL  os_free_mem                 (VOID *);
-+RM_STATUS   NV_API_CALL  os_alloc_contig_pages       (VOID **, U032);
-+VOID        NV_API_CALL  os_free_contig_pages        (VOID *, U032);
-+RM_STATUS   NV_API_CALL  os_get_current_time         (U032 *, U032 *);
-+RM_STATUS   NV_API_CALL  os_delay                    (U032);
-+RM_STATUS   NV_API_CALL  os_delay_us                 (U032);
-+U032        NV_API_CALL  os_get_cpu_frequency        (VOID);
-+RM_STATUS   NV_API_CALL  os_get_current_process      (U032 *);
-+RM_STATUS   NV_API_CALL  os_kill_process             (U032, U032);
-+U008*       NV_API_CALL  os_string_copy              (U008 *, const U008 *);
-+RM_STATUS   NV_API_CALL  os_strncpy_from_user        (U008 *, const U008 *, U032);
-+S032        NV_API_CALL  os_string_compare           (const U008 *, const U008 *);
-+U032        NV_API_CALL  os_string_length            (const U008 *);
-+U008*       NV_API_CALL  os_mem_copy                 (U008 *, const U008 *, U032);
-+RM_STATUS   NV_API_CALL  os_memcpy_from_user         (VOID *, const VOID *, U032);
-+RM_STATUS   NV_API_CALL  os_memcpy_to_user           (void *, const VOID *, U032);
-+VOID*       NV_API_CALL  os_mem_set                  (VOID *, U008, U032);
-+S032        NV_API_CALL  os_mem_cmp                  (const U008 *, const U008 *, U032);
-+VOID*       NV_API_CALL  os_pci_init_handle          (U008, U008, U008, U016 *, U016 *);
-+U008        NV_API_CALL  os_pci_read_byte            (VOID *, U008);
-+U016        NV_API_CALL  os_pci_read_word            (VOID *, U008);
-+U032        NV_API_CALL  os_pci_read_dword           (VOID *, U008);
-+VOID        NV_API_CALL  os_pci_write_byte           (VOID *, U008, U008);
-+VOID        NV_API_CALL  os_pci_write_word           (VOID *, U008, U016);
-+VOID        NV_API_CALL  os_pci_write_dword          (VOID *, U008, U032);
-+VOID*       NV_API_CALL  os_map_kernel_space         (U032, U032, U032);
-+VOID        NV_API_CALL  os_unmap_kernel_space       (VOID *, U032);
-+VOID*       NV_API_CALL  os_map_user_space           (VOID *, VOID **, U032, U032);
-+VOID        NV_API_CALL  os_unmap_user_space         (VOID *, VOID *);
-+VOID*       NV_API_CALL  os_map_io_space             (U032, U032, VOID **, U032, U032);
-+VOID        NV_API_CALL  os_unmap_io_space           (VOID *, U032, VOID *, U032);
-+RM_STATUS   NV_API_CALL  os_flush_cpu_cache          (VOID);
-+RM_STATUS   NV_API_CALL  os_set_mem_range            (U032, U032, U032);
-+RM_STATUS   NV_API_CALL  os_unset_mem_range          (U032, U032);
-+BOOL        NV_API_CALL  os_pci_device_present       (U016, U016);
-+U008        NV_API_CALL  os_io_read_byte             (PHWINFO, U032);
-+U016        NV_API_CALL  os_io_read_word             (PHWINFO, U032);
-+U032        NV_API_CALL  os_io_read_dword            (PHWINFO, U032);
-+VOID        NV_API_CALL  os_io_write_byte            (PHWINFO, U032, U008);
-+VOID        NV_API_CALL  os_io_write_word            (PHWINFO, U032, U016);
-+VOID        NV_API_CALL  os_io_write_dword           (PHWINFO, U032, U032);
-+ULONG       NV_API_CALL  os_cli                      (ULONG);
-+ULONG       NV_API_CALL  os_sti                      (ULONG);
-+VOID*       NV_API_CALL  os_copy_in_ioctl_param      (VOID *, VOID *, U032);
-+VOID*       NV_API_CALL  os_copy_out_ioctl_param     (VOID *, VOID *, U032);
-+VOID*       NV_API_CALL  os_registry_lookup          (PHWINFO, U008 *, U008 *);
-+RM_STATUS   NV_API_CALL  os_swap_barrier             (U032, VOID (*)(VOID *), VOID *);
-+BOOL        NV_API_CALL  os_is_administrator         (PHWINFO);
-+VOID        NV_API_CALL  os_dbg_init                 (VOID);
-+VOID        NV_API_CALL  os_dbg_breakpoint           (VOID);
-+VOID        NV_API_CALL  os_dbg_set_level            (U032);
-+U032        NV_API_CALL  os_get_cpu_count            (VOID);
-+RM_STATUS   NV_API_CALL  os_raise_smp_barrier        (VOID);
-+RM_STATUS   NV_API_CALL  os_clear_smp_barrier        (VOID);
- #if defined(DEBUG) && !defined(NVCPU_IA64)
--VOID        os_canary_arm               (VOID);
--VOID        os_canary_check             (VOID);
-+VOID        NV_API_CALL  os_canary_arm               (VOID);
-+VOID        NV_API_CALL  os_canary_check             (VOID);
- #define CANARY_ARM()    os_canary_arm()
- #define CANARY_CHECK()  os_canary_check()
- #else
-@@ -107,8 +107,8 @@
- #define CANARY_CHECK()
- #endif  // DEBUG & !NVCPU_IA64
- 
--RM_STATUS   osRaiseSmpBarrier           (VOID);
--RM_STATUS   osClearSmpBarrier           (VOID);
-+RM_STATUS   NV_API_CALL  osRaiseSmpBarrier           (VOID);
-+RM_STATUS   NV_API_CALL  osClearSmpBarrier           (VOID);
- 
- /*
-  * ---------------------------------------------------------------------------
-@@ -142,8 +142,8 @@
- #define NV_DBG_ERRORS     0x4
- 
- 
--void out_string(const char *str);
--int nv_printf(int debuglevel, const char *printf_format, ...);
-+void    NV_API_CALL  out_string(const char *str);
-+int     NV_API_CALL  nv_printf(int debuglevel, const char *printf_format, ...);
- 
- 
- #define NV_MEMORY_TYPE_SYSTEM       0
-diff -ruN NVIDIA_kernel-1.0-5328/os-registry.c NVIDIA_kernel-1.0-5328-2.6/os-registry.c
---- NVIDIA_kernel-1.0-5328/os-registry.c       2003-12-17 23:54:59.000000000 +0100
-+++ NVIDIA_kernel-1.0-5328-2.6/os-registry.c   2003-12-18 13:22:54.000000000 +0100
-@@ -48,24 +48,6 @@
-  *   This could be changed to work on a per-device basis.
-  */
- 
--/*
-- * The 2nd argument to MODULE_PARM is used to verify parameters passed
-- * to the module at load time. It should be a string in the following 
-- * format:
-- *
-- *    [min[-max]]{b,h,i,l,s}
-- *
-- * The MIN and MAX specifiers delimit the length of the array. If MAX
-- * is omitted, it defaults to MIN; if both are omitted, the default is
-- * 1. The final character is a type specifier.
-- *
-- *  b   byte
-- *  h   short
-- *  i   int
-- *  l   long
-- *  s   string
-- */
--
- /* 
-  * Option: VideoMemoryTypeOverride
-  * 
-@@ -92,7 +74,7 @@
-  */
- 
- static int NVreg_VideoMemoryTypeOverride = 1;
--MODULE_PARM(NVreg_VideoMemoryTypeOverride, "i");
-+NV_MODULE_PARAMETER(NVreg_VideoMemoryTypeOverride);
- 
- /*
-  * Option: EnableVia4x
-@@ -111,7 +93,7 @@
-  */
- 
- static int NVreg_EnableVia4x = 0;
--MODULE_PARM(NVreg_EnableVia4x, "i");
-+NV_MODULE_PARAMETER(NVreg_EnableVia4x);
- 
- /*
-  * Option: EnableALiAGP
-@@ -134,7 +116,7 @@
-  */
- 
- static int NVreg_EnableALiAGP = 0;
--MODULE_PARM(NVreg_EnableALiAGP, "i");
-+NV_MODULE_PARAMETER(NVreg_EnableALiAGP);
- 
- /* 
-  * Option: ReqAGPRate
-@@ -164,7 +146,7 @@
-  */
- 
- static int NVreg_ReqAGPRate = 7;
--MODULE_PARM(NVreg_ReqAGPRate, "i");
-+NV_MODULE_PARAMETER(NVreg_ReqAGPRate);
- 
- /* 
-  * Option: UpdateKernelAGP
-@@ -193,7 +175,7 @@
-  */
- 
- static int NVreg_UpdateKernelAGP = 1;
--MODULE_PARM(NVreg_UpdateKernelAGP, "i");
-+NV_MODULE_PARAMETER(NVreg_UpdateKernelAGP);
- 
- /* 
-  * Option: EnableAGPSBA
-@@ -226,7 +208,7 @@
- static int NVreg_EnableAGPSBA = 0;
- #endif
- 
--MODULE_PARM(NVreg_EnableAGPSBA, "i");
-+NV_MODULE_PARAMETER(NVreg_EnableAGPSBA);
- 
- /*
-  * Option: EnableAGPFW
-@@ -250,7 +232,7 @@
-  */
- 
- static int NVreg_EnableAGPFW = 0;
--MODULE_PARM(NVreg_EnableAGPFW, "i");
-+NV_MODULE_PARAMETER(NVreg_EnableAGPFW);
- 
- /*
-  * Option: SoftEDIDs
-@@ -269,7 +251,7 @@
-  */
- 
- static int NVreg_SoftEDIDs = 1;
--MODULE_PARM(NVreg_SoftEDIDs, "i");
-+NV_MODULE_PARAMETER(NVreg_SoftEDIDs);
- 
- /* 
-  * Option: Mobile
-@@ -293,14 +275,14 @@
-  */
- 
- static int NVreg_Mobile = ~0;
--MODULE_PARM(NVreg_Mobile, "i");
-+NV_MODULE_PARAMETER(NVreg_Mobile);
- 
- 
- static int NVreg_ResmanDebugLevel = ~0;
--MODULE_PARM(NVreg_ResmanDebugLevel, "i");
-+NV_MODULE_PARAMETER(NVreg_ResmanDebugLevel);
- 
- static int NVreg_FlatPanelMode = 0;
--MODULE_PARM(NVreg_FlatPanelMode, "i");
-+NV_MODULE_PARAMETER(NVreg_FlatPanelMode);
- 
- /*
-  * You can enable any of the registry options disabled by default by
diff --git a/media-video/nvidia-kernel/files/1.0.5332/NVIDIA-Linux-x86_64-1.0-5332-2.6.diff b/media-video/nvidia-kernel/files/1.0.5332/NVIDIA-Linux-x86_64-1.0-5332-2.6.diff
deleted file mode 100644 (file)
index e9d1f84..0000000
+++ /dev/null
@@ -1,151 +0,0 @@
-diff -urN NVIDIA-Linux-x86_64-1.0-5332-pkg0/usr/src/nv/Makefile NVIDIA-Linux-x86_64-1.0-5332-pkg0-gentoo/usr/src/nv/Makefile
---- NVIDIA-Linux-x86_64-1.0-5332-pkg0/usr/src/nv/Makefile      2004-01-09 16:07:06.000000000 -0500
-+++ NVIDIA-Linux-x86_64-1.0-5332-pkg0-gentoo/usr/src/nv/Makefile       2004-01-22 10:18:12.177456272 -0500
-@@ -1,14 +1,14 @@
- # This Makefile is automatically generated; do not edit
--#   Generated on 'builder26' on Fri Jan  9 12:42:34 PST 2004
-+#   Generated on 'builder3.nvidia.com' on Thu Jun 19 04:05:35 PDT 2003
- 
- LINUX_MODULE=nv-linux.o
--DEFINES=-D__KERNEL__ -DMODULE -D_LOOSE_KERNEL_NAMES -mcmodel=kernel -DNTRM -D_GNU_SOURCE -D_LOOSE_KERNEL_NAMES -D__KERNEL__ -DMODULE  -DNV_MAJOR_VERSION=1 -DNV_MINOR_VERSION=0 -DNV_PATCHLEVEL=5332    -DNV_UNIX  -DNV_LINUX  -DNV_INT64_OK  -DNV_64_BITS  -DNVCPU_X86_64 
-+DEFINES=-D__KERNEL__ -DMODULE -D_LOOSE_KERNEL_NAMES -DKBUILD_MODNAME="nvidia" -DNTRM -D_GNU_SOURCE -D_LOOSE_KERNEL_NAMES -D__KERNEL__ -DMODULE  -DNV_MAJOR_VERSION=1 -DNV_MINOR_VERSION=0 -DNV_PATCHLEVEL=4499     -DNV_UNIX   -DNV_LINUX   -DNV_INT64_OK   -DNVCPU_X86_64 -DNV_64_BITS -DREMAP_PAGE_RANGE_5 -DKBUILD_MODNAME=nvidia
- INCLUDES=-I.
- 
- OBJECTS=nv.o os-agp.o os-interface.o os-registry.o 
- HEADERS=os-agp.h os-interface.h nv-linux.h nv-misc.h nv-memdbg.h nv.h  rmretval.h nvtypes.h  $(VERSION_HDR)
- 
--CFLAGS=-Wall -Wimplicit -Wreturn-type -Wswitch -Wformat -Wchar-subscripts -Wparentheses -Wpointer-arith  -Wno-multichar  -Werror -O -mno-red-zone -MD $(DEFINES) $(INCLUDES) -Wno-cast-qual -Wno-error
-+CFLAGS=-Wall -Wimplicit -Wreturn-type -Wswitch -Wformat -Wchar-subscripts -Wparentheses -Wno-cast-qual -Wno-multichar  -O2 -MD $(DEFINES) $(INCLUDES) -Wno-cast-qual -mcmodel=kernel -nostdinc -iwithprefix include -fno-strict-aliasing -fno-common -mno-red-zone -mcmodel=kernel -pipe -fno-reorder-blocks -Wno-sign-compare -fno-asynchronous-unwind-tables -fomit-frame-pointer -Wdeclaration-after-statement -Wno-trigraphs -Wno-strict-prototypes 
- 
- RESMAN_KERNEL_MODULE=nv-kernel.o
- 
-@@ -50,8 +50,10 @@
- # allow specification of alternate include file tree on command line and extra defines
- ifdef SYSINCLUDE
- INCLUDES += -I$(SYSINCLUDE)
-+INCLUDES += -I$(SYSINCLUDE)/asm/mach-default
- else
- INCLUDES += -I$(KERNINC)
-+INCLUDES += -I$(KERNINC)/asm/mach-default
- endif
- 
- ifeq ($(shell sh conftest.sh remap_page_range $(INCLUDES)), 5)
-@@ -76,24 +78,62 @@
- install: package-install
- 
- suser-sanity-check:
--      @if ! sh conftest.sh suser_sanity_check nvidia; then exit 1; fi
-+      @if ! sh conftest.sh suser_sanity_check; then \
-+        echo; \
-+        echo "You have insufficient privileges for this operation. Please "; \
-+        echo "run \"make install\" as root!                               "; \
-+        echo; \
-+        exit 1; \
-+      fi
- 
- rmmod-sanity-check:
--      @if ! sh conftest.sh rmmod_sanity_check nvidia; then exit 1; fi
--
--gcc-sanity-check:
--      @if ! sh conftest.sh cc_sanity_check full_output $(CC); then exit 1; fi
--
--module: gcc-sanity-check $(LINUX_MODULE) $(RESMAN_KERNEL_MODULE) 
--      ld -r -o nvidia.o $(LINUX_MODULE) $(RESMAN_KERNEL_MODULE)
--
--package-install: module suser-sanity-check rmmod-sanity-check 
-+      @if ! sh conftest.sh rmmod_sanity_check nvidia; then \
-+        echo; \
-+        echo "Unable to unload the currently loaded NVIDIA kernel module! "; \
-+        echo "Please be certain that you have exited X before attempting  "; \
-+        echo "to install this version.                                    "; \
-+        echo; \
-+        exit 1; \
-+      fi
-+
-+cc-sanity-check:
-+      @if ! sh conftest.sh cc_sanity_check $(CC); then \
-+        echo; \
-+        echo "You appear to be building the NVIDIA kernel module with a  "; \
-+        echo "compiler different from the one that was used to build the "; \
-+        echo "running kernel. This may be perfectly fine, but there are  "; \
-+        echo "cases where this can lead to unexpected behaviour and      "; \
-+        echo "system crashes.                                            "; \
-+        echo; \
-+        echo "If you know what you are doing and want to override this   "; \
-+        echo "check, you can do so by setting IGNORE_CC_MISMATCH.        "; \
-+        echo; \
-+        echo "In any other case, set the CC environment variable to the  "; \
-+        echo "name of the compiler that was used to build the kernel.    "; \
-+        echo; \
-+        exit 1; \
-+      fi
-+
-+package-install: suser-sanity-check nvidia.o rmmod-sanity-check
-+      if [ -d $(BROKENDIR) ]; then \
-+              rm -f $(BROKENDIR)/NVdriver; \
-+              rmdir --ignore-fail-on-non-empty $(BROKENDIR); \
-+      fi && \
-       mkdir -p $(INSTALLDIR) && \
--      $(INSTALL) -m 0664 -o root -g root nvidia.o $(INSTALLDIR)/nvidia.o$(O) && \
--      PATH="$(PATH):/bin:/sbin" depmod -a && \
--              PATH="$(PATH):/bin:/sbin" modprobe nvidia && \
-+      rm -f $(INSTALLDIR)/NVdriver && \
-+      $(INSTALL) -m 0664 -o root -g root nvidia.ko $(INSTALLDIR)/nvidia.ko$(O) && \
-+      /sbin/depmod -a && \
-+      /sbin/modprobe nvidia && \
-       sh makedevices.sh && \
--      echo "nvidia.o installed successfully."; \
-+      echo "nvidia.ko installed successfully."; \
-+
-+nvidia.o: cc-sanity-check $(LINUX_MODULE) $(RESMAN_KERNEL_MODULE) 
-+      ld -d -r -o $@ $(LINUX_MODULE) $(RESMAN_KERNEL_MODULE)
-+      if [ -x /usr/src/linux/scripts/modpost ]; then \
-+              /usr/src/linux/scripts/modpost $@; \
-+              $(CC) -c $(CFLAGS) nvidia.mod.c; \
-+              ld -m elf_x86_64 -r -o nvidia.ko $@ nvidia.mod.o; \
-+      fi
- 
- $(VERSION_HDR): 
-       echo \#define NV_COMPILER \"`$(CC) -v 2>&1 | tail -n 1`\" > $@
-@@ -113,7 +153,7 @@
- 
- 
- clean:
--      $(RM) $(OBJECTS) $(LINUX_MODULE) $(VERSION_HDR) *.d NVdriver nvidia.o
-+      $(RM) $(OBJECTS) $(LINUX_MODULE) $(VERSION_HDR) *.d NVdriver nvidia.o nvidia.ko nvidia.mod.c nvidia.mod.o
- 
- 
- -include $(OBJECTS:%.o=%.d)
-diff -urN NVIDIA-Linux-x86_64-1.0-5332-pkg0/usr/src/nv/nv-linux.h NVIDIA-Linux-x86_64-1.0-5332-pkg0-gentoo/usr/src/nv/nv-linux.h
---- NVIDIA-Linux-x86_64-1.0-5332-pkg0/usr/src/nv/nv-linux.h    2004-01-09 16:07:05.000000000 -0500
-+++ NVIDIA-Linux-x86_64-1.0-5332-pkg0-gentoo/usr/src/nv/nv-linux.h     2004-01-22 10:09:29.821866392 -0500
-@@ -24,7 +24,7 @@
- #  define KERNEL_2_4
- #elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
- #  error This driver does not support 2.5 kernels!
--#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 7, 0) && defined(NVCPU_X86)
-+#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 7, 0) && ( defined(NVCPU_X86) || defined(NVCPU_X86_64) )
- #  define KERNEL_2_6
- #else
- #  error This driver does not support development kernels!
-diff -urN NVIDIA-Linux-x86_64-1.0-5332-pkg0/usr/src/nv/nv.c NVIDIA-Linux-x86_64-1.0-5332-pkg0-gentoo/usr/src/nv/nv.c
---- NVIDIA-Linux-x86_64-1.0-5332-pkg0/usr/src/nv/nv.c  2004-01-09 16:07:05.000000000 -0500
-+++ NVIDIA-Linux-x86_64-1.0-5332-pkg0-gentoo/usr/src/nv/nv.c   2004-01-22 10:11:51.897267648 -0500
-@@ -427,7 +427,8 @@
-         {
-             struct scatterlist *sg_ptr = &at->sg_list[i];
- 
--            sg_ptr->address = (char *) page_ptr->virt_addr;
-+            sg_ptr->page = virt_to_page( page_ptr->virt_addr );
-+          sg_ptr->offset = offset_in_page( page_ptr->virt_addr );
-             sg_ptr->length  = PAGE_SIZE;
- 
-             if (pci_map_sg(at->dev, sg_ptr, 1, PCI_DMA_BIDIRECTIONAL) == 0)
-@@ -435,7 +436,7 @@
-                 goto failed;
-             }
- 
--            page_ptr->dma_addr = sg_ptr->dma_address;
-+            page_ptr->dma_addr = sg_dma_address(sg_ptr);
-         }
- #endif
diff --git a/media-video/nvidia-kernel/files/1.0.5336/Makefile b/media-video/nvidia-kernel/files/1.0.5336/Makefile
deleted file mode 100644 (file)
index 8d37a89..0000000
+++ /dev/null
@@ -1,149 +0,0 @@
-# This Makefile is automatically generated; do not edit
-#   Generated on 'builder3.nvidia.com' on Thu Jun 19 04:05:35 PDT 2003
-
-LINUX_MODULE=nv-linux.o
-DEFINES=-D__KERNEL__ -DMODULE -D_LOOSE_KERNEL_NAMES -DKBUILD_MODNAME="nvidia" -DNTRM -D_GNU_SOURCE -D_LOOSE_KERNEL_NAMES -D__KERNEL__ -DMODULE  -DNV_MAJOR_VERSION=1 -DNV_MINOR_VERSION=0 -DNV_PATCHLEVEL=5328  -DNV_UNIX   -DNV_LINUX   -DNV_INT64_OK   -DNVCPU_X86
-INCLUDES=-I.
-
-OBJECTS=nv.o os-agp.o os-interface.o os-registry.o 
-HEADERS=os-agp.h os-interface.h nv-linux.h nv-misc.h nv-memdbg.h nv.h  rmretval.h nvtypes.h  $(VERSION_HDR)
-
-CFLAGS=-Wall -Wimplicit -Wreturn-type -Wswitch -Wformat -Wchar-subscripts -Wparentheses -Wcast-qual -Wno-multichar  -O -MD $(DEFINES) $(INCLUDES) -Wno-cast-qual
-
-RESMAN_KERNEL_MODULE=nv-kernel.o
-
-ifeq ($(KERNDIR),)
-KERNDIR=/lib/modules/$(shell uname -r)
-endif
-
-# check for newer paths. if found, use them, otherwise use old paths
-# these wouldn't work with the gnu make included with rh6.2
-# KERNINC=$(if -d $(KERNDIR)/build, $(KERNDIR)/build/include, /usr/src/linux/include)
-# INSTALLDIR=$(if -d $(KERNDIR)/kernel, $(KERNDIR)/kernel/drivers/video, $(KERNDIR)/video)
-
-# this is slightly more brain-dead, but works..
-ifeq ($(shell if test -d $(KERNDIR)/build; then echo yes; fi),yes)
-KERNINC=$(KERNDIR)/build/include
-else
-  ifeq ($(shell if test -d $(KERNDIR)/include; then echo yes; fi),yes)
-    KERNINC=$(KERNDIR)/include
-  else
-    KERNINC=/usr/src/linux/include
-  endif
-endif
-
-ifeq ($(shell if test -d $(KERNDIR)/kernel; then echo yes; fi),yes)
-INSTALLDIR=$(KERNDIR)/kernel/drivers/video
-else
-INSTALLDIR=$(KERNDIR)/video
-endif
-
-ifeq ($(shell echo $(NVDEBUG)),1)
-  ifeq ($(shell test -z $(RMDEBUG) && echo yes),yes)
-    RMDEBUG=1
-  endif
-endif
-
-ifeq ($(shell echo $(RMDEBUG)),1)
-CFLAGS += -DDEBUG -g -fno-common
-endif
-
-# this is just plain wrong, get rid of it
-BROKENDIR=$(KERNDIR)/kernel/video
-
-INSTALL=$(shell which install)
-
-# allow specification of alternate include file tree on command line and extra defines
-ifdef SYSINCLUDE
-INCLUDES += -I$(SYSINCLUDE)
-INCLUDES += -I$(SYSINCLUDE)/asm/mach-default
-else
-INCLUDES += -I$(KERNINC)
-INCLUDES += -I$(KERNINC)/asm/mach-default
-endif
-
-ifeq ($(shell sh conftest.sh remap_page_range $(INCLUDES)), 5)
-  DEFINES += -DREMAP_PAGE_RANGE_5
-endif
-
-ifeq ($(shell sh conftest.sh remap_page_range $(INCLUDES)), 4)
-  DEFINES += -DREMAP_PAGE_RANGE_4
-endif
-
-ifeq ($(shell sh conftest.sh class_simple $(INCLUDES)), yes)
-  DEFINES += -DHAVE_CLASS_SIMPLE
-endif
-
-DEFINES+=$(EXTRA_DEFINES)
-
-# allow build parameters to be passed in through the environment
-ifdef BUILD_PARAMS
-    DEFINES+=-D$(BUILD_PARAMS)
-endif
-
-VERSION_HDR=nv_compiler.h
-
-all: install
-
-install: package-install
-
-suser-sanity-check:
-       @if ! sh conftest.sh suser_sanity_check; then \
-         echo; \
-         echo "You have insufficient privileges for this operation. Please "; \
-         echo "run \"make install\" as root!                               "; \
-         echo; \
-         exit 1; \
-       fi
-
-rmmod-sanity-check:
-       @if ! sh conftest.sh rmmod_sanity_check nvidia; then \
-         echo; \
-         echo "Unable to unload the currently loaded NVIDIA kernel module! "; \
-         echo "Please be certain that you have exited X before attempting  "; \
-         echo "to install this version.                                    "; \
-         echo; \
-         exit 1; \
-       fi
-
-cc-sanity-check:
-       @if ! sh conftest.sh cc_sanity_check full_output $(CC); then exit 1; fi
-
-package-install: suser-sanity-check nvidia.o rmmod-sanity-check
-       if [ -d $(BROKENDIR) ]; then \
-               rm -f $(BROKENDIR)/NVdriver; \
-               rmdir --ignore-fail-on-non-empty $(BROKENDIR); \
-       fi && \
-       mkdir -p $(INSTALLDIR) && \
-       rm -f $(INSTALLDIR)/NVdriver && \
-       $(INSTALL) -m 0664 -o root -g root nvidia.o $(INSTALLDIR)/nvidia.o$(O) && \
-       /sbin/depmod -a && \
-       /sbin/modprobe nvidia && \
-       sh makedevices.sh && \
-       echo "nvidia.o installed successfully."; \
-
-nvidia.o: cc-sanity-check $(LINUX_MODULE) $(RESMAN_KERNEL_MODULE) 
-       ld -d -r -o $@ $(LINUX_MODULE) $(RESMAN_KERNEL_MODULE)
-
-$(VERSION_HDR): 
-       echo \#define NV_COMPILER \"`$(CC) -v 2>&1 | tail -n 1`\" > $@
-
-$(LINUX_MODULE): $(OBJECTS)
-       ld -r -o $@ $(OBJECTS)
-
-%.o: %.c $(HEADERS)
-       $(CC) -c $(CFLAGS) $<
-
-# debug tool to preprocess the file and leave .i to make it easier to untangle #defines
-%.i: %.c
-       $(CC) $(CFLAGS) -E $< > $@
-
-%.s: %.c
-       $(CC) $(CFLAGS) -S $< > $@
-
-
-clean:
-       $(RM) $(OBJECTS) $(LINUX_MODULE) $(VERSION_HDR) *.d NVdriver nvidia.o
-
-
--include $(OBJECTS:%.o=%.d)
diff --git a/media-video/nvidia-kernel/files/1.0.5336/NVIDIA_kernel-1.0-5336-2.6-20040521.patch b/media-video/nvidia-kernel/files/1.0.5336/NVIDIA_kernel-1.0-5336-2.6-20040521.patch
deleted file mode 100644 (file)
index 502833d..0000000
+++ /dev/null
@@ -1,829 +0,0 @@
-diff -ruN NVIDIA_kernel-1.0-5336/Makefile.kbuild NVIDIA_kernel-1.0-5336-2.6/Makefile.kbuild
---- NVIDIA_kernel-1.0-5336/Makefile.kbuild     2004-01-15 04:29:12.000000000 +0100
-+++ NVIDIA_kernel-1.0-5336-2.6/Makefile.kbuild 2004-05-12 19:17:49.000000000 +0200
-@@ -73,7 +73,7 @@
- #
- 
- EXTRA_CFLAGS += -I$(src)
--EXTRA_CFLAGS += -Wall -Wimplicit -Wreturn-type -Wswitch -Wformat -Wchar-subscripts -Wparentheses -Wpointer-arith  -Wno-multichar  -Werror -O -MD $(DEFINES) $(INCLUDES) -Wno-cast-qual -Wno-error
-+EXTRA_CFLAGS += -Wall -Wimplicit -Wreturn-type -Wswitch -Wformat -Wchar-subscripts -Wparentheses -Wno-pointer-arith  -Wno-multichar  -Werror -O -MD $(DEFINES) $(INCLUDES) -Wno-cast-qual -Wno-error
- 
- #
- # We rely on these two definitions below; if they aren't set, we set them to
-diff -ruN NVIDIA_kernel-1.0-5336/nv-linux.h NVIDIA_kernel-1.0-5336-2.6/nv-linux.h
---- NVIDIA_kernel-1.0-5336/nv-linux.h  2004-01-15 04:29:11.000000000 +0100
-+++ NVIDIA_kernel-1.0-5336-2.6/nv-linux.h      2004-05-12 19:17:36.000000000 +0200
-@@ -136,16 +136,19 @@
- 
- #if NV_ENABLE_MEM_TRACKING
- #define NV_MEM_TRACKING_PAD_SIZE(size)   ((size) += sizeof(void *))
--#define NV_MEM_TRACKING_HIDE_SIZE(ptr, size) \
--    if ((ptr) && *(ptr)) { \
--        *(int *) *(ptr) = (size); \
--        (char *) *(ptr) += sizeof(void *); \
--    }
--#define NV_MEM_TRACKING_RETRIEVE_SIZE(ptr, size) \
--    { \
--        (char *) (ptr) -= sizeof(void *); \
--        size = *(int *) (ptr); \
--    }
-+#define NV_MEM_TRACKING_HIDE_SIZE(ptr, size)            \
-+    if ((ptr) && *(ptr)) {                              \
-+        U008 *__ptr;                                    \
-+        *(unsigned long *) *(ptr) = (size);             \
-+        __ptr = *(ptr); __ptr += sizeof(void *);        \
-+        *(ptr) = (void *) __ptr;                        \
-+    }
-+#define NV_MEM_TRACKING_RETRIEVE_SIZE(ptr, size)        \
-+    {                                                   \
-+        U008 *__ptr = (ptr); __ptr -= sizeof(void *);   \
-+        (ptr) = (void *) __ptr;                         \
-+        size = *(unsigned long *) (ptr);                \
-+    } 
- #else
- #define NV_MEM_TRACKING_PAD_SIZE(size)
- #define NV_MEM_TRACKING_HIDE_SIZE(ptr, size)
-@@ -293,13 +296,13 @@
- #if defined(NVCPU_IA64)
- #define NV_VMALLOC(ptr, size) \
-     { \
--        (void *) (ptr) = vmalloc_dma(size); \
-+        (ptr) = vmalloc_dma(size); \
-         VM_ALLOC_RECORD(ptr, size, "vm_alloc"); \
-     }
- #else
- #define NV_VMALLOC(ptr, size) \
-     { \
--        (void *) (ptr) = vmalloc_32(size); \
-+        (ptr) = vmalloc_32(size); \
-         VM_ALLOC_RECORD(ptr, size, "vm_alloc"); \
-     }
- #endif
-@@ -312,13 +315,13 @@
- 
- #define NV_IOREMAP(ptr, physaddr, size) \
-     { \
--        (void *) (ptr) = ioremap(physaddr, size); \
-+        (ptr) = ioremap(physaddr, size); \
-         VM_ALLOC_RECORD(ptr, size, "vm_ioremap"); \
-     }
- 
- #define NV_IOREMAP_NOCACHE(ptr, physaddr, size) \
-     { \
--        (void *) (ptr) = ioremap_nocache(physaddr, size); \
-+        (ptr) = ioremap_nocache(physaddr, size); \
-         VM_ALLOC_RECORD(ptr, size, "vm_ioremap_nocache"); \
-     }
- 
-@@ -333,13 +336,13 @@
-  */
- #define NV_KMALLOC(ptr, size) \
-     { \
--        (void *) (ptr) = kmalloc(size, GFP_KERNEL); \
-+        (ptr) = kmalloc(size, GFP_KERNEL); \
-         KM_ALLOC_RECORD(ptr, size, "km_alloc"); \
-     }
- 
- #define NV_KMALLOC_ATOMIC(ptr, size) \
-     { \
--        (void *) (ptr) = kmalloc(size, GFP_ATOMIC); \
-+        (ptr) = kmalloc(size, GFP_ATOMIC); \
-         KM_ALLOC_RECORD(ptr, size, "km_alloc_atomic"); \
-     }  
- 
-@@ -352,7 +355,7 @@
- 
- #define NV_GET_FREE_PAGES(ptr, order) \
-     { \
--        (void *) (ptr) = __get_free_pages(NV_GFP_HW, order); \
-+        (ptr) = __get_free_pages(NV_GFP_HW, order); \
-     }
-         
- #define NV_FREE_PAGES(ptr, order) \
-@@ -689,8 +692,7 @@
- #define NV_GET_NVFP(filep)      ((nv_file_private_t *) FILE_PRIVATE(filep))
- 
- /* for the card devices */
--#define NVL_FROM_FILEP(filep) \
--    ((nv_linux_state_t*) (NV_GET_NVFP(filep))->nvptr)
-+#define NVL_FROM_FILEP(filep)   (NV_GET_NVFP(filep)->nvptr)
- 
- #define NV_GET_NVL_FROM_NV_STATE(nv) \
-     ((nv_linux_state_t *) nv->os_state)
-diff -ruN NVIDIA_kernel-1.0-5336/nv.c NVIDIA_kernel-1.0-5336-2.6/nv.c
---- NVIDIA_kernel-1.0-5336/nv.c        2004-01-15 04:29:11.000000000 +0100
-+++ NVIDIA_kernel-1.0-5336-2.6/nv.c    2004-05-12 19:18:29.000000000 +0200
-@@ -1182,7 +1182,7 @@
- struct vm_operations_struct nv_vm_ops = {
-     nv_kern_vma_open,
-     nv_kern_vma_release,  /* "close" */
--    nv_kern_vma_nopage,
-+/*  nv_kern_vma_nopage, */
- };
- 
- static nv_file_private_t *
-@@ -2006,7 +2006,7 @@
-  * waiting on the wait queue
-  */
- 
--void nv_set_hotkey_occurred_flag(void)
-+void NV_API_CALL nv_set_hotkey_occurred_flag(void)
- {
-     nv_printf(NV_DBG_EVENTINFO,"setting the hotkey occurred flag!\n");
- 
-@@ -2190,7 +2190,7 @@
-  *** EXPORTS to rest of resman
-  ***/
- 
--void *nv_find_nv_mapping(
-+void* NV_API_CALL nv_find_nv_mapping(
-     nv_state_t    *nv,
-     unsigned long  address
- )
-@@ -2261,8 +2261,7 @@
-  * the TYPE_AGP flag to differeniate it from a PCI allocation.
-  * failure is fine, we may just be checking if a given page is agp
-  */
--void *
--nv_find_agp_kernel_mapping(
-+void* NV_API_CALL nv_find_agp_kernel_mapping(
-     nv_state_t    *nv,
-     unsigned long  address
- )
-@@ -2338,8 +2337,7 @@
-     return (unsigned long) NULL;
- }
- 
--unsigned long
--nv_get_kern_phys_address(
-+unsigned long NV_API_CALL nv_get_kern_phys_address(
-     unsigned long address
- )
- {
-@@ -2368,8 +2366,7 @@
-     return _get_phys_address(address, 1);
- }
- 
--unsigned long
--nv_get_user_phys_address(
-+unsigned long NV_API_CALL nv_get_user_phys_address(
-     unsigned long address
- )
- {
-@@ -2391,8 +2388,7 @@
- 
- 
- /* allocate memory for DMA push buffers */
--int
--nv_alloc_pages(
-+int NV_API_CALL nv_alloc_pages(
-     nv_state_t *nv,
-     void **pAddress,
-     unsigned int page_count,
-@@ -2583,8 +2579,7 @@
-         return -1; \
-     }
- 
--int
--nv_free_pages(
-+int NV_API_CALL nv_free_pages(
-     nv_state_t *nv,
-     void **pAddress,
-     unsigned int page_count,
-@@ -2686,7 +2681,7 @@
-     nvl->rm_lock_count = 0;
- }
- 
--void nv_lock_rm(
-+void NV_API_CALL nv_lock_rm(
-     nv_state_t *nv
- )
- {
-@@ -2706,7 +2701,7 @@
-    nvl->rm_lock_count = 1;
- }
- 
--void nv_unlock_rm(
-+void NV_API_CALL nv_unlock_rm(
-     nv_state_t *nv
- )
- {
-@@ -2720,7 +2715,7 @@
-     spin_unlock_irq(&nvl->rm_lock);
- }
- 
--void nv_lock_heap(
-+void NV_API_CALL nv_lock_heap(
-     nv_state_t *nv
- )
- {
-@@ -2730,7 +2725,7 @@
-     nv_lock(nvl->heap_lock);
- }
- 
--void nv_unlock_heap(
-+void NV_API_CALL nv_unlock_heap(
-     nv_state_t *nv
- )
- {
-@@ -2743,7 +2738,7 @@
- /*
- ** post the event
- */
--void nv_post_event(
-+void NV_API_CALL nv_post_event(
-     nv_state_t *nv,
-     nv_event_t *event,
-     U032        handle,
-@@ -2781,7 +2776,7 @@
-     nv_unlock_irq(nvfp->fp_lock, eflags);
- }
- 
--int nv_get_event(
-+int NV_API_CALL nv_get_event(
-     nv_state_t *nv,
-     VOID *void_file,
-     nv_event_t *event,
-@@ -2822,8 +2817,7 @@
- }
- 
- 
--int
--nv_agp_init(
-+int NV_API_CALL nv_agp_init(
-     nv_state_t *nv,
-     VOID **phys_start,
-     VOID **linear_start,
-@@ -2888,8 +2882,7 @@
-     return status;
- }
- 
--int
--nv_agp_teardown(
-+int NV_API_CALL nv_agp_teardown(
-     nv_state_t *nv
- )
- {
-@@ -2926,8 +2919,7 @@
-  * (if the linear mapping was real, this is the page that would have been
-  * addressed by the virtual address. I know, confusing).
-  */
--int
--nv_agp_translate_address(
-+int NV_API_CALL nv_agp_translate_address(
-     nv_state_t *nv,
-     void       *base,
-     U032        index,
-@@ -2956,8 +2948,7 @@
- }
- 
- 
--int
--nv_int10h_call(
-+int NV_API_CALL nv_int10h_call(
-     nv_state_t *nv,
-     U032 *eax,
-     U032 *ebx,
-@@ -2970,8 +2961,7 @@
- }
- 
- /* set a timer to go off every second */
--int 
--nv_start_rc_timer(
-+int NV_API_CALL nv_start_rc_timer(
-     nv_state_t *nv
- )
- {
-@@ -2991,8 +2981,7 @@
-     return 0;
- }
- 
--int 
--nv_stop_rc_timer(
-+int NV_API_CALL nv_stop_rc_timer(
-     nv_state_t *nv
- )
- {
-diff -ruN NVIDIA_kernel-1.0-5336/os-interface.c NVIDIA_kernel-1.0-5336-2.6/os-interface.c
---- NVIDIA_kernel-1.0-5336/os-interface.c      2004-01-15 04:29:11.000000000 +0100
-+++ NVIDIA_kernel-1.0-5336-2.6/os-interface.c  2004-05-12 19:09:35.000000000 +0200
-@@ -35,7 +35,7 @@
- }
- #endif
- 
--RM_STATUS os_raise_smp_barrier(VOID)
-+RM_STATUS NV_API_CALL os_raise_smp_barrier(VOID)
- {
-     os_block_on_smp_barrier = 1;
- #ifdef CONFIG_SMP
-@@ -45,26 +45,26 @@
-     return RM_OK;
- }
- 
--RM_STATUS os_clear_smp_barrier(VOID)
-+RM_STATUS NV_API_CALL os_clear_smp_barrier(VOID)
- {
-     os_block_on_smp_barrier = 0;
-     return RM_OK;
- }
- 
- // return TRUE if the caller is the super-user
--BOOL os_is_administrator(
-+BOOL NV_API_CALL os_is_administrator(
-     PHWINFO pDev
- )
- {
-     return NV_IS_SUSER();
- }
- 
--U032 os_get_page_size(VOID)
-+U032 NV_API_CALL os_get_page_size(VOID)
- {
-     return PAGE_SIZE;
- }
- 
--ULONG os_get_page_mask(VOID)
-+ULONG NV_API_CALL os_get_page_mask(VOID)
- {
-     return PAGE_MASK;
- }
-@@ -78,7 +78,7 @@
- // just replace the code within osStringCopy with a call to the C library
- // function strcpy.
- //
--U008* os_string_copy(
-+U008* NV_API_CALL os_string_copy(
-     U008 *dst,
-     const U008 *src
- )
-@@ -86,7 +86,7 @@
-     return strcpy(dst, src);
- }
- 
--RM_STATUS os_strncpy_from_user(
-+RM_STATUS NV_API_CALL os_strncpy_from_user(
-     U008 *dst,
-     const U008 *src,
-     U032 n
-@@ -99,7 +99,7 @@
- #endif
- }
- 
--S032 os_string_compare(
-+S032 NV_API_CALL os_string_compare(
-     const U008 *s1,
-     const U008 *s2
- )
-@@ -107,14 +107,14 @@
-     return strcmp(s1, s2);
- }
- 
--U032 os_string_length(
-+U032 NV_API_CALL os_string_length(
-     const U008* str
- )
- {
-     return strlen(str);
- }
- 
--U008* os_mem_copy(
-+U008* NV_API_CALL os_mem_copy(
-     U008 *dst,
-     const U008 *src,
-     U032 length
-@@ -123,7 +123,7 @@
-     return memcpy(dst, src, length);
- }
- 
--RM_STATUS os_memcpy_from_user(
-+RM_STATUS NV_API_CALL os_memcpy_from_user(
-     VOID *dst,
-     const VOID* src,
-     U032 length
-@@ -132,7 +132,7 @@
-     return copy_from_user(dst, src, length) ? RM_ERR_BAD_ADDRESS : RM_OK;
- }
- 
--RM_STATUS os_memcpy_to_user(
-+RM_STATUS NV_API_CALL os_memcpy_to_user(
-     VOID *dst,
-     const VOID* src,
-     U032 length
-@@ -141,7 +141,7 @@
-     return copy_to_user(dst, src, length) ? RM_ERR_BAD_ADDRESS : RM_OK;
- }
- 
--VOID* os_mem_set(
-+VOID* NV_API_CALL os_mem_set(
-     VOID* dst,
-     U008 c,
-     U032 length
-@@ -150,7 +150,7 @@
-     return memset(dst, (int)c, length);
- }
- 
--S032 os_mem_cmp(
-+S032 NV_API_CALL os_mem_cmp(
-     const U008 *buf0,
-     const U008* buf1,
-     U032 length
-@@ -159,7 +159,7 @@
-     return memcmp(buf0, buf1, length);
- }
- 
--VOID* os_copy_in_ioctl_param(
-+VOID* NV_API_CALL os_copy_in_ioctl_param(
-     VOID *dst,
-     VOID *src,
-     U032 length
-@@ -172,7 +172,7 @@
-     }
- }
- 
--VOID* os_copy_out_ioctl_param(
-+VOID* NV_API_CALL os_copy_out_ioctl_param(
-     VOID *dst,
-     VOID *src,
-     U032 length
-@@ -204,7 +204,7 @@
- 
- #define KMALLOC_LIMIT 131072
- 
--RM_STATUS os_alloc_mem(
-+RM_STATUS NV_API_CALL os_alloc_mem(
-     VOID **address,
-     U032 size
- )
-@@ -251,7 +251,7 @@
-     return *address ? RM_OK : RM_ERR_NO_FREE_MEM;
- }
- 
--void os_free_mem(VOID *address)
-+void NV_API_CALL os_free_mem(VOID *address)
- {
-     unsigned long va;
-     int size;
-@@ -273,7 +273,7 @@
-  * we may allocate more pages than the caller really asked for.
-  * we'll only lock down the number of pages the caller asked for.
-  */
--RM_STATUS os_alloc_contig_pages(
-+RM_STATUS NV_API_CALL os_alloc_contig_pages(
-     VOID **address,
-     U032 size
- )
-@@ -310,7 +310,7 @@
-  * the same number of pages we locked, and to calculate the order we
-  * allocated, so we properly free the allocation.
-  */
--VOID os_free_contig_pages(
-+VOID NV_API_CALL os_free_contig_pages(
-     VOID *address,
-     U032 size
- )
-@@ -335,7 +335,7 @@
- *
- *****************************************************************************/
- 
--RM_STATUS os_get_current_time(
-+RM_STATUS NV_API_CALL os_get_current_time(
-     U032 *seconds,
-     U032 *useconds
- )
-@@ -371,7 +371,7 @@
-  * this, we use mdelay() for any full millisecond to be safe.
-  */
- 
--RM_STATUS os_delay_us(U032 MicroSeconds)
-+RM_STATUS NV_API_CALL os_delay_us(U032 MicroSeconds)
- {
-     unsigned long mdelay_safe_msec;
-     unsigned long usec;
-@@ -411,7 +411,7 @@
-  * remainder will be accounted for with mdelay().
-  */
- 
--RM_STATUS os_delay(U032 MilliSeconds)
-+RM_STATUS NV_API_CALL os_delay(U032 MilliSeconds)
- {
-     unsigned long MicroSeconds;
-     unsigned long jiffies;
-@@ -481,7 +481,7 @@
- }
- 
- /* return CPU frequency in MHz */
--U032 os_get_cpu_frequency(VOID)
-+U032 NV_API_CALL os_get_cpu_frequency(VOID)
- {
-     u64 tsc[2];
-     u32 tsc_d;
-@@ -500,13 +500,13 @@
-     return cpu_mhz;
- }
- 
--RM_STATUS os_get_current_process(U032 *pPid)
-+RM_STATUS NV_API_CALL os_get_current_process(U032 *pPid)
- {
-     *pPid = current->pid;
-     return RM_OK;
- }
- 
--RM_STATUS os_kill_process(
-+RM_STATUS NV_API_CALL os_kill_process(
-     U032 pid,
-     U032 sig
- )
-@@ -531,7 +531,7 @@
- //
- // this is what actually outputs the data.
- //
--inline void out_string(const char *str)
-+inline void NV_API_CALL out_string(const char *str)
- {
-     printk("%d: %s", smp_processor_id(), str);
- }    
-@@ -546,7 +546,7 @@
-  * Returns the number of characters written.
-  */
- 
--int nv_printf(
-+int NV_API_CALL nv_printf(
-     int   debuglevel,
-     const char *printf_format,
-     ...
-@@ -571,7 +571,7 @@
-     return chars_written;
- }
- 
--BOOL os_pci_device_present(
-+BOOL NV_API_CALL os_pci_device_present(
-     U016 vendor,
-     U016 device
- )
-@@ -587,7 +587,7 @@
-         return ret; \
-     }
- 
--VOID* os_pci_init_handle(
-+VOID* NV_API_CALL os_pci_init_handle(
-     U008 bus,
-     U008 slot,
-     U008 function,
-@@ -604,7 +604,7 @@
-     return (VOID *) dev;
- }
- 
--U008 os_pci_read_byte(
-+U008 NV_API_CALL os_pci_read_byte(
-     VOID *handle,
-     U008 offset
- )
-@@ -615,7 +615,7 @@
-     return value;
- }
- 
--U016 os_pci_read_word(
-+U016 NV_API_CALL os_pci_read_word(
-     VOID *handle,
-     U008 offset
- )
-@@ -626,7 +626,7 @@
-     return value;
- }
- 
--U032 os_pci_read_dword(
-+U032 NV_API_CALL os_pci_read_dword(
-     VOID *handle,
-     U008 offset
- ) 
-@@ -637,7 +637,7 @@
-     return value;
- }
- 
--VOID os_pci_write_byte(
-+VOID NV_API_CALL os_pci_write_byte(
-     VOID *handle,
-     U008 offset,
-     U008 value
-@@ -647,7 +647,7 @@
-     pci_write_config_byte( (struct pci_dev *) handle, offset, value);
- }
- 
--VOID os_pci_write_word(
-+VOID NV_API_CALL os_pci_write_word(
-     VOID *handle,
-     U008 offset,
-     U016 value
-@@ -657,7 +657,7 @@
-     pci_write_config_word( (struct pci_dev *) handle, offset, value);
- }
- 
--VOID os_pci_write_dword(
-+VOID NV_API_CALL os_pci_write_dword(
-     VOID *handle,
-     U008 offset,
-     U032 value
-@@ -667,7 +667,7 @@
-     pci_write_config_dword( (struct pci_dev *) handle, offset, value);
- }
- 
--VOID os_io_write_byte(
-+VOID NV_API_CALL os_io_write_byte(
-     PHWINFO pdev,
-     U032 address,
-     U008 value
-@@ -676,7 +676,7 @@
-     outb(value, address);
- }
- 
--VOID os_io_write_word(
-+VOID NV_API_CALL os_io_write_word(
-     PHWINFO pdev,
-     U032 address,
-     U016 value
-@@ -685,7 +685,7 @@
-     outw(value, address);
- }
- 
--VOID os_io_write_dword(
-+VOID NV_API_CALL os_io_write_dword(
-     PHWINFO pdev,
-     U032 address,
-     U032 value
-@@ -694,7 +694,7 @@
-     outl(value, address);
- }
- 
--U008 os_io_read_byte(
-+U008 NV_API_CALL os_io_read_byte(
-     PHWINFO pdev,
-     U032 address
- )
-@@ -702,7 +702,7 @@
-     return inb(address);
- }
- 
--U016 os_io_read_word(
-+U016 NV_API_CALL os_io_read_word(
-     PHWINFO pdev,
-     U032 address
- )
-@@ -710,7 +710,7 @@
-     return inw(address);
- }
- 
--U032 os_io_read_dword(
-+U032 NV_API_CALL os_io_read_dword(
-     PHWINFO pdev,
-     U032 address
- )
-@@ -718,14 +718,14 @@
-     return inl(address);
- }
- 
--ULONG os_cli(ULONG flags)
-+ULONG NV_API_CALL os_cli(ULONG flags)
- {
-     NV_SAVE_FLAGS(flags);
-     NV_CLI();
-     return flags;
- }
- 
--ULONG os_sti(ULONG flags)
-+ULONG NV_API_CALL os_sti(ULONG flags)
- {
-     NV_RESTORE_FLAGS(flags);
-     return flags;
-@@ -789,7 +789,7 @@
-  * achieve the same results on a PIII or higher
-  */
- 
--RM_STATUS os_set_mem_range(
-+RM_STATUS NV_API_CALL os_set_mem_range(
-     U032 start,
-     U032 size,
-     U032 mode
-@@ -817,7 +817,7 @@
-     return RM_ERROR;
- }
- 
--RM_STATUS os_unset_mem_range(
-+RM_STATUS NV_API_CALL os_unset_mem_range(
-     U032 start,
-     U032 size
- )
-@@ -839,7 +839,7 @@
-  * should this also check for Write-Combining??
-  */
- 
--VOID *os_map_kernel_space(
-+VOID *NV_API_CALL os_map_kernel_space(
-     U032 start,
-     U032 size_bytes,
-     U032 mode
-@@ -864,7 +864,7 @@
-     return vaddr;
- }
- 
--VOID os_unmap_kernel_space(
-+VOID NV_API_CALL os_unmap_kernel_space(
-     VOID *addr,
-     U032 size_bytes
- )
-@@ -872,7 +872,7 @@
-     NV_IOUNMAP(addr, size_bytes);
- }
- 
--VOID* os_map_user_space(
-+VOID* NV_API_CALL os_map_user_space(
-     VOID *kaddr,
-     VOID **priv,
-     U032 size_bytes,
-@@ -883,14 +883,14 @@
-     return NULL;
- }
- 
--VOID os_unmap_user_space(
-+VOID NV_API_CALL os_unmap_user_space(
-     VOID *uaddr,
-     VOID *priv
- )
- {
- }
- 
--VOID* os_map_io_space(
-+VOID* NV_API_CALL os_map_io_space(
-     U032 start,
-     U032 size_bytes,
-     VOID **priv,
-@@ -920,7 +920,7 @@
-     return (void *)(NV_UINTPTR_T) vma->vm_start;
- }
- 
--VOID os_unmap_io_space(
-+VOID NV_API_CALL os_unmap_io_space(
-     VOID *addr,
-     U032 size_bytes,
-     VOID *priv,
-@@ -930,14 +930,14 @@
- }
- 
- // flush the cpu's cache, uni-processor version
--RM_STATUS os_flush_cpu_cache()
-+RM_STATUS NV_API_CALL os_flush_cpu_cache()
- {
-     CACHE_FLUSH();
-     return RM_OK;
- }
- 
- // override initial debug level from registry
--VOID os_dbg_init(void)
-+VOID NV_API_CALL os_dbg_init(void)
- {
-     U032 new_debuglevel;
-     if (RM_OK == rm_read_registry_dword(0,
-@@ -950,7 +950,7 @@
-     }
- }
- 
--VOID os_dbg_set_level(U032 new_debuglevel)
-+VOID NV_API_CALL os_dbg_set_level(U032 new_debuglevel)
- {
-     nv_printf(NV_DBG_SETUP, "Changing debuglevel from 0x%x to 0x%x\n", cur_debuglevel, new_debuglevel);
-     cur_debuglevel = new_debuglevel;
-@@ -962,7 +962,7 @@
-  * a lock or which threw the breakpoint. I should probably scan the list of
-  * nv_state_t's and drop any held locks before throwing this breakpoint.
-  */
--VOID os_dbg_breakpoint(void)
-+VOID NV_API_CALL os_dbg_breakpoint(void)
- {
- #ifdef DEBUG
-     out_string("Break\n");
-@@ -979,7 +979,7 @@
- }
- 
- 
--U032 os_get_cpu_count()
-+U032 NV_API_CALL os_get_cpu_count()
- {
-     return NV_NUM_CPUS();
- }
-@@ -1008,7 +1008,7 @@
- #define NV_CANARY_CAGE  ((unsigned long *)(current + 1))
- 
- void
--os_canary_arm()
-+NV_API_CALL os_canary_arm()
- {
-     int i;
- 
-@@ -1017,7 +1017,7 @@
- }
- 
- void
--os_canary_check()
-+NV_API_CALL os_canary_check()
- {
-     int i;
- 
diff --git a/media-video/nvidia-kernel/files/1.0.5336/NVIDIA_kernel-1.0-5336-basic-sysfs-support-v2.patch b/media-video/nvidia-kernel/files/1.0.5336/NVIDIA_kernel-1.0-5336-basic-sysfs-support-v2.patch
deleted file mode 100644 (file)
index 468d909..0000000
+++ /dev/null
@@ -1,182 +0,0 @@
-diff -urN NVIDIA-Linux-x86-1.0-5336/usr/src/nv/Makefile.kbuild NVIDIA-Linux-x86-1.0-5336.sysfs/usr/src/nv/Makefile.kbuild
---- NVIDIA-Linux-x86-1.0-5336/usr/src/nv/Makefile.kbuild       2004-01-15 05:29:12.000000000 +0200
-+++ NVIDIA-Linux-x86-1.0-5336.sysfs/usr/src/nv/Makefile.kbuild 2004-05-22 21:04:52.143088872 +0200
-@@ -117,6 +117,9 @@
-   MODULE_OBJECT := $(MODULE_NAME).o
- else
-   MODULE_OBJECT := $(MODULE_NAME).ko
-+
-+  # We need this for the conftest.sh tests to work
-+  KERNEL_HEADERS += -I$(KERNEL_SOURCES)/include/asm/mach-generic
- endif
- 
- #
-@@ -146,6 +149,16 @@
-   EXTRA_CFLAGS += -DREMAP_PAGE_RANGE_4
- endif
- 
-+ifeq ($(shell sh $(src)/conftest.sh remap_page_range $(KERNEL_HEADERS)),)
-+  # Check if 'conftest.sh remap_page_rage' have no output - if so, we
-+  # can expect issues ... !
-+  $(error Cannot compile tests!  Please check $$KERNEL_HEADERS)
-+endif
-+
-+ifeq ($(shell sh $(src)/conftest.sh class_simple $(KERNEL_HEADERS)), yes)
-+  EXTRA_CFLAGS += -DHAVE_CLASS_SIMPLE
-+endif
-+  
- #
- # NVIDIA binary object file includes .common section.
- #
-diff -urN NVIDIA-Linux-x86-1.0-5336/usr/src/nv/conftest.sh NVIDIA-Linux-x86-1.0-5336.sysfs/usr/src/nv/conftest.sh
---- NVIDIA-Linux-x86-1.0-5336/usr/src/nv/conftest.sh   2004-01-15 05:29:11.000000000 +0200
-+++ NVIDIA-Linux-x86-1.0-5336.sysfs/usr/src/nv/conftest.sh     2004-05-22 20:58:19.382797512 +0200
-@@ -42,6 +42,29 @@
-         fi
-     ;;
- 
-+    class_simple)
-+        shift
-+        #
-+        # Determine if we have struct class_simple needed for limited sysfs
-+        # support in 2.6
-+        #
-+        echo "#include <linux/device.h>
-+        void add_test_class(void) {
-+           struct class_simple *test_class;
-+           test_class = class_simple_create(THIS_MODULE, \"test\");
-+        }" > conftest.c
-+
-+        gcc -Wall -c conftest.c -o conftest.o $* -D__KERNEL__  > output.log 2>&1
-+
-+        if test -f conftest.o && test -z "`cat output.log`"; then
-+          echo "yes"
-+        else
-+          echo "no"
-+        fi
-+
-+        rm -f conftest.{c,o} output.log
-+    ;;
-+
-     cc_sanity_check)
-         shift
-         #
-diff -urN NVIDIA-Linux-x86-1.0-5336/usr/src/nv/nv-linux.h NVIDIA-Linux-x86-1.0-5336.sysfs/usr/src/nv/nv-linux.h
---- NVIDIA-Linux-x86-1.0-5336/usr/src/nv/nv-linux.h    2004-01-15 05:29:11.000000000 +0200
-+++ NVIDIA-Linux-x86-1.0-5336.sysfs/usr/src/nv/nv-linux.h      2004-05-22 20:58:19.387796752 +0200
-@@ -448,6 +448,33 @@
- #  endif // defined(KERNEL_2_4)
- #endif // defined(CONFIG_DEVFS_FS)
- 
-+#if defined(KERNEL_2_6) && defined(HAVE_CLASS_SIMPLE)
-+#  define NV_SYSFS_REGISTER                                           \
-+    nvidia_class = class_simple_create(THIS_MODULE, "nvidia");
-+
-+#  define NV_SYSFS_ADD_CONTROL                                                \
-+     class_simple_device_add(nvidia_class,                            \
-+                             MKDEV(NV_MAJOR_DEVICE_NUMBER, 255),      \
-+                             NULL, "nvidiactl");
-+
-+#  define NV_SYSFS_ADD_DEVICE(_name, _minor)                          \
-+     class_simple_device_add(nvidia_class,                            \
-+                             MKDEV(NV_MAJOR_DEVICE_NUMBER, _minor),   \
-+                             &nv_linux_devices[_minor].dev->dev, _name);
-+
-+#  define NV_SYSFS_REMOVE_DEVICE(i)                                   \
-+            class_simple_device_remove(MKDEV(NV_MAJOR_DEVICE_NUMBER, i));
-+
-+#  define NV_SYSFS_UNREGISTER                                         \
-+    class_simple_destroy(nvidia_class);
-+#else
-+#  define NV_SYSFS_REGISTER
-+#  define NV_SYSFS_ADD_CONTROL
-+#  define NV_SYSFS_ADD_DEVICE(_name, _minor)
-+#  define NV_SYSFS_REMOVE_DEVICE(i)
-+#  define NV_SYSFS_UNREGISTER
-+#endif
-+
- 
- /*
-  * Linux 2.5 introduced the five argument version of remap_page_range, all
-diff -urN NVIDIA-Linux-x86-1.0-5336/usr/src/nv/nv.c NVIDIA-Linux-x86-1.0-5336.sysfs/usr/src/nv/nv.c
---- NVIDIA-Linux-x86-1.0-5336/usr/src/nv/nv.c  2004-01-15 05:29:11.000000000 +0200
-+++ NVIDIA-Linux-x86-1.0-5336.sysfs/usr/src/nv/nv.c    2004-05-22 20:58:19.393795840 +0200
-@@ -47,6 +47,10 @@
- devfs_handle_t nv_devfs_handles[NV_MAX_DEVICES+1];
- #endif
- 
-+#if defined(KERNEL_2_6) && defined(HAVE_CLASS_SIMPLE)
-+struct class_simple *nvidia_class;
-+#endif
-+
- // #define NV_DBG_MEM 1
- #undef NV_DBG_MEM
- 
-@@ -874,23 +878,31 @@
-     rc = register_chrdev(nv_major, "nvidia", &nv_fops);
- #endif
- 
-+    NV_SYSFS_REGISTER;
-+
-     if (rc < 0)
-     {
-         nv_printf(NV_DBG_ERRORS, "nvidia_init_module: register failed\n");
-         return rc;
-     }
- 
--#ifdef CONFIG_DEVFS_FS
-+#if defined(CONFIG_DEVFS_FS) || defined(KERNEL_2_6)
-     do
-     {
-         char name[10];
- 
-+# if defined(CONFIG_DEVFS_FS)
-         nv_devfs_handles[0] = NV_DEVFS_REGISTER("nvidiactl", 255);
-+# endif
-+        NV_SYSFS_ADD_CONTROL;
- 
-         for (i = 0; i < num_nv_devices; i++)
-         {
-             sprintf(name, "nvidia%d", i);
-+# if defined(CONFIG_DEVFS_FS)
-             nv_devfs_handles[i+1] = NV_DEVFS_REGISTER(name, i);
-+# endif
-+            NV_SYSFS_ADD_DEVICE(name, i);
-         }
-     } while(0);
- #endif
-@@ -951,6 +963,7 @@
- #else
-     unregister_chrdev(nv_major, "nvidia");
- #endif
-+    NV_SYSFS_UNREGISTER;
-     return rc;
- }
- 
-@@ -1011,15 +1024,24 @@
-         nv_printf(NV_DBG_ERRORS, "nvidia_exit_module: unregister nv failed\n");
-     }
- 
--#ifdef CONFIG_DEVFS_FS
-+#if defined(CONFIG_DEVFS_FS) || defined(KERNEL_2_6)
-     do {
-         int i;
-+# if defined(CONFIG_DEVFS_FS)
-         NV_DEVFS_REMOVE_CONTROL();
--        for (i = 0; i < num_nv_devices; i++)
-+# endif
-+        NV_SYSFS_REMOVE_DEVICE(255);
-+        for (i = 0; i < num_nv_devices; i++) {
-+# if defined(CONFIG_DEVFS_FS)
-             NV_DEVFS_REMOVE_DEVICE(i);
-+# endif
-+            NV_SYSFS_REMOVE_DEVICE(i);
-+        }
-     } while (0);
- #endif
- 
-+    NV_SYSFS_UNREGISTER;
-+
- #if NV_ENABLE_MEM_TRACKING
-     nv_list_mem(vm_list);
-     nv_list_mem(km_list);
diff --git a/media-video/nvidia-kernel/files/1.0.5336/NVIDIA_kernel-1.0-5336-basic-sysfs-support.patch b/media-video/nvidia-kernel/files/1.0.5336/NVIDIA_kernel-1.0-5336-basic-sysfs-support.patch
deleted file mode 100644 (file)
index bf90073..0000000
+++ /dev/null
@@ -1,166 +0,0 @@
-diff -urpN NVIDIA-Linux-x86-1.0-5336/usr/src/nv/Makefile.kbuild NVIDIA-Linux-x86-1.0-5336.sysfs/usr/src/nv/Makefile.kbuild
---- NVIDIA-Linux-x86-1.0-5336/usr/src/nv/Makefile.kbuild       2004-01-15 05:29:12.000000000 +0200
-+++ NVIDIA-Linux-x86-1.0-5336.sysfs/usr/src/nv/Makefile.kbuild 2004-02-01 16:15:55.529582488 +0200
-@@ -146,6 +146,10 @@ ifeq ($(shell sh $(src)/conftest.sh rema
-   EXTRA_CFLAGS += -DREMAP_PAGE_RANGE_4
- endif
- 
-+ifeq ($(shell sh $(src)/conftest.sh class_simple $(KERNEL_HEADERS)), yes)
-+  EXTRA_CFLAGS += -DHAVE_CLASS_SIMPLE
-+endif
-+  
- #
- # NVIDIA binary object file includes .common section.
- #
-diff -urpN NVIDIA-Linux-x86-1.0-5336/usr/src/nv/conftest.sh NVIDIA-Linux-x86-1.0-5336.sysfs/usr/src/nv/conftest.sh
---- NVIDIA-Linux-x86-1.0-5336/usr/src/nv/conftest.sh   2004-01-15 05:29:11.000000000 +0200
-+++ NVIDIA-Linux-x86-1.0-5336.sysfs/usr/src/nv/conftest.sh     2004-02-01 16:19:19.079638176 +0200
-@@ -42,6 +42,29 @@ case "$1" in
-         fi
-     ;;
- 
-+    class_simple)
-+        shift
-+        #
-+        # Determine if we have struct class_simple needed for limited sysfs
-+        # support in 2.6
-+        #
-+        echo "#include <linux/device.h>
-+        void add_test_class(void) {
-+           struct class_simple *test_class;
-+           test_class = class_simple_create(THIS_MODULE, \"test\");
-+        }" > conftest.c
-+
-+        gcc -Wall -c conftest.c -o conftest.o $* -D__KERNEL__  > output.log 2>&1
-+
-+        if test -f conftest.o && test -z "`cat output.log`"; then
-+          echo "yes"
-+        else
-+          echo "no"
-+        fi
-+
-+        rm -f conftest.{c,o} output.log
-+    ;;
-+
-     cc_sanity_check)
-         shift
-         #
-diff -urpN NVIDIA-Linux-x86-1.0-5336/usr/src/nv/nv-linux.h NVIDIA-Linux-x86-1.0-5336.sysfs/usr/src/nv/nv-linux.h
---- NVIDIA-Linux-x86-1.0-5336/usr/src/nv/nv-linux.h    2004-01-15 05:29:11.000000000 +0200
-+++ NVIDIA-Linux-x86-1.0-5336.sysfs/usr/src/nv/nv-linux.h      2004-02-01 16:54:14.850032648 +0200
-@@ -448,6 +448,33 @@ typedef struct agp_memory agp_memory;
- #  endif // defined(KERNEL_2_4)
- #endif // defined(CONFIG_DEVFS_FS)
- 
-+#if defined(KERNEL_2_6) && defined(HAVE_CLASS_SIMPLE)
-+#  define NV_SYSFS_REGISTER                                           \
-+    nvidia_class = class_simple_create(THIS_MODULE, "nvidia");
-+
-+#  define NV_SYSFS_ADD_CONTROL                                                \
-+     class_simple_device_add(nvidia_class,                            \
-+                             MKDEV(NV_MAJOR_DEVICE_NUMBER, 255),      \
-+                             NULL, "nvidiactl");
-+
-+#  define NV_SYSFS_ADD_DEVICE(_name, _minor)                          \
-+     class_simple_device_add(nvidia_class,                            \
-+                             MKDEV(NV_MAJOR_DEVICE_NUMBER, _minor),   \
-+                             &nv_linux_devices[_minor].dev->dev, _name);
-+
-+#  define NV_SYSFS_REMOVE_DEVICE(i)                                   \
-+            class_simple_device_remove(MKDEV(NV_MAJOR_DEVICE_NUMBER, i));
-+
-+#  define NV_SYSFS_UNREGISTER                                         \
-+    class_simple_destroy(nvidia_class);
-+#else
-+#  define NV_SYSFS_REGISTER
-+#  define NV_SYSFS_ADD_CONTROL
-+#  define NV_SYSFS_ADD_DEVICE(_name, _minor)
-+#  define NV_SYSFS_REMOVE_DEVICE(i)
-+#  define NV_SYSFS_UNREGISTER
-+#endif
-+
- 
- /*
-  * Linux 2.5 introduced the five argument version of remap_page_range, all
-diff -urpN NVIDIA-Linux-x86-1.0-5336/usr/src/nv/nv.c NVIDIA-Linux-x86-1.0-5336.sysfs/usr/src/nv/nv.c
---- NVIDIA-Linux-x86-1.0-5336/usr/src/nv/nv.c  2004-01-15 05:29:11.000000000 +0200
-+++ NVIDIA-Linux-x86-1.0-5336.sysfs/usr/src/nv/nv.c    2004-02-01 16:58:03.429283320 +0200
-@@ -47,6 +47,10 @@ struct proc_dir_entry *proc_nvidia;
- devfs_handle_t nv_devfs_handles[NV_MAX_DEVICES+1];
- #endif
- 
-+#if defined(KERNEL_2_6) && defined(HAVE_CLASS_SIMPLE)
-+struct class_simple *nvidia_class;
-+#endif
-+
- // #define NV_DBG_MEM 1
- #undef NV_DBG_MEM
- 
-@@ -874,23 +878,31 @@ static int __init nvidia_init_module(voi
-     rc = register_chrdev(nv_major, "nvidia", &nv_fops);
- #endif
- 
-+    NV_SYSFS_REGISTER;
-+
-     if (rc < 0)
-     {
-         nv_printf(NV_DBG_ERRORS, "nvidia_init_module: register failed\n");
-         return rc;
-     }
- 
--#ifdef CONFIG_DEVFS_FS
-+#if defined(CONFIG_DEVFS_FS) || defined(KERNEL_2_6)
-     do
-     {
-         char name[10];
- 
-+# if defined(CONFIG_DEVFS_FS)
-         nv_devfs_handles[0] = NV_DEVFS_REGISTER("nvidiactl", 255);
-+# endif
-+        NV_SYSFS_ADD_CONTROL;
- 
-         for (i = 0; i < num_nv_devices; i++)
-         {
-             sprintf(name, "nvidia%d", i);
-+# if defined(CONFIG_DEVFS_FS)
-             nv_devfs_handles[i+1] = NV_DEVFS_REGISTER(name, i);
-+# endif
-+            NV_SYSFS_ADD_DEVICE(name, i);
-         }
-     } while(0);
- #endif
-@@ -951,6 +963,7 @@ static int __init nvidia_init_module(voi
- #else
-     unregister_chrdev(nv_major, "nvidia");
- #endif
-+    NV_SYSFS_UNREGISTER;
-     return rc;
- }
- 
-@@ -1011,15 +1024,24 @@ static void __exit nvidia_exit_module(vo
-         nv_printf(NV_DBG_ERRORS, "nvidia_exit_module: unregister nv failed\n");
-     }
- 
--#ifdef CONFIG_DEVFS_FS
-+#if defined(CONFIG_DEVFS_FS) || defined(KERNEL_2_6)
-     do {
-         int i;
-+# if defined(CONFIG_DEVFS_FS)
-         NV_DEVFS_REMOVE_CONTROL();
--        for (i = 0; i < num_nv_devices; i++)
-+# endif
-+        NV_SYSFS_REMOVE_DEVICE(255);
-+        for (i = 0; i < num_nv_devices; i++) {
-+# if defined(CONFIG_DEVFS_FS)
-             NV_DEVFS_REMOVE_DEVICE(i);
-+# endif
-+            NV_SYSFS_REMOVE_DEVICE(i);
-+        }
-     } while (0);
- #endif
- 
-+    NV_SYSFS_UNREGISTER;
-+
- #if NV_ENABLE_MEM_TRACKING
-     nv_list_mem(vm_list);
-     nv_list_mem(km_list);
diff --git a/media-video/nvidia-kernel/files/1.0.5336/NVIDIA_kernel-1.0-5336-fix-makefile-for-2.6.patch b/media-video/nvidia-kernel/files/1.0.5336/NVIDIA_kernel-1.0-5336-fix-makefile-for-2.6.patch
deleted file mode 100644 (file)
index 16e6571..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-diff -urN NVIDIA-Linux-x86-1.0-5336/usr/src/nv/makefile NVIDIA-Linux-x86-1.0-5336.az/usr/src/nv/makefile
---- NVIDIA-Linux-x86-1.0-5336/usr/src/nv/makefile      2004-06-15 21:35:13.034445000 +0200
-+++ NVIDIA-Linux-x86-1.0-5336.az/usr/src/nv/makefile   2004-06-15 21:48:43.410249152 +0200
-@@ -12,4 +12,15 @@
- default: module
- 
- module nvidia.o nvidia.ko install nv-linux.o clean module-install package-install print-module-filename: select_makefile
--      @ $(MAKE) --no-print-directory -f Makefile $@
-+      @if [ "`ls -l Makefile`" == "Makefile.kbuild" ]; then \
-+              if [ "${SYSSRC}" ]; then \
-+                      KERNEL_INCLUDE="${SYSSRC}/include"; \
-+              elif [ "${SYSINCLUDE}" ]; then \
-+                      KERNEL_INCLUDE="${SYSINCLUDE}"; \
-+              else \
-+                      KERNEL_INCLUDE="/lib/modules/`uname -r`/build/include"; \
-+              fi; \
-+              make -C "${KERNEL_INCLUDE}/../" M=`pwd` $@; \
-+      else \
-+              $(MAKE) --no-print-directory -f Makefile $@; \
-+      fi
diff --git a/media-video/nvidia-kernel/files/1.0.5336/NVIDIA_kernel-1.0-5336-kbuild-koutput-support.patch b/media-video/nvidia-kernel/files/1.0.5336/NVIDIA_kernel-1.0-5336-kbuild-koutput-support.patch
deleted file mode 100644 (file)
index 0e1566d..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
---- usr/src/nv/conftest.sh.old 2004-06-30 16:08:25.863017584 +1000
-+++ usr/src/nv/conftest.sh     2004-06-30 17:19:33.415251032 +1000
-@@ -195,8 +195,10 @@
-         # 2.6 and newer kernels, and the old Makefile for kernels older
-         # than 2.6.
-         #
--        if [ "$SYSSRC" ]; then
--            KERNEL_INCLUDE=$SYSSRC/include
-+        if [ "$KV_OUT" ]; then
-+            KERNEL_INCLUDE=$KV_OUT/include
-+      elif [ "$SYSSRC" ]; then
-+          KERNEL_INCLUDE=$SYSSRC/include
-         elif [ "$SYSINCLUDE" ]; then
-             KERNEL_INCLUDE=$SYSINCLUDE
-         else
---- usr/src/nv/Makefile.kbuild.orig    2004-06-30 16:16:47.991682424 +1000
-+++ usr/src/nv/Makefile.kbuild 2004-06-30 17:23:24.047189648 +1000
-@@ -93,6 +93,11 @@
- ifdef SYSSRC
-   KERNEL_SOURCES := $(SYSSRC)
-   KERNEL_HEADERS := -I$(KERNEL_SOURCES)/include
-+  ifdef KV_OUT
-+    ifneq ($(SYSSRC),$(KV_OUT))
-+      KERNEL_HEADERS += -I$(KV_OUT)/include
-+    endif
-+  endif
-   MODULE_ROOT    := /lib/modules/$(shell sh $(src)/conftest.sh get_uname)/kernel/drivers
- else
-   KERNEL_SOURCES := /lib/modules/$(shell uname -r)/build
-@@ -119,7 +124,12 @@
-   MODULE_OBJECT := $(MODULE_NAME).ko
- 
-   # We need this for the conftest.sh tests to work
--  KERNEL_HEADERS += -I$(KERNEL_SOURCES)/include/asm/mach-generic
-+  ifneq ($(SYSSRC),$(KV_OUT))
-+    KERNEL_HEADERS += -I$(KV_OUT)/include2/asm/mach-generic
-+    KERNEL_HEADERS += -I$(KV_OUT)/include2
-+  else
-+    KERNEL_HEADERS += -I$(KERNEL_SOURCES)/include/asm/mach-generic
-+  endif
- endif
- 
- #
-@@ -191,7 +201,7 @@
- # KBUILD build parameters.
- #
- 
--KBUILD_PARAMS := -C $(KERNEL_SOURCES) SUBDIRS=$(PWD)
-+KBUILD_PARAMS := -C $(KERNEL_SOURCES) M=$(PWD)
- 
- #
- # NVIDIA sanity checks.
diff --git a/media-video/nvidia-kernel/files/1.0.6106/NVIDIA_kernel-1.0-6106-koutput-support.patch b/media-video/nvidia-kernel/files/1.0.6106/NVIDIA_kernel-1.0-6106-koutput-support.patch
deleted file mode 100644 (file)
index d4e2013..0000000
+++ /dev/null
@@ -1,211 +0,0 @@
---- Makefile.kbuild.old        2004-07-01 13:54:56.542258768 +1000
-+++ Makefile.kbuild    2004-07-01 13:57:04.861751240 +1000
-@@ -93,14 +93,23 @@
- ifdef SYSSRC
-   KERNEL_SOURCES := $(SYSSRC)
-   KERNEL_HEADERS := $(KERNEL_SOURCES)/include
-+  ifdef KVOUT
-+    ifneq ($(SYSSRC),$(KVOUT))
-+      KOUTPUT_HEADERS := $(KVOUT)/include
-+    endif
-+  endif
-+  ifndef KOUTPUT_HEADERS
-+    KOUTPUT_HEADERS := $(KERNEL_HEADERS)
-+  endif
- else
--  KERNEL_UNAME   := $(shell uname -r)
--  KERNEL_SOURCES := /lib/modules/$(KERNEL_UNAME)/build
--  KERNEL_HEADERS := $(KERNEL_SOURCES)/include
-+  KERNEL_UNAME    := $(shell uname -r)
-+  KERNEL_SOURCES  := /lib/modules/$(KERNEL_UNAME)/build
-+  KERNEL_HEADERS  := $(KERNEL_SOURCES)/include
-+  KOUTPUT_HEADERS := $(KERNEL_HEADERS)
- endif
- 
- CC ?= gcc
--CONFTEST := sh $(src)/conftest.sh "$(CC)" $(KERNEL_HEADERS)
-+CONFTEST := sh $(src)/conftest.sh "$(CC)" $(KERNEL_HEADERS) $(KOUTPUT_HEADERS)
- 
- KERNEL_UNAME ?= $(shell $(CONFTEST) get_uname)
- MODULE_ROOT  := /lib/modules/$(KERNEL_UNAME)/kernel/drivers
---- Makefile.nvidia.old        2004-07-01 13:55:03.054268792 +1000
-+++ Makefile.nvidia    2004-07-01 13:55:17.799027248 +1000
-@@ -21,6 +21,14 @@
- ifdef SYSSRC
-   KERNEL_SOURCES := $(SYSSRC)
-   KERNEL_HEADERS := $(KERNEL_SOURCES)/include
-+  ifdef KVOUT
-+    ifneq ($(SYSSRC),$(KVOUT))
-+      KOUTPUT_HEADERS := $(KVOUT)/include
-+    endif
-+  endif
-+  ifndef KOUTPUT_HEADERS
-+    KOUTPUT_HEADERS := $(KERNEL_SOURCES)
-+  endif
- else
-   ifdef SYSINCLUDE
-     KERNEL_HEADERS := $(SYSINCLUDE)
-@@ -28,10 +35,11 @@
-     KERNEL_UNAME   := $(shell uname -r)
-     KERNEL_HEADERS := /lib/modules/$(KERNEL_UNAME)/build/include
-   endif
-+  KOUTPUT_HEADERS := $(KERNEL_SOURCES)
- endif
- 
- CC ?= cc
--CONFTEST := sh ./conftest.sh "$(CC)" $(KERNEL_HEADERS)
-+CONFTEST := sh ./conftest.sh "$(CC)" $(KERNEL_HEADERS) $(KOUTPUT_HEADERS)
- 
- KERNEL_UNAME ?= $(shell $(CONFTEST) get_uname)
- MODULE_ROOT  := /lib/modules/$(KERNEL_UNAME)/kernel/drivers
---- makefile.old       2004-07-01 13:54:48.070546664 +1000
-+++ makefile   2004-07-01 13:55:13.966609864 +1000
-@@ -11,12 +11,21 @@
-   else
-     KERNEL_HEADERS := /lib/modules/$(shell uname -r)/build/include
-   endif
-+  KOUTPUT_HEADERS := $(KERNEL_HEADERS)
- else
-     KERNEL_HEADERS := $(SYSSRC)/include
-+    ifdef KVOUT
-+      ifneq ($(SYSSRC),$(KVOUT))
-+        KOUTPUT_HEADERS := $(KVOUT)/include
-+      endif
-+    endif
-+    ifndef KOUTPUT_HEADERS
-+      KOUTPUT_HEADERS := $(KERNEL_HEADERS)
-+    endif
- endif
- 
- CC ?= cc
--CONFTEST := sh ./conftest.sh "$(CC)" $(KERNEL_HEADERS)
-+CONFTEST := sh ./conftest.sh "$(CC)" $(KERNEL_HEADERS) $(KOUTPUT_HEADERS)
- 
- .PHONY: select_makefile
- select_makefile:
---- conftest.sh.old    2004-07-01 13:54:41.750507456 +1000
-+++ conftest.sh        2004-07-01 13:55:08.910378528 +1000
-@@ -7,16 +7,19 @@
- 
- CC="$1"
- ISYSTEM=`$CC -print-file-name=include`
--HEADERS=$2
-+SOURCE_HEADERS=$2
-+BUILT_HEADERS=$3
- 
- CFLAGS="-D__KERNEL__ \
- -Werror \
- -nostdinc \
- -isystem $ISYSTEM \
---I $HEADERS -I $HEADERS/asm/mach-default \
-+-I $SOURCE_HEADERS -I $SOURCE_HEADERS/asm/mach-default \
-+-I $BUILT_HEADERS -I $BUILT_HEADERS/../include2/asm/mach-default \
-+-I $BUILT_HEADERS/../include2 \
- -Wimplicit-function-declaration"
- 
--case "$3" in
-+case "$4" in
-     remap_page_range)
-         #
-         # Determine the number of arguments expected by remap_page_range.
-@@ -124,7 +126,7 @@
-         # Determine the kernel's major patch level; this is only done if we
-         # aren't told by KBUILD.
-         #
--        SOURCES=$HEADERS/..
-+        SOURCES=$SOURCE_HEADERS/..
- 
-         echo $(grep "^PATCHLEVEL =" $SOURCES/Makefile | cut -d " " -f 3)
-         exit 0
-@@ -193,7 +195,7 @@
-         RET=1
-         OUTPUT=$4
- 
--        if [ -f $HEADERS/linux/version.h ]; then
-+        if [ -f $BUILT_HEADERS/linux/version.h ]; then
-             #
-             # We are either looking at a configured kernel source
-             # tree or at headers shipped for a specific kernel.
-@@ -208,7 +210,7 @@
-               }
-             }" > conftest$$.c
- 
--            $CC conftest$$.c -o conftest$$ -nostdinc -I $HEADERS > /dev/null 2>&1
-+            $CC conftest$$.c -o conftest$$ -nostdinc -I $BUILT_HEADERS > /dev/null 2>&1
-             rm -f conftest$$.c
- 
-             if [ -f conftest$$ ]; then
-@@ -222,8 +224,8 @@
-                 RET=0
-             fi
-         else
--            MAKEFILE=$HEADERS/../Makefile
--            CONFIG=$HEADERS/../.config
-+            MAKEFILE=$SOURCE_HEADERS/../Makefile
-+            CONFIG=$BUILT_HEADERS/../.config
- 
-             if [ -f $MAKEFILE -a -f $CONFIG ]; then
-                 #
-@@ -275,7 +277,7 @@
-             return 0;
-         }" > conftest$$.c
- 
--        $CC conftest$$.c -o conftest$$ -nostdinc -I $HEADERS > /dev/null 2>&1
-+        $CC conftest$$.c -o conftest$$ -nostdinc -I $BUILT_HEADERS > /dev/null 2>&1
-         rm -f conftest$$.c
- 
-         if [ -f conftest$$ ]; then
-@@ -296,7 +298,7 @@
-         RET=1
-         OUTPUT=$4
- 
--        if [ -f $HEADERS/linux/autoconf.h ]; then
-+        if [ -f $BUILT_HEADERS/linux/autoconf.h ]; then
-             #
-             # We are looking at a configured source tree; verify
-             # that its configuration doesn't include rivafb using
-@@ -308,7 +310,7 @@
-             #endif
-             " > conftest$$.c
- 
--            $CC -c conftest$$.c -nostdinc -I $HEADERS > /dev/null 2>&1
-+            $CC -c conftest$$.c -nostdinc -I $BUILT_HEADERS > /dev/null 2>&1
-             rm -f conftest$$.c
- 
-             if [ -f conftest$$.o ]; then
-@@ -316,7 +318,7 @@
-                 RET=0
-             fi
-         else
--            CONFIG=$HEADERS/../.config
-+            CONFIG=$BUILT_HEADERS/../.config
-             if [ -f $CONFIG ]; then
-                 if [ -z "$(grep "^CONFIG_FB_RIVA=y" $CONFIG)" ]; then
-                     RET=0
-@@ -352,7 +354,7 @@
-         RET=1
-         OUTPUT=$4
- 
--        if [ -f $HEADERS/linux/autoconf.h ]; then
-+        if [ -f $BUILT_HEADERS/linux/autoconf.h ]; then
-             #
-             # We are looking at a configured source tree; verify
-             # that its configuration doesn't include rivafb using
-@@ -364,7 +366,7 @@
-             #endif
-             " > conftest$$.c
- 
--            $CC -c conftest$$.c -nostdinc -I $HEADERS > /dev/null 2>&1
-+            $CC -c conftest$$.c -nostdinc -I $BUILT_HEADERS > /dev/null 2>&1
-             rm -f conftest$$.c
- 
-             if [ -f conftest$$.o ]; then
-@@ -372,7 +374,7 @@
-                 RET=0
-             fi
-         else
--            CONFIG=$HEADERS/../.config
-+            CONFIG=$BUILT_HEADERS/../.config
-             if [ -f $CONFIG ]; then
-                 if [ -z "$(grep "^CONFIG_FB_RIVA=m" $CONFIG)" ]; then
-                     RET=0
diff --git a/media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.4363-r3 b/media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.4363-r3
deleted file mode 100644 (file)
index b1f93af..0000000
+++ /dev/null
@@ -1 +0,0 @@
-MD5 29b4cfcff63f502787fd2f0ac7a105fd NVIDIA_kernel-1.0-4363.tar.gz 661447
diff --git a/media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.4496-r3 b/media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.4496-r3
deleted file mode 100644 (file)
index 5fe85cc..0000000
+++ /dev/null
@@ -1 +0,0 @@
-MD5 cc8cc9b0fda676b074869e50844c969a NVIDIA-Linux-x86-1.0-4496-pkg0.run 5125585
diff --git a/media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.4499 b/media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.4499
deleted file mode 100644 (file)
index 189c10d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-MD5 d93786060f3fad675c3fb3bb3460739b NVIDIA_kernel-1.0-4499.tar.gz 732013
diff --git a/media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.5328-r1 b/media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.5328-r1
deleted file mode 100644 (file)
index 32ab3b4..0000000
+++ /dev/null
@@ -1 +0,0 @@
-MD5 b2ae3a449837430d5f10a2ebf3d9f7d4 NVIDIA-Linux-x86-1.0-5328-pkg1.run 6855080
diff --git a/media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.5332-r1 b/media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.5332-r1
deleted file mode 100644 (file)
index 943071e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-MD5 eede761ab428ff0d27e5f67e8c555972 NVIDIA-Linux-x86_64-1.0-5332-pkg0.run 5597826
diff --git a/media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.5336-r4 b/media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.5336-r4
deleted file mode 100644 (file)
index 56ddf0d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-MD5 6d7361347ebbef5dfdbe6bdcb560fda8 NVIDIA-Linux-x86-1.0-5336-pkg1.run 6821193
diff --git a/media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.6106-r1 b/media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.6106-r1
deleted file mode 100644 (file)
index a343b4b..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-MD5 5432f919f0211ce36b854d87108d7db0 NVIDIA-Linux-x86-1.0-6106-pkg1.run 8160802
-MD5 024f21a3fa134bee8339adac64bdc77a NVIDIA-Linux-x86_64-1.0-6106-pkg2.run 7331301
diff --git a/media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.6111-r2 b/media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.6111-r2
deleted file mode 100644 (file)
index 891f453..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-MD5 51e83be46f83c52102ccb8995b54f4e2 NVIDIA-Linux-x86-1.0-6111-pkg1.run 8167999
-MD5 6c7b0c8b3ce5c34186e0c80042e6d046 NVIDIA-Linux-x86_64-1.0-6111-pkg2.run 7333486
diff --git a/media-video/nvidia-kernel/nvidia-kernel-1.0.4363-r3.ebuild b/media-video/nvidia-kernel/nvidia-kernel-1.0.4363-r3.ebuild
deleted file mode 100644 (file)
index bc37797..0000000
+++ /dev/null
@@ -1,152 +0,0 @@
-# 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.4363-r3.ebuild,v 1.16 2004/11/07 02:01:13 cyfred Exp $
-
-inherit eutils
-
-NV_V="${PV/1.0./1.0-}"
-NV_PACKAGE="NVIDIA_kernel-${NV_V}"
-S="${WORKDIR}/${NV_PACKAGE}"
-DESCRIPTION="Linux kernel module for the NVIDIA's X driver"
-HOMEPAGE="http://www.nvidia.com/"
-SRC_URI="ftp://download.nvidia.com/XFree86/Linux-x86/${NV_V}/${NV_PACKAGE}.tar.gz"
-IUSE=""
-
-# The slot needs to be set to $KV to prevent unmerges of modules for other kernels.
-LICENSE="NVIDIA"
-SLOT="${KV}"
-KEYWORDS="-* -x86"
-RESTRICT="nostrip"
-
-DEPEND="virtual/linux-sources"
-export _POSIX2_VERSION="199209"
-
-pkg_setup() {
-       if [ ! -f /proc/mtrr ]
-       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 -> [*] MTRR (Memory Type Range Register) support"
-               eerror
-               eerror "and recompile your kernel ..."
-               die "MTRR support not detected!"
-       fi
-
-       check_version_h
-}
-
-check_version_h() {
-       if [ ! -f "${ROOT}/usr/src/linux/include/linux/version.h" ]
-       then
-               eerror "Please verify that your /usr/src/linux symlink is pointing"
-               eerror "to your current kernel sources, and that you did run:"
-               eerror
-               eerror "  # make dep"
-               die "/usr/src/linux symlink not setup!"
-       fi
-}
-
-get_KV_info() {
-       check_version_h
-
-       # Get the kernel version of sources in /usr/src/linux ...
-       export KV_full="$(awk '/UTS_RELEASE/ { gsub("\"", "", $3); print $3 }' \
-               "${ROOT}/usr/src/linux/include/linux/version.h")"
-       export KV_major="$(echo "${KV_full}" | cut -d. -f1)"
-       export KV_minor="$(echo "${KV_full}" | cut -d. -f2)"
-       export KV_micro="$(echo "${KV_full}" | cut -d. -f3 | sed -e 's:[^0-9].*::')"
-}
-
-is_kernel() {
-       [ -z "$1" -o -z "$2" ] && return 1
-
-       get_KV_info
-
-       if [ "${KV_major}" -eq "$1" -a "${KV_minor}" -eq "$2" ]
-       then
-               return 0
-       else
-               return 1
-       fi
-}
-
-src_unpack() {
-       unpack ${A}
-
-       # Next section applies patches for linux-2.5 kernel, and/or
-       # bugfixes for linux-2.4.  All these are from:
-       #
-       #   http://www.minion.de/nvidia/
-       #
-       # Many thanks to Christian Zander <zander@minion.de> for bringing
-       # these to us, and being so helpful to select which to use.
-
-       get_KV_info
-
-       cd ${S}
-       einfo "Linux kernel ${KV_major}.${KV_minor}.${KV_micro}"
-
-       if is_kernel 2 5 || is_kernel 2 6
-       then
-               EPATCH_SINGLE_MSG="Applying tasklet patch for kernel 2.[56]..." \
-               epatch ${FILESDIR}/${PV}/${NV_PACKAGE}-2.5-20030714.diff
-
-               # Kbuild have issues currently (sandbox related).
-               ln -snf Makefile.nvidia Makefile
-       fi
-}
-
-src_compile() {
-       # Portage should determine the version of the kernel sources
-       check_KV
-
-       # IGNORE_CC_MISMATCH disables a sanity check that's needed when gcc has been
-       # updated but the running kernel is still compiled with an older gcc.  This is
-       # needed for chrooted building, where the sanity check detects the gcc of the
-       # kernel outside the chroot rather than within.
-       make IGNORE_CC_MISMATCH="yes" KERNDIR="${ROOT}/usr/src/linux" \
-               clean nvidia.o || die
-}
-
-src_install() {
-       # The driver goes into the standard modules location
-       insinto /lib/modules/${KV}/video
-       if is_kernel 2 5 || is_kernel 2 6
-       then
-               newins nvidia.o nvidia.ko
-       else
-               doins nvidia.o
-       fi
-
-       # Add the aliases
-       insinto /etc/modules.d
-       newins ${FILESDIR}/nvidia-1.1 nvidia
-
-       # Docs
-       dodoc ${S}/README
-
-       # The device creation script
-       into /
-       newsbin ${S}/makedevices.sh NVmakedevices.sh
-}
-
-pkg_postinst() {
-       if [ "${ROOT}" = "/" ]
-       then
-               # Update module dependency
-               [ -x /usr/sbin/update-modules ] && /usr/sbin/update-modules
-               if [ ! -e /dev/.devfsd ] && [ ! -e /dev/.udev ] && [ -x /sbin/NVmakedevices.sh ]
-               then
-                       /sbin/NVmakedevices.sh >/dev/null 2>&1
-               fi
-       fi
-
-       echo
-       einfo "If you are not using devfs, loading the module automatically at"
-       einfo "boot up, you need to add \"nvidia\" to your /etc/modules.autoload."
-       echo
-       ewarn "Please note that the driver name changed from \"NVdriver\""
-       ewarn "to \"nvidia.o\"."
-       echo
-}
diff --git a/media-video/nvidia-kernel/nvidia-kernel-1.0.4496-r3.ebuild b/media-video/nvidia-kernel/nvidia-kernel-1.0.4496-r3.ebuild
deleted file mode 100644 (file)
index 4fbdbb3..0000000
+++ /dev/null
@@ -1,155 +0,0 @@
-# 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.4496-r3.ebuild,v 1.13 2004/11/07 02:01:13 cyfred Exp $
-
-inherit eutils
-
-NV_V="${PV/1.0./1.0-}"
-NV_PACKAGE="NVIDIA-Linux-x86-${NV_V}"
-S="${WORKDIR}/${NV_PACKAGE}-pkg0/usr/src/nv"
-DESCRIPTION="Linux kernel module for the NVIDIA's X driver"
-HOMEPAGE="http://www.nvidia.com/"
-SRC_URI="ftp://download.nvidia.com/XFree86/Linux-x86/${NV_V}/${NV_PACKAGE}-pkg0.run"
-IUSE=""
-
-# The slot needs to be set to $KV to prevent unmerges of modules for other kernels.
-LICENSE="NVIDIA"
-SLOT="${KV}"
-KEYWORDS="-* -x86"
-RESTRICT="nostrip"
-
-DEPEND="virtual/linux-sources"
-export _POSIX2_VERSION="199209"
-
-pkg_setup() {
-       if [ ! -f /proc/mtrr ]
-       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 -> [*] MTRR (Memory Type Range Register) support"
-               eerror
-               eerror "and recompile your kernel ..."
-               die "MTRR support not detected!"
-       fi
-
-       check_version_h
-}
-
-check_version_h() {
-       if [ ! -f "${ROOT}/usr/src/linux/include/linux/version.h" ]
-       then
-               eerror "Please verify that your /usr/src/linux symlink is pointing"
-               eerror "to your current kernel sources, and that you did run:"
-               eerror
-               eerror "  # make dep"
-               die "/usr/src/linux symlink not setup!"
-       fi
-}
-
-get_KV_info() {
-       check_version_h
-
-       # Get the kernel version of sources in /usr/src/linux ...
-       export KV_full="$(awk '/UTS_RELEASE/ { gsub("\"", "", $3); print $3 }' \
-               "${ROOT}/usr/src/linux/include/linux/version.h")"
-       export KV_major="$(echo "${KV_full}" | cut -d. -f1)"
-       export KV_minor="$(echo "${KV_full}" | cut -d. -f2)"
-       export KV_micro="$(echo "${KV_full}" | cut -d. -f3 | sed -e 's:[^0-9].*::')"
-}
-
-is_kernel() {
-       [ -z "$1" -o -z "$2" ] && return 1
-
-               get_KV_info
-
-               if [ "${KV_major}" -eq "$1" -a "${KV_minor}" -eq "$2" ]
-               then
-                               return 0
-               else
-                               return 1
-               fi
-}
-
-src_unpack() {
-       cd ${WORKDIR}
-       bash ${DISTDIR}/${NV_PACKAGE}-pkg0.run --extract-only
-
-       # Next section applies patches for linux-2.5 kernel, and/or
-       # bugfixes for linux-2.4.  All these are from:
-       #
-       #   http://www.minion.de/nvidia/
-       #
-       # Many thanks to Christian Zander <zander@minion.de> for bringing
-       # these to us, and being so helpful to select which to use.
-
-       get_KV_info
-
-       cd ${S}
-       einfo "Linux kernel ${KV_major}.${KV_minor}.${KV_micro}"
-
-       if is_kernel 2 5 || is_kernel 2 6
-       then
-               EPATCH_SINGLE_MSG="Applying tasklet patch ..." \
-               epatch ${FILESDIR}/${PV}/NVIDIA_kernel-${NV_V}-2.6-20030905.diff
-#              EPATCH_SINGLE_MSG="Applying pci device name patch ..." \
-#              epatch ${FILESDIR}/${PV}/NVIDIA_kernel-${NV_V}-2.6-pci_name-20030905.diff
-
-               # Kbuild have issues currently (sandbox related).
-               ln -snf Makefile.nvidia Makefile
-       fi
-}
-
-src_compile() {
-       # Portage should determine the version of the kernel sources
-       check_KV
-
-       # IGNORE_CC_MISMATCH disables a sanity check that's needed when gcc has been
-       # updated but the running kernel is still compiled with an older gcc.  This is
-       # needed for chrooted building, where the sanity check detects the gcc of the
-       # kernel outside the chroot rather than within.
-       make IGNORE_CC_MISMATCH="yes" KERNDIR="${ROOT}/usr/src/linux" \
-               clean nvidia.o || die
-}
-
-src_install() {
-       # The driver goes into the standard modules location
-       insinto /lib/modules/${KV}/video
-       if is_kernel 2 5 || is_kernel 2 6
-       then
-               newins nvidia.o nvidia.ko
-       else
-               doins nvidia.o
-       fi
-
-       # Add the aliases
-       insinto /etc/modules.d
-       newins ${FILESDIR}/nvidia-1.1 nvidia
-
-       # Docs
-       dodoc ${S}/README
-
-       # The device creation script
-       into /
-       newsbin ${S}/makedevices.sh NVmakedevices.sh
-}
-
-pkg_postinst() {
-       if [ "${ROOT}" = "/" ]
-       then
-               # Update module dependency
-               [ -x /usr/sbin/update-modules ] && /usr/sbin/update-modules
-               if [ ! -e /dev/.devfsd ] && [ ! -e /dev/.udev ] && [ -x /sbin/NVmakedevices.sh ]
-               then
-                       /sbin/NVmakedevices.sh >/dev/null 2>&1
-               fi
-       fi
-
-       echo
-       einfo "If you are not using devfs, loading the module automatically at"
-       einfo "boot up, you need to add \"nvidia\" to your /etc/modules.autoload."
-       echo
-       ewarn "Please note that the driver name changed from \"NVdriver\""
-       ewarn "to \"nvidia.o\"."
-       echo
-}
diff --git a/media-video/nvidia-kernel/nvidia-kernel-1.0.4499.ebuild b/media-video/nvidia-kernel/nvidia-kernel-1.0.4499.ebuild
deleted file mode 100644 (file)
index 1a192fd..0000000
+++ /dev/null
@@ -1,150 +0,0 @@
-# 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.4499.ebuild,v 1.11 2004/11/07 02:01:13 cyfred Exp $
-
-inherit eutils
-
-NV_V="${PV/1.0./1.0-}"
-NV_PACKAGE="NVIDIA-Linux-x86-${NV_V}"
-S="${WORKDIR}/NVIDIA_kernel-1.0-4499"
-DESCRIPTION="Linux kernel module for the NVIDIA's X driver"
-HOMEPAGE="http://www.nvidia.com/"
-SRC_URI="http://download.nvidia.com/XFree86/Linux-x86-64/1.0-4499/NVIDIA_kernel-1.0-4499.tar.gz"
-IUSE=""
-
-# The slot needs to be set to $KV to prevent unmerges of modules for other kernels.
-LICENSE="NVIDIA"
-SLOT="${KV}"
-KEYWORDS="-* -amd64"
-RESTRICT="nostrip"
-
-DEPEND="virtual/linux-sources"
-export _POSIX2_VERSION="199209"
-
-pkg_setup() {
-       if [ ! -f /proc/mtrr ]
-       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 -> [*] MTRR (Memory Type Range Register) support"
-               eerror
-               eerror "and recompile your kernel ..."
-               die "MTRR support not detected!"
-       fi
-
-       check_version_h
-}
-
-check_version_h() {
-       if [ ! -f "${ROOT}/usr/src/linux/include/linux/version.h" ]
-       then
-               eerror "Please verify that your /usr/src/linux symlink is pointing"
-               eerror "to your current kernel sources, and that you did run:"
-               eerror
-               eerror "  # make dep"
-               die "/usr/src/linux symlink not setup!"
-       fi
-}
-
-get_KV_info() {
-       check_version_h
-
-       # Get the kernel version of sources in /usr/src/linux ...
-       export KV_full="$(awk '/UTS_RELEASE/ { gsub("\"", "", $3); print $3 }' \
-               "${ROOT}/usr/src/linux/include/linux/version.h")"
-       export KV_major="$(echo "${KV_full}" | cut -d. -f1)"
-       export KV_minor="$(echo "${KV_full}" | cut -d. -f2)"
-       export KV_micro="$(echo "${KV_full}" | cut -d. -f3 | sed -e 's:[^0-9].*::')"
-}
-
-is_kernel() {
-       [ -z "$1" -o -z "$2" ] && return 1
-
-       get_KV_info
-
-       if [ "${KV_major}" -eq "$1" -a "${KV_minor}" -eq "$2" ]
-       then
-               return 0
-       else
-               return 1
-       fi
-}
-
-src_unpack() {
-       cd ${WORKDIR}
-       unpack NVIDIA_kernel-1.0-4499.tar.gz
-
-       # Next section applies patches for linux-2.5 kernel, and/or
-       # bugfixes for linux-2.4.  All these are from:
-       #
-       #   http://www.minion.de/nvidia/
-       #
-       # Many thanks to Christian Zander <zander@minion.de> for bringing
-       # these to us, and being so helpful to select which to use.
-
-       get_KV_info
-
-       cd ${S}
-       einfo "Linux kernel ${KV_major}.${KV_minor}.${KV_micro}"
-
-       if is_kernel 2 5 || is_kernel 2 6
-       then
-               EPATCH_SINGLE_MSG="Applying 2.6.x patch ..." \
-               epatch ${FILESDIR}/${PV}/NVIDIA_kernel-${NV_V}-2.6-20031014.diff
-       fi
-}
-
-src_compile() {
-       # Portage should determine the version of the kernel sources
-       check_KV
-
-       # IGNORE_CC_MISMATCH disables a sanity check that's needed when gcc has been
-       # updated but the running kernel is still compiled with an older gcc.  This is
-       # needed for chrooted building, where the sanity check detects the gcc of the
-       # kernel outside the chroot rather than within.
-       make IGNORE_CC_MISMATCH="yes" KERNDIR="${ROOT}/usr/src/linux" \
-               clean nvidia.o || die
-}
-
-src_install() {
-       # The driver goes into the standard modules location
-       insinto /lib/modules/${KV}/video
-       if is_kernel 2 5 || is_kernel 2 6
-       then
-               doins nvidia.ko
-       else
-               doins nvidia.o
-       fi
-
-       # Add the aliases
-       insinto /etc/modules.d
-       newins ${FILESDIR}/nvidia-1.1 nvidia
-
-       # Docs
-       dodoc ${S}/README
-
-       # The device creation script
-       into /
-       newsbin ${S}/makedevices.sh NVmakedevices.sh
-}
-
-pkg_postinst() {
-       if [ "${ROOT}" = "/" ]
-       then
-               # Update module dependency
-               [ -x /usr/sbin/update-modules ] && /usr/sbin/update-modules
-               if [ ! -e /dev/.devfsd ] && [ ! -e /dev/.udev ] && [ -x /sbin/NVmakedevices.sh ]
-               then
-                       /sbin/NVmakedevices.sh >/dev/null 2>&1
-               fi
-       fi
-
-       echo
-       einfo "If you are not using devfs, loading the module automatically at"
-       einfo "boot up, you need to add \"nvidia\" to your /etc/modules.autoload."
-       echo
-       ewarn "Please note that the driver name changed from \"NVdriver\""
-       ewarn "to \"nvidia.ko\"."
-       echo
-}
diff --git a/media-video/nvidia-kernel/nvidia-kernel-1.0.5328-r1.ebuild b/media-video/nvidia-kernel/nvidia-kernel-1.0.5328-r1.ebuild
deleted file mode 100644 (file)
index 418bfc2..0000000
+++ /dev/null
@@ -1,164 +0,0 @@
-# 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.5328-r1.ebuild,v 1.10 2004/11/07 02:01:13 cyfred Exp $
-
-inherit eutils
-
-PKG_V="pkg1"
-NV_V="${PV/1.0./1.0-}"
-NV_PACKAGE="NVIDIA-Linux-x86-${NV_V}"
-S="${WORKDIR}/${NV_PACKAGE}-${PKG_V}/usr/src/nv"
-DESCRIPTION="Linux kernel module for the NVIDIA's X driver"
-HOMEPAGE="http://www.nvidia.com/"
-SRC_URI="ftp://download.nvidia.com/XFree86/Linux-x86/${NV_V}/${NV_PACKAGE}-${PKG_V}.run"
-IUSE=""
-
-# The slot needs to be set to $KV to prevent unmerges of modules for other kernels.
-LICENSE="NVIDIA"
-SLOT="${KV}"
-KEYWORDS="-* -x86"
-RESTRICT="nostrip"
-
-DEPEND="virtual/linux-sources"
-export _POSIX2_VERSION="199209"
-
-
-pkg_setup() {
-       if [ ! -f /proc/mtrr ]
-       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 -> [*] MTRR (Memory Type Range Register) support"
-               eerror
-               eerror "and recompile your kernel ..."
-               die "MTRR support not detected!"
-       fi
-
-       check_version_h
-}
-
-check_version_h() {
-       if [ ! -f "${ROOT}/usr/src/linux/include/linux/version.h" ]
-       then
-               eerror "Please verify that your /usr/src/linux symlink is pointing"
-               eerror "to your current kernel sources, and that you did run:"
-               eerror
-               eerror "  # make dep"
-               die "/usr/src/linux symlink not setup!"
-       fi
-}
-
-get_KV_info() {
-       check_version_h
-
-       # Get the kernel version of sources in /usr/src/linux ...
-       export KV_full="$(awk '/UTS_RELEASE/ { gsub("\"", "", $3); print $3 }' \
-               "${ROOT}/usr/src/linux/include/linux/version.h")"
-       export KV_major="$(echo "${KV_full}" | cut -d. -f1)"
-       export KV_minor="$(echo "${KV_full}" | cut -d. -f2)"
-       export KV_micro="$(echo "${KV_full}" | cut -d. -f3 | sed -e 's:[^0-9].*::')"
-}
-
-is_kernel() {
-       [ -z "$1" -o -z "$2" ] && return 1
-
-       get_KV_info
-
-       if [ "${KV_major}" -eq "$1" -a "${KV_minor}" -eq "$2" ]
-       then
-               return 0
-       else
-               return 1
-       fi
-}
-
-src_unpack() {
-       cd ${WORKDIR}
-       bash ${DISTDIR}/${NV_PACKAGE}-${PKG_V}.run --extract-only
-
-       # Next section applies patches for linux-2.5 kernel, and/or
-       # bugfixes for linux-2.4.  All these are from:
-       #
-       #   http://www.minion.de/nvidia/
-       #
-       # Many thanks to Christian Zander <zander@minion.de> for bringing
-       # these to us, and being so helpful to select which to use.
-
-       get_KV_info
-
-       cd ${S}
-       einfo "Linux kernel ${KV_major}.${KV_minor}.${KV_micro}"
-
-       if is_kernel 2 5 || is_kernel 2 6
-       then
-               EPATCH_SINGLE_MSG="Applying tasklet patch ..." \
-               epatch ${FILESDIR}/${PV}/NVIDIA_kernel-${NV_V}-2.6-20040105.diff
-
-               # Kbuild have issues currently (sandbox related).
-               ln -snf Makefile.nvidia Makefile
-       fi
-
-       if is_kernel 2 4
-       then
-               EPATCH_SINGLE_MSG="Applying VIA chipset bugfix patch ..." \
-               epatch ${FILESDIR}/${PV}/NVIDIA_kernel-${NV_V}-2.4-via-chipset-fix.patch
-       fi
-
-       # if you set this then it's your own fault when stuff breaks :)
-       [ ! -z "${USE_CRAZY_OPTS}" ] && sed -i "s:-O:${CFLAGS}:" Makefile
-}
-
-src_compile() {
-       # Portage should determine the version of the kernel sources
-       check_KV
-
-       # IGNORE_CC_MISMATCH disables a sanity check that's needed when gcc has been
-       # updated but the running kernel is still compiled with an older gcc.  This is
-       # needed for chrooted building, where the sanity check detects the gcc of the
-       # kernel outside the chroot rather than within.
-       make IGNORE_CC_MISMATCH="yes" KERNDIR="${ROOT}/usr/src/linux" \
-               clean nvidia.o || die
-}
-
-src_install() {
-       # The driver goes into the standard modules location
-       insinto /lib/modules/${KV}/video
-       if is_kernel 2 5 || is_kernel 2 6
-       then
-               newins nvidia.o nvidia.ko
-       else
-               doins nvidia.o
-       fi
-
-       # Add the aliases
-       insinto /etc/modules.d
-       newins ${FILESDIR}/nvidia-1.1 nvidia
-
-       # Docs
-       dodoc ${S}/README
-
-       # The device creation script
-       into /
-       newsbin ${S}/makedevices.sh NVmakedevices.sh
-}
-
-pkg_postinst() {
-       if [ "${ROOT}" = "/" ]
-       then
-               # Update module dependency
-               [ -x /usr/sbin/update-modules ] && /usr/sbin/update-modules
-               if [ ! -e /dev/.devfsd ] && [ ! -e /dev/.udev ] && [ -x /sbin/NVmakedevices.sh ]
-               then
-                       /sbin/NVmakedevices.sh >/dev/null 2>&1
-               fi
-       fi
-
-       echo
-       einfo "If you are not using devfs, loading the module automatically at"
-       einfo "boot up, you need to add \"nvidia\" to your /etc/modules.autoload."
-       echo
-       ewarn "Please note that the driver name changed from \"NVdriver\""
-       ewarn "to \"nvidia.o\"."
-       echo
-}
diff --git a/media-video/nvidia-kernel/nvidia-kernel-1.0.5332-r1.ebuild b/media-video/nvidia-kernel/nvidia-kernel-1.0.5332-r1.ebuild
deleted file mode 100644 (file)
index dbe58fc..0000000
+++ /dev/null
@@ -1,156 +0,0 @@
-# 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.5332-r1.ebuild,v 1.6 2004/11/07 02:01:13 cyfred Exp $
-
-inherit eutils
-
-PKG_V="pkg0"
-NV_V="${PV/1.0./1.0-}"
-NV_PACKAGE="NVIDIA-Linux-x86_64-${NV_V}"
-S="${WORKDIR}/${NV_PACKAGE}-${PKG_V}/usr/src/nv"
-DESCRIPTION="Linux kernel module for the NVIDIA's X driver"
-HOMEPAGE="http://www.nvidia.com/"
-SRC_URI="ftp://download.nvidia.com/XFree86/Linux-x86_64/${NV_V}/${NV_PACKAGE}-${PKG_V}.run"
-IUSE=""
-
-# The slot needs to be set to $KV to prevent unmerges of modules for other kernels.
-LICENSE="NVIDIA"
-SLOT="${KV}"
-KEYWORDS="-* -amd64"
-RESTRICT="nostrip"
-
-DEPEND="virtual/linux-sources"
-export _POSIX2_VERSION="199209"
-
-
-pkg_setup() {
-       if [ ! -f /proc/mtrr ]
-       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 -> [*] MTRR (Memory Type Range Register) support"
-               eerror
-               eerror "and recompile your kernel ..."
-               die "MTRR support not detected!"
-       fi
-
-       check_version_h
-}
-
-check_version_h() {
-       if [ ! -f "${ROOT}/usr/src/linux/include/linux/version.h" ]
-       then
-               eerror "Please verify that your /usr/src/linux symlink is pointing"
-               eerror "to your current kernel sources, and that you did run:"
-               eerror
-               eerror "  # make dep"
-               die "/usr/src/linux symlink not setup!"
-       fi
-}
-
-get_KV_info() {
-       check_version_h
-
-       # Get the kernel version of sources in /usr/src/linux ...
-       export KV_full="$(awk '/UTS_RELEASE/ { gsub("\"", "", $3); print $3 }' \
-               "${ROOT}/usr/src/linux/include/linux/version.h")"
-       export KV_major="$(echo "${KV_full}" | cut -d. -f1)"
-       export KV_minor="$(echo "${KV_full}" | cut -d. -f2)"
-       export KV_micro="$(echo "${KV_full}" | cut -d. -f3 | sed -e 's:[^0-9].*::')"
-}
-
-is_kernel() {
-       [ -z "$1" -o -z "$2" ] && return 1
-
-       get_KV_info
-
-       if [ "${KV_major}" -eq "$1" -a "${KV_minor}" -eq "$2" ]
-       then
-               return 0
-       else
-               return 1
-       fi
-}
-
-src_unpack() {
-       cd ${WORKDIR}
-       bash ${DISTDIR}/${NV_PACKAGE}-${PKG_V}.run --extract-only
-
-       # Next section applies patches for linux-2.5 kernel, and/or
-       # bugfixes for linux-2.4.  All these are from:
-       #
-       #   http://www.minion.de/nvidia/
-       #
-       # Many thanks to Christian Zander <zander@minion.de> for bringing
-       # these to us, and being so helpful to select which to use.
-
-       get_KV_info
-
-       cd ${S}
-       einfo "Linux kernel ${KV_major}.${KV_minor}.${KV_micro}"
-
-       if is_kernel 2 5 || is_kernel 2 6
-       then
-               # Kbuild have issues currently (sandbox related).
-               EPATCH_SINGLE_MSG="Applying 2.6.x patch ..." \
-               epatch ${FILESDIR}/${PV}/NVIDIA-Linux-x86_64-1.0-5332-2.6.diff
-       fi
-
-       # if you set this then it's your own fault when stuff breaks :)
-       [ ! -z "${USE_CRAZY_OPTS}" ] && sed -i "s:-O:${CFLAGS}:" Makefile
-}
-
-src_compile() {
-       # Portage should determine the version of the kernel sources
-       check_KV
-
-       # IGNORE_CC_MISMATCH disables a sanity check that's needed when gcc has been
-       # updated but the running kernel is still compiled with an older gcc.  This is
-       # needed for chrooted building, where the sanity check detects the gcc of the
-       # kernel outside the chroot rather than within.
-       make IGNORE_CC_MISMATCH="yes" KERNDIR="${ROOT}/usr/src/linux" \
-               clean nvidia.o || die
-}
-
-src_install() {
-       # The driver goes into the standard modules location
-       insinto /lib/modules/${KV}/video
-       if is_kernel 2 5 || is_kernel 2 6
-       then
-               doins nvidia.ko
-       else
-               doins nvidia.o
-       fi
-
-       # Add the aliases
-       insinto /etc/modules.d
-       newins ${FILESDIR}/nvidia-1.1 nvidia
-
-       # Docs
-       dodoc ${S}/README
-
-       # The device creation script
-       into /
-       newsbin ${S}/makedevices.sh NVmakedevices.sh
-}
-
-pkg_postinst() {
-       if [ "${ROOT}" = "/" ]
-       then
-               # Update module dependency
-               [ -x /usr/sbin/update-modules ] && /usr/sbin/update-modules
-               if [ ! -e /dev/.devfsd ] && [ ! -e /dev/.udev ] && [ -x /sbin/NVmakedevices.sh ]
-               then
-                       /sbin/NVmakedevices.sh >/dev/null 2>&1
-               fi
-       fi
-
-       echo
-       einfo "If you are not using devfs, loading the module automatically at"
-       einfo "boot up, you need to add \"nvidia\" to your /etc/modules.autoload."
-       echo
-       ewarn "Please note that the driver name changed from \"NVdriver\""
-       ewarn "to \"nvidia.o\"."
-       echo
-}
diff --git a/media-video/nvidia-kernel/nvidia-kernel-1.0.5336-r4.ebuild b/media-video/nvidia-kernel/nvidia-kernel-1.0.5336-r4.ebuild
deleted file mode 100644 (file)
index 9afc97e..0000000
+++ /dev/null
@@ -1,160 +0,0 @@
-# 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.5336-r4.ebuild,v 1.5 2004/11/07 02:01:13 cyfred Exp $
-
-inherit eutils kmod
-
-PKG_V="pkg1"
-NV_V="${PV/1.0./1.0-}"
-NV_PACKAGE="NVIDIA-Linux-x86-${NV_V}"
-S="${WORKDIR}/${NV_PACKAGE}-${PKG_V}/usr/src/nv"
-DESCRIPTION="Linux kernel module for the NVIDIA's X driver"
-HOMEPAGE="http://www.nvidia.com/"
-SRC_URI="ftp://download.nvidia.com/XFree86/Linux-x86/${NV_V}/${NV_PACKAGE}-${PKG_V}.run"
-IUSE=""
-
-# The slot needs to be set to $KV to prevent unmerges of modules for other kernels.
-LICENSE="NVIDIA"
-SLOT="${KV}"
-KEYWORDS="-* -x86"
-RESTRICT="nostrip"
-
-DEPEND="virtual/linux-sources"
-export _POSIX2_VERSION="199209"
-
-KMOD_SOURCES="none"
-
-mtrr_check() {
-       if [ ! -f /proc/mtrr ]
-       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 -> [*] MTRR (Memory Type Range Register) support"
-               eerror
-               eerror "and recompile your kernel ..."
-               die "MTRR support not detected!"
-       fi
-}
-
-pkg_setup() {
-       mtrr_check
-
-       echo
-       ewarn "The new 2.6.6 Series kernels include an option for 4K Stack sizes,"
-       ewarn "this option must NOT be selected. This driver will only work with"
-       ewarn "the OLD 8K Stack size, please ensure you leave 8K stack sizes for now."
-       echo
-}
-
-ck_kern_write() {
-       if [ ! "${KV_PATCH}" -ge "6" ]
-       then
-               ewarn "You are running Linux Kernel ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}\n"
-               ewarn "Due to incompatibilities between the current nvidia drivers and"
-               ewarn "the new 2.6.6 kernel sources we need to use the koutput feature"
-               ewarn "unfortunately this means that older kernels will be omitted from"
-               ewarn "the sandbox for this build.\n"
-               ewarn "This will be over come with newer driver releases from nvidia."
-               echo
-               ewarn "THIS BUILD WILL NOT WORK WITH FEATURES=\"userpriv\""
-               echo
-               ewarn "We are working to resolve this issue, please disable userpriv"
-               ewarn "if you use it while building nvidia-kernel."
-               return 0
-       else
-               return 1
-       fi
-}
-
-src_unpack() {
-       # Let the kmod eclass set the variables for us
-       kmod_src_unpack
-
-       cd ${WORKDIR}
-       bash ${DISTDIR}/${NV_PACKAGE}-${PKG_V}.run --extract-only
-
-       # Next section applies patches for linux-2.5 kernel, and/or
-       # bugfixes for linux-2.4.  All these are from:
-       #
-       #   http://www.minion.de/nvidia/
-       #
-       # Many thanks to Christian Zander <zander@minion.de> for bringing
-       # these to us, and being so helpful to select which to use.
-
-       cd ${S}
-
-       # Support for gcc-3.4, so 2.4.xx should benifit as well ...
-       epatch ${FILESDIR}/${PV}/NVIDIA_kernel-${NV_V}-2.6-20040521.patch
-       # Cannot hurt for 2.4.xx as well ...
-       epatch ${FILESDIR}/${PV}/NVIDIA_kernel-${NV_V}-fix-makefile-for-2.6.patch
-
-       if is_kernel 2 5 || is_kernel 2 6
-       then
-               # Add sysfs support
-               epatch ${FILESDIR}/${PV}/NVIDIA_kernel-${NV_V}-basic-sysfs-support-v2.patch
-               # Add koutput support to kbuild (this is the BIGGEST hack)
-               epatch ${FILESDIR}/${PV}/NVIDIA_kernel-${NV_V}-kbuild-koutput-support.patch
-       fi
-
-       # if you set this then it's your own fault when stuff breaks :)
-       [ ! -z "${USE_CRAZY_OPTS}" ] && sed -i "s:-O:${CFLAGS}:" Makefile.*
-}
-
-src_compile() {
-       # IGNORE_CC_MISMATCH disables a sanity check that's needed when gcc has been
-       # updated but the running kernel is still compiled with an older gcc.  This is
-       # needed for chrooted building, where the sanity check detects the gcc of the
-       # kernel outside the chroot rather than within.
-       if is_kernel 2 5 || is_kernel 2 6
-       then
-               if ck_kern_write
-               then
-                       KD="`/bin/readlink -f ${KERNEL_DIR}`"
-                       einfo "Adding write support to ${KD}\n"
-                       addwrite "${KD}"
-               fi
-
-               unset ARCH
-       fi
-       make IGNORE_CC_MISMATCH="yes" SYSSRC="${KERNEL_DIR}" KV_OUT="${KV_OUTPUT}" \
-               clean module V=1 || die "Failed to build module"
-}
-
-src_install() {
-       # The driver goes into the standard modules location
-       insinto /lib/modules/${KV}/video
-
-       # Insert the module 
-       doins nvidia.${KV_OBJ}
-
-       # Add the aliases
-       insinto /etc/modules.d
-       newins ${FILESDIR}/nvidia-1.1 nvidia
-
-       # Docs
-       dodoc ${S}/README
-
-       # The device creation script
-       into /
-       newsbin ${S}/makedevices.sh NVmakedevices.sh
-}
-
-pkg_postinst() {
-       if [ "${ROOT}" = "/" ]
-       then
-               # Update module dependency
-               [ -x /usr/sbin/update-modules ] && /usr/sbin/update-modules
-               if [ ! -e /dev/.devfsd ] && [ ! -e /dev/.udev ] && [ -x /sbin/NVmakedevices.sh ]
-               then
-                       /sbin/NVmakedevices.sh >/dev/null 2>&1
-               fi
-       fi
-
-       echo
-       einfo "If you need to load the module automatically on boot up you need"
-       einfo "to add \"nvidia\" to /etc/modules.autoload.d/kernel-${KV_MAJOR}.${KV_MINOR}"
-       echo
-       einfo "Please note that the driver name is nvidia.${KV_OBJ}, not NVdriver"
-       echo
-}
diff --git a/media-video/nvidia-kernel/nvidia-kernel-1.0.6106-r1.ebuild b/media-video/nvidia-kernel/nvidia-kernel-1.0.6106-r1.ebuild
deleted file mode 100644 (file)
index 5c7b9c9..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-# 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.6106-r1.ebuild,v 1.3 2004/11/07 02:01:13 cyfred Exp $
-
-inherit eutils kmod
-
-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"
-
-# The slot needs to be set to $KV to prevent unmerges of modules for other kernels.
-LICENSE="NVIDIA"
-SLOT="${KV}"
-KEYWORDS="-* -x86 -amd64"
-RESTRICT="nostrip"
-IUSE=""
-
-DEPEND="virtual/linux-sources"
-export _POSIX2_VERSION="199209"
-
-KMOD_SOURCES="none"
-
-mtrr_check() {
-       if [ ! -f /proc/mtrr ]
-       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 -> [*] MTRR (Memory Type Range Register) support"
-               eerror
-               eerror "and recompile your kernel ..."
-               die "MTRR support not detected!"
-       fi
-}
-
-pkg_setup() {
-       mtrr_check
-}
-
-src_unpack() {
-       # Let the kmod eclass set the variables for us
-       kmod_src_unpack
-
-       cd ${WORKDIR}
-       bash ${DISTDIR}/${NV_PACKAGE}-${PKG_V}.run --extract-only
-
-       # Add patches below, with a breif description.
-       # 1) SYSFS supported by nvidia
-       # 2) minion.de patches not released yet
-
-       cd ${S}
-
-       # Add koutput compile time support... this is hackish
-       epatch ${FILESDIR}/${PV}/NVIDIA_kernel-${NV_V}-koutput-support.patch
-
-       # if you set this then it's your own fault when stuff breaks :)
-       [ ! -z "${USE_CRAZY_OPTS}" ] && sed -i "s:-O:${CFLAGS}:" Makefile.*
-}
-
-src_compile() {
-       # IGNORE_CC_MISMATCH disables a sanity check that's needed when gcc has been
-       # updated but the running kernel is still compiled with an older gcc.  This is
-       # needed for chrooted building, where the sanity check detects the gcc of the
-       # kernel outside the chroot rather than within.
-       if is_kernel 2 5 || is_kernel 2 6
-       then
-               unset ARCH
-       fi
-       make IGNORE_CC_MISMATCH="yes" SYSSRC="${KERNEL_DIR}" KVOUT="${KV_OUTPUT}"  \
-               clean module V=1 || die "Failed to build module"
-}
-
-src_install() {
-       # The driver goes into the standard modules location
-       insinto /lib/modules/${KV}/video
-
-       # Insert the module 
-       doins nvidia.${KV_OBJ}
-
-       # Add the aliases
-       insinto /etc/modules.d
-       newins ${FILESDIR}/nvidia-1.1 nvidia
-
-       # Docs
-       dodoc ${S}/README
-
-       # The device creation script
-       into /
-       newsbin ${S}/makedevices.sh NVmakedevices.sh
-}
-
-pkg_postinst() {
-       if [ "${ROOT}" = "/" ]
-       then
-               # Update module dependency
-               [ -x /usr/sbin/update-modules ] && /usr/sbin/update-modules
-               if [ ! -e /dev/.devfsd ] && [ ! -e /dev/.udev ] && [ -x /sbin/NVmakedevices.sh ]
-               then
-                       /sbin/NVmakedevices.sh >/dev/null 2>&1
-               fi
-       fi
-
-       echo
-       einfo "If you need to load the module automatically on boot up you need"
-       einfo "to add \"nvidia\" to /etc/modules.autoload.d/kernel-${KV_MAJOR}.${KV_MINOR}"
-       echo
-       einfo "Please note that the driver name is \"nvidia\", not \"NVdriver\""
-       echo
-       einfo "This module will now work correctly under udev, you do not need to"
-       einfo "manually create the devices anymore."
-       echo
-}
diff --git a/media-video/nvidia-kernel/nvidia-kernel-1.0.6111-r2.ebuild b/media-video/nvidia-kernel/nvidia-kernel-1.0.6111-r2.ebuild
deleted file mode 100644 (file)
index b937716..0000000
+++ /dev/null
@@ -1,139 +0,0 @@
-# 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.6111-r2.ebuild,v 1.2 2004/11/07 02:01:13 cyfred Exp $
-
-inherit eutils kmod
-
-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"
-
-# The slot needs to be set to $KV to prevent unmerges of modules for other kernels.
-LICENSE="NVIDIA"
-SLOT="${KV}"
-KEYWORDS="-* -x86 -amd64"
-RESTRICT="nostrip"
-IUSE=""
-
-DEPEND="virtual/linux-sources"
-export _POSIX2_VERSION="199209"
-
-KMOD_SOURCES="none"
-
-mtrr_check() {
-       if [ ! -f /proc/mtrr ]
-       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 -> [*] MTRR (Memory Type Range Register) support"
-               eerror
-               eerror "and recompile your kernel ..."
-               die "MTRR support not detected!"
-       fi
-}
-
-pkg_setup() {
-       mtrr_check
-}
-
-src_unpack() {
-       # Let the kmod eclass set the variables for us
-       kmod_src_unpack
-
-       cd ${WORKDIR}
-       bash ${DISTDIR}/${NV_PACKAGE}-${PKG_V}.run --extract-only
-
-       # Add patches below, with a breif description.
-       # 1) SYSFS supported by nvidia
-       # 2) minion.de patches not released yet
-
-       cd ${S}
-
-       # Fix up the removal of PM_SAVE_STATE in kernels > 2.6.8
-       epatch ${FILESDIR}/${PV}/power-suspend-2.6.9-changes.patch
-       # Update pci stuff to work with irqroutes being changed in kernels
-       epatch ${FILESDIR}/${PV}/nv_enable_pci.patch
-       # Fix VMALLOC_RESERVE issues with the new 2.6.9 release candidates
-       epatch ${FILESDIR}/${PV}/vmalloc-reserve.patch
-       # Port pci_find_class() -> pci_get_class() for >= 2.6.9-rc2
-       epatch ${FILESDIR}/${PV}/nv-pci_find_class.patch
-       # Fix remap_page_range() -> remap_pfn_range() for >= 2.6.9-rc2
-       epatch ${FILESDIR}/${PV}/nv-remap-range.patch
-
-       # TODO Combine the above patches into one
-
-       # if you set this then it's your own fault when stuff breaks :)
-       [ ! -z "${USE_CRAZY_OPTS}" ] && sed -i "s:-O:${CFLAGS}:" Makefile.*
-}
-
-src_compile() {
-       # IGNORE_CC_MISMATCH disables a sanity check that's needed when gcc has been
-       # updated but the running kernel is still compiled with an older gcc.  This is
-       # needed for chrooted building, where the sanity check detects the gcc of the
-       # kernel outside the chroot rather than within.
-       if is_kernel 2 5 || is_kernel 2 6
-       then
-               unset ARCH
-       fi
-       make IGNORE_CC_MISMATCH="yes" SYSSRC="${KERNEL_DIR}" SYSOUT="${KV_OUTPUT}"  \
-               clean module V=1 || die "Failed to build module"
-}
-
-src_install() {
-       # The driver goes into the standard modules location
-       insinto /lib/modules/${KV}/video
-
-       # Insert the module 
-       doins nvidia.${KV_OBJ}
-
-       # Add the aliases
-       insinto /etc/modules.d
-       newins ${FILESDIR}/nvidia-1.1 nvidia
-
-       # Docs
-       dodoc ${S}/README
-
-       # The device creation script
-       into /
-       newsbin ${S}/makedevices.sh NVmakedevices.sh
-}
-
-pkg_postinst() {
-       if [ "${ROOT}" = "/" ]
-       then
-               # Update module dependency
-               [ -x /usr/sbin/update-modules ] && /usr/sbin/update-modules
-               if [ ! -e /dev/.devfsd ] && [ ! -e /dev/.udev ] && [ -x /sbin/NVmakedevices.sh ]
-               then
-                       /sbin/NVmakedevices.sh >/dev/null 2>&1
-               fi
-       fi
-
-       echo
-       einfo "If you need to load the module automatically on boot up you need"
-       einfo "to add \"nvidia\" to /etc/modules.autoload.d/kernel-${KV_MAJOR}.${KV_MINOR}"
-       echo
-       einfo "Please note that the driver name is \"nvidia\", not \"NVdriver\""
-       echo
-       einfo "This module will now work correctly under udev, you do not need to"
-       einfo "manually create the devices anymore."
-       echo
-}