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 (+261 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
# The precompiled kernel module build process requires a separation of the
49
# closed source and open source object files.
50
#
51
52
KERNEL_GLUE_NAME := nv-linux.o
53
KERNEL_GLUE_OBJS := $(RESMAN_GLUE_OBJS) $(MODULE_NAME).mod.o
54
55
#
56
# A bug in KBUILD 2.4 means that leaving obj-m set in top-level context
57
# will cause Rules.make to call pathdown.sh, which is wrong. So, we only
58
# set this conditional of a kernel-level instance.
59
#
60
61
ifdef TOPDIR
62
obj-m += $(MODULE_NAME).o
63
endif
64
65
#
66
# Include local source directory in $(CC)'s include path and set disable any
67
# warning types that are of little interest to us.
68
#
69
70
EXTRA_CFLAGS += -I$(src)
71
EXTRA_CFLAGS += -Wno-cast-qual -Wno-strict-prototypes
72
73
#
74
# Determine location of the Linux kernel source tree. Allow users to override
75
# the default (i.e. automatically determined) kernel source location with the
76
# SYSSRC directive; this new directive replaces NVIDIA's SYSINCLUDE.
77
#
78
79
ifdef SYSSRC
80
  KERNEL_SOURCES := $(SYSSRC)
81
  KERNEL_HEADERS := -I$(KERNEL_SOURCES)/include
82
  MODULE_ROOT    := /lib/modules/$(shell uname -r)/kernel/drivers # XXX
83
else
84
  KERNEL_SOURCES := /lib/modules/$(shell uname -r)/build
85
  KERNEL_HEADERS := -I$(KERNEL_SOURCES)/include
86
  MODULE_ROOT    := /lib/modules/$(shell uname -r)/kernel/drivers
87
endif
88
89
#
90
# We rely on these two definitions below; if they aren't set, we set them to
91
# reasonable defaults (Linux 2.4's KBUILD, and top-level passes will not set
92
# these).
93
#
94
95
src ?= .
96
obj ?= .
97
98
#
99
# Sets any internal variables left unset by KBUILD (e.g. this happens during
100
# a top-level run).
101
#
102
103
TOPDIR ?= $(KERNEL_SOURCES)
104
PATCHLEVEL ?= $(shell sh $(src)/conftest.sh kernel_patch_level $(TOPDIR))
105
106
#
107
# Linux 2.4 uses the .o module extension. Linux 2.5, however, uses the .ko
108
# module extension. Handle these gracefully.
109
#
110
111
ifeq ($(PATCHLEVEL), 4)
112
  MODULE_OBJECT := $(MODULE_NAME).o
113
else
114
  MODULE_OBJECT := $(MODULE_NAME).ko
115
endif
116
117
#
118
# NVIDIA specific CFLAGS and #define's. The remap_page_range check has become
119
# necessary with the introduction of the five argument version to Linux 2.4
120
# distribution kernels; this conflicting change cannot be detected at compile
121
# time.
122
#
123
124
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
125
126
ifeq ($(shell echo $(NVDEBUG)),1)
127
  ifeq ($(shell test -z $(RMDEBUG) && echo yes),yes)
128
    RMDEBUG=1
129
  endif
130
endif
131
132
ifeq ($(shell echo $(RMDEBUG)),1)
133
  EXTRA_CFLAGS += -DDEBUG -g -fno-common
134
endif
135
136
ifeq ($(shell sh $(src)/conftest.sh remap_page_range $(KERNEL_HEADERS)), 5)
137
  EXTRA_CFLAGS += -DREMAP_PAGE_RANGE_5
138
endif
139
140
ifeq ($(shell sh $(src)/conftest.sh remap_page_range $(KERNEL_HEADERS)), 4)
141
  EXTRA_CFLAGS += -DREMAP_PAGE_RANGE_4
142
endif
143
144
#
145
# NVIDIA binary object file includes .common section.
146
#
147
148
EXTRA_LDFLAGS := -d
149
150
#
151
# Miscellaneous NVIDIA kernel module build support targets. They are needed
152
# to satisfy KBUILD requirements and to support NVIDIA specifics.
153
#
154
155
$(obj)/nv-kernel.o:
156
	cp $(src)/$(RESMAN_CORE_OBJS) $(obj)/$(RESMAN_CORE_OBJS)
157
158
$(obj)/$(VERSION_HEADER):
159
	echo \#define NV_COMPILER \"`$(CC) -v 2>&1 | tail -n 1`\" > $@
160
161
$(obj)/nv.o: $(obj)/$(VERSION_HEADER)
162
163
#
164
# More quirks for Linux 2.4 KBUILD, which doesn't link automatically.
165
#
166
167
ifeq ($(PATCHLEVEL), 4)
168
$(obj)/$(MODULE_NAME).o: $($(MODULE_NAME)-objs)
169
	$(LD) $(EXTRA_LDFLAGS) -r -o $@ $($(MODULE_NAME)-objs)
170
endif
171
172
#
173
# KBUILD build parameters.
174
#
175
176
KBUILD_PARAMS := -C $(KERNEL_SOURCES) SUBDIRS=$(PWD)
177
178
#
179
# NVIDIA sanity checks.
180
#
181
182
suser-sanity-check:
183
	@if ! sh conftest.sh suser_sanity_check; then \
184
	  echo; \
185
	  echo "You have insufficient privileges for this operation. Please "; \
186
	  echo "run \"make install\" as root!                               "; \
187
	  echo; \
188
	  exit 1; \
189
	fi
190
191
rmmod-sanity-check:
192
	@if ! sh conftest.sh rmmod_sanity_check $(MODULE_NAME); then \
193
	  echo; \
194
	  echo "Unable to unload the currently loaded NVIDIA kernel module! "; \
195
	  echo "Please be certain that you have exited X before attempting  "; \
196
	  echo "to install this version.                                    "; \
197
	  echo; \
198
	  exit 1; \
199
	fi
200
201
cc-sanity-check:
202
	@if ! sh conftest.sh cc_sanity_check full_output $(CC); then \
203
		exit 1; \
204
	fi
205
206
#
207
# Build the NVIDIA kernel module using Linux KBUILD. This target is used by
208
# the "package-install" target below.
209
#
210
211
$(MODULE_OBJECT): cc-sanity-check
212
	@make $(KBUILD_PARAMS) modules; \
213
	if ! [ -f $(MODULE_OBJECT) ]; then \
214
	  echo "$(MODULE_OBJECT) failed to build!"; \
215
	  exit 1; \
216
	fi
217
218
#
219
# Build the NVIDIA kernel module with KBUILD. Verify that the user posesses
220
# sufficient privileges. Rebuild the module dependency file.
221
#
222
223
module-install: suser-sanity-check $(MODULE_OBJECT)
224
	@mkdir -p $(MODULE_ROOT)/video; \
225
	install -m 0664 -o root -g root $(MODULE_OBJECT) $(MODULE_ROOT)/video; \
226
	/sbin/depmod -ae;
227
228
#
229
# This target builds, then installs, then creates device nodes and inserts
230
# the module, if successful.
231
#
232
233
package-install: module-install rmmod-sanity-check
234
	@sh makedevices.sh; \
235
	/sbin/modprobe $(MODULE_NAME) && \
236
	echo "$(MODULE_OBJECT) installed successfully.";
237
238
#
239
# Build an object file suitable for further processing by the installer and
240
# inclusion as a precompiled kernel interface file.
241
#
242
243
$(KERNEL_GLUE_NAME): $(MODULE_OBJECT)
244
	@ld -r -o $(KERNEL_GLUE_NAME) $(KERNEL_GLUE_OBJS)
245
246
#
247
# Support hack, KBUILD isn't prepared to clean up after external modules.
248
#
249
250
clean:
251
	@rm -f $(RESMAN_GLUE_OBJS) .*.{cmd,flags}
252
	@rm -f $(MODULE_NAME).{o,ko,mod.{o,c}} built-in.o $(VERSION_HEADER) *~
253
254
#
255
# Linux 2.4 KBUILD requires the inclusion of Rules.make; Linux 2.5's KBUILD
256
# includes dependencies automatically.
257
#
258
259
ifeq ($(PATCHLEVEL), 4)
260
include $(KERNEL_SOURCES)/Rules.make
261
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 (-94 / +176 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 299-311 Link Here
299
 * DMA use with the hardware.  This has to be done differently for
290
 * DMA use with the hardware.  This has to be done differently for
300
 * different platforms and kernel versions.
291
 * different platforms and kernel versions.
301
 */
292
 */
302
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 2, 18)
293
#if defined(NVCPU_IA64)
303
#define NV_VMALLOC(ptr, size) \
304
    { \
305
        (void *) (ptr) = vmalloc(size); \
306
        VM_ALLOC_RECORD(ptr, size, "vm_alloc"); \
307
    }
308
#elif defined(NVCPU_IA64)
309
#define NV_VMALLOC(ptr, size) \
294
#define NV_VMALLOC(ptr, size) \
310
    { \
295
    { \
311
        (void *) (ptr) = vmalloc_dma(size); \
296
        (void *) (ptr) = vmalloc_dma(size); \
Lines 377-454 Link Here
377
362
378
#endif /* !defined NVWATCH */
363
#endif /* !defined NVWATCH */
379
364
365
#define GET_MODULE_SYMBOL(mod,sym)      (const void *) inter_module_get(sym)
366
#define PUT_MODULE_SYMBOL(sym)          (inter_module_put((char *) sym))
380
367
381
#if !defined (KERNEL_2_2)
368
#ifdef KERNEL_2_6
382
#  define LINUX_VMA_OFFS(vma)           (((vma)->vm_pgoff) << PAGE_SHIFT)
369
# define NV_IS_SUSER()                  capable(CAP_SYS_ADMIN)
383
#  define GET_MODULE_SYMBOL(mod,sym)	(const void *) inter_module_get(sym)
370
# define NV_PCI_DEVICE_NAME(x)          ((x)->pretty_name)
384
#  define PUT_MODULE_SYMBOL(sym)        inter_module_put((char *) sym)
371
# define NV_CLI()                       local_irq_disable()
385
#  define GET_MAP_NR(phys_page)         virt_to_page(__va(phys_page))
372
# define NV_SAVE_FLAGS(x)               local_save_flags(x)
386
#  define MEM_MAP_READ_COUNT(map_nr)    (atomic_read(&(map_nr)->count))
373
# define NV_RESTORE_FLAGS(x)            local_irq_restore(x)
387
#  define MEM_MAP_INC_COUNT(map_nr)     (atomic_inc(&(map_nr)->count))
374
# define NV_MAY_SLEEP()                 (!in_interrupt() && !in_atomic())
388
#  define MEM_MAP_DEC_COUNT(map_nr)     (atomic_dec(&(map_nr)->count))
375
# define NV_SMP_NUM_CPUS                num_online_cpus()
389
#  define EVENT_QUEUE(ptr)               ((struct __wait_queue_head *)(ptr))
376
# define NV_MODULE_PARAMETER(x)         module_param(x, int, 0)
390
#  define VMA_PRIVATE(vma)              ((vma)->vm_private_data)
377
#else
391
#  define INIT_EVENT_QUEUE(ptr) \
378
# define NV_IS_SUSER()                  suser()
392
     if (ptr == NULL) { \
379
# define NV_PCI_DEVICE_NAME(x)          ((x)->name)
393
        NV_KMALLOC((ptr), sizeof(struct __wait_queue_head)); \
380
# define NV_CLI()                       cli()
394
        if (ptr) { \
381
# define NV_SAVE_FLAGS(x)               save_flags(x)
395
            memset((ptr), 0, sizeof(struct __wait_queue_head)); \
382
# define NV_RESTORE_FLAGS(x)            restore_flags(x)
396
            init_waitqueue_head((struct __wait_queue_head *)(ptr)); \
383
# define NV_MAY_SLEEP()                 (!in_interrupt())
397
        } \
384
# define NV_SMP_NUM_CPUS                smp_num_cpus
398
     }
385
# 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;
386
#endif
400
#else
387
401
#  define in_irq()                      (local_irq_count[smp_processor_id()])
388
#define NV_DEVICE_NUMBER(x)             minor((x)->i_rdev)
402
#  define LINUX_VMA_OFFS(vma)           ((vma)->vm_offset)
389
#define NV_VMA_OFFSET(x)                (((x)->vm_pgoff) << PAGE_SHIFT)
403
#  define GET_MODULE_SYMBOL(mod, sym)   (void*) get_module_symbol((mod), (sym))
390
#define NV_VMA_PRIVATE(x)               ((x)->vm_private_data)
404
#  define PUT_MODULE_SYMBOL(sym)
391
#define NV_IS_CONTROL_DEVICE(x)         (minor((x)->i_rdev) == 255)
405
#  define GET_MAP_NR(phys_page)         MAP_NR(__va(phys_page))
392
406
#  define MEM_MAP_READ_COUNT(map_nr)    (atomic_read(&mem_map[map_nr].count))
393
#ifndef minor
407
#  define MEM_MAP_INC_COUNT(map_nr)     (atomic_inc(&mem_map[map_nr].count))
394
/*
408
#  define MEM_MAP_DEC_COUNT(map_nr)     (atomic_dec(&mem_map[map_nr].count))
395
 * XXX Is this correct for all possible target kernels? We need this to
409
#  define EVENT_QUEUE(ptr)              ((struct wait_queue **) &(ptr))
396
 * support older 2.4 and some 2.6 kernels.
410
#  define VMA_PRIVATE(vma)              ((void*)((vma)->vm_pte))
397
 */
411
#  define INIT_EVENT_QUEUE(ptr)         if (ptr) { ((ptr) = NULL); }
398
# define minor(x) MINOR(x)
412
#  define FREE_EVENT_QUEUE(ptr)
399
#endif
400
401
#ifndef KERNEL_2_6
402
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 23)
403
  typedef void irqreturn_t;
404
#endif
405
# define IRQ_NONE
406
# define IRQ_RETVAL(x)
407
# define IRQ_HANDLED
408
#else
409
#ifdef AGPGART
410
  typedef struct agp_kern_info agp_kern_info;
411
  typedef struct agp_memory agp_memory;
412
#endif
413
  typedef void* devfs_handle_t;
414
#endif
415
416
#ifdef KERNEL_2_6
417
#define NV_DEVFS_REGISTER(_name, _minor)                            \
418
({                                                                  \
419
    devfs_handle_t __handle = NULL;                                 \
420
    devfs_mk_cdev(MKDEV(NV_MAJOR_DEVICE_NUMBER, _minor),            \
421
            S_IFCHR | S_IRUGO | S_IWUGO, _name);                    \
422
    __handle;                                                       \
423
})
424
425
#define NV_DEVFS_REMOVE_DEVICE(i) devfs_remove("nvidia%d", i)
426
#define NV_DEVFS_REMOVE_CONTROL() devfs_remove("nvidiactl")
427
#else
428
#define NV_DEVFS_REGISTER(_name, _minor)                            \
429
({                                                                  \
430
    devfs_handle_t __handle =                                       \
431
        devfs_register(NULL, _name, DEVFS_FL_DEFAULT,               \
432
                NV_MAJOR_DEVICE_NUMBER, _minor,                     \
433
                S_IFCHR | S_IRUGO | S_IWUGO, &nv_fops, NULL);       \
434
    __handle;                                                       \
435
 })
436
437
#define NV_DEVFS_REMOVE_DEVICE(i) devfs_unregister(nv_devfs_handles[i+1])
438
#define NV_DEVFS_REMOVE_CONTROL() devfs_unregister(nv_devfs_handles[0])
413
#endif
439
#endif
414
440
441
/*
442
 * Linux 2.5 introduced the five argument version of remap_page_range, all
443
 * relevant releases to date use it. This version was backported to 2.4 by
444
 * RedHat without means to identify the change, hence this hack.
445
 */
446
#ifdef KERNEL_2_6
447
#define NV_REMAP_PAGE_RANGE(a, b...) remap_page_range(vma, a, ## b)
448
#else
415
#if defined(REMAP_PAGE_RANGE_5)
449
#if defined(REMAP_PAGE_RANGE_5)
416
#define NV_REMAP_PAGE_RANGE(a, b...)    remap_page_range(vma, a, ## b)
450
#define NV_REMAP_PAGE_RANGE(a, b...) remap_page_range(vma, a, ## b)
417
#elif defined(REMAP_PAGE_RANGE_4)
451
#elif defined(REMAP_PAGE_RANGE_4)
418
#define NV_REMAP_PAGE_RANGE(a, b...)    remap_page_range(a, ## b)
452
#define NV_REMAP_PAGE_RANGE(a, b...) remap_page_range(a, ## b)
419
#else
453
#else
420
#error "Couldn't determine number of arguments expected by remap_page_range!"
454
#warning "conftest.sh failed, assuming old Linux 2.4 remap_page_range(4)!"
455
456
#define NV_REMAP_PAGE_RANGE(a, b...) remap_page_range(a, ## b)
421
#endif
457
#endif
458
#endif /* KERNEL_2_6 */
422
459
423
#if defined(pte_offset_atomic)
460
#if defined(pmd_offset_map)
424
#define NV_PTE_OFFSET(addres, pg_mid_dir, pte) \
461
#define NV_PMD_OFFSET(address, pgd, pmd) \
462
    { \
463
        pmd = pmd_offset_map(pgd, address); \
464
    }
465
#define NV_PMD_UNMAP(pmd) \
425
    { \
466
    { \
426
        pte_t *pte__ = pte_offset_atomic(pg_mid_dir, address); \
467
        pmd_unmap(pmd); \
427
        pte = *pte__; \
428
        pte_kunmap(pte__); \
429
    }
468
    }
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
469
#else
434
#define NV_PTE_OFFSET(addres, pg_mid_dir, pte) \
470
#define NV_PMD_OFFSET(address, pgd, pmd) \
435
    { \
471
    { \
436
        pte_t *pte__ = pte_offset_map(pg_mid_dir, address); \
472
        pmd = pmd_offset(pgd, address); \
437
        pte = *pte__; \
438
        pte_unmap(pte__); \
439
    }
473
    }
474
#define NV_PMD_UNMAP(pmd)
440
#endif
475
#endif
441
476
442
#define NV_PAGE_ALIGN(addr)             ( ((addr) + PAGE_SIZE - 1) / PAGE_SIZE)
477
#define NV_PMD_PRESENT(pmd) \
443
#define NV_MASK_OFFSET(addr)            ( (addr) & (PAGE_SIZE - 1) )
478
    ({ \
479
        if (pmd) { \
480
            if (pmd_none(*pmd)) { \
481
                NV_PMD_UNMAP(pmd); pmd = NULL; \
482
            } \
483
        } pmd != NULL; \
484
    })
444
485
445
#ifndef MAXMEM  /* temporary define for 2.2 kernels */
486
#if defined (pte_offset_atomic)
446
#define MAXMEM  (-PAGE_OFFSET - (64 * 1024 * 1024))
487
#define NV_PTE_OFFSET(address, pmd, pte) \
488
    { \
489
        pte = pte_offset_atomic(pmd, address); \
490
        NV_PMD_UNMAP(pmd); \
491
    }
492
#define NV_PTE_UNMAP(pte) \
493
    { \
494
        pte_kunmap(pte); \
495
    }
496
#elif defined (pte_offset)
497
#define NV_PTE_OFFSET(address, pmd, pte) \
498
    { \
499
        pte = pte_offset(pmd, address); \
500
        NV_PMD_UNMAP(pmd); \
501
    }
502
#define NV_PTE_UNMAP(pte)
503
#else
504
#define NV_PTE_OFFSET(address, pmd, pte) \
505
    { \
506
        pte = pte_offset_map(pmd, address); \
507
        NV_PMD_UNMAP(pmd); \
508
    }
509
#define NV_PTE_UNMAP(pte) \
510
    { \
511
        pte_unmap(pte); \
512
    }
447
#endif
513
#endif
448
514
449
#ifndef NV01_ROOT
515
#define NV_PTE_PRESENT(pte) \
450
#define NV01_ROOT 0x00000000
516
    ({ \
451
#endif 
517
        if (pte) { \
518
            if (!pte_present(*pte)) { \
519
                NV_PTE_UNMAP(pte); pte = NULL; \
520
            } \
521
        } pte != NULL; \
522
    })
523
524
#define NV_PTE_VALUE(pte) \
525
    ({ \
526
        unsigned long __pte_value = pte_val(*pte); \
527
        NV_PTE_UNMAP(pte); \
528
        __pte_value; \
529
    })
530
531
#define NV_PAGE_ALIGN(addr)             ( ((addr) + PAGE_SIZE - 1) / PAGE_SIZE)
532
#define NV_MASK_OFFSET(addr)            ( (addr) & (PAGE_SIZE - 1) )
452
533
453
#if defined(NVCPU_IA64)
534
#if defined(NVCPU_IA64)
454
#define NV_GFP_HW (GFP_KERNEL | __GFP_DMA)
535
#define NV_GFP_HW (GFP_KERNEL | __GFP_DMA)
Lines 475-481 Link Here
475
static inline int NV_IRQL_IS_RAISED()
556
static inline int NV_IRQL_IS_RAISED()
476
    {
557
    {
477
        unsigned long int eflags;
558
        unsigned long int eflags;
478
        __save_flags(eflags);
559
        NV_SAVE_FLAGS(eflags);
479
        return !(eflags & NV_CPU_INTERRUPT_FLAGS_BIT);
560
        return !(eflags & NV_CPU_INTERRUPT_FLAGS_BIT);
480
    }
561
    }
481
 
562
 
Lines 557-565 Link Here
557
    struct pci_dev *dev;
638
    struct pci_dev *dev;
558
    nv_alloc_t *alloc_queue;
639
    nv_alloc_t *alloc_queue;
559
640
560
    // bottom half interrupt handler info; per device
641
     /* keep track of any pending bottom halfes */
561
    /* keep track of any pending bottom-halves */
642
     struct tasklet_struct tasklet;
562
    struct tq_struct *bh;
643
644
     /* active bottom half counter */
563
    atomic_t bh_count;
645
    atomic_t bh_count;
564
646
565
    /* get a timer callback every second */
647
    /* get a timer callback every second */
Lines 597-603 Link Here
597
    U032 num_events;
679
    U032 num_events;
598
    U032 put, get;
680
    U032 put, get;
599
    spinlock_t fp_lock;
681
    spinlock_t fp_lock;
600
    void *wqueue;               // wait_queue for polling
682
    wait_queue_head_t waitqueue;
601
    nv_event_t *event_fifo;     // fifo for storing events
683
    nv_event_t *event_fifo;     // fifo for storing events
602
} nv_file_private_t;
684
} nv_file_private_t;
603
685
(-)NVIDIA_kernel-1.0-5328/nv-misc.h (+6 lines)
Lines 53-57 Link Here
53
53
54
typedef void *PHWINFO;
54
typedef void *PHWINFO;
55
55
56
/*
57
 * XXX: Make sure that arguments to and from the core resource
58
 * manager are passed and expected on the stack. Is this a good
59
 * place for this?
60
 */
