diff options
Diffstat (limited to 'drivers/char/drm/radeon_cp.c')
-rw-r--r-- | drivers/char/drm/radeon_cp.c | 1148 |
1 files changed, 243 insertions, 905 deletions
diff --git a/drivers/char/drm/radeon_cp.c b/drivers/char/drm/radeon_cp.c index f6f6c92bf771..e53158f0ecb5 100644 --- a/drivers/char/drm/radeon_cp.c +++ b/drivers/char/drm/radeon_cp.c | |||
@@ -2,6 +2,7 @@ | |||
2 | /* | 2 | /* |
3 | * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas. | 3 | * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas. |
4 | * Copyright 2000 VA Linux Systems, Inc., Fremont, California. | 4 | * Copyright 2000 VA Linux Systems, Inc., Fremont, California. |
5 | * Copyright 2007 Advanced Micro Devices, Inc. | ||
5 | * All Rights Reserved. | 6 | * All Rights Reserved. |
6 | * | 7 | * |
7 | * Permission is hereby granted, free of charge, to any person obtaining a | 8 | * Permission is hereby granted, free of charge, to any person obtaining a |
@@ -34,789 +35,13 @@ | |||
34 | #include "radeon_drv.h" | 35 | #include "radeon_drv.h" |
35 | #include "r300_reg.h" | 36 | #include "r300_reg.h" |
36 | 37 | ||
38 | #include "radeon_microcode.h" | ||
39 | |||
37 | #define RADEON_FIFO_DEBUG 0 | 40 | #define RADEON_FIFO_DEBUG 0 |
38 | 41 | ||
39 | static int radeon_do_cleanup_cp(struct drm_device * dev); | 42 | static int radeon_do_cleanup_cp(struct drm_device * dev); |
40 | 43 | ||
41 | /* CP microcode (from ATI) */ | 44 | static u32 R500_READ_MCIND(drm_radeon_private_t *dev_priv, int addr) |
42 | static const u32 R200_cp_microcode[][2] = { | ||
43 | {0x21007000, 0000000000}, | ||
44 | {0x20007000, 0000000000}, | ||
45 | {0x000000ab, 0x00000004}, | ||
46 | {0x000000af, 0x00000004}, | ||
47 | {0x66544a49, 0000000000}, | ||
48 | {0x49494174, 0000000000}, | ||
49 | {0x54517d83, 0000000000}, | ||
50 | {0x498d8b64, 0000000000}, | ||
51 | {0x49494949, 0000000000}, | ||
52 | {0x49da493c, 0000000000}, | ||
53 | {0x49989898, 0000000000}, | ||
54 | {0xd34949d5, 0000000000}, | ||
55 | {0x9dc90e11, 0000000000}, | ||
56 | {0xce9b9b9b, 0000000000}, | ||
57 | {0x000f0000, 0x00000016}, | ||
58 | {0x352e232c, 0000000000}, | ||
59 | {0x00000013, 0x00000004}, | ||
60 | {0x000f0000, 0x00000016}, | ||
61 | {0x352e272c, 0000000000}, | ||
62 | {0x000f0001, 0x00000016}, | ||
63 | {0x3239362f, 0000000000}, | ||
64 | {0x000077ef, 0x00000002}, | ||
65 | {0x00061000, 0x00000002}, | ||
66 | {0x00000020, 0x0000001a}, | ||
67 | {0x00004000, 0x0000001e}, | ||
68 | {0x00061000, 0x00000002}, | ||
69 | {0x00000020, 0x0000001a}, | ||
70 | {0x00004000, 0x0000001e}, | ||
71 | {0x00061000, 0x00000002}, | ||
72 | {0x00000020, 0x0000001a}, | ||
73 | {0x00004000, 0x0000001e}, | ||
74 | {0x00000016, 0x00000004}, | ||
75 | {0x0003802a, 0x00000002}, | ||
76 | {0x040067e0, 0x00000002}, | ||
77 | {0x00000016, 0x00000004}, | ||
78 | {0x000077e0, 0x00000002}, | ||
79 | {0x00065000, 0x00000002}, | ||
80 | {0x000037e1, 0x00000002}, | ||
81 | {0x040067e1, 0x00000006}, | ||
82 | {0x000077e0, 0x00000002}, | ||
83 | {0x000077e1, 0x00000002}, | ||
84 | {0x000077e1, 0x00000006}, | ||
85 | {0xffffffff, 0000000000}, | ||
86 | {0x10000000, 0000000000}, | ||
87 | {0x0003802a, 0x00000002}, | ||
88 | {0x040067e0, 0x00000006}, | ||
89 | {0x00007675, 0x00000002}, | ||
90 | {0x00007676, 0x00000002}, | ||
91 | {0x00007677, 0x00000002}, | ||
92 | {0x00007678, 0x00000006}, | ||
93 | {0x0003802b, 0x00000002}, | ||
94 | {0x04002676, 0x00000002}, | ||
95 | {0x00007677, 0x00000002}, | ||
96 | {0x00007678, 0x00000006}, | ||
97 | {0x0000002e, 0x00000018}, | ||
98 | {0x0000002e, 0x00000018}, | ||
99 | {0000000000, 0x00000006}, | ||
100 | {0x0000002f, 0x00000018}, | ||
101 | {0x0000002f, 0x00000018}, | ||
102 | {0000000000, 0x00000006}, | ||
103 | {0x01605000, 0x00000002}, | ||
104 | {0x00065000, 0x00000002}, | ||
105 | {0x00098000, 0x00000002}, | ||
106 | {0x00061000, 0x00000002}, | ||
107 | {0x64c0603d, 0x00000004}, | ||
108 | {0x00080000, 0x00000016}, | ||
109 | {0000000000, 0000000000}, | ||
110 | {0x0400251d, 0x00000002}, | ||
111 | {0x00007580, 0x00000002}, | ||
112 | {0x00067581, 0x00000002}, | ||
113 | {0x04002580, 0x00000002}, | ||
114 | {0x00067581, 0x00000002}, | ||
115 | {0x00000046, 0x00000004}, | ||
116 | {0x00005000, 0000000000}, | ||
117 | {0x00061000, 0x00000002}, | ||
118 | {0x0000750e, 0x00000002}, | ||
119 | {0x00019000, 0x00000002}, | ||
120 | {0x00011055, 0x00000014}, | ||
121 | {0x00000055, 0x00000012}, | ||
122 | {0x0400250f, 0x00000002}, | ||
123 | {0x0000504a, 0x00000004}, | ||
124 | {0x00007565, 0x00000002}, | ||
125 | {0x00007566, 0x00000002}, | ||
126 | {0x00000051, 0x00000004}, | ||
127 | {0x01e655b4, 0x00000002}, | ||
128 | {0x4401b0dc, 0x00000002}, | ||
129 | {0x01c110dc, 0x00000002}, | ||
130 | {0x2666705d, 0x00000018}, | ||
131 | {0x040c2565, 0x00000002}, | ||
132 | {0x0000005d, 0x00000018}, | ||
133 | {0x04002564, 0x00000002}, | ||
134 | {0x00007566, 0x00000002}, | ||
135 | {0x00000054, 0x00000004}, | ||
136 | {0x00401060, 0x00000008}, | ||
137 | {0x00101000, 0x00000002}, | ||
138 | {0x000d80ff, 0x00000002}, | ||
139 | {0x00800063, 0x00000008}, | ||
140 | {0x000f9000, 0x00000002}, | ||
141 | {0x000e00ff, 0x00000002}, | ||
142 | {0000000000, 0x00000006}, | ||
143 | {0x00000080, 0x00000018}, | ||
144 | {0x00000054, 0x00000004}, | ||
145 | {0x00007576, 0x00000002}, | ||
146 | {0x00065000, 0x00000002}, | ||
147 | {0x00009000, 0x00000002}, | ||
148 | {0x00041000, 0x00000002}, | ||
149 | {0x0c00350e, 0x00000002}, | ||
150 | {0x00049000, 0x00000002}, | ||
151 | {0x00051000, 0x00000002}, | ||
152 | {0x01e785f8, 0x00000002}, | ||
153 | {0x00200000, 0x00000002}, | ||
154 | {0x00600073, 0x0000000c}, | ||
155 | {0x00007563, 0x00000002}, | ||
156 | {0x006075f0, 0x00000021}, | ||
157 | {0x20007068, 0x00000004}, | ||
158 | {0x00005068, 0x00000004}, | ||
159 | {0x00007576, 0x00000002}, | ||
160 | {0x00007577, 0x00000002}, | ||
161 | {0x0000750e, 0x00000002}, | ||
162 | {0x0000750f, 0x00000002}, | ||
163 | {0x00a05000, 0x00000002}, | ||
164 | {0x00600076, 0x0000000c}, | ||
165 | {0x006075f0, 0x00000021}, | ||
166 | {0x000075f8, 0x00000002}, | ||
167 | {0x00000076, 0x00000004}, | ||
168 | {0x000a750e, 0x00000002}, | ||
169 | {0x0020750f, 0x00000002}, | ||
170 | {0x00600079, 0x00000004}, | ||
171 | {0x00007570, 0x00000002}, | ||
172 | {0x00007571, 0x00000002}, | ||
173 | {0x00007572, 0x00000006}, | ||
174 | {0x00005000, 0x00000002}, | ||
175 | {0x00a05000, 0x00000002}, | ||
176 | {0x00007568, 0x00000002}, | ||
177 | {0x00061000, 0x00000002}, | ||
178 | {0x00000084, 0x0000000c}, | ||
179 | {0x00058000, 0x00000002}, | ||
180 | {0x0c607562, 0x00000002}, | ||
181 | {0x00000086, 0x00000004}, | ||
182 | {0x00600085, 0x00000004}, | ||
183 | {0x400070dd, 0000000000}, | ||
184 | {0x000380dd, 0x00000002}, | ||
185 | {0x00000093, 0x0000001c}, | ||
186 | {0x00065095, 0x00000018}, | ||
187 | {0x040025bb, 0x00000002}, | ||
188 | {0x00061096, 0x00000018}, | ||
189 | {0x040075bc, 0000000000}, | ||
190 | {0x000075bb, 0x00000002}, | ||
191 | {0x000075bc, 0000000000}, | ||
192 | {0x00090000, 0x00000006}, | ||
193 | {0x00090000, 0x00000002}, | ||
194 | {0x000d8002, 0x00000006}, | ||
195 | {0x00005000, 0x00000002}, | ||
196 | {0x00007821, 0x00000002}, | ||
197 | {0x00007800, 0000000000}, | ||
198 | {0x00007821, 0x00000002}, | ||
199 | {0x00007800, 0000000000}, | ||
200 | {0x01665000, 0x00000002}, | ||
201 | {0x000a0000, 0x00000002}, | ||
202 | {0x000671cc, 0x00000002}, | ||
203 | {0x0286f1cd, 0x00000002}, | ||
204 | {0x000000a3, 0x00000010}, | ||
205 | {0x21007000, 0000000000}, | ||
206 | {0x000000aa, 0x0000001c}, | ||
207 | {0x00065000, 0x00000002}, | ||
208 | {0x000a0000, 0x00000002}, | ||
209 | {0x00061000, 0x00000002}, | ||
210 | {0x000b0000, 0x00000002}, | ||
211 | {0x38067000, 0x00000002}, | ||
212 | {0x000a00a6, 0x00000004}, | ||
213 | {0x20007000, 0000000000}, | ||
214 | {0x01200000, 0x00000002}, | ||
215 | {0x20077000, 0x00000002}, | ||
216 | {0x01200000, 0x00000002}, | ||
217 | {0x20007000, 0000000000}, | ||
218 | {0x00061000, 0x00000002}, | ||
219 | {0x0120751b, 0x00000002}, | ||
220 | {0x8040750a, 0x00000002}, | ||
221 | {0x8040750b, 0x00000002}, | ||
222 | {0x00110000, 0x00000002}, | ||
223 | {0x000380dd, 0x00000002}, | ||
224 | {0x000000bd, 0x0000001c}, | ||
225 | {0x00061096, 0x00000018}, | ||
226 | {0x844075bd, 0x00000002}, | ||
227 | {0x00061095, 0x00000018}, | ||
228 | {0x840075bb, 0x00000002}, | ||
229 | {0x00061096, 0x00000018}, | ||
230 | {0x844075bc, 0x00000002}, | ||
231 | {0x000000c0, 0x00000004}, | ||
232 | {0x804075bd, 0x00000002}, | ||
233 | {0x800075bb, 0x00000002}, | ||
234 | {0x804075bc, 0x00000002}, | ||
235 | {0x00108000, 0x00000002}, | ||
236 | {0x01400000, 0x00000002}, | ||
237 | {0x006000c4, 0x0000000c}, | ||
238 | {0x20c07000, 0x00000020}, | ||
239 | {0x000000c6, 0x00000012}, | ||
240 | {0x00800000, 0x00000006}, | ||
241 | {0x0080751d, 0x00000006}, | ||
242 | {0x000025bb, 0x00000002}, | ||
243 | {0x000040c0, 0x00000004}, | ||
244 | {0x0000775c, 0x00000002}, | ||
245 | {0x00a05000, 0x00000002}, | ||
246 | {0x00661000, 0x00000002}, | ||
247 | {0x0460275d, 0x00000020}, | ||
248 | {0x00004000, 0000000000}, | ||
249 | {0x00007999, 0x00000002}, | ||
250 | {0x00a05000, 0x00000002}, | ||
251 | {0x00661000, 0x00000002}, | ||
252 | {0x0460299b, 0x00000020}, | ||
253 | {0x00004000, 0000000000}, | ||
254 | {0x01e00830, 0x00000002}, | ||
255 | {0x21007000, 0000000000}, | ||
256 | {0x00005000, 0x00000002}, | ||
257 | {0x00038042, 0x00000002}, | ||
258 | {0x040025e0, 0x00000002}, | ||
259 | {0x000075e1, 0000000000}, | ||
260 | {0x00000001, 0000000000}, | ||
261 | {0x000380d9, 0x00000002}, | ||
262 | {0x04007394, 0000000000}, | ||
263 | {0000000000, 0000000000}, | ||
264 | {0000000000, 0000000000}, | ||
265 | {0000000000, 0000000000}, | ||
266 | {0000000000, 0000000000}, | ||
267 | {0000000000, 0000000000}, | ||
268 | {0000000000, 0000000000}, | ||
269 | {0000000000, 0000000000}, | ||
270 | {0000000000, 0000000000}, | ||
271 | {0000000000, 0000000000}, | ||
272 | {0000000000, 0000000000}, | ||
273 | {0000000000, 0000000000}, | ||
274 | {0000000000, 0000000000}, | ||
275 | {0000000000, 0000000000}, | ||
276 | {0000000000, 0000000000}, | ||
277 | {0000000000, 0000000000}, | ||
278 | {0000000000, 0000000000}, | ||
279 | {0000000000, 0000000000}, | ||
280 | {0000000000, 0000000000}, | ||
281 | {0000000000, 0000000000}, | ||
282 | {0000000000, 0000000000}, | ||
283 | {0000000000, 0000000000}, | ||
284 | {0000000000, 0000000000}, | ||
285 | {0000000000, 0000000000}, | ||
286 | {0000000000, 0000000000}, | ||
287 | {0000000000, 0000000000}, | ||
288 | {0000000000, 0000000000}, | ||
289 | {0000000000, 0000000000}, | ||
290 | {0000000000, 0000000000}, | ||
291 | {0000000000, 0000000000}, | ||
292 | {0000000000, 0000000000}, | ||
293 | {0000000000, 0000000000}, | ||
294 | {0000000000, 0000000000}, | ||
295 | {0000000000, 0000000000}, | ||
296 | {0000000000, 0000000000}, | ||
297 | {0000000000, 0000000000}, | ||
298 | {0000000000, 0000000000}, | ||
299 | }; | ||
300 | |||
301 | static const u32 radeon_cp_microcode[][2] = { | ||
302 | {0x21007000, 0000000000}, | ||
303 | {0x20007000, 0000000000}, | ||
304 | {0x000000b4, 0x00000004}, | ||
305 | {0x000000b8, 0x00000004}, | ||
306 | {0x6f5b4d4c, 0000000000}, | ||
307 | {0x4c4c427f, 0000000000}, | ||
308 | {0x5b568a92, 0000000000}, | ||
309 | {0x4ca09c6d, 0000000000}, | ||
310 | {0xad4c4c4c, 0000000000}, | ||
311 | {0x4ce1af3d, 0000000000}, | ||
312 | {0xd8afafaf, 0000000000}, | ||
313 | {0xd64c4cdc, 0000000000}, | ||
314 | {0x4cd10d10, 0000000000}, | ||
315 | {0x000f0000, 0x00000016}, | ||
316 | {0x362f242d, 0000000000}, | ||
317 | {0x00000012, 0x00000004}, | ||
318 | {0x000f0000, 0x00000016}, | ||
319 | {0x362f282d, 0000000000}, | ||
320 | {0x000380e7, 0x00000002}, | ||
321 | {0x04002c97, 0x00000002}, | ||
322 | {0x000f0001, 0x00000016}, | ||
323 | {0x333a3730, 0000000000}, | ||
324 | {0x000077ef, 0x00000002}, | ||
325 | {0x00061000, 0x00000002}, | ||
326 | {0x00000021, 0x0000001a}, | ||
327 | {0x00004000, 0x0000001e}, | ||
328 | {0x00061000, 0x00000002}, | ||
329 | {0x00000021, 0x0000001a}, | ||
330 | {0x00004000, 0x0000001e}, | ||
331 | {0x00061000, 0x00000002}, | ||
332 | {0x00000021, 0x0000001a}, | ||
333 | {0x00004000, 0x0000001e}, | ||
334 | {0x00000017, 0x00000004}, | ||
335 | {0x0003802b, 0x00000002}, | ||
336 | {0x040067e0, 0x00000002}, | ||
337 | {0x00000017, 0x00000004}, | ||
338 | {0x000077e0, 0x00000002}, | ||
339 | {0x00065000, 0x00000002}, | ||
340 | {0x000037e1, 0x00000002}, | ||
341 | {0x040067e1, 0x00000006}, | ||
342 | {0x000077e0, 0x00000002}, | ||
343 | {0x000077e1, 0x00000002}, | ||
344 | {0x000077e1, 0x00000006}, | ||
345 | {0xffffffff, 0000000000}, | ||
346 | {0x10000000, 0000000000}, | ||
347 | {0x0003802b, 0x00000002}, | ||
348 | {0x040067e0, 0x00000006}, | ||
349 | {0x00007675, 0x00000002}, | ||
350 | {0x00007676, 0x00000002}, | ||
351 | {0x00007677, 0x00000002}, | ||
352 | {0x00007678, 0x00000006}, | ||
353 | {0x0003802c, 0x00000002}, | ||
354 | {0x04002676, 0x00000002}, | ||
355 | {0x00007677, 0x00000002}, | ||
356 | {0x00007678, 0x00000006}, | ||
357 | {0x0000002f, 0x00000018}, | ||
358 | {0x0000002f, 0x00000018}, | ||
359 | {0000000000, 0x00000006}, | ||
360 | {0x00000030, 0x00000018}, | ||
361 | {0x00000030, 0x00000018}, | ||
362 | {0000000000, 0x00000006}, | ||
363 | {0x01605000, 0x00000002}, | ||
364 | {0x00065000, 0x00000002}, | ||
365 | {0x00098000, 0x00000002}, | ||
366 | {0x00061000, 0x00000002}, | ||
367 | {0x64c0603e, 0x00000004}, | ||
368 | {0x000380e6, 0x00000002}, | ||
369 | {0x040025c5, 0x00000002}, | ||
370 | {0x00080000, 0x00000016}, | ||
371 | {0000000000, 0000000000}, | ||
372 | {0x0400251d, 0x00000002}, | ||
373 | {0x00007580, 0x00000002}, | ||
374 | {0x00067581, 0x00000002}, | ||
375 | {0x04002580, 0x00000002}, | ||
376 | {0x00067581, 0x00000002}, | ||
377 | {0x00000049, 0x00000004}, | ||
378 | {0x00005000, 0000000000}, | ||
379 | {0x000380e6, 0x00000002}, | ||
380 | {0x040025c5, 0x00000002}, | ||
381 | {0x00061000, 0x00000002}, | ||
382 | {0x0000750e, 0x00000002}, | ||
383 | {0x00019000, 0x00000002}, | ||
384 | {0x00011055, 0x00000014}, | ||
385 | {0x00000055, 0x00000012}, | ||
386 | {0x0400250f, 0x00000002}, | ||
387 | {0x0000504f, 0x00000004}, | ||
388 | {0x000380e6, 0x00000002}, | ||
389 | {0x040025c5, 0x00000002}, | ||
390 | {0x00007565, 0x00000002}, | ||
391 | {0x00007566, 0x00000002}, | ||
392 | {0x00000058, 0x00000004}, | ||
393 | {0x000380e6, 0x00000002}, | ||
394 | {0x040025c5, 0x00000002}, | ||
395 | {0x01e655b4, 0x00000002}, | ||
396 | {0x4401b0e4, 0x00000002}, | ||
397 | {0x01c110e4, 0x00000002}, | ||
398 | {0x26667066, 0x00000018}, | ||
399 | {0x040c2565, 0x00000002}, | ||
400 | {0x00000066, 0x00000018}, | ||
401 | {0x04002564, 0x00000002}, | ||
402 | {0x00007566, 0x00000002}, | ||
403 | {0x0000005d, 0x00000004}, | ||
404 | {0x00401069, 0x00000008}, | ||
405 | {0x00101000, 0x00000002}, | ||
406 | {0x000d80ff, 0x00000002}, | ||
407 | {0x0080006c, 0x00000008}, | ||
408 | {0x000f9000, 0x00000002}, | ||
409 | {0x000e00ff, 0x00000002}, | ||
410 | {0000000000, 0x00000006}, | ||
411 | {0x0000008f, 0x00000018}, | ||
412 | {0x0000005b, 0x00000004}, | ||
413 | {0x000380e6, 0x00000002}, | ||
414 | {0x040025c5, 0x00000002}, | ||
415 | {0x00007576, 0x00000002}, | ||
416 | {0x00065000, 0x00000002}, | ||
417 | {0x00009000, 0x00000002}, | ||
418 | {0x00041000, 0x00000002}, | ||
419 | {0x0c00350e, 0x00000002}, | ||
420 | {0x00049000, 0x00000002}, | ||
421 | {0x00051000, 0x00000002}, | ||
422 | {0x01e785f8, 0x00000002}, | ||
423 | {0x00200000, 0x00000002}, | ||
424 | {0x0060007e, 0x0000000c}, | ||
425 | {0x00007563, 0x00000002}, | ||
426 | {0x006075f0, 0x00000021}, | ||
427 | {0x20007073, 0x00000004}, | ||
428 | {0x00005073, 0x00000004}, | ||
429 | {0x000380e6, 0x00000002}, | ||
430 | {0x040025c5, 0x00000002}, | ||
431 | {0x00007576, 0x00000002}, | ||
432 | {0x00007577, 0x00000002}, | ||
433 | {0x0000750e, 0x00000002}, | ||
434 | {0x0000750f, 0x00000002}, | ||
435 | {0x00a05000, 0x00000002}, | ||
436 | {0x00600083, 0x0000000c}, | ||
437 | {0x006075f0, 0x00000021}, | ||
438 | {0x000075f8, 0x00000002}, | ||
439 | {0x00000083, 0x00000004}, | ||
440 | {0x000a750e, 0x00000002}, | ||
441 | {0x000380e6, 0x00000002}, | ||
442 | {0x040025c5, 0x00000002}, | ||
443 | {0x0020750f, 0x00000002}, | ||
444 | {0x00600086, 0x00000004}, | ||
445 | {0x00007570, 0x00000002}, | ||
446 | {0x00007571, 0x00000002}, | ||
447 | {0x00007572, 0x00000006}, | ||
448 | {0x000380e6, 0x00000002}, | ||
449 | {0x040025c5, 0x00000002}, | ||
450 | {0x00005000, 0x00000002}, | ||
451 | {0x00a05000, 0x00000002}, | ||
452 | {0x00007568, 0x00000002}, | ||
453 | {0x00061000, 0x00000002}, | ||
454 | {0x00000095, 0x0000000c}, | ||
455 | {0x00058000, 0x00000002}, | ||
456 | {0x0c607562, 0x00000002}, | ||
457 | {0x00000097, 0x00000004}, | ||
458 | {0x000380e6, 0x00000002}, | ||
459 | {0x040025c5, 0x00000002}, | ||
460 | {0x00600096, 0x00000004}, | ||
461 | {0x400070e5, 0000000000}, | ||
462 | {0x000380e6, 0x00000002}, | ||
463 | {0x040025c5, 0x00000002}, | ||
464 | {0x000380e5, 0x00000002}, | ||
465 | {0x000000a8, 0x0000001c}, | ||
466 | {0x000650aa, 0x00000018}, | ||
467 | {0x040025bb, 0x00000002}, | ||
468 | {0x000610ab, 0x00000018}, | ||
469 | {0x040075bc, 0000000000}, | ||
470 | {0x000075bb, 0x00000002}, | ||
471 | {0x000075bc, 0000000000}, | ||
472 | {0x00090000, 0x00000006}, | ||
473 | {0x00090000, 0x00000002}, | ||
474 | {0x000d8002, 0x00000006}, | ||
475 | {0x00007832, 0x00000002}, | ||
476 | {0x00005000, 0x00000002}, | ||
477 | {0x000380e7, 0x00000002}, | ||
478 | {0x04002c97, 0x00000002}, | ||
479 | {0x00007820, 0x00000002}, | ||
480 | {0x00007821, 0x00000002}, | ||
481 | {0x00007800, 0000000000}, | ||
482 | {0x01200000, 0x00000002}, | ||
483 | {0x20077000, 0x00000002}, | ||
484 | {0x01200000, 0x00000002}, | ||
485 | {0x20007000, 0x00000002}, | ||
486 | {0x00061000, 0x00000002}, | ||
487 | {0x0120751b, 0x00000002}, | ||
488 | {0x8040750a, 0x00000002}, | ||
489 | {0x8040750b, 0x00000002}, | ||
490 | {0x00110000, 0x00000002}, | ||
491 | {0x000380e5, 0x00000002}, | ||
492 | {0x000000c6, 0x0000001c}, | ||
493 | {0x000610ab, 0x00000018}, | ||
494 | {0x844075bd, 0x00000002}, | ||
495 | {0x000610aa, 0x00000018}, | ||
496 | {0x840075bb, 0x00000002}, | ||
497 | {0x000610ab, 0x00000018}, | ||
498 | {0x844075bc, 0x00000002}, | ||
499 | {0x000000c9, 0x00000004}, | ||
500 | {0x804075bd, 0x00000002}, | ||
501 | {0x800075bb, 0x00000002}, | ||
502 | {0x804075bc, 0x00000002}, | ||
503 | {0x00108000, 0x00000002}, | ||
504 | {0x01400000, 0x00000002}, | ||
505 | {0x006000cd, 0x0000000c}, | ||
506 | {0x20c07000, 0x00000020}, | ||
507 | {0x000000cf, 0x00000012}, | ||
508 | {0x00800000, 0x00000006}, | ||
509 | {0x0080751d, 0x00000006}, | ||
510 | {0000000000, 0000000000}, | ||
511 | {0x0000775c, 0x00000002}, | ||
512 | {0x00a05000, 0x00000002}, | ||
513 | {0x00661000, 0x00000002}, | ||
514 | {0x0460275d, 0x00000020}, | ||
515 | {0x00004000, 0000000000}, | ||
516 | {0x01e00830, 0x00000002}, | ||
517 | {0x21007000, 0000000000}, | ||
518 | {0x6464614d, 0000000000}, | ||
519 | {0x69687420, 0000000000}, | ||
520 | {0x00000073, 0000000000}, | ||
521 | {0000000000, 0000000000}, | ||
522 | {0x00005000, 0x00000002}, | ||
523 | {0x000380d0, 0x00000002}, | ||
524 | {0x040025e0, 0x00000002}, | ||
525 | {0x000075e1, 0000000000}, | ||
526 | {0x00000001, 0000000000}, | ||
527 | {0x000380e0, 0x00000002}, | ||
528 | {0x04002394, 0x00000002}, | ||
529 | {0x00005000, 0000000000}, | ||
530 | {0000000000, 0000000000}, | ||
531 | {0000000000, 0000000000}, | ||
532 | {0x00000008, 0000000000}, | ||
533 | {0x00000004, 0000000000}, | ||
534 | {0000000000, 0000000000}, | ||
535 | {0000000000, 0000000000}, | ||
536 | {0000000000, 0000000000}, | ||
537 | {0000000000, 0000000000}, | ||
538 | {0000000000, 0000000000}, | ||
539 | {0000000000, 0000000000}, | ||
540 | {0000000000, 0000000000}, | ||
541 | {0000000000, 0000000000}, | ||
542 | {0000000000, 0000000000}, | ||
543 | {0000000000, 0000000000}, | ||
544 | {0000000000, 0000000000}, | ||
545 | {0000000000, 0000000000}, | ||
546 | {0000000000, 0000000000}, | ||
547 | {0000000000, 0000000000}, | ||
548 | {0000000000, 0000000000}, | ||
549 | {0000000000, 0000000000}, | ||
550 | {0000000000, 0000000000}, | ||
551 | {0000000000, 0000000000}, | ||
552 | {0000000000, 0000000000}, | ||
553 | {0000000000, 0000000000}, | ||
554 | {0000000000, 0000000000}, | ||
555 | {0000000000, 0000000000}, | ||
556 | {0000000000, 0000000000}, | ||
557 | {0000000000, 0000000000}, | ||
558 | }; | ||
559 | |||
560 | static const u32 R300_cp_microcode[][2] = { | ||
561 | {0x4200e000, 0000000000}, | ||
562 | {0x4000e000, 0000000000}, | ||
563 | {0x000000af, 0x00000008}, | ||
564 | {0x000000b3, 0x00000008}, | ||
565 | {0x6c5a504f, 0000000000}, | ||
566 | {0x4f4f497a, 0000000000}, | ||
567 | {0x5a578288, 0000000000}, | ||
568 | {0x4f91906a, 0000000000}, | ||
569 | {0x4f4f4f4f, 0000000000}, | ||
570 | {0x4fe24f44, 0000000000}, | ||
571 | {0x4f9c9c9c, 0000000000}, | ||
572 | {0xdc4f4fde, 0000000000}, | ||
573 | {0xa1cd4f4f, 0000000000}, | ||
574 | {0xd29d9d9d, 0000000000}, | ||
575 | {0x4f0f9fd7, 0000000000}, | ||
576 | {0x000ca000, 0x00000004}, | ||
577 | {0x000d0012, 0x00000038}, | ||
578 | {0x0000e8b4, 0x00000004}, | ||
579 | {0x000d0014, 0x00000038}, | ||
580 | {0x0000e8b6, 0x00000004}, | ||
581 | {0x000d0016, 0x00000038}, | ||
582 | {0x0000e854, 0x00000004}, | ||
583 | {0x000d0018, 0x00000038}, | ||
584 | {0x0000e855, 0x00000004}, | ||
585 | {0x000d001a, 0x00000038}, | ||
586 | {0x0000e856, 0x00000004}, | ||
587 | {0x000d001c, 0x00000038}, | ||
588 | {0x0000e857, 0x00000004}, | ||
589 | {0x000d001e, 0x00000038}, | ||
590 | {0x0000e824, 0x00000004}, | ||
591 | {0x000d0020, 0x00000038}, | ||
592 | {0x0000e825, 0x00000004}, | ||
593 | {0x000d0022, 0x00000038}, | ||
594 | {0x0000e830, 0x00000004}, | ||
595 | {0x000d0024, 0x00000038}, | ||
596 | {0x0000f0c0, 0x00000004}, | ||
597 | {0x000d0026, 0x00000038}, | ||
598 | {0x0000f0c1, 0x00000004}, | ||
599 | {0x000d0028, 0x00000038}, | ||
600 | {0x0000f041, 0x00000004}, | ||
601 | {0x000d002a, 0x00000038}, | ||
602 | {0x0000f184, 0x00000004}, | ||
603 | {0x000d002c, 0x00000038}, | ||
604 | {0x0000f185, 0x00000004}, | ||
605 | {0x000d002e, 0x00000038}, | ||
606 | {0x0000f186, 0x00000004}, | ||
607 | {0x000d0030, 0x00000038}, | ||
608 | {0x0000f187, 0x00000004}, | ||
609 | {0x000d0032, 0x00000038}, | ||
610 | {0x0000f180, 0x00000004}, | ||
611 | {0x000d0034, 0x00000038}, | ||
612 | {0x0000f393, 0x00000004}, | ||
613 | {0x000d0036, 0x00000038}, | ||
614 | {0x0000f38a, 0x00000004}, | ||
615 | {0x000d0038, 0x00000038}, | ||
616 | {0x0000f38e, 0x00000004}, | ||
617 | {0x0000e821, 0x00000004}, | ||
618 | {0x0140a000, 0x00000004}, | ||
619 | {0x00000043, 0x00000018}, | ||
620 | {0x00cce800, 0x00000004}, | ||
621 | {0x001b0001, 0x00000004}, | ||
622 | {0x08004800, 0x00000004}, | ||
623 | {0x001b0001, 0x00000004}, | ||
624 | {0x08004800, 0x00000004}, | ||
625 | {0x001b0001, 0x00000004}, | ||
626 | {0x08004800, 0x00000004}, | ||
627 | {0x0000003a, 0x00000008}, | ||
628 | {0x0000a000, 0000000000}, | ||
629 | {0x02c0a000, 0x00000004}, | ||
630 | {0x000ca000, 0x00000004}, | ||
631 | {0x00130000, 0x00000004}, | ||
632 | {0x000c2000, 0x00000004}, | ||
633 | {0xc980c045, 0x00000008}, | ||
634 | {0x2000451d, 0x00000004}, | ||
635 | {0x0000e580, 0x00000004}, | ||
636 | {0x000ce581, 0x00000004}, | ||
637 | {0x08004580, 0x00000004}, | ||
638 | {0x000ce581, 0x00000004}, | ||
639 | {0x0000004c, 0x00000008}, | ||
640 | {0x0000a000, 0000000000}, | ||
641 | {0x000c2000, 0x00000004}, | ||
642 | {0x0000e50e, 0x00000004}, | ||
643 | {0x00032000, 0x00000004}, | ||
644 | {0x00022056, 0x00000028}, | ||
645 | {0x00000056, 0x00000024}, | ||
646 | {0x0800450f, 0x00000004}, | ||
647 | {0x0000a050, 0x00000008}, | ||
648 | {0x0000e565, 0x00000004}, | ||
649 | {0x0000e566, 0x00000004}, | ||
650 | {0x00000057, 0x00000008}, | ||
651 | {0x03cca5b4, 0x00000004}, | ||
652 | {0x05432000, 0x00000004}, | ||
653 | {0x00022000, 0x00000004}, | ||
654 | {0x4ccce063, 0x00000030}, | ||
655 | {0x08274565, 0x00000004}, | ||
656 | {0x00000063, 0x00000030}, | ||
657 | {0x08004564, 0x00000004}, | ||
658 | {0x0000e566, 0x00000004}, | ||
659 | {0x0000005a, 0x00000008}, | ||
660 | {0x00802066, 0x00000010}, | ||
661 | {0x00202000, 0x00000004}, | ||
662 | {0x001b00ff, 0x00000004}, | ||
663 | {0x01000069, 0x00000010}, | ||
664 | {0x001f2000, 0x00000004}, | ||
665 | {0x001c00ff, 0x00000004}, | ||
666 | {0000000000, 0x0000000c}, | ||
667 | {0x00000085, 0x00000030}, | ||
668 | {0x0000005a, 0x00000008}, | ||
669 | {0x0000e576, 0x00000004}, | ||
670 | {0x000ca000, 0x00000004}, | ||
671 | {0x00012000, 0x00000004}, | ||
672 | {0x00082000, 0x00000004}, | ||
673 | {0x1800650e, 0x00000004}, | ||
674 | {0x00092000, 0x00000004}, | ||
675 | {0x000a2000, 0x00000004}, | ||
676 | {0x000f0000, 0x00000004}, | ||
677 | {0x00400000, 0x00000004}, | ||
678 | {0x00000079, 0x00000018}, | ||
679 | {0x0000e563, 0x00000004}, | ||
680 | {0x00c0e5f9, 0x000000c2}, | ||
681 | {0x0000006e, 0x00000008}, | ||
682 | {0x0000a06e, 0x00000008}, | ||
683 | {0x0000e576, 0x00000004}, | ||
684 | {0x0000e577, 0x00000004}, | ||
685 | {0x0000e50e, 0x00000004}, | ||
686 | {0x0000e50f, 0x00000004}, | ||
687 | {0x0140a000, 0x00000004}, | ||
688 | {0x0000007c, 0x00000018}, | ||
689 | {0x00c0e5f9, 0x000000c2}, | ||
690 | {0x0000007c, 0x00000008}, | ||
691 | {0x0014e50e, 0x00000004}, | ||
692 | {0x0040e50f, 0x00000004}, | ||
693 | {0x00c0007f, 0x00000008}, | ||
694 | {0x0000e570, 0x00000004}, | ||
695 | {0x0000e571, 0x00000004}, | ||
696 | {0x0000e572, 0x0000000c}, | ||
697 | {0x0000a000, 0x00000004}, | ||
698 | {0x0140a000, 0x00000004}, | ||
699 | {0x0000e568, 0x00000004}, | ||
700 | {0x000c2000, 0x00000004}, | ||
701 | {0x00000089, 0x00000018}, | ||
702 | {0x000b0000, 0x00000004}, | ||
703 | {0x18c0e562, 0x00000004}, | ||
704 | {0x0000008b, 0x00000008}, | ||
705 | {0x00c0008a, 0x00000008}, | ||
706 | {0x000700e4, 0x00000004}, | ||
707 | {0x00000097, 0x00000038}, | ||
708 | {0x000ca099, 0x00000030}, | ||
709 | {0x080045bb, 0x00000004}, | ||
710 | {0x000c209a, 0x00000030}, | ||
711 | {0x0800e5bc, 0000000000}, | ||
712 | {0x0000e5bb, 0x00000004}, | ||
713 | {0x0000e5bc, 0000000000}, | ||
714 | {0x00120000, 0x0000000c}, | ||
715 | {0x00120000, 0x00000004}, | ||
716 | {0x001b0002, 0x0000000c}, | ||
717 | {0x0000a000, 0x00000004}, | ||
718 | {0x0000e821, 0x00000004}, | ||
719 | {0x0000e800, 0000000000}, | ||
720 | {0x0000e821, 0x00000004}, | ||
721 | {0x0000e82e, 0000000000}, | ||
722 | {0x02cca000, 0x00000004}, | ||
723 | {0x00140000, 0x00000004}, | ||
724 | {0x000ce1cc, 0x00000004}, | ||
725 | {0x050de1cd, 0x00000004}, | ||
726 | {0x000000a7, 0x00000020}, | ||
727 | {0x4200e000, 0000000000}, | ||
728 | {0x000000ae, 0x00000038}, | ||
729 | {0x000ca000, 0x00000004}, | ||
730 | {0x00140000, 0x00000004}, | ||
731 | {0x000c2000, 0x00000004}, | ||
732 | {0x00160000, 0x00000004}, | ||
733 | {0x700ce000, 0x00000004}, | ||
734 | {0x001400aa, 0x00000008}, | ||
735 | {0x4000e000, 0000000000}, | ||
736 | {0x02400000, 0x00000004}, | ||
737 | {0x400ee000, 0x00000004}, | ||
738 | {0x02400000, 0x00000004}, | ||
739 | {0x4000e000, 0000000000}, | ||
740 | {0x000c2000, 0x00000004}, | ||
741 | {0x0240e51b, 0x00000004}, | ||
742 | {0x0080e50a, 0x00000005}, | ||
743 | {0x0080e50b, 0x00000005}, | ||
744 | {0x00220000, 0x00000004}, | ||
745 | {0x000700e4, 0x00000004}, | ||
746 | {0x000000c1, 0x00000038}, | ||
747 | {0x000c209a, 0x00000030}, | ||
748 | {0x0880e5bd, 0x00000005}, | ||
749 | {0x000c2099, 0x00000030}, | ||
750 | {0x0800e5bb, 0x00000005}, | ||
751 | {0x000c209a, 0x00000030}, | ||
752 | {0x0880e5bc, 0x00000005}, | ||
753 | {0x000000c4, 0x00000008}, | ||
754 | {0x0080e5bd, 0x00000005}, | ||
755 | {0x0000e5bb, 0x00000005}, | ||
756 | {0x0080e5bc, 0x00000005}, | ||
757 | {0x00210000, 0x00000004}, | ||
758 | {0x02800000, 0x00000004}, | ||
759 | {0x00c000c8, 0x00000018}, | ||
760 | {0x4180e000, 0x00000040}, | ||
761 | {0x000000ca, 0x00000024}, | ||
762 | {0x01000000, 0x0000000c}, | ||
763 | {0x0100e51d, 0x0000000c}, | ||
764 | {0x000045bb, 0x00000004}, | ||
765 | {0x000080c4, 0x00000008}, | ||
766 | {0x0000f3ce, 0x00000004}, | ||
767 | {0x0140a000, 0x00000004}, | ||
768 | {0x00cc2000, 0x00000004}, | ||
769 | {0x08c053cf, 0x00000040}, | ||
770 | {0x00008000, 0000000000}, | ||
771 | {0x0000f3d2, 0x00000004}, | ||
772 | {0x0140a000, 0x00000004}, | ||
773 | {0x00cc2000, 0x00000004}, | ||
774 | {0x08c053d3, 0x00000040}, | ||
775 | {0x00008000, 0000000000}, | ||
776 | {0x0000f39d, 0x00000004}, | ||
777 | {0x0140a000, 0x00000004}, | ||
778 | {0x00cc2000, 0x00000004}, | ||
779 | {0x08c0539e, 0x00000040}, | ||
780 | {0x00008000, 0000000000}, | ||
781 | {0x03c00830, 0x00000004}, | ||
782 | {0x4200e000, 0000000000}, | ||
783 | {0x0000a000, 0x00000004}, | ||
784 | {0x200045e0, 0x00000004}, | ||
785 | {0x0000e5e1, 0000000000}, | ||
786 | {0x00000001, 0000000000}, | ||
787 | {0x000700e1, 0x00000004}, | ||
788 | {0x0800e394, 0000000000}, | ||
789 | {0000000000, 0000000000}, | ||
790 | {0000000000, 0000000000}, | ||
791 | {0000000000, 0000000000}, | ||
792 | {0000000000, 0000000000}, | ||
793 | {0000000000, 0000000000}, | ||
794 | {0000000000, 0000000000}, | ||
795 | {0000000000, 0000000000}, | ||
796 | {0000000000, 0000000000}, | ||
797 | {0000000000, 0000000000}, | ||
798 | {0000000000, 0000000000}, | ||
799 | {0000000000, 0000000000}, | ||
800 | {0000000000, 0000000000}, | ||
801 | {0000000000, 0000000000}, | ||
802 | {0000000000, 0000000000}, | ||
803 | {0000000000, 0000000000}, | ||
804 | {0000000000, 0000000000}, | ||
805 | {0000000000, 0000000000}, | ||
806 | {0000000000, 0000000000}, | ||
807 | {0000000000, 0000000000}, | ||
808 | {0000000000, 0000000000}, | ||
809 | {0000000000, 0000000000}, | ||
810 | {0000000000, 0000000000}, | ||
811 | {0000000000, 0000000000}, | ||
812 | {0000000000, 0000000000}, | ||
813 | {0000000000, 0000000000}, | ||
814 | {0000000000, 0000000000}, | ||
815 | {0000000000, 0000000000}, | ||
816 | {0000000000, 0000000000}, | ||
817 | }; | ||
818 | |||
819 | static u32 RADEON_READ_MCIND(drm_radeon_private_t *dev_priv, int addr) | ||
820 | { | 45 | { |
821 | u32 ret; | 46 | u32 ret; |
822 | RADEON_WRITE(R520_MC_IND_INDEX, 0x7f0000 | (addr & 0xff)); | 47 | RADEON_WRITE(R520_MC_IND_INDEX, 0x7f0000 | (addr & 0xff)); |
@@ -825,21 +50,41 @@ static u32 RADEON_READ_MCIND(drm_radeon_private_t *dev_priv, int addr) | |||
825 | return ret; | 50 | return ret; |
826 | } | 51 | } |
827 | 52 | ||
53 | static u32 RS480_READ_MCIND(drm_radeon_private_t *dev_priv, int addr) | ||
54 | { | ||
55 | u32 ret; | ||
56 | RADEON_WRITE(RS480_NB_MC_INDEX, addr & 0xff); | ||
57 | ret = RADEON_READ(RS480_NB_MC_DATA); | ||
58 | RADEON_WRITE(RS480_NB_MC_INDEX, 0xff); | ||
59 | return ret; | ||
60 | } | ||
61 | |||
828 | static u32 RS690_READ_MCIND(drm_radeon_private_t *dev_priv, int addr) | 62 | static u32 RS690_READ_MCIND(drm_radeon_private_t *dev_priv, int addr) |
829 | { | 63 | { |
64 | u32 ret; | ||
830 | RADEON_WRITE(RS690_MC_INDEX, (addr & RS690_MC_INDEX_MASK)); | 65 | RADEON_WRITE(RS690_MC_INDEX, (addr & RS690_MC_INDEX_MASK)); |
831 | return RADEON_READ(RS690_MC_DATA); | 66 | ret = RADEON_READ(RS690_MC_DATA); |
67 | RADEON_WRITE(RS690_MC_INDEX, RS690_MC_INDEX_MASK); | ||
68 | return ret; | ||
69 | } | ||
70 | |||
71 | static u32 IGP_READ_MCIND(drm_radeon_private_t *dev_priv, int addr) | ||
72 | { | ||
73 | if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) | ||
74 | return RS690_READ_MCIND(dev_priv, addr); | ||
75 | else | ||
76 | return RS480_READ_MCIND(dev_priv, addr); | ||
832 | } | 77 | } |
833 | 78 | ||
834 | u32 radeon_read_fb_location(drm_radeon_private_t *dev_priv) | 79 | u32 radeon_read_fb_location(drm_radeon_private_t *dev_priv) |
835 | { | 80 | { |
836 | 81 | ||
837 | if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV515) | 82 | if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV515) |
838 | return RADEON_READ_MCIND(dev_priv, RV515_MC_FB_LOCATION); | 83 | return R500_READ_MCIND(dev_priv, RV515_MC_FB_LOCATION); |
839 | else if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) | 84 | else if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) |
840 | return RS690_READ_MCIND(dev_priv, RS690_MC_FB_LOCATION); | 85 | return RS690_READ_MCIND(dev_priv, RS690_MC_FB_LOCATION); |
841 | else if ((dev_priv->flags & RADEON_FAMILY_MASK) > CHIP_RV515) | 86 | else if ((dev_priv->flags & RADEON_FAMILY_MASK) > CHIP_RV515) |
842 | return RADEON_READ_MCIND(dev_priv, R520_MC_FB_LOCATION); | 87 | return R500_READ_MCIND(dev_priv, R520_MC_FB_LOCATION); |
843 | else | 88 | else |
844 | return RADEON_READ(RADEON_MC_FB_LOCATION); | 89 | return RADEON_READ(RADEON_MC_FB_LOCATION); |
845 | } | 90 | } |
@@ -847,11 +92,11 @@ u32 radeon_read_fb_location(drm_radeon_private_t *dev_priv) | |||
847 | static void radeon_write_fb_location(drm_radeon_private_t *dev_priv, u32 fb_loc) | 92 | static void radeon_write_fb_location(drm_radeon_private_t *dev_priv, u32 fb_loc) |
848 | { | 93 | { |
849 | if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV515) | 94 | if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV515) |
850 | RADEON_WRITE_MCIND(RV515_MC_FB_LOCATION, fb_loc); | 95 | R500_WRITE_MCIND(RV515_MC_FB_LOCATION, fb_loc); |
851 | else if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) | 96 | else if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) |
852 | RS690_WRITE_MCIND(RS690_MC_FB_LOCATION, fb_loc); | 97 | RS690_WRITE_MCIND(RS690_MC_FB_LOCATION, fb_loc); |
853 | else if ((dev_priv->flags & RADEON_FAMILY_MASK) > CHIP_RV515) | 98 | else if ((dev_priv->flags & RADEON_FAMILY_MASK) > CHIP_RV515) |
854 | RADEON_WRITE_MCIND(R520_MC_FB_LOCATION, fb_loc); | 99 | R500_WRITE_MCIND(R520_MC_FB_LOCATION, fb_loc); |
855 | else | 100 | else |
856 | RADEON_WRITE(RADEON_MC_FB_LOCATION, fb_loc); | 101 | RADEON_WRITE(RADEON_MC_FB_LOCATION, fb_loc); |
857 | } | 102 | } |
@@ -859,15 +104,39 @@ static void radeon_write_fb_location(drm_radeon_private_t *dev_priv, u32 fb_loc) | |||
859 | static void radeon_write_agp_location(drm_radeon_private_t *dev_priv, u32 agp_loc) | 104 | static void radeon_write_agp_location(drm_radeon_private_t *dev_priv, u32 agp_loc) |
860 | { | 105 | { |
861 | if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV515) | 106 | if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV515) |
862 | RADEON_WRITE_MCIND(RV515_MC_AGP_LOCATION, agp_loc); | 107 | R500_WRITE_MCIND(RV515_MC_AGP_LOCATION, agp_loc); |
863 | else if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) | 108 | else if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) |
864 | RS690_WRITE_MCIND(RS690_MC_AGP_LOCATION, agp_loc); | 109 | RS690_WRITE_MCIND(RS690_MC_AGP_LOCATION, agp_loc); |
865 | else if ((dev_priv->flags & RADEON_FAMILY_MASK) > CHIP_RV515) | 110 | else if ((dev_priv->flags & RADEON_FAMILY_MASK) > CHIP_RV515) |
866 | RADEON_WRITE_MCIND(R520_MC_AGP_LOCATION, agp_loc); | 111 | R500_WRITE_MCIND(R520_MC_AGP_LOCATION, agp_loc); |
867 | else | 112 | else |
868 | RADEON_WRITE(RADEON_MC_AGP_LOCATION, agp_loc); | 113 | RADEON_WRITE(RADEON_MC_AGP_LOCATION, agp_loc); |
869 | } | 114 | } |
870 | 115 | ||
116 | static void radeon_write_agp_base(drm_radeon_private_t *dev_priv, u64 agp_base) | ||
117 | { | ||
118 | u32 agp_base_hi = upper_32_bits(agp_base); | ||
119 | u32 agp_base_lo = agp_base & 0xffffffff; | ||
120 | |||
121 | if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV515) { | ||
122 | R500_WRITE_MCIND(RV515_MC_AGP_BASE, agp_base_lo); | ||
123 | R500_WRITE_MCIND(RV515_MC_AGP_BASE_2, agp_base_hi); | ||
124 | } else if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) { | ||
125 | RS690_WRITE_MCIND(RS690_MC_AGP_BASE, agp_base_lo); | ||
126 | RS690_WRITE_MCIND(RS690_MC_AGP_BASE_2, agp_base_hi); | ||
127 | } else if ((dev_priv->flags & RADEON_FAMILY_MASK) > CHIP_RV515) { | ||
128 | R500_WRITE_MCIND(R520_MC_AGP_BASE, agp_base_lo); | ||
129 | R500_WRITE_MCIND(R520_MC_AGP_BASE_2, agp_base_hi); | ||
130 | } else if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS480) { | ||
131 | RADEON_WRITE(RADEON_AGP_BASE, agp_base_lo); | ||
132 | RADEON_WRITE(RS480_AGP_BASE_2, 0); | ||
133 | } else { | ||
134 | RADEON_WRITE(RADEON_AGP_BASE, agp_base_lo); | ||
135 | if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R200) | ||
136 | RADEON_WRITE(RADEON_AGP_BASE_2, agp_base_hi); | ||
137 | } | ||
138 | } | ||
139 | |||
871 | static int RADEON_READ_PLL(struct drm_device * dev, int addr) | 140 | static int RADEON_READ_PLL(struct drm_device * dev, int addr) |
872 | { | 141 | { |
873 | drm_radeon_private_t *dev_priv = dev->dev_private; | 142 | drm_radeon_private_t *dev_priv = dev->dev_private; |
@@ -882,15 +151,6 @@ static u32 RADEON_READ_PCIE(drm_radeon_private_t *dev_priv, int addr) | |||
882 | return RADEON_READ(RADEON_PCIE_DATA); | 151 | return RADEON_READ(RADEON_PCIE_DATA); |
883 | } | 152 | } |
884 | 153 | ||
885 | static u32 RADEON_READ_IGPGART(drm_radeon_private_t *dev_priv, int addr) | ||
886 | { | ||
887 | u32 ret; | ||
888 | RADEON_WRITE(RADEON_IGPGART_INDEX, addr & 0x7f); | ||
889 | ret = RADEON_READ(RADEON_IGPGART_DATA); | ||
890 | RADEON_WRITE(RADEON_IGPGART_INDEX, 0x7f); | ||
891 | return ret; | ||
892 | } | ||
893 | |||
894 | #if RADEON_FIFO_DEBUG | 154 | #if RADEON_FIFO_DEBUG |
895 | static void radeon_status(drm_radeon_private_t * dev_priv) | 155 | static void radeon_status(drm_radeon_private_t * dev_priv) |
896 | { | 156 | { |
@@ -925,16 +185,36 @@ static int radeon_do_pixcache_flush(drm_radeon_private_t * dev_priv) | |||
925 | 185 | ||
926 | dev_priv->stats.boxes |= RADEON_BOX_WAIT_IDLE; | 186 | dev_priv->stats.boxes |= RADEON_BOX_WAIT_IDLE; |
927 | 187 | ||
928 | tmp = RADEON_READ(RADEON_RB3D_DSTCACHE_CTLSTAT); | 188 | if ((dev_priv->flags & RADEON_FAMILY_MASK) <= CHIP_RV280) { |
929 | tmp |= RADEON_RB3D_DC_FLUSH_ALL; | 189 | tmp = RADEON_READ(RADEON_RB3D_DSTCACHE_CTLSTAT); |
930 | RADEON_WRITE(RADEON_RB3D_DSTCACHE_CTLSTAT, tmp); | 190 | tmp |= RADEON_RB3D_DC_FLUSH_ALL; |
191 | RADEON_WRITE(RADEON_RB3D_DSTCACHE_CTLSTAT, tmp); | ||
931 | 192 | ||
932 | for (i = 0; i < dev_priv->usec_timeout; i++) { | 193 | for (i = 0; i < dev_priv->usec_timeout; i++) { |
933 | if (!(RADEON_READ(RADEON_RB3D_DSTCACHE_CTLSTAT) | 194 | if (!(RADEON_READ(RADEON_RB3D_DSTCACHE_CTLSTAT) |
934 | & RADEON_RB3D_DC_BUSY)) { | 195 | & RADEON_RB3D_DC_BUSY)) { |
935 | return 0; | 196 | return 0; |
197 | } | ||
198 | DRM_UDELAY(1); | ||
199 | } | ||
200 | } else { | ||
201 | /* 3D */ | ||
202 | tmp = RADEON_READ(R300_RB3D_DSTCACHE_CTLSTAT); | ||
203 | tmp |= RADEON_RB3D_DC_FLUSH_ALL; | ||
204 | RADEON_WRITE(R300_RB3D_DSTCACHE_CTLSTAT, tmp); | ||
205 | |||
206 | /* 2D */ | ||
207 | tmp = RADEON_READ(R300_DSTCACHE_CTLSTAT); | ||
208 | tmp |= RADEON_RB3D_DC_FLUSH_ALL; | ||
209 | RADEON_WRITE(R300_DSTCACHE_CTLSTAT, tmp); | ||
210 | |||
211 | for (i = 0; i < dev_priv->usec_timeout; i++) { | ||
212 | if (!(RADEON_READ(R300_DSTCACHE_CTLSTAT) | ||
213 | & RADEON_RB3D_DC_BUSY)) { | ||
214 | return 0; | ||
215 | } | ||
216 | DRM_UDELAY(1); | ||
936 | } | 217 | } |
937 | DRM_UDELAY(1); | ||
938 | } | 218 | } |
939 | 219 | ||
940 | #if RADEON_FIFO_DEBUG | 220 | #if RADEON_FIFO_DEBUG |
@@ -991,6 +271,50 @@ static int radeon_do_wait_for_idle(drm_radeon_private_t * dev_priv) | |||
991 | return -EBUSY; | 271 | return -EBUSY; |
992 | } | 272 | } |
993 | 273 | ||
274 | static void radeon_init_pipes(drm_radeon_private_t *dev_priv) | ||
275 | { | ||
276 | uint32_t gb_tile_config, gb_pipe_sel = 0; | ||
277 | |||
278 | /* RS4xx/RS6xx/R4xx/R5xx */ | ||
279 | if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R420) { | ||
280 | gb_pipe_sel = RADEON_READ(R400_GB_PIPE_SELECT); | ||
281 | dev_priv->num_gb_pipes = ((gb_pipe_sel >> 12) & 0x3) + 1; | ||
282 | } else { | ||
283 | /* R3xx */ | ||
284 | if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_R300) || | ||
285 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_R350)) { | ||
286 | dev_priv->num_gb_pipes = 2; | ||
287 | } else { | ||
288 | /* R3Vxx */ | ||
289 | dev_priv->num_gb_pipes = 1; | ||
290 | } | ||
291 | } | ||
292 | DRM_INFO("Num pipes: %d\n", dev_priv->num_gb_pipes); | ||
293 | |||
294 | gb_tile_config = (R300_ENABLE_TILING | R300_TILE_SIZE_16 /*| R300_SUBPIXEL_1_16*/); | ||
295 | |||
296 | switch (dev_priv->num_gb_pipes) { | ||
297 | case 2: gb_tile_config |= R300_PIPE_COUNT_R300; break; | ||
298 | case 3: gb_tile_config |= R300_PIPE_COUNT_R420_3P; break; | ||
299 | case 4: gb_tile_config |= R300_PIPE_COUNT_R420; break; | ||
300 | default: | ||
301 | case 1: gb_tile_config |= R300_PIPE_COUNT_RV350; break; | ||
302 | } | ||
303 | |||
304 | if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_RV515) { | ||
305 | RADEON_WRITE_PLL(R500_DYN_SCLK_PWMEM_PIPE, (1 | ((gb_pipe_sel >> 8) & 0xf) << 4)); | ||
306 | RADEON_WRITE(R500_SU_REG_DEST, ((1 << dev_priv->num_gb_pipes) - 1)); | ||
307 | } | ||
308 | RADEON_WRITE(R300_GB_TILE_CONFIG, gb_tile_config); | ||
309 | radeon_do_wait_for_idle(dev_priv); | ||
310 | RADEON_WRITE(R300_DST_PIPE_CONFIG, RADEON_READ(R300_DST_PIPE_CONFIG) | R300_PIPE_AUTO_CONFIG); | ||
311 | RADEON_WRITE(R300_RB2D_DSTCACHE_MODE, (RADEON_READ(R300_RB2D_DSTCACHE_MODE) | | ||
312 | R300_DC_AUTOFLUSH_ENABLE | | ||
313 | R300_DC_DC_DISABLE_IGNORE_PE)); | ||
314 | |||
315 | |||
316 | } | ||
317 | |||
994 | /* ================================================================ | 318 | /* ================================================================ |
995 | * CP control, initialization | 319 | * CP control, initialization |
996 | */ | 320 | */ |
@@ -1004,8 +328,22 @@ static void radeon_cp_load_microcode(drm_radeon_private_t * dev_priv) | |||
1004 | radeon_do_wait_for_idle(dev_priv); | 328 | radeon_do_wait_for_idle(dev_priv); |
1005 | 329 | ||
1006 | RADEON_WRITE(RADEON_CP_ME_RAM_ADDR, 0); | 330 | RADEON_WRITE(RADEON_CP_ME_RAM_ADDR, 0); |
1007 | 331 | if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_R100) || | |
1008 | if (dev_priv->microcode_version == UCODE_R200) { | 332 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV100) || |
333 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV200) || | ||
334 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS100) || | ||
335 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS200)) { | ||
336 | DRM_INFO("Loading R100 Microcode\n"); | ||
337 | for (i = 0; i < 256; i++) { | ||
338 | RADEON_WRITE(RADEON_CP_ME_RAM_DATAH, | ||
339 | R100_cp_microcode[i][1]); | ||
340 | RADEON_WRITE(RADEON_CP_ME_RAM_DATAL, | ||
341 | R100_cp_microcode[i][0]); | ||
342 | } | ||
343 | } else if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_R200) || | ||
344 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV250) || | ||
345 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV280) || | ||
346 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS300)) { | ||
1009 | DRM_INFO("Loading R200 Microcode\n"); | 347 | DRM_INFO("Loading R200 Microcode\n"); |
1010 | for (i = 0; i < 256; i++) { | 348 | for (i = 0; i < 256; i++) { |
1011 | RADEON_WRITE(RADEON_CP_ME_RAM_DATAH, | 349 | RADEON_WRITE(RADEON_CP_ME_RAM_DATAH, |
@@ -1013,7 +351,11 @@ static void radeon_cp_load_microcode(drm_radeon_private_t * dev_priv) | |||
1013 | RADEON_WRITE(RADEON_CP_ME_RAM_DATAL, | 351 | RADEON_WRITE(RADEON_CP_ME_RAM_DATAL, |
1014 | R200_cp_microcode[i][0]); | 352 | R200_cp_microcode[i][0]); |
1015 | } | 353 | } |
1016 | } else if (dev_priv->microcode_version == UCODE_R300) { | 354 | } else if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_R300) || |
355 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_R350) || | ||
356 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV350) || | ||
357 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV380) || | ||
358 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS480)) { | ||
1017 | DRM_INFO("Loading R300 Microcode\n"); | 359 | DRM_INFO("Loading R300 Microcode\n"); |
1018 | for (i = 0; i < 256; i++) { | 360 | for (i = 0; i < 256; i++) { |
1019 | RADEON_WRITE(RADEON_CP_ME_RAM_DATAH, | 361 | RADEON_WRITE(RADEON_CP_ME_RAM_DATAH, |
@@ -1021,12 +363,35 @@ static void radeon_cp_load_microcode(drm_radeon_private_t * dev_priv) | |||
1021 | RADEON_WRITE(RADEON_CP_ME_RAM_DATAL, | 363 | RADEON_WRITE(RADEON_CP_ME_RAM_DATAL, |
1022 | R300_cp_microcode[i][0]); | 364 | R300_cp_microcode[i][0]); |
1023 | } | 365 | } |
1024 | } else { | 366 | } else if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_R420) || |
367 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV410)) { | ||
368 | DRM_INFO("Loading R400 Microcode\n"); | ||
1025 | for (i = 0; i < 256; i++) { | 369 | for (i = 0; i < 256; i++) { |
1026 | RADEON_WRITE(RADEON_CP_ME_RAM_DATAH, | 370 | RADEON_WRITE(RADEON_CP_ME_RAM_DATAH, |
1027 | radeon_cp_microcode[i][1]); | 371 | R420_cp_microcode[i][1]); |
1028 | RADEON_WRITE(RADEON_CP_ME_RAM_DATAL, | 372 | RADEON_WRITE(RADEON_CP_ME_RAM_DATAL, |
1029 | radeon_cp_microcode[i][0]); | 373 | R420_cp_microcode[i][0]); |
374 | } | ||
375 | } else if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) { | ||
376 | DRM_INFO("Loading RS690 Microcode\n"); | ||
377 | for (i = 0; i < 256; i++) { | ||
378 | RADEON_WRITE(RADEON_CP_ME_RAM_DATAH, | ||
379 | RS690_cp_microcode[i][1]); | ||
380 | RADEON_WRITE(RADEON_CP_ME_RAM_DATAL, | ||
381 | RS690_cp_microcode[i][0]); | ||
382 | } | ||
383 | } else if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV515) || | ||
384 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_R520) || | ||
385 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV530) || | ||
386 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_R580) || | ||
387 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV560) || | ||
388 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV570)) { | ||
389 | DRM_INFO("Loading R500 Microcode\n"); | ||
390 | for (i = 0; i < 256; i++) { | ||
391 | RADEON_WRITE(RADEON_CP_ME_RAM_DATAH, | ||
392 | R520_cp_microcode[i][1]); | ||
393 | RADEON_WRITE(RADEON_CP_ME_RAM_DATAL, | ||
394 | R520_cp_microcode[i][0]); | ||
1030 | } | 395 | } |
1031 | } | 396 | } |
1032 | } | 397 | } |
@@ -1121,12 +486,13 @@ static void radeon_do_cp_stop(drm_radeon_private_t * dev_priv) | |||
1121 | static int radeon_do_engine_reset(struct drm_device * dev) | 486 | static int radeon_do_engine_reset(struct drm_device * dev) |
1122 | { | 487 | { |
1123 | drm_radeon_private_t *dev_priv = dev->dev_private; | 488 | drm_radeon_private_t *dev_priv = dev->dev_private; |
1124 | u32 clock_cntl_index, mclk_cntl, rbbm_soft_reset; | 489 | u32 clock_cntl_index = 0, mclk_cntl = 0, rbbm_soft_reset; |
1125 | DRM_DEBUG("\n"); | 490 | DRM_DEBUG("\n"); |
1126 | 491 | ||
1127 | radeon_do_pixcache_flush(dev_priv); | 492 | radeon_do_pixcache_flush(dev_priv); |
1128 | 493 | ||
1129 | if ((dev_priv->flags & RADEON_FAMILY_MASK) < CHIP_RV515) { | 494 | if ((dev_priv->flags & RADEON_FAMILY_MASK) <= CHIP_RV410) { |
495 | /* may need something similar for newer chips */ | ||
1130 | clock_cntl_index = RADEON_READ(RADEON_CLOCK_CNTL_INDEX); | 496 | clock_cntl_index = RADEON_READ(RADEON_CLOCK_CNTL_INDEX); |
1131 | mclk_cntl = RADEON_READ_PLL(dev, RADEON_MCLK_CNTL); | 497 | mclk_cntl = RADEON_READ_PLL(dev, RADEON_MCLK_CNTL); |
1132 | 498 | ||
@@ -1137,33 +503,39 @@ static int radeon_do_engine_reset(struct drm_device * dev) | |||
1137 | RADEON_FORCEON_YCLKB | | 503 | RADEON_FORCEON_YCLKB | |
1138 | RADEON_FORCEON_MC | | 504 | RADEON_FORCEON_MC | |
1139 | RADEON_FORCEON_AIC)); | 505 | RADEON_FORCEON_AIC)); |
506 | } | ||
1140 | 507 | ||
1141 | rbbm_soft_reset = RADEON_READ(RADEON_RBBM_SOFT_RESET); | 508 | rbbm_soft_reset = RADEON_READ(RADEON_RBBM_SOFT_RESET); |
1142 | 509 | ||
1143 | RADEON_WRITE(RADEON_RBBM_SOFT_RESET, (rbbm_soft_reset | | 510 | RADEON_WRITE(RADEON_RBBM_SOFT_RESET, (rbbm_soft_reset | |
1144 | RADEON_SOFT_RESET_CP | | 511 | RADEON_SOFT_RESET_CP | |
1145 | RADEON_SOFT_RESET_HI | | 512 | RADEON_SOFT_RESET_HI | |
1146 | RADEON_SOFT_RESET_SE | | 513 | RADEON_SOFT_RESET_SE | |
1147 | RADEON_SOFT_RESET_RE | | 514 | RADEON_SOFT_RESET_RE | |
1148 | RADEON_SOFT_RESET_PP | | 515 | RADEON_SOFT_RESET_PP | |
1149 | RADEON_SOFT_RESET_E2 | | 516 | RADEON_SOFT_RESET_E2 | |
1150 | RADEON_SOFT_RESET_RB)); | 517 | RADEON_SOFT_RESET_RB)); |
1151 | RADEON_READ(RADEON_RBBM_SOFT_RESET); | 518 | RADEON_READ(RADEON_RBBM_SOFT_RESET); |
1152 | RADEON_WRITE(RADEON_RBBM_SOFT_RESET, (rbbm_soft_reset & | 519 | RADEON_WRITE(RADEON_RBBM_SOFT_RESET, (rbbm_soft_reset & |
1153 | ~(RADEON_SOFT_RESET_CP | | 520 | ~(RADEON_SOFT_RESET_CP | |
1154 | RADEON_SOFT_RESET_HI | | 521 | RADEON_SOFT_RESET_HI | |
1155 | RADEON_SOFT_RESET_SE | | 522 | RADEON_SOFT_RESET_SE | |
1156 | RADEON_SOFT_RESET_RE | | 523 | RADEON_SOFT_RESET_RE | |
1157 | RADEON_SOFT_RESET_PP | | 524 | RADEON_SOFT_RESET_PP | |
1158 | RADEON_SOFT_RESET_E2 | | 525 | RADEON_SOFT_RESET_E2 | |
1159 | RADEON_SOFT_RESET_RB))); | 526 | RADEON_SOFT_RESET_RB))); |
1160 | RADEON_READ(RADEON_RBBM_SOFT_RESET); | 527 | RADEON_READ(RADEON_RBBM_SOFT_RESET); |
1161 | 528 | ||
529 | if ((dev_priv->flags & RADEON_FAMILY_MASK) <= CHIP_RV410) { | ||
1162 | RADEON_WRITE_PLL(RADEON_MCLK_CNTL, mclk_cntl); | 530 | RADEON_WRITE_PLL(RADEON_MCLK_CNTL, mclk_cntl); |
1163 | RADEON_WRITE(RADEON_CLOCK_CNTL_INDEX, clock_cntl_index); | 531 | RADEON_WRITE(RADEON_CLOCK_CNTL_INDEX, clock_cntl_index); |
1164 | RADEON_WRITE(RADEON_RBBM_SOFT_RESET, rbbm_soft_reset); | 532 | RADEON_WRITE(RADEON_RBBM_SOFT_RESET, rbbm_soft_reset); |
1165 | } | 533 | } |
1166 | 534 | ||
535 | /* setup the raster pipes */ | ||
536 | if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R300) | ||
537 | radeon_init_pipes(dev_priv); | ||
538 | |||
1167 | /* Reset the CP ring */ | 539 | /* Reset the CP ring */ |
1168 | radeon_do_cp_reset(dev_priv); | 540 | radeon_do_cp_reset(dev_priv); |
1169 | 541 | ||
@@ -1194,7 +566,8 @@ static void radeon_cp_init_ring_buffer(struct drm_device * dev, | |||
1194 | 566 | ||
1195 | #if __OS_HAS_AGP | 567 | #if __OS_HAS_AGP |
1196 | if (dev_priv->flags & RADEON_IS_AGP) { | 568 | if (dev_priv->flags & RADEON_IS_AGP) { |
1197 | RADEON_WRITE(RADEON_AGP_BASE, (unsigned int)dev->agp->base); | 569 | radeon_write_agp_base(dev_priv, dev->agp->base); |
570 | |||
1198 | radeon_write_agp_location(dev_priv, | 571 | radeon_write_agp_location(dev_priv, |
1199 | (((dev_priv->gart_vm_start - 1 + | 572 | (((dev_priv->gart_vm_start - 1 + |
1200 | dev_priv->gart_size) & 0xffff0000) | | 573 | dev_priv->gart_size) & 0xffff0000) | |
@@ -1339,102 +712,70 @@ static void radeon_test_writeback(drm_radeon_private_t * dev_priv) | |||
1339 | /* Enable or disable IGP GART on the chip */ | 712 | /* Enable or disable IGP GART on the chip */ |
1340 | static void radeon_set_igpgart(drm_radeon_private_t * dev_priv, int on) | 713 | static void radeon_set_igpgart(drm_radeon_private_t * dev_priv, int on) |
1341 | { | 714 | { |
1342 | u32 temp, tmp; | ||
1343 | |||
1344 | tmp = RADEON_READ(RADEON_AIC_CNTL); | ||
1345 | if (on) { | ||
1346 | DRM_DEBUG("programming igpgart %08X %08lX %08X\n", | ||
1347 | dev_priv->gart_vm_start, | ||
1348 | (long)dev_priv->gart_info.bus_addr, | ||
1349 | dev_priv->gart_size); | ||
1350 | |||
1351 | RADEON_WRITE_IGPGART(RADEON_IGPGART_UNK_18, 0x1000); | ||
1352 | RADEON_WRITE_IGPGART(RADEON_IGPGART_ENABLE, 0x1); | ||
1353 | RADEON_WRITE_IGPGART(RADEON_IGPGART_CTRL, 0x42040800); | ||
1354 | RADEON_WRITE_IGPGART(RADEON_IGPGART_BASE_ADDR, | ||
1355 | dev_priv->gart_info.bus_addr); | ||
1356 | |||
1357 | temp = RADEON_READ_IGPGART(dev_priv, RADEON_IGPGART_UNK_39); | ||
1358 | RADEON_WRITE_IGPGART(RADEON_IGPGART_UNK_39, temp); | ||
1359 | |||
1360 | RADEON_WRITE(RADEON_AGP_BASE, (unsigned int)dev_priv->gart_vm_start); | ||
1361 | dev_priv->gart_size = 32*1024*1024; | ||
1362 | radeon_write_agp_location(dev_priv, | ||
1363 | (((dev_priv->gart_vm_start - 1 + | ||
1364 | dev_priv->gart_size) & 0xffff0000) | | ||
1365 | (dev_priv->gart_vm_start >> 16))); | ||
1366 | |||
1367 | temp = RADEON_READ_IGPGART(dev_priv, RADEON_IGPGART_ENABLE); | ||
1368 | RADEON_WRITE_IGPGART(RADEON_IGPGART_ENABLE, temp); | ||
1369 | |||
1370 | RADEON_READ_IGPGART(dev_priv, RADEON_IGPGART_FLUSH); | ||
1371 | RADEON_WRITE_IGPGART(RADEON_IGPGART_FLUSH, 0x1); | ||
1372 | RADEON_READ_IGPGART(dev_priv, RADEON_IGPGART_FLUSH); | ||
1373 | RADEON_WRITE_IGPGART(RADEON_IGPGART_FLUSH, 0x0); | ||
1374 | } | ||
1375 | } | ||
1376 | |||
1377 | /* Enable or disable RS690 GART on the chip */ | ||
1378 | static void radeon_set_rs690gart(drm_radeon_private_t *dev_priv, int on) | ||
1379 | { | ||
1380 | u32 temp; | 715 | u32 temp; |
1381 | 716 | ||
1382 | if (on) { | 717 | if (on) { |
1383 | DRM_DEBUG("programming rs690 gart %08X %08lX %08X\n", | 718 | DRM_DEBUG("programming igp gart %08X %08lX %08X\n", |
1384 | dev_priv->gart_vm_start, | 719 | dev_priv->gart_vm_start, |
1385 | (long)dev_priv->gart_info.bus_addr, | 720 | (long)dev_priv->gart_info.bus_addr, |
1386 | dev_priv->gart_size); | 721 | dev_priv->gart_size); |
1387 | 722 | ||
1388 | temp = RS690_READ_MCIND(dev_priv, RS690_MC_MISC_CNTL); | 723 | temp = IGP_READ_MCIND(dev_priv, RS480_MC_MISC_CNTL); |
1389 | RS690_WRITE_MCIND(RS690_MC_MISC_CNTL, 0x5000); | 724 | if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) |
725 | IGP_WRITE_MCIND(RS480_MC_MISC_CNTL, (RS480_GART_INDEX_REG_EN | | ||
726 | RS690_BLOCK_GFX_D3_EN)); | ||
727 | else | ||
728 | IGP_WRITE_MCIND(RS480_MC_MISC_CNTL, RS480_GART_INDEX_REG_EN); | ||
1390 | 729 | ||
1391 | RS690_WRITE_MCIND(RS690_MC_AGP_SIZE, | 730 | IGP_WRITE_MCIND(RS480_AGP_ADDRESS_SPACE_SIZE, (RS480_GART_EN | |
1392 | RS690_MC_GART_EN | RS690_MC_AGP_SIZE_32MB); | 731 | RS480_VA_SIZE_32MB)); |
1393 | 732 | ||
1394 | temp = RS690_READ_MCIND(dev_priv, RS690_MC_GART_FEATURE_ID); | 733 | temp = IGP_READ_MCIND(dev_priv, RS480_GART_FEATURE_ID); |
1395 | RS690_WRITE_MCIND(RS690_MC_GART_FEATURE_ID, 0x42040800); | 734 | IGP_WRITE_MCIND(RS480_GART_FEATURE_ID, (RS480_HANG_EN | |
735 | RS480_TLB_ENABLE | | ||
736 | RS480_GTW_LAC_EN | | ||
737 | RS480_1LEVEL_GART)); | ||
1396 | 738 | ||
1397 | RS690_WRITE_MCIND(RS690_MC_GART_BASE, | 739 | temp = dev_priv->gart_info.bus_addr & 0xfffff000; |
1398 | dev_priv->gart_info.bus_addr); | 740 | temp |= (upper_32_bits(dev_priv->gart_info.bus_addr) & 0xff) << 4; |
741 | IGP_WRITE_MCIND(RS480_GART_BASE, temp); | ||
1399 | 742 | ||
1400 | temp = RS690_READ_MCIND(dev_priv, RS690_MC_AGP_MODE_CONTROL); | 743 | temp = IGP_READ_MCIND(dev_priv, RS480_AGP_MODE_CNTL); |
1401 | RS690_WRITE_MCIND(RS690_MC_AGP_MODE_CONTROL, 0x01400000); | 744 | IGP_WRITE_MCIND(RS480_AGP_MODE_CNTL, ((1 << RS480_REQ_TYPE_SNOOP_SHIFT) | |
745 | RS480_REQ_TYPE_SNOOP_DIS)); | ||
1402 | 746 | ||
1403 | RS690_WRITE_MCIND(RS690_MC_AGP_BASE, | 747 | radeon_write_agp_base(dev_priv, dev_priv->gart_vm_start); |
1404 | (unsigned int)dev_priv->gart_vm_start); | ||
1405 | 748 | ||
1406 | dev_priv->gart_size = 32*1024*1024; | 749 | dev_priv->gart_size = 32*1024*1024; |
1407 | temp = (((dev_priv->gart_vm_start - 1 + dev_priv->gart_size) & | 750 | temp = (((dev_priv->gart_vm_start - 1 + dev_priv->gart_size) & |
1408 | 0xffff0000) | (dev_priv->gart_vm_start >> 16)); | 751 | 0xffff0000) | (dev_priv->gart_vm_start >> 16)); |
1409 | 752 | ||
1410 | RS690_WRITE_MCIND(RS690_MC_AGP_LOCATION, temp); | 753 | radeon_write_agp_location(dev_priv, temp); |
1411 | 754 | ||
1412 | temp = RS690_READ_MCIND(dev_priv, RS690_MC_AGP_SIZE); | 755 | temp = IGP_READ_MCIND(dev_priv, RS480_AGP_ADDRESS_SPACE_SIZE); |
1413 | RS690_WRITE_MCIND(RS690_MC_AGP_SIZE, | 756 | IGP_WRITE_MCIND(RS480_AGP_ADDRESS_SPACE_SIZE, (RS480_GART_EN | |
1414 | RS690_MC_GART_EN | RS690_MC_AGP_SIZE_32MB); | 757 | RS480_VA_SIZE_32MB)); |
1415 | 758 | ||
1416 | do { | 759 | do { |
1417 | temp = RS690_READ_MCIND(dev_priv, RS690_MC_GART_CACHE_CNTL); | 760 | temp = IGP_READ_MCIND(dev_priv, RS480_GART_CACHE_CNTRL); |
1418 | if ((temp & RS690_MC_GART_CLEAR_STATUS) == | 761 | if ((temp & RS480_GART_CACHE_INVALIDATE) == 0) |
1419 | RS690_MC_GART_CLEAR_DONE) | ||
1420 | break; | 762 | break; |
1421 | DRM_UDELAY(1); | 763 | DRM_UDELAY(1); |
1422 | } while (1); | 764 | } while (1); |
1423 | 765 | ||
1424 | RS690_WRITE_MCIND(RS690_MC_GART_CACHE_CNTL, | 766 | IGP_WRITE_MCIND(RS480_GART_CACHE_CNTRL, |
1425 | RS690_MC_GART_CC_CLEAR); | 767 | RS480_GART_CACHE_INVALIDATE); |
768 | |||
1426 | do { | 769 | do { |
1427 | temp = RS690_READ_MCIND(dev_priv, RS690_MC_GART_CACHE_CNTL); | 770 | temp = IGP_READ_MCIND(dev_priv, RS480_GART_CACHE_CNTRL); |
1428 | if ((temp & RS690_MC_GART_CLEAR_STATUS) == | 771 | if ((temp & RS480_GART_CACHE_INVALIDATE) == 0) |
1429 | RS690_MC_GART_CLEAR_DONE) | ||
1430 | break; | 772 | break; |
1431 | DRM_UDELAY(1); | 773 | DRM_UDELAY(1); |
1432 | } while (1); | 774 | } while (1); |
1433 | 775 | ||
1434 | RS690_WRITE_MCIND(RS690_MC_GART_CACHE_CNTL, | 776 | IGP_WRITE_MCIND(RS480_GART_CACHE_CNTRL, 0); |
1435 | RS690_MC_GART_CC_NO_CHANGE); | ||
1436 | } else { | 777 | } else { |
1437 | RS690_WRITE_MCIND(RS690_MC_AGP_SIZE, RS690_MC_GART_DIS); | 778 | IGP_WRITE_MCIND(RS480_AGP_ADDRESS_SPACE_SIZE, 0); |
1438 | } | 779 | } |
1439 | } | 780 | } |
1440 | 781 | ||
@@ -1472,12 +813,8 @@ static void radeon_set_pcigart(drm_radeon_private_t * dev_priv, int on) | |||
1472 | { | 813 | { |
1473 | u32 tmp; | 814 | u32 tmp; |
1474 | 815 | ||
1475 | if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) { | 816 | if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) || |
1476 | radeon_set_rs690gart(dev_priv, on); | 817 | (dev_priv->flags & RADEON_IS_IGPGART)) { |
1477 | return; | ||
1478 | } | ||
1479 | |||
1480 | if (dev_priv->flags & RADEON_IS_IGPGART) { | ||
1481 | radeon_set_igpgart(dev_priv, on); | 818 | radeon_set_igpgart(dev_priv, on); |
1482 | return; | 819 | return; |
1483 | } | 820 | } |
@@ -1951,6 +1288,7 @@ static int radeon_do_resume_cp(struct drm_device * dev) | |||
1951 | radeon_cp_init_ring_buffer(dev, dev_priv); | 1288 | radeon_cp_init_ring_buffer(dev, dev_priv); |
1952 | 1289 | ||
1953 | radeon_do_engine_reset(dev); | 1290 | radeon_do_engine_reset(dev); |
1291 | radeon_enable_interrupt(dev); | ||
1954 | 1292 | ||
1955 | DRM_DEBUG("radeon_do_resume_cp() complete\n"); | 1293 | DRM_DEBUG("radeon_do_resume_cp() complete\n"); |
1956 | 1294 | ||