]> git.pld-linux.org Git - packages/xorg-driver-video-nvidia.git/blame - NVIDIA_kernel-1.0-6629-1201042.diff
- updated to 1.0-7167
[packages/xorg-driver-video-nvidia.git] / NVIDIA_kernel-1.0-6629-1201042.diff
CommitLineData
517a48eb
PS
1diff -ru usr/src/nv/nv-linux.h usr/src/nv.1201042/nv-linux.h
2--- usr/src/nv/nv-linux.h 2004-11-03 22:53:00.000000000 +0100
3+++ usr/src/nv.1201042/nv-linux.h 2005-01-22 14:34:35.000000000 +0100
4@@ -565,11 +565,6 @@
5 #define PCI_CAP_ID_EXP 0x10
6 #endif
7
8-#if defined(KERNEL_2_6) && defined(AGPGART)
9-typedef struct agp_kern_info agp_kern_info;
10-typedef struct agp_memory agp_memory;
11-#endif
12-
13 #if defined(CONFIG_DEVFS_FS)
14 # if defined(KERNEL_2_6)
15 typedef void* devfs_handle_t;
16diff -ru usr/src/nv/nv.c usr/src/nv.1201042/nv.c
17--- usr/src/nv/nv.c 2004-11-03 22:53:00.000000000 +0100
18+++ usr/src/nv.1201042/nv.c 2005-01-22 14:34:35.000000000 +0100
19@@ -2987,32 +2987,39 @@
20 */
21 if ( (!NV_AGP_ENABLED(nv)) && (config & NVOS_AGP_CONFIG_NVAGP) )
22 {
23- /* make sure the user does not have agpgart loaded */
24- if (inter_module_get("drm_agp")) {
25+#if defined(KERNEL_2_4)
26+ if (inter_module_get("drm_agp"))
27+ {
28 inter_module_put("drm_agp");
29- nv_printf(NV_DBG_WARNINGS, "NVRM: not using NVAGP, AGPGART is loaded!!\n");
30- } else {
31-#if defined(CONFIG_X86_64) && defined(CONFIG_GART_IOMMU)
32+ nv_printf(NV_DBG_WARNINGS, "NVRM: not using NVAGP, AGPGART is loaded!\n");
33+ return -1;
34+ }
35+#elif defined(AGPGART)
36+ int error;
37+ if ((error = agp_backend_acquire()) != -EINVAL)
38+ {
39+ if (!error) agp_backend_release();
40 nv_printf(NV_DBG_WARNINGS,
41- "NVRM: not using NVAGP, kernel was compiled with GART_IOMMU support!!\n");
42-#else
43- status = rm_init_agp(nv);
44- if (status == RM_OK)
45- {
46- nv->agp_config = NVOS_AGP_CONFIG_NVAGP;
47- nv->agp_status = NV_AGP_STATUS_ENABLED;
48- }
49+ "NVRM: not using NVAGP, an AGPGART backend is loaded!\n");
50+ return -1;
51+ }
52 #endif
53+#if defined(CONFIG_X86_64) && defined(CONFIG_GART_IOMMU)
54+ nv_printf(NV_DBG_WARNINGS,
55+ "NVRM: not using NVAGP, kernel was compiled with GART_IOMMU support!\n");
56+#else
57+ status = rm_init_agp(nv);
58+ if (status == RM_OK)
59+ {
60+ nv->agp_config = NVOS_AGP_CONFIG_NVAGP;
61+ nv->agp_status = NV_AGP_STATUS_ENABLED;
62 }
63+#endif
64 }
65
66 if (NV_AGP_ENABLED(nv))
67 old_error = 0; /* report new errors */
68
69- nv_printf(NV_DBG_SETUP,
70- "NVRM: agp_init finished with status 0x%x and config %d\n",
71- status, nv->agp_config);
72-
73 return status;
74 }
75
76@@ -3036,9 +3043,6 @@
77 nv->agp_config = NVOS_AGP_CONFIG_DISABLE_AGP;
78 nv->agp_status = NV_AGP_STATUS_DISABLED;
79
80- nv_printf(NV_DBG_SETUP, "NVRM: teardown finished with status 0x%x\n",
81- status);
82-
83 return status;
84 }
85
86diff -ru usr/src/nv/os-agp.c usr/src/nv.1201042/os-agp.c
87--- usr/src/nv/os-agp.c 2004-11-03 22:53:00.000000000 +0100
88+++ usr/src/nv.1201042/os-agp.c 2005-01-22 14:34:35.000000000 +0100
89@@ -25,6 +25,13 @@
90
91 #ifdef AGPGART
92
93+#if defined(KERNEL_2_6)
94+typedef struct agp_kern_info agp_kern_info;
95+typedef struct agp_memory agp_memory;
96+#elif defined(KERNEL_2_4)
97+const drm_agp_t *drm_agp_p; /* functions */
98+#endif
99+
100 typedef struct {
101 agp_memory *ptr;
102 int num_pages;
103@@ -45,7 +52,6 @@
104
105 agp_kern_info agpinfo;
106 agp_gart gart;
107-const drm_agp_t *drm_agp_p;
108
109 #if defined(CONFIG_MTRR)
110 #define MTRR_DEL(gart) if ((gart).mtrr > 0) mtrr_del((gart).mtrr, 0, 0);
111@@ -53,6 +59,26 @@
112 #define MTRR_DEL(gart)
113 #endif
114
115+#if defined(KERNEL_2_6)
116+#define NV_AGPGART_BACKEND_ACQUIRE(o) agp_backend_acquire()
117+#define NV_AGPGART_BACKEND_ENABLE(o,mode) agp_enable(mode)
118+#define NV_AGPGART_BACKEND_RELEASE(o) agp_backend_release()
119+#define NV_AGPGART_COPY_INFO(o,p) agp_copy_info(p)
120+#define NV_AGPGART_ALLOCATE_MEMORY(o,count,type) agp_allocate_memory(count,type)
121+#define NV_AGPGART_FREE_MEMORY(o,p) agp_free_memory(p)
122+#define NV_AGPGART_BIND_MEMORY(o,p,offset) agp_bind_memory(p,offset)
123+#define NV_AGPGART_UNBIND_MEMORY(o,p) agp_unbind_memory(p)
124+#elif defined(KERNEL_2_4)
125+#define NV_AGPGART_BACKEND_ACQUIRE(o) ({ (o)->acquire(); 0; })
126+#define NV_AGPGART_BACKEND_ENABLE(o,mode) (o)->enable(mode)
127+#define NV_AGPGART_BACKEND_RELEASE(o) ((o)->release())
128+#define NV_AGPGART_COPY_INFO(o,p) ({ (o)->copy_info(p); 0; })
129+#define NV_AGPGART_ALLOCATE_MEMORY(o,count,type) (o)->allocate_memory(count,type)
130+#define NV_AGPGART_FREE_MEMORY(o,p) (o)->free_memory(p)
131+#define NV_AGPGART_BIND_MEMORY(o,p,offset) (o)->bind_memory(p,offset)
132+#define NV_AGPGART_UNBIND_MEMORY(o,p) (o)->unbind_memory(p)
133+#endif
134+
135 #endif /* AGPGART */
136
137 BOOL KernInitAGP(
138@@ -73,8 +99,10 @@
139
140 memset( (void *) &gart, 0, sizeof(agp_gart));
141
142+#if defined(KERNEL_2_4)
143 if (!(drm_agp_p = inter_module_get_request("drm_agp", "agpgart")))
144 return 1;
145+#endif
146
147 /* NOTE: from here down, return an error code of '-1'
148 * that indicates that agpgart is loaded, but we failed to use it
149@@ -82,11 +110,10 @@
150 * the memory controller.
151 */
152
153- if (drm_agp_p->acquire())
154+ if (NV_AGPGART_BACKEND_ACQUIRE(drm_agp_p))
155 {
156- nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: backend in use\n");
157- inter_module_put("drm_agp");
158- return -1;
159+ nv_printf(NV_DBG_INFO, "NVRM: AGPGART: no backend available\n");
160+ goto bailout;
161 }
162
163 if (rm_read_registry_dword(nv, "NVreg", "ReqAGPRate", &agp_rate) == RM_ERROR)
164@@ -101,21 +128,12 @@
165 agp_fw = 1;
166 agp_fw &= 0x00000001;
167
168-#if defined(KERNEL_2_4)
169- /*
170- * The original Linux 2.4 AGP GART driver interface declared copy_info to
171- * return nothing. This changed in Linux 2.5, which reports unsupported
172- * chipsets via this function. If this Linux 2.4 kernels behaves the same
173- * way, we have no way to know.
174- */
175- drm_agp_p->copy_info(&agpinfo);
176-#else
177- if (drm_agp_p->copy_info(&agpinfo)) {
178+ if (NV_AGPGART_COPY_INFO(drm_agp_p, &agpinfo))
179+ {
180 nv_printf(NV_DBG_ERRORS,
181 "NVRM: AGPGART: kernel reports chipset as unsupported\n");
182 goto failed;
183 }
184-#endif
185
186 #ifdef CONFIG_MTRR
187 /*
188@@ -170,7 +188,7 @@
189 if (!(agp_rate & 0x00000004)) agpinfo.mode &= ~0x00000004;
190 if (!(agp_rate & 0x00000002)) agpinfo.mode &= ~0x00000002;
191
192- drm_agp_p->enable(agpinfo.mode);
193+ NV_AGPGART_BACKEND_ENABLE(drm_agp_p, agpinfo.mode);
194
195 *ap_phys_base = (void*) agpinfo.aper_base;
196 *ap_mapped_base = (void*) gart.aperture;
197@@ -182,8 +200,11 @@
198
199 failed:
200 MTRR_DEL(gart); /* checks gart.mtrr */
201- drm_agp_p->release();
202+ NV_AGPGART_BACKEND_RELEASE(drm_agp_p);
203+bailout:
204+#if defined(KERNEL_2_4)
205 inter_module_put("drm_agp");
206+#endif
207
208 return -1;
209
210@@ -213,9 +234,10 @@
211 NV_IOUNMAP(gart.aperture, RM_PAGE_SIZE);
212 }
213
214- drm_agp_p->release();
215-
216+ NV_AGPGART_BACKEND_RELEASE(drm_agp_p);
217+#if defined(KERNEL_2_4)
218 inter_module_put("drm_agp");
219+#endif
220
221 if (rm_clear_agp_bitmap(nv, &bitmap))
222 {
223@@ -244,7 +266,6 @@
224 return RM_ERROR;
225 #else
226 agp_memory *ptr;
227- int err;
228 agp_priv_data *data;
229 RM_STATUS status;
230
231@@ -262,7 +283,7 @@
232 return RM_ERROR;
233 }
234
235- ptr = drm_agp_p->allocate_memory(PageCount, AGP_NORMAL_MEMORY);
236+ ptr = NV_AGPGART_ALLOCATE_MEMORY(drm_agp_p, PageCount, AGP_NORMAL_MEMORY);
237 if (ptr == NULL)
238 {
239 *pAddress = (void*) 0;
240@@ -270,8 +291,7 @@
241 return RM_ERR_NO_FREE_MEM;
242 }
243
244- err = drm_agp_p->bind_memory(ptr, *Offset);
245- if (err)
246+ if (NV_AGPGART_BIND_MEMORY(drm_agp_p, ptr, *Offset))
247 {
248 // this happens a lot when the aperture itself fills up..
249 // not a big deal, so don't alarm people with an error message
250@@ -280,14 +300,11 @@
251 goto fail;
252 }
253
254- /* return the agp aperture address */
255- *pAddress = (void *) (agpinfo.aper_base + (*Offset << PAGE_SHIFT));
256-
257 status = os_alloc_mem((void **)&data, sizeof(agp_priv_data));
258 if (status != RM_OK)
259 {
260 nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: memory allocation failed\n");
261- drm_agp_p->unbind_memory(ptr);
262+ NV_AGPGART_UNBIND_MEMORY(drm_agp_p, ptr);
263 goto fail;
264 }
265
266@@ -302,7 +319,7 @@
267 return RM_OK;
268
269 fail:
270- drm_agp_p->free_memory(ptr);
271+ NV_AGPGART_FREE_MEMORY(drm_agp_p, ptr);
272 *pAddress = (void*) 0;
273
274 return RM_ERROR;
275@@ -342,7 +359,7 @@
276 {
277 nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: unable to remap %lu pages\n",
278 (unsigned long)agp_data->num_pages);
279- drm_agp_p->unbind_memory(agp_data->ptr);
280+ NV_AGPGART_UNBIND_MEMORY(drm_agp_p, agp_data->ptr);
281 goto fail;
282 }
283
284@@ -441,8 +458,8 @@
285 {
286 size_t pages = ptr->page_count;
287
288- drm_agp_p->unbind_memory(ptr);
289- drm_agp_p->free_memory(ptr);
290+ NV_AGPGART_UNBIND_MEMORY(drm_agp_p, ptr);
291+ NV_AGPGART_FREE_MEMORY(drm_agp_p, ptr);
292
293 nv_printf(NV_DBG_INFO, "NVRM: AGPGART: freed %ld pages\n",
294 (unsigned long)pages);
This page took 0.062948 seconds and 4 git commands to generate.