61
#define NV_API_CALL __attribute__((regparm(0)))
56
62
57
#endif /* _NV_MISC_H_ */
63
#endif /* _NV_MISC_H_ */
(-)NVIDIA_kernel-1.0-5328/nv.c (-173 / +137 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
void          nv_kern_isr_bh(unsigned long);
124
irqreturn_t   nv_kern_isr(int, void *, struct pt_regs *);
139
void          nv_kern_rc_timer(unsigned long);
125
void          nv_kern_rc_timer(unsigned long);
140
#ifdef CONFIG_PM
126
#ifdef CONFIG_PM
141
int           nv_kern_pm(struct pm_dev *dev, pm_request_t rqst, void *data);
127
int           nv_kern_pm(struct pm_dev *dev, pm_request_t rqst, void *data);
Lines 158-163 Link Here
158
/* character driver entry points */
144
/* character driver entry points */
159
145
160
static struct file_operations nv_fops = {
146
static struct file_operations nv_fops = {
147
    owner:          THIS_MODULE,
161
    poll:           nv_kern_poll,
148
    poll:           nv_kern_poll,
162
    ioctl:          nv_kern_ioctl,
149
    ioctl:          nv_kern_ioctl,
163
    mmap:           nv_kern_mmap,
150
    mmap:           nv_kern_mmap,
Lines 329-336 Link Here
329
    {
316
    {
330
        nv_printf(NV_DBG_MEMINFO, "  0x%x (0x%x): count %d flags 0x%x\n", 
317
        nv_printf(NV_DBG_MEMINFO, "  0x%x (0x%x): count %d flags 0x%x\n", 
331
            page_ptr->phys_addr, page_ptr->dma_addr,
318
            page_ptr->phys_addr, page_ptr->dma_addr,
332
            (GET_MAP_NR(page_ptr->phys_addr))->count,
319
            (virt_to_page(__va(page_ptr->phys_addr)))->count,
333
            (GET_MAP_NR(page_ptr->phys_addr))->flags);
320
            (virt_to_page(__va(page_ptr->phys_addr)))->flags);
334
        num_pages--;
321
        num_pages--;
335
        page_ptr++;
322
        page_ptr++;
336
    }
323
    }
Lines 401-407 Link Here
401
        phys_addr = virt_to_phys((void *) virt_addr);
388
        phys_addr = virt_to_phys((void *) virt_addr);
402
389
403
        /* lock the page for dma purposes */
390
        /* lock the page for dma purposes */
404
        mem_map_reserve(GET_MAP_NR(phys_addr));
391
        SetPageReserved(virt_to_page(__va(phys_addr)));
405
392
406
        page_ptr->phys_addr = phys_addr;
393
        page_ptr->phys_addr = phys_addr;
407
        page_ptr->virt_addr = virt_addr;
394
        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
434
        // but if we failed pci_map_sg, make sure to free this page
448
        if (page_ptr->virt_addr)
435
        if (page_ptr->virt_addr)
449
        {
436
        {
450
            mem_map_unreserve(GET_MAP_NR(page_ptr->phys_addr));
437
            ClearPageReserved(virt_to_page(__va(page_ptr->phys_addr)));
451
            NV_SET_PAGE_ATTRIB_CACHED(page_ptr);
438
            NV_SET_PAGE_ATTRIB_CACHED(page_ptr);
452
#if defined(NVCPU_X86_64)
439
#if defined(NVCPU_X86_64)
453
            // only unmap the page if it really was mapped through
440
            // only unmap the page if it really was mapped through
Lines 481-487 Link Here
481
468
482
    while (pages_left)
469
    while (pages_left)
483
    {
470
    {
484
        mem_map_unreserve(GET_MAP_NR(page_ptr->phys_addr));
471
        ClearPageReserved(virt_to_page(__va(page_ptr->phys_addr)));
485
        page_ptr++;
472
        page_ptr++;
486
        pages_left--;
473
        pages_left--;
487
    }
474
    }
Lines 616-622 Link Here
616
    return 0;
603
    return 0;
617
}
604
}
618
605
619
static struct pci_dev* nvos_find_agp_by_class(unsigned int class)
606
struct pci_dev* nvos_find_agp_by_class(unsigned int class)
620
{
607
{
621
    struct pci_dev *dev, *fn;
608
    struct pci_dev *dev, *fn;
622
    u8     cap_ptr;
609
    u8     cap_ptr;
Lines 674-684 Link Here
674
    nv_linux_state_t *nvl;
661
    nv_linux_state_t *nvl;
675
    nv_linux_state_t *nv_max_devices;
662
    nv_linux_state_t *nv_max_devices;
676
663
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);
664
    proc_nvidia = create_proc_entry("nvidia", flags, proc_root_driver);
683
    proc_nvidia_cards = create_proc_entry("cards", flags, proc_nvidia);
665
    proc_nvidia_cards = create_proc_entry("cards", flags, proc_nvidia);
684
    proc_nvidia_agp = create_proc_entry("agp", flags, proc_nvidia);
666
    proc_nvidia_agp = create_proc_entry("agp", flags, proc_nvidia);
Lines 740-748 Link Here
740
{
722
{
741
#ifdef CONFIG_PROC_FS
723
#ifdef CONFIG_PROC_FS
742
    nvos_proc_remove_all(proc_nvidia);
724
    nvos_proc_remove_all(proc_nvidia);
743
#if defined (KERNEL_2_2)
744
    remove_proc_entry("driver", &proc_root);
745
#endif
746
#endif
725
#endif
747
}
726
}
748
727
Lines 831-839 Link Here
831
 *** EXPORTS to Linux Kernel
810
 *** EXPORTS to Linux Kernel
832
 ***/
811
 ***/
833
812
834
int init_module(void)
813
static int __init nvidia_init_module(void)
835
{
814
{
836
    nv_linux_state_t *nvl;
837
    int rc, i;
815
    int rc, i;
838
816
839
    memset(nv_linux_devices, 0, sizeof(nv_linux_devices));
817
    memset(nv_linux_devices, 0, sizeof(nv_linux_devices));
Lines 846-852 Link Here
846
824
847
    nv_printf(NV_DBG_ERRORS, "nvidia: loading %s\n", pNVRM_ID);
825
    nv_printf(NV_DBG_ERRORS, "nvidia: loading %s\n", pNVRM_ID);
848
826
849
#ifdef CONFIG_DEVFS_FS
827
#if defined(CONFIG_DEVFS_FS) && !defined(KERNEL_2_6)
850
    rc = devfs_register_chrdev(nv_major, "nvidia", &nv_fops);
828
    rc = devfs_register_chrdev(nv_major, "nvidia", &nv_fops);
851
#else
829
#else
852
    rc = register_chrdev(nv_major, "nvidia", &nv_fops);
830
    rc = register_chrdev(nv_major, "nvidia", &nv_fops);
Lines 858-891 Link Here
858
    }
836
    }
859
837
860
#ifdef CONFIG_DEVFS_FS
838
#ifdef CONFIG_DEVFS_FS
861
    memset(nv_dev_handle, 0, sizeof(devfs_handle_t) * NV_MAX_DEVICES);
862
    do {
839
    do {
840
        /*
841
         * XXX This code isn't pretty, but neither is dealing with the
842
         * various Linux devfs implemenation(s). While Linux APIs are
843
         * known to be anything but stable and oftentimes anything but
844
         * well designed, the devfs interface has been more painful to
845
         * deal with than most other APIs.
846
         */
863
        char name[10];
847
        char name[10];
864
848
865
        nv_ctl_handle = devfs_register(NULL, "nvidiactl",
849
        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
850
870
        for (i = 0; i < num_nv_devices; i++) {
851
        for (i = 0; i < num_nv_devices; i++) {
871
            sprintf(name, "nvidia%d", i);
852
            sprintf(name, "nvidia%d", i);
872
            nv_dev_handle[i] = devfs_register(NULL, name,
853
            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
        }
854
        }
877
    } while(0);
855
    } while(0);
878
#endif
856
#endif
879
857
880
    nv_printf(NV_DBG_INFO, "init_module: major number %d\n", nv_major);
858
    nv_printf(NV_DBG_INFO, "nvidia_init_module: major number %d\n", nv_major);
881
859
882
    // init all the bottom half structures
860
    /* instantiate tasklets */
883
    for (nvl = nv_linux_devices; nvl < nv_linux_devices + NV_MAX_DEVICES; nvl++)
861
    for (i = 0; i < NV_MAX_DEVICES; i++) {
884
    {
862
        /*
885
        nvl->bh = &nv_bottom_halves[nvl - nv_linux_devices];
863
         * We keep one tasklet per card to avoid latency issues with more
886
        nvl->bh->routine = nv_kern_bh;
864
         * than one device; no two instances of a single tasklet are ever
887
        nvl->bh->data = (void *) nvl;
865
         * executed concurrently.
888
        nvl->bh->sync = 0;
866
         */
867
        atomic_set(&nv_linux_devices[i].tasklet.count, 1);
889
    }
868
    }
890
869
891
    // init the nvidia control device
870
    // init the nvidia control device
Lines 893-898 Link Here
893
        nv_state_t *nv_ctl = NV_STATE_PTR(&nv_ctl_device);
872
        nv_state_t *nv_ctl = NV_STATE_PTR(&nv_ctl_device);
894
        nv_ctl->os_state = (void *) &nv_ctl_device;
873
        nv_ctl->os_state = (void *) &nv_ctl_device;
895
        nv_lock_init_locks(nv_ctl);
874
        nv_lock_init_locks(nv_ctl);
875
        init_waitqueue_head(&nv_ctl_waitqueue);
896
    }
876
    }
897
877
898
#ifdef CONFIG_PM
878
#ifdef CONFIG_PM
Lines 919-932 Link Here
919
    /* create /proc/driver/nvidia */
899
    /* create /proc/driver/nvidia */
920
    nvos_proc_create();
900
    nvos_proc_create();
921
901
922
#if defined(DEBUG) && !defined(KERNEL_2_2)
902
#if defined(DEBUG)
923
    inter_module_register("nv_linux_devices", THIS_MODULE, nv_linux_devices);
903
    inter_module_register("nv_linux_devices", THIS_MODULE, nv_linux_devices);
924
#endif
904
#endif
925
905
926
    return 0;
906
    return 0;
927
907
928
 failed:
908
 failed:
929
#ifdef CONFIG_DEVFS_FS
909
#if defined(CONFIG_DEVFS_FS) && !defined(KERNEL_2_6)
930
    devfs_unregister_chrdev(nv_major, "nvidia");
910
    devfs_unregister_chrdev(nv_major, "nvidia");
931
#else
911
#else
932
    unregister_chrdev(nv_major, "nvidia");
912
    unregister_chrdev(nv_major, "nvidia");
Lines 934-959 Link Here
934
    return rc;
914
    return rc;
935
}
915
}
936
916
937
void cleanup_module(void)
917
static void __exit nvidia_exit_module(void)
938
{
918
{
939
    int rc, i;
919
    int rc;
940
    nv_linux_state_t *nvl;
920
    nv_linux_state_t *nvl, *max_devices;
941
    nv_linux_state_t *max_devices;
942
921
943
    /* remove /proc/driver/nvidia */
922
    /* remove /proc/driver/nvidia */
944
    nvos_proc_remove();
923
    nvos_proc_remove();
945
924
946
    nv_printf(NV_DBG_INFO, "cleanup_module\n");
925
    nv_printf(NV_DBG_INFO, "nvidia_exit_module\n");
947
926
948
#if defined(DEBUG) && !defined(KERNEL_2_2)
927
#if defined(DEBUG)
949
    inter_module_unregister("nv_linux_devices");
928
    inter_module_unregister("nv_linux_devices");
950
#endif
929
#endif
951
930
952
#ifdef CONFIG_PM
931
#ifdef CONFIG_PM
953
    for (i = 0; i < num_nv_devices; i++)
932
    do {
954
    {
933
        int i;
955
        pm_unregister(pm_nv_dev[i]);
934
        for (i = 0; i < num_nv_devices; i++) {
956
    }
935
            pm_unregister(pm_nv_dev[i]);
936
        }
937
    } while (0);
957
#endif
938
#endif
958
939
959
    // Shutdown the resource manager
940
    // Shutdown the resource manager
Lines 972-1001 Link Here
972
                continue;
953
                continue;
973
954
974
            nv_printf(NV_DBG_ERRORS,
955
            nv_printf(NV_DBG_ERRORS,
975
                    "still have vm que at cleanup_module(): 0x%x to 0x%x\n",
956
                    "still have vm que at nvidia_exit_module(): 0x%x to 0x%x\n",
976
                    nvl->alloc_queue->vma->vm_start,
957
                    nvl->alloc_queue->vma->vm_start,
977
                    nvl->alloc_queue->vma->vm_end);
958
                    nvl->alloc_queue->vma->vm_end);
978
        }
959
        }
979
    }
960
    }
