No empty .Rs/.Re
[netbsd-mini2440.git] / sys / external / bsd / drm / dist / shared-core / nv40_graph.c
blob4c378a05f72c5742c241579e9f3e637a633d77be
1 /*
2 * Copyright (C) 2007 Ben Skeggs.
3 * All Rights Reserved.
5 * Permission is hereby granted, free of charge, to any person obtaining
6 * a copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sublicense, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
13 * The above copyright notice and this permission notice (including the
14 * next paragraph) shall be included in all copies or substantial
15 * portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
21 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 #include "drmP.h"
28 #include "drm.h"
29 #include "nouveau_drv.h"
31 /*TODO: deciper what each offset in the context represents. The below
32 * contexts are taken from dumps just after the 3D object is
33 * created.
35 static void
36 nv40_graph_context_init(struct drm_device *dev, struct nouveau_gpuobj *ctx)
38 struct drm_nouveau_private *dev_priv = dev->dev_private;
39 int i;
41 /* Always has the "instance address" of itself at offset 0 */
42 INSTANCE_WR(ctx, 0x00000/4, ctx->im_pramin->start);
43 /* unknown */
44 INSTANCE_WR(ctx, 0x00024/4, 0x0000ffff);
45 INSTANCE_WR(ctx, 0x00028/4, 0x0000ffff);
46 INSTANCE_WR(ctx, 0x00030/4, 0x00000001);
47 INSTANCE_WR(ctx, 0x0011c/4, 0x20010001);
48 INSTANCE_WR(ctx, 0x00120/4, 0x0f73ef00);
49 INSTANCE_WR(ctx, 0x00128/4, 0x02008821);
50 INSTANCE_WR(ctx, 0x0016c/4, 0x00000040);
51 INSTANCE_WR(ctx, 0x00170/4, 0x00000040);
52 INSTANCE_WR(ctx, 0x00174/4, 0x00000040);
53 INSTANCE_WR(ctx, 0x0017c/4, 0x80000000);
54 INSTANCE_WR(ctx, 0x00180/4, 0x80000000);
55 INSTANCE_WR(ctx, 0x00184/4, 0x80000000);
56 INSTANCE_WR(ctx, 0x00188/4, 0x80000000);
57 INSTANCE_WR(ctx, 0x0018c/4, 0x80000000);
58 INSTANCE_WR(ctx, 0x0019c/4, 0x00000040);
59 INSTANCE_WR(ctx, 0x001a0/4, 0x80000000);
60 INSTANCE_WR(ctx, 0x001b0/4, 0x80000000);
61 INSTANCE_WR(ctx, 0x001c0/4, 0x80000000);
62 INSTANCE_WR(ctx, 0x001d0/4, 0x0b0b0b0c);
63 INSTANCE_WR(ctx, 0x00340/4, 0x00040000);
64 INSTANCE_WR(ctx, 0x00350/4, 0x55555555);
65 INSTANCE_WR(ctx, 0x00354/4, 0x55555555);
66 INSTANCE_WR(ctx, 0x00358/4, 0x55555555);
67 INSTANCE_WR(ctx, 0x0035c/4, 0x55555555);
68 INSTANCE_WR(ctx, 0x00388/4, 0x00000008);
69 INSTANCE_WR(ctx, 0x0039c/4, 0x00000010);
70 INSTANCE_WR(ctx, 0x00480/4, 0x00000100);
71 INSTANCE_WR(ctx, 0x00494/4, 0x00000111);
72 INSTANCE_WR(ctx, 0x00498/4, 0x00080060);
73 INSTANCE_WR(ctx, 0x004b4/4, 0x00000080);
74 INSTANCE_WR(ctx, 0x004b8/4, 0xffff0000);
75 INSTANCE_WR(ctx, 0x004bc/4, 0x00000001);
76 INSTANCE_WR(ctx, 0x004d0/4, 0x46400000);
77 INSTANCE_WR(ctx, 0x004ec/4, 0xffff0000);
78 INSTANCE_WR(ctx, 0x004f8/4, 0x0fff0000);
79 INSTANCE_WR(ctx, 0x004fc/4, 0x0fff0000);
80 INSTANCE_WR(ctx, 0x00504/4, 0x00011100);
81 for (i=0x00520; i<=0x0055c; i+=4)
82 INSTANCE_WR(ctx, i/4, 0x07ff0000);
83 INSTANCE_WR(ctx, 0x00568/4, 0x4b7fffff);
84 INSTANCE_WR(ctx, 0x00594/4, 0x30201000);
85 INSTANCE_WR(ctx, 0x00598/4, 0x70605040);
86 INSTANCE_WR(ctx, 0x0059c/4, 0xb8a89888);
87 INSTANCE_WR(ctx, 0x005a0/4, 0xf8e8d8c8);
88 INSTANCE_WR(ctx, 0x005b4/4, 0x40100000);
89 INSTANCE_WR(ctx, 0x005cc/4, 0x00000004);
90 INSTANCE_WR(ctx, 0x005d8/4, 0x0000ffff);
91 INSTANCE_WR(ctx, 0x0060c/4, 0x435185d6);
92 INSTANCE_WR(ctx, 0x00610/4, 0x2155b699);
93 INSTANCE_WR(ctx, 0x00614/4, 0xfedcba98);
94 INSTANCE_WR(ctx, 0x00618/4, 0x00000098);
95 INSTANCE_WR(ctx, 0x00628/4, 0xffffffff);
96 INSTANCE_WR(ctx, 0x0062c/4, 0x00ff7000);
97 INSTANCE_WR(ctx, 0x00630/4, 0x0000ffff);
98 INSTANCE_WR(ctx, 0x00640/4, 0x00ff0000);
99 INSTANCE_WR(ctx, 0x0067c/4, 0x00ffff00);
100 /* 0x680-0x6BC - NV30_TCL_PRIMITIVE_3D_TX_ADDRESS_UNIT(0-15) */
101 /* 0x6C0-0x6FC - NV30_TCL_PRIMITIVE_3D_TX_FORMAT_UNIT(0-15) */
102 for (i=0x006C0; i<=0x006fc; i+=4)
103 INSTANCE_WR(ctx, i/4, 0x00018488);
104 /* 0x700-0x73C - NV30_TCL_PRIMITIVE_3D_TX_WRAP_UNIT(0-15) */
105 for (i=0x00700; i<=0x0073c; i+=4)
106 INSTANCE_WR(ctx, i/4, 0x00028202);
107 /* 0x740-0x77C - NV30_TCL_PRIMITIVE_3D_TX_ENABLE_UNIT(0-15) */
108 /* 0x780-0x7BC - NV30_TCL_PRIMITIVE_3D_TX_SWIZZLE_UNIT(0-15) */
109 for (i=0x00780; i<=0x007bc; i+=4)
110 INSTANCE_WR(ctx, i/4, 0x0000aae4);
111 /* 0x7C0-0x7FC - NV30_TCL_PRIMITIVE_3D_TX_FILTER_UNIT(0-15) */
112 for (i=0x007c0; i<=0x007fc; i+=4)
113 INSTANCE_WR(ctx, i/4, 0x01012000);
114 /* 0x800-0x83C - NV30_TCL_PRIMITIVE_3D_TX_XY_DIM_UNIT(0-15) */
115 for (i=0x00800; i<=0x0083c; i+=4)
116 INSTANCE_WR(ctx, i/4, 0x00080008);
117 /* 0x840-0x87C - NV30_TCL_PRIMITIVE_3D_TX_UNK07_UNIT(0-15) */
118 /* 0x880-0x8BC - NV30_TCL_PRIMITIVE_3D_TX_DEPTH_UNIT(0-15) */
119 for (i=0x00880; i<=0x008bc; i+=4)
120 INSTANCE_WR(ctx, i/4, 0x00100008);
121 /* unknown */
122 for (i=0x00910; i<=0x0091c; i+=4)
123 INSTANCE_WR(ctx, i/4, 0x0001bc80);
124 for (i=0x00920; i<=0x0092c; i+=4)
125 INSTANCE_WR(ctx, i/4, 0x00000202);
126 for (i=0x00940; i<=0x0094c; i+=4)
127 INSTANCE_WR(ctx, i/4, 0x00000008);
128 for (i=0x00960; i<=0x0096c; i+=4)
129 INSTANCE_WR(ctx, i/4, 0x00080008);
130 INSTANCE_WR(ctx, 0x00980/4, 0x00000002);
131 INSTANCE_WR(ctx, 0x009b4/4, 0x00000001);
132 INSTANCE_WR(ctx, 0x009c0/4, 0x3e020200);
133 INSTANCE_WR(ctx, 0x009c4/4, 0x00ffffff);
134 INSTANCE_WR(ctx, 0x009c8/4, 0x60103f00);
135 INSTANCE_WR(ctx, 0x009d4/4, 0x00020000);
136 INSTANCE_WR(ctx, 0x00a08/4, 0x00008100);
137 INSTANCE_WR(ctx, 0x00aac/4, 0x00000001);
138 INSTANCE_WR(ctx, 0x00af0/4, 0x00000001);
139 INSTANCE_WR(ctx, 0x00af8/4, 0x80800001);
140 INSTANCE_WR(ctx, 0x00bcc/4, 0x00000005);
141 INSTANCE_WR(ctx, 0x00bf8/4, 0x00005555);
142 INSTANCE_WR(ctx, 0x00bfc/4, 0x00005555);
143 INSTANCE_WR(ctx, 0x00c00/4, 0x00005555);
144 INSTANCE_WR(ctx, 0x00c04/4, 0x00005555);
145 INSTANCE_WR(ctx, 0x00c08/4, 0x00005555);
146 INSTANCE_WR(ctx, 0x00c0c/4, 0x00005555);
147 INSTANCE_WR(ctx, 0x00c44/4, 0x00000001);
148 for (i=0x03008; i<=0x03080; i+=8)
149 INSTANCE_WR(ctx, i/4, 0x3f800000);
150 for (i=0x05288; i<=0x08570; i+=24)
151 INSTANCE_WR(ctx, i/4, 0x00000001);
152 for (i=0x08628; i<=0x08e18; i+=16)
153 INSTANCE_WR(ctx, i/4, 0x3f800000);
154 for (i=0x0bd28; i<=0x0f010; i+=24)
155 INSTANCE_WR(ctx, i/4, 0x00000001);
156 for (i=0x0f0c8; i<=0x0f8b8; i+=16)
157 INSTANCE_WR(ctx, i/4, 0x3f800000);
158 for (i=0x127c8; i<=0x15ab0; i+=24)
159 INSTANCE_WR(ctx, i/4, 0x00000001);
160 for (i=0x15b68; i<=0x16358; i+=16)
161 INSTANCE_WR(ctx, i/4, 0x3f800000);
162 for (i=0x19268; i<=0x1c550; i+=24)
163 INSTANCE_WR(ctx, i/4, 0x00000001);
164 for (i=0x1c608; i<=0x1cdf8; i+=16)
165 INSTANCE_WR(ctx, i/4, 0x3f800000);
166 for (i=0x1fd08; i<=0x22ff0; i+=24)
167 INSTANCE_WR(ctx, i/4, 0x00000001);
168 for (i=0x230a8; i<=0x23898; i+=16)
169 INSTANCE_WR(ctx, i/4, 0x3f800000);
170 for (i=0x267a8; i<=0x29a90; i+=24)
171 INSTANCE_WR(ctx, i/4, 0x00000001);
172 for (i=0x29b48; i<=0x2a338; i+=16)
173 INSTANCE_WR(ctx, i/4, 0x3f800000);
176 static void
177 nv41_graph_context_init(struct drm_device *dev, struct nouveau_gpuobj *ctx)
179 struct drm_nouveau_private *dev_priv = dev->dev_private;
180 int i;
182 INSTANCE_WR(ctx, 0x00000/4, ctx->im_pramin->start);
183 INSTANCE_WR(ctx, 0x00000024/4, 0x0000ffff);
184 INSTANCE_WR(ctx, 0x00000028/4, 0x0000ffff);
185 INSTANCE_WR(ctx, 0x00000030/4, 0x00000001);
186 INSTANCE_WR(ctx, 0x0000011c/4, 0x20010001);
187 INSTANCE_WR(ctx, 0x00000120/4, 0x0f73ef00);
188 INSTANCE_WR(ctx, 0x00000128/4, 0x02008821);
189 for (i = 0x00000178; i <= 0x00000180; i += 4)
190 INSTANCE_WR(ctx, i/4, 0x00000040);
191 INSTANCE_WR(ctx, 0x00000188/4, 0x00000040);
192 for (i = 0x00000194; i <= 0x000001b0; i += 4)
193 INSTANCE_WR(ctx, i/4, 0x80000000);
194 INSTANCE_WR(ctx, 0x000001d0/4, 0x0b0b0b0c);
195 INSTANCE_WR(ctx, 0x00000340/4, 0x00040000);
196 for (i = 0x00000350; i <= 0x0000035c; i += 4)
197 INSTANCE_WR(ctx, i/4, 0x55555555);
198 INSTANCE_WR(ctx, 0x00000388/4, 0x00000008);
199 INSTANCE_WR(ctx, 0x0000039c/4, 0x00001010);
200 INSTANCE_WR(ctx, 0x000003cc/4, 0x00000111);
201 INSTANCE_WR(ctx, 0x000003d0/4, 0x00080060);
202 INSTANCE_WR(ctx, 0x000003ec/4, 0x00000080);
203 INSTANCE_WR(ctx, 0x000003f0/4, 0xffff0000);
204 INSTANCE_WR(ctx, 0x000003f4/4, 0x00000001);
205 INSTANCE_WR(ctx, 0x00000408/4, 0x46400000);
206 INSTANCE_WR(ctx, 0x00000418/4, 0xffff0000);
207 INSTANCE_WR(ctx, 0x00000424/4, 0x0fff0000);
208 INSTANCE_WR(ctx, 0x00000428/4, 0x0fff0000);
209 INSTANCE_WR(ctx, 0x00000430/4, 0x00011100);
210 for (i = 0x0000044c; i <= 0x00000488; i += 4)
211 INSTANCE_WR(ctx, i/4, 0x07ff0000);
212 INSTANCE_WR(ctx, 0x00000494/4, 0x4b7fffff);
213 INSTANCE_WR(ctx, 0x000004bc/4, 0x30201000);
214 INSTANCE_WR(ctx, 0x000004c0/4, 0x70605040);
215 INSTANCE_WR(ctx, 0x000004c4/4, 0xb8a89888);
216 INSTANCE_WR(ctx, 0x000004c8/4, 0xf8e8d8c8);
217 INSTANCE_WR(ctx, 0x000004dc/4, 0x40100000);
218 INSTANCE_WR(ctx, 0x000004f8/4, 0x0000ffff);
219 INSTANCE_WR(ctx, 0x0000052c/4, 0x435185d6);
220 INSTANCE_WR(ctx, 0x00000530/4, 0x2155b699);
221 INSTANCE_WR(ctx, 0x00000534/4, 0xfedcba98);
222 INSTANCE_WR(ctx, 0x00000538/4, 0x00000098);
223 INSTANCE_WR(ctx, 0x00000548/4, 0xffffffff);
224 INSTANCE_WR(ctx, 0x0000054c/4, 0x00ff7000);
225 INSTANCE_WR(ctx, 0x00000550/4, 0x0000ffff);
226 INSTANCE_WR(ctx, 0x00000560/4, 0x00ff0000);
227 INSTANCE_WR(ctx, 0x00000598/4, 0x00ffff00);
228 for (i = 0x000005dc; i <= 0x00000618; i += 4)
229 INSTANCE_WR(ctx, i/4, 0x00018488);
230 for (i = 0x0000061c; i <= 0x00000658; i += 4)
231 INSTANCE_WR(ctx, i/4, 0x00028202);
232 for (i = 0x0000069c; i <= 0x000006d8; i += 4)
233 INSTANCE_WR(ctx, i/4, 0x0000aae4);
234 for (i = 0x000006dc; i <= 0x00000718; i += 4)
235 INSTANCE_WR(ctx, i/4, 0x01012000);
236 for (i = 0x0000071c; i <= 0x00000758; i += 4)
237 INSTANCE_WR(ctx, i/4, 0x00080008);
238 for (i = 0x0000079c; i <= 0x000007d8; i += 4)
239 INSTANCE_WR(ctx, i/4, 0x00100008);
240 for (i = 0x0000082c; i <= 0x00000838; i += 4)
241 INSTANCE_WR(ctx, i/4, 0x0001bc80);
242 for (i = 0x0000083c; i <= 0x00000848; i += 4)
243 INSTANCE_WR(ctx, i/4, 0x00000202);
244 for (i = 0x0000085c; i <= 0x00000868; i += 4)
245 INSTANCE_WR(ctx, i/4, 0x00000008);
246 for (i = 0x0000087c; i <= 0x00000888; i += 4)
247 INSTANCE_WR(ctx, i/4, 0x00080008);
248 INSTANCE_WR(ctx, 0x0000089c/4, 0x00000002);
249 INSTANCE_WR(ctx, 0x000008d0/4, 0x00000021);
250 INSTANCE_WR(ctx, 0x000008d4/4, 0x030c30c3);
251 INSTANCE_WR(ctx, 0x000008e0/4, 0x3e020200);
252 INSTANCE_WR(ctx, 0x000008e4/4, 0x00ffffff);
253 INSTANCE_WR(ctx, 0x000008e8/4, 0x20103f00);
254 INSTANCE_WR(ctx, 0x000008f4/4, 0x00020000);
255 INSTANCE_WR(ctx, 0x0000092c/4, 0x00008100);
256 INSTANCE_WR(ctx, 0x000009b8/4, 0x00000001);
257 INSTANCE_WR(ctx, 0x000009fc/4, 0x00001001);
258 INSTANCE_WR(ctx, 0x00000a04/4, 0x00000003);
259 INSTANCE_WR(ctx, 0x00000a08/4, 0x00888001);
260 INSTANCE_WR(ctx, 0x00000aac/4, 0x00000005);
261 INSTANCE_WR(ctx, 0x00000ab8/4, 0x0000ffff);
262 for (i = 0x00000ad4; i <= 0x00000ae4; i += 4)
263 INSTANCE_WR(ctx, i/4, 0x00005555);
264 INSTANCE_WR(ctx, 0x00000ae8/4, 0x00000001);
265 INSTANCE_WR(ctx, 0x00000b20/4, 0x00000001);
266 for (i = 0x00002ee8; i <= 0x00002f60; i += 8)
267 INSTANCE_WR(ctx, i/4, 0x3f800000);
268 for (i = 0x00005168; i <= 0x00007358; i += 24)
269 INSTANCE_WR(ctx, i/4, 0x00000001);
270 for (i = 0x00007368; i <= 0x00007758; i += 16)
271 INSTANCE_WR(ctx, i/4, 0x3f800000);
272 for (i = 0x0000a068; i <= 0x0000c258; i += 24)
273 INSTANCE_WR(ctx, i/4, 0x00000001);
274 for (i = 0x0000c268; i <= 0x0000c658; i += 16)
275 INSTANCE_WR(ctx, i/4, 0x3f800000);
276 for (i = 0x0000ef68; i <= 0x00011158; i += 24)
277 INSTANCE_WR(ctx, i/4, 0x00000001);
278 for (i = 0x00011168; i <= 0x00011558; i += 16)
279 INSTANCE_WR(ctx, i/4, 0x3f800000);
280 for (i = 0x00013e68; i <= 0x00016058; i += 24)
281 INSTANCE_WR(ctx, i/4, 0x00000001);
282 for (i = 0x00016068; i <= 0x00016458; i += 16)
283 INSTANCE_WR(ctx, i/4, 0x3f800000);
286 static void
287 nv43_graph_context_init(struct drm_device *dev, struct nouveau_gpuobj *ctx)
289 struct drm_nouveau_private *dev_priv = dev->dev_private;
290 int i;
292 INSTANCE_WR(ctx, 0x00000/4, ctx->im_pramin->start);
293 INSTANCE_WR(ctx, 0x00024/4, 0x0000ffff);
294 INSTANCE_WR(ctx, 0x00028/4, 0x0000ffff);
295 INSTANCE_WR(ctx, 0x00030/4, 0x00000001);
296 INSTANCE_WR(ctx, 0x0011c/4, 0x20010001);
297 INSTANCE_WR(ctx, 0x00120/4, 0x0f73ef00);
298 INSTANCE_WR(ctx, 0x00128/4, 0x02008821);
299 INSTANCE_WR(ctx, 0x00178/4, 0x00000040);
300 INSTANCE_WR(ctx, 0x0017c/4, 0x00000040);
301 INSTANCE_WR(ctx, 0x00180/4, 0x00000040);
302 INSTANCE_WR(ctx, 0x00188/4, 0x00000040);
303 INSTANCE_WR(ctx, 0x00194/4, 0x80000000);
304 INSTANCE_WR(ctx, 0x00198/4, 0x80000000);
305 INSTANCE_WR(ctx, 0x0019c/4, 0x80000000);
306 INSTANCE_WR(ctx, 0x001a0/4, 0x80000000);
307 INSTANCE_WR(ctx, 0x001a4/4, 0x80000000);
308 INSTANCE_WR(ctx, 0x001a8/4, 0x80000000);
309 INSTANCE_WR(ctx, 0x001ac/4, 0x80000000);
310 INSTANCE_WR(ctx, 0x001b0/4, 0x80000000);
311 INSTANCE_WR(ctx, 0x001d0/4, 0x0b0b0b0c);
312 INSTANCE_WR(ctx, 0x00340/4, 0x00040000);
313 INSTANCE_WR(ctx, 0x00350/4, 0x55555555);
314 INSTANCE_WR(ctx, 0x00354/4, 0x55555555);
315 INSTANCE_WR(ctx, 0x00358/4, 0x55555555);
316 INSTANCE_WR(ctx, 0x0035c/4, 0x55555555);
317 INSTANCE_WR(ctx, 0x00388/4, 0x00000008);
318 INSTANCE_WR(ctx, 0x0039c/4, 0x00001010);
319 INSTANCE_WR(ctx, 0x003cc/4, 0x00000111);
320 INSTANCE_WR(ctx, 0x003d0/4, 0x00080060);
321 INSTANCE_WR(ctx, 0x003ec/4, 0x00000080);
322 INSTANCE_WR(ctx, 0x003f0/4, 0xffff0000);
323 INSTANCE_WR(ctx, 0x003f4/4, 0x00000001);
324 INSTANCE_WR(ctx, 0x00408/4, 0x46400000);
325 INSTANCE_WR(ctx, 0x00418/4, 0xffff0000);
326 INSTANCE_WR(ctx, 0x00424/4, 0x0fff0000);
327 INSTANCE_WR(ctx, 0x00428/4, 0x0fff0000);
328 INSTANCE_WR(ctx, 0x00430/4, 0x00011100);
329 for (i=0x0044c; i<=0x00488; i+=4)
330 INSTANCE_WR(ctx, i/4, 0x07ff0000);
331 INSTANCE_WR(ctx, 0x00494/4, 0x4b7fffff);
332 INSTANCE_WR(ctx, 0x004bc/4, 0x30201000);
333 INSTANCE_WR(ctx, 0x004c0/4, 0x70605040);
334 INSTANCE_WR(ctx, 0x004c4/4, 0xb8a89888);
335 INSTANCE_WR(ctx, 0x004c8/4, 0xf8e8d8c8);
336 INSTANCE_WR(ctx, 0x004dc/4, 0x40100000);
337 INSTANCE_WR(ctx, 0x004f8/4, 0x0000ffff);
338 INSTANCE_WR(ctx, 0x0052c/4, 0x435185d6);
339 INSTANCE_WR(ctx, 0x00530/4, 0x2155b699);
340 INSTANCE_WR(ctx, 0x00534/4, 0xfedcba98);
341 INSTANCE_WR(ctx, 0x00538/4, 0x00000098);
342 INSTANCE_WR(ctx, 0x00548/4, 0xffffffff);
343 INSTANCE_WR(ctx, 0x0054c/4, 0x00ff7000);
344 INSTANCE_WR(ctx, 0x00550/4, 0x0000ffff);
345 INSTANCE_WR(ctx, 0x00560/4, 0x00ff0000);
346 INSTANCE_WR(ctx, 0x00598/4, 0x00ffff00);
347 for (i=0x005dc; i<=0x00618; i+=4)
348 INSTANCE_WR(ctx, i/4, 0x00018488);
349 for (i=0x0061c; i<=0x00658; i+=4)
350 INSTANCE_WR(ctx, i/4, 0x00028202);
351 for (i=0x0069c; i<=0x006d8; i+=4)
352 INSTANCE_WR(ctx, i/4, 0x0000aae4);
353 for (i=0x006dc; i<=0x00718; i+=4)
354 INSTANCE_WR(ctx, i/4, 0x01012000);
355 for (i=0x0071c; i<=0x00758; i+=4)
356 INSTANCE_WR(ctx, i/4, 0x00080008);
357 for (i=0x0079c; i<=0x007d8; i+=4)
358 INSTANCE_WR(ctx, i/4, 0x00100008);
359 for (i=0x0082c; i<=0x00838; i+=4)
360 INSTANCE_WR(ctx, i/4, 0x0001bc80);
361 for (i=0x0083c; i<=0x00848; i+=4)
362 INSTANCE_WR(ctx, i/4, 0x00000202);
363 for (i=0x0085c; i<=0x00868; i+=4)
364 INSTANCE_WR(ctx, i/4, 0x00000008);
365 for (i=0x0087c; i<=0x00888; i+=4)
366 INSTANCE_WR(ctx, i/4, 0x00080008);
367 INSTANCE_WR(ctx, 0x0089c/4, 0x00000002);
368 INSTANCE_WR(ctx, 0x008d0/4, 0x00000021);
369 INSTANCE_WR(ctx, 0x008d4/4, 0x030c30c3);
370 INSTANCE_WR(ctx, 0x008e0/4, 0x3e020200);
371 INSTANCE_WR(ctx, 0x008e4/4, 0x00ffffff);
372 INSTANCE_WR(ctx, 0x008e8/4, 0x0c103f00);
373 INSTANCE_WR(ctx, 0x008f4/4, 0x00020000);
374 INSTANCE_WR(ctx, 0x0092c/4, 0x00008100);
375 INSTANCE_WR(ctx, 0x009b8/4, 0x00000001);
376 INSTANCE_WR(ctx, 0x009fc/4, 0x00001001);
377 INSTANCE_WR(ctx, 0x00a04/4, 0x00000003);
378 INSTANCE_WR(ctx, 0x00a08/4, 0x00888001);
379 INSTANCE_WR(ctx, 0x00a8c/4, 0x00000005);
380 INSTANCE_WR(ctx, 0x00a98/4, 0x0000ffff);
381 INSTANCE_WR(ctx, 0x00ab4/4, 0x00005555);
382 INSTANCE_WR(ctx, 0x00ab8/4, 0x00005555);
383 INSTANCE_WR(ctx, 0x00abc/4, 0x00005555);
384 INSTANCE_WR(ctx, 0x00ac0/4, 0x00000001);
385 INSTANCE_WR(ctx, 0x00af8/4, 0x00000001);
386 for (i=0x02ec0; i<=0x02f38; i+=8)
387 INSTANCE_WR(ctx, i/4, 0x3f800000);
388 for (i=0x04c80; i<=0x06e70; i+=24)
389 INSTANCE_WR(ctx, i/4, 0x00000001);
390 for (i=0x06e80; i<=0x07270; i+=16)
391 INSTANCE_WR(ctx, i/4, 0x3f800000);
392 for (i=0x096c0; i<=0x0b8b0; i+=24)
393 INSTANCE_WR(ctx, i/4, 0x00000001);
394 for (i=0x0b8c0; i<=0x0bcb0; i+=16)
395 INSTANCE_WR(ctx, i/4, 0x3f800000);
396 for (i=0x0e100; i<=0x102f0; i+=24)
397 INSTANCE_WR(ctx, i/4, 0x00000001);
398 for (i=0x10300; i<=0x106f0; i+=16)
399 INSTANCE_WR(ctx, i/4, 0x3f800000);
402 static void
403 nv46_graph_context_init(struct drm_device *dev, struct nouveau_gpuobj *ctx)
405 struct drm_nouveau_private *dev_priv = dev->dev_private;
406 int i;
408 INSTANCE_WR(ctx, 0x00000/4, ctx->im_pramin->start);
409 INSTANCE_WR(ctx, 0x00040/4, 0x0000ffff);
410 INSTANCE_WR(ctx, 0x00044/4, 0x0000ffff);
411 INSTANCE_WR(ctx, 0x0004c/4, 0x00000001);
412 INSTANCE_WR(ctx, 0x00138/4, 0x20010001);
413 INSTANCE_WR(ctx, 0x0013c/4, 0x0f73ef00);
414 INSTANCE_WR(ctx, 0x00144/4, 0x02008821);
415 INSTANCE_WR(ctx, 0x00174/4, 0x00000001);
416 INSTANCE_WR(ctx, 0x00178/4, 0x00000001);
417 INSTANCE_WR(ctx, 0x0017c/4, 0x00000001);
418 INSTANCE_WR(ctx, 0x00180/4, 0x00000001);
419 INSTANCE_WR(ctx, 0x00184/4, 0x00000001);
420 INSTANCE_WR(ctx, 0x00188/4, 0x00000001);
421 INSTANCE_WR(ctx, 0x0018c/4, 0x00000001);
422 INSTANCE_WR(ctx, 0x00190/4, 0x00000001);
423 INSTANCE_WR(ctx, 0x00194/4, 0x00000040);
424 INSTANCE_WR(ctx, 0x00198/4, 0x00000040);
425 INSTANCE_WR(ctx, 0x0019c/4, 0x00000040);
426 INSTANCE_WR(ctx, 0x001a4/4, 0x00000040);
427 INSTANCE_WR(ctx, 0x001ec/4, 0x0b0b0b0c);
428 INSTANCE_WR(ctx, 0x0035c/4, 0x00040000);
429 INSTANCE_WR(ctx, 0x0036c/4, 0x55555555);
430 INSTANCE_WR(ctx, 0x00370/4, 0x55555555);
431 INSTANCE_WR(ctx, 0x00374/4, 0x55555555);
432 INSTANCE_WR(ctx, 0x00378/4, 0x55555555);
433 INSTANCE_WR(ctx, 0x003a4/4, 0x00000008);
434 INSTANCE_WR(ctx, 0x003b8/4, 0x00003010);
435 INSTANCE_WR(ctx, 0x003dc/4, 0x00000111);
436 INSTANCE_WR(ctx, 0x003e0/4, 0x00000111);
437 INSTANCE_WR(ctx, 0x003e4/4, 0x00000111);
438 INSTANCE_WR(ctx, 0x003e8/4, 0x00000111);
439 INSTANCE_WR(ctx, 0x003ec/4, 0x00000111);
440 INSTANCE_WR(ctx, 0x003f0/4, 0x00000111);
441 INSTANCE_WR(ctx, 0x003f4/4, 0x00000111);
442 INSTANCE_WR(ctx, 0x003f8/4, 0x00000111);
443 INSTANCE_WR(ctx, 0x003fc/4, 0x00000111);
444 INSTANCE_WR(ctx, 0x00400/4, 0x00000111);
445 INSTANCE_WR(ctx, 0x00404/4, 0x00000111);
446 INSTANCE_WR(ctx, 0x00408/4, 0x00000111);
447 INSTANCE_WR(ctx, 0x0040c/4, 0x00000111);
448 INSTANCE_WR(ctx, 0x00410/4, 0x00000111);
449 INSTANCE_WR(ctx, 0x00414/4, 0x00000111);
450 INSTANCE_WR(ctx, 0x00418/4, 0x00000111);
451 INSTANCE_WR(ctx, 0x004b0/4, 0x00000111);
452 INSTANCE_WR(ctx, 0x004b4/4, 0x00080060);
453 INSTANCE_WR(ctx, 0x004d0/4, 0x00000080);
454 INSTANCE_WR(ctx, 0x004d4/4, 0xffff0000);
455 INSTANCE_WR(ctx, 0x004d8/4, 0x00000001);
456 INSTANCE_WR(ctx, 0x004ec/4, 0x46400000);
457 INSTANCE_WR(ctx, 0x004fc/4, 0xffff0000);
458 INSTANCE_WR(ctx, 0x00500/4, 0x88888888);
459 INSTANCE_WR(ctx, 0x00504/4, 0x88888888);
460 INSTANCE_WR(ctx, 0x00508/4, 0x88888888);
461 INSTANCE_WR(ctx, 0x0050c/4, 0x88888888);
462 INSTANCE_WR(ctx, 0x00510/4, 0x88888888);
463 INSTANCE_WR(ctx, 0x00514/4, 0x88888888);
464 INSTANCE_WR(ctx, 0x00518/4, 0x88888888);
465 INSTANCE_WR(ctx, 0x0051c/4, 0x88888888);
466 INSTANCE_WR(ctx, 0x00520/4, 0x88888888);
467 INSTANCE_WR(ctx, 0x00524/4, 0x88888888);
468 INSTANCE_WR(ctx, 0x00528/4, 0x88888888);
469 INSTANCE_WR(ctx, 0x0052c/4, 0x88888888);
470 INSTANCE_WR(ctx, 0x00530/4, 0x88888888);
471 INSTANCE_WR(ctx, 0x00534/4, 0x88888888);
472 INSTANCE_WR(ctx, 0x00538/4, 0x88888888);
473 INSTANCE_WR(ctx, 0x0053c/4, 0x88888888);
474 INSTANCE_WR(ctx, 0x00550/4, 0x0fff0000);
475 INSTANCE_WR(ctx, 0x00554/4, 0x0fff0000);
476 INSTANCE_WR(ctx, 0x0055c/4, 0x00011100);
477 for (i=0x00578; i<0x005b4; i+=4)
478 INSTANCE_WR(ctx, i/4, 0x07ff0000);
479 INSTANCE_WR(ctx, 0x005c0/4, 0x4b7fffff);
480 INSTANCE_WR(ctx, 0x005e8/4, 0x30201000);
481 INSTANCE_WR(ctx, 0x005ec/4, 0x70605040);
482 INSTANCE_WR(ctx, 0x005f0/4, 0xb8a89888);
483 INSTANCE_WR(ctx, 0x005f4/4, 0xf8e8d8c8);
484 INSTANCE_WR(ctx, 0x00608/4, 0x40100000);
485 INSTANCE_WR(ctx, 0x00624/4, 0x0000ffff);
486 INSTANCE_WR(ctx, 0x00658/4, 0x435185d6);
487 INSTANCE_WR(ctx, 0x0065c/4, 0x2155b699);
488 INSTANCE_WR(ctx, 0x00660/4, 0xfedcba98);
489 INSTANCE_WR(ctx, 0x00664/4, 0x00000098);
490 INSTANCE_WR(ctx, 0x00674/4, 0xffffffff);
491 INSTANCE_WR(ctx, 0x00678/4, 0x00ff7000);
492 INSTANCE_WR(ctx, 0x0067c/4, 0x0000ffff);
493 INSTANCE_WR(ctx, 0x0068c/4, 0x00ff0000);
494 INSTANCE_WR(ctx, 0x006c8/4, 0x00ffff00);
495 for (i=0x0070c; i<=0x00748; i+=4)
496 INSTANCE_WR(ctx, i/4, 0x00018488);
497 for (i=0x0074c; i<=0x00788; i+=4)
498 INSTANCE_WR(ctx, i/4, 0x00028202);
499 for (i=0x007cc; i<=0x00808; i+=4)
500 INSTANCE_WR(ctx, i/4, 0x0000aae4);
501 for (i=0x0080c; i<=0x00848; i+=4)
502 INSTANCE_WR(ctx, i/4, 0x01012000);
503 for (i=0x0084c; i<=0x00888; i+=4)
504 INSTANCE_WR(ctx, i/4, 0x00080008);
505 for (i=0x008cc; i<=0x00908; i+=4)
506 INSTANCE_WR(ctx, i/4, 0x00100008);
507 for (i=0x0095c; i<=0x00968; i+=4)
508 INSTANCE_WR(ctx, i/4, 0x0001bc80);
509 for (i=0x0096c; i<=0x00978; i+=4)
510 INSTANCE_WR(ctx, i/4, 0x00000202);
511 for (i=0x0098c; i<=0x00998; i+=4)
512 INSTANCE_WR(ctx, i/4, 0x00000008);
513 for (i=0x009ac; i<=0x009b8; i+=4)
514 INSTANCE_WR(ctx, i/4, 0x00080008);
515 INSTANCE_WR(ctx, 0x009cc/4, 0x00000002);
516 INSTANCE_WR(ctx, 0x00a00/4, 0x00000421);
517 INSTANCE_WR(ctx, 0x00a04/4, 0x030c30c3);
518 INSTANCE_WR(ctx, 0x00a08/4, 0x00011001);
519 INSTANCE_WR(ctx, 0x00a14/4, 0x3e020200);
520 INSTANCE_WR(ctx, 0x00a18/4, 0x00ffffff);
521 INSTANCE_WR(ctx, 0x00a1c/4, 0x0c103f00);
522 INSTANCE_WR(ctx, 0x00a28/4, 0x00040000);
523 INSTANCE_WR(ctx, 0x00a60/4, 0x00008100);
524 INSTANCE_WR(ctx, 0x00aec/4, 0x00000001);
525 INSTANCE_WR(ctx, 0x00b30/4, 0x00001001);
526 INSTANCE_WR(ctx, 0x00b38/4, 0x00000003);
527 INSTANCE_WR(ctx, 0x00b3c/4, 0x00888001);
528 INSTANCE_WR(ctx, 0x00bc0/4, 0x00000005);
529 INSTANCE_WR(ctx, 0x00bcc/4, 0x0000ffff);
530 INSTANCE_WR(ctx, 0x00be8/4, 0x00005555);
531 INSTANCE_WR(ctx, 0x00bec/4, 0x00005555);
532 INSTANCE_WR(ctx, 0x00bf0/4, 0x00005555);
533 INSTANCE_WR(ctx, 0x00bf4/4, 0x00000001);
534 INSTANCE_WR(ctx, 0x00c2c/4, 0x00000001);
535 INSTANCE_WR(ctx, 0x00c30/4, 0x08e00001);
536 INSTANCE_WR(ctx, 0x00c34/4, 0x000e3000);
537 for (i=0x017f8; i<=0x01870; i+=8)
538 INSTANCE_WR(ctx, i/4, 0x3f800000);
539 for (i=0x035b8; i<=0x057a8; i+=24)
540 INSTANCE_WR(ctx, i/4, 0x00000001);
541 for (i=0x057b8; i<=0x05ba8; i+=16)
542 INSTANCE_WR(ctx, i/4, 0x3f800000);
543 for (i=0x07f38; i<=0x0a128; i+=24)
544 INSTANCE_WR(ctx, i/4, 0x00000001);
545 for (i=0x0a138; i<=0x0a528; i+=16)
546 INSTANCE_WR(ctx, i/4, 0x3f800000);
547 for (i=0x0c8b8; i<=0x0eaa8; i+=24)
548 INSTANCE_WR(ctx, i/4, 0x00000001);
549 for (i=0x0eab8; i<=0x0eea8; i+=16)
550 INSTANCE_WR(ctx, i/4, 0x3f800000);
553 /* This may only work on 7800 AGP cards, will include a warning */
554 static void
555 nv47_graph_context_init(struct drm_device *dev, struct nouveau_gpuobj *ctx)
557 struct drm_nouveau_private *dev_priv = dev->dev_private;
558 int i;
560 INSTANCE_WR(ctx, 0x00000000/4, ctx->im_pramin->start);
561 INSTANCE_WR(ctx, 0x00000024/4, 0x0000ffff);
562 INSTANCE_WR(ctx, 0x00000028/4, 0x0000ffff);
563 INSTANCE_WR(ctx, 0x00000030/4, 0x00000001);
564 INSTANCE_WR(ctx, 0x0000011c/4, 0x20010001);
565 INSTANCE_WR(ctx, 0x00000120/4, 0x0f73ef00);
566 INSTANCE_WR(ctx, 0x00000128/4, 0x02008821);
567 INSTANCE_WR(ctx, 0x00000178/4, 0x00000040);
568 INSTANCE_WR(ctx, 0x0000017c/4, 0x00000040);
569 INSTANCE_WR(ctx, 0x00000180/4, 0x00000040);
570 INSTANCE_WR(ctx, 0x00000188/4, 0x00000040);
571 for (i=0x00000194; i<=0x000001b0; i+=4)
572 INSTANCE_WR(ctx, i/4, 0x80000000);
573 INSTANCE_WR(ctx, 0x000001d0/4, 0x0b0b0b0c);
574 INSTANCE_WR(ctx, 0x00000340/4, 0x00040000);
575 INSTANCE_WR(ctx, 0x00000350/4, 0x55555555);
576 INSTANCE_WR(ctx, 0x00000354/4, 0x55555555);
577 INSTANCE_WR(ctx, 0x00000358/4, 0x55555555);
578 INSTANCE_WR(ctx, 0x0000035c/4, 0x55555555);
579 INSTANCE_WR(ctx, 0x00000388/4, 0x00000008);
580 INSTANCE_WR(ctx, 0x0000039c/4, 0x00001010);
581 for (i=0x000003c0; i<=0x000003fc; i+=4)
582 INSTANCE_WR(ctx, i/4, 0x00000111);
583 INSTANCE_WR(ctx, 0x00000454/4, 0x00000111);
584 INSTANCE_WR(ctx, 0x00000458/4, 0x00080060);
585 INSTANCE_WR(ctx, 0x00000474/4, 0x00000080);
586 INSTANCE_WR(ctx, 0x00000478/4, 0xffff0000);
587 INSTANCE_WR(ctx, 0x0000047c/4, 0x00000001);
588 INSTANCE_WR(ctx, 0x00000490/4, 0x46400000);
589 INSTANCE_WR(ctx, 0x000004a0/4, 0xffff0000);
590 for (i=0x000004a4; i<=0x000004e0; i+=4)
591 INSTANCE_WR(ctx, i/4, 0x88888888);
592 INSTANCE_WR(ctx, 0x000004f4/4, 0x0fff0000);
593 INSTANCE_WR(ctx, 0x000004f8/4, 0x0fff0000);
594 INSTANCE_WR(ctx, 0x00000500/4, 0x00011100);
595 for (i=0x0000051c; i<=0x00000558; i+=4)
596 INSTANCE_WR(ctx, i/4, 0x07ff0000);
597 INSTANCE_WR(ctx, 0x00000564/4, 0x4b7fffff);
598 INSTANCE_WR(ctx, 0x0000058c/4, 0x30201000);
599 INSTANCE_WR(ctx, 0x00000590/4, 0x70605040);
600 INSTANCE_WR(ctx, 0x00000594/4, 0xb8a89888);
601 INSTANCE_WR(ctx, 0x00000598/4, 0xf8e8d8c8);
602 INSTANCE_WR(ctx, 0x000005ac/4, 0x40100000);
603 INSTANCE_WR(ctx, 0x000005c8/4, 0x0000ffff);
604 INSTANCE_WR(ctx, 0x000005fc/4, 0x435185d6);
605 INSTANCE_WR(ctx, 0x00000600/4, 0x2155b699);
606 INSTANCE_WR(ctx, 0x00000604/4, 0xfedcba98);
607 INSTANCE_WR(ctx, 0x00000608/4, 0x00000098);
608 INSTANCE_WR(ctx, 0x00000618/4, 0xffffffff);
609 INSTANCE_WR(ctx, 0x0000061c/4, 0x00ff7000);
610 INSTANCE_WR(ctx, 0x00000620/4, 0x0000ffff);
611 INSTANCE_WR(ctx, 0x00000630/4, 0x00ff0000);
612 INSTANCE_WR(ctx, 0x0000066c/4, 0x00ffff00);
613 for (i=0x000006b0; i<=0x000006ec; i+=4)
614 INSTANCE_WR(ctx, i/4, 0x00018488);
615 for (i=0x000006f0; i<=0x0000072c; i+=4)
616 INSTANCE_WR(ctx, i/4, 0x00028202);
617 for (i=0x00000770; i<=0x000007ac; i+=4)
618 INSTANCE_WR(ctx, i/4, 0x0000aae4);
619 for (i=0x000007b0; i<=0x000007ec; i+=4)
620 INSTANCE_WR(ctx, i/4, 0x01012000);
621 for (i=0x000007f0; i<=0x0000082c; i+=4)
622 INSTANCE_WR(ctx, i/4, 0x00080008);
623 for (i=0x00000870; i<=0x000008ac; i+=4)
624 INSTANCE_WR(ctx, i/4, 0x00100008);
625 INSTANCE_WR(ctx, 0x00000900/4, 0x0001bc80);
626 INSTANCE_WR(ctx, 0x00000904/4, 0x0001bc80);
627 INSTANCE_WR(ctx, 0x00000908/4, 0x0001bc80);
628 INSTANCE_WR(ctx, 0x0000090c/4, 0x0001bc80);
629 INSTANCE_WR(ctx, 0x00000910/4, 0x00000202);
630 INSTANCE_WR(ctx, 0x00000914/4, 0x00000202);
631 INSTANCE_WR(ctx, 0x00000918/4, 0x00000202);
632 INSTANCE_WR(ctx, 0x0000091c/4, 0x00000202);
633 for (i=0x00000930; i<=0x0000095c; i+=4)
634 INSTANCE_WR(ctx, i/4, 0x00000008);
635 INSTANCE_WR(ctx, 0x00000970/4, 0x00000002);
636 INSTANCE_WR(ctx, 0x000009a4/4, 0x00000021);
637 INSTANCE_WR(ctx, 0x000009a8/4, 0x030c30c3);
638 INSTANCE_WR(ctx, 0x000009b4/4, 0x3e020200);
639 INSTANCE_WR(ctx, 0x000009b8/4, 0x00ffffff);
640 INSTANCE_WR(ctx, 0x000009bc/4, 0x40103f00);
641 INSTANCE_WR(ctx, 0x000009c8/4, 0x00040000);
642 INSTANCE_WR(ctx, 0x00000a00/4, 0x00008100);
643 INSTANCE_WR(ctx, 0x00000a8c/4, 0x00000001);
644 INSTANCE_WR(ctx, 0x00000ad0/4, 0x00001001);
645 INSTANCE_WR(ctx, 0x00000adc/4, 0x00000003);
646 INSTANCE_WR(ctx, 0x00000ae0/4, 0x00888001);
647 for (i=0x00000b10; i<=0x00000b8c; i+=4)
648 INSTANCE_WR(ctx, i/4, 0xffffffff);
649 INSTANCE_WR(ctx, 0x00000bb4/4, 0x00000005);
650 INSTANCE_WR(ctx, 0x00000bc0/4, 0x0000ffff);
651 for (i=0x00000bdc; i<=0x00000bf8; i+=4)
652 INSTANCE_WR(ctx, i/4, 0x00005555);
653 INSTANCE_WR(ctx, 0x00000bfc/4, 0x00000001);
654 INSTANCE_WR(ctx, 0x00000c34/4, 0x00000001);
655 INSTANCE_WR(ctx, 0x00000c38/4, 0x08e00001);
656 INSTANCE_WR(ctx, 0x00000c3c/4, 0x000e3000);
657 for (i=0x00003000; i<=0x00003078; i+=8)
658 INSTANCE_WR(ctx, i/4, 0x3f800000);
659 for (i=0x00004dc0; i<=0x00006fb0; i+=24)
660 INSTANCE_WR(ctx, i/4, 0x00000001);
661 for (i=0x00006fc0; i<=0x000073b0; i+=16)
662 INSTANCE_WR(ctx, i/4, 0x3f800000);
663 for (i=0x00009800; i<=0x0000b9f0; i+=24)
664 INSTANCE_WR(ctx, i/4, 0x00000001);
665 for (i=0x0000ba00; i<=0x00010430; i+=24)
666 INSTANCE_WR(ctx, i/4, 0x3f800000);
667 for (i=0x00010440; i<=0x00010830; i+=16)
668 INSTANCE_WR(ctx, i/4, 0x3f800000);
669 for (i=0x00012c80; i<=0x00014e70; i+=24)
670 INSTANCE_WR(ctx, i/4, 0x00000001);
671 for (i=0x00014e80; i<=0x00015270; i+=16)
672 INSTANCE_WR(ctx, i/4, 0x3f800000);
673 for (i=0x000176c0; i<=0x000198b0; i+=24)
674 INSTANCE_WR(ctx, i/4, 0x00000001);
675 for (i=0x000198c0; i<=0x00019cb0; i+=16)
676 INSTANCE_WR(ctx, i/4, 0x3f800000);
677 for (i=0x0001c100; i<=0x0001e2f0; i+=24)
678 INSTANCE_WR(ctx, i/4, 0x00000001);
679 for (i=0x0001e300; i<=0x0001e6f0; i+=16)
680 INSTANCE_WR(ctx, i/4, 0x3f800000);
683 static void
684 nv49_graph_context_init(struct drm_device *dev, struct nouveau_gpuobj *ctx)
686 struct drm_nouveau_private *dev_priv = dev->dev_private;
687 int i;
689 INSTANCE_WR(ctx, 0x00000/4, ctx->im_pramin->start);
690 INSTANCE_WR(ctx, 0x00004/4, 0x0000c040);
691 INSTANCE_WR(ctx, 0x00008/4, 0x0000c040);
692 INSTANCE_WR(ctx, 0x0000c/4, 0x0000c040);
693 INSTANCE_WR(ctx, 0x00010/4, 0x0000c040);
694 INSTANCE_WR(ctx, 0x00014/4, 0x0000c040);
695 INSTANCE_WR(ctx, 0x00018/4, 0x0000c040);
696 INSTANCE_WR(ctx, 0x0001c/4, 0x0000c040);
697 INSTANCE_WR(ctx, 0x00020/4, 0x0000c040);
698 INSTANCE_WR(ctx, 0x000c4/4, 0x0000ffff);
699 INSTANCE_WR(ctx, 0x000c8/4, 0x0000ffff);
700 INSTANCE_WR(ctx, 0x000d0/4, 0x00000001);
701 INSTANCE_WR(ctx, 0x001bc/4, 0x20010001);
702 INSTANCE_WR(ctx, 0x001c0/4, 0x0f73ef00);
703 INSTANCE_WR(ctx, 0x001c8/4, 0x02008821);
704 INSTANCE_WR(ctx, 0x00218/4, 0x00000040);
705 INSTANCE_WR(ctx, 0x0021c/4, 0x00000040);
706 INSTANCE_WR(ctx, 0x00220/4, 0x00000040);
707 INSTANCE_WR(ctx, 0x00228/4, 0x00000040);
708 INSTANCE_WR(ctx, 0x00234/4, 0x80000000);
709 INSTANCE_WR(ctx, 0x00238/4, 0x80000000);
710 INSTANCE_WR(ctx, 0x0023c/4, 0x80000000);
711 INSTANCE_WR(ctx, 0x00240/4, 0x80000000);
712 INSTANCE_WR(ctx, 0x00244/4, 0x80000000);
713 INSTANCE_WR(ctx, 0x00248/4, 0x80000000);
714 INSTANCE_WR(ctx, 0x0024c/4, 0x80000000);
715 INSTANCE_WR(ctx, 0x00250/4, 0x80000000);
716 INSTANCE_WR(ctx, 0x00270/4, 0x0b0b0b0c);
717 INSTANCE_WR(ctx, 0x003e0/4, 0x00040000);
718 INSTANCE_WR(ctx, 0x003f0/4, 0x55555555);
719 INSTANCE_WR(ctx, 0x003f4/4, 0x55555555);
720 INSTANCE_WR(ctx, 0x003f8/4, 0x55555555);
721 INSTANCE_WR(ctx, 0x003fc/4, 0x55555555);
722 INSTANCE_WR(ctx, 0x00428/4, 0x00000008);
723 INSTANCE_WR(ctx, 0x0043c/4, 0x00001010);
724 INSTANCE_WR(ctx, 0x00460/4, 0x00000111);
725 INSTANCE_WR(ctx, 0x00464/4, 0x00000111);
726 INSTANCE_WR(ctx, 0x00468/4, 0x00000111);
727 INSTANCE_WR(ctx, 0x0046c/4, 0x00000111);
728 INSTANCE_WR(ctx, 0x00470/4, 0x00000111);
729 INSTANCE_WR(ctx, 0x00474/4, 0x00000111);
730 INSTANCE_WR(ctx, 0x00478/4, 0x00000111);
731 INSTANCE_WR(ctx, 0x0047c/4, 0x00000111);
732 INSTANCE_WR(ctx, 0x00480/4, 0x00000111);
733 INSTANCE_WR(ctx, 0x00484/4, 0x00000111);
734 INSTANCE_WR(ctx, 0x00488/4, 0x00000111);
735 INSTANCE_WR(ctx, 0x0048c/4, 0x00000111);
736 INSTANCE_WR(ctx, 0x00490/4, 0x00000111);
737 INSTANCE_WR(ctx, 0x00494/4, 0x00000111);
738 INSTANCE_WR(ctx, 0x00498/4, 0x00000111);
739 INSTANCE_WR(ctx, 0x0049c/4, 0x00000111);
740 INSTANCE_WR(ctx, 0x004f4/4, 0x00000111);
741 INSTANCE_WR(ctx, 0x004f8/4, 0x00080060);
742 INSTANCE_WR(ctx, 0x00514/4, 0x00000080);
743 INSTANCE_WR(ctx, 0x00518/4, 0xffff0000);
744 INSTANCE_WR(ctx, 0x0051c/4, 0x00000001);
745 INSTANCE_WR(ctx, 0x00530/4, 0x46400000);
746 INSTANCE_WR(ctx, 0x00540/4, 0xffff0000);
747 INSTANCE_WR(ctx, 0x00544/4, 0x88888888);
748 INSTANCE_WR(ctx, 0x00548/4, 0x88888888);
749 INSTANCE_WR(ctx, 0x0054c/4, 0x88888888);
750 INSTANCE_WR(ctx, 0x00550/4, 0x88888888);
751 INSTANCE_WR(ctx, 0x00554/4, 0x88888888);
752 INSTANCE_WR(ctx, 0x00558/4, 0x88888888);
753 INSTANCE_WR(ctx, 0x0055c/4, 0x88888888);
754 INSTANCE_WR(ctx, 0x00560/4, 0x88888888);
755 INSTANCE_WR(ctx, 0x00564/4, 0x88888888);
756 INSTANCE_WR(ctx, 0x00568/4, 0x88888888);
757 INSTANCE_WR(ctx, 0x0056c/4, 0x88888888);
758 INSTANCE_WR(ctx, 0x00570/4, 0x88888888);
759 INSTANCE_WR(ctx, 0x00574/4, 0x88888888);
760 INSTANCE_WR(ctx, 0x00578/4, 0x88888888);
761 INSTANCE_WR(ctx, 0x0057c/4, 0x88888888);
762 INSTANCE_WR(ctx, 0x00580/4, 0x88888888);
763 INSTANCE_WR(ctx, 0x00594/4, 0x0fff0000);
764 INSTANCE_WR(ctx, 0x00598/4, 0x0fff0000);
765 INSTANCE_WR(ctx, 0x005a0/4, 0x00011100);
766 INSTANCE_WR(ctx, 0x005bc/4, 0x07ff0000);
767 INSTANCE_WR(ctx, 0x005c0/4, 0x07ff0000);
768 INSTANCE_WR(ctx, 0x005c4/4, 0x07ff0000);
769 INSTANCE_WR(ctx, 0x005c8/4, 0x07ff0000);
770 INSTANCE_WR(ctx, 0x005cc/4, 0x07ff0000);
771 INSTANCE_WR(ctx, 0x005d0/4, 0x07ff0000);
772 INSTANCE_WR(ctx, 0x005d4/4, 0x07ff0000);
773 INSTANCE_WR(ctx, 0x005d8/4, 0x07ff0000);
774 INSTANCE_WR(ctx, 0x005dc/4, 0x07ff0000);
775 INSTANCE_WR(ctx, 0x005e0/4, 0x07ff0000);
776 INSTANCE_WR(ctx, 0x005e4/4, 0x07ff0000);
777 INSTANCE_WR(ctx, 0x005e8/4, 0x07ff0000);
778 INSTANCE_WR(ctx, 0x005ec/4, 0x07ff0000);
779 INSTANCE_WR(ctx, 0x005f0/4, 0x07ff0000);
780 INSTANCE_WR(ctx, 0x005f4/4, 0x07ff0000);
781 INSTANCE_WR(ctx, 0x005f8/4, 0x07ff0000);
782 INSTANCE_WR(ctx, 0x00604/4, 0x4b7fffff);
783 INSTANCE_WR(ctx, 0x0062c/4, 0x30201000);
784 INSTANCE_WR(ctx, 0x00630/4, 0x70605040);
785 INSTANCE_WR(ctx, 0x00634/4, 0xb8a89888);
786 INSTANCE_WR(ctx, 0x00638/4, 0xf8e8d8c8);
787 INSTANCE_WR(ctx, 0x0064c/4, 0x40100000);
788 INSTANCE_WR(ctx, 0x00668/4, 0x0000ffff);
789 INSTANCE_WR(ctx, 0x0069c/4, 0x435185d6);
790 INSTANCE_WR(ctx, 0x006a0/4, 0x2155b699);
791 INSTANCE_WR(ctx, 0x006a4/4, 0xfedcba98);
792 INSTANCE_WR(ctx, 0x006a8/4, 0x00000098);
793 INSTANCE_WR(ctx, 0x006b8/4, 0xffffffff);
794 INSTANCE_WR(ctx, 0x006bc/4, 0x00ff7000);
795 INSTANCE_WR(ctx, 0x006c0/4, 0x0000ffff);
796 INSTANCE_WR(ctx, 0x006d0/4, 0x00ff0000);
797 INSTANCE_WR(ctx, 0x0070c/4, 0x00ffff00);
798 for (i=0x00750; i<=0x0078c; i+=4)
799 INSTANCE_WR(ctx, i/4, 0x00018488);
800 for (i=0x00790; i<=0x007cc; i+=4)
801 INSTANCE_WR(ctx, i/4, 0x00028202);
802 for (i=0x00810; i<=0x0084c; i+=4)
803 INSTANCE_WR(ctx, i/4, 0x0000aae4);
804 for (i=0x00850; i<=0x0088c; i+=4)
805 INSTANCE_WR(ctx, i/4, 0x01012000);
806 for (i=0x00890; i<=0x008cc; i+=4)
807 INSTANCE_WR(ctx, i/4, 0x00080008);
808 for (i=0x00910; i<=0x0094c; i+=4)
809 INSTANCE_WR(ctx, i/4, 0x00100008);
810 for (i=0x009a0; i<=0x009ac; i+=4)
811 INSTANCE_WR(ctx, i/4, 0x0001bc80);
812 for (i=0x009b0; i<=0x009bc; i+=4)
813 INSTANCE_WR(ctx, i/4, 0x00000202);
814 for (i=0x009d0; i<=0x009dc; i+=4)
815 INSTANCE_WR(ctx, i/4, 0x00000008);
816 for (i=0x009f0; i<=0x009fc; i+=4)
817 INSTANCE_WR(ctx, i/4, 0x00080008);
818 INSTANCE_WR(ctx, 0x00a10/4, 0x00000002);
819 INSTANCE_WR(ctx, 0x00a44/4, 0x00000421);
820 INSTANCE_WR(ctx, 0x00a48/4, 0x030c30c3);
821 INSTANCE_WR(ctx, 0x00a54/4, 0x3e020200);
822 INSTANCE_WR(ctx, 0x00a58/4, 0x00ffffff);
823 INSTANCE_WR(ctx, 0x00a5c/4, 0x20103f00);
824 INSTANCE_WR(ctx, 0x00a68/4, 0x00040000);
825 INSTANCE_WR(ctx, 0x00aa0/4, 0x00008100);
826 INSTANCE_WR(ctx, 0x00b2c/4, 0x00000001);
827 INSTANCE_WR(ctx, 0x00b70/4, 0x00001001);
828 INSTANCE_WR(ctx, 0x00b7c/4, 0x00000003);
829 INSTANCE_WR(ctx, 0x00b80/4, 0x00888001);
830 INSTANCE_WR(ctx, 0x00bb0/4, 0xffffffff);
831 INSTANCE_WR(ctx, 0x00bb4/4, 0xffffffff);
832 INSTANCE_WR(ctx, 0x00bb8/4, 0xffffffff);
833 INSTANCE_WR(ctx, 0x00bbc/4, 0xffffffff);
834 INSTANCE_WR(ctx, 0x00bc0/4, 0xffffffff);
835 INSTANCE_WR(ctx, 0x00bc4/4, 0xffffffff);
836 INSTANCE_WR(ctx, 0x00bc8/4, 0xffffffff);
837 INSTANCE_WR(ctx, 0x00bcc/4, 0xffffffff);
838 INSTANCE_WR(ctx, 0x00bd0/4, 0xffffffff);
839 INSTANCE_WR(ctx, 0x00bd4/4, 0xffffffff);
840 INSTANCE_WR(ctx, 0x00bd8/4, 0xffffffff);
841 INSTANCE_WR(ctx, 0x00bdc/4, 0xffffffff);
842 INSTANCE_WR(ctx, 0x00be0/4, 0xffffffff);
843 INSTANCE_WR(ctx, 0x00be4/4, 0xffffffff);
844 INSTANCE_WR(ctx, 0x00be8/4, 0xffffffff);
845 INSTANCE_WR(ctx, 0x00bec/4, 0xffffffff);
846 INSTANCE_WR(ctx, 0x00bf0/4, 0xffffffff);
847 INSTANCE_WR(ctx, 0x00bf4/4, 0xffffffff);
848 INSTANCE_WR(ctx, 0x00bf8/4, 0xffffffff);
849 INSTANCE_WR(ctx, 0x00bfc/4, 0xffffffff);
850 INSTANCE_WR(ctx, 0x00c00/4, 0xffffffff);
851 INSTANCE_WR(ctx, 0x00c04/4, 0xffffffff);
852 INSTANCE_WR(ctx, 0x00c08/4, 0xffffffff);
853 INSTANCE_WR(ctx, 0x00c0c/4, 0xffffffff);
854 INSTANCE_WR(ctx, 0x00c10/4, 0xffffffff);
855 INSTANCE_WR(ctx, 0x00c14/4, 0xffffffff);
856 INSTANCE_WR(ctx, 0x00c18/4, 0xffffffff);
857 INSTANCE_WR(ctx, 0x00c1c/4, 0xffffffff);
858 INSTANCE_WR(ctx, 0x00c20/4, 0xffffffff);
859 INSTANCE_WR(ctx, 0x00c24/4, 0xffffffff);
860 INSTANCE_WR(ctx, 0x00c28/4, 0xffffffff);
861 INSTANCE_WR(ctx, 0x00c2c/4, 0xffffffff);
862 INSTANCE_WR(ctx, 0x00c54/4, 0x00000005);
863 INSTANCE_WR(ctx, 0x00c60/4, 0x0000ffff);
864 INSTANCE_WR(ctx, 0x00c7c/4, 0x00005555);
865 INSTANCE_WR(ctx, 0x00c80/4, 0x00005555);
866 INSTANCE_WR(ctx, 0x00c84/4, 0x00005555);
867 INSTANCE_WR(ctx, 0x00c88/4, 0x00005555);
868 INSTANCE_WR(ctx, 0x00c8c/4, 0x00005555);
869 INSTANCE_WR(ctx, 0x00c90/4, 0x00005555);
870 INSTANCE_WR(ctx, 0x00c94/4, 0x00005555);
871 INSTANCE_WR(ctx, 0x00c98/4, 0x00005555);
872 INSTANCE_WR(ctx, 0x00c9c/4, 0x00000001);
873 INSTANCE_WR(ctx, 0x00cd4/4, 0x00000001);
874 INSTANCE_WR(ctx, 0x00cd8/4, 0x08e00001);
875 INSTANCE_WR(ctx, 0x00cdc/4, 0x000e3000);
876 for(i=0x030a0; i<=0x03118; i+=8)
877 INSTANCE_WR(ctx, i/4, 0x3f800000);
878 for(i=0x098a0; i<=0x0ba90; i+=24)
879 INSTANCE_WR(ctx, i/4, 0x00000001);
880 for(i=0x0baa0; i<=0x0be90; i+=16)
881 INSTANCE_WR(ctx, i/4, 0x3f800000);
882 for(i=0x0e2e0; i<=0x0fff0; i+=24)
883 INSTANCE_WR(ctx, i/4, 0x00000001);
884 for(i=0x10008; i<=0x104d0; i+=24)
885 INSTANCE_WR(ctx, i/4, 0x00000001);
886 for(i=0x104e0; i<=0x108d0; i+=16)
887 INSTANCE_WR(ctx, i/4, 0x3f800000);
888 for(i=0x12d20; i<=0x14f10; i+=24)
889 INSTANCE_WR(ctx, i/4, 0x00000001);
890 for(i=0x14f20; i<=0x15310; i+=16)
891 INSTANCE_WR(ctx, i/4, 0x3f800000);
892 for(i=0x17760; i<=0x19950; i+=24)
893 INSTANCE_WR(ctx, i/4, 0x00000001);
894 for(i=0x19960; i<=0x19d50; i+=16)
895 INSTANCE_WR(ctx, i/4, 0x3f800000);
896 for(i=0x1c1a0; i<=0x1e390; i+=24)
897 INSTANCE_WR(ctx, i/4, 0x00000001);
898 for(i=0x1e3a0; i<=0x1e790; i+=16)
899 INSTANCE_WR(ctx, i/4, 0x3f800000);
900 for(i=0x20be0; i<=0x22dd0; i+=24)
901 INSTANCE_WR(ctx, i/4, 0x00000001);
902 for(i=0x22de0; i<=0x231d0; i+=16)
903 INSTANCE_WR(ctx, i/4, 0x3f800000);
906 static void
907 nv4a_graph_context_init(struct drm_device *dev, struct nouveau_gpuobj *ctx)
909 struct drm_nouveau_private *dev_priv = dev->dev_private;
910 int i;
912 INSTANCE_WR(ctx, 0x00000/4, ctx->im_pramin->start);
913 INSTANCE_WR(ctx, 0x00024/4, 0x0000ffff);
914 INSTANCE_WR(ctx, 0x00028/4, 0x0000ffff);
915 INSTANCE_WR(ctx, 0x00030/4, 0x00000001);
916 INSTANCE_WR(ctx, 0x0011c/4, 0x20010001);
917 INSTANCE_WR(ctx, 0x00120/4, 0x0f73ef00);
918 INSTANCE_WR(ctx, 0x00128/4, 0x02008821);
919 INSTANCE_WR(ctx, 0x00158/4, 0x00000001);
920 INSTANCE_WR(ctx, 0x0015c/4, 0x00000001);
921 INSTANCE_WR(ctx, 0x00160/4, 0x00000001);
922 INSTANCE_WR(ctx, 0x00164/4, 0x00000001);
923 INSTANCE_WR(ctx, 0x00168/4, 0x00000001);
924 INSTANCE_WR(ctx, 0x0016c/4, 0x00000001);
925 INSTANCE_WR(ctx, 0x00170/4, 0x00000001);
926 INSTANCE_WR(ctx, 0x00174/4, 0x00000001);
927 INSTANCE_WR(ctx, 0x00178/4, 0x00000040);
928 INSTANCE_WR(ctx, 0x0017c/4, 0x00000040);
929 INSTANCE_WR(ctx, 0x00180/4, 0x00000040);
930 INSTANCE_WR(ctx, 0x00188/4, 0x00000040);
931 INSTANCE_WR(ctx, 0x001d0/4, 0x0b0b0b0c);
932 INSTANCE_WR(ctx, 0x00340/4, 0x00040000);
933 INSTANCE_WR(ctx, 0x00350/4, 0x55555555);
934 INSTANCE_WR(ctx, 0x00354/4, 0x55555555);
935 INSTANCE_WR(ctx, 0x00358/4, 0x55555555);
936 INSTANCE_WR(ctx, 0x0035c/4, 0x55555555);
937 INSTANCE_WR(ctx, 0x00388/4, 0x00000008);
938 INSTANCE_WR(ctx, 0x0039c/4, 0x00003010);
939 INSTANCE_WR(ctx, 0x003cc/4, 0x00000111);
940 INSTANCE_WR(ctx, 0x003d0/4, 0x00080060);
941 INSTANCE_WR(ctx, 0x003ec/4, 0x00000080);
942 INSTANCE_WR(ctx, 0x003f0/4, 0xffff0000);
943 INSTANCE_WR(ctx, 0x003f4/4, 0x00000001);
944 INSTANCE_WR(ctx, 0x00408/4, 0x46400000);
945 INSTANCE_WR(ctx, 0x00418/4, 0xffff0000);
946 INSTANCE_WR(ctx, 0x00424/4, 0x0fff0000);
947 INSTANCE_WR(ctx, 0x00428/4, 0x0fff0000);
948 INSTANCE_WR(ctx, 0x00430/4, 0x00011100);
949 for (i=0x0044c; i<=0x00488; i+=4)
950 INSTANCE_WR(ctx, i/4, 0x07ff0000);
951 INSTANCE_WR(ctx, 0x00494/4, 0x4b7fffff);
952 INSTANCE_WR(ctx, 0x004bc/4, 0x30201000);
953 INSTANCE_WR(ctx, 0x004c0/4, 0x70605040);
954 INSTANCE_WR(ctx, 0x004c4/4, 0xb8a89888);
955 INSTANCE_WR(ctx, 0x004c8/4, 0xf8e8d8c8);
956 INSTANCE_WR(ctx, 0x004dc/4, 0x40100000);
957 INSTANCE_WR(ctx, 0x004f8/4, 0x0000ffff);
958 INSTANCE_WR(ctx, 0x0052c/4, 0x435185d6);
959 INSTANCE_WR(ctx, 0x00530/4, 0x2155b699);
960 INSTANCE_WR(ctx, 0x00534/4, 0xfedcba98);
961 INSTANCE_WR(ctx, 0x00538/4, 0x00000098);
962 INSTANCE_WR(ctx, 0x00548/4, 0xffffffff);
963 INSTANCE_WR(ctx, 0x0054c/4, 0x00ff7000);
964 INSTANCE_WR(ctx, 0x00550/4, 0x0000ffff);
965 INSTANCE_WR(ctx, 0x0055c/4, 0x00ff0000);
966 INSTANCE_WR(ctx, 0x00594/4, 0x00ffff00);
967 for (i=0x005d8; i<=0x00614; i+=4)
968 INSTANCE_WR(ctx, i/4, 0x00018488);
969 for (i=0x00618; i<=0x00654; i+=4)
970 INSTANCE_WR(ctx, i/4, 0x00028202);
971 for (i=0x00698; i<=0x006d4; i+=4)
972 INSTANCE_WR(ctx, i/4, 0x0000aae4);
973 for (i=0x006d8; i<=0x00714; i+=4)
974 INSTANCE_WR(ctx, i/4, 0x01012000);
975 for (i=0x00718; i<=0x00754; i+=4)
976 INSTANCE_WR(ctx, i/4, 0x00080008);
977 for (i=0x00798; i<=0x007d4; i+=4)
978 INSTANCE_WR(ctx, i/4, 0x00100008);
979 for (i=0x00828; i<=0x00834; i+=4)
980 INSTANCE_WR(ctx, i/4, 0x0001bc80);
981 for (i=0x00838; i<=0x00844; i+=4)
982 INSTANCE_WR(ctx, i/4, 0x00000202);
983 for (i=0x00858; i<=0x00864; i+=4)
984 INSTANCE_WR(ctx, i/4, 0x00000008);
985 for (i=0x00878; i<=0x00884; i+=4)
986 INSTANCE_WR(ctx, i/4, 0x00080008);
987 INSTANCE_WR(ctx, 0x00898/4, 0x00000002);
988 INSTANCE_WR(ctx, 0x008cc/4, 0x00000021);
989 INSTANCE_WR(ctx, 0x008d0/4, 0x030c30c3);
990 INSTANCE_WR(ctx, 0x008d4/4, 0x00011001);
991 INSTANCE_WR(ctx, 0x008e0/4, 0x3e020200);
992 INSTANCE_WR(ctx, 0x008e4/4, 0x00ffffff);
993 INSTANCE_WR(ctx, 0x008e8/4, 0x0c103f00);
994 INSTANCE_WR(ctx, 0x008f4/4, 0x00040000);
995 INSTANCE_WR(ctx, 0x0092c/4, 0x00008100);
996 INSTANCE_WR(ctx, 0x009b8/4, 0x00000001);
997 INSTANCE_WR(ctx, 0x009fc/4, 0x00001001);
998 INSTANCE_WR(ctx, 0x00a04/4, 0x00000003);
999 INSTANCE_WR(ctx, 0x00a08/4, 0x00888001);
1000 INSTANCE_WR(ctx, 0x00a8c/4, 0x00000005);
1001 INSTANCE_WR(ctx, 0x00a98/4, 0x0000ffff);
1002 INSTANCE_WR(ctx, 0x00ab4/4, 0x00005555);
1003 INSTANCE_WR(ctx, 0x00ab8/4, 0x00005555);
1004 INSTANCE_WR(ctx, 0x00abc/4, 0x00005555);
1005 INSTANCE_WR(ctx, 0x00ac0/4, 0x00000001);
1006 INSTANCE_WR(ctx, 0x00af8/4, 0x00000001);
1007 for (i=0x016c0; i<=0x01738; i+=8)
1008 INSTANCE_WR(ctx, i/4, 0x3f800000);
1009 for (i=0x03840; i<=0x05670; i+=24)
1010 INSTANCE_WR(ctx, i/4, 0x00000001);
1011 for (i=0x05680; i<=0x05a70; i+=16)
1012 INSTANCE_WR(ctx, i/4, 0x3f800000);
1013 for (i=0x07e00; i<=0x09ff0; i+=24)
1014 INSTANCE_WR(ctx, i/4, 0x00000001);
1015 for (i=0x0a000; i<=0x0a3f0; i+=16)
1016 INSTANCE_WR(ctx, i/4, 0x3f800000);
1017 for (i=0x0c780; i<=0x0e970; i+=24)
1018 INSTANCE_WR(ctx, i/4, 0x00000001);
1019 for (i=0x0e980; i<=0x0ed70; i+=16)
1020 INSTANCE_WR(ctx, i/4, 0x3f800000);
1023 static void
1024 nv4b_graph_context_init(struct drm_device *dev, struct nouveau_gpuobj *ctx)
1026 struct drm_nouveau_private *dev_priv = dev->dev_private;
1027 int i;
1029 INSTANCE_WR(ctx, 0x00000/4, ctx->im_pramin->start);
1030 INSTANCE_WR(ctx, 0x00004/4, 0x0000c040);
1031 INSTANCE_WR(ctx, 0x00008/4, 0x0000c040);
1032 INSTANCE_WR(ctx, 0x0000c/4, 0x0000c040);
1033 INSTANCE_WR(ctx, 0x00010/4, 0x0000c040);
1034 INSTANCE_WR(ctx, 0x00014/4, 0x0000c040);
1035 INSTANCE_WR(ctx, 0x00018/4, 0x0000c040);
1036 INSTANCE_WR(ctx, 0x0001c/4, 0x0000c040);
1037 INSTANCE_WR(ctx, 0x00020/4, 0x0000c040);
1038 INSTANCE_WR(ctx, 0x000c4/4, 0x0000ffff);
1039 INSTANCE_WR(ctx, 0x000c8/4, 0x0000ffff);
1040 INSTANCE_WR(ctx, 0x000d0/4, 0x00000001);
1041 INSTANCE_WR(ctx, 0x001bc/4, 0x20010001);
1042 INSTANCE_WR(ctx, 0x001c0/4, 0x0f73ef00);
1043 INSTANCE_WR(ctx, 0x001c8/4, 0x02008821);
1044 INSTANCE_WR(ctx, 0x00218/4, 0x00000040);
1045 INSTANCE_WR(ctx, 0x0021c/4, 0x00000040);
1046 INSTANCE_WR(ctx, 0x00220/4, 0x00000040);
1047 INSTANCE_WR(ctx, 0x00228/4, 0x00000040);
1048 INSTANCE_WR(ctx, 0x00234/4, 0x80000000);
1049 INSTANCE_WR(ctx, 0x00238/4, 0x80000000);
1050 INSTANCE_WR(ctx, 0x0023c/4, 0x80000000);
1051 INSTANCE_WR(ctx, 0x00240/4, 0x80000000);
1052 INSTANCE_WR(ctx, 0x00244/4, 0x80000000);
1053 INSTANCE_WR(ctx, 0x00248/4, 0x80000000);
1054 INSTANCE_WR(ctx, 0x0024c/4, 0x80000000);
1055 INSTANCE_WR(ctx, 0x00250/4, 0x80000000);
1056 INSTANCE_WR(ctx, 0x00270/4, 0x0b0b0b0c);
1057 INSTANCE_WR(ctx, 0x003e0/4, 0x00040000);
1058 INSTANCE_WR(ctx, 0x003f0/4, 0x55555555);
1059 INSTANCE_WR(ctx, 0x003f4/4, 0x55555555);
1060 INSTANCE_WR(ctx, 0x003f8/4, 0x55555555);
1061 INSTANCE_WR(ctx, 0x003fc/4, 0x55555555);
1062 INSTANCE_WR(ctx, 0x00428/4, 0x00000008);
1063 INSTANCE_WR(ctx, 0x0043c/4, 0x00001010);
1064 INSTANCE_WR(ctx, 0x00460/4, 0x00000111);
1065 INSTANCE_WR(ctx, 0x00464/4, 0x00000111);
1066 INSTANCE_WR(ctx, 0x00468/4, 0x00000111);
1067 INSTANCE_WR(ctx, 0x0046c/4, 0x00000111);
1068 INSTANCE_WR(ctx, 0x00470/4, 0x00000111);
1069 INSTANCE_WR(ctx, 0x00474/4, 0x00000111);
1070 INSTANCE_WR(ctx, 0x00478/4, 0x00000111);
1071 INSTANCE_WR(ctx, 0x0047c/4, 0x00000111);
1072 INSTANCE_WR(ctx, 0x00480/4, 0x00000111);
1073 INSTANCE_WR(ctx, 0x00484/4, 0x00000111);
1074 INSTANCE_WR(ctx, 0x00488/4, 0x00000111);
1075 INSTANCE_WR(ctx, 0x0048c/4, 0x00000111);
1076 INSTANCE_WR(ctx, 0x00490/4, 0x00000111);
1077 INSTANCE_WR(ctx, 0x00494/4, 0x00000111);
1078 INSTANCE_WR(ctx, 0x00498/4, 0x00000111);
1079 INSTANCE_WR(ctx, 0x0049c/4, 0x00000111);
1080 INSTANCE_WR(ctx, 0x004f4/4, 0x00000111);
1081 INSTANCE_WR(ctx, 0x004f8/4, 0x00080060);
1082 INSTANCE_WR(ctx, 0x00514/4, 0x00000080);
1083 INSTANCE_WR(ctx, 0x00518/4, 0xffff0000);
1084 INSTANCE_WR(ctx, 0x0051c/4, 0x00000001);
1085 INSTANCE_WR(ctx, 0x00530/4, 0x46400000);
1086 INSTANCE_WR(ctx, 0x00540/4, 0xffff0000);
1087 INSTANCE_WR(ctx, 0x00544/4, 0x88888888);
1088 INSTANCE_WR(ctx, 0x00548/4, 0x88888888);
1089 INSTANCE_WR(ctx, 0x0054c/4, 0x88888888);
1090 INSTANCE_WR(ctx, 0x00550/4, 0x88888888);
1091 INSTANCE_WR(ctx, 0x00554/4, 0x88888888);
1092 INSTANCE_WR(ctx, 0x00558/4, 0x88888888);
1093 INSTANCE_WR(ctx, 0x0055c/4, 0x88888888);
1094 INSTANCE_WR(ctx, 0x00560/4, 0x88888888);
1095 INSTANCE_WR(ctx, 0x00564/4, 0x88888888);
1096 INSTANCE_WR(ctx, 0x00568/4, 0x88888888);
1097 INSTANCE_WR(ctx, 0x0056c/4, 0x88888888);
1098 INSTANCE_WR(ctx, 0x00570/4, 0x88888888);
1099 INSTANCE_WR(ctx, 0x00574/4, 0x88888888);
1100 INSTANCE_WR(ctx, 0x00578/4, 0x88888888);
1101 INSTANCE_WR(ctx, 0x0057c/4, 0x88888888);
1102 INSTANCE_WR(ctx, 0x00580/4, 0x88888888);
1103 INSTANCE_WR(ctx, 0x00594/4, 0x0fff0000);
1104 INSTANCE_WR(ctx, 0x00598/4, 0x0fff0000);
1105 INSTANCE_WR(ctx, 0x005a0/4, 0x00011100);
1106 INSTANCE_WR(ctx, 0x005bc/4, 0x07ff0000);
1107 INSTANCE_WR(ctx, 0x005c0/4, 0x07ff0000);
1108 INSTANCE_WR(ctx, 0x005c4/4, 0x07ff0000);
1109 INSTANCE_WR(ctx, 0x005c8/4, 0x07ff0000);
1110 INSTANCE_WR(ctx, 0x005cc/4, 0x07ff0000);
1111 INSTANCE_WR(ctx, 0x005d0/4, 0x07ff0000);
1112 INSTANCE_WR(ctx, 0x005d4/4, 0x07ff0000);
1113 INSTANCE_WR(ctx, 0x005d8/4, 0x07ff0000);
1114 INSTANCE_WR(ctx, 0x005dc/4, 0x07ff0000);
1115 INSTANCE_WR(ctx, 0x005e0/4, 0x07ff0000);
1116 INSTANCE_WR(ctx, 0x005e4/4, 0x07ff0000);
1117 INSTANCE_WR(ctx, 0x005e8/4, 0x07ff0000);
1118 INSTANCE_WR(ctx, 0x005ec/4, 0x07ff0000);
1119 INSTANCE_WR(ctx, 0x005f0/4, 0x07ff0000);
1120 INSTANCE_WR(ctx, 0x005f4/4, 0x07ff0000);
1121 INSTANCE_WR(ctx, 0x005f8/4, 0x07ff0000);
1122 INSTANCE_WR(ctx, 0x00604/4, 0x4b7fffff);
1123 INSTANCE_WR(ctx, 0x0062c/4, 0x30201000);
1124 INSTANCE_WR(ctx, 0x00630/4, 0x70605040);
1125 INSTANCE_WR(ctx, 0x00634/4, 0xb8a89888);
1126 INSTANCE_WR(ctx, 0x00638/4, 0xf8e8d8c8);
1127 INSTANCE_WR(ctx, 0x0064c/4, 0x40100000);
1128 INSTANCE_WR(ctx, 0x00668/4, 0x0000ffff);
1129 INSTANCE_WR(ctx, 0x0069c/4, 0x435185d6);
1130 INSTANCE_WR(ctx, 0x006a0/4, 0x2155b699);
1131 INSTANCE_WR(ctx, 0x006a4/4, 0xfedcba98);
1132 INSTANCE_WR(ctx, 0x006a8/4, 0x00000098);
1133 INSTANCE_WR(ctx, 0x006b8/4, 0xffffffff);
1134 INSTANCE_WR(ctx, 0x006bc/4, 0x00ff7000);
1135 INSTANCE_WR(ctx, 0x006c0/4, 0x0000ffff);
1136 INSTANCE_WR(ctx, 0x006d0/4, 0x00ff0000);
1137 INSTANCE_WR(ctx, 0x0070c/4, 0x00ffff00);
1138 for (i=0x00750; i<=0x0078c; i+=4)
1139 INSTANCE_WR(ctx, i/4, 0x00018488);
1140 for (i=0x00790; i<=0x007cc; i+=4)
1141 INSTANCE_WR(ctx, i/4, 0x00028202);
1142 for (i=0x00810; i<=0x0084c; i+=4)
1143 INSTANCE_WR(ctx, i/4, 0x0000aae4);
1144 for (i=0x00850; i<=0x0088c; i+=4)
1145 INSTANCE_WR(ctx, i/4, 0x01012000);
1146 for (i=0x00890; i<=0x008cc; i+=4)
1147 INSTANCE_WR(ctx, i/4, 0x00080008);
1148 for (i=0x00910; i<=0x0094c; i+=4)
1149 INSTANCE_WR(ctx, i/4, 0x00100008);
1150 for (i=0x009a0; i<=0x009ac; i+=4)
1151 INSTANCE_WR(ctx, i/4, 0x0001bc80);
1152 for (i=0x009b0; i<=0x009bc; i+=4)
1153 INSTANCE_WR(ctx, i/4, 0x00000202);
1154 for (i=0x009d0; i<=0x009dc; i+=4)
1155 INSTANCE_WR(ctx, i/4, 0x00000008);
1156 for (i=0x009f0; i<=0x009fc; i+=4)
1157 INSTANCE_WR(ctx, i/4, 0x00080008);
1158 INSTANCE_WR(ctx, 0x00a10/4, 0x00000002);
1159 INSTANCE_WR(ctx, 0x00a44/4, 0x00000421);
1160 INSTANCE_WR(ctx, 0x00a48/4, 0x030c30c3);
1161 INSTANCE_WR(ctx, 0x00a54/4, 0x3e020200);
1162 INSTANCE_WR(ctx, 0x00a58/4, 0x00ffffff);
1163 INSTANCE_WR(ctx, 0x00a5c/4, 0x20103f00);
1164 INSTANCE_WR(ctx, 0x00a68/4, 0x00040000);
1165 INSTANCE_WR(ctx, 0x00aa0/4, 0x00008100);
1166 INSTANCE_WR(ctx, 0x00b2c/4, 0x00000001);
1167 INSTANCE_WR(ctx, 0x00b70/4, 0x00001001);
1168 INSTANCE_WR(ctx, 0x00b7c/4, 0x00000003);
1169 INSTANCE_WR(ctx, 0x00b80/4, 0x00888001);
1170 INSTANCE_WR(ctx, 0x00bb0/4, 0xffffffff);
1171 INSTANCE_WR(ctx, 0x00bb4/4, 0xffffffff);
1172 INSTANCE_WR(ctx, 0x00bb8/4, 0xffffffff);
1173 INSTANCE_WR(ctx, 0x00bbc/4, 0xffffffff);
1174 INSTANCE_WR(ctx, 0x00bc0/4, 0xffffffff);
1175 INSTANCE_WR(ctx, 0x00bc4/4, 0xffffffff);
1176 INSTANCE_WR(ctx, 0x00bc8/4, 0xffffffff);
1177 INSTANCE_WR(ctx, 0x00bcc/4, 0xffffffff);
1178 INSTANCE_WR(ctx, 0x00bd0/4, 0xffffffff);
1179 INSTANCE_WR(ctx, 0x00bd4/4, 0xffffffff);
1180 INSTANCE_WR(ctx, 0x00bd8/4, 0xffffffff);
1181 INSTANCE_WR(ctx, 0x00bdc/4, 0xffffffff);
1182 INSTANCE_WR(ctx, 0x00be0/4, 0xffffffff);
1183 INSTANCE_WR(ctx, 0x00be4/4, 0xffffffff);
1184 INSTANCE_WR(ctx, 0x00be8/4, 0xffffffff);
1185 INSTANCE_WR(ctx, 0x00bec/4, 0xffffffff);
1186 INSTANCE_WR(ctx, 0x00bf0/4, 0xffffffff);
1187 INSTANCE_WR(ctx, 0x00bf4/4, 0xffffffff);
1188 INSTANCE_WR(ctx, 0x00bf8/4, 0xffffffff);
1189 INSTANCE_WR(ctx, 0x00bfc/4, 0xffffffff);
1190 INSTANCE_WR(ctx, 0x00c00/4, 0xffffffff);
1191 INSTANCE_WR(ctx, 0x00c04/4, 0xffffffff);
1192 INSTANCE_WR(ctx, 0x00c08/4, 0xffffffff);
1193 INSTANCE_WR(ctx, 0x00c0c/4, 0xffffffff);
1194 INSTANCE_WR(ctx, 0x00c10/4, 0xffffffff);
1195 INSTANCE_WR(ctx, 0x00c14/4, 0xffffffff);
1196 INSTANCE_WR(ctx, 0x00c18/4, 0xffffffff);
1197 INSTANCE_WR(ctx, 0x00c1c/4, 0xffffffff);
1198 INSTANCE_WR(ctx, 0x00c20/4, 0xffffffff);
1199 INSTANCE_WR(ctx, 0x00c24/4, 0xffffffff);
1200 INSTANCE_WR(ctx, 0x00c28/4, 0xffffffff);
1201 INSTANCE_WR(ctx, 0x00c2c/4, 0xffffffff);
1202 INSTANCE_WR(ctx, 0x00c54/4, 0x00000005);
1203 INSTANCE_WR(ctx, 0x00c60/4, 0x0000ffff);
1204 INSTANCE_WR(ctx, 0x00c7c/4, 0x00005555);
1205 INSTANCE_WR(ctx, 0x00c80/4, 0x00005555);
1206 INSTANCE_WR(ctx, 0x00c84/4, 0x00005555);
1207 INSTANCE_WR(ctx, 0x00c88/4, 0x00005555);
1208 INSTANCE_WR(ctx, 0x00c8c/4, 0x00005555);
1209 INSTANCE_WR(ctx, 0x00c90/4, 0x00005555);
1210 INSTANCE_WR(ctx, 0x00c94/4, 0x00005555);
1211 INSTANCE_WR(ctx, 0x00c98/4, 0x00005555);
1212 INSTANCE_WR(ctx, 0x00c9c/4, 0x00000001);
1213 INSTANCE_WR(ctx, 0x00cd4/4, 0x00000001);
1214 INSTANCE_WR(ctx, 0x00cd8/4, 0x08e00001);
1215 INSTANCE_WR(ctx, 0x00cdc/4, 0x000e3000);
1216 for(i=0x030a0; i<=0x03118; i+=8)
1217 INSTANCE_WR(ctx, i/4, 0x3f800000);
1218 for(i=0x098a0; i<=0x0ba90; i+=24)
1219 INSTANCE_WR(ctx, i/4, 0x00000001);
1220 for(i=0x0baa0; i<=0x0be90; i+=16)
1221 INSTANCE_WR(ctx, i/4, 0x3f800000);
1222 for(i=0x0e2e0; i<=0x0fff0; i+=24)
1223 INSTANCE_WR(ctx, i/4, 0x00000001);
1224 for(i=0x10008; i<=0x104d0; i+=24)
1225 INSTANCE_WR(ctx, i/4, 0x00000001);
1226 for(i=0x104e0; i<=0x108d0; i+=16)
1227 INSTANCE_WR(ctx, i/4, 0x3f800000);
1228 for(i=0x12d20; i<=0x14f10; i+=24)
1229 INSTANCE_WR(ctx, i/4, 0x00000001);
1230 for(i=0x14f20; i<=0x15310; i+=16)
1231 INSTANCE_WR(ctx, i/4, 0x3f800000);
1232 for(i=0x17760; i<=0x19950; i+=24)
1233 INSTANCE_WR(ctx, i/4, 0x00000001);
1234 for(i=0x19960; i<=0x19d50; i+=16)
1235 INSTANCE_WR(ctx, i/4, 0x3f800000);
1238 static void
1239 nv4c_graph_context_init(struct drm_device *dev, struct nouveau_gpuobj *ctx)
1241 struct drm_nouveau_private *dev_priv = dev->dev_private;
1242 int i;
1244 INSTANCE_WR(ctx, 0x00000/4, ctx->im_pramin->start);
1245 INSTANCE_WR(ctx, 0x00024/4, 0x0000ffff);
1246 INSTANCE_WR(ctx, 0x00028/4, 0x0000ffff);
1247 INSTANCE_WR(ctx, 0x00030/4, 0x00000001);
1248 INSTANCE_WR(ctx, 0x0011c/4, 0x20010001);
1249 INSTANCE_WR(ctx, 0x00120/4, 0x0f73ef00);
1250 INSTANCE_WR(ctx, 0x00128/4, 0x02008821);
1251 INSTANCE_WR(ctx, 0x00158/4, 0x00000001);
1252 INSTANCE_WR(ctx, 0x0015c/4, 0x00000001);
1253 INSTANCE_WR(ctx, 0x00160/4, 0x00000001);
1254 INSTANCE_WR(ctx, 0x00164/4, 0x00000001);
1255 INSTANCE_WR(ctx, 0x00168/4, 0x00000001);
1256 INSTANCE_WR(ctx, 0x0016c/4, 0x00000001);
1257 INSTANCE_WR(ctx, 0x00170/4, 0x00000001);
1258 INSTANCE_WR(ctx, 0x00174/4, 0x00000001);
1259 INSTANCE_WR(ctx, 0x00178/4, 0x00000040);
1260 INSTANCE_WR(ctx, 0x0017c/4, 0x00000040);
1261 INSTANCE_WR(ctx, 0x00180/4, 0x00000040);
1262 INSTANCE_WR(ctx, 0x00188/4, 0x00000040);
1263 INSTANCE_WR(ctx, 0x001d0/4, 0x0b0b0b0c);
1264 INSTANCE_WR(ctx, 0x00340/4, 0x00040000);
1265 INSTANCE_WR(ctx, 0x00350/4, 0x55555555);
1266 INSTANCE_WR(ctx, 0x00354/4, 0x55555555);
1267 INSTANCE_WR(ctx, 0x00358/4, 0x55555555);
1268 INSTANCE_WR(ctx, 0x0035c/4, 0x55555555);
1269 INSTANCE_WR(ctx, 0x00388/4, 0x00000008);
1270 INSTANCE_WR(ctx, 0x0039c/4, 0x00001010);
1271 INSTANCE_WR(ctx, 0x003d0/4, 0x00000111);
1272 INSTANCE_WR(ctx, 0x003d4/4, 0x00080060);
1273 INSTANCE_WR(ctx, 0x003f0/4, 0x00000080);
1274 INSTANCE_WR(ctx, 0x003f4/4, 0xffff0000);
1275 INSTANCE_WR(ctx, 0x003f8/4, 0x00000001);
1276 INSTANCE_WR(ctx, 0x0040c/4, 0x46400000);
1277 INSTANCE_WR(ctx, 0x0041c/4, 0xffff0000);
1278 INSTANCE_WR(ctx, 0x00428/4, 0x0fff0000);
1279 INSTANCE_WR(ctx, 0x0042c/4, 0x0fff0000);
1280 INSTANCE_WR(ctx, 0x00434/4, 0x00011100);
1281 for (i=0x00450; i<0x0048c; i+=4)
1282 INSTANCE_WR(ctx, i/4, 0x07ff0000);
1283 INSTANCE_WR(ctx, 0x00498/4, 0x4b7fffff);
1284 INSTANCE_WR(ctx, 0x004c0/4, 0x30201000);
1285 INSTANCE_WR(ctx, 0x004c4/4, 0x70605040);
1286 INSTANCE_WR(ctx, 0x004c8/4, 0xb8a89888);
1287 INSTANCE_WR(ctx, 0x004cc/4, 0xf8e8d8c8);
1288 INSTANCE_WR(ctx, 0x004e0/4, 0x40100000);
1289 INSTANCE_WR(ctx, 0x004fc/4, 0x0000ffff);
1290 INSTANCE_WR(ctx, 0x00530/4, 0x435185d6);
1291 INSTANCE_WR(ctx, 0x00534/4, 0x2155b699);
1292 INSTANCE_WR(ctx, 0x00538/4, 0xfedcba98);
1293 INSTANCE_WR(ctx, 0x0053c/4, 0x00000098);
1294 INSTANCE_WR(ctx, 0x0054c/4, 0xffffffff);
1295 INSTANCE_WR(ctx, 0x00550/4, 0x00ff7000);
1296 INSTANCE_WR(ctx, 0x00554/4, 0x0000ffff);
1297 INSTANCE_WR(ctx, 0x00564/4, 0x00ff0000);
1298 INSTANCE_WR(ctx, 0x0059c/4, 0x00ffff00);
1299 for (i=0x005e0; i<=0x0061c; i+=4)
1300 INSTANCE_WR(ctx, i/4, 0x00018488);
1301 for (i=0x00620; i<=0x0065c; i+=4)
1302 INSTANCE_WR(ctx, i/4, 0x00028202);
1303 for (i=0x006a0; i<=0x006dc; i+=4)
1304 INSTANCE_WR(ctx, i/4, 0x0000aae4);
1305 for (i=0x006e0; i<=0x0071c; i+=4)
1306 INSTANCE_WR(ctx, i/4, 0x01012000);
1307 for (i=0x00720; i<=0x0075c; i+=4)
1308 INSTANCE_WR(ctx, i/4, 0x00080008);
1309 for (i=0x007a0; i<=0x007dc; i+=4)
1310 INSTANCE_WR(ctx, i/4, 0x00100008);
1311 for (i=0x00830; i<=0x0083c; i+=4)
1312 INSTANCE_WR(ctx, i/4, 0x0001bc80);
1313 for (i=0x00840; i<=0x0084c; i+=4)
1314 INSTANCE_WR(ctx, i/4, 0x00000202);
1315 for (i=0x00860; i<=0x0086c; i+=4)
1316 INSTANCE_WR(ctx, i/4, 0x00000008);
1317 for (i=0x00880; i<=0x0088c; i+=4)
1318 INSTANCE_WR(ctx, i/4, 0x00080008);
1319 INSTANCE_WR(ctx, 0x008a0/4, 0x00000002);
1320 INSTANCE_WR(ctx, 0x008d4/4, 0x00000020);
1321 INSTANCE_WR(ctx, 0x008d8/4, 0x030c30c3);
1322 INSTANCE_WR(ctx, 0x008dc/4, 0x00011001);
1323 INSTANCE_WR(ctx, 0x008e8/4, 0x3e020200);
1324 INSTANCE_WR(ctx, 0x008ec/4, 0x00ffffff);
1325 INSTANCE_WR(ctx, 0x008f0/4, 0x0c103f00);
1326 INSTANCE_WR(ctx, 0x008fc/4, 0x00040000);
1327 INSTANCE_WR(ctx, 0x00934/4, 0x00008100);
1328 INSTANCE_WR(ctx, 0x009c0/4, 0x00000001);
1329 INSTANCE_WR(ctx, 0x00a04/4, 0x00001001);
1330 INSTANCE_WR(ctx, 0x00a0c/4, 0x00000003);
1331 INSTANCE_WR(ctx, 0x00a10/4, 0x00888001);
1332 INSTANCE_WR(ctx, 0x00a74/4, 0x00000005);
1333 INSTANCE_WR(ctx, 0x00a80/4, 0x0000ffff);
1334 INSTANCE_WR(ctx, 0x00a9c/4, 0x00005555);
1335 INSTANCE_WR(ctx, 0x00aa0/4, 0x00000001);
1336 INSTANCE_WR(ctx, 0x00ad8/4, 0x00000001);
1337 for (i=0x016a0; i<0x01718; i+=8)
1338 INSTANCE_WR(ctx, i/4, 0x3f800000);
1339 for (i=0x03460; i<0x05650; i+=24)
1340 INSTANCE_WR(ctx, i/4, 0x00000001);
1341 for (i=0x05660; i<0x05a50; i+=16)
1342 INSTANCE_WR(ctx, i/4, 0x3f800000);
1345 static void
1346 nv4e_graph_context_init(struct drm_device *dev, struct nouveau_gpuobj *ctx)
1348 struct drm_nouveau_private *dev_priv = dev->dev_private;
1349 int i;
1351 INSTANCE_WR(ctx, 0x00000/4, ctx->im_pramin->start);
1352 INSTANCE_WR(ctx, 0x00024/4, 0x0000ffff);
1353 INSTANCE_WR(ctx, 0x00028/4, 0x0000ffff);
1354 INSTANCE_WR(ctx, 0x00030/4, 0x00000001);
1355 INSTANCE_WR(ctx, 0x0011c/4, 0x20010001);
1356 INSTANCE_WR(ctx, 0x00120/4, 0x0f73ef00);
1357 INSTANCE_WR(ctx, 0x00128/4, 0x02008821);
1358 INSTANCE_WR(ctx, 0x00158/4, 0x00000001);
1359 INSTANCE_WR(ctx, 0x0015c/4, 0x00000001);
1360 INSTANCE_WR(ctx, 0x00160/4, 0x00000001);
1361 INSTANCE_WR(ctx, 0x00164/4, 0x00000001);
1362 INSTANCE_WR(ctx, 0x00168/4, 0x00000001);
1363 INSTANCE_WR(ctx, 0x0016c/4, 0x00000001);
1364 INSTANCE_WR(ctx, 0x00170/4, 0x00000001);
1365 INSTANCE_WR(ctx, 0x00174/4, 0x00000001);
1366 INSTANCE_WR(ctx, 0x00178/4, 0x00000040);
1367 INSTANCE_WR(ctx, 0x0017c/4, 0x00000040);
1368 INSTANCE_WR(ctx, 0x00180/4, 0x00000040);
1369 INSTANCE_WR(ctx, 0x00188/4, 0x00000040);
1370 INSTANCE_WR(ctx, 0x001d0/4, 0x0b0b0b0c);
1371 INSTANCE_WR(ctx, 0x00340/4, 0x00040000);
1372 INSTANCE_WR(ctx, 0x00350/4, 0x55555555);
1373 INSTANCE_WR(ctx, 0x00354/4, 0x55555555);
1374 INSTANCE_WR(ctx, 0x00358/4, 0x55555555);
1375 INSTANCE_WR(ctx, 0x0035c/4, 0x55555555);
1376 INSTANCE_WR(ctx, 0x00388/4, 0x00000008);
1377 INSTANCE_WR(ctx, 0x0039c/4, 0x00001010);
1378 INSTANCE_WR(ctx, 0x003cc/4, 0x00000111);
1379 INSTANCE_WR(ctx, 0x003d0/4, 0x00080060);
1380 INSTANCE_WR(ctx, 0x003ec/4, 0x00000080);
1381 INSTANCE_WR(ctx, 0x003f0/4, 0xffff0000);
1382 INSTANCE_WR(ctx, 0x003f4/4, 0x00000001);
1383 INSTANCE_WR(ctx, 0x00408/4, 0x46400000);
1384 INSTANCE_WR(ctx, 0x00418/4, 0xffff0000);
1385 INSTANCE_WR(ctx, 0x00424/4, 0x0fff0000);
1386 INSTANCE_WR(ctx, 0x00428/4, 0x0fff0000);
1387 INSTANCE_WR(ctx, 0x00430/4, 0x00011100);
1388 for (i=0x0044c; i<=0x00488; i+=4)
1389 INSTANCE_WR(ctx, i/4, 0x07ff0000);
1390 INSTANCE_WR(ctx, 0x00494/4, 0x4b7fffff);
1391 INSTANCE_WR(ctx, 0x004bc/4, 0x30201000);
1392 INSTANCE_WR(ctx, 0x004c0/4, 0x70605040);
1393 INSTANCE_WR(ctx, 0x004c4/4, 0xb8a89888);
1394 INSTANCE_WR(ctx, 0x004c8/4, 0xf8e8d8c8);
1395 INSTANCE_WR(ctx, 0x004dc/4, 0x40100000);
1396 INSTANCE_WR(ctx, 0x004f8/4, 0x0000ffff);
1397 INSTANCE_WR(ctx, 0x0052c/4, 0x435185d6);
1398 INSTANCE_WR(ctx, 0x00530/4, 0x2155b699);
1399 INSTANCE_WR(ctx, 0x00534/4, 0xfedcba98);
1400 INSTANCE_WR(ctx, 0x00538/4, 0x00000098);
1401 INSTANCE_WR(ctx, 0x00548/4, 0xffffffff);
1402 INSTANCE_WR(ctx, 0x0054c/4, 0x00ff7000);
1403 INSTANCE_WR(ctx, 0x00550/4, 0x0000ffff);
1404 INSTANCE_WR(ctx, 0x0055c/4, 0x00ff0000);
1405 INSTANCE_WR(ctx, 0x00594/4, 0x00ffff00);
1406 for (i=0x005d8; i<=0x00614; i+=4)
1407 INSTANCE_WR(ctx, i/4, 0x00018488);
1408 for (i=0x00618; i<=0x00654; i+=4)
1409 INSTANCE_WR(ctx, i/4, 0x00028202);
1410 for (i=0x00698; i<=0x006d4; i+=4)
1411 INSTANCE_WR(ctx, i/4, 0x0000aae4);
1412 for (i=0x006d8; i<=0x00714; i+=4)
1413 INSTANCE_WR(ctx, i/4, 0x01012000);
1414 for (i=0x00718; i<=0x00754; i+=4)
1415 INSTANCE_WR(ctx, i/4, 0x00080008);
1416 for (i=0x00798; i<=0x007d4; i+=4)
1417 INSTANCE_WR(ctx, i/4, 0x00100008);
1418 for (i=0x00828; i<=0x00834; i+=4)
1419 INSTANCE_WR(ctx, i/4, 0x0001bc80);
1420 for (i=0x00838; i<=0x00844; i+=4)
1421 INSTANCE_WR(ctx, i/4, 0x00000202);
1422 for (i=0x00858; i<=0x00864; i+=4)
1423 INSTANCE_WR(ctx, i/4, 0x00000008);
1424 for (i=0x00878; i<=0x00884; i+=4)
1425 INSTANCE_WR(ctx, i/4, 0x00080008);
1426 INSTANCE_WR(ctx, 0x00898/4, 0x00000002);
1427 INSTANCE_WR(ctx, 0x008cc/4, 0x00000020);
1428 INSTANCE_WR(ctx, 0x008d0/4, 0x030c30c3);
1429 INSTANCE_WR(ctx, 0x008d4/4, 0x00011001);
1430 INSTANCE_WR(ctx, 0x008e0/4, 0x3e020200);
1431 INSTANCE_WR(ctx, 0x008e4/4, 0x00ffffff);
1432 INSTANCE_WR(ctx, 0x008e8/4, 0x0c103f00);
1433 INSTANCE_WR(ctx, 0x008f4/4, 0x00040000);
1434 INSTANCE_WR(ctx, 0x0092c/4, 0x00008100);
1435 INSTANCE_WR(ctx, 0x009b8/4, 0x00000001);
1436 INSTANCE_WR(ctx, 0x009fc/4, 0x00001001);
1437 INSTANCE_WR(ctx, 0x00a04/4, 0x00000003);
1438 INSTANCE_WR(ctx, 0x00a08/4, 0x00888001);
1439 INSTANCE_WR(ctx, 0x00a6c/4, 0x00000005);
1440 INSTANCE_WR(ctx, 0x00a78/4, 0x0000ffff);
1441 INSTANCE_WR(ctx, 0x00a94/4, 0x00005555);
1442 INSTANCE_WR(ctx, 0x00a98/4, 0x00000001);
1443 INSTANCE_WR(ctx, 0x00aa4/4, 0x00000001);
1444 for (i=0x01668; i<=0x016e0; i+=8)
1445 INSTANCE_WR(ctx, i/4, 0x3f800000);
1446 for (i=0x03428; i<=0x05618; i+=24)
1447 INSTANCE_WR(ctx, i/4, 0x00000001);
1448 for (i=0x05628; i<=0x05a18; i+=16)
1449 INSTANCE_WR(ctx, i/4, 0x3f800000);
1453 nv40_graph_create_context(struct nouveau_channel *chan)
1455 struct drm_device *dev = chan->dev;
1456 struct drm_nouveau_private *dev_priv = dev->dev_private;
1457 void (*ctx_init)(struct drm_device *, struct nouveau_gpuobj *);
1458 int ret;
1460 /* These functions populate the graphics context with a whole heap
1461 * of default state. All these functions are very similar, with
1462 * a minimal amount of chipset-specific changes. However, as we're
1463 * currently dependant on the context programs used by the NVIDIA
1464 * binary driver these functions must match the layout expected by
1465 * them. Hopefully at some point this will all change.
1467 switch (dev_priv->chipset) {
1468 case 0x40:
1469 ctx_init = nv40_graph_context_init;
1470 break;
1471 case 0x41:
1472 case 0x42:
1473 ctx_init = nv41_graph_context_init;
1474 break;
1475 case 0x43:
1476 ctx_init = nv43_graph_context_init;
1477 break;
1478 case 0x46:
1479 ctx_init = nv46_graph_context_init;
1480 break;
1481 case 0x47:
1482 ctx_init = nv47_graph_context_init;
1483 break;
1484 case 0x49:
1485 ctx_init = nv49_graph_context_init;
1486 break;
1487 case 0x44:
1488 case 0x4a:
1489 ctx_init = nv4a_graph_context_init;
1490 break;
1491 case 0x4b:
1492 ctx_init = nv4b_graph_context_init;
1493 break;
1494 case 0x4c:
1495 case 0x67:
1496 ctx_init = nv4c_graph_context_init;
1497 break;
1498 case 0x4e:
1499 ctx_init = nv4e_graph_context_init;
1500 break;
1501 default:
1502 ctx_init = nv40_graph_context_init;
1503 break;
1506 /* Allocate a 175KiB block of PRAMIN to store the context. This
1507 * is massive overkill for a lot of chipsets, but it should be safe
1508 * until we're able to implement this properly (will happen at more
1509 * or less the same time we're able to write our own context programs.
1511 if ((ret = nouveau_gpuobj_new_ref(dev, chan, NULL, 0, 175*1024, 16,
1512 NVOBJ_FLAG_ZERO_ALLOC,
1513 &chan->ramin_grctx)))
1514 return ret;
1516 /* Initialise default context values */
1517 ctx_init(dev, chan->ramin_grctx->gpuobj);
1519 return 0;
1522 void
1523 nv40_graph_destroy_context(struct nouveau_channel *chan)
1525 nouveau_gpuobj_ref_del(chan->dev, &chan->ramin_grctx);
1528 static int
1529 nv40_graph_transfer_context(struct drm_device *dev, uint32_t inst, int save)
1531 struct drm_nouveau_private *dev_priv = dev->dev_private;
1532 uint32_t old_cp, tv = 1000, tmp;
1533 int i;
1535 old_cp = NV_READ(NV20_PGRAPH_CHANNEL_CTX_POINTER);
1536 NV_WRITE(NV20_PGRAPH_CHANNEL_CTX_POINTER, inst);
1538 tmp = NV_READ(NV40_PGRAPH_CTXCTL_0310);
1539 tmp |= save ? NV40_PGRAPH_CTXCTL_0310_XFER_SAVE :
1540 NV40_PGRAPH_CTXCTL_0310_XFER_LOAD;
1541 NV_WRITE(NV40_PGRAPH_CTXCTL_0310, tmp);
1543 tmp = NV_READ(NV40_PGRAPH_CTXCTL_0304);
1544 tmp |= NV40_PGRAPH_CTXCTL_0304_XFER_CTX;
1545 NV_WRITE(NV40_PGRAPH_CTXCTL_0304, tmp);
1547 nouveau_wait_for_idle(dev);
1549 for (i = 0; i < tv; i++) {
1550 if (NV_READ(NV40_PGRAPH_CTXCTL_030C) == 0)
1551 break;
1554 NV_WRITE(NV20_PGRAPH_CHANNEL_CTX_POINTER, old_cp);
1556 if (i == tv) {
1557 uint32_t ucstat = NV_READ(NV40_PGRAPH_CTXCTL_UCODE_STAT);
1558 DRM_ERROR("Failed: Instance=0x%08x Save=%d\n", inst, save);
1559 DRM_ERROR("IP: 0x%02x, Opcode: 0x%08x\n",
1560 ucstat >> NV40_PGRAPH_CTXCTL_UCODE_STAT_IP_SHIFT,
1561 ucstat & NV40_PGRAPH_CTXCTL_UCODE_STAT_OP_MASK);
1562 DRM_ERROR("0x40030C = 0x%08x\n",
1563 NV_READ(NV40_PGRAPH_CTXCTL_030C));
1564 return -EBUSY;
1567 return 0;
1570 /* Save current context (from PGRAPH) into the channel's context */
1572 nv40_graph_save_context(struct nouveau_channel *chan)
1574 struct drm_device *dev = chan->dev;
1575 uint32_t inst;
1577 if (!chan->ramin_grctx)
1578 return -EINVAL;
1579 inst = chan->ramin_grctx->instance >> 4;
1581 return nv40_graph_transfer_context(dev, inst, 1);
1584 /* Restore the context for a specific channel into PGRAPH */
1586 nv40_graph_load_context(struct nouveau_channel *chan)
1588 struct drm_device *dev = chan->dev;
1589 struct drm_nouveau_private *dev_priv = dev->dev_private;
1590 uint32_t inst;
1591 int ret;
1593 if (!chan->ramin_grctx)
1594 return -EINVAL;
1595 inst = chan->ramin_grctx->instance >> 4;
1597 ret = nv40_graph_transfer_context(dev, inst, 0);
1598 if (ret)
1599 return ret;
1601 /* 0x40032C, no idea of it's exact function. Could simply be a
1602 * record of the currently active PGRAPH context. It's currently
1603 * unknown as to what bit 24 does. The nv ddx has it set, so we will
1604 * set it here too.
1606 NV_WRITE(NV20_PGRAPH_CHANNEL_CTX_POINTER, inst);
1607 NV_WRITE(NV40_PGRAPH_CTXCTL_CUR,
1608 (inst & NV40_PGRAPH_CTXCTL_CUR_INST_MASK) |
1609 NV40_PGRAPH_CTXCTL_CUR_LOADED);
1610 /* 0x32E0 records the instance address of the active FIFO's PGRAPH
1611 * context. If at any time this doesn't match 0x40032C, you will
1612 * recieve PGRAPH_INTR_CONTEXT_SWITCH
1614 NV_WRITE(NV40_PFIFO_GRCTX_INSTANCE, inst);
1615 return 0;
1618 /* These blocks of "magic numbers" are actually a microcode that the GPU uses
1619 * to control how graphics contexts get saved and restored between PRAMIN
1620 * and PGRAPH during a context switch. We're currently using values seen
1621 * in mmio-traces of the binary driver.
1623 static uint32_t nv40_ctx_prog[] = {
1624 0x00400889, 0x00200000, 0x0060000a, 0x00200000, 0x00300000, 0x00800001,
1625 0x00700009, 0x0060000e, 0x00400d64, 0x00400d05, 0x00408f65, 0x00409406,
1626 0x0040a268, 0x00200000, 0x0060000a, 0x00700000, 0x00106000, 0x00700080,
1627 0x004014e6, 0x007000a0, 0x00401a84, 0x00700082, 0x00600001, 0x00500061,
1628 0x00600002, 0x00401b68, 0x00500060, 0x00200001, 0x0060000a, 0x0011814d,
1629 0x00110158, 0x00105401, 0x0020003a, 0x00100051, 0x001040c5, 0x0010c1c4,
1630 0x001041c9, 0x0010c1dc, 0x00110205, 0x0011420a, 0x00114210, 0x00110216,
1631 0x0012421b, 0x00120270, 0x001242c0, 0x00200040, 0x00100280, 0x00128100,
1632 0x00128120, 0x00128143, 0x0011415f, 0x0010815c, 0x0010c140, 0x00104029,
1633 0x00110400, 0x00104d10, 0x00500060, 0x00403b87, 0x0060000d, 0x004076e6,
1634 0x002000f0, 0x0060000a, 0x00200045, 0x00100620, 0x00108668, 0x0011466b,
1635 0x00120682, 0x0011068b, 0x00168691, 0x0010c6ae, 0x001206b4, 0x0020002a,
1636 0x001006c4, 0x001246f0, 0x002000c0, 0x00100700, 0x0010c3d7, 0x001043e1,
1637 0x00500060, 0x00405600, 0x00405684, 0x00600003, 0x00500067, 0x00600008,
1638 0x00500060, 0x00700082, 0x0020026c, 0x0060000a, 0x00104800, 0x00104901,
1639 0x00120920, 0x00200035, 0x00100940, 0x00148a00, 0x00104a14, 0x00200038,
1640 0x00100b00, 0x00138d00, 0x00104e00, 0x0012d600, 0x00105c00, 0x00104f06,
1641 0x0020031a, 0x0060000a, 0x00300000, 0x00200680, 0x00406c00, 0x00200684,
1642 0x00800001, 0x00200b62, 0x0060000a, 0x0020a0b0, 0x0040728a, 0x00201b68,
1643 0x00800041, 0x00407684, 0x00203e60, 0x00800002, 0x00408700, 0x00600006,
1644 0x00700003, 0x004080e6, 0x00700080, 0x0020031a, 0x0060000a, 0x00200004,
1645 0x00800001, 0x00700000, 0x00200000, 0x0060000a, 0x00106002, 0x0040a284,
1646 0x00700002, 0x00600004, 0x0040a268, 0x00700000, 0x00200000, 0x0060000a,
1647 0x00106002, 0x00700080, 0x00400a84, 0x00700002, 0x00400a68, 0x00500060,
1648 0x00600007, 0x00409388, 0x0060000f, 0x00000000, 0x00500060, 0x00200000,
1649 0x0060000a, 0x00700000, 0x00106001, 0x00700083, 0x00910880, 0x00901ffe,
1650 0x00940400, 0x00200020, 0x0060000b, 0x00500069, 0x0060000c, 0x00401b68,
1651 0x0040a406, 0x0040a505, 0x00600009, 0x00700005, 0x00700006, 0x0060000e,
1655 static uint32_t nv41_ctx_prog[] = {
1656 0x00400889, 0x00200000, 0x0060000a, 0x00200000, 0x00300000, 0x00800001,
1657 0x00700009, 0x0060000e, 0x00400d64, 0x00400d05, 0x00408f65, 0x00409306,
1658 0x0040a068, 0x0040198f, 0x00200001, 0x0060000a, 0x00700080, 0x00104042,
1659 0x00200001, 0x0060000a, 0x00700000, 0x001040c5, 0x00401826, 0x00401968,
1660 0x0060000d, 0x00200000, 0x0060000a, 0x00700000, 0x00106000, 0x00700080,
1661 0x004020e6, 0x007000a0, 0x00500060, 0x00200001, 0x0060000a, 0x0011814d,
1662 0x00110158, 0x00105401, 0x0020003a, 0x00100051, 0x001040c5, 0x0010c1c4,
1663 0x001041c9, 0x0010c1dc, 0x00150210, 0x0012c225, 0x00108238, 0x0010823e,
1664 0x001242c0, 0x00200040, 0x00100280, 0x00128100, 0x00128120, 0x00128143,
1665 0x0011415f, 0x0010815c, 0x0010c140, 0x00104029, 0x00110400, 0x00104d10,
1666 0x001046ec, 0x00500060, 0x00404087, 0x0060000d, 0x004079e6, 0x002000f1,
1667 0x0060000a, 0x00148653, 0x00104668, 0x0010c66d, 0x00120682, 0x0011068b,
1668 0x00168691, 0x001046ae, 0x001046b0, 0x001206b4, 0x001046c4, 0x001146c6,
1669 0x00200020, 0x001006cc, 0x001046ed, 0x001246f0, 0x002000c0, 0x00100700,
1670 0x0010c3d7, 0x001043e1, 0x00500060, 0x00200233, 0x0060000a, 0x00104800,
1671 0x00108901, 0x00124920, 0x0020001f, 0x00100940, 0x00140965, 0x00148a00,
1672 0x00108a14, 0x00200020, 0x00100b00, 0x00134b2c, 0x0010cd00, 0x0010cd04,
1673 0x00114d08, 0x00104d80, 0x00104e00, 0x0012d600, 0x00105c00, 0x00104f06,
1674 0x002002d2, 0x0060000a, 0x00300000, 0x00200680, 0x00407200, 0x00200684,
1675 0x00800001, 0x00200b1a, 0x0060000a, 0x00206380, 0x0040788a, 0x00201480,
1676 0x00800041, 0x00408900, 0x00600006, 0x004085e6, 0x00700080, 0x0020007a,
1677 0x0060000a, 0x00104280, 0x002002d2, 0x0060000a, 0x00200004, 0x00800001,
1678 0x00700000, 0x00200000, 0x0060000a, 0x00106002, 0x0040a068, 0x00700000,
1679 0x00200000, 0x0060000a, 0x00106002, 0x00700080, 0x00400a68, 0x00500060,
1680 0x00600007, 0x00409388, 0x0060000f, 0x00500060, 0x00200000, 0x0060000a,
1681 0x00700000, 0x00106001, 0x00910880, 0x00901ffe, 0x00940400, 0x00200020,
1682 0x0060000b, 0x00500069, 0x0060000c, 0x00402168, 0x0040a206, 0x0040a305,
1683 0x00600009, 0x00700005, 0x00700006, 0x0060000e, ~0
1686 static uint32_t nv43_ctx_prog[] = {
1687 0x00400889, 0x00200000, 0x0060000a, 0x00200000, 0x00300000, 0x00800001,
1688 0x00700009, 0x0060000e, 0x00400d64, 0x00400d05, 0x00409565, 0x00409a06,
1689 0x0040a868, 0x00200000, 0x0060000a, 0x00700000, 0x00106000, 0x00700080,
1690 0x004014e6, 0x007000a0, 0x00401a84, 0x00700082, 0x00600001, 0x00500061,
1691 0x00600002, 0x00401b68, 0x00500060, 0x00200001, 0x0060000a, 0x0011814d,
1692 0x00110158, 0x00105401, 0x0020003a, 0x00100051, 0x001040c5, 0x0010c1c4,
1693 0x001041c9, 0x0010c1dc, 0x00150210, 0x0012c225, 0x00108238, 0x0010823e,
1694 0x001242c0, 0x00200040, 0x00100280, 0x00128100, 0x00128120, 0x00128143,
1695 0x0011415f, 0x0010815c, 0x0010c140, 0x00104029, 0x00110400, 0x00104d10,
1696 0x001046ec, 0x00500060, 0x00403a87, 0x0060000d, 0x00407ce6, 0x002000f1,
1697 0x0060000a, 0x00148653, 0x00104668, 0x0010c66d, 0x00120682, 0x0011068b,
1698 0x00168691, 0x001046ae, 0x001046b0, 0x001206b4, 0x001046c4, 0x001146c6,
1699 0x00200020, 0x001006cc, 0x001046ed, 0x001246f0, 0x002000c0, 0x00100700,
1700 0x0010c3d7, 0x001043e1, 0x00500060, 0x00405800, 0x00405884, 0x00600003,
1701 0x00500067, 0x00600008, 0x00500060, 0x00700082, 0x00200233, 0x0060000a,
1702 0x00104800, 0x00108901, 0x00124920, 0x0020001f, 0x00100940, 0x00140965,
1703 0x00148a00, 0x00108a14, 0x00160b00, 0x00134b2c, 0x0010cd00, 0x0010cd04,
1704 0x0010cd08, 0x00104d80, 0x00104e00, 0x0012d600, 0x00105c00, 0x00104f06,
1705 0x002002c8, 0x0060000a, 0x00300000, 0x00200680, 0x00407200, 0x00200684,
1706 0x00800001, 0x00200b10, 0x0060000a, 0x00203870, 0x0040788a, 0x00201350,
1707 0x00800041, 0x00407c84, 0x00201560, 0x00800002, 0x00408d00, 0x00600006,
1708 0x00700003, 0x004086e6, 0x00700080, 0x002002c8, 0x0060000a, 0x00200004,
1709 0x00800001, 0x00700000, 0x00200000, 0x0060000a, 0x00106002, 0x0040a884,
1710 0x00700002, 0x00600004, 0x0040a868, 0x00700000, 0x00200000, 0x0060000a,
1711 0x00106002, 0x00700080, 0x00400a84, 0x00700002, 0x00400a68, 0x00500060,
1712 0x00600007, 0x00409988, 0x0060000f, 0x00000000, 0x00500060, 0x00200000,
1713 0x0060000a, 0x00700000, 0x00106001, 0x00700083, 0x00910880, 0x00901ffe,
1714 0x00940400, 0x00200020, 0x0060000b, 0x00500069, 0x0060000c, 0x00401b68,
1715 0x0040aa06, 0x0040ab05, 0x00600009, 0x00700005, 0x00700006, 0x0060000e,
1719 static uint32_t nv44_ctx_prog[] = {
1720 0x00400889, 0x00200000, 0x0060000a, 0x00200000, 0x00300000, 0x00800001,
1721 0x00700009, 0x0060000e, 0x00400d64, 0x00400d05, 0x00409a65, 0x00409f06,
1722 0x0040ac68, 0x0040248f, 0x00200001, 0x0060000a, 0x00700080, 0x00104042,
1723 0x001041c6, 0x00104040, 0x00200001, 0x0060000a, 0x00700000, 0x001040c5,
1724 0x00402320, 0x00402321, 0x00402322, 0x00402324, 0x00402326, 0x0040232b,
1725 0x001040c5, 0x00402328, 0x001040c5, 0x00402320, 0x00402468, 0x0060000d,
1726 0x00200000, 0x0060000a, 0x00700000, 0x00106000, 0x00700080, 0x00402be6,
1727 0x007000a0, 0x00500060, 0x00200001, 0x0060000a, 0x0011814d, 0x00110158,
1728 0x00105401, 0x0020003a, 0x00100051, 0x001040c5, 0x0010c1c4, 0x001041c9,
1729 0x0010c1dc, 0x00150210, 0x0012c225, 0x00108238, 0x0010823e, 0x001242c0,
1730 0x00200040, 0x00100280, 0x00128100, 0x00128120, 0x00128143, 0x0011415f,
1731 0x0010815c, 0x0010c140, 0x00104029, 0x00110400, 0x00104d10, 0x001046ec,
1732 0x00500060, 0x00404b87, 0x0060000d, 0x004084e6, 0x002000f1, 0x0060000a,
1733 0x00148653, 0x00104668, 0x0010c66d, 0x00120682, 0x0011068b, 0x00168691,
1734 0x001046ae, 0x001046b0, 0x001206b4, 0x001046c4, 0x001146c6, 0x001646cc,
1735 0x001186e6, 0x001046ed, 0x001246f0, 0x002000c0, 0x00100700, 0x0010c3d7,
1736 0x001043e1, 0x00500060, 0x00200232, 0x0060000a, 0x00104800, 0x00108901,
1737 0x00104910, 0x00124920, 0x0020001f, 0x00100940, 0x00140965, 0x00148a00,
1738 0x00108a14, 0x00160b00, 0x00134b2c, 0x0010cd00, 0x0010cd04, 0x0010cd08,
1739 0x00104d80, 0x00104e00, 0x0012d600, 0x00105c00, 0x00104f06, 0x002002c8,
1740 0x0060000a, 0x00300000, 0x00200080, 0x00407d00, 0x00200084, 0x00800001,
1741 0x00200510, 0x0060000a, 0x002037e0, 0x0040838a, 0x00201320, 0x00800029,
1742 0x00409400, 0x00600006, 0x004090e6, 0x00700080, 0x0020007a, 0x0060000a,
1743 0x00104280, 0x002002c8, 0x0060000a, 0x00200004, 0x00800001, 0x00700000,
1744 0x00200000, 0x0060000a, 0x00106002, 0x0040ac68, 0x00700000, 0x00200000,
1745 0x0060000a, 0x00106002, 0x00700080, 0x00400a68, 0x00500060, 0x00600007,
1746 0x00409e88, 0x0060000f, 0x00000000, 0x00500060, 0x00200000, 0x0060000a,
1747 0x00700000, 0x00106001, 0x00910880, 0x00901ffe, 0x01940000, 0x00200020,
1748 0x0060000b, 0x00500069, 0x0060000c, 0x00402c68, 0x0040ae06, 0x0040af05,
1749 0x00600009, 0x00700005, 0x00700006, 0x0060000e, ~0
1752 static uint32_t nv46_ctx_prog[] = {
1753 0x00400889, 0x00200000, 0x0060000a, 0x00200000, 0x00300000, 0x00800001,
1754 0x00700009, 0x0060000e, 0x00400d64, 0x00400d05, 0x00408f65, 0x00409306,
1755 0x0040a068, 0x0040198f, 0x00200001, 0x0060000a, 0x00700080, 0x00104042,
1756 0x00200001, 0x0060000a, 0x00700000, 0x001040c5, 0x00401826, 0x00401968,
1757 0x0060000d, 0x00200000, 0x0060000a, 0x00700000, 0x00106000, 0x00700080,
1758 0x004020e6, 0x007000a0, 0x00500060, 0x00200008, 0x0060000a, 0x0011814d,
1759 0x00110158, 0x00105401, 0x0020003a, 0x00100051, 0x001040c5, 0x0010c1c4,
1760 0x001041c9, 0x0010c1dc, 0x00150210, 0x0012c225, 0x00108238, 0x0010823e,
1761 0x001242c0, 0x00200040, 0x00100280, 0x00128100, 0x00128120, 0x00128143,
1762 0x0011415f, 0x0010815c, 0x0010c140, 0x00104029, 0x00110400, 0x00104d10,
1763 0x00500060, 0x00403f87, 0x0060000d, 0x004079e6, 0x002000f7, 0x0060000a,
1764 0x00200045, 0x00100620, 0x00104668, 0x0017466d, 0x0011068b, 0x00168691,
1765 0x001046ae, 0x001046b0, 0x001206b4, 0x001046c4, 0x001146c6, 0x00200022,
1766 0x001006cc, 0x001246f0, 0x002000c0, 0x00100700, 0x0010c3d7, 0x001043e1,
1767 0x00500060, 0x0020027f, 0x0060000a, 0x00104800, 0x00108901, 0x00104910,
1768 0x00124920, 0x0020001f, 0x00100940, 0x00140965, 0x00148a00, 0x00108a14,
1769 0x00160b00, 0x00134b2c, 0x0010cd00, 0x0010cd04, 0x0010cd08, 0x00104d80,
1770 0x00104e00, 0x0012d600, 0x00105c00, 0x00104f06, 0x00105406, 0x00105709,
1771 0x00200316, 0x0060000a, 0x00300000, 0x00200080, 0x00407200, 0x00200084,
1772 0x00800001, 0x0020055e, 0x0060000a, 0x002037e0, 0x0040788a, 0x00201320,
1773 0x00800029, 0x00408900, 0x00600006, 0x004085e6, 0x00700080, 0x00200081,
1774 0x0060000a, 0x00104280, 0x00200316, 0x0060000a, 0x00200004, 0x00800001,
1775 0x00700000, 0x00200000, 0x0060000a, 0x00106002, 0x0040a068, 0x00700000,
1776 0x00200000, 0x0060000a, 0x00106002, 0x00700080, 0x00400a68, 0x00500060,
1777 0x00600007, 0x00409388, 0x0060000f, 0x00500060, 0x00200000, 0x0060000a,
1778 0x00700000, 0x00106001, 0x00910880, 0x00901ffe, 0x01940000, 0x00200020,
1779 0x0060000b, 0x00500069, 0x0060000c, 0x00402168, 0x0040a206, 0x0040a305,
1780 0x00600009, 0x00700005, 0x00700006, 0x0060000e, ~0
1783 static uint32_t nv47_ctx_prog[] = {
1784 0x00400889, 0x00200000, 0x0060000a, 0x00200000, 0x00300000, 0x00800001,
1785 0x00700009, 0x0060000e, 0x00400d64, 0x00400d05, 0x00409265, 0x00409606,
1786 0x0040a368, 0x0040198f, 0x00200001, 0x0060000a, 0x00700080, 0x00104042,
1787 0x00200001, 0x0060000a, 0x00700000, 0x001040c5, 0x00401826, 0x00401968,
1788 0x0060000d, 0x00200000, 0x0060000a, 0x00700000, 0x00106000, 0x00700080,
1789 0x004020e6, 0x007000a0, 0x00500060, 0x00200001, 0x0060000a, 0x0011814d,
1790 0x00110158, 0x00105401, 0x0020003a, 0x00100051, 0x001040c5, 0x0010c1c4,
1791 0x001041c9, 0x0010c1dc, 0x00150210, 0x0012c225, 0x00108238, 0x0010823e,
1792 0x001242c0, 0x00200040, 0x00100280, 0x00128100, 0x00128120, 0x00128143,
1793 0x0011415f, 0x0010815c, 0x0010c140, 0x00104029, 0x00110400, 0x00104d12,
1794 0x00500060, 0x00403f87, 0x0060000d, 0x00407ce6, 0x002000f0, 0x0060000a,
1795 0x00200020, 0x00100620, 0x00154650, 0x00104668, 0x0017466d, 0x0011068b,
1796 0x00168691, 0x001046ae, 0x001046b0, 0x001206b4, 0x001046c4, 0x001146c6,
1797 0x00200022, 0x001006cc, 0x001246f0, 0x002000c0, 0x00100700, 0x0010c3d7,
1798 0x001043e1, 0x00500060, 0x00200268, 0x0060000a, 0x00104800, 0x00108901,
1799 0x00124920, 0x0020001f, 0x00100940, 0x00140965, 0x00144a00, 0x00104a19,
1800 0x0010ca1c, 0x00110b00, 0x00200028, 0x00100b08, 0x00134c2e, 0x0010cd00,
1801 0x0010cd04, 0x00120d08, 0x00104d80, 0x00104e00, 0x0012d600, 0x00105c00,
1802 0x00104f06, 0x00105406, 0x00105709, 0x00200318, 0x0060000a, 0x00300000,
1803 0x00200680, 0x00407500, 0x00200684, 0x00800001, 0x00200b60, 0x0060000a,
1804 0x00209540, 0x00407b8a, 0x00201350, 0x00800041, 0x00408c00, 0x00600006,
1805 0x004088e6, 0x00700080, 0x0020007a, 0x0060000a, 0x00104280, 0x00200318,
1806 0x0060000a, 0x00200004, 0x00800001, 0x00700000, 0x00200000, 0x0060000a,
1807 0x00106002, 0x0040a368, 0x00700000, 0x00200000, 0x0060000a, 0x00106002,
1808 0x00700080, 0x00400a68, 0x00500060, 0x00600007, 0x00409688, 0x0060000f,
1809 0x00500060, 0x00200000, 0x0060000a, 0x00700000, 0x00106001, 0x0091a880,
1810 0x00901ffe, 0x10940000, 0x00200020, 0x0060000b, 0x00500069, 0x0060000c,
1811 0x00402168, 0x0040a506, 0x0040a605, 0x00600009, 0x00700005, 0x00700006,
1812 0x0060000e, ~0
1815 //this is used for nv49 and nv4b
1816 static uint32_t nv49_4b_ctx_prog[] ={
1817 0x00400564, 0x00400505, 0x00408165, 0x00408206, 0x00409e68, 0x00200020,
1818 0x0060000a, 0x00700080, 0x00104042, 0x00200020, 0x0060000a, 0x00700000,
1819 0x001040c5, 0x00400f26, 0x00401068, 0x0060000d, 0x0070008f, 0x0070000e,
1820 0x00408d68, 0x004015e6, 0x007000a0, 0x00700080, 0x0040180f, 0x00700000,
1821 0x00200029, 0x0060000a, 0x0011814d, 0x00110158, 0x00105401, 0x0020003a,
1822 0x00100051, 0x001040c5, 0x0010c1c4, 0x001041c9, 0x0010c1dc, 0x00150210,
1823 0x0012c225, 0x00108238, 0x0010823e, 0x001242c0, 0x00200040, 0x00100280,
1824 0x00128100, 0x00128120, 0x00128143, 0x0011415f, 0x0010815c, 0x0010c140,
1825 0x00104029, 0x00110400, 0x00104d12, 0x00500060, 0x004071e6, 0x00200118,
1826 0x0060000a, 0x00200020, 0x00100620, 0x00154650, 0x00104668, 0x0017466d,
1827 0x0011068b, 0x00168691, 0x001046ae, 0x001046b0, 0x001206b4, 0x001046c4,
1828 0x001146c6, 0x00200022, 0x001006cc, 0x001246f0, 0x002000c0, 0x00100700,
1829 0x0010c3d7, 0x001043e1, 0x00500060, 0x00200290, 0x0060000a, 0x00104800,
1830 0x00108901, 0x00124920, 0x0020001f, 0x00100940, 0x00140965, 0x00144a00,
1831 0x00104a19, 0x0010ca1c, 0x00110b00, 0x00200028, 0x00100b08, 0x00134c2e,
1832 0x0010cd00, 0x0010cd04, 0x00120d08, 0x00104d80, 0x00104e00, 0x0012d600,
1833 0x00105c00, 0x00104f06, 0x00105406, 0x00105709, 0x00200340, 0x0060000a,
1834 0x00300000, 0x00200680, 0x00406a0f, 0x00200684, 0x00800001, 0x00200b88,
1835 0x0060000a, 0x00209540, 0x0040708a, 0x00201350, 0x00800041, 0x00407c0f,
1836 0x00600006, 0x00407ce6, 0x00700080, 0x002000a2, 0x0060000a, 0x00104280,
1837 0x00200340, 0x0060000a, 0x00200004, 0x00800001, 0x0070008e, 0x00408d68,
1838 0x0040020f, 0x00600006, 0x00409e68, 0x00600007, 0x0070000f, 0x0070000e,
1839 0x00408d68, 0x0091a880, 0x00901ffe, 0x10940000, 0x00200020, 0x0060000b,
1840 0x00500069, 0x0060000c, 0x00401568, 0x00700000, 0x00200001, 0x0040910e,
1841 0x00200021, 0x0060000a, 0x00409b0d, 0x00104a40, 0x00104a50, 0x00104a60,
1842 0x00104a70, 0x00104a80, 0x00104a90, 0x00104aa0, 0x00104ab0, 0x00407e0e,
1843 0x0040130f, 0x00408568, 0x0040a006, 0x0040a105, 0x00600009, 0x00700005,
1844 0x00700006, 0x0060000e, ~0
1848 static uint32_t nv4a_ctx_prog[] = {
1849 0x00400889, 0x00200000, 0x0060000a, 0x00200000, 0x00300000, 0x00800001,
1850 0x00700009, 0x0060000e, 0x00400d64, 0x00400d05, 0x00409965, 0x00409e06,
1851 0x0040ac68, 0x00200000, 0x0060000a, 0x00700000, 0x00106000, 0x00700080,
1852 0x004014e6, 0x007000a0, 0x00401a84, 0x00700082, 0x00600001, 0x00500061,
1853 0x00600002, 0x00401b68, 0x00500060, 0x00200001, 0x0060000a, 0x0011814d,
1854 0x00110158, 0x00105401, 0x0020003a, 0x00100051, 0x001040c5, 0x0010c1c4,
1855 0x001041c9, 0x0010c1dc, 0x00150210, 0x0012c225, 0x00108238, 0x0010823e,
1856 0x001242c0, 0x00200040, 0x00100280, 0x00128100, 0x00128120, 0x00128143,
1857 0x0011415f, 0x0010815c, 0x0010c140, 0x00104029, 0x00110400, 0x00104d10,
1858 0x001046ec, 0x00500060, 0x00403a87, 0x0060000d, 0x00407de6, 0x002000f1,
1859 0x0060000a, 0x00148653, 0x00104668, 0x0010c66d, 0x00120682, 0x0011068b,
1860 0x00168691, 0x001046ae, 0x001046b0, 0x001206b4, 0x001046c4, 0x001146c6,
1861 0x001646cc, 0x001186e6, 0x001046ed, 0x001246f0, 0x002000c0, 0x00100700,
1862 0x0010c3d7, 0x001043e1, 0x00500060, 0x00405800, 0x00405884, 0x00600003,
1863 0x00500067, 0x00600008, 0x00500060, 0x00700082, 0x00200232, 0x0060000a,
1864 0x00104800, 0x00108901, 0x00104910, 0x00124920, 0x0020001f, 0x00100940,
1865 0x00140965, 0x00148a00, 0x00108a14, 0x00160b00, 0x00134b2c, 0x0010cd00,
1866 0x0010cd04, 0x0010cd08, 0x00104d80, 0x00104e00, 0x0012d600, 0x00105c00,
1867 0x00104f06, 0x002002c8, 0x0060000a, 0x00300000, 0x00200080, 0x00407300,
1868 0x00200084, 0x00800001, 0x00200510, 0x0060000a, 0x002037e0, 0x0040798a,
1869 0x00201320, 0x00800029, 0x00407d84, 0x00201560, 0x00800002, 0x00409100,
1870 0x00600006, 0x00700003, 0x00408ae6, 0x00700080, 0x0020007a, 0x0060000a,
1871 0x00104280, 0x002002c8, 0x0060000a, 0x00200004, 0x00800001, 0x00700000,
1872 0x00200000, 0x0060000a, 0x00106002, 0x0040ac84, 0x00700002, 0x00600004,
1873 0x0040ac68, 0x00700000, 0x00200000, 0x0060000a, 0x00106002, 0x00700080,
1874 0x00400a84, 0x00700002, 0x00400a68, 0x00500060, 0x00600007, 0x00409d88,
1875 0x0060000f, 0x00000000, 0x00500060, 0x00200000, 0x0060000a, 0x00700000,
1876 0x00106001, 0x00700083, 0x00910880, 0x00901ffe, 0x01940000, 0x00200020,
1877 0x0060000b, 0x00500069, 0x0060000c, 0x00401b68, 0x0040ae06, 0x0040af05,
1878 0x00600009, 0x00700005, 0x00700006, 0x0060000e, ~0
1881 static uint32_t nv4c_ctx_prog[] = {
1882 0x00400889, 0x00200000, 0x0060000a, 0x00200000, 0x00300000, 0x00800001,
1883 0x00700009, 0x0060000e, 0x00400d64, 0x00400d05, 0x00409065, 0x00409406,
1884 0x0040a168, 0x0040198f, 0x00200001, 0x0060000a, 0x00700080, 0x00104042,
1885 0x00200001, 0x0060000a, 0x00700000, 0x001040c5, 0x00401826, 0x00401968,
1886 0x0060000d, 0x00200000, 0x0060000a, 0x00700000, 0x00106000, 0x00700080,
1887 0x004020e6, 0x007000a0, 0x00500060, 0x00200001, 0x0060000a, 0x0011814d,
1888 0x00110158, 0x00105401, 0x0020003a, 0x00100051, 0x001040c5, 0x0010c1c4,
1889 0x001041c9, 0x0010c1dc, 0x00150210, 0x0012c225, 0x00108238, 0x0010823e,
1890 0x001242c0, 0x00200040, 0x00100280, 0x00128100, 0x00128120, 0x00128143,
1891 0x0011415f, 0x0010815c, 0x0010c140, 0x00104029, 0x00110400, 0x00104d10,
1892 0x0010427e, 0x001046ec, 0x00500060, 0x00404187, 0x0060000d, 0x00407ae6,
1893 0x002000f2, 0x0060000a, 0x00148653, 0x00104668, 0x0010c66d, 0x00120682,
1894 0x0011068b, 0x00168691, 0x001046ae, 0x001046b0, 0x001206b4, 0x001046c4,
1895 0x001146c6, 0x00200020, 0x001006cc, 0x001046ed, 0x001246f0, 0x002000c0,
1896 0x00100700, 0x0010c3d7, 0x001043e1, 0x00500060, 0x00200234, 0x0060000a,
1897 0x00104800, 0x00108901, 0x00104910, 0x00124920, 0x0020001f, 0x00100940,
1898 0x00140965, 0x00148a00, 0x00108a14, 0x00140b00, 0x00134b2c, 0x0010cd00,
1899 0x0010cd04, 0x00104d08, 0x00104d80, 0x00104e00, 0x0012d600, 0x00105c00,
1900 0x00104f06, 0x002002c0, 0x0060000a, 0x00300000, 0x00200080, 0x00407300,
1901 0x00200084, 0x00800001, 0x00200508, 0x0060000a, 0x00201320, 0x0040798a,
1902 0xfffffaf8, 0x00800029, 0x00408a00, 0x00600006, 0x004086e6, 0x00700080,
1903 0x0020007a, 0x0060000a, 0x00104280, 0x002002c0, 0x0060000a, 0x00200004,
1904 0x00800001, 0x00700000, 0x00200000, 0x0060000a, 0x00106002, 0x0040a168,
1905 0x00700000, 0x00200000, 0x0060000a, 0x00106002, 0x00700080, 0x00400a68,
1906 0x00500060, 0x00600007, 0x00409488, 0x0060000f, 0x00500060, 0x00200000,
1907 0x0060000a, 0x00700000, 0x00106001, 0x00910880, 0x00901ffe, 0x01940000,
1908 0x00200020, 0x0060000b, 0x00500069, 0x0060000c, 0x00402168, 0x0040a306,
1909 0x0040a405, 0x00600009, 0x00700005, 0x00700006, 0x0060000e, ~0
1912 static uint32_t nv4e_ctx_prog[] = {
1913 0x00400889, 0x00200000, 0x0060000a, 0x00200000, 0x00300000, 0x00800001,
1914 0x00700009, 0x0060000e, 0x00400d64, 0x00400d05, 0x00409565, 0x00409a06,
1915 0x0040a868, 0x00200000, 0x0060000a, 0x00700000, 0x00106000, 0x00700080,
1916 0x004014e6, 0x007000a0, 0x00401a84, 0x00700082, 0x00600001, 0x00500061,
1917 0x00600002, 0x00401b68, 0x00500060, 0x00200001, 0x0060000a, 0x0011814d,
1918 0x00110158, 0x00105401, 0x0020003a, 0x00100051, 0x001040c5, 0x0010c1c4,
1919 0x001041c9, 0x0010c1dc, 0x00150210, 0x0012c225, 0x00108238, 0x0010823e,
1920 0x001242c0, 0x00200040, 0x00100280, 0x00128100, 0x00128120, 0x00128143,
1921 0x0011415f, 0x0010815c, 0x0010c140, 0x00104029, 0x00110400, 0x00104d10,
1922 0x001046ec, 0x00500060, 0x00403a87, 0x0060000d, 0x00407ce6, 0x002000f1,
1923 0x0060000a, 0x00148653, 0x00104668, 0x0010c66d, 0x00120682, 0x0011068b,
1924 0x00168691, 0x001046ae, 0x001046b0, 0x001206b4, 0x001046c4, 0x001146c6,
1925 0x001646cc, 0x001186e6, 0x001046ed, 0x001246f0, 0x002000c0, 0x00100700,
1926 0x0010c3d7, 0x001043e1, 0x00500060, 0x00405800, 0x00405884, 0x00600003,
1927 0x00500067, 0x00600008, 0x00500060, 0x00700082, 0x00200232, 0x0060000a,
1928 0x00104800, 0x00108901, 0x00104910, 0x00124920, 0x0020001f, 0x00100940,
1929 0x00140965, 0x00148a00, 0x00108a14, 0x00140b00, 0x00134b2c, 0x0010cd00,
1930 0x0010cd04, 0x00104d08, 0x00104d80, 0x00104e00, 0x00105c00, 0x00104f06,
1931 0x002002b2, 0x0060000a, 0x00300000, 0x00200080, 0x00407200, 0x00200084,
1932 0x00800001, 0x002004fa, 0x0060000a, 0x00201320, 0x0040788a, 0xfffffb06,
1933 0x00800029, 0x00407c84, 0x00200b20, 0x00800002, 0x00408d00, 0x00600006,
1934 0x00700003, 0x004086e6, 0x00700080, 0x002002b2, 0x0060000a, 0x00200004,
1935 0x00800001, 0x00700000, 0x00200000, 0x0060000a, 0x00106002, 0x0040a884,
1936 0x00700002, 0x00600004, 0x0040a868, 0x00700000, 0x00200000, 0x0060000a,
1937 0x00106002, 0x00700080, 0x00400a84, 0x00700002, 0x00400a68, 0x00500060,
1938 0x00600007, 0x00409988, 0x0060000f, 0x00000000, 0x00500060, 0x00200000,
1939 0x0060000a, 0x00700000, 0x00106001, 0x00700083, 0x00910880, 0x00901ffe,
1940 0x01940000, 0x00200020, 0x0060000b, 0x00500069, 0x0060000c, 0x00401b68,
1941 0x0040aa06, 0x0040ab05, 0x00600009, 0x00700005, 0x00700006, 0x0060000e,
1946 * G70 0x47
1947 * G71 0x49
1948 * NV45 0x48
1949 * G72[M] 0x46
1950 * G73 0x4b
1951 * C51_G7X 0x4c
1952 * C51 0x4e
1955 nv40_graph_init(struct drm_device *dev)
1957 struct drm_nouveau_private *dev_priv =
1958 (struct drm_nouveau_private *)dev->dev_private;
1959 uint32_t *ctx_prog;
1960 uint32_t vramsz, tmp;
1961 int i, j;
1963 NV_WRITE(NV03_PMC_ENABLE, NV_READ(NV03_PMC_ENABLE) &
1964 ~NV_PMC_ENABLE_PGRAPH);
1965 NV_WRITE(NV03_PMC_ENABLE, NV_READ(NV03_PMC_ENABLE) |
1966 NV_PMC_ENABLE_PGRAPH);
1968 switch (dev_priv->chipset) {
1969 case 0x40: ctx_prog = nv40_ctx_prog; break;
1970 case 0x41:
1971 case 0x42: ctx_prog = nv41_ctx_prog; break;
1972 case 0x43: ctx_prog = nv43_ctx_prog; break;
1973 case 0x44: ctx_prog = nv44_ctx_prog; break;
1974 case 0x46: ctx_prog = nv46_ctx_prog; break;
1975 case 0x47: ctx_prog = nv47_ctx_prog; break;
1976 case 0x49: ctx_prog = nv49_4b_ctx_prog; break;
1977 case 0x4a: ctx_prog = nv4a_ctx_prog; break;
1978 case 0x4b: ctx_prog = nv49_4b_ctx_prog; break;
1979 case 0x4c:
1980 case 0x67: ctx_prog = nv4c_ctx_prog; break;
1981 case 0x4e: ctx_prog = nv4e_ctx_prog; break;
1982 default:
1983 DRM_ERROR("Context program for 0x%02x unavailable\n",
1984 dev_priv->chipset);
1985 return -EINVAL;
1988 /* Load the context program onto the card */
1989 DRM_DEBUG("Loading context program\n");
1991 i = 0;
1992 NV_WRITE(NV40_PGRAPH_CTXCTL_UCODE_INDEX, 0);
1993 while (ctx_prog[i] != ~0) {
1994 NV_WRITE(NV40_PGRAPH_CTXCTL_UCODE_DATA, ctx_prog[i]);
1995 i++;
1998 /* No context present currently */
1999 NV_WRITE(NV40_PGRAPH_CTXCTL_CUR, 0x00000000);
2001 NV_WRITE(NV03_PGRAPH_INTR , 0xFFFFFFFF);
2002 NV_WRITE(NV40_PGRAPH_INTR_EN, 0xFFFFFFFF);
2004 NV_WRITE(NV04_PGRAPH_DEBUG_0, 0xFFFFFFFF);
2005 NV_WRITE(NV04_PGRAPH_DEBUG_0, 0x00000000);
2006 NV_WRITE(NV04_PGRAPH_DEBUG_1, 0x401287c0);
2007 NV_WRITE(NV04_PGRAPH_DEBUG_3, 0xe0de8055);
2008 NV_WRITE(NV10_PGRAPH_DEBUG_4, 0x00008000);
2009 NV_WRITE(NV04_PGRAPH_LIMIT_VIOL_PIX, 0x00be3c5f);
2011 NV_WRITE(NV10_PGRAPH_CTX_CONTROL, 0x10010100);
2012 NV_WRITE(NV10_PGRAPH_STATE , 0xFFFFFFFF);
2013 NV_WRITE(NV04_PGRAPH_FIFO , 0x00000001);
2015 j = NV_READ(0x1540) & 0xff;
2016 if (j) {
2017 for (i=0; !(j&1); j>>=1, i++);
2018 NV_WRITE(0x405000, i);
2021 if (dev_priv->chipset == 0x40) {
2022 NV_WRITE(0x4009b0, 0x83280fff);
2023 NV_WRITE(0x4009b4, 0x000000a0);
2024 } else {
2025 NV_WRITE(0x400820, 0x83280eff);
2026 NV_WRITE(0x400824, 0x000000a0);
2029 switch (dev_priv->chipset) {
2030 case 0x40:
2031 case 0x45:
2032 NV_WRITE(0x4009b8, 0x0078e366);
2033 NV_WRITE(0x4009bc, 0x0000014c);
2034 break;
2035 case 0x41:
2036 case 0x42: /* pciid also 0x00Cx */
2037 // case 0x0120: //XXX (pciid)
2038 NV_WRITE(0x400828, 0x007596ff);
2039 NV_WRITE(0x40082c, 0x00000108);
2040 break;
2041 case 0x43:
2042 NV_WRITE(0x400828, 0x0072cb77);
2043 NV_WRITE(0x40082c, 0x00000108);
2044 break;
2045 case 0x44:
2046 case 0x46: /* G72 */
2047 case 0x4a:
2048 case 0x4c: /* G7x-based C51 */
2049 case 0x4e:
2050 NV_WRITE(0x400860, 0);
2051 NV_WRITE(0x400864, 0);
2052 break;
2053 case 0x47: /* G70 */
2054 case 0x49: /* G71 */
2055 case 0x4b: /* G73 */
2056 NV_WRITE(0x400828, 0x07830610);
2057 NV_WRITE(0x40082c, 0x0000016A);
2058 break;
2059 default:
2060 break;
2063 NV_WRITE(0x400b38, 0x2ffff800);
2064 NV_WRITE(0x400b3c, 0x00006000);
2066 /* copy tile info from PFB */
2067 switch (dev_priv->chipset) {
2068 case 0x40: /* vanilla NV40 */
2069 for (i=0; i<NV10_PFB_TILE__SIZE; i++) {
2070 tmp = NV_READ(NV10_PFB_TILE(i));
2071 NV_WRITE(NV40_PGRAPH_TILE0(i), tmp);
2072 NV_WRITE(NV40_PGRAPH_TILE1(i), tmp);
2073 tmp = NV_READ(NV10_PFB_TLIMIT(i));
2074 NV_WRITE(NV40_PGRAPH_TLIMIT0(i), tmp);
2075 NV_WRITE(NV40_PGRAPH_TLIMIT1(i), tmp);
2076 tmp = NV_READ(NV10_PFB_TSIZE(i));
2077 NV_WRITE(NV40_PGRAPH_TSIZE0(i), tmp);
2078 NV_WRITE(NV40_PGRAPH_TSIZE1(i), tmp);
2079 tmp = NV_READ(NV10_PFB_TSTATUS(i));
2080 NV_WRITE(NV40_PGRAPH_TSTATUS0(i), tmp);
2081 NV_WRITE(NV40_PGRAPH_TSTATUS1(i), tmp);
2083 break;
2084 case 0x44:
2085 case 0x4a:
2086 case 0x4e: /* NV44-based cores don't have 0x406900? */
2087 for (i=0; i<NV40_PFB_TILE__SIZE_0; i++) {
2088 tmp = NV_READ(NV40_PFB_TILE(i));
2089 NV_WRITE(NV40_PGRAPH_TILE0(i), tmp);
2090 tmp = NV_READ(NV40_PFB_TLIMIT(i));
2091 NV_WRITE(NV40_PGRAPH_TLIMIT0(i), tmp);
2092 tmp = NV_READ(NV40_PFB_TSIZE(i));
2093 NV_WRITE(NV40_PGRAPH_TSIZE0(i), tmp);
2094 tmp = NV_READ(NV40_PFB_TSTATUS(i));
2095 NV_WRITE(NV40_PGRAPH_TSTATUS0(i), tmp);
2097 break;
2098 case 0x46:
2099 case 0x47:
2100 case 0x49:
2101 case 0x4b: /* G7X-based cores */
2102 for (i=0; i<NV40_PFB_TILE__SIZE_1; i++) {
2103 tmp = NV_READ(NV40_PFB_TILE(i));
2104 NV_WRITE(NV47_PGRAPH_TILE0(i), tmp);
2105 NV_WRITE(NV40_PGRAPH_TILE1(i), tmp);
2106 tmp = NV_READ(NV40_PFB_TLIMIT(i));
2107 NV_WRITE(NV47_PGRAPH_TLIMIT0(i), tmp);
2108 NV_WRITE(NV40_PGRAPH_TLIMIT1(i), tmp);
2109 tmp = NV_READ(NV40_PFB_TSIZE(i));
2110 NV_WRITE(NV47_PGRAPH_TSIZE0(i), tmp);
2111 NV_WRITE(NV40_PGRAPH_TSIZE1(i), tmp);
2112 tmp = NV_READ(NV40_PFB_TSTATUS(i));
2113 NV_WRITE(NV47_PGRAPH_TSTATUS0(i), tmp);
2114 NV_WRITE(NV40_PGRAPH_TSTATUS1(i), tmp);
2116 break;
2117 default: /* everything else */
2118 for (i=0; i<NV40_PFB_TILE__SIZE_0; i++) {
2119 tmp = NV_READ(NV40_PFB_TILE(i));
2120 NV_WRITE(NV40_PGRAPH_TILE0(i), tmp);
2121 NV_WRITE(NV40_PGRAPH_TILE1(i), tmp);
2122 tmp = NV_READ(NV40_PFB_TLIMIT(i));
2123 NV_WRITE(NV40_PGRAPH_TLIMIT0(i), tmp);
2124 NV_WRITE(NV40_PGRAPH_TLIMIT1(i), tmp);
2125 tmp = NV_READ(NV40_PFB_TSIZE(i));
2126 NV_WRITE(NV40_PGRAPH_TSIZE0(i), tmp);
2127 NV_WRITE(NV40_PGRAPH_TSIZE1(i), tmp);
2128 tmp = NV_READ(NV40_PFB_TSTATUS(i));
2129 NV_WRITE(NV40_PGRAPH_TSTATUS0(i), tmp);
2130 NV_WRITE(NV40_PGRAPH_TSTATUS1(i), tmp);
2132 break;
2135 /* begin RAM config */
2136 vramsz = drm_get_resource_len(dev, 0) - 1;
2137 switch (dev_priv->chipset) {
2138 case 0x40:
2139 NV_WRITE(0x4009A4, NV_READ(NV04_PFB_CFG0));
2140 NV_WRITE(0x4009A8, NV_READ(NV04_PFB_CFG1));
2141 NV_WRITE(0x4069A4, NV_READ(NV04_PFB_CFG0));
2142 NV_WRITE(0x4069A8, NV_READ(NV04_PFB_CFG1));
2143 NV_WRITE(0x400820, 0);
2144 NV_WRITE(0x400824, 0);
2145 NV_WRITE(0x400864, vramsz);
2146 NV_WRITE(0x400868, vramsz);
2147 break;
2148 default:
2149 switch (dev_priv->chipset) {
2150 case 0x46:
2151 case 0x47:
2152 case 0x49:
2153 case 0x4b:
2154 NV_WRITE(0x400DF0, NV_READ(NV04_PFB_CFG0));
2155 NV_WRITE(0x400DF4, NV_READ(NV04_PFB_CFG1));
2156 break;
2157 default:
2158 NV_WRITE(0x4009F0, NV_READ(NV04_PFB_CFG0));
2159 NV_WRITE(0x4009F4, NV_READ(NV04_PFB_CFG1));
2160 break;
2162 NV_WRITE(0x4069F0, NV_READ(NV04_PFB_CFG0));
2163 NV_WRITE(0x4069F4, NV_READ(NV04_PFB_CFG1));
2164 NV_WRITE(0x400840, 0);
2165 NV_WRITE(0x400844, 0);
2166 NV_WRITE(0x4008A0, vramsz);
2167 NV_WRITE(0x4008A4, vramsz);
2168 break;
2171 /* per-context state, doesn't belong here */
2172 NV_WRITE(0x400B20, 0x00000000);
2173 NV_WRITE(0x400B04, 0xFFFFFFFF);
2175 tmp = NV_READ(NV10_PGRAPH_SURFACE) & 0x0007ff00;
2176 NV_WRITE(NV10_PGRAPH_SURFACE, tmp);
2177 tmp = NV_READ(NV10_PGRAPH_SURFACE) | 0x00020100;
2178 NV_WRITE(NV10_PGRAPH_SURFACE, tmp);
2180 NV_WRITE(NV03_PGRAPH_ABS_UCLIP_XMIN, 0);
2181 NV_WRITE(NV03_PGRAPH_ABS_UCLIP_YMIN, 0);
2182 NV_WRITE(NV03_PGRAPH_ABS_UCLIP_XMAX, 0x7fff);
2183 NV_WRITE(NV03_PGRAPH_ABS_UCLIP_YMAX, 0x7fff);
2185 return 0;
2188 void nv40_graph_takedown(struct drm_device *dev)