Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 36286 | Differences between
and this patch

Collapse All | Expand All

(-)NVIDIA_kernel-1.0-5328/Makefile (-141 lines)
Lines 1-141 Link Here
1
# This Makefile is automatically generated; do not edit
2
#   Generated on 'builder3.nvidia.com' on Wed Dec 17 13:54:52 PST 2003
3
4
LINUX_MODULE=nv-linux.o
5
DEFINES=-D__KERNEL__ -DMODULE -D_LOOSE_KERNEL_NAMES -DNTRM -D_GNU_SOURCE -D_LOOSE_KERNEL_NAMES -D__KERNEL__ -DMODULE  -DNV_MAJOR_VERSION=1 -DNV_MINOR_VERSION=0 -DNV_PATCHLEVEL=5328  -DNV_UNIX   -DNV_LINUX   -DNV_INT64_OK   -DNVCPU_X86     
6
INCLUDES=-I.
7
8
OBJECTS=nv.o os-agp.o os-interface.o os-registry.o 
9
HEADERS=os-agp.h os-interface.h nv-linux.h nv-misc.h nv-memdbg.h nv.h  rmretval.h nvtypes.h  $(VERSION_HDR)
10
11
CFLAGS=-Wall -Wimplicit -Wreturn-type -Wswitch -Wformat -Wchar-subscripts -Wparentheses -Wpointer-arith  -Wno-multichar  -Werror -O -MD $(DEFINES) $(INCLUDES) -Wno-cast-qual -Wno-error
12
13
RESMAN_KERNEL_MODULE=nv-kernel.o
14
15
KERNDIR=/lib/modules/$(shell uname -r)
16
17
# check for newer paths. if found, use them, otherwise use old paths
18
# these wouldn't work with the gnu make included with rh6.2
19
# KERNINC=$(if -d $(KERNDIR)/build, $(KERNDIR)/build/include, /usr/src/linux/include)
20
# INSTALLDIR=$(if -d $(KERNDIR)/kernel, $(KERNDIR)/kernel/drivers/video, $(KERNDIR)/video)
21
22
# this is slightly more brain-dead, but works..
23
ifeq ($(shell if test -d $(KERNDIR)/build; then echo yes; fi),yes)
24
KERNINC=$(KERNDIR)/build/include
25
else
26
KERNINC=/usr/src/linux/include
27
endif
28
29
ifeq ($(shell if test -d $(KERNDIR)/kernel; then echo yes; fi),yes)
30
INSTALLDIR=$(KERNDIR)/kernel/drivers/video
31
else
32
INSTALLDIR=$(KERNDIR)/video
33
endif
34
35
ifeq ($(shell echo $(NVDEBUG)),1)
36
  ifeq ($(shell test -z $(RMDEBUG) && echo yes),yes)
37
    RMDEBUG=1
38
  endif
39
endif
40
41
ifeq ($(shell echo $(RMDEBUG)),1)
42
CFLAGS += -DDEBUG -g -fno-common
43
endif
44
45
# this is just plain wrong, get rid of it
46
BROKENDIR=$(KERNDIR)/kernel/video
47
48
INSTALL=$(shell which install)
49
50
# allow specification of alternate include file tree on command line and extra defines
51
ifdef SYSINCLUDE
52
INCLUDES += -I$(SYSINCLUDE)
53
else
54
INCLUDES += -I$(KERNINC)
55
endif
56
57
ifeq ($(shell sh conftest.sh remap_page_range $(INCLUDES)), 5)
58
  DEFINES += -DREMAP_PAGE_RANGE_5
59
endif
60
61
ifeq ($(shell sh conftest.sh remap_page_range $(INCLUDES)), 4)
62
  DEFINES += -DREMAP_PAGE_RANGE_4
63
endif
64
65
DEFINES+=$(EXTRA_DEFINES)
66
67
# allow build parameters to be passed in through the environment
68
ifdef BUILD_PARAMS
69
    DEFINES+=-D$(BUILD_PARAMS)
70
endif
71
72
VERSION_HDR=nv_compiler.h
73
74
all: install
75
76
install: package-install
77
78
package-install: nvidia.o rmmod-check
79
	@if [ `id -ur` != 0 ]; then \
80
		echo Please run \"make install\" as root.; \
81
	else \
82
		if [ -d $(BROKENDIR) ]; then \
83
			rm -f $(BROKENDIR)/NVdriver; \
84
			rmdir --ignore-fail-on-non-empty $(BROKENDIR); \
85
		fi && \
86
		mkdir -p $(INSTALLDIR) && \
87
		rm -f $(INSTALLDIR)/NVdriver && \
88
		$(INSTALL) -m 0664 -o root -g root nvidia.o $(INSTALLDIR)/nvidia.o$(O) && \
89
		PATH="$(PATH):/bin:/sbin" depmod -a && \
90
                PATH="$(PATH):/bin:/sbin" modprobe nvidia && \
91
		sh makedevices.sh && \
92
		echo "nvidia.o installed successfully."; \
93
	fi
94
95
RMMOD_ERROR=\
96
	echo ""; \
97
	echo "Unable to remove existing NVIDIA kernel module."; \
98
	echo "Please be sure you have exited X before attempting"; \
99
	echo "to install the NVIDIA kernel module."; \
100
	echo ""; \
101
	echo -en "\033[1;31m"; \
102
	echo -e  "*** Failed rmmod sanity check. Bailing out! ***"; \
103
	echo -en "\033[0m"; \
104
	exit 1;
105
106
rmmod-check:
107
	@if PATH="$(PATH):/bin:/sbin" lsmod | grep -w nvidia > /dev/null; then \
108
		if ! PATH="($PATH):/bin:/sbin" rmmod nvidia > /dev/null; then $(RMMOD_ERROR) fi \
109
	fi; \
110
	if PATH="$(PATH):/bin:/sbin" lsmod | grep -w NVdriver > /dev/null; then \
111
		if ! PATH="$(PATH):/bin:/sbin" rmmod NVdriver > /dev/null; then $(RMMOD_ERROR) fi \
112
	fi
113
114
gcc-check:
115
	@if ! sh conftest.sh cc_sanity_check full_output $(CC); then exit 1; fi
116
117
nvidia.o: gcc-check $(LINUX_MODULE) $(RESMAN_KERNEL_MODULE) 
118
	ld -r -o $@ $(LINUX_MODULE) $(RESMAN_KERNEL_MODULE)
119
120
$(VERSION_HDR): 
121
	echo \#define NV_COMPILER \"`$(CC) -v 2>&1 | tail -n 1`\" > $@
122
123
$(LINUX_MODULE): $(OBJECTS)
124
	ld -r -o $@ $(OBJECTS)
125
126
%.o: %.c $(HEADERS)
127
	$(CC) -c $(CFLAGS) $<
128
129
# debug tool to preprocess the file and leave .i to make it easier to untangle #defines
130
%.i: %.c
131
	$(CC) $(CFLAGS) -E $< > $@
132
133
%.s: %.c
134
	$(CC) $(CFLAGS) -S $< > $@
135
136
137
clean:
138
	$(RM) $(OBJECTS) $(LINUX_MODULE) $(VERSION_HDR) *.d NVdriver nvidia.o
139
140
141
-include $(OBJECTS:%.o=%.d)
(-)NVIDIA_kernel-1.0-5328/Makefile.kbuild (+245 lines)
Line 0 Link Here
1
#
2
# KBUILD Makefile for the NVIDIA Linux kernel module.
3
#
4
# The motivation for replacing the original Makefile is the hope that this
5
# version will simplify the build and installation process. In the past,
6
# many architectural and cosmetic changes to the Linux kernel have made it
7
# difficult to maintain compatibility or required duplication of logic.
8
#
9
# Linux 2.5 introduces numerous such changes, many of which impact modules.
10
# Relying on KBUILD, some aspects of the build system otherwise difficult
11
# to support (for example, module versioning) are abstracted away and dealt
12
# with elsewhere, making life significantly easier here.
13
#
14
# The new approach currently has its own share of problems, some of which
15
# are architectural difficulties with KBUILD, others minor annoyances. For
16
# this reason, an improved version of the NVIDIA Makefile is available to
17
# those experiencing difficulties.
18
#
19
# Please report any problems you may be experiencing with this experimental
20
# Makefile to either one (or, preferably, both) of us:
21
#
22
# Alistair J Strachan (alistair@devzero.co.uk) (first pass, enhancements)
23
# Christian Zander (zander@mail.minion.de) (enhancements)
24
#
25
26
all: install
27
install: package-install
28
29
#
30
# The NVIDIA kernel module base name and static file names. KBUILD will go
31
# ahead and append ".o" or ".ko" to form the final module name.
32
#
33
34
MODULE_NAME := nvidia
35
VERSION_HEADER := nv_compiler.h
36
37
#
38
# List of object files to link into NVIDIA kernel module; make sure KBUILD
39
# understands that we want a module.
40
#
41
42
RESMAN_CORE_OBJS := nv-kernel.o
43
RESMAN_GLUE_OBJS := nv.o os-agp.o os-interface.o os-registry.o
44
45
$(MODULE_NAME)-objs := $(RESMAN_CORE_OBJS) $(RESMAN_GLUE_OBJS)
46
47
#
48
# A bug in KBUILD 2.4 means that leaving obj-m set in top-level context
49
# will cause Rules.make to call pathdown.sh, which is wrong. So, we only
50
# set this conditional of a kernel-level instance.
51
#
52
53
ifdef TOPDIR
54
obj-m += $(MODULE_NAME).o
55
endif
56
57
#
58
# Include local source directory in $(CC)'s include path and set disable any
59
# warning types that are of little interest to us.
60
#
61
62
EXTRA_CFLAGS += -I$(src)
63
EXTRA_CFLAGS += -Wno-cast-qual -Wno-strict-prototypes
64
65
#
66
# Determine location of the Linux kernel source tree. Allow users to override
67
# the default (i.e. automatically determined) kernel source location with the
68
# KERNDIR directive; this new directive replaces NVIDIA's SYSINCLUDE.
69
#
70
71
ifdef KERNDIR
72
  KERNEL_SOURCES := $(KERNDIR)
73
  KERNEL_HEADERS := -I$(KERNEL_SOURCES)/include
74
  MODULE_ROOT    := /lib/modules/$(shell uname -r)/kernel/drivers # XXX
75
else
76
  KERNEL_SOURCES := /lib/modules/$(shell uname -r)/build
77
  KERNEL_HEADERS := -I$(KERNEL_SOURCES)/include
78
  MODULE_ROOT    := /lib/modules/$(shell uname -r)/kernel/drivers
79
endif
80
81
#
82
# We rely on these two definitions below; if they aren't set, we set them to
83
# reasonable defaults (Linux 2.4's KBUILD, and top-level passes will not set
84
# these).
85
#
86
87
src ?= .
88
obj ?= .
89
90
#
91
# Sets any internal variables left unset by KBUILD (e.g. this happens during
92
# a top-level run).
93
#
94
95
TOPDIR ?= $(KERNEL_SOURCES)
96
PATCHLEVEL ?= $(shell sh $(src)/conftest.sh kernel_patch_level $(TOPDIR))
97
98
#
99
# Linux 2.4 uses the .o module extension. Linux 2.5, however, uses the .ko
100
# module extension. Handle these gracefully.
101
#
102
103
ifeq ($(PATCHLEVEL), 4)
104
  MODULE_OBJECT := $(MODULE_NAME).o
105
else
106
  MODULE_OBJECT := $(MODULE_NAME).ko
107
endif
108
109
#
110
# NVIDIA specific CFLAGS and #define's. The remap_page_range check has become
111
# necessary with the introduction of the five argument version to Linux 2.4
112
# distribution kernels; this conflicting change cannot be detected at compile
113
# time.
114
#
115
116
EXTRA_CFLAGS += -D__KERNEL__ -DMODULE -D_LOOSE_KERNEL_NAMES -DNTRM -D_GNU_SOURCE -D_LOOSE_KERNEL_NAMES -D__KERNEL__ -DMODULE  -DNV_MAJOR_VERSION=1 -DNV_MINOR_VERSION=0 -DNV_PATCHLEVEL=5328  -DNV_UNIX   -DNV_LINUX   -DNV_INT64_OK   -DNVCPU_X86
117
118
ifeq ($(shell echo $(NVDEBUG)),1)
119
  ifeq ($(shell test -z $(RMDEBUG) && echo yes),yes)
120
    RMDEBUG=1
121
  endif
122
endif
123
124
ifeq ($(shell echo $(RMDEBUG)),1)
125
  EXTRA_CFLAGS += -DDEBUG -g -fno-common
126
endif
127
128
ifeq ($(shell sh $(src)/conftest.sh remap_page_range $(KERNEL_HEADERS)), 5)
129
  EXTRA_CFLAGS += -DREMAP_PAGE_RANGE_5
130
endif
131
132
ifeq ($(shell sh $(src)/conftest.sh remap_page_range $(KERNEL_HEADERS)), 4)
133
  EXTRA_CFLAGS += -DREMAP_PAGE_RANGE_4
134
endif
135
136
#
137
# NVIDIA binary object file includes .common section.
138
#
139
140
EXTRA_LDFLAGS := -d
141
142
#
143
# Miscellaneous NVIDIA kernel module build support targets. They are needed
144
# to satisfy KBUILD requirements and to support NVIDIA specifics.
145
#
146
147
$(obj)/nv-kernel.o:
148
	cp $(src)/$(RESMAN_CORE_OBJS) $(obj)/$(RESMAN_CORE_OBJS)
149
150
$(obj)/$(VERSION_HEADER):
151
	echo \#define NV_COMPILER \"`$(CC) -v 2>&1 | tail -n 1`\" > $@
152
153
$(obj)/nv.o: $(obj)/$(VERSION_HEADER)
154
155
#
156
# More quirks for Linux 2.4 KBUILD, which doesn't link automatically.
157
#
158
159
ifeq ($(PATCHLEVEL), 4)
160
$(obj)/$(MODULE_NAME).o: $($(MODULE_NAME)-objs)
161
	$(LD) $(EXTRA_LDFLAGS) -r -o $@ $($(MODULE_NAME)-objs)
162
endif
163
164
#
165
# KBUILD build parameters.
166
#
167
168
KBUILD_PARAMS := -C $(KERNEL_SOURCES) SUBDIRS=$(PWD)
169
170
#
171
# NVIDIA sanity checks.
172
#
173
174
suser-sanity-check:
175
	@if ! sh conftest.sh suser_sanity_check; then \
176
	  echo; \
177
	  echo "You have insufficient privileges for this operation. Please "; \
178
	  echo "run \"make install\" as root!                               "; \
179
	  echo; \
180
	  exit 1; \
181
	fi
182
183
rmmod-sanity-check:
184
	@if ! sh conftest.sh rmmod_sanity_check $(MODULE_NAME); then \
185
	  echo; \
186
	  echo "Unable to unload the currently loaded NVIDIA kernel module! "; \
187
	  echo "Please be certain that you have exited X before attempting  "; \
188
	  echo "to install this version.                                    "; \
189
	  echo; \
190
	  exit 1; \
191
	fi
192
193
cc-sanity-check:
194
	@if ! sh conftest.sh cc_sanity_check full_output $(CC); then \
195
		exit 1; \
196
	fi
197
198
#
199
# Build the NVIDIA kernel module using Linux KBUILD. This target is used by
200
# the "package-install" target below.
201
#
202
203
module: cc-sanity-check
204
	@make $(KBUILD_PARAMS) modules; \
205
	if ! [ -f $(MODULE_OBJECT) ]; then \
206
	  echo "$(MODULE_OBJECT) failed to build!"; \
207
	  exit 1; \
208
	fi
209
210
#
211
# Build the NVIDIA kernel module with KBUILD. Verify that the user posesses
212
# sufficient privileges. Rebuild the module dependency file.
213
#
214
215
module-install: suser-sanity-check module
216
	@mkdir -p $(MODULE_ROOT)/video; \
