Magellan Linux

Contents of /trunk/nvidia/1.0.6629/NVIDIA_kernel-1.0-6629-agp_bridge_data.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 153 - (show annotations) (download)
Tue May 8 20:52:56 2007 UTC (17 years ago) by niro
File size: 7860 byte(s)
-import

1 diff -ruN nv-6629-jam/usr/src/nv/nv-linux.h nv-6629-jam-2/usr/src/nv/nv-linux.h
2 --- nv-6629-jam/usr/src/nv/nv-linux.h 2005-01-24 23:16:46.000000000 +0100
3 +++ nv-6629-jam-2/usr/src/nv/nv-linux.h 2005-01-26 00:25:10.000000000 +0100
4 @@ -930,6 +930,9 @@
5
6 /* lock for linux-specific alloc queue */
7 struct semaphore at_lock;
8 +
9 + /* AGP bridge handle */
10 + struct agp_bridge_data *agp_bridge;
11 } nv_linux_state_t;
12
13
14 diff -ruN nv-6629-jam/usr/src/nv/nv.c nv-6629-jam-2/usr/src/nv/nv.c
15 --- nv-6629-jam/usr/src/nv/nv.c 2005-01-24 23:16:46.000000000 +0100
16 +++ nv-6629-jam-2/usr/src/nv/nv.c 2005-01-26 00:47:14.000000000 +0100
17 @@ -3013,18 +3013,19 @@
18 return -1;
19 }
20 #elif defined(AGPGART)
21 - int error;
22 /*
23 * We can only safely use NvAGP when no backend has been
24 * registered with the AGPGART frontend. This condition
25 * is only met when the acquire function returns -EINVAL.
26 *
27 * Other return codes indicate that a backend is present
28 * and was either acquired, busy or else unavailable.
29 */
30 - if ((error = agp_backend_acquire()) != -EINVAL)
31 + nv_linux_state_t *nvl = NV_GET_NVL_FROM_NV_STATE(nv);
32 + nvl->agp_bridge = agp_backend_acquire(nvl->dev);
33 + if (nvl->agp_bridge)
34 {
35 - if (!error) agp_backend_release();
36 + agp_backend_release(nvl->agp_bridge);
37 nv_printf(NV_DBG_WARNINGS,
38 "NVRM: not using NVAGP, an AGPGART backend is loaded!\n");
39 return -1;
40 diff -ruN nv-6629-jam/usr/src/nv/os-agp.c nv-6629-jam-2/usr/src/nv/os-agp.c
41 --- nv-6629-jam/usr/src/nv/os-agp.c 2005-01-24 23:16:46.000000000 +0100
42 +++ nv-6629-jam-2/usr/src/nv/os-agp.c 2005-01-26 00:49:01.000000000 +0100
43 @@ -60,23 +60,23 @@
44 #endif
45
46 #if defined(KERNEL_2_6)
47 -#define NV_AGPGART_BACKEND_ACQUIRE(o) agp_backend_acquire()
48 -#define NV_AGPGART_BACKEND_ENABLE(o,mode) agp_enable(mode)
49 -#define NV_AGPGART_BACKEND_RELEASE(o) agp_backend_release()
50 -#define NV_AGPGART_COPY_INFO(o,p) agp_copy_info(p)
51 -#define NV_AGPGART_ALLOCATE_MEMORY(o,count,type) agp_allocate_memory(count,type)
52 -#define NV_AGPGART_FREE_MEMORY(o,p) agp_free_memory(p)
53 -#define NV_AGPGART_BIND_MEMORY(o,p,offset) agp_bind_memory(p,offset)
54 -#define NV_AGPGART_UNBIND_MEMORY(o,p) agp_unbind_memory(p)
55 +#define NV_AGPGART_BACKEND_ACQUIRE(nvl,o) ({ nvl->agp_bridge = agp_backend_acquire(nvl->dev); !nvl->agp_bridge; })
56 +#define NV_AGPGART_BACKEND_ENABLE(nvl,o,mode) agp_enable(nvl->agp_bridge,mode)
57 +#define NV_AGPGART_BACKEND_RELEASE(nvl,o) agp_backend_release(nvl->agp_bridge)
58 +#define NV_AGPGART_COPY_INFO(nvl,o,p) agp_copy_info(nvl->agp_bridge,p)
59 +#define NV_AGPGART_ALLOCATE_MEMORY(nvl,o,count,type) agp_allocate_memory(nvl->agp_bridge,count,type)
60 +#define NV_AGPGART_FREE_MEMORY(nvl,o,p) agp_free_memory(p)
61 +#define NV_AGPGART_BIND_MEMORY(nvl,o,p,offset) agp_bind_memory(p,offset)
62 +#define NV_AGPGART_UNBIND_MEMORY(nvl,o,p) agp_unbind_memory(p)
63 #elif defined(KERNEL_2_4)
64 -#define NV_AGPGART_BACKEND_ACQUIRE(o) ({ (o)->acquire(); 0; })
65 -#define NV_AGPGART_BACKEND_ENABLE(o,mode) (o)->enable(mode)
66 -#define NV_AGPGART_BACKEND_RELEASE(o) ((o)->release())
67 -#define NV_AGPGART_COPY_INFO(o,p) ({ (o)->copy_info(p); 0; })
68 -#define NV_AGPGART_ALLOCATE_MEMORY(o,count,type) (o)->allocate_memory(count,type)
69 -#define NV_AGPGART_FREE_MEMORY(o,p) (o)->free_memory(p)
70 -#define NV_AGPGART_BIND_MEMORY(o,p,offset) (o)->bind_memory(p,offset)
71 -#define NV_AGPGART_UNBIND_MEMORY(o,p) (o)->unbind_memory(p)
72 +#define NV_AGPGART_BACKEND_ACQUIRE(nvl,o) ({ (o)->acquire(); 0; })
73 +#define NV_AGPGART_BACKEND_ENABLE(nvl,o,mode) (o)->enable(mode)
74 +#define NV_AGPGART_BACKEND_RELEASE(nvl,o) ((o)->release())
75 +#define NV_AGPGART_COPY_INFO(nvl,o,p) ({ (o)->copy_info(p); 0; })
76 +#define NV_AGPGART_ALLOCATE_MEMORY(nvl,o,count,type) (o)->allocate_memory(count,type)
77 +#define NV_AGPGART_FREE_MEMORY(nvl,o,p) (o)->free_memory(p)
78 +#define NV_AGPGART_BIND_MEMORY(nvl,o,p,offset) (o)->bind_memory(p,offset)
79 +#define NV_AGPGART_UNBIND_MEMORY(nvl,o,p) (o)->unbind_memory(p)
80 #endif
81
82 #endif /* AGPGART */
83 @@ -96,6 +96,7 @@
84 U032 agp_fw;
85 void *bitmap;
86 U032 bitmap_size;
87 + nv_linux_state_t *nvl = NV_GET_NVL_FROM_NV_STATE(nv);
88
89 memset( (void *) &gart, 0, sizeof(agp_gart));
90
91 @@ -110,7 +111,7 @@
92 * the memory controller.
93 */
94
95 - if (NV_AGPGART_BACKEND_ACQUIRE(drm_agp_p))
96 + if (NV_AGPGART_BACKEND_ACQUIRE(nvl,drm_agp_p))
97 {
98 nv_printf(NV_DBG_INFO, "NVRM: AGPGART: no backend available\n");
99 goto bailout;
100 @@ -128,7 +129,7 @@
101 agp_fw = 1;
102 agp_fw &= 0x00000001;
103
104 - if (NV_AGPGART_COPY_INFO(drm_agp_p, &agpinfo))
105 + if (NV_AGPGART_COPY_INFO(nvl,drm_agp_p, &agpinfo))
106 {
107 nv_printf(NV_DBG_ERRORS,
108 "NVRM: AGPGART: kernel reports chipset as unsupported\n");
109 @@ -188,7 +189,7 @@
110 if (!(agp_rate & 0x00000004)) agpinfo.mode &= ~0x00000004;
111 if (!(agp_rate & 0x00000002)) agpinfo.mode &= ~0x00000002;
112
113 - NV_AGPGART_BACKEND_ENABLE(drm_agp_p, agpinfo.mode);
114 + NV_AGPGART_BACKEND_ENABLE(nvl,drm_agp_p, agpinfo.mode);
115
116 *ap_phys_base = (void*) agpinfo.aper_base;
117 *ap_mapped_base = (void*) gart.aperture;
118 @@ -200,7 +201,7 @@
119
120 failed:
121 MTRR_DEL(gart); /* checks gart.mtrr */
122 - NV_AGPGART_BACKEND_RELEASE(drm_agp_p);
123 + NV_AGPGART_BACKEND_RELEASE(nvl,drm_agp_p);
124 bailout:
125 #if defined(KERNEL_2_4)
126 inter_module_put("drm_agp");
127 @@ -219,6 +220,7 @@
128 return 1;
129 #else
130 void *bitmap;
131 + nv_linux_state_t *nvl;
132
133 /* sanity check to make sure we should actually be here. */
134 if (!gart.ready)
135 @@ -234,7 +236,8 @@
136 NV_IOUNMAP(gart.aperture, RM_PAGE_SIZE);
137 }
138
139 - NV_AGPGART_BACKEND_RELEASE(drm_agp_p);
140 + nvl = NV_GET_NVL_FROM_NV_STATE(nv);
141 + NV_AGPGART_BACKEND_RELEASE(nvl,drm_agp_p);
142 #if defined(KERNEL_2_4)
143 inter_module_put("drm_agp");
144 #endif
145 @@ -268,6 +271,7 @@
146 agp_memory *ptr;
147 agp_priv_data *data;
148 RM_STATUS status;
149 + nv_linux_state_t *nvl;
150
151 if (!gart.ready)
152 {
153 @@ -283,7 +287,8 @@
154 return RM_ERROR;
155 }
156
157 - ptr = NV_AGPGART_ALLOCATE_MEMORY(drm_agp_p, PageCount, AGP_NORMAL_MEMORY);
158 + nvl = NV_GET_NVL_FROM_NV_STATE(nv);
159 + ptr = NV_AGPGART_ALLOCATE_MEMORY(nvl,drm_agp_p, PageCount, AGP_NORMAL_MEMORY);
160 if (ptr == NULL)
161 {
162 *pAddress = (void*) 0;
163 @@ -291,7 +296,7 @@
164 return RM_ERR_NO_FREE_MEM;
165 }
166
167 - if (NV_AGPGART_BIND_MEMORY(drm_agp_p, ptr, *Offset))
168 + if (NV_AGPGART_BIND_MEMORY(nvl,drm_agp_p, ptr, *Offset))
169 {
170 // this happens a lot when the aperture itself fills up..
171 // not a big deal, so don't alarm people with an error message
172 @@ -304,7 +309,7 @@
173 if (status != RM_OK)
174 {
175 nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: memory allocation failed\n");
176 - NV_AGPGART_UNBIND_MEMORY(drm_agp_p, ptr);
177 + NV_AGPGART_UNBIND_MEMORY(nvl,drm_agp_p, ptr);
178 goto fail;
179 }
180
181 @@ -319,7 +324,7 @@
182 return RM_OK;
183
184 fail:
185 - NV_AGPGART_FREE_MEMORY(drm_agp_p, ptr);
186 + NV_AGPGART_FREE_MEMORY(nvl,drm_agp_p, ptr);
187 *pAddress = (void*) 0;
188
189 return RM_ERROR;
190 @@ -359,7 +364,7 @@
191 {
192 nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: unable to remap %lu pages\n",
193 (unsigned long)agp_data->num_pages);
194 - NV_AGPGART_UNBIND_MEMORY(drm_agp_p, agp_data->ptr);
195 + NV_AGPGART_UNBIND_MEMORY(nvl,drm_agp_p, agp_data->ptr);
196 goto fail;
197 }
198
199 @@ -458,8 +463,8 @@
200 {
201 size_t pages = ptr->page_count;
202
203 - NV_AGPGART_UNBIND_MEMORY(drm_agp_p, ptr);
204 - NV_AGPGART_FREE_MEMORY(drm_agp_p, ptr);
205 + NV_AGPGART_UNBIND_MEMORY(nvl,drm_agp_p, ptr);
206 + NV_AGPGART_FREE_MEMORY(nvl,drm_agp_p, ptr);
207
208 nv_printf(NV_DBG_INFO, "NVRM: AGPGART: freed %ld pages\n",
209 (unsigned long)pages);
210

Properties

Name Value
svn:executable *