blob: ff1cc58920c0b45e517d8d6d8906670510747d1c [file] [log] [blame]
Jerome Glisse771fe6b2009-06-05 14:42:42 +02001/*
2 * Copyright 2008 Advanced Micro Devices, Inc.
3 * Copyright 2008 Red Hat Inc.
4 * Copyright 2009 Jerome Glisse.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 * OTHER DEALINGS IN THE SOFTWARE.
23 *
24 * Authors: Dave Airlie
25 * Alex Deucher
26 * Jerome Glisse
27 */
Jerome Glisse3ce0a232009-09-08 10:10:24 +100028#include <linux/firmware.h>
29#include <linux/platform_device.h>
Tejun Heo5a0e3ad2010-03-24 17:04:11 +090030#include <linux/slab.h>
Jerome Glisse771fe6b2009-06-05 14:42:42 +020031#include "drmP.h"
Jerome Glisse771fe6b2009-06-05 14:42:42 +020032#include "radeon.h"
Daniel Vettere6990372010-03-11 21:19:17 +000033#include "radeon_asic.h"
Dave Airlie4153e582009-09-18 18:41:24 +100034#include "radeon_drm.h"
Jerome Glisse3ce0a232009-09-08 10:10:24 +100035#include "rv770d.h"
Jerome Glisse3ce0a232009-09-08 10:10:24 +100036#include "atom.h"
Jerome Glissed39c3b82009-09-28 18:34:43 +020037#include "avivod.h"
Jerome Glisse771fe6b2009-06-05 14:42:42 +020038
Jerome Glisse3ce0a232009-09-08 10:10:24 +100039#define R700_PFP_UCODE_SIZE 848
40#define R700_PM4_UCODE_SIZE 1360
Jerome Glisse771fe6b2009-06-05 14:42:42 +020041
Jerome Glisse3ce0a232009-09-08 10:10:24 +100042static void rv770_gpu_init(struct radeon_device *rdev);
43void rv770_fini(struct radeon_device *rdev);
44
Alex Deucher21a81222010-07-02 12:58:16 -040045/* get temperature in millidegrees */
46u32 rv770_get_temp(struct radeon_device *rdev)
47{
48 u32 temp = (RREG32(CG_MULT_THERMAL_STATUS) & ASIC_T_MASK) >>
49 ASIC_T_SHIFT;
50 u32 actual_temp = 0;
51
52 if ((temp >> 9) & 1)
53 actual_temp = 0;
54 else
55 actual_temp = (temp >> 1) & 0xff;
56
57 return actual_temp * 1000;
58}
59
Alex Deucher49e02b72010-04-23 17:57:27 -040060void rv770_pm_misc(struct radeon_device *rdev)
61{
Rafał Miłeckia081a9d2010-06-07 18:20:25 -040062 int req_ps_idx = rdev->pm.requested_power_state_index;
63 int req_cm_idx = rdev->pm.requested_clock_mode_index;
64 struct radeon_power_state *ps = &rdev->pm.power_state[req_ps_idx];
65 struct radeon_voltage *voltage = &ps->clock_info[req_cm_idx].voltage;
Alex Deucher4d601732010-06-07 18:15:18 -040066
67 if ((voltage->type == VOLTAGE_SW) && voltage->voltage) {
68 if (voltage->voltage != rdev->pm.current_vddc) {
69 radeon_atom_set_voltage(rdev, voltage->voltage);
70 rdev->pm.current_vddc = voltage->voltage;
Rafał Miłecki0fcbe942010-06-07 18:25:21 -040071 DRM_DEBUG("Setting: v: %d\n", voltage->voltage);
Alex Deucher4d601732010-06-07 18:15:18 -040072 }
73 }
Alex Deucher49e02b72010-04-23 17:57:27 -040074}
Jerome Glisse3ce0a232009-09-08 10:10:24 +100075
76/*
77 * GART
Jerome Glisse771fe6b2009-06-05 14:42:42 +020078 */
Jerome Glisse3ce0a232009-09-08 10:10:24 +100079int rv770_pcie_gart_enable(struct radeon_device *rdev)
80{
81 u32 tmp;
82 int r, i;
83
Jerome Glisse4aac0472009-09-14 18:29:49 +020084 if (rdev->gart.table.vram.robj == NULL) {
85 dev_err(rdev->dev, "No VRAM object for PCIE GART.\n");
86 return -EINVAL;
Jerome Glisse3ce0a232009-09-08 10:10:24 +100087 }
Jerome Glisse4aac0472009-09-14 18:29:49 +020088 r = radeon_gart_table_vram_pin(rdev);
89 if (r)
Jerome Glisse3ce0a232009-09-08 10:10:24 +100090 return r;
Dave Airlie82568562010-02-05 16:00:07 +100091 radeon_gart_restore(rdev);
Jerome Glisse3ce0a232009-09-08 10:10:24 +100092 /* Setup L2 cache */
93 WREG32(VM_L2_CNTL, ENABLE_L2_CACHE | ENABLE_L2_FRAGMENT_PROCESSING |
94 ENABLE_L2_PTE_CACHE_LRU_UPDATE_BY_WRITE |
95 EFFECTIVE_L2_QUEUE_SIZE(7));
96 WREG32(VM_L2_CNTL2, 0);
97 WREG32(VM_L2_CNTL3, BANK_SELECT(0) | CACHE_UPDATE_MODE(2));
98 /* Setup TLB control */
99 tmp = ENABLE_L1_TLB | ENABLE_L1_FRAGMENT_PROCESSING |
100 SYSTEM_ACCESS_MODE_NOT_IN_SYS |
101 SYSTEM_APERTURE_UNMAPPED_ACCESS_PASS_THRU |
102 EFFECTIVE_L1_TLB_SIZE(5) | EFFECTIVE_L1_QUEUE_SIZE(5);
103 WREG32(MC_VM_MD_L1_TLB0_CNTL, tmp);
104 WREG32(MC_VM_MD_L1_TLB1_CNTL, tmp);
105 WREG32(MC_VM_MD_L1_TLB2_CNTL, tmp);
106 WREG32(MC_VM_MB_L1_TLB0_CNTL, tmp);
107 WREG32(MC_VM_MB_L1_TLB1_CNTL, tmp);
108 WREG32(MC_VM_MB_L1_TLB2_CNTL, tmp);
109 WREG32(MC_VM_MB_L1_TLB3_CNTL, tmp);
110 WREG32(VM_CONTEXT0_PAGE_TABLE_START_ADDR, rdev->mc.gtt_start >> 12);
Jerome Glisse1a029b72009-10-06 19:04:30 +0200111 WREG32(VM_CONTEXT0_PAGE_TABLE_END_ADDR, rdev->mc.gtt_end >> 12);
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000112 WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR, rdev->gart.table_addr >> 12);
113 WREG32(VM_CONTEXT0_CNTL, ENABLE_CONTEXT | PAGE_TABLE_DEPTH(0) |
114 RANGE_PROTECTION_FAULT_ENABLE_DEFAULT);
115 WREG32(VM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR,
116 (u32)(rdev->dummy_page.addr >> 12));
117 for (i = 1; i < 7; i++)
118 WREG32(VM_CONTEXT0_CNTL + (i * 4), 0);
119
120 r600_pcie_gart_tlb_flush(rdev);
121 rdev->gart.ready = true;
122 return 0;
123}
124
125void rv770_pcie_gart_disable(struct radeon_device *rdev)
126{
127 u32 tmp;
Jerome Glisse4c788672009-11-20 14:29:23 +0100128 int i, r;
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000129
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000130 /* Disable all tables */
131 for (i = 0; i < 7; i++)
132 WREG32(VM_CONTEXT0_CNTL + (i * 4), 0);
133
134 /* Setup L2 cache */
135 WREG32(VM_L2_CNTL, ENABLE_L2_FRAGMENT_PROCESSING |
136 EFFECTIVE_L2_QUEUE_SIZE(7));
137 WREG32(VM_L2_CNTL2, 0);
138 WREG32(VM_L2_CNTL3, BANK_SELECT(0) | CACHE_UPDATE_MODE(2));
139 /* Setup TLB control */
140 tmp = EFFECTIVE_L1_TLB_SIZE(5) | EFFECTIVE_L1_QUEUE_SIZE(5);
141 WREG32(MC_VM_MD_L1_TLB0_CNTL, tmp);
142 WREG32(MC_VM_MD_L1_TLB1_CNTL, tmp);
143 WREG32(MC_VM_MD_L1_TLB2_CNTL, tmp);
144 WREG32(MC_VM_MB_L1_TLB0_CNTL, tmp);
145 WREG32(MC_VM_MB_L1_TLB1_CNTL, tmp);
146 WREG32(MC_VM_MB_L1_TLB2_CNTL, tmp);
147 WREG32(MC_VM_MB_L1_TLB3_CNTL, tmp);
Jerome Glisse4aac0472009-09-14 18:29:49 +0200148 if (rdev->gart.table.vram.robj) {
Jerome Glisse4c788672009-11-20 14:29:23 +0100149 r = radeon_bo_reserve(rdev->gart.table.vram.robj, false);
150 if (likely(r == 0)) {
151 radeon_bo_kunmap(rdev->gart.table.vram.robj);
152 radeon_bo_unpin(rdev->gart.table.vram.robj);
153 radeon_bo_unreserve(rdev->gart.table.vram.robj);
154 }
Jerome Glisse4aac0472009-09-14 18:29:49 +0200155 }
156}
157
158void rv770_pcie_gart_fini(struct radeon_device *rdev)
159{
Jerome Glissef9274562010-03-17 14:44:29 +0000160 radeon_gart_fini(rdev);
Jerome Glisse4aac0472009-09-14 18:29:49 +0200161 rv770_pcie_gart_disable(rdev);
162 radeon_gart_table_vram_free(rdev);
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000163}
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200164
165
Jerome Glisse1a029b72009-10-06 19:04:30 +0200166void rv770_agp_enable(struct radeon_device *rdev)
167{
168 u32 tmp;
169 int i;
170
171 /* Setup L2 cache */
172 WREG32(VM_L2_CNTL, ENABLE_L2_CACHE | ENABLE_L2_FRAGMENT_PROCESSING |
173 ENABLE_L2_PTE_CACHE_LRU_UPDATE_BY_WRITE |
174 EFFECTIVE_L2_QUEUE_SIZE(7));
175 WREG32(VM_L2_CNTL2, 0);
176 WREG32(VM_L2_CNTL3, BANK_SELECT(0) | CACHE_UPDATE_MODE(2));
177 /* Setup TLB control */
178 tmp = ENABLE_L1_TLB | ENABLE_L1_FRAGMENT_PROCESSING |
179 SYSTEM_ACCESS_MODE_NOT_IN_SYS |
180 SYSTEM_APERTURE_UNMAPPED_ACCESS_PASS_THRU |
181 EFFECTIVE_L1_TLB_SIZE(5) | EFFECTIVE_L1_QUEUE_SIZE(5);
182 WREG32(MC_VM_MD_L1_TLB0_CNTL, tmp);
183 WREG32(MC_VM_MD_L1_TLB1_CNTL, tmp);
184 WREG32(MC_VM_MD_L1_TLB2_CNTL, tmp);
185 WREG32(MC_VM_MB_L1_TLB0_CNTL, tmp);
186 WREG32(MC_VM_MB_L1_TLB1_CNTL, tmp);
187 WREG32(MC_VM_MB_L1_TLB2_CNTL, tmp);
188 WREG32(MC_VM_MB_L1_TLB3_CNTL, tmp);
189 for (i = 0; i < 7; i++)
190 WREG32(VM_CONTEXT0_CNTL + (i * 4), 0);
191}
192
Jerome Glissea3c19452009-10-01 18:02:13 +0200193static void rv770_mc_program(struct radeon_device *rdev)
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200194{
Jerome Glissea3c19452009-10-01 18:02:13 +0200195 struct rv515_mc_save save;
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000196 u32 tmp;
197 int i, j;
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200198
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000199 /* Initialize HDP */
200 for (i = 0, j = 0; i < 32; i++, j += 0x18) {
201 WREG32((0x2c14 + j), 0x00000000);
202 WREG32((0x2c18 + j), 0x00000000);
203 WREG32((0x2c1c + j), 0x00000000);
204 WREG32((0x2c20 + j), 0x00000000);
205 WREG32((0x2c24 + j), 0x00000000);
206 }
Alex Deucher812d0462010-07-26 18:51:53 -0400207 /* r7xx hw bug. Read from HDP_DEBUG1 rather
208 * than writing to HDP_REG_COHERENCY_FLUSH_CNTL
209 */
210 tmp = RREG32(HDP_DEBUG1);
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200211
Jerome Glissea3c19452009-10-01 18:02:13 +0200212 rv515_mc_stop(rdev, &save);
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000213 if (r600_mc_wait_for_idle(rdev)) {
Jerome Glissea3c19452009-10-01 18:02:13 +0200214 dev_warn(rdev->dev, "Wait for MC idle timedout !\n");
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200215 }
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000216 /* Lockout access through VGA aperture*/
217 WREG32(VGA_HDP_CONTROL, VGA_MEMORY_DISABLE);
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000218 /* Update configuration */
Jerome Glisse1a029b72009-10-06 19:04:30 +0200219 if (rdev->flags & RADEON_IS_AGP) {
220 if (rdev->mc.vram_start < rdev->mc.gtt_start) {
221 /* VRAM before AGP */
222 WREG32(MC_VM_SYSTEM_APERTURE_LOW_ADDR,
223 rdev->mc.vram_start >> 12);
224 WREG32(MC_VM_SYSTEM_APERTURE_HIGH_ADDR,
225 rdev->mc.gtt_end >> 12);
226 } else {
227 /* VRAM after AGP */
228 WREG32(MC_VM_SYSTEM_APERTURE_LOW_ADDR,
229 rdev->mc.gtt_start >> 12);
230 WREG32(MC_VM_SYSTEM_APERTURE_HIGH_ADDR,
231 rdev->mc.vram_end >> 12);
232 }
233 } else {
234 WREG32(MC_VM_SYSTEM_APERTURE_LOW_ADDR,
235 rdev->mc.vram_start >> 12);
236 WREG32(MC_VM_SYSTEM_APERTURE_HIGH_ADDR,
237 rdev->mc.vram_end >> 12);
238 }
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000239 WREG32(MC_VM_SYSTEM_APERTURE_DEFAULT_ADDR, 0);
Jerome Glisse1a029b72009-10-06 19:04:30 +0200240 tmp = ((rdev->mc.vram_end >> 24) & 0xFFFF) << 16;
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000241 tmp |= ((rdev->mc.vram_start >> 24) & 0xFFFF);
242 WREG32(MC_VM_FB_LOCATION, tmp);
243 WREG32(HDP_NONSURFACE_BASE, (rdev->mc.vram_start >> 8));
244 WREG32(HDP_NONSURFACE_INFO, (2 << 7));
Jerome Glisse46fcd2b2010-06-03 19:34:48 +0200245 WREG32(HDP_NONSURFACE_SIZE, 0x3FFFFFFF);
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000246 if (rdev->flags & RADEON_IS_AGP) {
Jerome Glisse1a029b72009-10-06 19:04:30 +0200247 WREG32(MC_VM_AGP_TOP, rdev->mc.gtt_end >> 16);
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000248 WREG32(MC_VM_AGP_BOT, rdev->mc.gtt_start >> 16);
249 WREG32(MC_VM_AGP_BASE, rdev->mc.agp_base >> 22);
250 } else {
251 WREG32(MC_VM_AGP_BASE, 0);
252 WREG32(MC_VM_AGP_TOP, 0x0FFFFFFF);
253 WREG32(MC_VM_AGP_BOT, 0x0FFFFFFF);
254 }
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000255 if (r600_mc_wait_for_idle(rdev)) {
Jerome Glissea3c19452009-10-01 18:02:13 +0200256 dev_warn(rdev->dev, "Wait for MC idle timedout !\n");
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000257 }
Jerome Glissea3c19452009-10-01 18:02:13 +0200258 rv515_mc_resume(rdev, &save);
Dave Airlie698443d2009-09-18 14:16:38 +1000259 /* we need to own VRAM, so turn off the VGA renderer here
260 * to stop it overwriting our objects */
Jerome Glissed39c3b82009-09-28 18:34:43 +0200261 rv515_vga_render_disable(rdev);
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200262}
263
264
265/*
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000266 * CP.
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200267 */
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000268void r700_cp_stop(struct radeon_device *rdev)
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200269{
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000270 WREG32(CP_ME_CNTL, (CP_ME_HALT | CP_PFP_HALT));
Alex Deucher724c80e2010-08-27 18:25:25 -0400271 WREG32(SCRATCH_UMSK, 0);
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200272}
273
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000274static int rv770_cp_load_microcode(struct radeon_device *rdev)
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200275{
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000276 const __be32 *fw_data;
277 int i;
278
279 if (!rdev->me_fw || !rdev->pfp_fw)
280 return -EINVAL;
281
282 r700_cp_stop(rdev);
283 WREG32(CP_RB_CNTL, RB_NO_UPDATE | (15 << 8) | (3 << 0));
284
285 /* Reset cp */
286 WREG32(GRBM_SOFT_RESET, SOFT_RESET_CP);
287 RREG32(GRBM_SOFT_RESET);
288 mdelay(15);
289 WREG32(GRBM_SOFT_RESET, 0);
290
291 fw_data = (const __be32 *)rdev->pfp_fw->data;
292 WREG32(CP_PFP_UCODE_ADDR, 0);
293 for (i = 0; i < R700_PFP_UCODE_SIZE; i++)
294 WREG32(CP_PFP_UCODE_DATA, be32_to_cpup(fw_data++));
295 WREG32(CP_PFP_UCODE_ADDR, 0);
296
297 fw_data = (const __be32 *)rdev->me_fw->data;
298 WREG32(CP_ME_RAM_WADDR, 0);
299 for (i = 0; i < R700_PM4_UCODE_SIZE; i++)
300 WREG32(CP_ME_RAM_DATA, be32_to_cpup(fw_data++));
301
302 WREG32(CP_PFP_UCODE_ADDR, 0);
303 WREG32(CP_ME_RAM_WADDR, 0);
304 WREG32(CP_ME_RAM_RADDR, 0);
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200305 return 0;
306}
307
Alex Deucherfe251e22010-03-24 13:36:43 -0400308void r700_cp_fini(struct radeon_device *rdev)
309{
310 r700_cp_stop(rdev);
311 radeon_ring_fini(rdev);
312}
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200313
314/*
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000315 * Core functions
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200316 */
Alex Deucherd03f5d52010-02-19 16:22:31 -0500317static u32 r700_get_tile_pipe_to_backend_map(struct radeon_device *rdev,
318 u32 num_tile_pipes,
319 u32 num_backends,
320 u32 backend_disable_mask)
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200321{
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000322 u32 backend_map = 0;
323 u32 enabled_backends_mask;
324 u32 enabled_backends_count;
325 u32 cur_pipe;
326 u32 swizzle_pipe[R7XX_MAX_PIPES];
327 u32 cur_backend;
328 u32 i;
Alex Deucherd03f5d52010-02-19 16:22:31 -0500329 bool force_no_swizzle;
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000330
331 if (num_tile_pipes > R7XX_MAX_PIPES)
332 num_tile_pipes = R7XX_MAX_PIPES;
333 if (num_tile_pipes < 1)
334 num_tile_pipes = 1;
335 if (num_backends > R7XX_MAX_BACKENDS)
336 num_backends = R7XX_MAX_BACKENDS;
337 if (num_backends < 1)
338 num_backends = 1;
339
340 enabled_backends_mask = 0;
341 enabled_backends_count = 0;
342 for (i = 0; i < R7XX_MAX_BACKENDS; ++i) {
343 if (((backend_disable_mask >> i) & 1) == 0) {
344 enabled_backends_mask |= (1 << i);
345 ++enabled_backends_count;
346 }
347 if (enabled_backends_count == num_backends)
348 break;
349 }
350
351 if (enabled_backends_count == 0) {
352 enabled_backends_mask = 1;
353 enabled_backends_count = 1;
354 }
355
356 if (enabled_backends_count != num_backends)
357 num_backends = enabled_backends_count;
358
Alex Deucherd03f5d52010-02-19 16:22:31 -0500359 switch (rdev->family) {
360 case CHIP_RV770:
361 case CHIP_RV730:
362 force_no_swizzle = false;
363 break;
364 case CHIP_RV710:
365 case CHIP_RV740:
366 default:
367 force_no_swizzle = true;
368 break;
369 }
370
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000371 memset((uint8_t *)&swizzle_pipe[0], 0, sizeof(u32) * R7XX_MAX_PIPES);
372 switch (num_tile_pipes) {
373 case 1:
374 swizzle_pipe[0] = 0;
375 break;
376 case 2:
377 swizzle_pipe[0] = 0;
378 swizzle_pipe[1] = 1;
379 break;
380 case 3:
Alex Deucherd03f5d52010-02-19 16:22:31 -0500381 if (force_no_swizzle) {
382 swizzle_pipe[0] = 0;
383 swizzle_pipe[1] = 1;
384 swizzle_pipe[2] = 2;
385 } else {
386 swizzle_pipe[0] = 0;
387 swizzle_pipe[1] = 2;
388 swizzle_pipe[2] = 1;
389 }
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000390 break;
391 case 4:
Alex Deucherd03f5d52010-02-19 16:22:31 -0500392 if (force_no_swizzle) {
393 swizzle_pipe[0] = 0;
394 swizzle_pipe[1] = 1;
395 swizzle_pipe[2] = 2;
396 swizzle_pipe[3] = 3;
397 } else {
398 swizzle_pipe[0] = 0;
399 swizzle_pipe[1] = 2;
400 swizzle_pipe[2] = 3;
401 swizzle_pipe[3] = 1;
402 }
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000403 break;
404 case 5:
Alex Deucherd03f5d52010-02-19 16:22:31 -0500405 if (force_no_swizzle) {
406 swizzle_pipe[0] = 0;
407 swizzle_pipe[1] = 1;
408 swizzle_pipe[2] = 2;
409 swizzle_pipe[3] = 3;
410 swizzle_pipe[4] = 4;
411 } else {
412 swizzle_pipe[0] = 0;
413 swizzle_pipe[1] = 2;
414 swizzle_pipe[2] = 4;
415 swizzle_pipe[3] = 1;
416 swizzle_pipe[4] = 3;
417 }
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000418 break;
419 case 6:
Alex Deucherd03f5d52010-02-19 16:22:31 -0500420 if (force_no_swizzle) {
421 swizzle_pipe[0] = 0;
422 swizzle_pipe[1] = 1;
423 swizzle_pipe[2] = 2;
424 swizzle_pipe[3] = 3;
425 swizzle_pipe[4] = 4;
426 swizzle_pipe[5] = 5;
427 } else {
428 swizzle_pipe[0] = 0;
429 swizzle_pipe[1] = 2;
430 swizzle_pipe[2] = 4;
431 swizzle_pipe[3] = 5;
432 swizzle_pipe[4] = 3;
433 swizzle_pipe[5] = 1;
434 }
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000435 break;
436 case 7:
Alex Deucherd03f5d52010-02-19 16:22:31 -0500437 if (force_no_swizzle) {
438 swizzle_pipe[0] = 0;
439 swizzle_pipe[1] = 1;
440 swizzle_pipe[2] = 2;
441 swizzle_pipe[3] = 3;
442 swizzle_pipe[4] = 4;
443 swizzle_pipe[5] = 5;
444 swizzle_pipe[6] = 6;
445 } else {
446 swizzle_pipe[0] = 0;
447 swizzle_pipe[1] = 2;
448 swizzle_pipe[2] = 4;
449 swizzle_pipe[3] = 6;
450 swizzle_pipe[4] = 3;
451 swizzle_pipe[5] = 1;
452 swizzle_pipe[6] = 5;
453 }
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000454 break;
455 case 8:
Alex Deucherd03f5d52010-02-19 16:22:31 -0500456 if (force_no_swizzle) {
457 swizzle_pipe[0] = 0;
458 swizzle_pipe[1] = 1;
459 swizzle_pipe[2] = 2;
460 swizzle_pipe[3] = 3;
461 swizzle_pipe[4] = 4;
462 swizzle_pipe[5] = 5;
463 swizzle_pipe[6] = 6;
464 swizzle_pipe[7] = 7;
465 } else {
466 swizzle_pipe[0] = 0;
467 swizzle_pipe[1] = 2;
468 swizzle_pipe[2] = 4;
469 swizzle_pipe[3] = 6;
470 swizzle_pipe[4] = 3;
471 swizzle_pipe[5] = 1;
472 swizzle_pipe[6] = 7;
473 swizzle_pipe[7] = 5;
474 }
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000475 break;
476 }
477
478 cur_backend = 0;
479 for (cur_pipe = 0; cur_pipe < num_tile_pipes; ++cur_pipe) {
480 while (((1 << cur_backend) & enabled_backends_mask) == 0)
481 cur_backend = (cur_backend + 1) % R7XX_MAX_BACKENDS;
482
483 backend_map |= (u32)(((cur_backend & 3) << (swizzle_pipe[cur_pipe] * 2)));
484
485 cur_backend = (cur_backend + 1) % R7XX_MAX_BACKENDS;
486 }
487
488 return backend_map;
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200489}
490
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000491static void rv770_gpu_init(struct radeon_device *rdev)
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200492{
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000493 int i, j, num_qd_pipes;
Alex Deucherd03f5d52010-02-19 16:22:31 -0500494 u32 ta_aux_cntl;
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000495 u32 sx_debug_1;
496 u32 smx_dc_ctl0;
Alex Deucherd03f5d52010-02-19 16:22:31 -0500497 u32 db_debug3;
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000498 u32 num_gs_verts_per_thread;
499 u32 vgt_gs_per_es;
500 u32 gs_prim_buffer_depth = 0;
501 u32 sq_ms_fifo_sizes;
502 u32 sq_config;
503 u32 sq_thread_resource_mgmt;
504 u32 hdp_host_path_cntl;
505 u32 sq_dyn_gpr_size_simd_ab_0;
506 u32 backend_map;
507 u32 gb_tiling_config = 0;
508 u32 cc_rb_backend_disable = 0;
509 u32 cc_gc_shader_pipe_config = 0;
510 u32 mc_arb_ramcfg;
511 u32 db_debug4;
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200512
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000513 /* setup chip specs */
514 switch (rdev->family) {
515 case CHIP_RV770:
516 rdev->config.rv770.max_pipes = 4;
517 rdev->config.rv770.max_tile_pipes = 8;
518 rdev->config.rv770.max_simds = 10;
519 rdev->config.rv770.max_backends = 4;
520 rdev->config.rv770.max_gprs = 256;
521 rdev->config.rv770.max_threads = 248;
522 rdev->config.rv770.max_stack_entries = 512;
523 rdev->config.rv770.max_hw_contexts = 8;
524 rdev->config.rv770.max_gs_threads = 16 * 2;
525 rdev->config.rv770.sx_max_export_size = 128;
526 rdev->config.rv770.sx_max_export_pos_size = 16;
527 rdev->config.rv770.sx_max_export_smx_size = 112;
528 rdev->config.rv770.sq_num_cf_insts = 2;
529
530 rdev->config.rv770.sx_num_of_sets = 7;
531 rdev->config.rv770.sc_prim_fifo_size = 0xF9;
532 rdev->config.rv770.sc_hiz_tile_fifo_size = 0x30;
533 rdev->config.rv770.sc_earlyz_tile_fifo_fize = 0x130;
534 break;
535 case CHIP_RV730:
536 rdev->config.rv770.max_pipes = 2;
537 rdev->config.rv770.max_tile_pipes = 4;
538 rdev->config.rv770.max_simds = 8;
539 rdev->config.rv770.max_backends = 2;
540 rdev->config.rv770.max_gprs = 128;
541 rdev->config.rv770.max_threads = 248;
542 rdev->config.rv770.max_stack_entries = 256;
543 rdev->config.rv770.max_hw_contexts = 8;
544 rdev->config.rv770.max_gs_threads = 16 * 2;
545 rdev->config.rv770.sx_max_export_size = 256;
546 rdev->config.rv770.sx_max_export_pos_size = 32;
547 rdev->config.rv770.sx_max_export_smx_size = 224;
548 rdev->config.rv770.sq_num_cf_insts = 2;
549
550 rdev->config.rv770.sx_num_of_sets = 7;
551 rdev->config.rv770.sc_prim_fifo_size = 0xf9;
552 rdev->config.rv770.sc_hiz_tile_fifo_size = 0x30;
553 rdev->config.rv770.sc_earlyz_tile_fifo_fize = 0x130;
554 if (rdev->config.rv770.sx_max_export_pos_size > 16) {
555 rdev->config.rv770.sx_max_export_pos_size -= 16;
556 rdev->config.rv770.sx_max_export_smx_size += 16;
557 }
558 break;
559 case CHIP_RV710:
560 rdev->config.rv770.max_pipes = 2;
561 rdev->config.rv770.max_tile_pipes = 2;
562 rdev->config.rv770.max_simds = 2;
563 rdev->config.rv770.max_backends = 1;
564 rdev->config.rv770.max_gprs = 256;
565 rdev->config.rv770.max_threads = 192;
566 rdev->config.rv770.max_stack_entries = 256;
567 rdev->config.rv770.max_hw_contexts = 4;
568 rdev->config.rv770.max_gs_threads = 8 * 2;
569 rdev->config.rv770.sx_max_export_size = 128;
570 rdev->config.rv770.sx_max_export_pos_size = 16;
571 rdev->config.rv770.sx_max_export_smx_size = 112;
572 rdev->config.rv770.sq_num_cf_insts = 1;
573
574 rdev->config.rv770.sx_num_of_sets = 7;
575 rdev->config.rv770.sc_prim_fifo_size = 0x40;
576 rdev->config.rv770.sc_hiz_tile_fifo_size = 0x30;
577 rdev->config.rv770.sc_earlyz_tile_fifo_fize = 0x130;
578 break;
579 case CHIP_RV740:
580 rdev->config.rv770.max_pipes = 4;
581 rdev->config.rv770.max_tile_pipes = 4;
582 rdev->config.rv770.max_simds = 8;
583 rdev->config.rv770.max_backends = 4;
584 rdev->config.rv770.max_gprs = 256;
585 rdev->config.rv770.max_threads = 248;
586 rdev->config.rv770.max_stack_entries = 512;
587 rdev->config.rv770.max_hw_contexts = 8;
588 rdev->config.rv770.max_gs_threads = 16 * 2;
589 rdev->config.rv770.sx_max_export_size = 256;
590 rdev->config.rv770.sx_max_export_pos_size = 32;
591 rdev->config.rv770.sx_max_export_smx_size = 224;
592 rdev->config.rv770.sq_num_cf_insts = 2;
593
594 rdev->config.rv770.sx_num_of_sets = 7;
595 rdev->config.rv770.sc_prim_fifo_size = 0x100;
596 rdev->config.rv770.sc_hiz_tile_fifo_size = 0x30;
597 rdev->config.rv770.sc_earlyz_tile_fifo_fize = 0x130;
598
599 if (rdev->config.rv770.sx_max_export_pos_size > 16) {
600 rdev->config.rv770.sx_max_export_pos_size -= 16;
601 rdev->config.rv770.sx_max_export_smx_size += 16;
602 }
603 break;
604 default:
605 break;
606 }
607
608 /* Initialize HDP */
609 j = 0;
610 for (i = 0; i < 32; i++) {
611 WREG32((0x2c14 + j), 0x00000000);
612 WREG32((0x2c18 + j), 0x00000000);
613 WREG32((0x2c1c + j), 0x00000000);
614 WREG32((0x2c20 + j), 0x00000000);
615 WREG32((0x2c24 + j), 0x00000000);
616 j += 0x18;
617 }
618
619 WREG32(GRBM_CNTL, GRBM_READ_TIMEOUT(0xff));
620
621 /* setup tiling, simd, pipe config */
622 mc_arb_ramcfg = RREG32(MC_ARB_RAMCFG);
623
624 switch (rdev->config.rv770.max_tile_pipes) {
625 case 1:
Alex Deucherd03f5d52010-02-19 16:22:31 -0500626 default:
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000627 gb_tiling_config |= PIPE_TILING(0);
628 break;
629 case 2:
630 gb_tiling_config |= PIPE_TILING(1);
631 break;
632 case 4:
633 gb_tiling_config |= PIPE_TILING(2);
634 break;
635 case 8:
636 gb_tiling_config |= PIPE_TILING(3);
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000637 break;
638 }
Alex Deucherd03f5d52010-02-19 16:22:31 -0500639 rdev->config.rv770.tiling_npipes = rdev->config.rv770.max_tile_pipes;
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000640
641 if (rdev->family == CHIP_RV770)
642 gb_tiling_config |= BANK_TILING(1);
643 else
Alex Deuchere29649d2009-11-03 10:04:01 -0500644 gb_tiling_config |= BANK_TILING((mc_arb_ramcfg & NOOFBANK_MASK) >> NOOFBANK_SHIFT);
Jerome Glisse961fb592010-02-10 22:30:05 +0000645 rdev->config.rv770.tiling_nbanks = 4 << ((gb_tiling_config >> 4) & 0x3);
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000646
647 gb_tiling_config |= GROUP_SIZE(0);
Jerome Glisse961fb592010-02-10 22:30:05 +0000648 rdev->config.rv770.tiling_group_size = 256;
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000649
Alex Deuchere29649d2009-11-03 10:04:01 -0500650 if (((mc_arb_ramcfg & NOOFROWS_MASK) >> NOOFROWS_SHIFT) > 3) {
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000651 gb_tiling_config |= ROW_TILING(3);
652 gb_tiling_config |= SAMPLE_SPLIT(3);
653 } else {
654 gb_tiling_config |=
655 ROW_TILING(((mc_arb_ramcfg & NOOFROWS_MASK) >> NOOFROWS_SHIFT));
656 gb_tiling_config |=
657 SAMPLE_SPLIT(((mc_arb_ramcfg & NOOFROWS_MASK) >> NOOFROWS_SHIFT));
658 }
659
660 gb_tiling_config |= BANK_SWAPS(1);
661
Alex Deucherd03f5d52010-02-19 16:22:31 -0500662 cc_rb_backend_disable = RREG32(CC_RB_BACKEND_DISABLE) & 0x00ff0000;
663 cc_rb_backend_disable |=
664 BACKEND_DISABLE((R7XX_MAX_BACKENDS_MASK << rdev->config.rv770.max_backends) & R7XX_MAX_BACKENDS_MASK);
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000665
Alex Deucherd03f5d52010-02-19 16:22:31 -0500666 cc_gc_shader_pipe_config = RREG32(CC_GC_SHADER_PIPE_CONFIG) & 0xffffff00;
667 cc_gc_shader_pipe_config |=
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000668 INACTIVE_QD_PIPES((R7XX_MAX_PIPES_MASK << rdev->config.rv770.max_pipes) & R7XX_MAX_PIPES_MASK);
669 cc_gc_shader_pipe_config |=
670 INACTIVE_SIMDS((R7XX_MAX_SIMDS_MASK << rdev->config.rv770.max_simds) & R7XX_MAX_SIMDS_MASK);
671
Alex Deucherd03f5d52010-02-19 16:22:31 -0500672 if (rdev->family == CHIP_RV740)
673 backend_map = 0x28;
674 else
675 backend_map = r700_get_tile_pipe_to_backend_map(rdev,
676 rdev->config.rv770.max_tile_pipes,
677 (R7XX_MAX_BACKENDS -
678 r600_count_pipe_bits((cc_rb_backend_disable &
679 R7XX_MAX_BACKENDS_MASK) >> 16)),
680 (cc_rb_backend_disable >> 16));
Alex Deucherd03f5d52010-02-19 16:22:31 -0500681
Alex Deuchere7aeeba62010-06-04 13:10:12 -0400682 rdev->config.rv770.tile_config = gb_tiling_config;
683 gb_tiling_config |= BACKEND_MAP(backend_map);
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000684
685 WREG32(GB_TILING_CONFIG, gb_tiling_config);
686 WREG32(DCP_TILING_CONFIG, (gb_tiling_config & 0xffff));
687 WREG32(HDP_TILING_CONFIG, (gb_tiling_config & 0xffff));
688
689 WREG32(CC_RB_BACKEND_DISABLE, cc_rb_backend_disable);
690 WREG32(CC_GC_SHADER_PIPE_CONFIG, cc_gc_shader_pipe_config);
Alex Deucherf867c60d2010-03-05 14:50:37 -0500691 WREG32(GC_USER_SHADER_PIPE_CONFIG, cc_gc_shader_pipe_config);
Alex Deucherd03f5d52010-02-19 16:22:31 -0500692 WREG32(CC_SYS_RB_BACKEND_DISABLE, cc_rb_backend_disable);
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000693
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000694 WREG32(CGTS_SYS_TCC_DISABLE, 0);
695 WREG32(CGTS_TCC_DISABLE, 0);
Alex Deucherf867c60d2010-03-05 14:50:37 -0500696 WREG32(CGTS_USER_SYS_TCC_DISABLE, 0);
697 WREG32(CGTS_USER_TCC_DISABLE, 0);
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000698
699 num_qd_pipes =
Alex Deucherd03f5d52010-02-19 16:22:31 -0500700 R7XX_MAX_PIPES - r600_count_pipe_bits((cc_gc_shader_pipe_config & INACTIVE_QD_PIPES_MASK) >> 8);
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000701 WREG32(VGT_OUT_DEALLOC_CNTL, (num_qd_pipes * 4) & DEALLOC_DIST_MASK);
702 WREG32(VGT_VERTEX_REUSE_BLOCK_CNTL, ((num_qd_pipes * 4) - 2) & VTX_REUSE_DEPTH_MASK);
703
704 /* set HW defaults for 3D engine */
705 WREG32(CP_QUEUE_THRESHOLDS, (ROQ_IB1_START(0x16) |
Alex Deuchere29649d2009-11-03 10:04:01 -0500706 ROQ_IB2_START(0x2b)));
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000707
708 WREG32(CP_MEQ_THRESHOLDS, STQ_SPLIT(0x30));
709
Alex Deucherd03f5d52010-02-19 16:22:31 -0500710 ta_aux_cntl = RREG32(TA_CNTL_AUX);
711 WREG32(TA_CNTL_AUX, ta_aux_cntl | DISABLE_CUBE_ANISO);
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000712
713 sx_debug_1 = RREG32(SX_DEBUG_1);
714 sx_debug_1 |= ENABLE_NEW_SMX_ADDRESS;
715 WREG32(SX_DEBUG_1, sx_debug_1);
716
717 smx_dc_ctl0 = RREG32(SMX_DC_CTL0);
718 smx_dc_ctl0 &= ~CACHE_DEPTH(0x1ff);
719 smx_dc_ctl0 |= CACHE_DEPTH((rdev->config.rv770.sx_num_of_sets * 64) - 1);
720 WREG32(SMX_DC_CTL0, smx_dc_ctl0);
721
Alex Deucherd03f5d52010-02-19 16:22:31 -0500722 if (rdev->family != CHIP_RV740)
723 WREG32(SMX_EVENT_CTL, (ES_FLUSH_CTL(4) |
724 GS_FLUSH_CTL(4) |
725 ACK_FLUSH_CTL(3) |
726 SYNC_FLUSH_CTL));
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000727
Alex Deucherd03f5d52010-02-19 16:22:31 -0500728 db_debug3 = RREG32(DB_DEBUG3);
729 db_debug3 &= ~DB_CLK_OFF_DELAY(0x1f);
730 switch (rdev->family) {
731 case CHIP_RV770:
732 case CHIP_RV740:
733 db_debug3 |= DB_CLK_OFF_DELAY(0x1f);
734 break;
735 case CHIP_RV710:
736 case CHIP_RV730:
737 default:
738 db_debug3 |= DB_CLK_OFF_DELAY(2);
739 break;
740 }
741 WREG32(DB_DEBUG3, db_debug3);
742
743 if (rdev->family != CHIP_RV770) {
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000744 db_debug4 = RREG32(DB_DEBUG4);
745 db_debug4 |= DISABLE_TILE_COVERED_FOR_PS_ITER;
746 WREG32(DB_DEBUG4, db_debug4);
747 }
748
749 WREG32(SX_EXPORT_BUFFER_SIZES, (COLOR_BUFFER_SIZE((rdev->config.rv770.sx_max_export_size / 4) - 1) |
Alex Deuchere29649d2009-11-03 10:04:01 -0500750 POSITION_BUFFER_SIZE((rdev->config.rv770.sx_max_export_pos_size / 4) - 1) |
751 SMX_BUFFER_SIZE((rdev->config.rv770.sx_max_export_smx_size / 4) - 1)));
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000752
753 WREG32(PA_SC_FIFO_SIZE, (SC_PRIM_FIFO_SIZE(rdev->config.rv770.sc_prim_fifo_size) |
Alex Deuchere29649d2009-11-03 10:04:01 -0500754 SC_HIZ_TILE_FIFO_SIZE(rdev->config.rv770.sc_hiz_tile_fifo_size) |
755 SC_EARLYZ_TILE_FIFO_SIZE(rdev->config.rv770.sc_earlyz_tile_fifo_fize)));
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000756
757 WREG32(PA_SC_MULTI_CHIP_CNTL, 0);
758
759 WREG32(VGT_NUM_INSTANCES, 1);
760
761 WREG32(SPI_CONFIG_CNTL, GPR_WRITE_PRIORITY(0));
762
763 WREG32(SPI_CONFIG_CNTL_1, VTX_DONE_DELAY(4));
764
765 WREG32(CP_PERFMON_CNTL, 0);
766
767 sq_ms_fifo_sizes = (CACHE_FIFO_SIZE(16 * rdev->config.rv770.sq_num_cf_insts) |
768 DONE_FIFO_HIWATER(0xe0) |
769 ALU_UPDATE_FIFO_HIWATER(0x8));
770 switch (rdev->family) {
771 case CHIP_RV770:
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000772 case CHIP_RV730:
773 case CHIP_RV710:
Alex Deucherd03f5d52010-02-19 16:22:31 -0500774 sq_ms_fifo_sizes |= FETCH_FIFO_HIWATER(0x1);
775 break;
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000776 case CHIP_RV740:
777 default:
778 sq_ms_fifo_sizes |= FETCH_FIFO_HIWATER(0x4);
779 break;
780 }
781 WREG32(SQ_MS_FIFO_SIZES, sq_ms_fifo_sizes);
782
783 /* SQ_CONFIG, SQ_GPR_RESOURCE_MGMT, SQ_THREAD_RESOURCE_MGMT, SQ_STACK_RESOURCE_MGMT
784 * should be adjusted as needed by the 2D/3D drivers. This just sets default values
785 */
786 sq_config = RREG32(SQ_CONFIG);
787 sq_config &= ~(PS_PRIO(3) |
788 VS_PRIO(3) |
789 GS_PRIO(3) |
790 ES_PRIO(3));
791 sq_config |= (DX9_CONSTS |
792 VC_ENABLE |
793 EXPORT_SRC_C |
794 PS_PRIO(0) |
795 VS_PRIO(1) |
796 GS_PRIO(2) |
797 ES_PRIO(3));
798 if (rdev->family == CHIP_RV710)
799 /* no vertex cache */
800 sq_config &= ~VC_ENABLE;
801
802 WREG32(SQ_CONFIG, sq_config);
803
804 WREG32(SQ_GPR_RESOURCE_MGMT_1, (NUM_PS_GPRS((rdev->config.rv770.max_gprs * 24)/64) |
Dave Airliefe62e1a2009-09-21 14:06:30 +1000805 NUM_VS_GPRS((rdev->config.rv770.max_gprs * 24)/64) |
806 NUM_CLAUSE_TEMP_GPRS(((rdev->config.rv770.max_gprs * 24)/64)/2)));
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000807
808 WREG32(SQ_GPR_RESOURCE_MGMT_2, (NUM_GS_GPRS((rdev->config.rv770.max_gprs * 7)/64) |
Dave Airliefe62e1a2009-09-21 14:06:30 +1000809 NUM_ES_GPRS((rdev->config.rv770.max_gprs * 7)/64)));
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000810
811 sq_thread_resource_mgmt = (NUM_PS_THREADS((rdev->config.rv770.max_threads * 4)/8) |
812 NUM_VS_THREADS((rdev->config.rv770.max_threads * 2)/8) |
813 NUM_ES_THREADS((rdev->config.rv770.max_threads * 1)/8));
814 if (((rdev->config.rv770.max_threads * 1) / 8) > rdev->config.rv770.max_gs_threads)
815 sq_thread_resource_mgmt |= NUM_GS_THREADS(rdev->config.rv770.max_gs_threads);
816 else
817 sq_thread_resource_mgmt |= NUM_GS_THREADS((rdev->config.rv770.max_gs_threads * 1)/8);
818 WREG32(SQ_THREAD_RESOURCE_MGMT, sq_thread_resource_mgmt);
819
820 WREG32(SQ_STACK_RESOURCE_MGMT_1, (NUM_PS_STACK_ENTRIES((rdev->config.rv770.max_stack_entries * 1)/4) |
821 NUM_VS_STACK_ENTRIES((rdev->config.rv770.max_stack_entries * 1)/4)));
822
823 WREG32(SQ_STACK_RESOURCE_MGMT_2, (NUM_GS_STACK_ENTRIES((rdev->config.rv770.max_stack_entries * 1)/4) |
824 NUM_ES_STACK_ENTRIES((rdev->config.rv770.max_stack_entries * 1)/4)));
825
826 sq_dyn_gpr_size_simd_ab_0 = (SIMDA_RING0((rdev->config.rv770.max_gprs * 38)/64) |
827 SIMDA_RING1((rdev->config.rv770.max_gprs * 38)/64) |
828 SIMDB_RING0((rdev->config.rv770.max_gprs * 38)/64) |
829 SIMDB_RING1((rdev->config.rv770.max_gprs * 38)/64));
830
831 WREG32(SQ_DYN_GPR_SIZE_SIMD_AB_0, sq_dyn_gpr_size_simd_ab_0);
832 WREG32(SQ_DYN_GPR_SIZE_SIMD_AB_1, sq_dyn_gpr_size_simd_ab_0);
833 WREG32(SQ_DYN_GPR_SIZE_SIMD_AB_2, sq_dyn_gpr_size_simd_ab_0);
834 WREG32(SQ_DYN_GPR_SIZE_SIMD_AB_3, sq_dyn_gpr_size_simd_ab_0);
835 WREG32(SQ_DYN_GPR_SIZE_SIMD_AB_4, sq_dyn_gpr_size_simd_ab_0);
836 WREG32(SQ_DYN_GPR_SIZE_SIMD_AB_5, sq_dyn_gpr_size_simd_ab_0);
837 WREG32(SQ_DYN_GPR_SIZE_SIMD_AB_6, sq_dyn_gpr_size_simd_ab_0);
838 WREG32(SQ_DYN_GPR_SIZE_SIMD_AB_7, sq_dyn_gpr_size_simd_ab_0);
839
840 WREG32(PA_SC_FORCE_EOV_MAX_CNTS, (FORCE_EOV_MAX_CLK_CNT(4095) |
Dave Airliefe62e1a2009-09-21 14:06:30 +1000841 FORCE_EOV_MAX_REZ_CNT(255)));
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000842
843 if (rdev->family == CHIP_RV710)
844 WREG32(VGT_CACHE_INVALIDATION, (CACHE_INVALIDATION(TC_ONLY) |
Dave Airliefe62e1a2009-09-21 14:06:30 +1000845 AUTO_INVLD_EN(ES_AND_GS_AUTO)));
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000846 else
847 WREG32(VGT_CACHE_INVALIDATION, (CACHE_INVALIDATION(VC_AND_TC) |
Dave Airliefe62e1a2009-09-21 14:06:30 +1000848 AUTO_INVLD_EN(ES_AND_GS_AUTO)));
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000849
850 switch (rdev->family) {
851 case CHIP_RV770:
852 case CHIP_RV730:
853 case CHIP_RV740:
854 gs_prim_buffer_depth = 384;
855 break;
856 case CHIP_RV710:
857 gs_prim_buffer_depth = 128;
858 break;
859 default:
860 break;
861 }
862
863 num_gs_verts_per_thread = rdev->config.rv770.max_pipes * 16;
864 vgt_gs_per_es = gs_prim_buffer_depth + num_gs_verts_per_thread;
865 /* Max value for this is 256 */
866 if (vgt_gs_per_es > 256)
867 vgt_gs_per_es = 256;
868
869 WREG32(VGT_ES_PER_GS, 128);
870 WREG32(VGT_GS_PER_ES, vgt_gs_per_es);
871 WREG32(VGT_GS_PER_VS, 2);
872
873 /* more default values. 2D/3D driver should adjust as needed */
874 WREG32(VGT_GS_VERTEX_REUSE, 16);
875 WREG32(PA_SC_LINE_STIPPLE_STATE, 0);
876 WREG32(VGT_STRMOUT_EN, 0);
877 WREG32(SX_MISC, 0);
878 WREG32(PA_SC_MODE_CNTL, 0);
879 WREG32(PA_SC_EDGERULE, 0xaaaaaaaa);
880 WREG32(PA_SC_AA_CONFIG, 0);
881 WREG32(PA_SC_CLIPRECT_RULE, 0xffff);
882 WREG32(PA_SC_LINE_STIPPLE, 0);
883 WREG32(SPI_INPUT_Z, 0);
884 WREG32(SPI_PS_IN_CONTROL_0, NUM_INTERP(2));
885 WREG32(CB_COLOR7_FRAG, 0);
886
887 /* clear render buffer base addresses */
888 WREG32(CB_COLOR0_BASE, 0);
889 WREG32(CB_COLOR1_BASE, 0);
890 WREG32(CB_COLOR2_BASE, 0);
891 WREG32(CB_COLOR3_BASE, 0);
892 WREG32(CB_COLOR4_BASE, 0);
893 WREG32(CB_COLOR5_BASE, 0);
894 WREG32(CB_COLOR6_BASE, 0);
895 WREG32(CB_COLOR7_BASE, 0);
896
897 WREG32(TCP_CNTL, 0);
898
899 hdp_host_path_cntl = RREG32(HDP_HOST_PATH_CNTL);
900 WREG32(HDP_HOST_PATH_CNTL, hdp_host_path_cntl);
901
902 WREG32(PA_SC_MULTI_CHIP_CNTL, 0);
903
904 WREG32(PA_CL_ENHANCE, (CLIP_VTX_REORDER_ENA |
905 NUM_CLIP_SEQ(3)));
906
907}
908
Alex Deucher87cbf8f2010-08-27 13:59:54 -0400909static int rv770_vram_scratch_init(struct radeon_device *rdev)
910{
911 int r;
912 u64 gpu_addr;
913
914 if (rdev->vram_scratch.robj == NULL) {
915 r = radeon_bo_create(rdev, NULL, RADEON_GPU_PAGE_SIZE,
916 true, RADEON_GEM_DOMAIN_VRAM,
917 &rdev->vram_scratch.robj);
918 if (r) {
919 return r;
920 }
921 }
922
923 r = radeon_bo_reserve(rdev->vram_scratch.robj, false);
924 if (unlikely(r != 0))
925 return r;
926 r = radeon_bo_pin(rdev->vram_scratch.robj,
927 RADEON_GEM_DOMAIN_VRAM, &gpu_addr);
928 if (r) {
929 radeon_bo_unreserve(rdev->vram_scratch.robj);
930 return r;
931 }
932 r = radeon_bo_kmap(rdev->vram_scratch.robj,
933 (void **)&rdev->vram_scratch.ptr);
934 if (r)
935 radeon_bo_unpin(rdev->vram_scratch.robj);
936 radeon_bo_unreserve(rdev->vram_scratch.robj);
937
938 return r;
939}
940
941static void rv770_vram_scratch_fini(struct radeon_device *rdev)
942{
943 int r;
944
945 if (rdev->vram_scratch.robj == NULL) {
946 return;
947 }
948 r = radeon_bo_reserve(rdev->vram_scratch.robj, false);
949 if (likely(r == 0)) {
950 radeon_bo_kunmap(rdev->vram_scratch.robj);
951 radeon_bo_unpin(rdev->vram_scratch.robj);
952 radeon_bo_unreserve(rdev->vram_scratch.robj);
953 }
954 radeon_bo_unref(&rdev->vram_scratch.robj);
955}
956
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000957int rv770_mc_init(struct radeon_device *rdev)
958{
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000959 u32 tmp;
Alex Deucher5885b7a2009-10-19 17:23:33 -0400960 int chansize, numchan;
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000961
962 /* Get VRAM informations */
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000963 rdev->mc.vram_is_ddr = true;
Alex Deucher5885b7a2009-10-19 17:23:33 -0400964 tmp = RREG32(MC_ARB_RAMCFG);
965 if (tmp & CHANSIZE_OVERRIDE) {
966 chansize = 16;
967 } else if (tmp & CHANSIZE_MASK) {
968 chansize = 64;
969 } else {
970 chansize = 32;
971 }
972 tmp = RREG32(MC_SHARED_CHMAP);
973 switch ((tmp & NOOFCHAN_MASK) >> NOOFCHAN_SHIFT) {
974 case 0:
975 default:
976 numchan = 1;
977 break;
978 case 1:
979 numchan = 2;
980 break;
981 case 2:
982 numchan = 4;
983 break;
984 case 3:
985 numchan = 8;
986 break;
987 }
988 rdev->mc.vram_width = numchan * chansize;
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200989 /* Could aper size report 0 ? */
Jordan Crouse01d73a62010-05-27 13:40:24 -0600990 rdev->mc.aper_base = pci_resource_start(rdev->pdev, 0);
991 rdev->mc.aper_size = pci_resource_len(rdev->pdev, 0);
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000992 /* Setup GPU memory space */
993 rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE);
994 rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE);
Jerome Glisse51e5fcd2010-02-19 14:33:54 +0000995 rdev->mc.visible_vram_size = rdev->mc.aper_size;
Jerome Glissed594e462010-02-17 21:54:29 +0000996 r600_vram_gtt_location(rdev, &rdev->mc);
Alex Deucherf47299c2010-03-16 20:54:38 -0400997 radeon_update_bandwidth_info(rdev);
998
Jerome Glisse3ce0a232009-09-08 10:10:24 +1000999 return 0;
1000}
Jerome Glissed594e462010-02-17 21:54:29 +00001001
Dave Airliefc30b8e2009-09-18 15:19:37 +10001002static int rv770_startup(struct radeon_device *rdev)
Jerome Glisse3ce0a232009-09-08 10:10:24 +10001003{
1004 int r;
1005
Alex Deucher779720a2009-12-09 19:31:44 -05001006 if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw) {
1007 r = r600_init_microcode(rdev);
1008 if (r) {
1009 DRM_ERROR("Failed to load firmware!\n");
1010 return r;
1011 }
1012 }
1013
Jerome Glissea3c19452009-10-01 18:02:13 +02001014 rv770_mc_program(rdev);
Jerome Glisse1a029b72009-10-06 19:04:30 +02001015 if (rdev->flags & RADEON_IS_AGP) {
1016 rv770_agp_enable(rdev);
1017 } else {
1018 r = rv770_pcie_gart_enable(rdev);
1019 if (r)
1020 return r;
1021 }
Alex Deucher87cbf8f2010-08-27 13:59:54 -04001022 r = rv770_vram_scratch_init(rdev);
1023 if (r)
1024 return r;
Jerome Glisse3ce0a232009-09-08 10:10:24 +10001025 rv770_gpu_init(rdev);
Jerome Glissec38c7b62010-02-04 17:27:27 +01001026 r = r600_blit_init(rdev);
1027 if (r) {
1028 r600_blit_fini(rdev);
1029 rdev->asic->copy = NULL;
1030 dev_warn(rdev->dev, "failed blitter (%d) falling back to memcpy\n", r);
1031 }
Alex Deucherb70d6bb2010-08-06 21:36:58 -04001032
Alex Deucher724c80e2010-08-27 18:25:25 -04001033 /* allocate wb buffer */
1034 r = radeon_wb_init(rdev);
1035 if (r)
1036 return r;
1037
Alex Deucherd8f60cf2009-12-01 13:43:46 -05001038 /* Enable IRQ */
Alex Deucherd8f60cf2009-12-01 13:43:46 -05001039 r = r600_irq_init(rdev);
1040 if (r) {
1041 DRM_ERROR("radeon: IH init failed (%d).\n", r);
1042 radeon_irq_kms_fini(rdev);
1043 return r;
1044 }
1045 r600_irq_set(rdev);
1046
Jerome Glisse3ce0a232009-09-08 10:10:24 +10001047 r = radeon_ring_init(rdev, rdev->cp.ring_size);
1048 if (r)
1049 return r;
1050 r = rv770_cp_load_microcode(rdev);
1051 if (r)
1052 return r;
1053 r = r600_cp_resume(rdev);
1054 if (r)
1055 return r;
Alex Deucher724c80e2010-08-27 18:25:25 -04001056
Jerome Glisse3ce0a232009-09-08 10:10:24 +10001057 return 0;
1058}
1059
Dave Airliefc30b8e2009-09-18 15:19:37 +10001060int rv770_resume(struct radeon_device *rdev)
1061{
1062 int r;
1063
Jerome Glisse1a029b72009-10-06 19:04:30 +02001064 /* Do not reset GPU before posting, on rv770 hw unlike on r500 hw,
1065 * posting will perform necessary task to bring back GPU into good
1066 * shape.
1067 */
Dave Airliefc30b8e2009-09-18 15:19:37 +10001068 /* post card */
Jerome Glissee7d40b92009-10-01 18:02:15 +02001069 atom_asic_init(rdev->mode_info.atom_context);
Dave Airliefc30b8e2009-09-18 15:19:37 +10001070
1071 r = rv770_startup(rdev);
1072 if (r) {
1073 DRM_ERROR("r600 startup failed on resume\n");
1074 return r;
1075 }
1076
Jerome Glisse62a8ea32009-10-01 18:02:11 +02001077 r = r600_ib_test(rdev);
Dave Airliefc30b8e2009-09-18 15:19:37 +10001078 if (r) {
1079 DRM_ERROR("radeon: failled testing IB (%d).\n", r);
1080 return r;
1081 }
Rafał Miłecki8a8c6e72010-03-06 13:03:36 +00001082
1083 r = r600_audio_init(rdev);
1084 if (r) {
1085 dev_err(rdev->dev, "radeon: audio init failed\n");
1086 return r;
1087 }
1088
Dave Airliefc30b8e2009-09-18 15:19:37 +10001089 return r;
1090
1091}
1092
Jerome Glisse3ce0a232009-09-08 10:10:24 +10001093int rv770_suspend(struct radeon_device *rdev)
1094{
Jerome Glisse4c788672009-11-20 14:29:23 +01001095 int r;
1096
Rafał Miłecki8a8c6e72010-03-06 13:03:36 +00001097 r600_audio_fini(rdev);
Jerome Glisse3ce0a232009-09-08 10:10:24 +10001098 /* FIXME: we should wait for ring to be empty */
1099 r700_cp_stop(rdev);
Dave Airlie4153e582009-09-18 18:41:24 +10001100 rdev->cp.ready = false;
Jerome Glisse0c452492010-01-15 14:44:37 +01001101 r600_irq_suspend(rdev);
Alex Deucher724c80e2010-08-27 18:25:25 -04001102 radeon_wb_disable(rdev);
Jerome Glisse4aac0472009-09-14 18:29:49 +02001103 rv770_pcie_gart_disable(rdev);
Dave Airlie4153e582009-09-18 18:41:24 +10001104 /* unpin shaders bo */
Jerome Glisse30d2d9a2010-01-13 10:29:27 +01001105 if (rdev->r600_blit.shader_obj) {
1106 r = radeon_bo_reserve(rdev->r600_blit.shader_obj, false);
1107 if (likely(r == 0)) {
1108 radeon_bo_unpin(rdev->r600_blit.shader_obj);
1109 radeon_bo_unreserve(rdev->r600_blit.shader_obj);
1110 }
Jerome Glisse4c788672009-11-20 14:29:23 +01001111 }
Jerome Glisse3ce0a232009-09-08 10:10:24 +10001112 return 0;
1113}
1114
1115/* Plan is to move initialization in that function and use
1116 * helper function so that radeon_device_init pretty much
1117 * do nothing more than calling asic specific function. This
1118 * should also allow to remove a bunch of callback function
1119 * like vram_info.
1120 */
1121int rv770_init(struct radeon_device *rdev)
1122{
1123 int r;
1124
Jerome Glisse3ce0a232009-09-08 10:10:24 +10001125 r = radeon_dummy_page_init(rdev);
1126 if (r)
1127 return r;
1128 /* This don't do much */
1129 r = radeon_gem_init(rdev);
1130 if (r)
1131 return r;
1132 /* Read BIOS */
1133 if (!radeon_get_bios(rdev)) {
1134 if (ASIC_IS_AVIVO(rdev))
1135 return -EINVAL;
1136 }
1137 /* Must be an ATOMBIOS */
Jerome Glissee7d40b92009-10-01 18:02:15 +02001138 if (!rdev->is_atom_bios) {
1139 dev_err(rdev->dev, "Expecting atombios for R600 GPU\n");
Jerome Glisse3ce0a232009-09-08 10:10:24 +10001140 return -EINVAL;
Jerome Glissee7d40b92009-10-01 18:02:15 +02001141 }
Jerome Glisse3ce0a232009-09-08 10:10:24 +10001142 r = radeon_atombios_init(rdev);
1143 if (r)
1144 return r;
1145 /* Post card if necessary */
Dave Airlie72542d72009-12-01 14:06:31 +10001146 if (!r600_card_posted(rdev)) {
1147 if (!rdev->bios) {
1148 dev_err(rdev->dev, "Card not posted and no BIOS - ignoring\n");
1149 return -EINVAL;
1150 }
Jerome Glisse3ce0a232009-09-08 10:10:24 +10001151 DRM_INFO("GPU not posted. posting now...\n");
1152 atom_asic_init(rdev->mode_info.atom_context);
1153 }
1154 /* Initialize scratch registers */
1155 r600_scratch_init(rdev);
1156 /* Initialize surface registers */
1157 radeon_surface_init(rdev);
Rafał Miłecki74338742009-11-03 00:53:02 +01001158 /* Initialize clocks */
Michel Dänzer5e6dde72009-09-17 09:42:28 +02001159 radeon_get_clock_info(rdev->ddev);
Jerome Glisse3ce0a232009-09-08 10:10:24 +10001160 /* Fence driver */
1161 r = radeon_fence_driver_init(rdev);
1162 if (r)
1163 return r;
Jerome Glissed594e462010-02-17 21:54:29 +00001164 /* initialize AGP */
Jerome Glisse700a0cc2010-01-13 15:16:38 +01001165 if (rdev->flags & RADEON_IS_AGP) {
1166 r = radeon_agp_init(rdev);
1167 if (r)
1168 radeon_agp_disable(rdev);
1169 }
Jerome Glisse3ce0a232009-09-08 10:10:24 +10001170 r = rv770_mc_init(rdev);
Jerome Glisseb574f252009-10-06 19:04:29 +02001171 if (r)
Jerome Glisse3ce0a232009-09-08 10:10:24 +10001172 return r;
Jerome Glisse3ce0a232009-09-08 10:10:24 +10001173 /* Memory manager */
Jerome Glisse4c788672009-11-20 14:29:23 +01001174 r = radeon_bo_init(rdev);
Jerome Glisse3ce0a232009-09-08 10:10:24 +10001175 if (r)
1176 return r;
Alex Deucherd8f60cf2009-12-01 13:43:46 -05001177
1178 r = radeon_irq_kms_init(rdev);
1179 if (r)
1180 return r;
1181
Jerome Glisse3ce0a232009-09-08 10:10:24 +10001182 rdev->cp.ring_obj = NULL;
1183 r600_ring_init(rdev, 1024 * 1024);
1184
Alex Deucherd8f60cf2009-12-01 13:43:46 -05001185 rdev->ih.ring_obj = NULL;
1186 r600_ih_ring_init(rdev, 64 * 1024);
1187
Jerome Glisse4aac0472009-09-14 18:29:49 +02001188 r = r600_pcie_gart_init(rdev);
1189 if (r)
1190 return r;
1191
Alex Deucher779720a2009-12-09 19:31:44 -05001192 rdev->accel_working = true;
Dave Airliefc30b8e2009-09-18 15:19:37 +10001193 r = rv770_startup(rdev);
Jerome Glisse3ce0a232009-09-08 10:10:24 +10001194 if (r) {
Jerome Glisse655efd32010-02-02 11:51:45 +01001195 dev_err(rdev->dev, "disabling GPU acceleration\n");
Alex Deucherfe251e22010-03-24 13:36:43 -04001196 r700_cp_fini(rdev);
Jerome Glisse655efd32010-02-02 11:51:45 +01001197 r600_irq_fini(rdev);
Alex Deucher724c80e2010-08-27 18:25:25 -04001198 radeon_wb_fini(rdev);
Jerome Glisse655efd32010-02-02 11:51:45 +01001199 radeon_irq_kms_fini(rdev);
Jerome Glisse75c81292009-10-01 18:02:14 +02001200 rv770_pcie_gart_fini(rdev);
Jerome Glisse733289c2009-09-16 15:24:21 +02001201 rdev->accel_working = false;
Jerome Glisse3ce0a232009-09-08 10:10:24 +10001202 }
Jerome Glisse733289c2009-09-16 15:24:21 +02001203 if (rdev->accel_working) {
Jerome Glisse733289c2009-09-16 15:24:21 +02001204 r = radeon_ib_pool_init(rdev);
1205 if (r) {
Jerome Glissedb963802010-01-17 21:21:56 +01001206 dev_err(rdev->dev, "IB initialization failed (%d).\n", r);
Jerome Glisse733289c2009-09-16 15:24:21 +02001207 rdev->accel_working = false;
Jerome Glissedb963802010-01-17 21:21:56 +01001208 } else {
1209 r = r600_ib_test(rdev);
1210 if (r) {
1211 dev_err(rdev->dev, "IB test failed (%d).\n", r);
1212 rdev->accel_working = false;
1213 }
Jerome Glisse733289c2009-09-16 15:24:21 +02001214 }
Jerome Glisse3ce0a232009-09-08 10:10:24 +10001215 }
Rafał Miłecki8a8c6e72010-03-06 13:03:36 +00001216
1217 r = r600_audio_init(rdev);
1218 if (r) {
1219 dev_err(rdev->dev, "radeon: audio init failed\n");
1220 return r;
1221 }
1222
Jerome Glisse3ce0a232009-09-08 10:10:24 +10001223 return 0;
1224}
1225
1226void rv770_fini(struct radeon_device *rdev)
1227{
1228 r600_blit_fini(rdev);
Alex Deucherfe251e22010-03-24 13:36:43 -04001229 r700_cp_fini(rdev);
Alex Deucherd8f60cf2009-12-01 13:43:46 -05001230 r600_irq_fini(rdev);
Alex Deucher724c80e2010-08-27 18:25:25 -04001231 radeon_wb_fini(rdev);
Alex Deucherd8f60cf2009-12-01 13:43:46 -05001232 radeon_irq_kms_fini(rdev);
Jerome Glisse4aac0472009-09-14 18:29:49 +02001233 rv770_pcie_gart_fini(rdev);
Alex Deucher87cbf8f2010-08-27 13:59:54 -04001234 rv770_vram_scratch_fini(rdev);
Jerome Glisse3ce0a232009-09-08 10:10:24 +10001235 radeon_gem_fini(rdev);
1236 radeon_fence_driver_fini(rdev);
Jerome Glissed0269ed2010-01-07 16:08:32 +01001237 radeon_agp_fini(rdev);
Jerome Glisse4c788672009-11-20 14:29:23 +01001238 radeon_bo_fini(rdev);
Jerome Glissee7d40b92009-10-01 18:02:15 +02001239 radeon_atombios_fini(rdev);
Jerome Glisse3ce0a232009-09-08 10:10:24 +10001240 kfree(rdev->bios);
1241 rdev->bios = NULL;
1242 radeon_dummy_page_fini(rdev);
Jerome Glisse771fe6b2009-06-05 14:42:42 +02001243}