217
	install -m 0664 -o root -g root $(MODULE_OBJECT) $(MODULE_ROOT)/video; \
218
	/sbin/depmod -ae;
219
220
#
221
# This target builds, then installs, then creates device nodes and inserts
222
# the module, if successful.
223
#
224
225
package-install: module-install rmmod-sanity-check
226
	@sh makedevices.sh; \
227
	/sbin/modprobe $(MODULE_NAME) && \
228
	echo "$(MODULE_OBJECT) installed successfully.";
229
230
#
231
# Support hack, KBUILD isn't prepared to clean up after external modules.
232
#
233
234
clean:
235
	@rm -f $(RESMAN_GLUE_OBJS) .*.{cmd,flags}
236
	@rm -f $(MODULE_NAME).{o,ko,mod.{o,c}} built-in.o $(VERSION_HEADER) *~
237
238
#
239
# Linux 2.4 KBUILD requires the inclusion of Rules.make; Linux 2.5's KBUILD
240
# includes dependencies automatically.
241
#
242
243
ifeq ($(PATCHLEVEL), 4)
244
include $(KERNEL_SOURCES)/Rules.make
245
endif
(-)NVIDIA_kernel-1.0-5328/Makefile.nvidia (+139 lines)
Line 0 Link Here
1
# This Makefile is automatically generated; do not edit
2
#   Generated on 'builder3.nvidia.com' on Thu Jun 19 04:05:35 PDT 2003
3
4
LINUX_MODULE=nv-linux.o
5
DEFINES=-D__KERNEL__ -DMODULE -D_LOOSE_KERNEL_NAMES -DKBUILD_MODNAME="nvidia" -DNTRM -D_GNU_SOURCE -D_LOOSE_KERNEL_NAMES -D__KERNEL__ -DMODULE  -DNV_MAJOR_VERSION=1 -DNV_MINOR_VERSION=0 -DNV_PATCHLEVEL=5328     -DNV_UNIX   -DNV_LINUX   -DNV_INT64_OK   -DNVCPU_X86
6
INCLUDES=-I.
7
8
OBJECTS=nv.o os-agp.o os-interface.o os-registry.o 
9
HEADERS=os-agp.h os-interface.h nv-linux.h nv-misc.h nv-memdbg.h nv.h  rmretval.h nvtypes.h  $(VERSION_HDR)
10
11
CFLAGS=-Wall -Wimplicit -Wreturn-type -Wswitch -Wformat -Wchar-subscripts -Wparentheses -Wcast-qual -Wno-multichar  -O -MD $(DEFINES) $(INCLUDES) -Wno-cast-qual
12
13
RESMAN_KERNEL_MODULE=nv-kernel.o
14
15
KERNDIR=/lib/modules/$(shell uname -r)
16
17
# check for newer paths. if found, use them, otherwise use old paths
18
# these wouldn't work with the gnu make included with rh6.2
19
# KERNINC=$(if -d $(KERNDIR)/build, $(KERNDIR)/build/include, /usr/src/linux/include)
20
# INSTALLDIR=$(if -d $(KERNDIR)/kernel, $(KERNDIR)/kernel/drivers/video, $(KERNDIR)/video)
21
22
# this is slightly more brain-dead, but works..
23
ifeq ($(shell if test -d $(KERNDIR)/build; then echo yes; fi),yes)
24
KERNINC=$(KERNDIR)/build/include
25
else
26
KERNINC=/usr/src/linux/include
27
endif
28
29
ifeq ($(shell if test -d $(KERNDIR)/kernel; then echo yes; fi),yes)
30
INSTALLDIR=$(KERNDIR)/kernel/drivers/video
31
else
32
INSTALLDIR=$(KERNDIR)/video
33
endif
34
35
ifeq ($(shell echo $(NVDEBUG)),1)
36
  ifeq ($(shell test -z $(RMDEBUG) && echo yes),yes)
37
    RMDEBUG=1
38
  endif
39
endif
40
41
ifeq ($(shell echo $(RMDEBUG)),1)
42
CFLAGS += -DDEBUG -g -fno-common
43
endif
44
45
# this is just plain wrong, get rid of it
46
BROKENDIR=$(KERNDIR)/kernel/video
47
48
INSTALL=$(shell which install)
49
50
# allow specification of alternate include file tree on command line and extra defines
51
ifdef SYSINCLUDE
52
INCLUDES += -I$(SYSINCLUDE)
53
INCLUDES += -I$(SYSINCLUDE)/asm/mach-default
54
else
55
INCLUDES += -I$(KERNINC)
56
INCLUDES += -I$(KERNINC)/asm/mach-default
57
endif
58
59
ifeq ($(shell sh conftest.sh remap_page_range $(INCLUDES)), 5)
60
  DEFINES += -DREMAP_PAGE_RANGE_5
61
endif
62
63
ifeq ($(shell sh conftest.sh remap_page_range $(INCLUDES)), 4)
64
  DEFINES += -DREMAP_PAGE_RANGE_4
65
endif
66
67
DEFINES+=$(EXTRA_DEFINES)
68
69
# allow build parameters to be passed in through the environment
70
ifdef BUILD_PARAMS
71
    DEFINES+=-D$(BUILD_PARAMS)
72
endif
73
74
VERSION_HDR=nv_compiler.h
75
76
all: install
77
78
install: package-install
79
80
suser-sanity-check:
81
	@if ! sh conftest.sh suser_sanity_check; then \
82
	  echo; \
83
	  echo "You have insufficient privileges for this operation. Please "; \
84
	  echo "run \"make install\" as root!                               "; \
85
	  echo; \
86
	  exit 1; \
87
	fi
88
89
rmmod-sanity-check:
90
	@if ! sh conftest.sh rmmod_sanity_check nvidia; then \
91
	  echo; \
92
	  echo "Unable to unload the currently loaded NVIDIA kernel module! "; \
93
	  echo "Please be certain that you have exited X before attempting  "; \
94
	  echo "to install this version.                                    "; \
95
	  echo; \
96
	  exit 1; \
97
	fi
98
99
cc-sanity-check:
100
	@if ! sh conftest.sh cc_sanity_check full_output $(CC); then exit 1; fi
101
102
package-install: suser-sanity-check nvidia.o rmmod-sanity-check
103
	if [ -d $(BROKENDIR) ]; then \
104
		rm -f $(BROKENDIR)/NVdriver; \
105
		rmdir --ignore-fail-on-non-empty $(BROKENDIR); \
106
	fi && \
107
	mkdir -p $(INSTALLDIR) && \
108
	rm -f $(INSTALLDIR)/NVdriver && \
109
	$(INSTALL) -m 0664 -o root -g root nvidia.o $(INSTALLDIR)/nvidia.o$(O) && \
110
	/sbin/depmod -a && \
111
	/sbin/modprobe nvidia && \
112
	sh makedevices.sh && \
113
	echo "nvidia.o installed successfully."; \
114
115
nvidia.o: cc-sanity-check $(LINUX_MODULE) $(RESMAN_KERNEL_MODULE) 
116
	ld -d -r -o $@ $(LINUX_MODULE) $(RESMAN_KERNEL_MODULE)
117
118
$(VERSION_HDR): 
119
	echo \#define NV_COMPILER \"`$(CC) -v 2>&1 | tail -n 1`\" > $@
120
121
$(LINUX_MODULE): $(OBJECTS)
122
	ld -r -o $@ $(OBJECTS)
123
124
%.o: %.c $(HEADERS)
125
	$(CC) -c $(CFLAGS) $<
126
127
# debug tool to preprocess the file and leave .i to make it easier to untangle #defines
128
%.i: %.c
129
	$(CC) $(CFLAGS) -E $< > $@
130
131
%.s: %.c
132
	$(CC) $(CFLAGS) -S $< > $@
133
134
135
clean:
136
	$(RM) $(OBJECTS) $(LINUX_MODULE) $(VERSION_HDR) *.d NVdriver nvidia.o
137
138
139
-include $(OBJECTS:%.o=%.d)
(-)NVIDIA_kernel-1.0-5328/conftest.sh (+74 lines)
Lines 104-108 Link Here
104
            exit 0
104
            exit 0
105
        fi
105
        fi
106
    ;;
106
    ;;
107
108
    cc_sanity_check)
109
        shift
110
        #
111
        # Verify that the same compiler is used for the kernel and kernel
112
        # module.
113
        #
114
        if test -n "$IGNORE_CC_MISMATCH" -o -n "$KERNDIR"; then
115
          #
116
          # The user chose to disable the gcc sanity test or is building
117
          # the module for a kernel not currently running, which renders
118
          # our test meaningless.
119
          #
120
          exit 0
121
        fi
122
123
        VERSION="^Linux version.* (.*) (\(gcc.*\)).*"
124
        KERNEL=$(cat /proc/version | sed "s/$VERSION/\1/")
125
        MODULE=$($* -v 2>&1 | tail -n 1)
126
127
        if test "$KERNEL" != "$MODULE"; then
128
          #
129
          # The kernel seems to have been built with a different version
130
          # of the C compiler, which may be a problem.
131
          #
132
          exit 1
133
        else
134
          exit 0
135
        fi
136
    ;;
137
138
    kernel_patch_level)
139
        shift
140
        #
141
        # Determine the kernel's major patch level; this is only done if we
142
        # aren't told by KBUILD.
143
        #
144
        echo $(cat "$1"/Makefile | grep "PATCHLEVEL =" | cut -d " " -f 3)
145
        exit 0
146
    ;;
147
148
    suser_sanity_check)
149
        shift
150
        #
151
        # Determine the caller's user id to determine if we have sufficient
152
        # privileges for the requested operation.
153
        #
154
        if test $(id -ur) != 0; then
155
          exit 1
156
        else
157
          exit 0
158
        fi
159
    ;;
160
161
    rmmod_sanity_check)
162
        shift
163
        #
164
        # Make sure that any currently loaded NVIDIA kernel module can be
165
        # unloaded.
166
        #
167
        if /sbin/lsmod | grep -q "$1"; then
168
          /sbin/rmmod "$1" >& /dev/null
169
        fi
170
171
        if /sbin/lsmod | grep -q "$1"; then
172
          #
173
          # The NVIDIA kernel module is still loaded, most likely because
174
          # it is busy.
175
          #
176
          exit 1
177
        else
178
          exit 0
179
        fi
180
    ;;
107
esac
181
esac
108
182
(-)NVIDIA_kernel-1.0-5328/makedevices.sh (-38 / +40 lines)
Lines 8-54 Link Here
8
# create a temporary file
8
# create a temporary file
9
tmp=`(mktemp -q /tmp/nvidia.XXXXXX) 2> /dev/null` || tmp="/tmp/nvidia.$$"
9
tmp=`(mktemp -q /tmp/nvidia.XXXXXX) 2> /dev/null` || tmp="/tmp/nvidia.$$"
10
10
11
paths=" /etc/modutils/aliases    \
11
modconfs=" /etc/modutils/aliases    \
12
        /etc/modules.conf        \
12
           /etc/modules.conf        \
13
        /etc/conf.modules        "
13
           /etc/modprobe.d/aliases  \
14
14
           /etc/modprobe.conf       \
15
modconf=""
15
           /etc/conf.modules        "
16
for path in $paths; do
16
17
   if [ -f "$path" ]; then
17
#
18
       modconf=$path
18
# Pass the -p option to cp to preserve the permissions of $modconf and
19
       break
19
# /etc/rc.d/rc.modules across the update. Update all relevant files
20
# including those eventually regenerated to avoid the need for awkward
21
# logic here.
22
#
23
for modconf in $modconfs; do
24
   if [ -f "$modconf" ]; then
25
     cp -p $modconf $tmp
26
     sed '/^alias.*\(NVdriver\|nvidia\)/d'  < $modconf   > $tmp
27
28
     # make sure the last character in the file is a newline
29
     [ `tail -n 1 $tmp | wc -l` = 0 ] && echo "" >> $tmp
30
31
     if [ -c /dev/.devfsd ]; then
32
       echo "alias /dev/nvidia* nvidia" >> $tmp
33
     else
34
       if [ `uname -r | cut -d '.' -f 2` = 6 ]; then
35
           echo "alias	char-major-195*	nvidia" >> $tmp
36
       else
37
           echo "alias	char-major-195	nvidia" >> $tmp
38
       fi
39
     fi
40
     mv -f $tmp $modconf
41
     test -x /sbin/update-modules && /sbin/update-modules
20
   fi
42
   fi
21
done
43
done
22
44
23
if [ ! -z $modconf ]; then
45
if [ -f /etc/rc.d/rc.modules ]; then
24
   # Initialize the permissions on $tmp so that we don't change the
46
  cp -p /etc/rc.d/rc.modules $tmp
25
   # permissions of $modconf when we mv it into place
47
  sed '/.*\(NVdriver\|nvidia\).*/d' < /etc/rc.d/rc.modules > $tmp
26
   cp -p $modconf $tmp
48
27
   sed '/^alias.*\(NVdriver\|nvidia\)/d'  < $modconf   > $tmp
49
  # make sure the last character in the file is a newline
28
   
50
  [ `tail -n 1 $tmp | wc -l` = 0 ] && echo "" >> $tmp
29
   # make sure the last character in the file is a newline
51
30
   [ `tail -n 1 $tmp | wc -l` = 0 ] && echo "" >> $tmp
52
  echo -e "\n/sbin/modprobe nvidia" >> $tmp
31
53
  mv -f $tmp /etc/rc.d/rc.modules
32
   if [ -c /dev/.devfsd ]; then
33
     echo "alias /dev/nvidia*   nvidia" >> $tmp
34
   else
35
     echo "alias char-major-195 nvidia" >> $tmp
36
   fi
37
   mv -f $tmp $modconf
38
   test -x /sbin/update-modules && /sbin/update-modules
39
else
40
  if [ -f /etc/rc.d/rc.modules ]; then
41
    # Initialize the permissions on $tmp so that we don't change the
42
    # permissions of /etc/rc.d/rc.modules when we mv it into place
43
    cp -p /etc/rc.d/rc.modules $tmp
44
    sed '/.*\(NVdriver\|nvidia\).*/d' < /etc/rc.d/rc.modules > $tmp
45
46
    # make sure the last character in the file is a newline
47
    [ `tail -n 1 $tmp | wc -l` = 0 ] && echo "" >> $tmp 
48
49
    echo "/sbin/modprobe nvidia" >> $tmp
50
    mv -f $tmp /etc/rc.d/rc.modules
51
  fi