980
961
981
#ifdef CONFIG_DEVFS_FS
962
#if defined(CONFIG_DEVFS_FS) && !defined(KERNEL_2_6)
982
    rc = devfs_unregister_chrdev(nv_major, "nvidia");
963
    rc = devfs_unregister_chrdev(nv_major, "nvidia");
983
#else
964
#else
984
    rc = unregister_chrdev(nv_major, "nvidia");
965
    rc = unregister_chrdev(nv_major, "nvidia");
985
#endif
966
#endif
986
967
987
    if (rc < 0) {
968
    if (rc < 0) {
988
        nv_printf(NV_DBG_ERRORS, "cleanup_module: unregister nv failed\n");
969
        nv_printf(NV_DBG_ERRORS, "nvidia_exit_module: unregister nv failed\n");
989
    }
970
    }
990
971
991
#ifdef CONFIG_DEVFS_FS
972
#ifdef CONFIG_DEVFS_FS
992
    do {
973
    do {
993
        int i;
974
        int i;
994
        for (i = 0; nv_dev_handle[i] != 0; i++) {
975
        NV_DEVFS_REMOVE_CONTROL();
995
            devfs_unregister(nv_dev_handle[i]);
976
        for (i = 0; i < num_nv_devices; i++)
996
        }
977
            NV_DEVFS_REMOVE_DEVICE(i);
997
    } while(0);
978
    } while (0);
