summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Schlemmer <azarah@gentoo.org>2003-06-22 15:03:40 +0000
committerMartin Schlemmer <azarah@gentoo.org>2003-06-22 15:03:40 +0000
commit71c765db26eb16ffe6dccc52f0084666b3fcc43d (patch)
tree81bf04b19def1169da242f32dc14c8e2e6ddebba /media-video/nvidia-kernel
parentUpdate patches for merged version. Mark stable for x86. (diff)
downloadgentoo-2-71c765db26eb16ffe6dccc52f0084666b3fcc43d.tar.gz
gentoo-2-71c765db26eb16ffe6dccc52f0084666b3fcc43d.tar.bz2
gentoo-2-71c765db26eb16ffe6dccc52f0084666b3fcc43d.zip
Update patches for merged version. Mark stable for x86.
Diffstat (limited to 'media-video/nvidia-kernel')
-rw-r--r--media-video/nvidia-kernel/ChangeLog7
-rw-r--r--media-video/nvidia-kernel/Manifest19
-rw-r--r--media-video/nvidia-kernel/files/1.0.4349/NVIDIA_kernel-1.0-4349-2.5-20030401.diff2195
-rw-r--r--media-video/nvidia-kernel/files/1.0.4363/NVIDIA_kernel-1.0-4363-2.5-20030614.diff (renamed from media-video/nvidia-kernel/files/1.0.4363/NVIDIA_kernel-1.0-4363-2.5-20030424.diff)332
-rw-r--r--media-video/nvidia-kernel/files/1.0.4363/NVIDIA_kernel-1.0-4363-2.5.68.diff43
-rw-r--r--media-video/nvidia-kernel/files/1.0.4363/NVIDIA_kernel-1.0-4363-2.5.69-agp.diff48
-rw-r--r--media-video/nvidia-kernel/files/1.0.4363/NVIDIA_kernel-1.0-4363-2.5.69.diff49
-rw-r--r--media-video/nvidia-kernel/files/NVIDIA_kernel-1.0-4349-2.5.diff2217
-rw-r--r--media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.43491
-rw-r--r--media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.4349-r11
-rw-r--r--media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.43631
-rw-r--r--media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.4363-r11
-rw-r--r--media-video/nvidia-kernel/nvidia-kernel-1.0.4349-r1.ebuild143
-rw-r--r--media-video/nvidia-kernel/nvidia-kernel-1.0.4349.ebuild143
-rw-r--r--media-video/nvidia-kernel/nvidia-kernel-1.0.4363-r1.ebuild143
-rw-r--r--media-video/nvidia-kernel/nvidia-kernel-1.0.4363-r2.ebuild64
-rw-r--r--media-video/nvidia-kernel/nvidia-kernel-1.0.4363.ebuild136
17 files changed, 275 insertions, 5268 deletions
diff --git a/media-video/nvidia-kernel/ChangeLog b/media-video/nvidia-kernel/ChangeLog
index 790c07ba5a85..650f99723abd 100644
--- a/media-video/nvidia-kernel/ChangeLog
+++ b/media-video/nvidia-kernel/ChangeLog
@@ -1,6 +1,11 @@
# ChangeLog for media-video/nvidia-kernel
# Copyright 2002-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/media-video/nvidia-kernel/ChangeLog,v 1.33 2003/05/26 20:11:32 azarah Exp $
+# $Header: /var/cvsroot/gentoo-x86/media-video/nvidia-kernel/ChangeLog,v 1.34 2003/06/22 15:02:23 azarah Exp $
+
+ 22 Jun 2003; Martin Schlemmer <azarah@gentoo.org> nvidia-kernel-1.0.4363-r2.ebuild,
+ files/1.0.4363/NVIDIA_kernel-1.0-4363-2.5-20030614.diff:
+ Update 2.5 patch from minion.de. Some cleanups for the kernel version stuff.
+ Mark stable for x86.
*nvidia-kernel-1.0.4363-r2 (26 May 2003)
diff --git a/media-video/nvidia-kernel/Manifest b/media-video/nvidia-kernel/Manifest
index a7087ddb8883..5f0ef9a85daa 100644
--- a/media-video/nvidia-kernel/Manifest
+++ b/media-video/nvidia-kernel/Manifest
@@ -1,15 +1,10 @@
-MD5 72b5c30956287e008e275335251c3854 ChangeLog 6855
+MD5 ed9fba75f23d8df1987a045a11f1249f ChangeLog 7103
MD5 04b1f361d40708ab81631bea5e46a632 nvidia-kernel-1.0.2880-r1.ebuild 1970
MD5 5177ed76121fb4bc1aa220c62319d196 nvidia-kernel-1.0.2960-r1.ebuild 2081
MD5 16a9003f79bea31eeec6f03ae64cd8ef nvidia-kernel-1.0.3123-r2.ebuild 3229
MD5 4fc62b5769bfcbb15e69c27860bc27e7 nvidia-kernel-1.0.4191-r2.ebuild 3870
-MD5 e64884b31959fdf80e8abc6016f63e34 nvidia-kernel-1.0.4349-r1.ebuild 4219
+MD5 1cc6bbe9ad30e518aa73a838830dc2bc nvidia-kernel-1.0.4363-r2.ebuild 4043
MD5 0646bd1f1f1109063862d1475aaccab4 nvidia-kernel-1.0.4349-r2.ebuild 3702
-MD5 10e07a6ec08e11dab21341ae06788e78 nvidia-kernel-1.0.4349.ebuild 4201
-MD5 60d9b36f0373c43f7942c7dcc942350b nvidia-kernel-1.0.4363.ebuild 4104
-MD5 41ef9b0e0b419230890e03d60ac5530d nvidia-kernel-1.0.4363-r2.ebuild 4663
-MD5 fb0098fb2f158b1633237ad1e18bdb8f nvidia-kernel-1.0.4363-r1.ebuild 4364
-MD5 ce0902323c5c037bceab1d36a3288a52 .nvidia-kernel-1.0.4363-r2.ebuild.swp 20480
MD5 441b29e8f10b6620c4dd4fc01528f172 files/NVIDIA_kernel-1.0-3123-2.5-module.diff 5569
MD5 4057597a09dd795c93ce8088d6f023bb files/NVIDIA_kernel-1.0-3123-2.5-tl-pa.diff 11858
MD5 059b3ddf8944dce6c9184d11d15abd71 files/NVIDIA_kernel-1.0-3123-2.5-tl.diff 31614
@@ -18,24 +13,14 @@ MD5 f38a4afc671446ad293a46b0046c0aec files/NVIDIA_kernel-1.0-3123-pa.diff 10825
MD5 7f987ae6384103d87f323d834bba87a1 files/NVIDIA_kernel-1.0-4191-2.5-tl.diff 39065
MD5 57f69061f52fd98e20c7d62882af2757 files/NVIDIA_kernel-1.0-4191-2.5.54.diff 1228
MD5 6d8e159e5bdeb520091874050594b706 files/NVIDIA_kernel-1.0-4191-2.5.63.diff 814
-MD5 10b4f13c2bcadeb688057dd9c80e60e7 files/NVIDIA_kernel-1.0-4349-2.5.diff 70087
MD5 ef31d4cc1ef62e1c3b2336d984cf6496 files/digest-nvidia-kernel-1.0.2880-r1 74
MD5 15c10778db607715e60a461e09d9f54c files/digest-nvidia-kernel-1.0.2960-r1 1122
MD5 5ba2848379bbce2f85d8442c01c0291d files/digest-nvidia-kernel-1.0.3123-r2 74
MD5 854b5c292ec300d7105dbd54385840f6 files/digest-nvidia-kernel-1.0.4191-r2 74
-MD5 c66873e3c55fd472cc99da1b74499c03 files/digest-nvidia-kernel-1.0.4349 74
-MD5 c66873e3c55fd472cc99da1b74499c03 files/digest-nvidia-kernel-1.0.4349-r1 74
MD5 c66873e3c55fd472cc99da1b74499c03 files/digest-nvidia-kernel-1.0.4349-r2 74
-MD5 56ebaa3ba92e9db848baea746a6aef1a files/digest-nvidia-kernel-1.0.4363 74
MD5 089e6829e7e8497a603ba9dc9563a722 files/nvidia 30
MD5 b6a9c4bdd3961980af4a70f57485d708 files/nvidia-1.1 441
-MD5 56ebaa3ba92e9db848baea746a6aef1a files/digest-nvidia-kernel-1.0.4363-r1 74
MD5 56ebaa3ba92e9db848baea746a6aef1a files/digest-nvidia-kernel-1.0.4363-r2 74
-MD5 c2b76deee2403fc2b92ef4af7294ac27 files/1.0.4349/NVIDIA_kernel-1.0-4349-2.5-20030401.diff 69423
MD5 31565678620709b117139345323051fd files/1.0.4349/NVIDIA_kernel-1.0-4349-2.5-20030402.diff 70350
MD5 439563bcf7fa96c91361226fae454e0e files/1.0.4349/NVIDIA_kernel-1.0-4349-2.5.68.diff 1467
-MD5 051a7f07595e4d97c82275767fe961f9 files/1.0.4363/NVIDIA_kernel-1.0-4363-2.5-20030424.diff 69299
-MD5 439563bcf7fa96c91361226fae454e0e files/1.0.4363/NVIDIA_kernel-1.0-4363-2.5.68.diff 1467
-MD5 78aae777bb88899e94c4b42d51c0ccd3 files/1.0.4363/NVIDIA_kernel-1.0-4363-2.5.69.diff 1718
-MD5 c8791c963b5cef6e865def9e9c3f5f09 files/1.0.4363/NVIDIA_kernel-1.0-4363-2.5.69-agp.diff 1336
MD5 e08e015c157458037c079e0259cf16a6 files/1.0.4363/NVIDIA_kernel-1.0-4363-2.5-20030614.diff 74562
diff --git a/media-video/nvidia-kernel/files/1.0.4349/NVIDIA_kernel-1.0-4349-2.5-20030401.diff b/media-video/nvidia-kernel/files/1.0.4349/NVIDIA_kernel-1.0-4349-2.5-20030401.diff
deleted file mode 100644
index e1ff248623f4..000000000000
--- a/media-video/nvidia-kernel/files/1.0.4349/NVIDIA_kernel-1.0-4349-2.5-20030401.diff
+++ /dev/null
@@ -1,2195 +0,0 @@
-diff -ruN NVIDIA_kernel-1.0-4349/Makefile NVIDIA_kernel-1.0-4349-2.5/Makefile
---- NVIDIA_kernel-1.0-4349/Makefile 2003-03-28 04:30:56.000000000 +0100
-+++ NVIDIA_kernel-1.0-4349-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 Thu Mar 27 19:00:03 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=4349 -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-4349/Makefile.kbuild NVIDIA_kernel-1.0-4349-2.5/Makefile.kbuild
---- NVIDIA_kernel-1.0-4349/Makefile.kbuild 1970-01-01 01:00:00.000000000 +0100
-+++ NVIDIA_kernel-1.0-4349-2.5/Makefile.kbuild 2003-03-30 21:45:21.000000000 +0200
-@@ -0,0 +1,229 @@
-+#
-+# 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@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)
-+
-+obj-m += $(MODULE_NAME).o
-+
-+#
-+# We rely on these two definitions below; make sure they are set correctly
-+# when using Linux 2.4 KBUILD.
-+#
-+
-+ifndef PATCHLEVEL
-+ src := .
-+ obj := .
-+else
-+ ifeq ($(PATCHLEVEL), 4)
-+ src := .
-+ obj := .
-+ endif
-+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)
-+ INCLUDES := -I$(KERNEL_SOURCES)/include
-+else
-+ KERNEL_SOURCES := /lib/modules/$(shell uname -r)/build
-+ INCLUDES := -I$(KERNEL_SOURCES)/include
-+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 $(INCLUDES)), 5)
-+ EXTRA_CFLAGS += -DREMAP_PAGE_RANGE_5
-+endif
-+
-+ifeq ($(shell sh $(src)/conftest.sh remap_page_range $(INCLUDES)), 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 -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.
-+#
-+
-+build: cc-sanity-check
-+ @make $(KBUILD_PARAMS) modules; \
-+ if ! [ -f $(MODULE_NAME).ko -o -f $(MODULE_NAME).o ]; then \
-+ echo "$(MODULE_NAKE).{o,ko} failed to build!"; \
-+ exit 1; \
-+ fi
-+
-+#
-+# Install the NVIDIA kernel module using Linux KBUILD. Verify that user has
-+# sufficient privileges and that existing modules can be unloaded.
-+#
-+
-+package-install: suser-sanity-check build rmmod-sanity-check
-+ @sh makedevices.sh; \
-+ make $(KBUILD_PARAMS) modules_install; \
-+ /sbin/depmod -ae; \
-+ /sbin/modprobe $(MODULE_NAME) && \
-+ echo "$(MODULE_NAME).{o,ko} 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) *~
-+
-+#
-+# Lastly, even more quirks for Linux 2.4 KBUILD.
-+#
-+
-+fastdep:
-+
-+ifeq ($(PATCHLEVEL), 4)
-+include $(KERNEL_SOURCES)/Rules.make
-+endif
-+
-diff -ruN NVIDIA_kernel-1.0-4349/Makefile.nvidia NVIDIA_kernel-1.0-4349-2.5/Makefile.nvidia
---- NVIDIA_kernel-1.0-4349/Makefile.nvidia 1970-01-01 01:00:00.000000000 +0100
-+++ NVIDIA_kernel-1.0-4349-2.5/Makefile.nvidia 2003-03-30 21:43:11.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 $(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
-+
-+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 -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-4349/conftest.sh NVIDIA_kernel-1.0-4349-2.5/conftest.sh
---- NVIDIA_kernel-1.0-4349/conftest.sh 2003-03-28 04:30:56.000000000 +0100
-+++ NVIDIA_kernel-1.0-4349-2.5/conftest.sh 2003-03-30 21:40:14.000000000 +0200
-@@ -21,17 +21,82 @@
- }" > conftest.c
-
- RPR_TEST_4=$(gcc -c conftest.c -o /dev/null $* -D__KERNEL__ 2>&1)
-+ rm conftest.c
-
- if test -z "$RPR_TEST_4"; then
- echo "4"
- elif test -z "$RPR_TEST_5"; then
- echo "5"
- else
-- echo " "
-- echo "Warning! conftest.sh was unable to determine the number of "
-- echo "arguments expected by remap_page_range: assuming 4. "
-- echo " "
-- echo "4"
-+ #
-+ # We couldn't determine the number of arguments expected by the
-+ # remap_page_range function.
-+ #
-+ 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 -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
-+ ;;
-+
-+ 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-4349/nv-linux.h NVIDIA_kernel-1.0-4349-2.5/nv-linux.h
---- NVIDIA_kernel-1.0-4349/nv-linux.h 2003-03-28 04:30:56.000000000 +0100
-+++ NVIDIA_kernel-1.0-4349-2.5/nv-linux.h 2003-03-29 21:27:01.000000000 +0100
-@@ -20,35 +20,20 @@
- # 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
- #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 +46,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 +62,16 @@
- #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 +80,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,37 +122,41 @@
- for (pos = (head)->next; pos != (head); pos = (pos)->next)
- #endif
-
--#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 2, 18)
--#define vmalloc_32 vmalloc
--#endif
--
--#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)
-+#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 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_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
-
- #if defined(REMAP_PAGE_RANGE_5)
- #define NV_REMAP_PAGE_RANGE(a, b...) remap_page_range(vma, a, ## b)
--#else
-+#elif defined(REMAP_PAGE_RANGE_4)
- #define NV_REMAP_PAGE_RANGE(a, b...) remap_page_range(a, ## b)
-+#else
-+#error "Unable to determine number of arguments expected by remap_page_range!"
- #endif
-
- #if defined(pte_offset_atomic)
-@@ -187,14 +181,6 @@
- #define NV_PAGE_ALIGN(addr) ( ((addr) + PAGE_SIZE - 1) / PAGE_SIZE)
- #define NV_MASK_OFFSET(addr) ( (addr) & (PAGE_SIZE - 1) )
-
--#ifndef MAXMEM /* temporary define for 2.2 kernels */
--#define MAXMEM (-PAGE_OFFSET - (64 * 1024 * 1024))
--#endif
--
--#ifndef NV01_ROOT
--#define NV01_ROOT 0x00000000
--#endif
--
- #if defined(NVCPU_IA64)
- #define NV_GFP_HW (GFP_KERNEL | __GFP_DMA)
- #define CACHE_FLUSH()
-@@ -250,7 +236,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);
- }
-
-@@ -308,16 +294,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-4349/nv.c NVIDIA_kernel-1.0-4349-2.5/nv.c
---- NVIDIA_kernel-1.0-4349/nv.c 2003-03-28 04:30:55.000000000 +0100
-+++ NVIDIA_kernel-1.0-4349-2.5/nv.c 2003-04-01 20:25:50.000000000 +0200
-@@ -16,6 +16,8 @@
- #include "os-agp.h"
-
-
-+MODULE_LICENSE("NVIDIA");
-+
- /*
- * our global state; one per device
- */
-@@ -36,7 +38,6 @@
- // 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;
-@@ -47,16 +48,6 @@
- devfs_handle_t nv_ctl_handle;
- #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);
-@@ -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));
-+ mem_map_reserve(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));
-+ mem_map_unreserve(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));
-+ mem_map_unreserve(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);
-@@ -633,9 +616,6 @@
- {
- #ifdef CONFIG_PROC_FS
- nvos_proc_remove_all(proc_nvidia);
--#if defined (KERNEL_2_2)
-- remove_proc_entry("driver", &proc_root);
--#endif
- #endif
- }
-
-@@ -724,11 +704,10 @@
- *** 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 num_devices, i;
-
- memset(nv_linux_devices, 0, sizeof(nv_linux_devices));
- num_devices = nvos_probe_devices();
-@@ -740,14 +719,14 @@
-
- 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;
- }
-
-@@ -755,7 +734,6 @@
- memset(nv_dev_handle, 0, sizeof(devfs_handle_t) * NV_MAX_DEVICES);
- do {
- char name[10];
-- int i;
-
- nv_ctl_handle = devfs_register(NULL, "nvidiactl",
- DEVFS_FL_DEFAULT, nv_major, 255,
-@@ -772,23 +750,30 @@
- } 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
-@@ -813,14 +798,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");
-@@ -828,7 +813,7 @@
- return rc;
- }
-
--void cleanup_module(void)
-+static void __exit nvidia_exit_module(void)
- {
- int rc;
- nv_linux_state_t *nvl;
-@@ -837,9 +822,9 @@
- /* 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
-
-@@ -864,20 +849,20 @@
- 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
-@@ -891,6 +876,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
-@@ -904,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",
-@@ -916,8 +903,6 @@
-
- nvos_list_page_count(at->page_table, at->num_pages);
- }
--
-- MOD_INC_USE_COUNT;
- }
-
-
-@@ -925,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--;
-
-@@ -947,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.
-@@ -975,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: "
-@@ -1014,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;
- }
-
-@@ -1036,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
- };
-
-
-@@ -1074,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? */
-@@ -1085,9 +1057,6 @@
- goto failed;
- }
-
--
-- MOD_INC_USE_COUNT;
--
- nvl = &nv_linux_devices[devnum];
- nv = NV_STATE_PTR(nvl);
-
-@@ -1135,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;
- }
-@@ -1155,7 +1117,6 @@
- return rc;
-
- failed:
-- MOD_DEC_USE_COUNT;
- nv_unlock_ldata(nv);
- return rc;
- }
-@@ -1177,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));
-@@ -1187,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);
-@@ -1228,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);
- }
-@@ -1244,8 +1193,6 @@
- NV_KFREE(file->private_data);
- file->private_data = (void *) 0;
-
-- MOD_DEC_USE_COUNT;
--
- return 0;
- }
-
-@@ -1262,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)))
- {
-@@ -1283,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)
-@@ -1291,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;
-@@ -1301,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 */
-@@ -1310,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;
-@@ -1320,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)
- {
-@@ -1341,7 +1288,7 @@
- }
-
- at->vma = vma;
-- VMA_PRIVATE(vma) = at;
-+ NV_VMA_PRIVATE(vma) = at;
- at->usage_count++;
-
- if (NV_OSAGP_ENABLED(nv))
-@@ -1364,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)
- {
-@@ -1388,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);
-@@ -1410,9 +1357,6 @@
-
- vma->vm_file = file;
-
-- /* just increment usage count, rather than calling vma_open */
-- MOD_INC_USE_COUNT;
--
- return 0;
- }
-
-@@ -1437,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);
-
-@@ -1517,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):
- {
-@@ -1663,8 +1608,7 @@
- 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);
- }
- }
-
-@@ -1758,26 +1702,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 */
-@@ -1805,15 +1729,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);
-@@ -1823,8 +1739,6 @@
- NV_KFREE(file->private_data);
- file->private_data = (void *) 0;
-
-- MOD_DEC_USE_COUNT;
--
- return 0;
- }
-
-@@ -1849,7 +1763,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);
-
-@@ -1879,7 +1793,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,
-@@ -1958,7 +1872,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);
-@@ -2571,7 +2485,7 @@
-
- nvfp->any_fired_notifiers++;
-
-- wake_up_interruptible(GET_EVENT_QUEUE(nvl));
-+ wake_up_interruptible(&nvl->waitqueue);
- }
-
- /*
-@@ -2588,7 +2502,7 @@
- if (nvl->waiting_for_vblank)
- nvl->vblank_notifier++;
-
-- wake_up_interruptible(GET_EVENT_QUEUE(nvl));
-+ wake_up_interruptible(&nvl->waitqueue);
- }
-
-
-@@ -2639,12 +2553,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-4349/os-agp.c NVIDIA_kernel-1.0-4349-2.5/os-agp.c
---- NVIDIA_kernel-1.0-4349/os-agp.c 2003-03-28 04:30:55.000000000 +0100
-+++ NVIDIA_kernel-1.0-4349-2.5/os-agp.c 2003-03-29 21:50:14.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);
-@@ -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-4349/os-interface.c NVIDIA_kernel-1.0-4349-2.5/os-interface.c
---- NVIDIA_kernel-1.0-4349/os-interface.c 2003-03-28 04:30:55.000000000 +0100
-+++ NVIDIA_kernel-1.0-4349-2.5/os-interface.c 2003-04-01 20:41:58.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))));
-+ mem_map_reserve(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))));
-+ mem_map_reserve(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;
-@@ -555,8 +560,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);
-
-
- //
-@@ -739,14 +744,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;
- }
-
-@@ -879,16 +884,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,
-@@ -909,16 +904,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(
-@@ -1019,7 +1005,7 @@
-
- U032 os_get_cpu_count()
- {
-- return smp_num_cpus;
-+ return NV_SMP_NUM_CPUS;
- }
-
-
-@@ -1082,12 +1068,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-4349/os-registry.c NVIDIA_kernel-1.0-4349-2.5/os-registry.c
---- NVIDIA_kernel-1.0-4349/os-registry.c 2003-03-28 04:30:55.000000000 +0100
-+++ NVIDIA_kernel-1.0-4349-2.5/os-registry.c 2003-03-29 18:50:56.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.4363/NVIDIA_kernel-1.0-4363-2.5-20030424.diff b/media-video/nvidia-kernel/files/1.0.4363/NVIDIA_kernel-1.0-4363-2.5-20030614.diff
index 5ae93503bfea..328fc4bcf52c 100644
--- a/media-video/nvidia-kernel/files/1.0.4363/NVIDIA_kernel-1.0-4363-2.5-20030424.diff
+++ b/media-video/nvidia-kernel/files/1.0.4363/NVIDIA_kernel-1.0-4363-2.5-20030614.diff
@@ -173,8 +173,8 @@ diff -ruN NVIDIA_kernel-1.0-4363/Makefile NVIDIA_kernel-1.0-4363-2.5/Makefile
--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-04-25 01:55:40.000000000 +0200
-@@ -0,0 +1,244 @@
++++ 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.
+#
@@ -197,7 +197,7 @@ diff -ruN NVIDIA_kernel-1.0-4363/Makefile.kbuild NVIDIA_kernel-1.0-4363-2.5/Make
+# Makefile to either one (or, preferably, both) of us:
+#
+# Alistair J Strachan (alistair@devzero.co.uk) (first pass, enhancements)
-+# Christian Zander (zander@minion.de) (enhancements)
++# Christian Zander (zander@mail.minion.de) (enhancements)
+#
+
+all: install
@@ -221,7 +221,15 @@ diff -ruN NVIDIA_kernel-1.0-4363/Makefile.kbuild NVIDIA_kernel-1.0-4363-2.5/Make
+
+$(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
@@ -240,11 +248,11 @@ diff -ruN NVIDIA_kernel-1.0-4363/Makefile.kbuild NVIDIA_kernel-1.0-4363-2.5/Make
+ifdef KERNDIR
+ KERNEL_SOURCES := $(KERNDIR)
+ KERNEL_HEADERS := -I$(KERNEL_SOURCES)/include
-+ MODULE_ROOT := /lib/modules/$(shell uname -r) # XXX
++ 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)
++ MODULE_ROOT := /lib/modules/$(shell uname -r)/kernel/drivers
+endif
+
+#
@@ -256,7 +264,13 @@ diff -ruN NVIDIA_kernel-1.0-4363/Makefile.kbuild NVIDIA_kernel-1.0-4363-2.5/Make
+src ?= .
+obj ?= .
+
-+PATCHLEVEL ?= $(shell sh $(src)/conftest.sh kernel_patch_level $(KERNEL_SOURCES))
++#
++# 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
@@ -421,7 +435,7 @@ diff -ruN NVIDIA_kernel-1.0-4363/Makefile.kbuild NVIDIA_kernel-1.0-4363-2.5/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-04-25 01:55:40.000000000 +0200
++++ 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
@@ -512,7 +526,7 @@ diff -ruN NVIDIA_kernel-1.0-4363/Makefile.nvidia NVIDIA_kernel-1.0-4363-2.5/Make
+ fi
+
+rmmod-sanity-check:
-+ @if ! sh conftest.sh rmmod_sanity_check $(MODULE_NAME); then \
++ @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 "; \
@@ -579,7 +593,7 @@ diff -ruN NVIDIA_kernel-1.0-4363/Makefile.nvidia NVIDIA_kernel-1.0-4363-2.5/Make
+-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-04-25 01:56:26.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
@@ -661,7 +675,7 @@ diff -ruN NVIDIA_kernel-1.0-4363/conftest.sh NVIDIA_kernel-1.0-4363-2.5/conftest
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-04-25 01:55:30.000000000 +0200
++++ NVIDIA_kernel-1.0-4363-2.5/nv-linux.h 2003-06-13 23:29:10.000000000 +0200
@@ -20,35 +20,20 @@
# define MODVERSIONS
#endif
@@ -719,7 +733,7 @@ diff -ruN NVIDIA_kernel-1.0-4363/nv-linux.h NVIDIA_kernel-1.0-4363-2.5/nv-linux.
#include <linux/slab.h> /* kmalloc, kfree, etc */
#include <linux/vmalloc.h> /* vmalloc, vfree, etc */
-@@ -74,9 +62,16 @@
+@@ -74,9 +62,15 @@
#include <linux/poll.h> /* poll_wait */
#include <linux/delay.h> /* mdelay, udelay */
@@ -731,13 +745,13 @@ diff -ruN NVIDIA_kernel-1.0-4363/nv-linux.h NVIDIA_kernel-1.0-4363-2.5/nv-linux.
+#endif
+
#include <linux/pci.h> /* pci_find_class, etc */
- #include <linux/wrapper.h> /* mem_map_reserve */
+-#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 +80,9 @@
+@@ -85,14 +79,9 @@
#include <asm/page.h> /* PAGE_OFFSET */
#include <asm/pgtable.h> /* pte bit definitions */
@@ -752,24 +766,13 @@ diff -ruN NVIDIA_kernel-1.0-4363/nv-linux.h NVIDIA_kernel-1.0-4363-2.5/nv-linux.
#ifdef CONFIG_PROC_FS
#include <linux/proc_fs.h>
-@@ -132,31 +122,33 @@
+@@ -132,40 +121,90 @@
for (pos = (head)->next; pos != (head); pos = (pos)->next)
#endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 2, 18)
-#define vmalloc_32 vmalloc
-#endif
--
--#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)
+#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)
@@ -786,17 +789,7 @@ diff -ruN NVIDIA_kernel-1.0-4363/nv-linux.h NVIDIA_kernel-1.0-4363-2.5/nv-linux.
+# 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 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))
++#else
+# define NV_DEVICE_NUMBER(_minor) ((_minor) & 0x0f)
+# define NV_IS_CONTROL_DEVICE(_minor) (((_minor) & 0xff) == 0xff)
+# define NV_IS_SUSER() suser()
@@ -807,10 +800,89 @@ diff -ruN NVIDIA_kernel-1.0-4363/nv-linux.h NVIDIA_kernel-1.0-4363-2.5/nv-linux.
+# 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)
-@@ -189,14 +181,6 @@
+ #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)
+ #else
+-#error "Couldn't determine number of arguments expected by remap_page_range!"
++#warning "conftest.sh failed, assuming 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) \
+@@ -189,14 +228,6 @@
#define NV_PAGE_ALIGN(addr) ( ((addr) + PAGE_SIZE - 1) / PAGE_SIZE)
#define NV_MASK_OFFSET(addr) ( (addr) & (PAGE_SIZE - 1) )
@@ -825,7 +897,7 @@ diff -ruN NVIDIA_kernel-1.0-4363/nv-linux.h NVIDIA_kernel-1.0-4363-2.5/nv-linux.
#if defined(NVCPU_IA64)
#define NV_GFP_HW (GFP_KERNEL | __GFP_DMA)
#define CACHE_FLUSH()
-@@ -252,7 +236,7 @@
+@@ -252,7 +283,7 @@
static inline int NV_IRQL_IS_RAISED()
{
unsigned long int eflags;
@@ -834,7 +906,7 @@ diff -ruN NVIDIA_kernel-1.0-4363/nv-linux.h NVIDIA_kernel-1.0-4363-2.5/nv-linux.
return !(eflags & NV_CPU_INTERRUPT_FLAGS_BIT);
}
-@@ -310,16 +294,17 @@
+@@ -310,16 +341,17 @@
nv_alloc_t *alloc_queue;
@@ -858,8 +930,8 @@ diff -ruN NVIDIA_kernel-1.0-4363/nv-linux.h NVIDIA_kernel-1.0-4363-2.5/nv-linux.
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-04-25 01:51:16.000000000 +0200
-@@ -16,6 +16,8 @@
++++ NVIDIA_kernel-1.0-4363-2.5/nv.c 2003-06-02 00:10:13.000000000 +0200
+@@ -16,11 +16,14 @@
#include "os-agp.h"
@@ -868,7 +940,13 @@ diff -ruN NVIDIA_kernel-1.0-4363/nv.c NVIDIA_kernel-1.0-4363-2.5/nv.c
/*
* our global state; one per device
*/
-@@ -36,7 +38,6 @@
+
+ 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];
@@ -876,8 +954,12 @@ diff -ruN NVIDIA_kernel-1.0-4363/nv.c NVIDIA_kernel-1.0-4363-2.5/nv.c
#ifdef CONFIG_PROC_FS
struct proc_dir_entry *proc_nvidia;
-@@ -47,16 +48,6 @@
- devfs_handle_t nv_ctl_handle;
+ #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
-/*
@@ -904,6 +986,15 @@ diff -ruN NVIDIA_kernel-1.0-4363/nv.c NVIDIA_kernel-1.0-4363-2.5/nv.c
/* 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 */
@@ -928,7 +1019,7 @@ diff -ruN NVIDIA_kernel-1.0-4363/nv.c NVIDIA_kernel-1.0-4363-2.5/nv.c
/* lock the page for dma purposes */
- mem_map_reserve(GET_MAP_NR(phys_addr));
-+ mem_map_reserve(virt_to_page(__va(phys_addr)));
++ SetPageReserved(virt_to_page(__va(phys_addr)));
*page_ptr++ = phys_addr;
pages_needed--;
@@ -937,7 +1028,7 @@ diff -ruN NVIDIA_kernel-1.0-4363/nv.c NVIDIA_kernel-1.0-4363-2.5/nv.c
{
page_ptr--;
- mem_map_unreserve(GET_MAP_NR(*page_ptr));
-+ mem_map_unreserve(virt_to_page(__va(*page_ptr)));
++ ClearPageReserved(virt_to_page(__va(*page_ptr)));
free_page((unsigned long) phys_to_virt(*page_ptr));
}
@@ -946,7 +1037,7 @@ diff -ruN NVIDIA_kernel-1.0-4363/nv.c NVIDIA_kernel-1.0-4363-2.5/nv.c
while (pages_left)
{
- mem_map_unreserve(GET_MAP_NR(*page_list));
-+ mem_map_unreserve(virt_to_page(__va(*page_list)));
++ ClearPageReserved(virt_to_page(__va(*page_list)));
page_list++;
pages_left--;
}
@@ -972,7 +1063,7 @@ diff -ruN NVIDIA_kernel-1.0-4363/nv.c NVIDIA_kernel-1.0-4363-2.5/nv.c
#endif
}
-@@ -726,11 +706,10 @@
+@@ -726,71 +706,75 @@
*** EXPORTS to Linux Kernel
***/
@@ -980,13 +1071,19 @@ diff -ruN NVIDIA_kernel-1.0-4363/nv.c NVIDIA_kernel-1.0-4363-2.5/nv.c
+static int __init nvidia_init_module(void)
{
- nv_linux_state_t *nvl;
- int rc;
+- int rc;
- int num_devices;
-+ int num_devices, i;
++ int i, rc;
memset(nv_linux_devices, 0, sizeof(nv_linux_devices));
- num_devices = nvos_probe_devices();
-@@ -742,14 +721,14 @@
+- 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);
@@ -1003,15 +1100,34 @@ diff -ruN NVIDIA_kernel-1.0-4363/nv.c NVIDIA_kernel-1.0-4363-2.5/nv.c
return rc;
}
-@@ -757,7 +736,6 @@
- memset(nv_dev_handle, 0, sizeof(devfs_handle_t) * NV_MAX_DEVICES);
+ #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,
-@@ -774,23 +752,30 @@
+- 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
@@ -1051,7 +1167,7 @@ diff -ruN NVIDIA_kernel-1.0-4363/nv.c NVIDIA_kernel-1.0-4363-2.5/nv.c
}
#ifdef CONFIG_PM
-@@ -815,14 +800,14 @@
+@@ -815,14 +799,14 @@
/* create /proc/driver/nvidia */
nvos_proc_create();
@@ -1068,16 +1184,18 @@ diff -ruN NVIDIA_kernel-1.0-4363/nv.c NVIDIA_kernel-1.0-4363-2.5/nv.c
devfs_unregister_chrdev(nv_major, "nvidia");
#else
unregister_chrdev(nv_major, "nvidia");
-@@ -830,7 +815,7 @@
+@@ -830,18 +814,18 @@
return rc;
}
-void cleanup_module(void)
+static void __exit nvidia_exit_module(void)
{
- int rc;
+- int rc;
nv_linux_state_t *nvl;
-@@ -839,9 +824,9 @@
+ nv_linux_state_t *max_devices;
++ int rc;
+
/* remove /proc/driver/nvidia */
nvos_proc_remove();
@@ -1089,7 +1207,7 @@ diff -ruN NVIDIA_kernel-1.0-4363/nv.c NVIDIA_kernel-1.0-4363-2.5/nv.c
inter_module_unregister("nv_linux_devices");
#endif
-@@ -866,20 +851,20 @@
+@@ -866,33 +850,34 @@
continue;
nv_printf(NV_DBG_ERRORS,
@@ -1113,7 +1231,17 @@ diff -ruN NVIDIA_kernel-1.0-4363/nv.c NVIDIA_kernel-1.0-4363-2.5/nv.c
}
#ifdef CONFIG_DEVFS_FS
-@@ -893,6 +878,8 @@
+ 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
}
@@ -1122,7 +1250,7 @@ diff -ruN NVIDIA_kernel-1.0-4363/nv.c NVIDIA_kernel-1.0-4363-2.5/nv.c
/* this is only called when the vmas are duplicated.
* this appears to only happen when the process is cloned to create
-@@ -906,11 +893,11 @@
+@@ -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",
@@ -1137,7 +1265,7 @@ diff -ruN NVIDIA_kernel-1.0-4363/nv.c NVIDIA_kernel-1.0-4363-2.5/nv.c
at->usage_count++;
nv_printf(NV_DBG_MEMINFO, " at 0x%x, usage count %d, page_table 0x%x\n",
-@@ -918,8 +905,6 @@
+@@ -918,8 +903,6 @@
nvos_list_page_count(at->page_table, at->num_pages);
}
@@ -1146,7 +1274,7 @@ diff -ruN NVIDIA_kernel-1.0-4363/nv.c NVIDIA_kernel-1.0-4363-2.5/nv.c
}
-@@ -927,11 +912,11 @@
+@@ -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",
@@ -1161,7 +1289,7 @@ diff -ruN NVIDIA_kernel-1.0-4363/nv.c NVIDIA_kernel-1.0-4363-2.5/nv.c
at->usage_count--;
-@@ -949,22 +934,12 @@
+@@ -949,22 +932,12 @@
if (at->page_table)
nvos_unlock_pages(at->page_table, at->num_pages);
nvos_free_alloc(at);
@@ -1185,7 +1313,7 @@ diff -ruN NVIDIA_kernel-1.0-4363/nv.c NVIDIA_kernel-1.0-4363-2.5/nv.c
/* 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 +952,7 @@
+@@ -977,7 +950,7 @@
struct page *page_ptr;
int rm_status, index;
@@ -1194,7 +1322,7 @@ diff -ruN NVIDIA_kernel-1.0-4363/nv.c NVIDIA_kernel-1.0-4363-2.5/nv.c
if (at == NULL)
{
nv_printf(NV_DBG_ERRORS, "NVRM: nopage handler called without an at: "
-@@ -1016,7 +991,7 @@
+@@ -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);
@@ -1203,7 +1331,7 @@ diff -ruN NVIDIA_kernel-1.0-4363/nv.c NVIDIA_kernel-1.0-4363-2.5/nv.c
return NOPAGE_SIGBUS;
}
-@@ -1038,14 +1013,11 @@
+@@ -1038,14 +1011,11 @@
return page_ptr;
}
@@ -1218,7 +1346,7 @@ diff -ruN NVIDIA_kernel-1.0-4363/nv.c NVIDIA_kernel-1.0-4363-2.5/nv.c
};
-@@ -1076,7 +1048,7 @@
+@@ -1076,7 +1046,7 @@
/* for control device, just jump to its open routine */
/* after setting up the private data */
@@ -1227,7 +1355,7 @@ diff -ruN NVIDIA_kernel-1.0-4363/nv.c NVIDIA_kernel-1.0-4363-2.5/nv.c
return nv_kern_ctl_open(inode, file);
/* what device are we talking about? */
-@@ -1087,9 +1059,6 @@
+@@ -1087,9 +1057,6 @@
goto failed;
}
@@ -1237,7 +1365,7 @@ diff -ruN NVIDIA_kernel-1.0-4363/nv.c NVIDIA_kernel-1.0-4363-2.5/nv.c
nvl = &nv_linux_devices[devnum];
nv = NV_STATE_PTR(nvl);
-@@ -1137,16 +1106,9 @@
+@@ -1137,16 +1104,9 @@
goto failed;
}
@@ -1257,7 +1385,7 @@ diff -ruN NVIDIA_kernel-1.0-4363/nv.c NVIDIA_kernel-1.0-4363-2.5/nv.c
nv->flags |= NV_FLAG_OPEN;
}
-@@ -1157,7 +1119,6 @@
+@@ -1157,7 +1117,6 @@
return rc;
failed:
@@ -1265,7 +1393,7 @@ diff -ruN NVIDIA_kernel-1.0-4363/nv.c NVIDIA_kernel-1.0-4363-2.5/nv.c
nv_unlock_ldata(nv);
return rc;
}
-@@ -1179,7 +1140,7 @@
+@@ -1179,7 +1138,7 @@
/* for control device, just jump to its open routine */
/* after setting up the private data */
@@ -1274,7 +1402,7 @@ diff -ruN NVIDIA_kernel-1.0-4363/nv.c NVIDIA_kernel-1.0-4363-2.5/nv.c
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 +1150,22 @@
+@@ -1189,28 +1148,22 @@
nv_lock_ldata(nv);
if (--nv->usage_count == 0)
{
@@ -1316,7 +1444,7 @@ diff -ruN NVIDIA_kernel-1.0-4363/nv.c NVIDIA_kernel-1.0-4363-2.5/nv.c
free_irq(nv->interrupt_line, (void *) nv);
rm_shutdown_adapter(nv);
-@@ -1230,12 +1185,6 @@
+@@ -1230,12 +1183,6 @@
}
}
@@ -1329,7 +1457,7 @@ diff -ruN NVIDIA_kernel-1.0-4363/nv.c NVIDIA_kernel-1.0-4363-2.5/nv.c
/* leave INIT flag alone so we don't reinit every time */
nv->flags &= ~(NV_FLAG_OPEN | NV_FLAG_WAITING);
}
-@@ -1246,8 +1195,6 @@
+@@ -1246,8 +1193,6 @@
NV_KFREE(file->private_data);
file->private_data = (void *) 0;
@@ -1338,7 +1466,7 @@ diff -ruN NVIDIA_kernel-1.0-4363/nv.c NVIDIA_kernel-1.0-4363-2.5/nv.c
return 0;
}
-@@ -1264,10 +1211,10 @@
+@@ -1264,10 +1209,10 @@
nv_printf(NV_DBG_INFO, "mmap([0x%lx-0x%lx] off=0x%lx)\n",
vma->vm_start,
vma->vm_end,
@@ -1351,7 +1479,7 @@ diff -ruN NVIDIA_kernel-1.0-4363/nv.c NVIDIA_kernel-1.0-4363-2.5/nv.c
(NV_MASK_OFFSET(vma->vm_start)) ||
(NV_MASK_OFFSET(vma->vm_end)))
{
-@@ -1285,7 +1232,7 @@
+@@ -1285,7 +1230,7 @@
/* NV reg space */
@@ -1360,7 +1488,7 @@ diff -ruN NVIDIA_kernel-1.0-4363/nv.c NVIDIA_kernel-1.0-4363-2.5/nv.c
{
/* truncate to size of registers */
if (pages > nv->regs->size / PAGE_SIZE)
-@@ -1293,7 +1240,7 @@
+@@ -1293,7 +1238,7 @@
vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
if (NV_REMAP_PAGE_RANGE(vma->vm_start,
@@ -1369,7 +1497,7 @@ diff -ruN NVIDIA_kernel-1.0-4363/nv.c NVIDIA_kernel-1.0-4363-2.5/nv.c
vma->vm_end - vma->vm_start,
vma->vm_page_prot))
return -EAGAIN;
-@@ -1303,7 +1250,7 @@
+@@ -1303,7 +1248,7 @@
}
/* NV fb space */
@@ -1378,7 +1506,7 @@ diff -ruN NVIDIA_kernel-1.0-4363/nv.c NVIDIA_kernel-1.0-4363-2.5/nv.c
{
/* truncate to size of framebuffer */
-@@ -1312,7 +1259,7 @@
+@@ -1312,7 +1257,7 @@
vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
if (NV_REMAP_PAGE_RANGE(vma->vm_start,
@@ -1387,7 +1515,7 @@ diff -ruN NVIDIA_kernel-1.0-4363/nv.c NVIDIA_kernel-1.0-4363-2.5/nv.c
vma->vm_end - vma->vm_start,
vma->vm_page_prot))
return -EAGAIN;
-@@ -1322,10 +1269,10 @@
+@@ -1322,10 +1267,10 @@
}
/* AGP allocator */
@@ -1400,7 +1528,7 @@ diff -ruN NVIDIA_kernel-1.0-4363/nv.c NVIDIA_kernel-1.0-4363-2.5/nv.c
if (at == NULL)
{
-@@ -1343,7 +1290,7 @@
+@@ -1343,7 +1288,7 @@
}
at->vma = vma;
@@ -1409,7 +1537,7 @@ diff -ruN NVIDIA_kernel-1.0-4363/nv.c NVIDIA_kernel-1.0-4363-2.5/nv.c
at->usage_count++;
if (NV_OSAGP_ENABLED(nv))
-@@ -1366,13 +1313,13 @@
+@@ -1366,13 +1311,13 @@
}
/* Magic allocator */
@@ -1425,7 +1553,7 @@ diff -ruN NVIDIA_kernel-1.0-4363/nv.c NVIDIA_kernel-1.0-4363-2.5/nv.c
if (at == NULL)
{
-@@ -1390,7 +1337,7 @@
+@@ -1390,7 +1335,7 @@
}
at->vma = vma;
@@ -1434,7 +1562,7 @@ diff -ruN NVIDIA_kernel-1.0-4363/nv.c NVIDIA_kernel-1.0-4363-2.5/nv.c
at->usage_count++;
nv_printf(NV_DBG_INFO, "remapping %d system pages for at 0x%x\n", pages, at);
-@@ -1412,9 +1359,6 @@
+@@ -1412,9 +1357,6 @@
vma->vm_file = file;
@@ -1444,7 +1572,7 @@ diff -ruN NVIDIA_kernel-1.0-4363/nv.c NVIDIA_kernel-1.0-4363-2.5/nv.c
return 0;
}
-@@ -1439,7 +1383,7 @@
+@@ -1439,7 +1381,7 @@
return nv_kern_ctl_poll (file, wait);
// add us to the list
@@ -1453,7 +1581,7 @@ diff -ruN NVIDIA_kernel-1.0-4363/nv.c NVIDIA_kernel-1.0-4363-2.5/nv.c
nv_lock_ldata(nv);
-@@ -1519,12 +1463,13 @@
+@@ -1519,12 +1461,13 @@
switch (_IOC_NR(cmd))
{
@@ -1468,7 +1596,16 @@ diff -ruN NVIDIA_kernel-1.0-4363/nv.c NVIDIA_kernel-1.0-4363-2.5/nv.c
/* pass out info about the card */
case _IOC_NR(NV_IOCTL_CARD_INFO):
{
-@@ -1665,8 +1610,7 @@
+@@ -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);
@@ -1476,8 +1613,11 @@ diff -ruN NVIDIA_kernel-1.0-4363/nv.c NVIDIA_kernel-1.0-4363-2.5/nv.c
- 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);
@@ -1590,7 +1730,7 @@ diff -ruN NVIDIA_kernel-1.0-4363/nv.c NVIDIA_kernel-1.0-4363-2.5/nv.c
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-04-25 01:51:16.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;
@@ -1933,7 +2073,7 @@ diff -ruN NVIDIA_kernel-1.0-4363/os-agp.c NVIDIA_kernel-1.0-4363-2.5/os-agp.c
(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-04-25 01:51:16.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
)
@@ -1960,7 +2100,7 @@ diff -ruN NVIDIA_kernel-1.0-4363/os-interface.c NVIDIA_kernel-1.0-4363-2.5/os-in
for (i = 0; i < count; i++) {
- mem_map_reserve(GET_MAP_NR(__pa((va))));
-+ mem_map_reserve(virt_to_page(va));
++ SetPageReserved(virt_to_page(va));
va += PAGE_SIZE;
}
@@ -1969,7 +2109,7 @@ diff -ruN NVIDIA_kernel-1.0-4363/os-interface.c NVIDIA_kernel-1.0-4363-2.5/os-in
for (i = 0; i < count; i++) {
- mem_map_unreserve(GET_MAP_NR(__pa((va))));
-+ mem_map_unreserve(virt_to_page(va));
++ ClearPageReserved(virt_to_page(va));
va += PAGE_SIZE;
}
@@ -2074,7 +2214,7 @@ diff -ruN NVIDIA_kernel-1.0-4363/os-interface.c NVIDIA_kernel-1.0-4363-2.5/os-in
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-04-25 01:51:16.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.
*/
diff --git a/media-video/nvidia-kernel/files/1.0.4363/NVIDIA_kernel-1.0-4363-2.5.68.diff b/media-video/nvidia-kernel/files/1.0.4363/NVIDIA_kernel-1.0-4363-2.5.68.diff
deleted file mode 100644
index e515f5d8d55f..000000000000
--- a/media-video/nvidia-kernel/files/1.0.4363/NVIDIA_kernel-1.0-4363-2.5.68.diff
+++ /dev/null
@@ -1,43 +0,0 @@
-diff -urpN NVIDIA_kernel-1.0-4349/nv.c NVIDIA_kernel-1.0-4349-2.5.68/nv.c
---- NVIDIA_kernel-1.0-4349/nv.c 2003-04-22 22:12:56.000000000 +0200
-+++ NVIDIA_kernel-1.0-4349-2.5.68/nv.c 2003-04-22 22:11:25.000000000 +0200
-@@ -108,7 +108,7 @@ int nv_kern_mmap(struct file *
- 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);
-@@ -869,10 +869,10 @@ static void __exit nvidia_exit_module(vo
- do {
- int i;
- for (i = 0; nv_dev_handle[i] != 0; i++) {
-- devfs_unregister(nv_dev_handle[i]);
-+ devfs_remove("nvidia%d", i);
- }
- } while(0);
-- devfs_unregister(nv_ctl_handle);
-+ devfs_remove("nvidiactl");
- #endif
- }
-
-@@ -1594,7 +1594,7 @@ int nv_kern_ioctl(
- * 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
-@@ -1610,6 +1610,8 @@ void nv_kern_isr(
- NV_ATOMIC_INC(nvl->bh_count);
- tasklet_schedule(&nvl->tasklet);
- }
-+
-+ return IRQ_HANDLED;
- }
-
- void nv_kern_bh(
diff --git a/media-video/nvidia-kernel/files/1.0.4363/NVIDIA_kernel-1.0-4363-2.5.69-agp.diff b/media-video/nvidia-kernel/files/1.0.4363/NVIDIA_kernel-1.0-4363-2.5.69-agp.diff
deleted file mode 100644
index 5a2aa0dbe9e8..000000000000
--- a/media-video/nvidia-kernel/files/1.0.4363/NVIDIA_kernel-1.0-4363-2.5.69-agp.diff
+++ /dev/null
@@ -1,48 +0,0 @@
-diff -urN NVIDIA_kernel-1.0-4363.orig/os-agp.c NVIDIA_kernel-1.0-4363/os-agp.c
---- NVIDIA_kernel-1.0-4363.orig/os-agp.c 2003-05-26 20:03:59.000000000 +0200
-+++ NVIDIA_kernel-1.0-4363/os-agp.c 2003-05-26 20:03:25.000000000 +0200
-@@ -28,7 +28,7 @@
- #ifdef AGPGART
-
- typedef struct {
-- agp_memory *ptr;
-+ struct agp_memory *ptr;
- int num_pages;
- int offset;
- #if defined(NVCPU_IA64)
-@@ -45,7 +45,7 @@
- int ready;
- } agp_gart;
-
--agp_kern_info agpinfo;
-+struct agp_kern_info agpinfo;
- agp_gart gart;
- const drm_agp_t *drm_agp_p;
-
-@@ -260,7 +260,7 @@
- *pAddress = (void*) 0;
- return RM_ERROR;
- #else
-- agp_memory *ptr;
-+ struct agp_memory *ptr;
- int err;
- agp_priv_data *data;
- RM_STATUS status;
-@@ -388,7 +388,7 @@
- #else
- struct vm_area_struct *vma = (struct vm_area_struct *) pvma;
- agp_priv_data *agp_data = (agp_priv_data *) priv_data;
-- agp_memory *agp_memory_ptr = agp_data->ptr;
-+ struct agp_memory *agp_memory_ptr = agp_data->ptr;
- struct page *page_ptr;
- unsigned long phys_addr;
- int idx;
-@@ -431,7 +431,7 @@
- #ifndef AGPGART
- return RM_OK;
- #else
-- agp_memory *ptr;
-+ struct agp_memory *ptr;
- agp_priv_data *data = priv_data;
-
- #if defined(NVCPU_IA64) && (LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 9))
diff --git a/media-video/nvidia-kernel/files/1.0.4363/NVIDIA_kernel-1.0-4363-2.5.69.diff b/media-video/nvidia-kernel/files/1.0.4363/NVIDIA_kernel-1.0-4363-2.5.69.diff
deleted file mode 100644
index 745e0af936b2..000000000000
--- a/media-video/nvidia-kernel/files/1.0.4363/NVIDIA_kernel-1.0-4363-2.5.69.diff
+++ /dev/null
@@ -1,49 +0,0 @@
---- NVIDIA_kernel-1.0-4363/nv.c.orig 2003-05-13 22:26:24.000000000 +0200
-+++ NVIDIA_kernel-1.0-4363/nv.c 2003-05-13 22:27:39.000000000 +0200
-@@ -44,8 +44,8 @@
- #endif
-
- #ifdef CONFIG_DEVFS_FS
--devfs_handle_t nv_dev_handle[NV_MAX_DEVICES];
--devfs_handle_t nv_ctl_handle;
-+int nv_dev_handle[NV_MAX_DEVICES];
-+int nv_ctl_handle;
- #endif
-
- // #define NV_DBG_MEM 1
-@@ -733,21 +733,16 @@
- }
-
- #ifdef CONFIG_DEVFS_FS
-- memset(nv_dev_handle, 0, sizeof(devfs_handle_t) * NV_MAX_DEVICES);
-+ /* devfs_mk_cdev return 0 on success */
-+ memset(nv_dev_handle, 1, sizeof(nv_dev_handle) * NV_MAX_DEVICES);
- do {
- 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_ctl_handle = devfs_mk_cdev(MKDEV(nv_major, 255), S_IFCHR|S_IRUGO|S_IWUGO, "nvidiactl");
-
- for (i = 0; i < 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_dev_handle[i] = devfs_mk_cdev(MKDEV(nv_major, i), S_IFCHR|S_IRUGO|S_IWUGO, name);
- }
- } while(0);
- #endif
-@@ -870,7 +865,8 @@
- #ifdef CONFIG_DEVFS_FS
- do {
- int i;
-- for (i = 0; nv_dev_handle[i] != 0; i++) {
-+ /* devfs_mk_cdev return 0 on success */
-+ for (i = 0; nv_dev_handle[i] == 0; i++) {
- devfs_remove("nvidia%d", i);
- }
- } while(0);
diff --git a/media-video/nvidia-kernel/files/NVIDIA_kernel-1.0-4349-2.5.diff b/media-video/nvidia-kernel/files/NVIDIA_kernel-1.0-4349-2.5.diff
deleted file mode 100644
index 2b51c13efa22..000000000000
--- a/media-video/nvidia-kernel/files/NVIDIA_kernel-1.0-4349-2.5.diff
+++ /dev/null
@@ -1,2217 +0,0 @@
-diff -ruN NVIDIA_kernel-1.0-4349/Makefile NVIDIA_kernel-1.0-4349-2.5/Makefile
---- NVIDIA_kernel-1.0-4349/Makefile 2003-03-28 04:30:56.000000000 +0100
-+++ NVIDIA_kernel-1.0-4349-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 Thu Mar 27 19:00:03 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=4349 -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-4349/Makefile.kbuild NVIDIA_kernel-1.0-4349-2.5/Makefile.kbuild
---- NVIDIA_kernel-1.0-4349/Makefile.kbuild 1970-01-01 01:00:00.000000000 +0100
-+++ NVIDIA_kernel-1.0-4349-2.5/Makefile.kbuild 2003-03-30 21:45:21.000000000 +0200
-@@ -0,0 +1,229 @@
-+#
-+# 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@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)
-+
-+obj-m += $(MODULE_NAME).o
-+
-+#
-+# We rely on these two definitions below; make sure they are set correctly
-+# when using Linux 2.4 KBUILD.
-+#
-+
-+ifndef PATCHLEVEL
-+ src := .
-+ obj := .
-+else
-+ ifeq ($(PATCHLEVEL), 4)
-+ src := .
-+ obj := .
-+ endif
-+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)
-+ INCLUDES := -I$(KERNEL_SOURCES)/include
-+else
-+ KERNEL_SOURCES := /lib/modules/$(shell uname -r)/build
-+ INCLUDES := -I$(KERNEL_SOURCES)/include
-+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 $(INCLUDES)), 5)
-+ EXTRA_CFLAGS += -DREMAP_PAGE_RANGE_5
-+endif
-+
-+ifeq ($(shell sh $(src)/conftest.sh remap_page_range $(INCLUDES)), 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 -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.
-+#
-+
-+build: cc-sanity-check
-+ @make $(KBUILD_PARAMS) modules; \
-+ if ! [ -f $(MODULE_NAME).ko -o -f $(MODULE_NAME).o ]; then \
-+ echo "$(MODULE_NAKE).{o,ko} failed to build!"; \
-+ exit 1; \
-+ fi
-+
-+#
-+# Install the NVIDIA kernel module using Linux KBUILD. Verify that user has
-+# sufficient privileges and that existing modules can be unloaded.
-+#
-+
-+package-install: suser-sanity-check build rmmod-sanity-check
-+ @sh makedevices.sh; \
-+ make $(KBUILD_PARAMS) modules_install; \
-+ /sbin/depmod -ae; \
-+ /sbin/modprobe $(MODULE_NAME) && \
-+ echo "$(MODULE_NAME).{o,ko} 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) *~
-+
-+#
-+# Lastly, even more quirks for Linux 2.4 KBUILD.
-+#
-+
-+fastdep:
-+
-+ifeq ($(PATCHLEVEL), 4)
-+include $(KERNEL_SOURCES)/Rules.make
-+endif
-+
-diff -ruN NVIDIA_kernel-1.0-4349/Makefile.nvidia NVIDIA_kernel-1.0-4349-2.5/Makefile.nvidia
---- NVIDIA_kernel-1.0-4349/Makefile.nvidia 1970-01-01 01:00:00.000000000 +0100
-+++ NVIDIA_kernel-1.0-4349-2.5/Makefile.nvidia 2003-03-30 21:43:11.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 $(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
-+
-+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 -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-4349/conftest.sh NVIDIA_kernel-1.0-4349-2.5/conftest.sh
---- NVIDIA_kernel-1.0-4349/conftest.sh 2003-03-28 04:30:56.000000000 +0100
-+++ NVIDIA_kernel-1.0-4349-2.5/conftest.sh 2003-03-30 21:40:14.000000000 +0200
-@@ -21,17 +21,82 @@
- }" > conftest.c
-
- RPR_TEST_4=$(gcc -c conftest.c -o /dev/null $* -D__KERNEL__ 2>&1)
-+ rm conftest.c
-
- if test -z "$RPR_TEST_4"; then
- echo "4"
- elif test -z "$RPR_TEST_5"; then
- echo "5"
- else
-- echo " "
-- echo "Warning! conftest.sh was unable to determine the number of "
-- echo "arguments expected by remap_page_range: assuming 4. "
-- echo " "
-- echo "4"
-+ #
-+ # We couldn't determine the number of arguments expected by the
-+ # remap_page_range function.
-+ #
-+ 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 -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
-+ ;;
-+
-+ 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-4349/nv-linux.h NVIDIA_kernel-1.0-4349-2.5/nv-linux.h
---- NVIDIA_kernel-1.0-4349/nv-linux.h 2003-03-28 04:30:56.000000000 +0100
-+++ NVIDIA_kernel-1.0-4349-2.5/nv-linux.h 2003-03-29 21:27:01.000000000 +0100
-@@ -20,35 +20,20 @@
- # 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
- #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 +46,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 +62,16 @@
- #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 +80,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,37 +122,41 @@
- for (pos = (head)->next; pos != (head); pos = (pos)->next)
- #endif
-
--#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 2, 18)
--#define vmalloc_32 vmalloc
--#endif
--
--#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)
-+#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 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_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
-
- #if defined(REMAP_PAGE_RANGE_5)
- #define NV_REMAP_PAGE_RANGE(a, b...) remap_page_range(vma, a, ## b)
--#else
-+#elif defined(REMAP_PAGE_RANGE_4)
- #define NV_REMAP_PAGE_RANGE(a, b...) remap_page_range(a, ## b)
-+#else
-+#error "Unable to determine number of arguments expected by remap_page_range!"
- #endif
-
- #if defined(pte_offset_atomic)
-@@ -187,14 +181,6 @@
- #define NV_PAGE_ALIGN(addr) ( ((addr) + PAGE_SIZE - 1) / PAGE_SIZE)
- #define NV_MASK_OFFSET(addr) ( (addr) & (PAGE_SIZE - 1) )
-
--#ifndef MAXMEM /* temporary define for 2.2 kernels */
--#define MAXMEM (-PAGE_OFFSET - (64 * 1024 * 1024))
--#endif
--
--#ifndef NV01_ROOT
--#define NV01_ROOT 0x00000000
--#endif
--
- #if defined(NVCPU_IA64)
- #define NV_GFP_HW (GFP_KERNEL | __GFP_DMA)
- #define CACHE_FLUSH()
-@@ -250,7 +236,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);
- }
-
-@@ -308,16 +294,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-4349/nv.c NVIDIA_kernel-1.0-4349-2.5/nv.c
---- NVIDIA_kernel-1.0-4349/nv.c 2003-03-28 04:30:55.000000000 +0100
-+++ NVIDIA_kernel-1.0-4349-2.5/nv.c 2003-03-29 21:56:03.000000000 +0100
-@@ -16,6 +16,8 @@
- #include "os-agp.h"
-
-
-+MODULE_LICENSE("NVIDIA");
-+
- /*
- * our global state; one per device
- */
-@@ -36,27 +38,20 @@
- // 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
-+#if defined(CONFIG_DEVFS_FS) && !defined(KERNEL_2_5)
-+/*
-+ * We don't need to manually keep track of devfs entries in Linux 2.5, the
-+ * kernel is nice enough to do it for us.
-+ */
- devfs_handle_t nv_dev_handle[NV_MAX_DEVICES];
- devfs_handle_t nv_ctl_handle;
- #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 +102,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);
-@@ -144,6 +135,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 +290,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 +362,7 @@
- phys_addr = virt_to_phys((void *) virt_addr);
-
- /* lock the page for dma purposes */
-- mem_map_reserve(GET_MAP_NR(phys_addr));
-+ mem_map_reserve(virt_to_page(__va(phys_addr)));
-
- *page_ptr++ = phys_addr;
- pages_needed--;
-@@ -383,7 +375,7 @@
- while (page_ptr != (unsigned long *) page_list)
- {
- page_ptr--;
-- mem_map_unreserve(GET_MAP_NR(*page_ptr));
-+ mem_map_unreserve(virt_to_page(__va(*page_ptr)));
- free_page((unsigned long) phys_to_virt(*page_ptr));
- }
-
-@@ -403,7 +395,7 @@
-
- while (pages_left)
- {
-- mem_map_unreserve(GET_MAP_NR(*page_list));
-+ mem_map_unreserve(virt_to_page(__va(*page_list)));
- page_list++;
- pages_left--;
- }
-@@ -569,11 +561,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);
-@@ -633,9 +620,6 @@
- {
- #ifdef CONFIG_PROC_FS
- nvos_proc_remove_all(proc_nvidia);
--#if defined (KERNEL_2_2)
-- remove_proc_entry("driver", &proc_root);
--#endif
- #endif
- }
-
-@@ -724,11 +708,10 @@
- *** 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 num_devices, i;
-
- memset(nv_linux_devices, 0, sizeof(nv_linux_devices));
- num_devices = nvos_probe_devices();
-@@ -740,22 +723,21 @@
-
- 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
-+#if defined(CONFIG_DEVFS_FS) && !defined(KERNEL_2_5)
- memset(nv_dev_handle, 0, sizeof(devfs_handle_t) * NV_MAX_DEVICES);
- do {
- char name[10];
-- int i;
-
- nv_ctl_handle = devfs_register(NULL, "nvidiactl",
- DEVFS_FL_DEFAULT, nv_major, 255,
-@@ -772,23 +754,30 @@
- } 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
-@@ -813,14 +802,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");
-@@ -828,7 +817,7 @@
- return rc;
- }
-
--void cleanup_module(void)
-+static void __exit nvidia_exit_module(void)
- {
- int rc;
- nv_linux_state_t *nvl;
-@@ -837,9 +826,9 @@
- /* 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
-
-@@ -864,23 +853,23 @@
- 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
-+#if defined(CONFIG_DEVFS_FS) && !defined(KERNEL_2_5)
- do {
- int i;
- for (i = 0; nv_dev_handle[i] != 0; i++) {
-@@ -891,6 +880,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
-@@ -904,11 +895,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",
-@@ -916,8 +907,6 @@
-
- nvos_list_page_count(at->page_table, at->num_pages);
- }
--
-- MOD_INC_USE_COUNT;
- }
-
-
-@@ -925,11 +914,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--;
-
-@@ -947,22 +936,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.
-@@ -975,7 +954,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: "
-@@ -1014,7 +993,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;
- }
-
-@@ -1036,14 +1015,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
- };
-
-
-@@ -1074,7 +1050,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? */
-@@ -1085,9 +1061,6 @@
- goto failed;
- }
-
--
-- MOD_INC_USE_COUNT;
--
- nvl = &nv_linux_devices[devnum];
- nv = NV_STATE_PTR(nvl);
-
-@@ -1135,16 +1108,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;
- }
-@@ -1155,7 +1121,6 @@
- return rc;
-
- failed:
-- MOD_DEC_USE_COUNT;
- nv_unlock_ldata(nv);
- return rc;
- }
-@@ -1177,7 +1142,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));
-@@ -1187,28 +1152,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);
-@@ -1228,12 +1187,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);
- }
-@@ -1244,8 +1197,6 @@
- NV_KFREE(file->private_data);
- file->private_data = (void *) 0;
-
-- MOD_DEC_USE_COUNT;
--
- return 0;
- }
-
-@@ -1262,10 +1213,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)))
- {
-@@ -1283,7 +1234,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)
-@@ -1291,7 +1242,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;
-@@ -1301,7 +1252,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 */
-@@ -1310,7 +1261,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;
-@@ -1320,10 +1271,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)
- {
-@@ -1341,7 +1292,7 @@
- }
-
- at->vma = vma;
-- VMA_PRIVATE(vma) = at;
-+ NV_VMA_PRIVATE(vma) = at;
- at->usage_count++;
-
- if (NV_OSAGP_ENABLED(nv))
-@@ -1364,13 +1315,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)
- {
-@@ -1388,7 +1339,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);
-@@ -1410,9 +1361,6 @@
-
- vma->vm_file = file;
-
-- /* just increment usage count, rather than calling vma_open */
-- MOD_INC_USE_COUNT;
--
- return 0;
- }
-
-@@ -1437,7 +1385,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);
-
-@@ -1517,12 +1465,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):
- {
-@@ -1663,8 +1612,7 @@
- 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);
- }
- }
-
-@@ -1758,26 +1706,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 */
-@@ -1805,15 +1733,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);
-@@ -1823,8 +1743,6 @@
- NV_KFREE(file->private_data);
- file->private_data = (void *) 0;
-
-- MOD_DEC_USE_COUNT;
--
- return 0;
- }
-
-@@ -1849,7 +1767,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);
-
-@@ -1879,7 +1797,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,
-@@ -1958,7 +1876,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);
-@@ -2571,7 +2489,7 @@
-
- nvfp->any_fired_notifiers++;
-
-- wake_up_interruptible(GET_EVENT_QUEUE(nvl));
-+ wake_up_interruptible(&nvl->waitqueue);
- }
-
- /*
-@@ -2588,7 +2506,7 @@
- if (nvl->waiting_for_vblank)
- nvl->vblank_notifier++;
-
-- wake_up_interruptible(GET_EVENT_QUEUE(nvl));
-+ wake_up_interruptible(&nvl->waitqueue);
- }
-
-
-@@ -2639,12 +2557,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-4349/os-agp.c NVIDIA_kernel-1.0-4349-2.5/os-agp.c
---- NVIDIA_kernel-1.0-4349/os-agp.c 2003-03-28 04:30:55.000000000 +0100
-+++ NVIDIA_kernel-1.0-4349-2.5/os-agp.c 2003-03-29 21:50:14.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);
-@@ -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-4349/os-interface.c NVIDIA_kernel-1.0-4349-2.5/os-interface.c
---- NVIDIA_kernel-1.0-4349/os-interface.c 2003-03-28 04:30:55.000000000 +0100
-+++ NVIDIA_kernel-1.0-4349-2.5/os-interface.c 2003-03-29 21:51:26.000000000 +0100
-@@ -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))));
-+ mem_map_reserve(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))));
-+ mem_map_reserve(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;
-@@ -555,8 +560,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);
-
-
- //
-@@ -739,14 +744,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;
- }
-
-@@ -866,7 +871,7 @@
- {
- void *vaddr;
-
-- if (in_interrupt())
-+ if (!NV_MAY_SLEEP())
- {
- nv_printf(NV_DBG_ERRORS, "trying to map 0x%x to kernel space in interrupt!\n", start);
- os_dbg_breakpoint();
-@@ -879,16 +884,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,
-@@ -909,16 +904,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(
-@@ -1019,7 +1005,7 @@
-
- U032 os_get_cpu_count()
- {
-- return smp_num_cpus;
-+ return NV_SMP_NUM_CPUS;
- }
-
-
-@@ -1082,12 +1068,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-4349/os-registry.c NVIDIA_kernel-1.0-4349-2.5/os-registry.c
---- NVIDIA_kernel-1.0-4349/os-registry.c 2003-03-28 04:30:55.000000000 +0100
-+++ NVIDIA_kernel-1.0-4349-2.5/os-registry.c 2003-03-29 18:50:56.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/digest-nvidia-kernel-1.0.4349 b/media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.4349
deleted file mode 100644
index 401c5ee20c8a..000000000000
--- a/media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.4349
+++ /dev/null
@@ -1 +0,0 @@
-MD5 d55a295e440209594d7ccdc3c56023c4 NVIDIA_kernel-1.0-4349.tar.gz 664328
diff --git a/media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.4349-r1 b/media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.4349-r1
deleted file mode 100644
index 401c5ee20c8a..000000000000
--- a/media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.4349-r1
+++ /dev/null
@@ -1 +0,0 @@
-MD5 d55a295e440209594d7ccdc3c56023c4 NVIDIA_kernel-1.0-4349.tar.gz 664328
diff --git a/media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.4363 b/media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.4363
deleted file mode 100644
index b1f93afc2136..000000000000
--- a/media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.4363
+++ /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.4363-r1 b/media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.4363-r1
deleted file mode 100644
index b1f93afc2136..000000000000
--- a/media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.4363-r1
+++ /dev/null
@@ -1 +0,0 @@
-MD5 29b4cfcff63f502787fd2f0ac7a105fd NVIDIA_kernel-1.0-4363.tar.gz 661447
diff --git a/media-video/nvidia-kernel/nvidia-kernel-1.0.4349-r1.ebuild b/media-video/nvidia-kernel/nvidia-kernel-1.0.4349-r1.ebuild
deleted file mode 100644
index f5337e22ccfe..000000000000
--- a/media-video/nvidia-kernel/nvidia-kernel-1.0.4349-r1.ebuild
+++ /dev/null
@@ -1,143 +0,0 @@
-# Copyright 1999-2003 Gentoo Technologies, Inc.
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/media-video/nvidia-kernel/nvidia-kernel-1.0.4349-r1.ebuild,v 1.2 2003/04/21 15:49:44 pfeifer Exp $
-
-inherit eutils
-
-# Make sure Portage does _NOT_ strip symbols. Need both lines for
-# Portage 1.8.9+
-DEBUGBUILD="yes"
-RESTRICT="nostrip"
-
-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"
-SRC_URI="ftp://download.nvidia.com/XFree86/Linux-x86/${NV_V}/${NV_PACKAGE}.tar.gz"
-HOMEPAGE="http://www.nvidia.com/"
-
-# The slow needs to be set to $KV to prevent unmerges of
-# modules for other kernels.
-LICENSE="NVIDIA"
-SLOT="${KV}"
-KEYWORDS="x86 -ppc -sparc -alpha -hppa -mips -arm"
-
-DEPEND="virtual/linux-sources
- >=sys-apps/portage-1.9.10"
-RDEPEND=${DEPEND}
-IUSE=""
-
-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
-}
-
-src_unpack() {
- unpack ${A}
-
- # Next section applies patches for linux-2.5 kernel, or if
- # linux-2.4, the page_alloc.c patch courtesy of NVIDIA Corporation.
- # 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.
- # The patches should close bugs #9704 & #15722.
-
- local KV_major="`uname -r | cut -d. -f1`"
- local KV_minor="`uname -r | cut -d. -f2`"
- local KV_micro="`uname -r | cut -d. -f3 | sed -e 's:[^0-9].*::'`"
-
- cd ${S}
- einfo "Linux kernel ${KV_major}.${KV_minor}.${KV_micro}"
- if [ "${KV_major}" -eq 2 -a "${KV_minor}" -eq 5 ]
- then
- EPATCH_SINGLE_MSG="Applying tasklet patch for kernel 2.5..." \
- epatch ${FILESDIR}/${PV}/${NV_PACKAGE}-2.5-20030401.diff
-
- # Some problems with kbuild one ..
- ln -s Makefile.nvidia Makefile
- fi
-
-# if [ "${KV_major}" -eq 2 -a "${KV_minor}" -eq 4 ] && \
-# [ -r /usr/src/linux/mm/rmap.c ]
-# then
-# einfo "Detected rmap enabled kernel."
-# EPATCH_SINGLE_MSG="Applying rmap patch for kernel 2.4..." \
-# epatch ${FILESDIR}/${NV_PACKAGE}-2.5-tl.diff
-#
-# elif [ "${KV_major}" -eq 2 -a "${KV_minor}" -eq 5 ]
-# then
-# EPATCH_SINGLE_MSG="Applying tasklet patch for kernel 2.5..." \
-# epatch ${FILESDIR}/${NV_PACKAGE}-2.5-tl.diff
-#
-# if [ "${KV_micro}" -ge 54 ]
-# then
-# EPATCH_SINGLE_MSG="Applying module_loader_no_common_sections patch..." \
-# epatch ${FILESDIR}/${NV_PACKAGE}-2.5.54.diff
-# fi
-# if [ "${KV_micro}" -ge 63 ]
-# then
-# EPATCH_SINGLE_MSG="Applying missing_modversion.h patch..." \
-# epatch ${FILESDIR}/${NV_PACKAGE}-2.5.63.diff
-# fi
-# 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="/usr/src/linux" \
- clean nvidia.o || die
-}
-
-src_install() {
- # The driver goes into the standard modules location
- insinto /lib/modules/${KV}/video
- doins nvidia.o
-
- # 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 ] && [ -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.4349.ebuild b/media-video/nvidia-kernel/nvidia-kernel-1.0.4349.ebuild
deleted file mode 100644
index 334a473c52ef..000000000000
--- a/media-video/nvidia-kernel/nvidia-kernel-1.0.4349.ebuild
+++ /dev/null
@@ -1,143 +0,0 @@
-# Copyright 1999-2003 Gentoo Technologies, Inc.
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/media-video/nvidia-kernel/nvidia-kernel-1.0.4349.ebuild,v 1.1 2003/03/31 20:26:44 azarah Exp $
-
-inherit eutils
-
-# Make sure Portage does _NOT_ strip symbols. Need both lines for
-# Portage 1.8.9+
-DEBUGBUILD="yes"
-RESTRICT="nostrip"
-
-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"
-SRC_URI="ftp://download.nvidia.com/XFree86/Linux-x86/${NV_V}/${NV_PACKAGE}.tar.gz"
-HOMEPAGE="http://www.nvidia.com/"
-
-# The slow needs to be set to $KV to prevent unmerges of
-# modules for other kernels.
-LICENSE="NVIDIA"
-SLOT="${KV}"
-KEYWORDS="~x86 -ppc -sparc -alpha -hppa -mips -arm"
-
-DEPEND="virtual/linux-sources
- >=sys-apps/portage-1.9.10"
-RDEPEND=${DEPEND}
-IUSE=""
-
-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
-}
-
-src_unpack() {
- unpack ${A}
-
- # Next section applies patches for linux-2.5 kernel, or if
- # linux-2.4, the page_alloc.c patch courtesy of NVIDIA Corporation.
- # 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.
- # The patches should close bugs #9704 & #15722.
-
- local KV_major="`uname -r | cut -d. -f1`"
- local KV_minor="`uname -r | cut -d. -f2`"
- local KV_micro="`uname -r | cut -d. -f3 | sed -e 's:[^0-9].*::'`"
-
- cd ${S}
- einfo "Linux kernel ${KV_major}.${KV_minor}.${KV_micro}"
- if [ "${KV_major}" -eq 2 -a "${KV_minor}" -eq 5 ]
- then
- EPATCH_SINGLE_MSG="Applying tasklet patch for kernel 2.5..." \
- epatch ${FILESDIR}/${NV_PACKAGE}-2.5.diff
-
- # Some problems with kbuild one ..
- ln -s Makefile.nvidia Makefile
- fi
-
-# if [ "${KV_major}" -eq 2 -a "${KV_minor}" -eq 4 ] && \
-# [ -r /usr/src/linux/mm/rmap.c ]
-# then
-# einfo "Detected rmap enabled kernel."
-# EPATCH_SINGLE_MSG="Applying rmap patch for kernel 2.4..." \
-# epatch ${FILESDIR}/${NV_PACKAGE}-2.5-tl.diff
-#
-# elif [ "${KV_major}" -eq 2 -a "${KV_minor}" -eq 5 ]
-# then
-# EPATCH_SINGLE_MSG="Applying tasklet patch for kernel 2.5..." \
-# epatch ${FILESDIR}/${NV_PACKAGE}-2.5-tl.diff
-#
-# if [ "${KV_micro}" -ge 54 ]
-# then
-# EPATCH_SINGLE_MSG="Applying module_loader_no_common_sections patch..." \
-# epatch ${FILESDIR}/${NV_PACKAGE}-2.5.54.diff
-# fi
-# if [ "${KV_micro}" -ge 63 ]
-# then
-# EPATCH_SINGLE_MSG="Applying missing_modversion.h patch..." \
-# epatch ${FILESDIR}/${NV_PACKAGE}-2.5.63.diff
-# fi
-# 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="/usr/src/linux" \
- clean nvidia.o || die
-}
-
-src_install() {
- # The driver goes into the standard modules location
- insinto /lib/modules/${KV}/video
- doins nvidia.o
-
- # 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 ] && [ -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.4363-r1.ebuild b/media-video/nvidia-kernel/nvidia-kernel-1.0.4363-r1.ebuild
deleted file mode 100644
index 144d99402662..000000000000
--- a/media-video/nvidia-kernel/nvidia-kernel-1.0.4363-r1.ebuild
+++ /dev/null
@@ -1,143 +0,0 @@
-# Copyright 1999-2003 Gentoo Technologies, Inc.
-# 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-r1.ebuild,v 1.1 2003/05/13 20:53:38 azarah Exp $
-
-inherit eutils
-
-# Make sure Portage does _NOT_ strip symbols. Need both lines for
-# Portage 1.8.9+
-DEBUGBUILD="yes"
-RESTRICT="nostrip"
-
-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"
-SRC_URI="ftp://download.nvidia.com/XFree86/Linux-x86/${NV_V}/${NV_PACKAGE}.tar.gz"
-HOMEPAGE="http://www.nvidia.com/"
-
-# The slow needs to be set to $KV to prevent unmerges of
-# modules for other kernels.
-LICENSE="NVIDIA"
-SLOT="${KV}"
-KEYWORDS="~x86 -ppc -sparc -alpha -hppa -mips -arm"
-
-DEPEND="virtual/linux-sources
- >=sys-apps/portage-1.9.10"
-RDEPEND=${DEPEND}
-IUSE=""
-
-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
-
- 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
-}
-
-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 the kernel version of sources in /usr/src/linux ...
- local KV_full="$(awk '/UTS_RELEASE/ { gsub("\"", "", $3); print $3 }' \
- "${ROOT}/usr/src/linux/include/linux/version.h")"
- local KV_major="$(echo "${KV_full}" | cut -d. -f1)"
- local KV_minor="$(echo "${KV_full}" | cut -d. -f2)"
- local KV_micro="$(echo "${KV_full}" | cut -d. -f3 | sed -e 's:[^0-9].*::')"
-
- cd ${S}
- einfo "Linux kernel ${KV_major}.${KV_minor}.${KV_micro}"
- if [ "${KV_major}" -eq 2 -a "${KV_minor}" -eq 5 ]
- then
- EPATCH_SINGLE_MSG="Applying tasklet patch for kernel 2.5..." \
- epatch ${FILESDIR}/${PV}/${NV_PACKAGE}-2.5-20030424.diff
-
- if [ "${KV_micro}" -ge 68 ] && \
- [ -n "`grep irqreturn_t /usr/src/linux/include/linux/interrupt.h`" ]
- then
- EPATCH_SINGLE_MSG="Applying patch for devfs/irq changes in 2.5.68+..." \
- epatch ${FILESDIR}/${PV}/${NV_PACKAGE}-2.5.68.diff
- fi
-
- if [ "${KV_micro}" -ge 69 ] && \
- [ -z "`grep devfs_handle_t /usr/src/linux/include/linux/devfs_fs_kernel.h`" ]
- then
- EPATCH_SINGLE_MSG="Applying patch for devfs changes in 2.5.69+..." \
- epatch ${FILESDIR}/${PV}/${NV_PACKAGE}-2.5.69.diff
- fi
-
- # Some problems with kbuild one ..
- ln -s 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="/usr/src/linux" \
- clean nvidia.o || die
-}
-
-src_install() {
- # The driver goes into the standard modules location
- insinto /lib/modules/${KV}/video
- doins nvidia.o
-
- # 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 ] && [ -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.4363-r2.ebuild b/media-video/nvidia-kernel/nvidia-kernel-1.0.4363-r2.ebuild
index 777503044966..137e778bec7c 100644
--- a/media-video/nvidia-kernel/nvidia-kernel-1.0.4363-r2.ebuild
+++ b/media-video/nvidia-kernel/nvidia-kernel-1.0.4363-r2.ebuild
@@ -1,6 +1,6 @@
# Copyright 1999-2003 Gentoo Technologies, Inc.
# 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-r2.ebuild,v 1.1 2003/05/26 20:11:32 azarah Exp $
+# $Header: /var/cvsroot/gentoo-x86/media-video/nvidia-kernel/nvidia-kernel-1.0.4363-r2.ebuild,v 1.2 2003/06/22 15:02:23 azarah Exp $
inherit eutils
@@ -20,7 +20,7 @@ HOMEPAGE="http://www.nvidia.com/"
# modules for other kernels.
LICENSE="NVIDIA"
SLOT="${KV}"
-KEYWORDS="~x86 -ppc -sparc -alpha -hppa -mips -arm"
+KEYWORDS="x86 -ppc -sparc -alpha -hppa -mips -arm"
DEPEND="virtual/linux-sources
>=sys-apps/portage-1.9.10"
@@ -49,6 +49,26 @@ pkg_setup() {
fi
}
+get_KV_info() {
+ # 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_2_5_kernel() {
+ get_KV_info
+
+ if [ "${KV_major}" -eq 2 -a "${KV_minor}" -eq 5 ]
+ then
+ return 0
+ else
+ return 1
+ fi
+}
+
src_unpack() {
unpack ${A}
@@ -60,49 +80,27 @@ src_unpack() {
# Many thanks to Christian Zander <zander@minion.de> for bringing
# these to us, and being so helpful to select which to use.
- # Get the kernel version of sources in /usr/src/linux ...
- local KV_full="$(awk '/UTS_RELEASE/ { gsub("\"", "", $3); print $3 }' \
- "${ROOT}/usr/src/linux/include/linux/version.h")"
- local KV_major="$(echo "${KV_full}" | cut -d. -f1)"
- local KV_minor="$(echo "${KV_full}" | cut -d. -f2)"
- local KV_micro="$(echo "${KV_full}" | cut -d. -f3 | sed -e 's:[^0-9].*::')"
+ get_KV_info
cd ${S}
einfo "Linux kernel ${KV_major}.${KV_minor}.${KV_micro}"
- if [ "${KV_major}" -eq 2 -a "${KV_minor}" -eq 5 ]
+
+ if is_2_5_kernel
then
EPATCH_SINGLE_MSG="Applying tasklet patch for kernel 2.5..." \
- epatch ${FILESDIR}/${PV}/${NV_PACKAGE}-2.5-20030424.diff
-
- if [ "${KV_micro}" -ge 68 ] && \
- [ -n "`grep irqreturn_t /usr/src/linux/include/linux/interrupt.h`" ]
- then
- EPATCH_SINGLE_MSG="Applying patch for devfs/irq changes in 2.5.68+..." \
- epatch ${FILESDIR}/${PV}/${NV_PACKAGE}-2.5.68.diff
- fi
+ epatch ${FILESDIR}/${PV}/${NV_PACKAGE}-2.5-20030614.diff
- if [ "${KV_micro}" -ge 69 ]
- then
- if [ -z "`grep devfs_handle_t /usr/src/linux/include/linux/devfs_fs_kernel.h`" ]
- then
- EPATCH_SINGLE_MSG="Applying patch for devfs changes in 2.5.69+..." \
- epatch ${FILESDIR}/${PV}/${NV_PACKAGE}-2.5.69.diff
- fi
- if [ -n "`grep "struct agp_memory" /usr/src/linux/drivers/char/agp/agp.h`" ]
- then
- EPATCH_SINGLE_MSG="Applying patch for agp changes in 2.5.69+..." \
- epatch ${FILESDIR}/${PV}/${NV_PACKAGE}-2.5.69-agp.diff
- fi
- fi
-
- # Some problems with kbuild one ..
- ln -s Makefile.nvidia Makefile
+ # Kbuild have issues currently (sandbox related).
+ ln -snf Makefile.nvidia Makefile
+ else
+ 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
diff --git a/media-video/nvidia-kernel/nvidia-kernel-1.0.4363.ebuild b/media-video/nvidia-kernel/nvidia-kernel-1.0.4363.ebuild
deleted file mode 100644
index 72a5c7676ded..000000000000
--- a/media-video/nvidia-kernel/nvidia-kernel-1.0.4363.ebuild
+++ /dev/null
@@ -1,136 +0,0 @@
-# Copyright 1999-2003 Gentoo Technologies, Inc.
-# 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.ebuild,v 1.1 2003/04/26 13:14:20 azarah Exp $
-
-inherit eutils
-
-# Make sure Portage does _NOT_ strip symbols. Need both lines for
-# Portage 1.8.9+
-DEBUGBUILD="yes"
-RESTRICT="nostrip"
-
-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"
-SRC_URI="ftp://download.nvidia.com/XFree86/Linux-x86/${NV_V}/${NV_PACKAGE}.tar.gz"
-HOMEPAGE="http://www.nvidia.com/"
-
-# The slow needs to be set to $KV to prevent unmerges of
-# modules for other kernels.
-LICENSE="NVIDIA"
-SLOT="${KV}"
-KEYWORDS="~x86 -ppc -sparc -alpha -hppa -mips -arm"
-
-DEPEND="virtual/linux-sources
- >=sys-apps/portage-1.9.10"
-RDEPEND=${DEPEND}
-IUSE=""
-
-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
-
- 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
-}
-
-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 the kernel version of sources in /usr/src/linux ...
- local KV_full="$(awk '/UTS_RELEASE/ { gsub("\"", "", $3); print $3 }' \
- "${ROOT}/usr/src/linux/include/linux/version.h")"
- local KV_major="$(echo "${KV_full}" | cut -d. -f1)"
- local KV_minor="$(echo "${KV_full}" | cut -d. -f2)"
- local KV_micro="$(echo "${KV_full}" | cut -d. -f3 | sed -e 's:[^0-9].*::')"
-
- cd ${S}
- einfo "Linux kernel ${KV_major}.${KV_minor}.${KV_micro}"
- if [ "${KV_major}" -eq 2 -a "${KV_minor}" -eq 5 ]
- then
- EPATCH_SINGLE_MSG="Applying tasklet patch for kernel 2.5..." \
- epatch ${FILESDIR}/${PV}/${NV_PACKAGE}-2.5-20030424.diff
-
- if [ "${KV_micro}" -ge 68 ] && \
- [ -n "`grep irqreturn_t /usr/src/linux/include/linux/interrupt.h`" ]
- then
- EPATCH_SINGLE_MSG="Applying patch for devfs/irq changes in 2.5.68+..." \
- epatch ${FILESDIR}/${PV}/${NV_PACKAGE}-2.5.68.diff
- fi
-
- # Some problems with kbuild one ..
- ln -s 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="/usr/src/linux" \
- clean nvidia.o || die
-}
-
-src_install() {
- # The driver goes into the standard modules location
- insinto /lib/modules/${KV}/video
- doins nvidia.o
-
- # 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 ] && [ -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
-}
-