52
fi
54
fi
53
55
54
if [ ! -c /dev/.devfsd ]; then
56
if [ ! -c /dev/.devfsd ]; then
(-)NVIDIA_kernel-1.0-5328/nv-linux.h (-87 / +173 lines)
Lines 21-54 Link Here
21
#  define MODVERSIONS
21
#  define MODVERSIONS
22
#endif
22
#endif
23
23
24
#if defined (MODVERSIONS)
25
#include <linux/modversions.h>
26
#endif
27
28
#include <linux/kernel.h>
24
#include <linux/kernel.h>
29
#include <linux/module.h>
25
#include <linux/module.h>
30
26
31
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 2, 12)
27
#if   LINUX_VERSION_CODE < KERNEL_VERSION(2, 3, 0)
32
#  error This driver does not support 2.2.11 or earlier kernels!
28
#  error This driver does not support 2.2.x kernels!
33
#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 3, 0)
34
#  define KERNEL_2_2
35
#  warning NVIDIA is considering dropping support for linux-2.2 
36
#  warning kernels. While end users are free to maintain their 
37
#  warning own patches, or stick with current drivers, our new 
38
#  warning drivers will not work "out of the box." If you are 
39
#  warning concerned about lack of support for 2.2 kernels, 
40
#  warning please let us know at linux-bugs@nvidia.com; we would
41
#  warning like to know how many users would be seriously 
42
#  warning impacted by this decision.
43
#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 0)
29
#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 0)
44
#  error This driver does not support 2.3.x development kernels!
30
#  error This driver does not support 2.3.x kernels!
45
#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
31
#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
46
#  define KERNEL_2_4
32
#  define KERNEL_2_4
47
#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
33
#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
48
#  error This driver does not support 2.5.x development kernels!
34
#  error This driver does not support 2.5.x kernels!
49
#  define KERNEL_2_5
35
#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 7, 0)
36
#  define KERNEL_2_6
50
#else
37
#else
51
#  error This driver does not support 2.6.x or newer kernels!
38
#  error This driver does not support development kernels!
52
#endif
39
#endif
53
40
54
#if defined (__ia64)
41
#if defined (__ia64)
Lines 61-72 Link Here
61
#define __SMP__
48
#define __SMP__
62
#endif
49
#endif
63
50
51
#if defined (MODVERSIONS) && !defined (KERNEL_2_6)
52
#include <linux/modversions.h>
53
#endif
54
64
#include <linux/types.h>            /* pic_t, size_t, __u32, etc        */
55
#include <linux/types.h>            /* pic_t, size_t, __u32, etc        */
65
#include <linux/errno.h>            /* error codes                      */
56
#include <linux/errno.h>            /* error codes                      */
66
#include <linux/list.h>             /* circular linked list             */
57
#include <linux/list.h>             /* circular linked list             */
67
#include <linux/stddef.h>           /* NULL, offsetof                   */
58
#include <linux/stddef.h>           /* NULL, offsetof                   */
68
#include <linux/wait.h>             /* wait queues                      */
59
#include <linux/wait.h>             /* wait queues                      */
69
#include <linux/tqueue.h>           /* struct tq_struct                 */
70
60
71
#include <linux/slab.h>             /* kmalloc, kfree, etc              */
61
#include <linux/slab.h>             /* kmalloc, kfree, etc              */
72
#include <linux/vmalloc.h>          /* vmalloc, vfree, etc              */
62
#include <linux/vmalloc.h>          /* vmalloc, vfree, etc              */
Lines 74-82 Link Here
74
#include <linux/poll.h>             /* poll_wait                        */
64
#include <linux/poll.h>             /* poll_wait                        */
75
#include <linux/delay.h>            /* mdelay, udelay                   */
65
#include <linux/delay.h>            /* mdelay, udelay                   */
76
66
67
#ifdef KERNEL_2_6
68
#include <linux/sched.h>            /* suser(), capable() replacement   */
69
#include <linux/moduleparam.h>      /* module_param()                   */
70
#include <linux/smp_lock.h>         /* kernel_locked                    */
71
#include <asm/kmap_types.h>         /* page table entry lookup          */
72
#endif
73
77
#include <linux/pci.h>              /* pci_find_class, etc              */
74
#include <linux/pci.h>              /* pci_find_class, etc              */
78
#include <linux/wrapper.h>          /* mem_map_reserve                  */
75
#include <linux/interrupt.h>        /* tasklets, interrupt helpers      */
79
#include <linux/interrupt.h>        /* mark_bh, init_bh, remove_bh      */
80
#include <linux/timer.h>
76
#include <linux/timer.h>
81
77
82
#include <asm/system.h>             /* cli, sli, save_flags             */
78
#include <asm/system.h>             /* cli, sli, save_flags             */
Lines 85-98 Link Here
85
#include <asm/page.h>               /* PAGE_OFFSET                      */
81
#include <asm/page.h>               /* PAGE_OFFSET                      */
86
#include <asm/pgtable.h>            /* pte bit definitions              */
82
#include <asm/pgtable.h>            /* pte bit definitions              */
87
83
88
#if !defined (KERNEL_2_2)
89
#include <linux/spinlock.h>
84
#include <linux/spinlock.h>
90
#include <asm/semaphore.h>
85
#include <asm/semaphore.h>
91
#include <linux/highmem.h>
86
#include <linux/highmem.h>
92
#else
93
#include <asm/spinlock.h>
94
#include <asm/semaphore.h>
95
#endif
96
87
97
#ifdef CONFIG_PROC_FS
88
#ifdef CONFIG_PROC_FS
98
#include <linux/proc_fs.h>
89
#include <linux/proc_fs.h>
Lines 377-454 Link Here
377
368
378
#endif /* !defined NVWATCH */
369
#endif /* !defined NVWATCH */
379
370
371
#define GET_MODULE_SYMBOL(mod,sym)      (const void *) inter_module_get(sym)
372
#define PUT_MODULE_SYMBOL(sym)          (inter_module_put((char *) sym))
380
373
381
#if !defined (KERNEL_2_2)
374
#ifdef KERNEL_2_6
382
#  define LINUX_VMA_OFFS(vma)           (((vma)->vm_pgoff) << PAGE_SHIFT)
375
# define NV_IS_SUSER()                  capable(CAP_SYS_ADMIN)
383
#  define GET_MODULE_SYMBOL(mod,sym)	(const void *) inter_module_get(sym)
376
# define NV_PCI_DEVICE_NAME(x)          ((x)->pretty_name)
384
#  define PUT_MODULE_SYMBOL(sym)        inter_module_put((char *) sym)
377
# define NV_CLI()                       local_irq_disable()
385
#  define GET_MAP_NR(phys_page)         virt_to_page(__va(phys_page))
378
# define NV_SAVE_FLAGS(x)               local_save_flags(x)
386
#  define MEM_MAP_READ_COUNT(map_nr)    (atomic_read(&(map_nr)->count))
379
# define NV_RESTORE_FLAGS(x)            local_irq_restore(x)
387
#  define MEM_MAP_INC_COUNT(map_nr)     (atomic_inc(&(map_nr)->count))
380
# define NV_MAY_SLEEP()                 (!in_interrupt() && !in_atomic())
388
#  define MEM_MAP_DEC_COUNT(map_nr)     (atomic_dec(&(map_nr)->count))
381
# define NV_SMP_NUM_CPUS                num_online_cpus()
389
#  define EVENT_QUEUE(ptr)               ((struct __wait_queue_head *)(ptr))
382
# define NV_MODULE_PARAMETER(x)         module_param(x, int, 0)
390
#  define VMA_PRIVATE(vma)              ((vma)->vm_private_data)
383
#else
391
#  define INIT_EVENT_QUEUE(ptr) \
384
# define NV_IS_SUSER()                  suser()
392
     if (ptr == NULL) { \
385
# define NV_PCI_DEVICE_NAME(x)          ((x)->name)
393
        NV_KMALLOC((ptr), sizeof(struct __wait_queue_head)); \
386
# define NV_CLI()                       cli()
394
        if (ptr) { \
387
# define NV_SAVE_FLAGS(x)               save_flags(x)
395
            memset((ptr), 0, sizeof(struct __wait_queue_head)); \
388
# define NV_RESTORE_FLAGS(x)            restore_flags(x)
396
            init_waitqueue_head((struct __wait_queue_head *)(ptr)); \
389
# define NV_MAY_SLEEP()                 (!in_interrupt())
397
        } \
390
# define NV_SMP_NUM_CPUS                smp_num_cpus
398
     }
391
# define NV_MODULE_PARAMETER(x)         MODULE_PARM(x, "i")
399
#  define FREE_EVENT_QUEUE(ptr)         NV_KFREE((ptr), sizeof(struct __wait_queue_head)); (ptr) = NULL;
392
#endif
400
#else
393
401
#  define in_irq()                      (local_irq_count[smp_processor_id()])
394
#define NV_DEVICE_NUMBER(x)             minor((x)->i_rdev)
402
#  define LINUX_VMA_OFFS(vma)           ((vma)->vm_offset)
395
#define NV_VMA_OFFSET(x)                (((x)->vm_pgoff) << PAGE_SHIFT)
403
#  define GET_MODULE_SYMBOL(mod, sym)   (void*) get_module_symbol((mod), (sym))
396
#define NV_VMA_PRIVATE(x)               ((x)->vm_private_data)
404
#  define PUT_MODULE_SYMBOL(sym)
397
#define NV_IS_CONTROL_DEVICE(x)         (minor((x)->i_rdev) == 255)
405
#  define GET_MAP_NR(phys_page)         MAP_NR(__va(phys_page))
398
406
#  define MEM_MAP_READ_COUNT(map_nr)    (atomic_read(&mem_map[map_nr].count))
399
#ifndef minor
407
#  define MEM_MAP_INC_COUNT(map_nr)     (atomic_inc(&mem_map[map_nr].count))
400
/*
408
#  define MEM_MAP_DEC_COUNT(map_nr)     (atomic_dec(&mem_map[map_nr].count))
401
 * XXX Is this correct for all possible target kernels? We need this to
409
#  define EVENT_QUEUE(ptr)              ((struct wait_queue **) &(ptr))
402
 * support older 2.4 and some 2.6 kernels.
410
#  define VMA_PRIVATE(vma)              ((void*)((vma)->vm_pte))
403
 */
411
#  define INIT_EVENT_QUEUE(ptr)         if (ptr) { ((ptr) = NULL); }
404
# define minor(x) MINOR(x)
412
#  define FREE_EVENT_QUEUE(ptr)
405
#endif
406
407
#ifndef KERNEL_2_6
408
  typedef void irqreturn_t;
409
# define IRQ_NONE
410
# define IRQ_RETVAL(x)
411
# define IRQ_HANDLED
412
#else
413
#ifdef AGPGART
414
  typedef struct agp_kern_info agp_kern_info;
415
  typedef struct agp_memory agp_memory;
416
#endif
417
  typedef void* devfs_handle_t;
418
#endif
419
420
#ifdef KERNEL_2_6
421
#define NV_DEVFS_REGISTER(_name, _minor)                            \
422
({                                                                  \
423
    devfs_handle_t __handle = NULL;                                 \
424
    devfs_mk_cdev(MKDEV(NV_MAJOR_DEVICE_NUMBER, _minor),            \
425
            S_IFCHR | S_IRUGO | S_IWUGO, _name);                    \
426
    __handle;                                                       \
427
})
428
429
#define NV_DEVFS_REMOVE_DEVICE(i) devfs_remove("nvidia%d", i)
430
#define NV_DEVFS_REMOVE_CONTROL() devfs_remove("nvidiactl")
431
#else
432
#define NV_DEVFS_REGISTER(_name, _minor)                            \
433
({                                                                  \
434
    devfs_handle_t __handle =                                       \
435
        devfs_register(NULL, _name, DEVFS_FL_DEFAULT,               \
436
                NV_MAJOR_DEVICE_NUMBER, _minor,                     \
437
                S_IFCHR | S_IRUGO | S_IWUGO, &nv_fops, NULL);       \
438
    __handle;                                                       \
439
 })
440
441
#define NV_DEVFS_REMOVE_DEVICE(i) devfs_unregister(nv_devfs_handles[i+1])
442
#define NV_DEVFS_REMOVE_CONTROL() devfs_unregister(nv_devfs_handles[0])
413
#endif
443
#endif
414
444
445
/*
446
 * Linux 2.5 introduced the five argument version of remap_page_range, all
447
 * relevant releases to date use it. This version was backported to 2.4 by
448
 * RedHat without means to identify the change, hence this hack.
449
 */
450
#ifdef KERNEL_2_6
451
#define NV_REMAP_PAGE_RANGE(a, b...) remap_page_range(vma, a, ## b)
452
#else
415
#if defined(REMAP_PAGE_RANGE_5)
453
#if defined(REMAP_PAGE_RANGE_5)
416
#define NV_REMAP_PAGE_RANGE(a, b...)    remap_page_range(vma, a, ## b)
454
#define NV_REMAP_PAGE_RANGE(a, b...) remap_page_range(vma, a, ## b)
417
#elif defined(REMAP_PAGE_RANGE_4)
455
#elif defined(REMAP_PAGE_RANGE_4)
418
#define NV_REMAP_PAGE_RANGE(a, b...)    remap_page_range(a, ## b)
456
#define NV_REMAP_PAGE_RANGE(a, b...) remap_page_range(a, ## b)
419
#else
457
#else
420
#error "Couldn't determine number of arguments expected by remap_page_range!"
458
#warning "conftest.sh failed, assuming old Linux 2.4 remap_page_range(4)!"
459
460
#define NV_REMAP_PAGE_RANGE(a, b...) remap_page_range(a, ## b)
421
#endif
461
#endif
462
#endif /* KERNEL_2_6 */
422
463
423
#if defined(pte_offset_atomic)
464
#if defined(pmd_offset_map)
424
#define NV_PTE_OFFSET(addres, pg_mid_dir, pte) \
465
#define NV_PMD_OFFSET(address, pgd, pmd) \
466
    { \
467
        pmd = pmd_offset_map(pgd, address); \
468
    }
469
#define NV_PMD_UNMAP(pmd) \
425
    { \
470
    { \
426
        pte_t *pte__ = pte_offset_atomic(pg_mid_dir, address); \
471
        pmd_unmap(pmd); \
427
        pte = *pte__; \
428
        pte_kunmap(pte__); \
429
    }
472
    }
430
#elif defined(pte_offset)
431
#define NV_PTE_OFFSET(addres, pg_mid_dir, pte) \
432
    pte = *pte_offset(pg_mid_dir, address)
433
#else
473
#else
434
#define NV_PTE_OFFSET(addres, pg_mid_dir, pte) \
474
#define NV_PMD_OFFSET(address, pgd, pmd) \
435
    { \
475
    { \
436
        pte_t *pte__ = pte_offset_map(pg_mid_dir, address); \
476
        pmd = pmd_offset(pgd, address); \
437
        pte = *pte__; \
438
        pte_unmap(pte__); \
439
    }
477
    }
478
#define NV_PMD_UNMAP(pmd)
440
#endif
479
#endif
441
480
442
#define NV_PAGE_ALIGN(addr)             ( ((addr) + PAGE_SIZE - 1) / PAGE_SIZE)
481
#define NV_PMD_PRESENT(pmd) \
443
#define NV_MASK_OFFSET(addr)            ( (addr) & (PAGE_SIZE - 1) )
482
    ({ \
483
        if (pmd) { \
484
            if (pmd_none(*pmd)) { \
485
                NV_PMD_UNMAP(pmd); pmd = NULL; \
486
            } \
487
        } pmd != NULL; \
488
    })
444
489
445
#ifndef MAXMEM  /* temporary define for 2.2 kernels */
490
#if defined (pte_offset_atomic)
446
#define MAXMEM  (-PAGE_OFFSET - (64 * 1024 * 1024))
491
#define NV_PTE_OFFSET(address, pmd, pte) \
492
    { \
493
        pte = pte_offset_atomic(pmd, address); \
494
        NV_PMD_UNMAP(pmd); \
495
    }
496
#define NV_PTE_UNMAP(pte) \
497
    { \
498
        pte_kunmap(pte); \
499
    }
500
#elif defined (pte_offset)
501
#define NV_PTE_OFFSET(address, pmd, pte) \
502
    { \
503
        pte = pte_offset(pmd, address); \
504
        NV_PMD_UNMAP(pmd); \
505
    }
506
#define NV_PTE_UNMAP(pte)
507
#else
508
#define NV_PTE_OFFSET(address, pmd, pte) \
509
    { \
510
        pte = pte_offset_map(pmd, address); \
511
        NV_PMD_UNMAP(pmd); \
512
    }
513
#define NV_PTE_UNMAP(pte) \
514
    { \
515
        pte_unmap(pte); \
516
    }
447
#endif
517
#endif
448
518
449
#ifndef NV01_ROOT
519
#define NV_PTE_PRESENT(pte) \
450
#define NV01_ROOT 0x00000000
520
    ({ \
451
#endif 
521
        if (pte) { \
522
            if (!pte_present(*pte)) { \
523
                NV_PTE_UNMAP(pte); pte = NULL; \
524
            } \
525
        } pte != NULL; \
526
    })
527
528
#define NV_PTE_VALUE(pte) \
529
    ({ \
530
        unsigned long __pte_value = pte_val(*pte); \
531
        NV_PTE_UNMAP(pte); \
532
        __pte_value; \
533
    })