998
    devfs_unregister(nv_ctl_handle);
999
#endif
979
#endif
1000
980
1001
#if NV_ENABLE_MEM_TRACKING
981
#if NV_ENABLE_MEM_TRACKING
Lines 1007-1012 Link Here
1007
#endif
987
#endif
1008
}
988
}
1009
989
990
module_init(nvidia_init_module);
991
module_exit(nvidia_exit_module);
1010
992
1011
/* this is only called when the vmas are duplicated.
993
/* this is only called when the vmas are duplicated.
1012
 * this appears to only happen when the process is cloned to create
994
 * 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)
1002
nv_kern_vma_open(struct vm_area_struct *vma)
1021
{
1003
{
1022
    nv_printf(NV_DBG_MEMINFO, "vma_open for 0x%x - 0x%x, offset 0x%x\n",
1004
    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));
1005
        vma->vm_start, vma->vm_end, NV_VMA_OFFSET(vma));
1024
1006
1025
    if (VMA_PRIVATE(vma))
1007
    if (NV_VMA_PRIVATE(vma))
1026
    {
1008
    {
1027
        nv_alloc_t *at = (nv_alloc_t *) VMA_PRIVATE(vma);
1009
        nv_alloc_t *at = (nv_alloc_t *) NV_VMA_PRIVATE(vma);
1028
        at->usage_count++;
1010
        at->usage_count++;
1029
1011
1030
        nv_printf(NV_DBG_MEMINFO, "  at 0x%x, usage count %d, page_table 0x%x\n",
1012
        nv_printf(NV_DBG_MEMINFO, "  at 0x%x, usage count %d, page_table 0x%x\n",
Lines 1032-1039 Link Here
1032
1014
1033
        nvos_list_page_count(at->page_table, at->num_pages);
1015
        nvos_list_page_count(at->page_table, at->num_pages);
1034
    }
1016
    }
1035
1036
    MOD_INC_USE_COUNT;
1037
}
1017
}
1038
1018
1039
1019
Lines 1041-1051 Link Here
1041
nv_kern_vma_release(struct vm_area_struct *vma)
1021
nv_kern_vma_release(struct vm_area_struct *vma)
1042
{
1022
{
1043
    nv_printf(NV_DBG_MEMINFO, "vma_release for 0x%x - 0x%x, offset 0x%x\n",
1023
    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));
1024
        vma->vm_start, vma->vm_end, NV_VMA_OFFSET(vma));
1045
1025
1046
    if (VMA_PRIVATE(vma))
1026
    if (NV_VMA_PRIVATE(vma))
1047
    {
1027
    {
1048
        nv_alloc_t *at = (nv_alloc_t *) VMA_PRIVATE(vma);
1028
        nv_alloc_t *at = (nv_alloc_t *) NV_VMA_PRIVATE(vma);
1049
1029
1050
        at->usage_count--;
1030
        at->usage_count--;
1051
1031
Lines 1063-1097 Link Here
1063
            if (at->page_table)
1043
            if (at->page_table)
1064
                nvos_unlock_pages(at);
1044
                nvos_unlock_pages(at);
1065
            nvos_free_alloc(at);
1045
            nvos_free_alloc(at);
1066
            VMA_PRIVATE(vma) = NULL;
1046
            NV_VMA_PRIVATE(vma) = NULL;
1067
        }
1047
        }
1068
    }
1048
    }
1069
1070
    MOD_DEC_USE_COUNT;
1071
}
1049
}
1072
1050
1073
1051
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
1052
/* AGP allocations under the 460GX are not mapped to the aperture
1083
 * addresses by the CPU.  This nopage handler will fault on CPU
1053
 * addresses by the CPU.  This nopage handler will fault on CPU
1084
 * accesses to AGP memory and map the address to the correct page.
1054
 * accesses to AGP memory and map the address to the correct page.
1085
 */
1055
 */
1086
struct page *nv_kern_vma_nopage(struct vm_area_struct *vma, unsigned long address, int write_access)
1056
struct page *nv_kern_vma_nopage(struct vm_area_struct *vma, unsigned long address, int write_access)
1087
{
1057
{
1058
#if defined(NVCPU_IA64) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 9))
1088
    nv_alloc_t *at, *tmp;
1059
    nv_alloc_t *at, *tmp;
1089
    nv_linux_state_t *nvl;
1060
    nv_linux_state_t *nvl;
1090
    nv_state_t *nv;
1061
    nv_state_t *nv;
1091
    struct page *page_ptr;
1062
    struct page *page_ptr;
1092
    int rm_status, index;
1063
    int rm_status, index;
1093
1064
1094
    at = VMA_PRIVATE(vma);
1065
    at = NV_VMA_PRIVATE(vma);
1095
    if (at == NULL)
1066
    if (at == NULL)
1096
    {
1067
    {
1097
        nv_printf(NV_DBG_ERRORS, "NVRM: nopage handler called without an at: "
1068
        nv_printf(NV_DBG_ERRORS, "NVRM: nopage handler called without an at: "
Lines 1130-1136 Link Here
1130
        // far again
1101
        // far again
1131
        nv_printf(NV_DBG_ERRORS, "NVRM: nopage handler called on a freed"
1102
        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);
1103
                  "address: vm_start 0x%x, at 0x%x\n", vma->vm_start, at);
1133
        VMA_PRIVATE(vma) = NULL;
1104
        NV_VMA_PRIVATE(vma) = NULL;
1134
        return NOPAGE_SIGBUS;
1105
        return NOPAGE_SIGBUS;
1135
    }
1106
    }
1136
1107
Lines 1154-1168 Link Here
1154
    at->page_table[index].virt_addr = (unsigned long) __va(page_to_pfn(page_ptr) << PAGE_SHIFT);
1125
    at->page_table[index].virt_addr = (unsigned long) __va(page_to_pfn(page_ptr) << PAGE_SHIFT);
1155
1126
1156
    return page_ptr;
1127
    return page_ptr;
1157
}
1158
#endif
1128
#endif
1129
    return NOPAGE_SIGBUS;
1130
}
1159
1131
1160
struct vm_operations_struct nv_vm_ops = {
1132
struct vm_operations_struct nv_vm_ops = {
1161
    nv_kern_vma_open,
1133
    nv_kern_vma_open,
1162
    nv_kern_vma_release,  /* "close" */
1134
    nv_kern_vma_release,  /* "close" */
1163
#if !defined(KERNEL_2_2)
1164
    nv_kern_vma_nopage,
1135
    nv_kern_vma_nopage,
1165
#endif
1166
};
1136
};
1167
1137
1168
static nv_file_private_t *
1138
static nv_file_private_t *
Lines 1177-1183 Link Here
1177
    memset(nvfp, 0, sizeof(nv_file_private_t));
1147
    memset(nvfp, 0, sizeof(nv_file_private_t));
1178
1148
1179
    // initialize this file's event queue
1149
    // initialize this file's event queue
1180
    INIT_EVENT_QUEUE(nvfp->wqueue);
1150
    init_waitqueue_head(&nvfp->waitqueue);
1181
1151
1182
    nv_init_lock(nvfp->fp_lock);
1152
    nv_init_lock(nvfp->fp_lock);
1183
1153
Lines 1197-1207 Link Here
1197
    if (nvfp == NULL)
1167
    if (nvfp == NULL)
1198
        return;
1168
        return;
1199
1169
1200
    FREE_EVENT_QUEUE(nvfp->wqueue);
1201
    NV_VFREE(nvfp->event_fifo, sizeof(nv_event_t) * NV_EVENT_FIFO_SIZE);
1170
    NV_VFREE(nvfp->event_fifo, sizeof(nv_event_t) * NV_EVENT_FIFO_SIZE);
1202
    NV_VFREE(nvfp, sizeof(nv_file_private_t));
1171
    NV_VFREE(nvfp, sizeof(nv_file_private_t));
1203
}
1172
}
1204
1173
1174
void nv_kern_isr_bh(unsigned long data)
1175
{
1176
    /*
1177
     * XXX: This level of indirection is necessary to work around
1178
     * problems with Linux kernels using a non-standard calling
1179
     * convention, i.e. Arjan van de Ven's/RedHat's 2.6.0 kernels.
1180
     */
1181
    rm_isr_bh((VOID *) data);
1182
}
1205
1183
1206
/*
1184
/*
1207
** nv_kern_open
1185
** nv_kern_open
Lines 1226-1236 Link Here
1226
1204
1227
    /* for control device, just jump to its open routine */
1205
    /* for control device, just jump to its open routine */
1228
    /* after setting up the private data */
1206
    /* after setting up the private data */
1229
    if (NV_DEVICE_IS_CONTROL_DEVICE(inode->i_rdev))
1207
    if (NV_IS_CONTROL_DEVICE(inode))
1230
        return nv_kern_ctl_open(inode, file);
1208
        return nv_kern_ctl_open(inode, file);
1231
1209
1232
    /* what device are we talking about? */