534
535
#define NV_PAGE_ALIGN(addr)             ( ((addr) + PAGE_SIZE - 1) / PAGE_SIZE)
536
#define NV_MASK_OFFSET(addr)            ( (addr) & (PAGE_SIZE - 1) )
452
537
453
#if defined(NVCPU_IA64)
538
#if defined(NVCPU_IA64)
454
#define NV_GFP_HW (GFP_KERNEL | __GFP_DMA)
539
#define NV_GFP_HW (GFP_KERNEL | __GFP_DMA)
Lines 475-481 Link Here
475
static inline int NV_IRQL_IS_RAISED()
560
static inline int NV_IRQL_IS_RAISED()
476
    {
561
    {
477
        unsigned long int eflags;
562
        unsigned long int eflags;
478
        __save_flags(eflags);
563
        NV_SAVE_FLAGS(eflags);
479
        return !(eflags & NV_CPU_INTERRUPT_FLAGS_BIT);
564
        return !(eflags & NV_CPU_INTERRUPT_FLAGS_BIT);
480
    }
565
    }
481
 
566
 
Lines 557-565 Link Here
557
    struct pci_dev *dev;
642
    struct pci_dev *dev;
558
    nv_alloc_t *alloc_queue;
643
    nv_alloc_t *alloc_queue;
559
644
560
    // bottom half interrupt handler info; per device
645
     /* keep track of any pending bottom halfes */
561
    /* keep track of any pending bottom-halves */
646
     struct tasklet_struct tasklet;
562
    struct tq_struct *bh;
647
648
     /* active bottom half counter */
563
    atomic_t bh_count;
649
    atomic_t bh_count;
564
650
565
    /* get a timer callback every second */
651
    /* get a timer callback every second */
Lines 597-603 Link Here
597
    U032 num_events;
683
    U032 num_events;
598
    U032 put, get;
684
    U032 put, get;
599
    spinlock_t fp_lock;
685
    spinlock_t fp_lock;
600
    void *wqueue;               // wait_queue for polling
686
    wait_queue_head_t waitqueue;
601
    nv_event_t *event_fifo;     // fifo for storing events
687
    nv_event_t *event_fifo;     // fifo for storing events
602
} nv_file_private_t;
688
} nv_file_private_t;
603
689
(-)NVIDIA_kernel-1.0-5328/nv.c (-172 / +126 lines)
Lines 15-20 Link Here
15
#include "nv_compiler.h"
15
#include "nv_compiler.h"
16
#include "os-agp.h"
16
#include "os-agp.h"
17
17
18
MODULE_LICENSE("NVIDIA");
18
19
19
/*
20
/*
20
 * our global state; one per device
21
 * our global state; one per device
Lines 33-64 Link Here
33
 */
34
 */
34
35
35
nv_linux_state_t nv_ctl_device = { { 0 } };
36
nv_linux_state_t nv_ctl_device = { { 0 } };
36
void *nv_ctl_wqueue = NULL;
37
wait_queue_head_t nv_ctl_waitqueue;
37
38
38
// keep track of opened clients and their process id so they
39
// keep track of opened clients and their process id so they
39
//   can be free'd up on abnormal close
40
//   can be free'd up on abnormal close
40
nv_client_t       nv_clients[NV_MAX_CLIENTS];
41
nv_client_t       nv_clients[NV_MAX_CLIENTS];
41
struct tq_struct  nv_bottom_halves[NV_MAX_CLIENTS];
42
42
43
#ifdef CONFIG_PROC_FS
43
#ifdef CONFIG_PROC_FS
44
struct proc_dir_entry *proc_nvidia;
44
struct proc_dir_entry *proc_nvidia;
45
#endif
45
#endif
46
46
47
#ifdef CONFIG_DEVFS_FS
47
#ifdef CONFIG_DEVFS_FS
48
devfs_handle_t  nv_dev_handle[NV_MAX_DEVICES];
48
devfs_handle_t nv_devfs_handles[NV_MAX_DEVICES+1];
49
devfs_handle_t  nv_ctl_handle;
50
#endif
49
#endif
51
50
52
/*
53
 * pick apart our minor device number
54
 * low 3 bits is NV device
55
 * if 255, then its the control device
56
 */
57
58
#define NV_DEVICE_NUMBER(_minor) ((_minor) & 0x0f)
59
#define NV_DEVICE_IS_CONTROL_DEVICE(_minor) \
60
             (((_minor) & 0xFF) == 0xFF)
61
62
// #define NV_DBG_MEM 1
51
// #define NV_DBG_MEM 1
63
#undef NV_DBG_MEM
52
#undef NV_DBG_MEM
64
53
Lines 121-130 Link Here
121
 *** EXPORTS to Linux Kernel
110
 *** EXPORTS to Linux Kernel
122
 ***/
111
 ***/
123
112
124
/* linux module interface functions (called by linux kernel) */
125
int           init_module(void);
126
void          cleanup_module(void);
127
128
/* nv_kern_ functions, interfaces used by linux kernel */
113
/* nv_kern_ functions, interfaces used by linux kernel */
129
void          nv_kern_vma_open(struct vm_area_struct *vma);
114
void          nv_kern_vma_open(struct vm_area_struct *vma);
130
void          nv_kern_vma_release(struct vm_area_struct *vma);
115
void          nv_kern_vma_release(struct vm_area_struct *vma);
Lines 135-141 Link Here
135
unsigned int  nv_kern_poll(struct file *, poll_table *);
120
unsigned int  nv_kern_poll(struct file *, poll_table *);
136
int           nv_kern_ioctl(struct inode *, struct file *, unsigned int, unsigned long);
121
int           nv_kern_ioctl(struct inode *, struct file *, unsigned int, unsigned long);
137
void          nv_kern_bh(void *);
122
void          nv_kern_bh(void *);
138
void          nv_kern_isr(int, void *, struct pt_regs *);
123
irqreturn_t   nv_kern_isr(int, void *, struct pt_regs *);
139
void          nv_kern_rc_timer(unsigned long);
124
void          nv_kern_rc_timer(unsigned long);
140
#ifdef CONFIG_PM
125
#ifdef CONFIG_PM
141
int           nv_kern_pm(struct pm_dev *dev, pm_request_t rqst, void *data);
126
int           nv_kern_pm(struct pm_dev *dev, pm_request_t rqst, void *data);
Lines 158-163 Link Here
158
/* character driver entry points */
143
/* character driver entry points */
159
144
160
static struct file_operations nv_fops = {
145
static struct file_operations nv_fops = {
146
    owner:          THIS_MODULE,
161
    poll:           nv_kern_poll,
147
    poll:           nv_kern_poll,
162
    ioctl:          nv_kern_ioctl,
148
    ioctl:          nv_kern_ioctl,
163
    mmap:           nv_kern_mmap,
149
    mmap:           nv_kern_mmap,
Lines 329-336 Link Here
329
    {
315
    {
330
        nv_printf(NV_DBG_MEMINFO, "  0x%x (0x%x): count %d flags 0x%x\n", 
316
        nv_printf(NV_DBG_MEMINFO, "  0x%x (0x%x): count %d flags 0x%x\n", 
331
            page_ptr->phys_addr, page_ptr->dma_addr,
317
            page_ptr->phys_addr, page_ptr->dma_addr,
332
            (GET_MAP_NR(page_ptr->phys_addr))->count,
318
            (virt_to_page(__va(page_ptr->phys_addr)))->count,
333
            (GET_MAP_NR(page_ptr->phys_addr))->flags);
319
            (virt_to_page(__va(page_ptr->phys_addr)))->flags);
334
        num_pages--;
320
        num_pages--;
335
        page_ptr++;
321
        page_ptr++;
336
    }
322
    }
Lines 401-407 Link Here
401
        phys_addr = virt_to_phys((void *) virt_addr);
387
        phys_addr = virt_to_phys((void *) virt_addr);
402
388
403
        /* lock the page for dma purposes */
389
        /* lock the page for dma purposes */
404
        mem_map_reserve(GET_MAP_NR(phys_addr));
390
        SetPageReserved(virt_to_page(__va(phys_addr)));
405
391
406
        page_ptr->phys_addr = phys_addr;
392
        page_ptr->phys_addr = phys_addr;
407
        page_ptr->virt_addr = virt_addr;
393
        page_ptr->virt_addr = virt_addr;
Lines 447-453 Link Here
447
        // but if we failed pci_map_sg, make sure to free this page
433
        // but if we failed pci_map_sg, make sure to free this page
448
        if (page_ptr->virt_addr)
434
        if (page_ptr->virt_addr)
449
        {
435
        {
450
            mem_map_unreserve(GET_MAP_NR(page_ptr->phys_addr));
436
            ClearPageReserved(virt_to_page(__va(page_ptr->phys_addr)));
451
            NV_SET_PAGE_ATTRIB_CACHED(page_ptr);
437
            NV_SET_PAGE_ATTRIB_CACHED(page_ptr);
452
#if defined(NVCPU_X86_64)
438
#if defined(NVCPU_X86_64)
453
            // only unmap the page if it really was mapped through
439
            // only unmap the page if it really was mapped through
Lines 481-487 Link Here
481
467
482
    while (pages_left)
468
    while (pages_left)
483
    {
469
    {
484
        mem_map_unreserve(GET_MAP_NR(page_ptr->phys_addr));
470
        ClearPageReserved(virt_to_page(__va(page_ptr->phys_addr)));
485
        page_ptr++;
471
        page_ptr++;
486
        pages_left--;
472
        pages_left--;
487
    }
473
    }
Lines 674-684 Link Here
674
    nv_linux_state_t *nvl;
660
    nv_linux_state_t *nvl;
675
    nv_linux_state_t *nv_max_devices;
661
    nv_linux_state_t *nv_max_devices;
676
662
677
#if defined (KERNEL_2_2)
678
    struct proc_dir_entry *proc_root_driver;
679
    proc_root_driver = create_proc_entry("driver", flags, &proc_root);
680
#endif
681
682
    proc_nvidia = create_proc_entry("nvidia", flags, proc_root_driver);
663
    proc_nvidia = create_proc_entry("nvidia", flags, proc_root_driver);
683
    proc_nvidia_cards = create_proc_entry("cards", flags, proc_nvidia);
664
    proc_nvidia_cards = create_proc_entry("cards", flags, proc_nvidia);
684
    proc_nvidia_agp = create_proc_entry("agp", flags, proc_nvidia);
665
    proc_nvidia_agp = create_proc_entry("agp", flags, proc_nvidia);
Lines 740-748 Link Here
740
{
721
{
741
#ifdef CONFIG_PROC_FS
722
#ifdef CONFIG_PROC_FS
742
    nvos_proc_remove_all(proc_nvidia);
723
    nvos_proc_remove_all(proc_nvidia);
743
#if defined (KERNEL_2_2)
744
    remove_proc_entry("driver", &proc_root);
745
#endif
746
#endif
724
#endif
747
}
725
}
748
726
Lines 831-839 Link Here
831
 *** EXPORTS to Linux Kernel
809
 *** EXPORTS to Linux Kernel
832
 ***/
810
 ***/
833
811
834
int init_module(void)
812
static int __init nvidia_init_module(void)
835
{
813
{
836
    nv_linux_state_t *nvl;
837
    int rc, i;
814
    int rc, i;
838
815
839
    memset(nv_linux_devices, 0, sizeof(nv_linux_devices));
816
    memset(nv_linux_devices, 0, sizeof(nv_linux_devices));
Lines 846-852 Link Here
846
823
847
    nv_printf(NV_DBG_ERRORS, "nvidia: loading %s\n", pNVRM_ID);
824
    nv_printf(NV_DBG_ERRORS, "nvidia: loading %s\n", pNVRM_ID);
848
825
849
#ifdef CONFIG_DEVFS_FS
826
#if defined(CONFIG_DEVFS_FS) && !defined(KERNEL_2_6)
850
    rc = devfs_register_chrdev(nv_major, "nvidia", &nv_fops);
827
    rc = devfs_register_chrdev(nv_major, "nvidia", &nv_fops);
851
#else
828
#else
852
    rc = register_chrdev(nv_major, "nvidia", &nv_fops);
829
    rc = register_chrdev(nv_major, "nvidia", &nv_fops);
Lines 858-891 Link Here
858
    }
835
    }
859
836
860
#ifdef CONFIG_DEVFS_FS
837
#ifdef CONFIG_DEVFS_FS
861
    memset(nv_dev_handle, 0, sizeof(devfs_handle_t) * NV_MAX_DEVICES);
862
    do {
838
    do {
839
        /*
840
         * XXX This code isn't pretty, but neither is dealing with the
841
         * various Linux devfs implemenation(s). While Linux APIs are
842
         * known to be anything but stable and oftentimes anything but
843
         * well designed, the devfs interface has been more painful to
844
         * deal with than most other APIs.
845
         */
863
        char name[10];
846
        char name[10];
864
847
865
        nv_ctl_handle = devfs_register(NULL, "nvidiactl",
848
        nv_devfs_handles[0] = NV_DEVFS_REGISTER("nvidiactl", 255);
866
                            DEVFS_FL_DEFAULT, nv_major, 255,
867
                            S_IFCHR | S_IRUGO | S_IWUGO,
868
                            &nv_fops, NULL);
869
849
870
        for (i = 0; i < num_nv_devices; i++) {
850
        for (i = 0; i < num_nv_devices; i++) {
871
            sprintf(name, "nvidia%d", i);
851
            sprintf(name, "nvidia%d", i);
872
            nv_dev_handle[i] = devfs_register(NULL, name,
852
            nv_devfs_handles[i+1] = NV_DEVFS_REGISTER(name, i);
873
                                  DEVFS_FL_DEFAULT, nv_major, i,
874
                                  S_IFCHR | S_IRUGO | S_IWUGO,
875
                                  &nv_fops, NULL);
876
        }
853
        }
877
    } while(0);
854
    } while(0);
878
#endif
855
#endif
879
856
880
    nv_printf(NV_DBG_INFO, "init_module: major number %d\n", nv_major);
857
    nv_printf(NV_DBG_INFO, "nvidia_init_module: major number %d\n", nv_major);
881
858
882
    // init all the bottom half structures
859
    /* instantiate tasklets */
883
    for (nvl = nv_linux_devices; nvl < nv_linux_devices + NV_MAX_DEVICES; nvl++)
860
    for (i = 0; i < NV_MAX_DEVICES; i++) {
884
    {
861
        /*
885
        nvl->bh = &nv_bottom_halves[nvl - nv_linux_devices];
862
         * We keep one tasklet per card to avoid latency issues with more
886
        nvl->bh->routine = nv_kern_bh;
863
         * than one device; no two instances of a single tasklet are ever
887
        nvl->bh->data = (void *) nvl;
864
         * executed concurrently.
888
        nvl->bh->sync = 0;
865
         */
866
        atomic_set(&nv_linux_devices[i].tasklet.count, 1);
889
    }
867
    }
890
868
891
    // init the nvidia control device
869
    // init the nvidia control device
Lines 893-898 Link Here
893
        nv_state_t *nv_ctl = NV_STATE_PTR(&nv_ctl_device);
871
        nv_state_t *nv_ctl = NV_STATE_PTR(&nv_ctl_device);
894
        nv_ctl->os_state = (void *) &nv_ctl_device;
872
        nv_ctl->os_state = (void *) &nv_ctl_device;
895
        nv_lock_init_locks(nv_ctl);
873
        nv_lock_init_locks(nv_ctl);
874
        init_waitqueue_head(&nv_ctl_waitqueue);
896
    }
875
    }
897
876
898
#ifdef CONFIG_PM
877
#ifdef CONFIG_PM
Lines 919-932 Link Here
919
    /* create /proc/driver/nvidia */
898
    /* create /proc/driver/nvidia */
920
    nvos_proc_create();
899
    nvos_proc_create();
921
900
922
#if defined(DEBUG) && !defined(KERNEL_2_2)
901
#if defined(DEBUG)
923
    inter_module_register("nv_linux_devices", THIS_MODULE, nv_linux_devices);
902
    inter_module_register("nv_linux_devices", THIS_MODULE, nv_linux_devices);
924
#endif
903
#endif
925
904
926
    return 0;
905
    return 0;
927
906
928
 failed:
907
 failed:
929
#ifdef CONFIG_DEVFS_FS
908
#if defined(CONFIG_DEVFS_FS) && !defined(KERNEL_2_6)
930
    devfs_unregister_chrdev(nv_major, "nvidia");
909
    devfs_unregister_chrdev(nv_major, "nvidia");
931
#else
910
#else
932
    unregister_chrdev(nv_major, "nvidia");
911
    unregister_chrdev(nv_major, "nvidia");
Lines 934-959 Link Here
934
    return rc;
913
    return rc;
935
}
914
}
936
915
937
void cleanup_module(void)
916
static void __exit nvidia_exit_module(void)
938
{
917
{
939
    int rc, i;
918
    int rc;
940
    nv_linux_state_t *nvl;
919
    nv_linux_state_t *nvl, *max_devices;
941
    nv_linux_state_t *max_devices;
942
920
943
    /* remove /proc/driver/nvidia */
921
    /* remove /proc/driver/nvidia */
944
    nvos_proc_remove();
922
    nvos_proc_remove();
945
923
946
    nv_printf(NV_DBG_INFO, "cleanup_module\n");
924
    nv_printf(NV_DBG_INFO, "nvidia_exit_module\n");
947
925
948
#if defined(DEBUG) && !defined(KERNEL_2_2)
926
#if defined(DEBUG)
949
    inter_module_unregister("nv_linux_devices");
927
    inter_module_unregister("nv_linux_devices");
950
#endif
928
#endif
951
929
952
#ifdef CONFIG_PM
930
#ifdef CONFIG_PM
953
    for (i = 0; i < num_nv_devices; i++)
931
    do {
954
    {
932
        int i;
955
        pm_unregister(pm_nv_dev[i]);
933
        for (i = 0; i < num_nv_devices; i++) {
956
    }
934
            pm_unregister(pm_nv_dev[i]);
935
        }
936
    } while (0);
957
#endif
937
#endif
958
938
959
    // Shutdown the resource manager
939
    // Shutdown the resource manager
Lines 972-1001 Link Here
972
                continue;
952
                continue;
973
953
974
            nv_printf(NV_DBG_ERRORS,
954
            nv_printf(NV_DBG_ERRORS,
975
                    "still have vm que at cleanup_module(): 0x%x to 0x%x\n",
955
                    "still have vm que at nvidia_exit_module(): 0x%x to 0x%x\n",
976
                    nvl->alloc_queue->vma->vm_start,
956
                    nvl->alloc_queue->vma->vm_start,
977
                    nvl->alloc_queue->vma->vm_end);
957
                    nvl->alloc_queue->vma->vm_end);
978
        }
958
        }
979
    }
959
    }
980
960
981
#ifdef CONFIG_DEVFS_FS
961
#if defined(CONFIG_DEVFS_FS) && !defined(KERNEL_2_6)
982
    rc = devfs_unregister_chrdev(nv_major, "nvidia");
962
    rc = devfs_unregister_chrdev(nv_major, "nvidia");
983
#else
963
#else
984
    rc = unregister_chrdev(nv_major, "nvidia");
964
    rc = unregister_chrdev(nv_major, "nvidia");
985
#endif
965
#endif
986
966
987
    if (rc < 0) {
967
    if (rc < 0) {
988
        nv_printf(NV_DBG_ERRORS, "cleanup_module: unregister nv failed\n");
968
        nv_printf(NV_DBG_ERRORS, "nvidia_exit_module: unregister nv failed\n");
989
    }
969
    }
990
970
991
#ifdef CONFIG_DEVFS_FS
971
#ifdef CONFIG_DEVFS_FS
992
    do {
972
    do {
993
        int i;
973
        int i;
994
        for (i = 0; nv_dev_handle[i] != 0; i++) {
974
        NV_DEVFS_REMOVE_CONTROL();
995
            devfs_unregister(nv_dev_handle[i]);
975
        for (i = 0; i < num_nv_devices; i++)
996
        }
976
            NV_DEVFS_REMOVE_DEVICE(i);
997
    } while(0);
977
    } while (0);
998
    devfs_unregister(nv_ctl_handle);
999
#endif
978
#endif
1000
979
1001
#if NV_ENABLE_MEM_TRACKING
980
#if NV_ENABLE_MEM_TRACKING
Lines 1007-1012 Link Here
1007
#endif
986
#endif
1008
}
987
}
1009
988
989
module_init(nvidia_init_module);
990
module_exit(nvidia_exit_module);
1010
991
1011
/* this is only called when the vmas are duplicated.
992
/* this is only called when the vmas are duplicated.
1012
 * this appears to only happen when the process is cloned to create
993
 * this appears to only happen when the process is cloned to create
Lines 1020-1030 Link Here
1020
nv_kern_vma_open(struct vm_area_struct *vma)
1001
nv_kern_vma_open(struct vm_area_struct *vma)
1021
{
1002
{
1022
    nv_printf(NV_DBG_MEMINFO, "vma_open for 0x%x - 0x%x, offset 0x%x\n",
1003
    nv_printf(NV_DBG_MEMINFO, "vma_open for 0x%x - 0x%x, offset 0x%x\n",
1023
        vma->vm_start, vma->vm_end, LINUX_VMA_OFFS(vma));
1004
        vma->vm_start, vma->vm_end, NV_VMA_OFFSET(vma));
1024
1005
1025
    if (VMA_PRIVATE(vma))
1006
    if (NV_VMA_PRIVATE(vma))
1026
    {
1007
    {
1027
        nv_alloc_t *at = (nv_alloc_t *) VMA_PRIVATE(vma);
1008
        nv_alloc_t *at = (nv_alloc_t *) NV_VMA_PRIVATE(vma);
1028
        at->usage_count++;
1009
        at->usage_count++;
1029
1010
1030
        nv_printf(NV_DBG_MEMINFO, "  at 0x%x, usage count %d, page_table 0x%x\n",
1011
        nv_printf(NV_DBG_MEMINFO, "  at 0x%x, usage count %d, page_table 0x%x\n",
Lines 1032-1039 Link Here
1032
1013
1033
        nvos_list_page_count(at->page_table, at->num_pages);
1014
        nvos_list_page_count(at->page_table, at->num_pages);
1034
    }
1015
    }
1035
1036
    MOD_INC_USE_COUNT;
1037
}
1016
}
1038
1017
1039
1018
Lines 1041-1051 Link Here
1041
nv_kern_vma_release(struct vm_area_struct *vma)
1020
nv_kern_vma_release(struct vm_area_struct *vma)
1042
{
1021
{
1043
    nv_printf(NV_DBG_MEMINFO, "vma_release for 0x%x - 0x%x, offset 0x%x\n",
1022
    nv_printf(NV_DBG_MEMINFO, "vma_release for 0x%x - 0x%x, offset 0x%x\n",
1044
        vma->vm_start, vma->vm_end, LINUX_VMA_OFFS(vma));
1023
        vma->vm_start, vma->vm_end, NV_VMA_OFFSET(vma));
1045
1024
1046
    if (VMA_PRIVATE(vma))
1025
    if (NV_VMA_PRIVATE(vma))
1047
    {
1026
    {
1048
        nv_alloc_t *at = (nv_alloc_t *) VMA_PRIVATE(vma);
1027
        nv_alloc_t *at = (nv_alloc_t *) NV_VMA_PRIVATE(vma);
1049
1028
1050
        at->usage_count--;
1029
        at->usage_count--;
1051
1030
Lines 1063-1097 Link Here
1063
            if (at->page_table)
1042
            if (at->page_table)
1064
                nvos_unlock_pages(at);
1043
                nvos_unlock_pages(at);
1065
            nvos_free_alloc(at);
1044
            nvos_free_alloc(at);
1066
            VMA_PRIVATE(vma) = NULL;
1045
            NV_VMA_PRIVATE(vma) = NULL;
1067
        }
1046
        }
1068
    }
1047
    }
1069
1070
    MOD_DEC_USE_COUNT;
1071
}
1048
}
1072
1049
1073
1050
1074
/* at this point, this code just plain won't work with 2.2 kernels.
1075
 * additionally, only ia64 & the 460GX need a nopage handler, and 2.2 doesn't
1076
 * work on ia64 anyways. It's expected that at some point other agp chipsets
1077
 * will work similar to the 460GX (AGP 3.0 spec), so pre-emptively make sure
1078
 * this works on our standard ia32 driver.
1079
 */
1080
#if !defined(KERNEL_2_2)
1081
1082
/* AGP allocations under the 460GX are not mapped to the aperture
1051
/* AGP allocations under the 460GX are not mapped to the aperture
1083
 * addresses by the CPU.  This nopage handler will fault on CPU
1052
 * addresses by the CPU.  This nopage handler will fault on CPU
1084
 * accesses to AGP memory and map the address to the correct page.
1053
 * accesses to AGP memory and map the address to the correct page.
1085
 */
1054
 */
1086
struct page *nv_kern_vma_nopage(struct vm_area_struct *vma, unsigned long address, int write_access)
1055
struct page *nv_kern_vma_nopage(struct vm_area_struct *vma, unsigned long address, int write_access)
1087
{
1056
{
1057
#if defined(NVCPU_IA64) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 9))
1088
    nv_alloc_t *at, *tmp;
1058
    nv_alloc_t *at, *tmp;
1089
    nv_linux_state_t *nvl;
1059
    nv_linux_state_t *nvl;
1090
    nv_state_t *nv;
1060
    nv_state_t *nv;
1091
    struct page *page_ptr;
1061
    struct page *page_ptr;
1092
    int rm_status, index;
1062
    int rm_status, index;
1093
1063
1094
    at = VMA_PRIVATE(vma);
1064
    at = NV_VMA_PRIVATE(vma);
1095
    if (at == NULL)
1065
    if (at == NULL)
1096
    {
1066
    {
1097
        nv_printf(NV_DBG_ERRORS, "NVRM: nopage handler called without an at: "
1067
        nv_printf(NV_DBG_ERRORS, "NVRM: nopage handler called without an at: "
Lines 1130-1136 Link Here
1130
        // far again
1100
        // far again
1131
        nv_printf(NV_DBG_ERRORS, "NVRM: nopage handler called on a freed"
1101
        nv_printf(NV_DBG_ERRORS, "NVRM: nopage handler called on a freed"
1132
                  "address: vm_start 0x%x, at 0x%x\n", vma->vm_start, at);
1102
                  "address: vm_start 0x%x, at 0x%x\n", vma->vm_start, at);
1133
        VMA_PRIVATE(vma) = NULL;
1103
        NV_VMA_PRIVATE(vma) = NULL;
1134
        return NOPAGE_SIGBUS;
1104
        return NOPAGE_SIGBUS;
1135
    }
1105
    }
1136
1106
Lines 1154-1168 Link Here
1154
    at->page_table[index].virt_addr = (unsigned long) __va(page_to_pfn(page_ptr) << PAGE_SHIFT);
1124
    at->page_table[index].virt_addr = (unsigned long) __va(page_to_pfn(page_ptr) << PAGE_SHIFT);
1155
1125
1156
    return page_ptr;
1126
    return page_ptr;
1157
}
1158
#endif
1127
#endif
1128
    return NOPAGE_SIGBUS;
1129
}
1159
1130
1160
struct vm_operations_struct nv_vm_ops = {
1131
struct vm_operations_struct nv_vm_ops = {
1161
    nv_kern_vma_open,
1132
    nv_kern_vma_open,
1162
    nv_kern_vma_release,  /* "close" */
1133
    nv_kern_vma_release,  /* "close" */
1163
#if !defined(KERNEL_2_2)
1164
    nv_kern_vma_nopage,
1134
    nv_kern_vma_nopage,
1165
#endif
1166
};
1135
};
1167
1136
1168
static nv_file_private_t *
1137
static nv_file_private_t *
Lines 1177-1183 Link Here
1177
    memset(nvfp, 0, sizeof(nv_file_private_t));
1146
    memset(nvfp, 0, sizeof(nv_file_private_t));
1178
1147
1179
    // initialize this file's event queue
1148
    // initialize this file's event queue
1180
    INIT_EVENT_QUEUE(nvfp->wqueue);
1149
    init_waitqueue_head(&nvfp->waitqueue);
1181
1150
1182
    nv_init_lock(nvfp->fp_lock);
1151
    nv_init_lock(nvfp->fp_lock);
1183
1152
Lines 1197-1203 Link Here
1197
    if (nvfp == NULL)
1166
    if (nvfp == NULL)
1198
        return;
1167
        return;
1199
1168
1200
    FREE_EVENT_QUEUE(nvfp->wqueue);
1201
    NV_VFREE(nvfp->event_fifo, sizeof(nv_event_t) * NV_EVENT_FIFO_SIZE);
1169
    NV_VFREE(nvfp->event_fifo, sizeof(nv_event_t) * NV_EVENT_FIFO_SIZE);
1202
    NV_VFREE(nvfp, sizeof(nv_file_private_t));
1170
    NV_VFREE(nvfp, sizeof(nv_file_private_t));
1203
}
1171
}
Lines 1226-1236 Link Here
1226
1194
1227
    /* for control device, just jump to its open routine */
1195
    /* for control device, just jump to its open routine */
1228
    /* after setting up the private data */
1196
    /* after setting up the private data */
1229
    if (NV_DEVICE_IS_CONTROL_DEVICE(inode->i_rdev))
1197
    if (NV_IS_CONTROL_DEVICE(inode))
1230
        return nv_kern_ctl_open(inode, file);
1198
        return nv_kern_ctl_open(inode, file);
1231
1199
1232
    /* what device are we talking about? */
1200
    /* what device are we talking about? */
1233
    devnum = NV_DEVICE_NUMBER(inode->i_rdev);
1201
    devnum = NV_DEVICE_NUMBER(inode);
1234
    if (devnum >= NV_MAX_DEVICES)
1202
    if (devnum >= NV_MAX_DEVICES)
1235
    {
1203
    {
1236
        rc = -ENODEV;
1204
        rc = -ENODEV;
Lines 1283-1294 Link Here
1283
            goto failed;
1251
            goto failed;
1284
        }
1252
        }
1285
1253
1254
        nvl->tasklet.func = (void *) rm_isr_bh;
1255
        nvl->tasklet.data = (unsigned long) nv->pdev;
1256
        tasklet_enable(&nvl->tasklet);
1286
1257
1287
        nv->flags |= NV_FLAG_OPEN;
1258
        nv->flags |= NV_FLAG_OPEN;
1288
    }
1259
    }
1289
1260
1290
    nv->usage_count++;
1261
    nv->usage_count++;
1291
    MOD_INC_USE_COUNT;
1292
1262
1293
 failed:
1263
 failed:
1294
    nv_unlock(nvl->ldata_lock);
1264
    nv_unlock(nvl->ldata_lock);
Lines 1319-1356 Link Here
1319
1289
1320
    /* for control device, just jump to its open routine */
1290
    /* for control device, just jump to its open routine */
1321
    /* after setting up the private data */
1291
    /* after setting up the private data */
1322
    if (NV_DEVICE_IS_CONTROL_DEVICE(inode->i_rdev))
1292
    if (NV_IS_CONTROL_DEVICE(inode))
1323
        return nv_kern_ctl_close(inode, file);
1293
        return nv_kern_ctl_close(inode, file);
1324
1294
1325
    nv_printf(NV_DBG_INFO, "nv_kern_close on device %d\n", NV_DEVICE_NUMBER(inode->i_rdev));
1295
    nv_printf(NV_DBG_INFO, "nv_kern_close on device %d\n", NV_DEVICE_NUMBER(inode));
1326
1296
1327
    rm_free_unused_clients(nv, current->pid, (void *) file);
1297
    rm_free_unused_clients(nv, current->pid, (void *) file);