1210
    /* what device are we talking about? */
1233
    devnum = NV_DEVICE_NUMBER(inode->i_rdev);
1211
    devnum = NV_DEVICE_NUMBER(inode);
1234
    if (devnum >= NV_MAX_DEVICES)
1212
    if (devnum >= NV_MAX_DEVICES)
1235
    {
1213
    {
1236
        rc = -ENODEV;
1214
        rc = -ENODEV;
Lines 1283-1294 Link Here
1283
            goto failed;
1261
            goto failed;
1284
        }
1262
        }
1285
1263
1264
        nvl->tasklet.func = nv_kern_isr_bh;
1265
        nvl->tasklet.data = (unsigned long) nv->pdev;
1266
        tasklet_enable(&nvl->tasklet);
1286
1267
1287
        nv->flags |= NV_FLAG_OPEN;
1268
        nv->flags |= NV_FLAG_OPEN;
1288
    }
1269
    }
1289
1270
1290
    nv->usage_count++;
1271
    nv->usage_count++;
1291
    MOD_INC_USE_COUNT;
1292
1272
1293
 failed:
1273
 failed:
1294
    nv_unlock(nvl->ldata_lock);
1274
    nv_unlock(nvl->ldata_lock);
Lines 1319-1356 Link Here
1319
1299
1320
    /* for control device, just jump to its open routine */
1300
    /* for control device, just jump to its open routine */
1321
    /* after setting up the private data */
1301
    /* after setting up the private data */
1322
    if (NV_DEVICE_IS_CONTROL_DEVICE(inode->i_rdev))
1302
    if (NV_IS_CONTROL_DEVICE(inode))
1323
        return nv_kern_ctl_close(inode, file);
1303
        return nv_kern_ctl_close(inode, file);
1324
1304
1325
    nv_printf(NV_DBG_INFO, "nv_kern_close on device %d\n", NV_DEVICE_NUMBER(inode->i_rdev));
1305
    nv_printf(NV_DBG_INFO, "nv_kern_close on device %d\n", NV_DEVICE_NUMBER(inode));
1326
1306
1327
    rm_free_unused_clients(nv, current->pid, (void *) file);
1307
    rm_free_unused_clients(nv, current->pid, (void *) file);
1328
1308
1329
    nv_lock(nvl->ldata_lock);
1309
    nv_lock(nvl->ldata_lock);
1330
    if (--nv->usage_count == 0)
1310
    if (--nv->usage_count == 0)
1331
    {
1311
    {
1332
        int counter = 0;
1312
        /*
1333
1313
         * The usage count for this device has dropped to zero, it can be shut
1334
        /* turn off interrupts.
1314
         * down safely; disable its interrupts.
1335
        ** be careful to make sure any pending bottom half gets run
1315
         */
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);
1316
        rm_disable_adapter(nv);
1341
1317
1342
        /* give it a moment to allow any bottom half to run */
1318
        /*
1343
1319
         * Disable this device's tasklet to make sure that no bottom half will
1344
#define MAX_BH_TASKS 10
1320
         * run with undefined device state.
1345
        while (NV_ATOMIC_READ(nvl->bh_count) && (counter < MAX_BH_TASKS))
1321
         */
1346
        {
1322
        tasklet_disable(&nvl->tasklet);
1347
            current->state = TASK_INTERRUPTIBLE;
1348
            schedule_timeout(HZ/50);
1349
            counter++;
1350
        }
1351
1323
1352
        /* free the irq, which may block until any pending interrupts */
1324
        /*
1353
        /* are done being processed. */
1325
         * Free the IRQ, which may block until all pending interrupt processing
1326
         * has completed.
1327
         */
1354
        free_irq(nv->interrupt_line, (void *) nv);
1328
        free_irq(nv->interrupt_line, (void *) nv);
1355
1329
1356
        rm_shutdown_adapter(nv);
1330
        rm_shutdown_adapter(nv);
Lines 1381-1388 Link Here
1381
        FILE_PRIVATE(file) = NULL;
1355
        FILE_PRIVATE(file) = NULL;
1382
    }
1356
    }
1383
1357
1384
    MOD_DEC_USE_COUNT;
1385
1386
    return 0;
1358
    return 0;
1387
}
1359
}
1388
1360
Lines 1399-1408 Link Here
1399
    nv_printf(NV_DBG_INFO, "mmap([0x%p-0x%p] off=0x%lx)\n",
1371
    nv_printf(NV_DBG_INFO, "mmap([0x%p-0x%p] off=0x%lx)\n",
1400
        vma->vm_start,
1372
        vma->vm_start,
1401
        vma->vm_end,
1373
        vma->vm_end,
1402
        LINUX_VMA_OFFS(vma));
1374
        NV_VMA_OFFSET(vma));
1403
1375
1404
    // be a bit paranoid for now
1376
    // be a bit paranoid for now
1405
    if ((NV_MASK_OFFSET(LINUX_VMA_OFFS(vma))) ||
1377
    if ((NV_MASK_OFFSET(NV_VMA_OFFSET(vma))) ||
1406
        (NV_MASK_OFFSET(vma->vm_start)) ||
1378
        (NV_MASK_OFFSET(vma->vm_start)) ||
1407
        (NV_MASK_OFFSET(vma->vm_end)))
1379
        (NV_MASK_OFFSET(vma->vm_end)))