1328
1298
1329
    nv_lock(nvl->ldata_lock);
1299
    nv_lock(nvl->ldata_lock);
1330
    if (--nv->usage_count == 0)
1300
    if (--nv->usage_count == 0)
1331
    {
1301
    {
1332
        int counter = 0;
1302
        /*
1333
1303
         * The usage count for this device has dropped to zero, it can be shut
1334
        /* turn off interrupts.
1304
         * down safely; disable its interrupts.
1335
        ** be careful to make sure any pending bottom half gets run
1305
         */
1336
        **  or disabled before calling rm_shutdown_adapter() since
1337
        **  it will free up the pdev.  This is hard to see on single
1338
        **  cpu systems, but easy on dual cpu :-)
1339
        */
1340
        rm_disable_adapter(nv);
1306
        rm_disable_adapter(nv);
1341
1307
1342
        /* give it a moment to allow any bottom half to run */
1308
        /*
1343
1309
         * Disable this device's tasklet to make sure that no bottom half will
1344
#define MAX_BH_TASKS 10
1310
         * run with undefined device state.
1345
        while (NV_ATOMIC_READ(nvl->bh_count) && (counter < MAX_BH_TASKS))
1311
         */
1346
        {
1312
        tasklet_disable(&nvl->tasklet);
1347
            current->state = TASK_INTERRUPTIBLE;
1348
            schedule_timeout(HZ/50);
1349
            counter++;
1350
        }
1351
1313
1352
        /* free the irq, which may block until any pending interrupts */
1314
        /*
1353
        /* are done being processed. */
1315
         * Free the IRQ, which may block until all pending interrupt processing
1316
         * has completed.
1317
         */
1354
        free_irq(nv->interrupt_line, (void *) nv);
1318
        free_irq(nv->interrupt_line, (void *) nv);
1355
1319
1356
        rm_shutdown_adapter(nv);
1320
        rm_shutdown_adapter(nv);
Lines 1381-1388 Link Here
1381
        FILE_PRIVATE(file) = NULL;
1345
        FILE_PRIVATE(file) = NULL;
1382
    }
1346
    }
1383
1347
1384
    MOD_DEC_USE_COUNT;
1385
1386
    return 0;
1348
    return 0;
1387
}
1349
}
1388
1350
Lines 1399-1408 Link Here
1399
    nv_printf(NV_DBG_INFO, "mmap([0x%p-0x%p] off=0x%lx)\n",
1361
    nv_printf(NV_DBG_INFO, "mmap([0x%p-0x%p] off=0x%lx)\n",
1400
        vma->vm_start,
1362
        vma->vm_start,
1401
        vma->vm_end,
1363
        vma->vm_end,
1402
        LINUX_VMA_OFFS(vma));
1364
        NV_VMA_OFFSET(vma));
1403
1365
1404
    // be a bit paranoid for now
1366
    // be a bit paranoid for now
1405
    if ((NV_MASK_OFFSET(LINUX_VMA_OFFS(vma))) ||
1367
    if ((NV_MASK_OFFSET(NV_VMA_OFFSET(vma))) ||
1406
        (NV_MASK_OFFSET(vma->vm_start)) ||
1368
        (NV_MASK_OFFSET(vma->vm_start)) ||
1407
        (NV_MASK_OFFSET(vma->vm_end)))
1369
        (NV_MASK_OFFSET(vma->vm_end)))