1408
    {
1380
    {
Lines 1420-1426 Link Here
1420
1392
1421
1393
1422
    /* NV reg space */
1394
    /* NV reg space */
1423
    if (IS_REG_OFFSET(nv, LINUX_VMA_OFFS(vma), vma->vm_end - vma->vm_start))
1395
    if (IS_REG_OFFSET(nv, NV_VMA_OFFSET(vma), vma->vm_end - vma->vm_start))
1424
    {
1396
    {
1425
        /* truncate to size of registers */
1397
        /* truncate to size of registers */
1426
        if (pages > nv->regs->size / PAGE_SIZE)
1398
        if (pages > nv->regs->size / PAGE_SIZE)
Lines 1428-1434 Link Here
1428
1400
1429
        vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
1401
        vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
1430
        if (NV_REMAP_PAGE_RANGE(vma->vm_start,
1402
        if (NV_REMAP_PAGE_RANGE(vma->vm_start,
1431
                             phys_to_uncached(LINUX_VMA_OFFS(vma)),
1403
                             phys_to_uncached(NV_VMA_OFFSET(vma)),
1432
                             vma->vm_end - vma->vm_start,
1404
                             vma->vm_end - vma->vm_start,
1433
                             vma->vm_page_prot))
1405
                             vma->vm_page_prot))
1434
            return -EAGAIN;
1406
            return -EAGAIN;
Lines 1438-1444 Link Here
1438
    }
1410
    }
1439
1411
1440
    /* NV fb space */
1412
    /* NV fb space */
1441
    else if (IS_FB_OFFSET(nv, LINUX_VMA_OFFS(vma), vma->vm_end - vma->vm_start))
1413
    else if (IS_FB_OFFSET(nv, NV_VMA_OFFSET(vma), vma->vm_end - vma->vm_start))
1442
    {
1414
    {
1443
1415
1444
        /* truncate to size of framebuffer */
1416
        /* truncate to size of framebuffer */
Lines 1447-1453 Link Here
1447
1419
1448
        vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
1420
        vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
1449
        if (NV_REMAP_PAGE_RANGE(vma->vm_start,
1421
        if (NV_REMAP_PAGE_RANGE(vma->vm_start,
1450
                             phys_to_uncached(LINUX_VMA_OFFS(vma)),
1422
                             phys_to_uncached(NV_VMA_OFFSET(vma)),
1451
                             vma->vm_end - vma->vm_start,
1423
                             vma->vm_end - vma->vm_start,
1452
                             vma->vm_page_prot))
1424
                             vma->vm_page_prot))
1453
            return -EAGAIN;
1425
            return -EAGAIN;
Lines 1457-1466 Link Here
1457
    }
1429
    }
1458
1430
1459
    /* AGP allocator */
1431
    /* AGP allocator */
1460
    else if (IS_AGP_OFFSET(nv, LINUX_VMA_OFFS(vma), vma->vm_end - vma->vm_start))
1432
    else if (IS_AGP_OFFSET(nv, NV_VMA_OFFSET(vma), vma->vm_end - vma->vm_start))
1461
    {
1433
    {
1462
        nv_lock(nvl->at_lock);
1434
        nv_lock(nvl->at_lock);
1463
        at = nvl_find_alloc(nvl, LINUX_VMA_OFFS(vma), NV_ALLOC_TYPE_AGP);
1435
        at = nvl_find_alloc(nvl, NV_VMA_OFFSET(vma), NV_ALLOC_TYPE_AGP);
1464
1436
1465
        if (at == NULL)
1437
        if (at == NULL)
1466
        {
1438
        {
Lines 1478-1484 Link Here
1478
        }
1450
        }
1479
1451
1480
        at->vma = vma;
1452
        at->vma = vma;
1481
        VMA_PRIVATE(vma) = at;
1453
        NV_VMA_PRIVATE(vma) = at;
1482
        at->usage_count++;
1454
        at->usage_count++;
1483
1455
1484
        if (NV_OSAGP_ENABLED(nv))
1456
        if (NV_OSAGP_ENABLED(nv))
Lines 1502-1514 Link Here
1502
    }
1474
    }
1503
1475
1504
    /* Magic allocator */
1476
    /* Magic allocator */
1505
    else // if (LINUX_VMA_OFFS(vma) == NV_MMAP_ALLOCATION_OFFSET)
1477
    else // if (NV_VMA_OFFSET(vma) == NV_MMAP_ALLOCATION_OFFSET)
1506
    {
1478
    {
1507
        unsigned long page = 0, pos, start;
1479
        unsigned long page = 0, pos, start;
1508
        int i = 0;
1480
        int i = 0;
1509
1481
1510
        nv_lock(nvl->at_lock);
1482
        nv_lock(nvl->at_lock);
1511
        at = nvl_find_alloc(nvl, LINUX_VMA_OFFS(vma), NV_ALLOC_TYPE_PCI);
1483
        at = nvl_find_alloc(nvl, NV_VMA_OFFSET(vma), NV_ALLOC_TYPE_PCI);
1512
1484
1513
        if (at == NULL)
1485
        if (at == NULL)
1514
        {
1486
        {
Lines 1526-1532 Link Here
1526
        }
1498
        }
1527
1499
1528
        at->vma = vma;
1500
        at->vma = vma;
1529
        VMA_PRIVATE(vma) = at;
1501
        NV_VMA_PRIVATE(vma) = at;
1530
        at->usage_count++;
1502
        at->usage_count++;
1531
1503
1532
        nv_printf(NV_DBG_INFO, "remapping %d system pages for at 0x%x\n", pages, at);
1504
        nv_printf(NV_DBG_INFO, "remapping %d system pages for at 0x%x\n", pages, at);
Lines 1548-1556 Link Here
1548
1520
1549
    vma->vm_file = file;
1521
    vma->vm_file = file;
1550
1522
1551
    /* just increment usage count, rather than calling vma_open */
1552
    MOD_INC_USE_COUNT;
1553
1554
    return 0;
1523
    return 0;
1555
}
1524
}
1556
1525
Lines 1577-1583 Link Here
1577
    {
1546
    {
1578
        nv_printf(NV_DBG_EVENTINFO, "calling poll_wait\n");
1547
        nv_printf(NV_DBG_EVENTINFO, "calling poll_wait\n");
1579
        // add us to the list
1548
        // add us to the list
1580
        poll_wait(file, EVENT_QUEUE(nvfp->wqueue), wait);
1549
        poll_wait(file, &nvfp->waitqueue, wait);
1581
    }
1550
    }
1582
1551
1583
    nv_lock_irq(nvfp->fp_lock, eflags);
1552
    nv_lock_irq(nvfp->fp_lock, eflags);
Lines 1645-1656 Link Here
1645
1614
1646
    switch (_IOC_NR(cmd))
1615
    switch (_IOC_NR(cmd))
1647
    {
1616
    {
1617
#if !defined(KERNEL_2_6)
1648
        /* debug tool; zap the module use count so we can unload driver */
1618
        /* debug tool; zap the module use count so we can unload driver */
1649
        /*             even if it is confused */
1619
        /*             even if it is confused */
1650
        case NV_ESC_MODULE_RESET:
1620
        case NV_ESC_MODULE_RESET:
1651
            atomic_set(&__this_module.uc.usecount, 1);
1621
            atomic_set(&__this_module.uc.usecount, 1);
1652
            break;
1622
            break;
1653
1623
#endif
1654
        /* pass out info about the card */
1624
        /* pass out info about the card */
1655
        case NV_ESC_CARD_INFO:
1625
        case NV_ESC_CARD_INFO:
1656
        {
1626
        {
Lines 1777-1783 Link Here
1777
 * driver receives an interrupt
1747
 * driver receives an interrupt
1778
 *    if someone waiting, then hand it off.
1748
 *    if someone waiting, then hand it off.
1779
 */
1749
 */
1780
void nv_kern_isr(
1750
irqreturn_t nv_kern_isr(
1781
    int   irq,
1751
    int   irq,
1782
    void *arg,
1752
    void *arg,
1783
    struct pt_regs *regs
1753
    struct pt_regs *regs
Lines 1791-1799 Link Here
1791
    if (need_to_run_bottom_half)
1761
    if (need_to_run_bottom_half)
1792
    {
1762
    {
1793
        NV_ATOMIC_INC(nvl->bh_count);
1763
        NV_ATOMIC_INC(nvl->bh_count);
1794
        queue_task(nvl->bh, &tq_immediate);
1764
        tasklet_schedule(&nvl->tasklet);
1795
        mark_bh(IMMEDIATE_BH);
1796
    }
1765
    }
1766
1767
    return IRQ_HANDLED;
1797
}
1768
}
1798
1769
1799
void nv_kern_bh(
1770
void nv_kern_bh(
Lines 1911-1921 Link Here
1911
1882
1912
    if (nv->usage_count == 0)
1883
    if (nv->usage_count == 0)
1913
    {
1884
    {
1914
        INIT_EVENT_QUEUE(nv_ctl_wqueue);
1885
        init_waitqueue_head(&nv_ctl_waitqueue);
1915
    }
1886
    }
1916
1887
1917
    MOD_INC_USE_COUNT;
1918
1919
    nv->flags |= NV_FLAG_OPEN + NV_FLAG_CONTROL;
1888
    nv->flags |= NV_FLAG_OPEN + NV_FLAG_CONTROL;
1920
1889
1921
    /* turn off the hotkey occurred bit */
1890
    /* turn off the hotkey occurred bit */
Lines 1943-1952 Link Here
1943
1912
1944
    nv_lock(nvl->ldata_lock);
1913
    nv_lock(nvl->ldata_lock);
1945
    if (--nv->usage_count == 0)
1914
    if (--nv->usage_count == 0)
1946
    {
1947
        FREE_EVENT_QUEUE(nv_ctl_wqueue);
1948
        nv->flags = 0;
1915
        nv->flags = 0;
1949
    }
1916
1950
    nv_unlock(nvl->ldata_lock);
1917
    nv_unlock(nvl->ldata_lock);
1951
1918
1952
    rm_free_unused_clients(nv, current->pid, (void *) file);
1919
    rm_free_unused_clients(nv, current->pid, (void *) file);
Lines 1957-1964 Link Here
1957
        FILE_PRIVATE(file) = NULL;
1924
        FILE_PRIVATE(file) = NULL;
1958
    }
1925
    }
1959
1926
1960
    MOD_DEC_USE_COUNT;
1961
1962
    return 0;
1927
    return 0;
1963
}
1928
}
1964
1929
Lines 1982-1988 Link Here
1982
    nv = NV_STATE_PTR(nvl);
1947
    nv = NV_STATE_PTR(nvl);
1983
1948
1984
    if ( !(file->f_flags & O_NONBLOCK) )
1949
    if ( !(file->f_flags & O_NONBLOCK) )
1985
        poll_wait(file, EVENT_QUEUE(nv_ctl_wqueue), wait);
1950
        poll_wait(file, &nv_ctl_waitqueue, wait);
1986
1951
1987
    nv_lock(nvl->ldata_lock);
1952
    nv_lock(nvl->ldata_lock);
1988
1953
Lines 2013-2019 Link Here
2013
    nv_ctl_device.nv_state.flags |= NV_FLAG_HOTKEY_OCCURRED;
1978
    nv_ctl_device.nv_state.flags |= NV_FLAG_HOTKEY_OCCURRED;
2014
    nv_unlock(nv_ctl_device.ldata_lock);
1979
    nv_unlock(nv_ctl_device.ldata_lock);
2015
1980
2016
    wake_up_interruptible(EVENT_QUEUE(nv_ctl_wqueue));
1981
    wake_up_interruptible(&nv_ctl_waitqueue);
2017
}
1982
}
2018
1983
2019
int nv_kern_read_cardinfo(char *page, char **start, off_t off,
1984
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 ");
2057
        len += sprintf(page+len, "Host Bridge: \t ");
2093
2058
2094
#if defined(CONFIG_PCI_NAMES)
2059
#if defined(CONFIG_PCI_NAMES)
2095
        len += sprintf(page+len, "%s\n", dev->name);
2060
        len += sprintf(page+len, "%s\n", NV_PCI_DEVICE_NAME(dev));
2096
#else
2061
#else
2097
        len += sprintf(page+len, "PCI device %04x:%04x\n",
2062
        len += sprintf(page+len, "PCI device %04x:%04x\n",
2098
                dev->vendor, dev->device);
2063
                dev->vendor, dev->device);
Lines 2304-2330 Link Here
2304
    int kern
2269
    int kern
2305
)
2270
)
2306
{
2271
{
2307
    pgd_t *pg_dir;
2272
    pgd_t *pgd;
2308
    pmd_t *pg_mid_dir;
2273
    pmd_t *pmd;
2309
    pte_t pte;
2274
    pte_t *pte;
2310
    unsigned long retval;
2275
    unsigned long retval;
2311
2276
2312
    if (kern) pg_dir = pgd_offset_k(address);
2277
    if (kern)
2313
    else      pg_dir = pgd_offset(current->mm, address);
2278
        pgd = pgd_offset_k(address);
2279
    else
2280
        pgd = pgd_offset(current->mm, address);
2314
2281
2315
    if (pgd_none(*pg_dir))
2282
    if (!pgd || pgd_none(*pgd))
2316
        goto failed;
2283
        goto failed;
2317
2284
2318
    pg_mid_dir = pmd_offset(pg_dir, address);
2285
    NV_PMD_OFFSET(address, pgd, pmd);
2319
    if (pmd_none(*pg_mid_dir))
2286
2287
    if (!NV_PMD_PRESENT(pmd))
2320
        goto failed;
2288
        goto failed;
2321
2289
2322
    NV_PTE_OFFSET(address, pg_mid_dir, pte);
2290
    NV_PTE_OFFSET(address, pmd, pte);
2323
2291
2324
    if (!pte_present(pte))
2292
    if (!NV_PTE_PRESENT(pte))
2325
        goto failed;
2293
        goto failed;
2326
2294
2327
    retval = ((pte_val(pte) & KERN_PAGE_MASK) | NV_MASK_OFFSET(address));
2295
    retval = ((NV_PTE_VALUE(pte) & KERN_PAGE_MASK) | NV_MASK_OFFSET(address));
2328
2296
2329
#if defined(NVCPU_X86_64) && defined(_PAGE_NX)
2297
#if defined(NVCPU_X86_64) && defined(_PAGE_NX)
2330
    // mask out the non-executable page bit for the true physical address
2298
    // mask out the non-executable page bit for the true physical address
Lines 2759-2765 Link Here
2759
2727
2760
    if (nvfp->num_events == NV_EVENT_FIFO_SIZE)
2728
    if (nvfp->num_events == NV_EVENT_FIFO_SIZE)
2761
    {
2729
    {
2762
        wake_up_interruptible(EVENT_QUEUE(nvfp->wqueue));
2730
        wake_up_interruptible(&nvfp->waitqueue);
2763
        nv_unlock_irq(nvfp->fp_lock, eflags);
2731
        nv_unlock_irq(nvfp->fp_lock, eflags);
2764
        return;
2732
        return;
2765
    }
2733
    }
Lines 2776-2782 Link Here
2776
    if (nvfp->put >= NV_EVENT_FIFO_SIZE)
2744
    if (nvfp->put >= NV_EVENT_FIFO_SIZE)
2777
        nvfp->put = 0;
2745
        nvfp->put = 0;
2778
2746
2779
    wake_up_interruptible(EVENT_QUEUE(nvfp->wqueue));
2747
    wake_up_interruptible(&nvfp->waitqueue);
2780
    nv_unlock_irq(nvfp->fp_lock, eflags);
2748
    nv_unlock_irq(nvfp->fp_lock, eflags);
2781
}
2749
}
2782
2750
Lines 2866-2877 Link Here
2866
    if ( (NV_AGP_DISABLED(nv)) && (config & NVOS_AGP_CONFIG_NVAGP) )
2834
    if ( (NV_AGP_DISABLED(nv)) && (config & NVOS_AGP_CONFIG_NVAGP) )
2867
    {
2835
    {
2868
        /* make sure the user does not have agpgart loaded */
2836
        /* make sure the user does not have agpgart loaded */
2869
#if !defined (KERNEL_2_2)
2870
        if (inter_module_get("drm_agp")) {
2837
        if (inter_module_get("drm_agp")) {
2871
            inter_module_put("drm_agp");
2838
            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");
2839
            nv_printf(NV_DBG_WARNINGS, "NVRM: not using NVAGP, AGPGART is loaded!!\n");
2876
        } else {
2840
        } else {
2877
#if defined(CONFIG_X86_64) && defined(CONFIG_GART_IOMMU)
2841
#if defined(CONFIG_X86_64) && defined(CONFIG_GART_IOMMU)
(-)NVIDIA_kernel-1.0-5328/nv.h (-56 / +56 lines)
Lines 327-357 Link Here
327
 * ---------------------------------------------------------------------------
327
 * ---------------------------------------------------------------------------
328
 */
328
 */
329
329
330
VOID*  nv_find_nv_mapping           (nv_state_t *, unsigned long); 
330
VOID*  NV_API_CALL  nv_find_nv_mapping           (nv_state_t *, unsigned long); 
331
VOID*  nv_find_agp_kernel_mapping   (nv_state_t *, unsigned long); 
331
VOID*  NV_API_CALL  nv_find_agp_kernel_mapping   (nv_state_t *, unsigned long); 
332
ULONG  nv_get_kern_phys_address     (ULONG);
332
ULONG  NV_API_CALL  nv_get_kern_phys_address     (ULONG);
333
ULONG  nv_get_user_phys_address     (ULONG);
333
ULONG  NV_API_CALL  nv_get_user_phys_address     (ULONG);
334
334
335
VOID   nv_lock_rm                   (nv_state_t *);
335
VOID   NV_API_CALL  nv_lock_rm                   (nv_state_t *);
336
VOID   nv_unlock_rm                 (nv_state_t *);
336
VOID   NV_API_CALL  nv_unlock_rm                 (nv_state_t *);
337
VOID   nv_lock_heap                 (nv_state_t *);
337
VOID   NV_API_CALL  nv_lock_heap                 (nv_state_t *);
338
VOID   nv_unlock_heap               (nv_state_t *);
338
VOID   NV_API_CALL  nv_unlock_heap               (nv_state_t *);
339
339
340
VOID   nv_set_hotkey_occurred_flag  (VOID);
340
VOID   NV_API_CALL  nv_set_hotkey_occurred_flag  (VOID);
341
S032   nv_int10h_call               (nv_state_t *, U032 *, U032 *, U032 *, U032 *, VOID *);
341
S032   NV_API_CALL  nv_int10h_call               (nv_state_t *, U032 *, U032 *, U032 *, U032 *, VOID *);
342
342
343
S032   nv_alloc_pages               (nv_state_t *, VOID **, U032, U032, U032, U032, U032, U032, VOID **);
343
S032   NV_API_CALL  nv_alloc_pages               (nv_state_t *, VOID **, U032, U032, U032, U032, U032, U032, VOID **);
344
S032   nv_free_pages                (nv_state_t *, VOID **, U032, U032, VOID *);
344
S032   NV_API_CALL  nv_free_pages                (nv_state_t *, VOID **, U032, U032, VOID *);
345
345
346
S032   nv_agp_init                  (nv_state_t *, VOID **, VOID **, VOID *, U032);
346
S032   NV_API_CALL  nv_agp_init                  (nv_state_t *, VOID **, VOID **, VOID *, U032);
347
S032   nv_agp_teardown              (nv_state_t *);
347
S032   NV_API_CALL  nv_agp_teardown              (nv_state_t *);
348
S032   nv_agp_translate_address     (nv_state_t *, VOID *, U032, U032 *);
348
S032   NV_API_CALL  nv_agp_translate_address     (nv_state_t *, VOID *, U032, U032 *);
349
349
350
S032   nv_start_rc_timer            (nv_state_t *);
350
S032   NV_API_CALL  nv_start_rc_timer            (nv_state_t *);
351
S032   nv_stop_rc_timer             (nv_state_t *);
351
S032   NV_API_CALL  nv_stop_rc_timer             (nv_state_t *);
352
352
353
VOID   nv_post_event                (nv_state_t *, nv_event_t *, U032, U032);
353
VOID   NV_API_CALL  nv_post_event                (nv_state_t *, nv_event_t *, U032, U032);
354
S032   nv_get_event                 (nv_state_t *, VOID *, nv_event_t *, U032 *);
354
S032   NV_API_CALL  nv_get_event                 (nv_state_t *, VOID *, nv_event_t *, U032 *);
355
355
356
356
357
/*
357
/*
Lines 362-402 Link Here
362
 * ---------------------------------------------------------------------------
362
 * ---------------------------------------------------------------------------
363
 */
363
 */
364
364
365
BOOL       rm_init_rm               (VOID);
365
BOOL       NV_API_CALL  rm_init_rm               (VOID);
366
BOOL       rm_shutdown_rm           (VOID);
366
BOOL       NV_API_CALL  rm_shutdown_rm           (VOID);
367
BOOL       rm_init_adapter          (nv_state_t *);
367
BOOL       NV_API_CALL  rm_init_adapter          (nv_state_t *);
368
BOOL       rm_disable_adapter       (nv_state_t *);
368
BOOL       NV_API_CALL  rm_disable_adapter       (nv_state_t *);
369
BOOL       rm_shutdown_adapter      (nv_state_t *);
369
BOOL       NV_API_CALL  rm_shutdown_adapter      (nv_state_t *);
370
BOOL       rm_ioctl                 (nv_state_t *, VOID *, U032, VOID *);
370
BOOL       NV_API_CALL  rm_ioctl                 (nv_state_t *, VOID *, U032, VOID *);
371
BOOL       rm_isr                   (U032, U032 *);
371
BOOL       NV_API_CALL  rm_isr                   (U032, U032 *);
372
VOID       rm_isr_bh                (VOID *);
372
VOID       NV_API_CALL  rm_isr_bh                (VOID *);
373
RM_STATUS  rm_power_management      (nv_state_t *, U032, U032);
373
RM_STATUS  NV_API_CALL  rm_power_management      (nv_state_t *, U032, U032);
374
U032       rm_get_vbios_version     (nv_state_t *, U032 *, U032 *, U032 *, U032 *, U032 *);
374
U032       NV_API_CALL  rm_get_vbios_version     (nv_state_t *, U032 *, U032 *, U032 *, U032 *, U032 *);
375
VOID       rm_free_unused_clients   (nv_state_t *, U032, VOID *);
375
VOID       NV_API_CALL  rm_free_unused_clients   (nv_state_t *, U032, VOID *);
376
376
377
VOID       rm_update_agp_config     (nv_state_t *);
377
VOID       NV_API_CALL  rm_update_agp_config     (nv_state_t *);
378
RM_STATUS  rm_init_agp              (nv_state_t *);
378
RM_STATUS  NV_API_CALL  rm_init_agp              (nv_state_t *);
379
RM_STATUS  rm_teardown_agp          (nv_state_t *);
379
RM_STATUS  NV_API_CALL  rm_teardown_agp          (nv_state_t *);
380
380
381
RM_STATUS  rm_alloc_agp_pages       (nv_state_t *, VOID **, U032, U032, VOID **, U032 *);
381
RM_STATUS  NV_API_CALL  rm_alloc_agp_pages       (nv_state_t *, VOID **, U032, U032, VOID **, U032 *);
382
RM_STATUS  rm_map_agp_pages         (nv_state_t *, VOID **, U032, VOID *);
382
RM_STATUS  NV_API_CALL  rm_map_agp_pages         (nv_state_t *, VOID **, U032, VOID *);
383
RM_STATUS  rm_free_agp_pages        (nv_state_t *, VOID **, VOID *);
383
RM_STATUS  NV_API_CALL  rm_free_agp_pages        (nv_state_t *, VOID **, VOID *);
384
384
385
RM_STATUS  rm_alloc_agp_bitmap      (nv_state_t *, U032, U032 *);
385
RM_STATUS  NV_API_CALL  rm_alloc_agp_bitmap      (nv_state_t *, U032, U032 *);
386
RM_STATUS  rm_free_agp_bitmap       (nv_state_t *, U032, U032);
386
RM_STATUS  NV_API_CALL  rm_free_agp_bitmap       (nv_state_t *, U032, U032);
387
RM_STATUS  rm_set_agp_bitmap        (nv_state_t *, VOID *);
387
RM_STATUS  NV_API_CALL  rm_set_agp_bitmap        (nv_state_t *, VOID *);
388
RM_STATUS  rm_clear_agp_bitmap      (nv_state_t *, VOID **);
388
RM_STATUS  NV_API_CALL  rm_clear_agp_bitmap      (nv_state_t *, VOID **);
389
389
390
RM_STATUS  rm_load_registry         (nv_parm_t *);
390
RM_STATUS  NV_API_CALL  rm_load_registry         (nv_parm_t *);
391
RM_STATUS  rm_read_registry_dword   (nv_state_t *, U008 *, U008 *, U032 *);
391
RM_STATUS  NV_API_CALL  rm_read_registry_dword   (nv_state_t *, U008 *, U008 *, U032 *);
392
RM_STATUS  rm_write_registry_dword  (nv_state_t *, U008 *, U008 *, U032);
392
RM_STATUS  NV_API_CALL  rm_write_registry_dword  (nv_state_t *, U008 *, U008 *, U032);
393
RM_STATUS  rm_read_registry_binary  (nv_state_t *, U008 *, U008 *, U008 *, U032 *);
393
RM_STATUS  NV_API_CALL  rm_read_registry_binary  (nv_state_t *, U008 *, U008 *, U008 *, U032 *);
394
RM_STATUS  rm_write_registry_binary (nv_state_t *, U008 *, U008 *, U008 *, U032);
394
RM_STATUS  NV_API_CALL  rm_write_registry_binary (nv_state_t *, U008 *, U008 *, U008 *, U032);
395
395
396
RM_STATUS  rm_run_rc_callback       (nv_state_t *);
396
RM_STATUS  NV_API_CALL  rm_run_rc_callback       (nv_state_t *);
397
RM_STATUS  rm_get_device_name       (U032, U032, U008*);
397
RM_STATUS  NV_API_CALL  rm_get_device_name       (U032, U032, U008*);
398
398
399
NvUI64     nv_rdtsc                 (VOID);
399
NvUI64     NV_API_CALL  nv_rdtsc                 (VOID);
400
400
401
#endif /* NVWATCH */
401
#endif /* NVWATCH */
402
402
(-)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 (-29 / +31 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 618-629 Link Here
618
    return value;
623
    return value;
619
}
624
}
620
625
626
struct pci_dev* nvos_find_agp_by_class(unsigned int);
627
621
U032 os_pci_read_dword(
628
U032 os_pci_read_dword(
622
    VOID *handle,
629
    VOID *handle,
623
    U008 offset
630
    U008 offset
624
) 
631
) 
625
{
632
{
626
    U032 value;
633
    U032 value;
634
    if (!handle) {
635
        /*
636
         * XXX: This hack works around a bug in the NVIDIA AGP
637
         * GART driver, which calls us with an invalid handle
638
         * on newer Via chipsets. What we need here instead is
639
         * a handle for the AGP graphics card.
640
         */
641
        handle = nvos_find_agp_by_class(PCI_CLASS_DISPLAY_VGA);
642
643
        if (!handle) {
644
            printk("NVRM: os_pci_read_dword(): bad handle!\n");
645
            return 0;
646
        }
647
    }
627
    pci_read_config_dword( (struct pci_dev *) handle, offset, (u32 *) &value);
648
    pci_read_config_dword( (struct pci_dev *) handle, offset, (u32 *) &value);
628
    return value;
649
    return value;
629
}
650
}
Lines 708-721 Link Here
708
729
709
ULONG os_cli(ULONG flags)
730
ULONG os_cli(ULONG flags)
710
{
731
{
711
    save_flags(flags);
732
    NV_SAVE_FLAGS(flags);
712
    cli();
733
    NV_CLI();
713
    return flags;
734
    return flags;
714
}
735
}
715
736
716
ULONG os_sti(ULONG flags)
737
ULONG os_sti(ULONG flags)
717
{
738
{
718
    restore_flags(flags);
739
    NV_RESTORE_FLAGS(flags);
719
    return flags;
740
    return flags;
720
}
741
}
721
742
Lines 848-863 Link Here
848
        NV_IOREMAP_NOCACHE(vaddr, start, size_bytes);
869
        NV_IOREMAP_NOCACHE(vaddr, start, size_bytes);
849
    }
870
    }
850
871
851
#if defined (KERNEL_2_2)
852
    if ((vaddr == NULL)) // && (mode == NV_MEMORY_DEFAULT))
853
    {
854
        unsigned long map_nr = MAP_NR(__va(start));
855
        if (map_nr < max_mapnr) {
856
            vaddr = __va(start);
857
        }
858
    }
859
#endif
860
861
    return vaddr;
872
    return vaddr;
862
}
873
}
863
874
Lines 866-881 Link Here
866
    U032 size_bytes