1408
    {
1370
    {
Lines 1420-1426 Link Here
1420
1382
1421
1383
1422
    /* NV reg space */
1384
    /* NV reg space */
1423
    if (IS_REG_OFFSET(nv, LINUX_VMA_OFFS(vma), vma->vm_end - vma->vm_start))
1385
    if (IS_REG_OFFSET(nv, NV_VMA_OFFSET(vma), vma->vm_end - vma->vm_start))
1424
    {
1386
    {
1425
        /* truncate to size of registers */
1387
        /* truncate to size of registers */
1426
        if (pages > nv->regs->size / PAGE_SIZE)
1388
        if (pages > nv->regs->size / PAGE_SIZE)
Lines 1428-1434 Link Here
1428
1390
1429
        vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
1391
        vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
1430
        if (NV_REMAP_PAGE_RANGE(vma->vm_start,
1392
        if (NV_REMAP_PAGE_RANGE(vma->vm_start,
1431
                             phys_to_uncached(LINUX_VMA_OFFS(vma)),
1393
                             phys_to_uncached(NV_VMA_OFFSET(vma)),
1432
                             vma->vm_end - vma->vm_start,
1394
                             vma->vm_end - vma->vm_start,
1433
                             vma->vm_page_prot))
1395
                             vma->vm_page_prot))
1434
            return -EAGAIN;
1396
            return -EAGAIN;
Lines 1438-1444 Link Here
1438
    }
1400
    }
1439
1401
1440
    /* NV fb space */
1402
    /* NV fb space */
1441
    else if (IS_FB_OFFSET(nv, LINUX_VMA_OFFS(vma), vma->vm_end - vma->vm_start))
1403
    else if (IS_FB_OFFSET(nv, NV_VMA_OFFSET(vma), vma->vm_end - vma->vm_start))
1442
    {
1404
    {
1443
1405
1444
        /* truncate to size of framebuffer */
1406
        /* truncate to size of framebuffer */
Lines 1447-1453 Link Here
1447
1409
1448
        vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
1410
        vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
1449
        if (NV_REMAP_PAGE_RANGE(vma->vm_start,
1411
        if (NV_REMAP_PAGE_RANGE(vma->vm_start,
1450
                             phys_to_uncached(LINUX_VMA_OFFS(vma)),
1412
                             phys_to_uncached(NV_VMA_OFFSET(vma)),
1451
                             vma->vm_end - vma->vm_start,
1413
                             vma->vm_end - vma->vm_start,
1452
                             vma->vm_page_prot))
1414
                             vma->vm_page_prot))
1453
            return -EAGAIN;
1415
            return -EAGAIN;
Lines 1457-1466 Link Here
1457
    }
1419
    }
1458
1420
1459
    /* AGP allocator */
1421
    /* AGP allocator */
1460
    else if (IS_AGP_OFFSET(nv, LINUX_VMA_OFFS(vma), vma->vm_end - vma->vm_start))
1422
    else if (IS_AGP_OFFSET(nv, NV_VMA_OFFSET(vma), vma->vm_end - vma->vm_start))
1461
    {
1423
    {
1462
        nv_lock(nvl->at_lock);
1424
        nv_lock(nvl->at_lock);
1463
        at = nvl_find_alloc(nvl, LINUX_VMA_OFFS(vma), NV_ALLOC_TYPE_AGP);
1425
        at = nvl_find_alloc(nvl, NV_VMA_OFFSET(vma), NV_ALLOC_TYPE_AGP);
1464
1426
1465
        if (at == NULL)
1427
        if (at == NULL)
1466
        {
1428
        {
Lines 1478-1484 Link Here
1478
        }
1440
        }
1479
1441
1480
        at->vma = vma;
1442
        at->vma = vma;
1481
        VMA_PRIVATE(vma) = at;
1443
        NV_VMA_PRIVATE(vma) = at;
1482
        at->usage_count++;
1444
        at->usage_count++;
1483
1445
1484
        if (NV_OSAGP_ENABLED(nv))
1446
        if (NV_OSAGP_ENABLED(nv))
Lines 1502-1514 Link Here
1502
    }
1464
    }
1503
1465
1504
    /* Magic allocator */
1466
    /* Magic allocator */
1505
    else // if (LINUX_VMA_OFFS(vma) == NV_MMAP_ALLOCATION_OFFSET)
1467
    else // if (NV_VMA_OFFSET(vma) == NV_MMAP_ALLOCATION_OFFSET)
1506
    {
1468
    {
1507
        unsigned long page = 0, pos, start;
1469
        unsigned long page = 0, pos, start;
1508
        int i = 0;
1470
        int i = 0;
1509
1471
1510
        nv_lock(nvl->at_lock);
1472
        nv_lock(nvl->at_lock);
1511
        at = nvl_find_alloc(nvl, LINUX_VMA_OFFS(vma), NV_ALLOC_TYPE_PCI);
1473
        at = nvl_find_alloc(nvl, NV_VMA_OFFSET(vma), NV_ALLOC_TYPE_PCI);
1512
1474
1513
        if (at == NULL)
1475
        if (at == NULL)
1514
        {
1476
        {
Lines 1526-1532 Link Here
1526
        }
1488
        }
1527
1489
1528
        at->vma = vma;
1490
        at->vma = vma;
1529
        VMA_PRIVATE(vma) = at;
1491
        NV_VMA_PRIVATE(vma) = at;
1530
        at->usage_count++;
1492
        at->usage_count++;
1531
1493
1532
        nv_printf(NV_DBG_INFO, "remapping %d system pages for at 0x%x\n", pages, at);
1494
        nv_printf(NV_DBG_INFO, "remapping %d system pages for at 0x%x\n", pages, at);
Lines 1548-1556 Link Here
1548
1510
1549
    vma->vm_file = file;
1511
    vma->vm_file = file;
1550
1512
1551
    /* just increment usage count, rather than calling vma_open */
1552
    MOD_INC_USE_COUNT;
1553
1554
    return 0;
1513
    return 0;
1555
}
1514
}
1556
1515
Lines 1577-1583 Link Here
1577
    {
1536
    {
1578
        nv_printf(NV_DBG_EVENTINFO, "calling poll_wait\n");
1537
        nv_printf(NV_DBG_EVENTINFO, "calling poll_wait\n");
1579
        // add us to the list
1538
        // add us to the list
1580
        poll_wait(file, EVENT_QUEUE(nvfp->wqueue), wait);
1539
        poll_wait(file, &nvfp->waitqueue, wait);
1581
    }
1540
    }
1582
1541
1583
    nv_lock_irq(nvfp->fp_lock, eflags);
1542
    nv_lock_irq(nvfp->fp_lock, eflags);
Lines 1645-1656 Link Here
1645
1604
1646
    switch (_IOC_NR(cmd))
1605
    switch (_IOC_NR(cmd))
1647
    {
1606
    {
1607
#if !defined(KERNEL_2_6)
1648
        /* debug tool; zap the module use count so we can unload driver */
1608
        /* debug tool; zap the module use count so we can unload driver */
1649
        /*             even if it is confused */
1609
        /*             even if it is confused */
1650
        case NV_ESC_MODULE_RESET:
1610
        case NV_ESC_MODULE_RESET:
1651
            atomic_set(&__this_module.uc.usecount, 1);
1611
            atomic_set(&__this_module.uc.usecount, 1);
1652
            break;
1612
            break;
1653
1613
#endif
1654
        /* pass out info about the card */
1614
        /* pass out info about the card */
1655
        case NV_ESC_CARD_INFO:
1615
        case NV_ESC_CARD_INFO:
1656
        {
1616
        {
Lines 1777-1783 Link Here
1777
 * driver receives an interrupt
1737
 * driver receives an interrupt
1778
 *    if someone waiting, then hand it off.
1738
 *    if someone waiting, then hand it off.
1779
 */
1739
 */
1780
void nv_kern_isr(
1740
irqreturn_t nv_kern_isr(
1781
    int   irq,
1741
    int   irq,
1782
    void *arg,
1742
    void *arg,
1783
    struct pt_regs *regs
1743
    struct pt_regs *regs
Lines 1791-1799 Link Here
1791
    if (need_to_run_bottom_half)
1751
    if (need_to_run_bottom_half)
1792
    {
1752
    {
1793
        NV_ATOMIC_INC(nvl->bh_count);
1753
        NV_ATOMIC_INC(nvl->bh_count);
1794
        queue_task(nvl->bh, &tq_immediate);
1754
        tasklet_schedule(&nvl->tasklet);
1795
        mark_bh(IMMEDIATE_BH);
1796
    }
1755
    }
1756
1757
    return IRQ_HANDLED;
1797
}
1758
}
1798
1759
1799
void nv_kern_bh(
1760
void nv_kern_bh(
Lines 1911-1921 Link Here
1911
1872
1912
    if (nv->usage_count == 0)
1873
    if (nv->usage_count == 0)
1913
    {
1874
    {
1914
        INIT_EVENT_QUEUE(nv_ctl_wqueue);
1875
        init_waitqueue_head(&nv_ctl_waitqueue);
1915
    }
1876
    }
1916
1877
1917
    MOD_INC_USE_COUNT;
1918
1919
    nv->flags |= NV_FLAG_OPEN + NV_FLAG_CONTROL;
1878
    nv->flags |= NV_FLAG_OPEN + NV_FLAG_CONTROL;
1920
1879
1921
    /* turn off the hotkey occurred bit */
1880
    /* turn off the hotkey occurred bit */
Lines 1943-1952 Link Here
1943
1902
1944
    nv_lock(nvl->ldata_lock);
1903
    nv_lock(nvl->ldata_lock);
1945
    if (--nv->usage_count == 0)
1904
    if (--nv->usage_count == 0)
1946
    {
1947
        FREE_EVENT_QUEUE(nv_ctl_wqueue);
1948
        nv->flags = 0;
1905
        nv->flags = 0;
1949
    }
1906
1950
    nv_unlock(nvl->ldata_lock);
1907
    nv_unlock(nvl->ldata_lock);
1951
1908
1952
    rm_free_unused_clients(nv, current->pid, (void *) file);
1909
    rm_free_unused_clients(nv, current->pid, (void *) file);
Lines 1957-1964 Link Here
1957
        FILE_PRIVATE(file) = NULL;
1914
        FILE_PRIVATE(file) = NULL;
1958
    }
1915
    }
1959
1916
1960
    MOD_DEC_USE_COUNT;
1961
1962
    return 0;
1917
    return 0;
1963
}
1918
}
1964
1919
Lines 1982-1988 Link Here
1982
    nv = NV_STATE_PTR(nvl);
1937
    nv = NV_STATE_PTR(nvl);
1983
1938
1984
    if ( !(file->f_flags & O_NONBLOCK) )
1939
    if ( !(file->f_flags & O_NONBLOCK) )
1985
        poll_wait(file, EVENT_QUEUE(nv_ctl_wqueue), wait);
1940
        poll_wait(file, &nv_ctl_waitqueue, wait);
1986
1941
1987
    nv_lock(nvl->ldata_lock);
1942
    nv_lock(nvl->ldata_lock);
1988
1943
Lines 2013-2019 Link Here
2013
    nv_ctl_device.nv_state.flags |= NV_FLAG_HOTKEY_OCCURRED;
1968
    nv_ctl_device.nv_state.flags |= NV_FLAG_HOTKEY_OCCURRED;
2014
    nv_unlock(nv_ctl_device.ldata_lock);
1969
    nv_unlock(nv_ctl_device.ldata_lock);
2015
1970
2016
    wake_up_interruptible(EVENT_QUEUE(nv_ctl_wqueue));
1971
    wake_up_interruptible(&nv_ctl_waitqueue);
2017
}
1972
}
2018
1973
2019
int nv_kern_read_cardinfo(char *page, char **start, off_t off,
1974
int nv_kern_read_cardinfo(char *page, char **start, off_t off,
Lines 2092-2098 Link Here
2092
        len += sprintf(page+len, "Host Bridge: \t ");
2047
        len += sprintf(page+len, "Host Bridge: \t ");
2093
2048
2094
#if defined(CONFIG_PCI_NAMES)
2049
#if defined(CONFIG_PCI_NAMES)
2095
        len += sprintf(page+len, "%s\n", dev->name);
2050
        len += sprintf(page+len, "%s\n", NV_PCI_DEVICE_NAME(dev));
2096
#else
2051
#else
2097
        len += sprintf(page+len, "PCI device %04x:%04x\n",
2052
        len += sprintf(page+len, "PCI device %04x:%04x\n",
2098
                dev->vendor, dev->device);
2053
                dev->vendor, dev->device);
Lines 2304-2330 Link Here
2304
    int kern
2259
    int kern
2305
)
2260
)
2306
{
2261
{
2307
    pgd_t *pg_dir;
2262
    pgd_t *pgd;
2308
    pmd_t *pg_mid_dir;
2263
    pmd_t *pmd;
2309
    pte_t pte;
2264
    pte_t *pte;
2310
    unsigned long retval;
2265
    unsigned long retval;
2311
2266
2312
    if (kern) pg_dir = pgd_offset_k(address);
2267
    if (kern)
2313
    else      pg_dir = pgd_offset(current->mm, address);
2268
        pgd = pgd_offset_k(address);
2269
    else
2270
        pgd = pgd_offset(current->mm, address);
2314
2271
2315
    if (pgd_none(*pg_dir))
2272
    if (!pgd || pgd_none(*pgd))
2316
        goto failed;
2273
        goto failed;
2317
2274
2318
    pg_mid_dir = pmd_offset(pg_dir, address);
2275
    NV_PMD_OFFSET(address, pgd, pmd);
2319
    if (pmd_none(*pg_mid_dir))
2276
2277
    if (!NV_PMD_PRESENT(pmd))
2320
        goto failed;
2278
        goto failed;
2321
2279
2322
    NV_PTE_OFFSET(address, pg_mid_dir, pte);
2280
    NV_PTE_OFFSET(address, pmd, pte);
2323
2281
2324
    if (!pte_present(pte))
2282
    if (!NV_PTE_PRESENT(pte))
2325
        goto failed;
2283
        goto failed;
2326
2284
2327
    retval = ((pte_val(pte) & KERN_PAGE_MASK) | NV_MASK_OFFSET(address));
2285
    retval = ((NV_PTE_VALUE(pte) & KERN_PAGE_MASK) | NV_MASK_OFFSET(address));
2328
2286
2329
#if defined(NVCPU_X86_64) && defined(_PAGE_NX)
2287
#if defined(NVCPU_X86_64) && defined(_PAGE_NX)
2330
    // mask out the non-executable page bit for the true physical address
2288
    // mask out the non-executable page bit for the true physical address
Lines 2759-2765 Link Here
2759
2717
2760
    if (nvfp->num_events == NV_EVENT_FIFO_SIZE)
2718
    if (nvfp->num_events == NV_EVENT_FIFO_SIZE)
2761
    {
2719
    {
2762
        wake_up_interruptible(EVENT_QUEUE(nvfp->wqueue));
2720
        wake_up_interruptible(&nvfp->waitqueue);
2763
        nv_unlock_irq(nvfp->fp_lock, eflags);
2721
        nv_unlock_irq(nvfp->fp_lock, eflags);
2764
        return;
2722
        return;
2765
    }
2723
    }
Lines 2776-2782 Link Here
2776
    if (nvfp->put >= NV_EVENT_FIFO_SIZE)
2734
    if (nvfp->put >= NV_EVENT_FIFO_SIZE)
2777
        nvfp->put = 0;
2735
        nvfp->put = 0;
2778
2736
2779
    wake_up_interruptible(EVENT_QUEUE(nvfp->wqueue));
2737
    wake_up_interruptible(&nvfp->waitqueue);
2780
    nv_unlock_irq(nvfp->fp_lock, eflags);
2738
    nv_unlock_irq(nvfp->fp_lock, eflags);
2781
}
2739
}
2782
2740
Lines 2866-2877 Link Here
2866
    if ( (NV_AGP_DISABLED(nv)) && (config & NVOS_AGP_CONFIG_NVAGP) )
2824
    if ( (NV_AGP_DISABLED(nv)) && (config & NVOS_AGP_CONFIG_NVAGP) )
2867
    {
2825
    {
2868
        /* make sure the user does not have agpgart loaded */
2826
        /* make sure the user does not have agpgart loaded */
2869
#if !defined (KERNEL_2_2)
2870
        if (inter_module_get("drm_agp")) {
2827
        if (inter_module_get("drm_agp")) {
2871
            inter_module_put("drm_agp");
2828
            inter_module_put("drm_agp");
2872
#else
2873
        if (GET_MODULE_SYMBOL(0, __MODULE_STRING(agp_enable))) {
2874
#endif
2875
            nv_printf(NV_DBG_WARNINGS, "NVRM: not using NVAGP, AGPGART is loaded!!\n");
2829
            nv_printf(NV_DBG_WARNINGS, "NVRM: not using NVAGP, AGPGART is loaded!!\n");
2876
        } else {
2830
        } else {
2877
#if defined(CONFIG_X86_64) && defined(CONFIG_GART_IOMMU)
2831
#if defined(CONFIG_X86_64) && defined(CONFIG_GART_IOMMU)
(-)NVIDIA_kernel-1.0-5328/os-agp.c (-114 / +43 lines)
Lines 45-88 Link Here
45
    int  ready;
45
    int  ready;
46
} agp_gart;
46
} agp_gart;
47
47
48
typedef struct {
49
    int           (*backend_acquire)(void);
50
    void          (*backend_release)(void);
51
    void          (*copy_info)(agp_kern_info *);
52
    agp_memory *  (*allocate_memory)(size_t, unsigned int);
53
    void          (*free_memory)(agp_memory *);
54
    int           (*bind_memory)(agp_memory *, off_t);
55
    int           (*unbind_memory)(agp_memory *);
56
    void          (*enable)(unsigned int);
57
} agp_operations_struct;
58
59
agp_operations_struct agp_ops;
60
agp_kern_info         agpinfo;
48
agp_kern_info         agpinfo;
61
agp_gart              gart;
49
agp_gart              gart;
62
#if !defined (KERNEL_2_2)
63
const drm_agp_t       *drm_agp_p;
50
const drm_agp_t       *drm_agp_p;
64
#endif
65
66
#if defined (KERNEL_2_2)
67
    #define GET_AGPGART_SYMBOL(sym, sym_string)                     \
68
        sym = (void*) GET_MODULE_SYMBOL(0, sym_string);             \
69
        if (sym == NULL)                                            \
70
        {                                                           \
71
            nv_printf(NV_DBG_ERRORS,                                \
72
                "NVRM: AGPGART: unable to retrieve symbol %s\n",    \
73
                sym_string);                                        \
74
            return 1;                                               \
75
        }
76
77
    #define AGP_BACKEND_ACQUIRE_SYM   __MODULE_STRING(agp_backend_acquire)
78
    #define AGP_BACKEND_RELEASE_SYM   __MODULE_STRING(agp_backend_release)
79
    #define AGP_COPY_INFO_SYM         __MODULE_STRING(agp_copy_info)
80
    #define AGP_ALLOCATE_MEMORY_SYM   __MODULE_STRING(agp_allocate_memory)
81
    #define AGP_FREE_MEMORY_SYM       __MODULE_STRING(agp_free_memory)
82
    #define AGP_BIND_MEMORY_SYM       __MODULE_STRING(agp_bind_memory)
83
    #define AGP_UNBIND_MEMORY_SYM     __MODULE_STRING(agp_unbind_memory)
84
    #define AGP_ENABLE_SYM            __MODULE_STRING(agp_enable)
85
#endif
86
51
87
#if defined(CONFIG_MTRR)
52
#if defined(CONFIG_MTRR)
88
#define MTRR_DEL(gart) if ((gart).mtrr > 0) mtrr_del((gart).mtrr, 0, 0);
53
#define MTRR_DEL(gart) if ((gart).mtrr > 0) mtrr_del((gart).mtrr, 0, 0);
Lines 110-157 Link Here
110
75
111
    memset( (void *) &gart, 0, sizeof(agp_gart));
76
    memset( (void *) &gart, 0, sizeof(agp_gart));
112
77
113
#if !defined (KERNEL_2_2)
78
    /*
79
     * XXX The inter_module_* mechanism has been deprecated and replaced with
80
     * a different mechanism in Linux 2.5; it will go away eventually.
81
     * Also, the Linux 2.5 AGP GART driver is modularized, agpgart.o does not
82
     * include backend drivers.
83
     */
114
    if (!(drm_agp_p = inter_module_get_request("drm_agp", "agpgart")))
84
    if (!(drm_agp_p = inter_module_get_request("drm_agp", "agpgart")))
115
    {
85
    {
116
        nv_printf(NV_DBG_ERRORS,
86
        nv_printf(NV_DBG_ERRORS,
117
            "NVRM: AGPGART: unable to retrieve symbol table\n");
87
            "NVRM: AGPGART: unable to retrieve symbol table\n");
118
        return 1;
88
        return 1;
119
    }
89
    }
120
    
121
    agp_ops.backend_acquire = drm_agp_p->acquire;
122
    agp_ops.backend_release = drm_agp_p->release;
123
    agp_ops.allocate_memory = drm_agp_p->allocate_memory;
124
    agp_ops.free_memory     = drm_agp_p->free_memory;
125
    agp_ops.bind_memory     = drm_agp_p->bind_memory;
126
    agp_ops.unbind_memory   = drm_agp_p->unbind_memory;
127
    agp_ops.enable          = drm_agp_p->enable;
128
129
    // looks like some newer kernels (for example mandrake 9.0's 2.4.19-16mdk)
130
    // have updated copy_info to return an integer value, and of course didn't
131
    // bother bumping the agpgart revision up. The return value is pretty 
132
    // harmless (backend_acquire would have already failed and caused us to
133
    // bail), so cast the function pointer to avoid compiler warnings.
134
    // we may need to revisit this in the future.
135
    agp_ops.copy_info       = (void (*)(agp_kern_info *)) drm_agp_p->copy_info;
136
137
#else
138
#if defined(CONFIG_KMOD)
139
    if ( request_module("agpgart") )
140
    {
141
        nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: not loading agpgart.o\n");
142
        return 1;
143
    }
144
#endif
145
146
    GET_AGPGART_SYMBOL(agp_ops.backend_acquire, AGP_BACKEND_ACQUIRE_SYM);
147
    GET_AGPGART_SYMBOL(agp_ops.backend_release, AGP_BACKEND_RELEASE_SYM);
148
    GET_AGPGART_SYMBOL(agp_ops.copy_info,       AGP_COPY_INFO_SYM);
149
    GET_AGPGART_SYMBOL(agp_ops.allocate_memory, AGP_ALLOCATE_MEMORY_SYM);
150
    GET_AGPGART_SYMBOL(agp_ops.free_memory,     AGP_FREE_MEMORY_SYM);
151
    GET_AGPGART_SYMBOL(agp_ops.bind_memory,     AGP_BIND_MEMORY_SYM);
152
    GET_AGPGART_SYMBOL(agp_ops.unbind_memory,   AGP_UNBIND_MEMORY_SYM);
153
    GET_AGPGART_SYMBOL(agp_ops.enable,          AGP_ENABLE_SYM);
154
#endif
155
90
156
    /* NOTE: from here down, return an error code of '-1'
91
    /* NOTE: from here down, return an error code of '-1'
157
     * that indicates that agpgart is loaded, but we failed to use it
92
     * that indicates that agpgart is loaded, but we failed to use it
Lines 159-165 Link Here
159
     * the memory controller.
94
     * the memory controller.
160
     */
95
     */
161
96
162
    if ( (*(agp_ops.backend_acquire))() )
97
    if (drm_agp_p->acquire())
163
    {
98
    {
164
        nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: backend in use\n");
99
        nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: backend in use\n");
165
        return -1;
100
        return -1;
Lines 177-183 Link Here
177
        agp_fw = 1;
112
        agp_fw = 1;
178
    agp_fw &= 0x00000001;
113
    agp_fw &= 0x00000001;
179
    
114
    
180
    (*(agp_ops.copy_info))(&agpinfo);
115
#if defined(KERNEL_2_4)
116
    /*
117
     * The original Linux 2.4 AGP GART driver interface declared copy_info to
118
     * return nothing. This changed in Linux 2.5, which reports unsupported
119
     * chipsets via this function. If this Linux 2.4 kernels behaves the same
120
     * way, we have no way to know.
121
     */
122
    drm_agp_p->copy_info(&agpinfo);
123
#else
124
    if (drm_agp_p->copy_info(&agpinfo)) {
125
        drm_agp_p->release();
126
        inter_module_put("drm_agp");
127
        return -1;
128
    }
129
#endif
181
130
182
#ifdef CONFIG_MTRR
131
#ifdef CONFIG_MTRR
183
    if ((gart.mtrr = mtrr_add(agpinfo.aper_base,
132
    if ((gart.mtrr = mtrr_add(agpinfo.aper_base,
Lines 191-197 Link Here
191
         */
140
         */
192
        nv_printf(NV_DBG_ERRORS, 
141
        nv_printf(NV_DBG_ERRORS, 
193
            "NVRM: AGPGART: unable to set MTRR write-combining\n");
142
            "NVRM: AGPGART: unable to set MTRR write-combining\n");
194
        (*(agp_ops.backend_release))();
143
        drm_agp_p->release();
144
        inter_module_put("drm_agp");
195
        return -1;
145
        return -1;
196
    }
146
    }
197
#endif
147
#endif
Lines 207-213 Link Here
207
    {
157
    {
208
        nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: unable to remap aperture\n");
158
        nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: unable to remap aperture\n");
209
        MTRR_DEL(gart);
159
        MTRR_DEL(gart);
210
        (*(agp_ops.backend_release))();
160
        drm_agp_p->release();
161
        inter_module_put("drm_agp");
211
        return -1;
162
        return -1;
212
    }
163
    }
213
164
Lines 218-224 Link Here
218
        nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: unable to allocate bitmap\n");
169
        nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: unable to allocate bitmap\n");
219
        NV_IOUNMAP(gart.aperture, RM_PAGE_SIZE);
170
        NV_IOUNMAP(gart.aperture, RM_PAGE_SIZE);
220
        MTRR_DEL(gart);
171
        MTRR_DEL(gart);
221
        (*(agp_ops.backend_release))();
172
        drm_agp_p->release();
173
        inter_module_put("drm_agp");
222
        return -1;
174
        return -1;
223
    }
175
    }
224
176
Lines 229-267 Link Here
229
        os_free_mem(bitmap);
181
        os_free_mem(bitmap);
230
        NV_IOUNMAP(gart.aperture, RM_PAGE_SIZE);
182
        NV_IOUNMAP(gart.aperture, RM_PAGE_SIZE);
231
        MTRR_DEL(gart);
183
        MTRR_DEL(gart);
232
        (*(agp_ops.backend_release))();
184
        drm_agp_p->release();
185
        inter_module_put("drm_agp");
233
        return -1;
186
        return -1;
234
    }
187
    }
235
188
236
    nv_printf(NV_DBG_SETUP,
237
        "NVRM: AGPGART: aperture: %ldM @ 0x%08lx\n",
238
        (unsigned long)agpinfo.aper_size,
239
        (unsigned long)agpinfo.aper_base);
240
241
    nv_printf(NV_DBG_SETUP, 
242
        "NVRM: AGPGART: aperture mapped from 0x%08lx to 0x%08lx\n",
243
        agpinfo.aper_base,
244
        (unsigned long) gart.aperture);
245
246
    if (!agp_sba) agpinfo.mode &= ~0x00000200;
189
    if (!agp_sba) agpinfo.mode &= ~0x00000200;
247
    if (!agp_fw)  agpinfo.mode &= ~0x00000010;
190
    if (!agp_fw)  agpinfo.mode &= ~0x00000010;
248
191
249
    if (!(agp_rate & 0x00000004)) agpinfo.mode &= ~0x00000004;
192
    if (!(agp_rate & 0x00000004)) agpinfo.mode &= ~0x00000004;
250
    if (!(agp_rate & 0x00000002)) agpinfo.mode &= ~0x00000002;
193
    if (!(agp_rate & 0x00000002)) agpinfo.mode &= ~0x00000002;
251
    
194
    
252
    (*(agp_ops.enable))(agpinfo.mode);
195
    drm_agp_p->enable(agpinfo.mode);
253
    
196
    
254
    if (agpinfo.mode & 0x00000200)
255
        nv_printf(NV_DBG_SETUP, "NVRM: AGPGART: backend supports sba\n");
256
    if (agpinfo.mode & 0x00000010)
257
        nv_printf(NV_DBG_SETUP, "NVRM: AGPGART: backend supports fw\n");
258
    if (agpinfo.mode & 0x00000004)
259
        nv_printf(NV_DBG_SETUP, "NVRM: AGPGART: mode 4x\n");
260
    else if (agpinfo.mode & 0x00000002)
261
        nv_printf(NV_DBG_SETUP, "NVRM: AGPGART: mode 2x\n");
262
    else if (agpinfo.mode & 0x00000001)
263
        nv_printf(NV_DBG_SETUP, "NVRM: AGPGART: mode 1x\n");
264
265
    *ap_phys_base   = (void*) agpinfo.aper_base;
197
    *ap_phys_base   = (void*) agpinfo.aper_base;
266
    *ap_mapped_base = (void*) gart.aperture;
198
    *ap_mapped_base = (void*) gart.aperture;
267
    *apsize         = (agpinfo.aper_size * 0x100000) - 1;
199
    *apsize         = (agpinfo.aper_size * 0x100000) - 1;
Lines 295-305 Link Here
295
        NV_IOUNMAP(gart.aperture, RM_PAGE_SIZE);
227
        NV_IOUNMAP(gart.aperture, RM_PAGE_SIZE);
296
    }
228
    }
297
229
298
    (*(agp_ops.backend_release))();
230
    drm_agp_p->release();
299
231
300
#if !defined (KERNEL_2_2)
232
    /*
233
     * XXX Same as above; the inter_module_* mechanism will go away at some
234
     * point, it has been deprecated in Linux 2.5.
235
     */
301
    inter_module_put("drm_agp");
236
    inter_module_put("drm_agp");
302
#endif
303
237
304
    if (rm_clear_agp_bitmap(nv, &bitmap))
238
    if (rm_clear_agp_bitmap(nv, &bitmap))
305
    {
239
    {
Lines 346-352 Link Here
346
        return RM_ERROR;
280
        return RM_ERROR;
347
    }
281
    }
348
282
349
    ptr = (*agp_ops.allocate_memory)(PageCount, AGP_NORMAL_MEMORY);
283
    ptr = drm_agp_p->allocate_memory(PageCount, AGP_NORMAL_MEMORY);
350
    if (ptr == NULL)
284
    if (ptr == NULL)
351
    {
285
    {
352
        *pAddress = (void*) 0;
286
        *pAddress = (void*) 0;
Lines 354-360 Link Here
354
        return RM_ERR_NO_FREE_MEM;
288
        return RM_ERR_NO_FREE_MEM;
355
    }
289
    }
356
    
290
    
357
    err = (*(agp_ops.bind_memory))(ptr, *Offset);
291
    err = drm_agp_p->bind_memory(ptr, *Offset);
358
    if (err)
292
    if (err)
359
    {
293
    {
360
        // this happens a lot when the aperture itself fills up..
294
        // this happens a lot when the aperture itself fills up..
Lines 371-377 Link Here
371
    if (status != RM_OK)
305
    if (status != RM_OK)
372
    {
306
    {
373
        nv_printf(NV_DBG_ERRORS, "NVRM: memory allocation failed\n");
307
        nv_printf(NV_DBG_ERRORS, "NVRM: memory allocation failed\n");
374
        (*(agp_ops.unbind_memory))(ptr);
308
        drm_agp_p->unbind_memory(ptr);
375
        goto fail;
309
        goto fail;
376
    }
310
    }
377
311
Lines 386-392 Link Here
386
    return RM_OK;
320
    return RM_OK;
387
321
388
fail:
322
fail:
389
    (*(agp_ops.free_memory))(ptr);
323
    drm_agp_p->free_memory(ptr);
390
    *pAddress = (void*) 0;
324
    *pAddress = (void*) 0;
391
325
392
    return RM_ERROR;
326
    return RM_ERROR;
Lines 426-432 Link Here
426
    {
360
    {
427
        nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: unable to remap %lu pages\n",
361
        nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: unable to remap %lu pages\n",
428
            (unsigned long)agp_data->num_pages);
362
            (unsigned long)agp_data->num_pages);
429
        (*(agp_ops.unbind_memory))(agp_data->ptr);
363
        drm_agp_p->unbind_memory(agp_data->ptr);
430
        goto fail;
364
        goto fail;
431
    }
365
    }
432
    
366
    
Lines 445-452 Link Here
445
}
379
}
446
#endif
380
#endif
447
381
448
#if !defined(KERNEL_2_2)
449
450
RM_STATUS 
382
RM_STATUS 
451
KernMapAGPNopage(
383
KernMapAGPNopage(
452
    VOID *address,
384
    VOID *address,
Lines 501-509 Link Here
501
#endif
433
#endif
502
}
434
}
503
435
504
#endif /* !defined(KERNEL_2_2) */
505
506
507
RM_STATUS KernFreeAGPPages(
436
RM_STATUS KernFreeAGPPages(
508
    nv_state_t *nv,
437
    nv_state_t *nv,
509
    VOID **pAddress,
438
    VOID **pAddress,
Lines 529-536 Link Here
529
    {
458
    {
530
        size_t pages = ptr->page_count;
459
        size_t pages = ptr->page_count;
531
460
532
        (*(agp_ops.unbind_memory))(ptr);
461
        drm_agp_p->unbind_memory(ptr);
533
        (*(agp_ops.free_memory))(ptr);
462
        drm_agp_p->free_memory(ptr);
534
463
535
        nv_printf(NV_DBG_INFO, "NVRM: AGPGART: freed %ld pages\n",
464
        nv_printf(NV_DBG_INFO, "NVRM: AGPGART: freed %ld pages\n",
536
            (unsigned long)pages);
465
            (unsigned long)pages);
(-)NVIDIA_kernel-1.0-5328/os-interface.c (-19 / +15 lines)
Lines 56-62 Link Here
56
    PHWINFO pDev
56
    PHWINFO pDev
57
)
57
)
58
{
58
{
59
    return suser();
59
    return NV_IS_SUSER();
60
}
60
}
61
61
62
U032 os_get_page_size(VOID)
62
U032 os_get_page_size(VOID)
Lines 211-216 Link Here
211
{
211
{
212
    NV_MEM_TRACKING_PAD_SIZE(size);
212
    NV_MEM_TRACKING_PAD_SIZE(size);
213
213
214
    /*
215
     * XXX This needs to be !NV_MAY_SLEEP() rather than in_interrupt(); that
216
     * requires quite a bit of locking to be rearranged, however, which is why
217
     * I'll leave it alone for now.
218
     */
214
    if (in_interrupt()) {
219
    if (in_interrupt()) {
215
        if (size <= KMALLOC_LIMIT) {
220
        if (size <= KMALLOC_LIMIT) {
216
            /*
221
            /*
Lines 296-302 Link Here
296
    *address = (void *) va;
301
    *address = (void *) va;
297
302
298
    for (i = 0; i < count; i++) {
303
    for (i = 0; i < count; i++) {
299
        mem_map_reserve(GET_MAP_NR(__pa((va))));
304
        SetPageReserved(virt_to_page(va));
300
        va += PAGE_SIZE;
305
        va += PAGE_SIZE;
301
    }
306
    }
302
307
Lines 320-326 Link Here
320
    unsigned long va = (unsigned long) address;
325
    unsigned long va = (unsigned long) address;
321
326
322
    for (i = 0; i < count; i++) {
327
    for (i = 0; i < count; i++) {
323
        mem_map_unreserve(GET_MAP_NR(__pa((va))));
328
        ClearPageReserved(virt_to_page(va));
324
        va += PAGE_SIZE;
329
        va += PAGE_SIZE;
325
    }
330
    }
326
331
Lines 426-432 Link Here
426
    if (in_irq() && MilliSeconds > NV_MAX_ISR_MDELAY)
431
    if (in_irq() && MilliSeconds > NV_MAX_ISR_MDELAY)
427
        return RM_ERROR;
432
        return RM_ERROR;
428
433
429
    if (in_interrupt()) 
434
    if (!NV_MAY_SLEEP()) 
430
    {
435
    {
431
        mdelay(MilliSeconds);
436
        mdelay(MilliSeconds);
432
        return RM_OK;
437
        return RM_OK;
Lines 524-531 Link Here
524
// The current debug display level (default to maximum debug level)
529
// The current debug display level (default to maximum debug level)
525
int cur_debuglevel = 0xaaaaaaaa;
530
int cur_debuglevel = 0xaaaaaaaa;
526
531
527
MODULE_PARM(silence_nvidia_output, "1i");
528
static int silence_nvidia_output = 0;
532
static int silence_nvidia_output = 0;
533
NV_MODULE_PARAMETER(silence_nvidia_output);
529
534
530
535
531
//
536
//
Lines 708-721 Link Here
708
713
709
ULONG os_cli(ULONG flags)
714
ULONG os_cli(ULONG flags)
710
{
715
{
711
    save_flags(flags);
716
    NV_SAVE_FLAGS(flags);
712
    cli();
717
    NV_CLI();
713
    return flags;
718
    return flags;
714
}
719
}
715
720
716
ULONG os_sti(ULONG flags)
721
ULONG os_sti(ULONG flags)
717
{
722
{
718
    restore_flags(flags);
723
    NV_RESTORE_FLAGS(flags);
719
    return flags;
724
    return flags;
720
}
725
}
721
726
Lines 866-881 Link Here
866
    U032 size_bytes
871
    U032 size_bytes
867
)
872
)
868
{
873
{
869
#if defined (KERNEL_2_2)
874
    NV_IOUNMAP(addr, size_bytes);
870
    if (MAP_NR(addr) < max_mapnr) {
871
        // if we didn't want the memory cached, this isn't necessary
872
        // but we shouldn't be in a timing critical piece of code.
873
        asm volatile("wbinvd":::"memory");
874
    } else 
875
#endif
876
    {
877
        NV_IOUNMAP(addr, size_bytes);
878
    }
879
}
875
}
880
876
881
VOID* os_map_user_space(
877
VOID* os_map_user_space(
Lines 979-985 Link Here
979
975
980
U032 os_get_cpu_count()
976
U032 os_get_cpu_count()
981
{
977
{
982
    return smp_num_cpus;
978
    return NV_SMP_NUM_CPUS;
983
}
979
}
984
980
985
#if defined(DEBUG) && !defined(NVCPU_IA64)
981
#if defined(DEBUG) && !defined(NVCPU_IA64)
(-)NVIDIA_kernel-1.0-5328/os-registry.c (-29 / +11 lines)
Lines 48-71 Link Here
48
 *   This could be changed to work on a per-device basis.
48
 *   This could be changed to work on a per-device basis.
49
 */
49
 */
50
50
51
/*
52
 * The 2nd argument to MODULE_PARM is used to verify parameters passed
53
 * to the module at load time. It should be a string in the following 
54
 * format:
55
 *
56
 *   	[min[-max]]{b,h,i,l,s}
57
 *
58
 * The MIN and MAX specifiers delimit the length of the array. If MAX
59
 * is omitted, it defaults to MIN; if both are omitted, the default is
60
 * 1. The final character is a type specifier.
61
 *
62
 *  b   byte
63
 *  h   short
64
 *  i   int
65
 *  l   long
66
 *  s   string
67
 */
68
69
/* 
51
/* 
70
 * Option: VideoMemoryTypeOverride
52
 * Option: VideoMemoryTypeOverride
71
 * 
53
 * 
Lines 92-98 Link Here
92
 */
74
 */
93
75
94
static int NVreg_VideoMemoryTypeOverride = 1;
76
static int NVreg_VideoMemoryTypeOverride = 1;
95
MODULE_PARM(NVreg_VideoMemoryTypeOverride, "i");
77
NV_MODULE_PARAMETER(NVreg_VideoMemoryTypeOverride);
96
78
97
/*
79
/*
98
 * Option: EnableVia4x
80
 * Option: EnableVia4x
Lines 111-117 Link Here
111
 */
93
 */
112
94
113
static int NVreg_EnableVia4x = 0;
95
static int NVreg_EnableVia4x = 0;
114
MODULE_PARM(NVreg_EnableVia4x, "i");
96
NV_MODULE_PARAMETER(NVreg_EnableVia4x);
115
97
116
/*
98
/*
117
 * Option: EnableALiAGP
99
 * Option: EnableALiAGP
Lines 134-140 Link Here
134
 */
116
 */
135
117
136
static int NVreg_EnableALiAGP = 0;
118
static int NVreg_EnableALiAGP = 0;
137
MODULE_PARM(NVreg_EnableALiAGP, "i");
119
NV_MODULE_PARAMETER(NVreg_EnableALiAGP);
138
120
139
/* 
121
/* 
140
 * Option: ReqAGPRate
122
 * Option: ReqAGPRate
Lines 164-170 Link Here
164
 */
146
 */
165
147
166
static int NVreg_ReqAGPRate = 7;
148
static int NVreg_ReqAGPRate = 7;
167
MODULE_PARM(NVreg_ReqAGPRate, "i");
149
NV_MODULE_PARAMETER(NVreg_ReqAGPRate);
168
150
169
/* 
151
/* 
170
 * Option: UpdateKernelAGP
152
 * Option: UpdateKernelAGP
Lines 193-199 Link Here
193
 */
175
 */
194
176
195
static int NVreg_UpdateKernelAGP = 1;
177
static int NVreg_UpdateKernelAGP = 1;
196
MODULE_PARM(NVreg_UpdateKernelAGP, "i");
178
NV_MODULE_PARAMETER(NVreg_UpdateKernelAGP);
197
179
198
/* 
180
/* 
199
 * Option: EnableAGPSBA
181
 * Option: EnableAGPSBA
Lines 226-232 Link Here
226
static int NVreg_EnableAGPSBA = 0;
208
static int NVreg_EnableAGPSBA = 0;
227
#endif
209
#endif
228
210
229
MODULE_PARM(NVreg_EnableAGPSBA, "i");
211
NV_MODULE_PARAMETER(NVreg_EnableAGPSBA);
230
212
231
/*
213
/*
232
 * Option: EnableAGPFW
214
 * Option: EnableAGPFW
Lines 250-256 Link Here
250
 */
232
 */
251
233
252
static int NVreg_EnableAGPFW = 0;
234
static int NVreg_EnableAGPFW = 0;
253
MODULE_PARM(NVreg_EnableAGPFW, "i");
235
NV_MODULE_PARAMETER(NVreg_EnableAGPFW);
254
236
255
/*
237
/*
256
 * Option: SoftEDIDs
238
 * Option: SoftEDIDs
Lines 269-275 Link Here
269
 */
251
 */
270
252
271
static int NVreg_SoftEDIDs = 1;
253
static int NVreg_SoftEDIDs = 1;
272
MODULE_PARM(NVreg_SoftEDIDs, "i");
254
NV_MODULE_PARAMETER(NVreg_SoftEDIDs);
273
255
274
/* 
256
/* 
275
 * Option: Mobile
257
 * Option: Mobile
Lines 293-306 Link Here
293
 */
275
 */
294
276
295
static int NVreg_Mobile = ~0;
277
static int NVreg_Mobile = ~0;
296
MODULE_PARM(NVreg_Mobile, "i");
278
NV_MODULE_PARAMETER(NVreg_Mobile);
297
279
298
280
299
static int NVreg_ResmanDebugLevel = ~0;
281
static int NVreg_ResmanDebugLevel = ~0;
300
MODULE_PARM(NVreg_ResmanDebugLevel, "i");
282
NV_MODULE_PARAMETER(NVreg_ResmanDebugLevel);
301
283
302
static int NVreg_FlatPanelMode = 0;
284
static int NVreg_FlatPanelMode = 0;
303
MODULE_PARM(NVreg_FlatPanelMode, "i");
285
NV_MODULE_PARAMETER(NVreg_FlatPanelMode);
304
286
305
/*
287
/*
306
 * You can enable any of the registry options disabled by default by
288
 * You can enable any of the registry options disabled by default by

Return to bug 36286