877
    U032 size_bytes
867
)
878
)
868
{
879
{
869
#if defined (KERNEL_2_2)
880
    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
}
881
}
880
882
881
VOID* os_map_user_space(
883
VOID* os_map_user_space(
Lines 979-985 Link Here
979
981
980
U032 os_get_cpu_count()
982
U032 os_get_cpu_count()
981
{
983
{
982
    return smp_num_cpus;
984
    return NV_SMP_NUM_CPUS;
983
}
985
}
984
986
985
#if defined(DEBUG) && !defined(NVCPU_IA64)
987
#if defined(DEBUG) && !defined(NVCPU_IA64)
(-)NVIDIA_kernel-1.0-5328/os-interface.h (-63 / +63 lines)
Lines 40-105 Link Here
40
 * ---------------------------------------------------------------------------
40
 * ---------------------------------------------------------------------------
41
 */
41
 */
42
42
43
U032        os_get_page_size            (VOID);
43
U032        NV_API_CALL  os_get_page_size            (VOID);
44
ULONG       os_get_page_mask            (VOID);
44
ULONG       NV_API_CALL  os_get_page_mask            (VOID);
45
RM_STATUS   os_alloc_mem                (VOID **, U032);
45
RM_STATUS   NV_API_CALL  os_alloc_mem                (VOID **, U032);
46
VOID        os_free_mem                 (VOID *);
46
VOID        NV_API_CALL  os_free_mem                 (VOID *);
47
RM_STATUS   os_alloc_contig_pages       (VOID **, U032);
47
RM_STATUS   NV_API_CALL  os_alloc_contig_pages       (VOID **, U032);
48
VOID        os_free_contig_pages        (VOID *, U032);
48
VOID        NV_API_CALL  os_free_contig_pages        (VOID *, U032);
49
RM_STATUS   os_get_current_time         (U032 *, U032 *);
49
RM_STATUS   NV_API_CALL  os_get_current_time         (U032 *, U032 *);
50
RM_STATUS   os_delay                    (U032);
50
RM_STATUS   NV_API_CALL  os_delay                    (U032);
51
RM_STATUS   os_delay_us                 (U032);
51
RM_STATUS   NV_API_CALL  os_delay_us                 (U032);
52
U032        os_get_cpu_frequency        (VOID);
52
U032        NV_API_CALL  os_get_cpu_frequency        (VOID);
53
RM_STATUS   os_get_current_process      (U032 *);
53
RM_STATUS   NV_API_CALL  os_get_current_process      (U032 *);
54
RM_STATUS   os_kill_process             (U032, U032);
54
RM_STATUS   NV_API_CALL  os_kill_process             (U032, U032);
55
U008*       os_string_copy              (U008 *, const U008 *);
55
U008*       NV_API_CALL  os_string_copy              (U008 *, const U008 *);
56
RM_STATUS   os_strncpy_from_user        (U008 *, const U008 *, U032);
56
RM_STATUS   NV_API_CALL  os_strncpy_from_user        (U008 *, const U008 *, U032);
57
S032        os_string_compare           (const U008 *, const U008 *);
57
S032        NV_API_CALL  os_string_compare           (const U008 *, const U008 *);
58
U032        os_string_length            (const U008 *);
58
U032        NV_API_CALL  os_string_length            (const U008 *);
59
U008*       os_mem_copy                 (U008 *, const U008 *, U032);
59
U008*       NV_API_CALL  os_mem_copy                 (U008 *, const U008 *, U032);
60
RM_STATUS   os_memcpy_from_user         (VOID *, const VOID *, U032);
60
RM_STATUS   NV_API_CALL  os_memcpy_from_user         (VOID *, const VOID *, U032);
61
RM_STATUS   os_memcpy_to_user           (void *, const VOID *, U032);
61
RM_STATUS   NV_API_CALL  os_memcpy_to_user           (void *, const VOID *, U032);
62
VOID*       os_mem_set                  (VOID *, U008, U032);
62
VOID*       NV_API_CALL  os_mem_set                  (VOID *, U008, U032);
63
S032        os_mem_cmp                  (const U008 *, const U008 *, U032);
63
S032        NV_API_CALL  os_mem_cmp                  (const U008 *, const U008 *, U032);
64
VOID*       os_pci_init_handle          (U008, U008, U008, U016 *, U016 *);
64
VOID*       NV_API_CALL  os_pci_init_handle          (U008, U008, U008, U016 *, U016 *);
65
U008        os_pci_read_byte            (VOID *, U008);
65
U008        NV_API_CALL  os_pci_read_byte            (VOID *, U008);
66
U016        os_pci_read_word            (VOID *, U008);
66
U016        NV_API_CALL  os_pci_read_word            (VOID *, U008);
67
U032        os_pci_read_dword           (VOID *, U008);
67
U032        NV_API_CALL  os_pci_read_dword           (VOID *, U008);
68
VOID        os_pci_write_byte           (VOID *, U008, U008);
68
VOID        NV_API_CALL  os_pci_write_byte           (VOID *, U008, U008);
69
VOID        os_pci_write_word           (VOID *, U008, U016);
69
VOID        NV_API_CALL  os_pci_write_word           (VOID *, U008, U016);
70
VOID        os_pci_write_dword          (VOID *, U008, U032);
70
VOID        NV_API_CALL  os_pci_write_dword          (VOID *, U008, U032);
71
VOID*       os_map_kernel_space         (U032, U032, U032);
71
VOID*       NV_API_CALL  os_map_kernel_space         (U032, U032, U032);
72
VOID        os_unmap_kernel_space       (VOID *, U032);
72
VOID        NV_API_CALL  os_unmap_kernel_space       (VOID *, U032);
73
VOID*       os_map_user_space           (VOID *, VOID **, U032, U032);
73
VOID*       NV_API_CALL  os_map_user_space           (VOID *, VOID **, U032, U032);
74
VOID        os_unmap_user_space         (VOID *, VOID *);
74
VOID        NV_API_CALL  os_unmap_user_space         (VOID *, VOID *);
75
VOID*       os_map_io_space             (U032, U032, VOID **, U032, U032);
75
VOID*       NV_API_CALL  os_map_io_space             (U032, U032, VOID **, U032, U032);
76
VOID        os_unmap_io_space           (VOID *, U032, VOID *, U032);
76
VOID        NV_API_CALL  os_unmap_io_space           (VOID *, U032, VOID *, U032);
77
RM_STATUS   os_flush_cpu_cache          (VOID);
77
RM_STATUS   NV_API_CALL  os_flush_cpu_cache          (VOID);
78
RM_STATUS   os_set_mem_range            (U032, U032, U032);
78
RM_STATUS   NV_API_CALL  os_set_mem_range            (U032, U032, U032);
79
RM_STATUS   os_unset_mem_range          (U032, U032);
79
RM_STATUS   NV_API_CALL  os_unset_mem_range          (U032, U032);
80
BOOL        os_pci_device_present       (U016, U016);
80
BOOL        NV_API_CALL  os_pci_device_present       (U016, U016);
81
U008        os_io_read_byte             (PHWINFO, U032);
81
U008        NV_API_CALL  os_io_read_byte             (PHWINFO, U032);
82
U016        os_io_read_word             (PHWINFO, U032);
82
U016        NV_API_CALL  os_io_read_word             (PHWINFO, U032);
83
U032        os_io_read_dword            (PHWINFO, U032);
83
U032        NV_API_CALL  os_io_read_dword            (PHWINFO, U032);
84
VOID        os_io_write_byte            (PHWINFO, U032, U008);
84
VOID        NV_API_CALL  os_io_write_byte            (PHWINFO, U032, U008);
85
VOID        os_io_write_word            (PHWINFO, U032, U016);
85
VOID        NV_API_CALL  os_io_write_word            (PHWINFO, U032, U016);
86
VOID        os_io_write_dword           (PHWINFO, U032, U032);
86
VOID        NV_API_CALL  os_io_write_dword           (PHWINFO, U032, U032);
87
ULONG       os_cli                      (ULONG);
87
ULONG       NV_API_CALL  os_cli                      (ULONG);
88
ULONG       os_sti                      (ULONG);
88
ULONG       NV_API_CALL  os_sti                      (ULONG);
89
VOID*       os_copy_in_ioctl_param      (VOID *, VOID *, U032);
89
VOID*       NV_API_CALL  os_copy_in_ioctl_param      (VOID *, VOID *, U032);
90
VOID*       os_copy_out_ioctl_param     (VOID *, VOID *, U032);
90
VOID*       NV_API_CALL  os_copy_out_ioctl_param     (VOID *, VOID *, U032);
91
VOID*       os_registry_lookup          (PHWINFO, U008 *, U008 *);
91
VOID*       NV_API_CALL  os_registry_lookup          (PHWINFO, U008 *, U008 *);
92
RM_STATUS   os_swap_barrier             (U032, VOID (*)(VOID *), VOID *);
92
RM_STATUS   NV_API_CALL  os_swap_barrier             (U032, VOID (*)(VOID *), VOID *);
93
BOOL        os_is_administrator         (PHWINFO);
93
BOOL        NV_API_CALL  os_is_administrator         (PHWINFO);
94
VOID        os_dbg_init                 (VOID);
94
VOID        NV_API_CALL  os_dbg_init                 (VOID);
95
VOID        os_dbg_breakpoint           (VOID);
95
VOID        NV_API_CALL  os_dbg_breakpoint           (VOID);
96
VOID        os_dbg_set_level            (U032);
96
VOID        NV_API_CALL  os_dbg_set_level            (U032);
97
U032        os_get_cpu_count            (VOID);
97
U032        NV_API_CALL  os_get_cpu_count            (VOID);
98
RM_STATUS   os_raise_smp_barrier        (VOID);
98
RM_STATUS   NV_API_CALL  os_raise_smp_barrier        (VOID);
99
RM_STATUS   os_clear_smp_barrier        (VOID);
99
RM_STATUS   NV_API_CALL  os_clear_smp_barrier        (VOID);
100
#if defined(DEBUG) && !defined(NVCPU_IA64)
100
#if defined(DEBUG) && !defined(NVCPU_IA64)
101
VOID        os_canary_arm               (VOID);
101
VOID        NV_API_CALL  os_canary_arm               (VOID);
102
VOID        os_canary_check             (VOID);
102
VOID        NV_API_CALL  os_canary_check             (VOID);
103
#define CANARY_ARM()    os_canary_arm()
103
#define CANARY_ARM()    os_canary_arm()
104
#define CANARY_CHECK()  os_canary_check()
104
#define CANARY_CHECK()  os_canary_check()
105
#else
105
#else
Lines 107-114 Link Here
107
#define CANARY_CHECK()
107
#define CANARY_CHECK()
108
#endif  // DEBUG & !NVCPU_IA64
108
#endif  // DEBUG & !NVCPU_IA64
109
109
110
RM_STATUS   osRaiseSmpBarrier           (VOID);
110
RM_STATUS   NV_API_CALL  osRaiseSmpBarrier           (VOID);
111
RM_STATUS   osClearSmpBarrier           (VOID);
111
RM_STATUS   NV_API_CALL  osClearSmpBarrier           (VOID);
112
112
113
/*
113
/*
114
 * ---------------------------------------------------------------------------
114
 * ---------------------------------------------------------------------------
Lines 142-149 Link Here
142
#define NV_DBG_ERRORS     0x4
142
#define NV_DBG_ERRORS     0x4
143
143
144
144
145
void out_string(const char *str);
145
void    NV_API_CALL  out_string(const char *str);
146
int nv_printf(int debuglevel, const char *printf_format, ...);
146
int     NV_API_CALL  nv_printf(int debuglevel, const char *printf_format, ...);
147
147
148
148
149
#define NV_MEMORY_TYPE_SYSTEM       0
149
#define NV_MEMORY_TYPE_SYSTEM       0
(-)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