Lines Matching refs:rdev
49 static void rv770_gpu_init(struct radeon_device *rdev);
50 void rv770_fini(struct radeon_device *rdev);
51 static void rv770_pcie_gen2_enable(struct radeon_device *rdev);
52 int evergreen_set_uvd_clocks(struct radeon_device *rdev, u32 vclk, u32 dclk);
54 int rv770_set_uvd_clocks(struct radeon_device *rdev, u32 vclk, u32 dclk) in rv770_set_uvd_clocks() argument
60 if (rdev->family == CHIP_RV740) in rv770_set_uvd_clocks()
61 return evergreen_set_uvd_clocks(rdev, vclk, dclk); in rv770_set_uvd_clocks()
74 r = radeon_uvd_calc_upll_dividers(rdev, vclk, dclk, 50000, 160000, in rv770_set_uvd_clocks()
94 r = radeon_uvd_send_upll_ctlreq(rdev, CG_UPLL_FUNC_CNTL); in rv770_set_uvd_clocks()
125 r = radeon_uvd_send_upll_ctlreq(rdev, CG_UPLL_FUNC_CNTL); in rv770_set_uvd_clocks()
723 static void rv770_init_golden_registers(struct radeon_device *rdev) in rv770_init_golden_registers() argument
725 switch (rdev->family) { in rv770_init_golden_registers()
727 radeon_program_register_sequence(rdev, in rv770_init_golden_registers()
730 radeon_program_register_sequence(rdev, in rv770_init_golden_registers()
733 if (rdev->pdev->device == 0x994e) in rv770_init_golden_registers()
734 radeon_program_register_sequence(rdev, in rv770_init_golden_registers()
738 radeon_program_register_sequence(rdev, in rv770_init_golden_registers()
741 radeon_program_register_sequence(rdev, in rv770_init_golden_registers()
746 radeon_program_register_sequence(rdev, in rv770_init_golden_registers()
749 radeon_program_register_sequence(rdev, in rv770_init_golden_registers()
752 radeon_program_register_sequence(rdev, in rv770_init_golden_registers()
755 radeon_program_register_sequence(rdev, in rv770_init_golden_registers()
760 radeon_program_register_sequence(rdev, in rv770_init_golden_registers()
763 radeon_program_register_sequence(rdev, in rv770_init_golden_registers()
766 radeon_program_register_sequence(rdev, in rv770_init_golden_registers()
769 radeon_program_register_sequence(rdev, in rv770_init_golden_registers()
774 radeon_program_register_sequence(rdev, in rv770_init_golden_registers()
777 radeon_program_register_sequence(rdev, in rv770_init_golden_registers()
797 u32 rv770_get_xclk(struct radeon_device *rdev) in rv770_get_xclk() argument
799 u32 reference_clock = rdev->clock.spll.reference_freq; in rv770_get_xclk()
811 void rv770_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base, bool async) in rv770_page_flip() argument
813 struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id]; in rv770_page_flip()
842 for (i = 0; i < rdev->usec_timeout; i++) { in rv770_page_flip()
854 bool rv770_page_flip_pending(struct radeon_device *rdev, int crtc_id) in rv770_page_flip_pending() argument
856 struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id]; in rv770_page_flip_pending()
864 int rv770_get_temp(struct radeon_device *rdev) in rv770_get_temp() argument
883 void rv770_pm_misc(struct radeon_device *rdev) in rv770_pm_misc() argument
885 int req_ps_idx = rdev->pm.requested_power_state_index; in rv770_pm_misc()
886 int req_cm_idx = rdev->pm.requested_clock_mode_index; in rv770_pm_misc()
887 struct radeon_power_state *ps = &rdev->pm.power_state[req_ps_idx]; in rv770_pm_misc()
894 if (voltage->voltage != rdev->pm.current_vddc) { in rv770_pm_misc()
895 radeon_atom_set_voltage(rdev, voltage->voltage, SET_VOLTAGE_TYPE_ASIC_VDDC); in rv770_pm_misc()
896 rdev->pm.current_vddc = voltage->voltage; in rv770_pm_misc()
905 static int rv770_pcie_gart_enable(struct radeon_device *rdev) in rv770_pcie_gart_enable() argument
910 if (rdev->gart.robj == NULL) { in rv770_pcie_gart_enable()
911 dev_err(rdev->dev, "No VRAM object for PCIE GART.\n"); in rv770_pcie_gart_enable()
914 r = radeon_gart_table_vram_pin(rdev); in rv770_pcie_gart_enable()
931 if (rdev->family == CHIP_RV740) in rv770_pcie_gart_enable()
937 WREG32(VM_CONTEXT0_PAGE_TABLE_START_ADDR, rdev->mc.gtt_start >> 12); in rv770_pcie_gart_enable()
938 WREG32(VM_CONTEXT0_PAGE_TABLE_END_ADDR, rdev->mc.gtt_end >> 12); in rv770_pcie_gart_enable()
939 WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR, rdev->gart.table_addr >> 12); in rv770_pcie_gart_enable()
943 (u32)(rdev->dummy_page.addr >> 12)); in rv770_pcie_gart_enable()
947 r600_pcie_gart_tlb_flush(rdev); in rv770_pcie_gart_enable()
949 (unsigned)(rdev->mc.gtt_size >> 20), in rv770_pcie_gart_enable()
950 (unsigned long long)rdev->gart.table_addr); in rv770_pcie_gart_enable()
951 rdev->gart.ready = true; in rv770_pcie_gart_enable()
955 static void rv770_pcie_gart_disable(struct radeon_device *rdev) in rv770_pcie_gart_disable() argument
978 radeon_gart_table_vram_unpin(rdev); in rv770_pcie_gart_disable()
981 static void rv770_pcie_gart_fini(struct radeon_device *rdev) in rv770_pcie_gart_fini() argument
983 radeon_gart_fini(rdev); in rv770_pcie_gart_fini()
984 rv770_pcie_gart_disable(rdev); in rv770_pcie_gart_fini()
985 radeon_gart_table_vram_free(rdev); in rv770_pcie_gart_fini()
989 static void rv770_agp_enable(struct radeon_device *rdev) in rv770_agp_enable() argument
1016 static void rv770_mc_program(struct radeon_device *rdev) in rv770_mc_program() argument
1035 rv515_mc_stop(rdev, &save); in rv770_mc_program()
1036 if (r600_mc_wait_for_idle(rdev)) { in rv770_mc_program()
1037 dev_warn(rdev->dev, "Wait for MC idle timedout !\n"); in rv770_mc_program()
1042 if (rdev->flags & RADEON_IS_AGP) { in rv770_mc_program()
1043 if (rdev->mc.vram_start < rdev->mc.gtt_start) { in rv770_mc_program()
1046 rdev->mc.vram_start >> 12); in rv770_mc_program()
1048 rdev->mc.gtt_end >> 12); in rv770_mc_program()
1052 rdev->mc.gtt_start >> 12); in rv770_mc_program()
1054 rdev->mc.vram_end >> 12); in rv770_mc_program()
1058 rdev->mc.vram_start >> 12); in rv770_mc_program()
1060 rdev->mc.vram_end >> 12); in rv770_mc_program()
1062 WREG32(MC_VM_SYSTEM_APERTURE_DEFAULT_ADDR, rdev->vram_scratch.gpu_addr >> 12); in rv770_mc_program()
1063 tmp = ((rdev->mc.vram_end >> 24) & 0xFFFF) << 16; in rv770_mc_program()
1064 tmp |= ((rdev->mc.vram_start >> 24) & 0xFFFF); in rv770_mc_program()
1066 WREG32(HDP_NONSURFACE_BASE, (rdev->mc.vram_start >> 8)); in rv770_mc_program()
1069 if (rdev->flags & RADEON_IS_AGP) { in rv770_mc_program()
1070 WREG32(MC_VM_AGP_TOP, rdev->mc.gtt_end >> 16); in rv770_mc_program()
1071 WREG32(MC_VM_AGP_BOT, rdev->mc.gtt_start >> 16); in rv770_mc_program()
1072 WREG32(MC_VM_AGP_BASE, rdev->mc.agp_base >> 22); in rv770_mc_program()
1078 if (r600_mc_wait_for_idle(rdev)) { in rv770_mc_program()
1079 dev_warn(rdev->dev, "Wait for MC idle timedout !\n"); in rv770_mc_program()
1081 rv515_mc_resume(rdev, &save); in rv770_mc_program()
1084 rv515_vga_render_disable(rdev); in rv770_mc_program()
1091 void r700_cp_stop(struct radeon_device *rdev) in r700_cp_stop() argument
1093 if (rdev->asic->copy.copy_ring_index == RADEON_RING_TYPE_GFX_INDEX) in r700_cp_stop()
1094 radeon_ttm_set_active_vram_size(rdev, rdev->mc.visible_vram_size); in r700_cp_stop()
1097 rdev->ring[RADEON_RING_TYPE_GFX_INDEX].ready = false; in r700_cp_stop()
1100 static int rv770_cp_load_microcode(struct radeon_device *rdev) in rv770_cp_load_microcode() argument
1105 if (!rdev->me_fw || !rdev->pfp_fw) in rv770_cp_load_microcode()
1108 r700_cp_stop(rdev); in rv770_cp_load_microcode()
1121 fw_data = (const __be32 *)rdev->pfp_fw->data; in rv770_cp_load_microcode()
1127 fw_data = (const __be32 *)rdev->me_fw->data; in rv770_cp_load_microcode()
1138 void r700_cp_fini(struct radeon_device *rdev) in r700_cp_fini() argument
1140 struct radeon_ring *ring = &rdev->ring[RADEON_RING_TYPE_GFX_INDEX]; in r700_cp_fini()
1141 r700_cp_stop(rdev); in r700_cp_fini()
1142 radeon_ring_fini(rdev, ring); in r700_cp_fini()
1143 radeon_scratch_free(rdev, ring->rptr_save_reg); in r700_cp_fini()
1146 void rv770_set_clk_bypass_mode(struct radeon_device *rdev) in rv770_set_clk_bypass_mode() argument
1150 if (rdev->flags & RADEON_IS_IGP) in rv770_set_clk_bypass_mode()
1158 for (i = 0; i < rdev->usec_timeout; i++) { in rv770_set_clk_bypass_mode()
1168 if ((rdev->family == CHIP_RV710) || (rdev->family == CHIP_RV730)) in rv770_set_clk_bypass_mode()
1178 static void rv770_gpu_init(struct radeon_device *rdev) in rv770_gpu_init() argument
1202 rdev->config.rv770.tiling_group_size = 256; in rv770_gpu_init()
1203 switch (rdev->family) { in rv770_gpu_init()
1205 rdev->config.rv770.max_pipes = 4; in rv770_gpu_init()
1206 rdev->config.rv770.max_tile_pipes = 8; in rv770_gpu_init()
1207 rdev->config.rv770.max_simds = 10; in rv770_gpu_init()
1208 rdev->config.rv770.max_backends = 4; in rv770_gpu_init()
1209 rdev->config.rv770.max_gprs = 256; in rv770_gpu_init()
1210 rdev->config.rv770.max_threads = 248; in rv770_gpu_init()
1211 rdev->config.rv770.max_stack_entries = 512; in rv770_gpu_init()
1212 rdev->config.rv770.max_hw_contexts = 8; in rv770_gpu_init()
1213 rdev->config.rv770.max_gs_threads = 16 * 2; in rv770_gpu_init()
1214 rdev->config.rv770.sx_max_export_size = 128; in rv770_gpu_init()
1215 rdev->config.rv770.sx_max_export_pos_size = 16; in rv770_gpu_init()
1216 rdev->config.rv770.sx_max_export_smx_size = 112; in rv770_gpu_init()
1217 rdev->config.rv770.sq_num_cf_insts = 2; in rv770_gpu_init()
1219 rdev->config.rv770.sx_num_of_sets = 7; in rv770_gpu_init()
1220 rdev->config.rv770.sc_prim_fifo_size = 0xF9; in rv770_gpu_init()
1221 rdev->config.rv770.sc_hiz_tile_fifo_size = 0x30; in rv770_gpu_init()
1222 rdev->config.rv770.sc_earlyz_tile_fifo_fize = 0x130; in rv770_gpu_init()
1225 rdev->config.rv770.max_pipes = 2; in rv770_gpu_init()
1226 rdev->config.rv770.max_tile_pipes = 4; in rv770_gpu_init()
1227 rdev->config.rv770.max_simds = 8; in rv770_gpu_init()
1228 rdev->config.rv770.max_backends = 2; in rv770_gpu_init()
1229 rdev->config.rv770.max_gprs = 128; in rv770_gpu_init()
1230 rdev->config.rv770.max_threads = 248; in rv770_gpu_init()
1231 rdev->config.rv770.max_stack_entries = 256; in rv770_gpu_init()
1232 rdev->config.rv770.max_hw_contexts = 8; in rv770_gpu_init()
1233 rdev->config.rv770.max_gs_threads = 16 * 2; in rv770_gpu_init()
1234 rdev->config.rv770.sx_max_export_size = 256; in rv770_gpu_init()
1235 rdev->config.rv770.sx_max_export_pos_size = 32; in rv770_gpu_init()
1236 rdev->config.rv770.sx_max_export_smx_size = 224; in rv770_gpu_init()
1237 rdev->config.rv770.sq_num_cf_insts = 2; in rv770_gpu_init()
1239 rdev->config.rv770.sx_num_of_sets = 7; in rv770_gpu_init()
1240 rdev->config.rv770.sc_prim_fifo_size = 0xf9; in rv770_gpu_init()
1241 rdev->config.rv770.sc_hiz_tile_fifo_size = 0x30; in rv770_gpu_init()
1242 rdev->config.rv770.sc_earlyz_tile_fifo_fize = 0x130; in rv770_gpu_init()
1243 if (rdev->config.rv770.sx_max_export_pos_size > 16) { in rv770_gpu_init()
1244 rdev->config.rv770.sx_max_export_pos_size -= 16; in rv770_gpu_init()
1245 rdev->config.rv770.sx_max_export_smx_size += 16; in rv770_gpu_init()
1249 rdev->config.rv770.max_pipes = 2; in rv770_gpu_init()
1250 rdev->config.rv770.max_tile_pipes = 2; in rv770_gpu_init()
1251 rdev->config.rv770.max_simds = 2; in rv770_gpu_init()
1252 rdev->config.rv770.max_backends = 1; in rv770_gpu_init()
1253 rdev->config.rv770.max_gprs = 256; in rv770_gpu_init()
1254 rdev->config.rv770.max_threads = 192; in rv770_gpu_init()
1255 rdev->config.rv770.max_stack_entries = 256; in rv770_gpu_init()
1256 rdev->config.rv770.max_hw_contexts = 4; in rv770_gpu_init()
1257 rdev->config.rv770.max_gs_threads = 8 * 2; in rv770_gpu_init()
1258 rdev->config.rv770.sx_max_export_size = 128; in rv770_gpu_init()
1259 rdev->config.rv770.sx_max_export_pos_size = 16; in rv770_gpu_init()
1260 rdev->config.rv770.sx_max_export_smx_size = 112; in rv770_gpu_init()
1261 rdev->config.rv770.sq_num_cf_insts = 1; in rv770_gpu_init()
1263 rdev->config.rv770.sx_num_of_sets = 7; in rv770_gpu_init()
1264 rdev->config.rv770.sc_prim_fifo_size = 0x40; in rv770_gpu_init()
1265 rdev->config.rv770.sc_hiz_tile_fifo_size = 0x30; in rv770_gpu_init()
1266 rdev->config.rv770.sc_earlyz_tile_fifo_fize = 0x130; in rv770_gpu_init()
1269 rdev->config.rv770.max_pipes = 4; in rv770_gpu_init()
1270 rdev->config.rv770.max_tile_pipes = 4; in rv770_gpu_init()
1271 rdev->config.rv770.max_simds = 8; in rv770_gpu_init()
1272 rdev->config.rv770.max_backends = 4; in rv770_gpu_init()
1273 rdev->config.rv770.max_gprs = 256; in rv770_gpu_init()
1274 rdev->config.rv770.max_threads = 248; in rv770_gpu_init()
1275 rdev->config.rv770.max_stack_entries = 512; in rv770_gpu_init()
1276 rdev->config.rv770.max_hw_contexts = 8; in rv770_gpu_init()
1277 rdev->config.rv770.max_gs_threads = 16 * 2; in rv770_gpu_init()
1278 rdev->config.rv770.sx_max_export_size = 256; in rv770_gpu_init()
1279 rdev->config.rv770.sx_max_export_pos_size = 32; in rv770_gpu_init()
1280 rdev->config.rv770.sx_max_export_smx_size = 224; in rv770_gpu_init()
1281 rdev->config.rv770.sq_num_cf_insts = 2; in rv770_gpu_init()
1283 rdev->config.rv770.sx_num_of_sets = 7; in rv770_gpu_init()
1284 rdev->config.rv770.sc_prim_fifo_size = 0x100; in rv770_gpu_init()
1285 rdev->config.rv770.sc_hiz_tile_fifo_size = 0x30; in rv770_gpu_init()
1286 rdev->config.rv770.sc_earlyz_tile_fifo_fize = 0x130; in rv770_gpu_init()
1288 if (rdev->config.rv770.sx_max_export_pos_size > 16) { in rv770_gpu_init()
1289 rdev->config.rv770.sx_max_export_pos_size -= 16; in rv770_gpu_init()
1290 rdev->config.rv770.sx_max_export_smx_size += 16; in rv770_gpu_init()
1328 tmp = rdev->config.rv770.max_simds - in rv770_gpu_init()
1330 rdev->config.rv770.active_simds = tmp; in rv770_gpu_init()
1332 switch (rdev->config.rv770.max_tile_pipes) { in rv770_gpu_init()
1347 rdev->config.rv770.tiling_npipes = rdev->config.rv770.max_tile_pipes; in rv770_gpu_init()
1351 for (i = 0; i < rdev->config.rv770.max_backends; i++) in rv770_gpu_init()
1355 for (i = 0; i < rdev->config.rv770.max_backends; i++) in rv770_gpu_init()
1359 tmp = r6xx_remap_render_backend(rdev, tmp, rdev->config.rv770.max_backends, in rv770_gpu_init()
1362 rdev->config.rv770.backend_map = tmp; in rv770_gpu_init()
1364 if (rdev->family == CHIP_RV770) in rv770_gpu_init()
1372 rdev->config.rv770.tiling_nbanks = 4 << ((gb_tiling_config >> 4) & 0x3); in rv770_gpu_init()
1385 rdev->config.rv770.tile_config = gb_tiling_config; in rv770_gpu_init()
1392 if (rdev->family == CHIP_RV730) { in rv770_gpu_init()
1423 smx_dc_ctl0 |= CACHE_DEPTH((rdev->config.rv770.sx_num_of_sets * 64) - 1); in rv770_gpu_init()
1426 if (rdev->family != CHIP_RV740) in rv770_gpu_init()
1432 if (rdev->family != CHIP_RV770) in rv770_gpu_init()
1437 switch (rdev->family) { in rv770_gpu_init()
1450 if (rdev->family != CHIP_RV770) { in rv770_gpu_init()
1456 …WREG32(SX_EXPORT_BUFFER_SIZES, (COLOR_BUFFER_SIZE((rdev->config.rv770.sx_max_export_size / 4) - 1)… in rv770_gpu_init()
1457 POSITION_BUFFER_SIZE((rdev->config.rv770.sx_max_export_pos_size / 4) - 1) | in rv770_gpu_init()
1458 SMX_BUFFER_SIZE((rdev->config.rv770.sx_max_export_smx_size / 4) - 1))); in rv770_gpu_init()
1460 WREG32(PA_SC_FIFO_SIZE, (SC_PRIM_FIFO_SIZE(rdev->config.rv770.sc_prim_fifo_size) | in rv770_gpu_init()
1461 SC_HIZ_TILE_FIFO_SIZE(rdev->config.rv770.sc_hiz_tile_fifo_size) | in rv770_gpu_init()
1462 SC_EARLYZ_TILE_FIFO_SIZE(rdev->config.rv770.sc_earlyz_tile_fifo_fize))); in rv770_gpu_init()
1472 sq_ms_fifo_sizes = (CACHE_FIFO_SIZE(16 * rdev->config.rv770.sq_num_cf_insts) | in rv770_gpu_init()
1475 switch (rdev->family) { in rv770_gpu_init()
1503 if (rdev->family == CHIP_RV710) in rv770_gpu_init()
1509 WREG32(SQ_GPR_RESOURCE_MGMT_1, (NUM_PS_GPRS((rdev->config.rv770.max_gprs * 24)/64) | in rv770_gpu_init()
1510 NUM_VS_GPRS((rdev->config.rv770.max_gprs * 24)/64) | in rv770_gpu_init()
1511 NUM_CLAUSE_TEMP_GPRS(((rdev->config.rv770.max_gprs * 24)/64)/2))); in rv770_gpu_init()
1513 WREG32(SQ_GPR_RESOURCE_MGMT_2, (NUM_GS_GPRS((rdev->config.rv770.max_gprs * 7)/64) | in rv770_gpu_init()
1514 NUM_ES_GPRS((rdev->config.rv770.max_gprs * 7)/64))); in rv770_gpu_init()
1516 sq_thread_resource_mgmt = (NUM_PS_THREADS((rdev->config.rv770.max_threads * 4)/8) | in rv770_gpu_init()
1517 NUM_VS_THREADS((rdev->config.rv770.max_threads * 2)/8) | in rv770_gpu_init()
1518 NUM_ES_THREADS((rdev->config.rv770.max_threads * 1)/8)); in rv770_gpu_init()
1519 if (((rdev->config.rv770.max_threads * 1) / 8) > rdev->config.rv770.max_gs_threads) in rv770_gpu_init()
1520 sq_thread_resource_mgmt |= NUM_GS_THREADS(rdev->config.rv770.max_gs_threads); in rv770_gpu_init()
1522 sq_thread_resource_mgmt |= NUM_GS_THREADS((rdev->config.rv770.max_gs_threads * 1)/8); in rv770_gpu_init()
1525 …WREG32(SQ_STACK_RESOURCE_MGMT_1, (NUM_PS_STACK_ENTRIES((rdev->config.rv770.max_stack_entries * 1)/… in rv770_gpu_init()
1526 NUM_VS_STACK_ENTRIES((rdev->config.rv770.max_stack_entries * 1)/4))); in rv770_gpu_init()
1528 …WREG32(SQ_STACK_RESOURCE_MGMT_2, (NUM_GS_STACK_ENTRIES((rdev->config.rv770.max_stack_entries * 1)/… in rv770_gpu_init()
1529 NUM_ES_STACK_ENTRIES((rdev->config.rv770.max_stack_entries * 1)/4))); in rv770_gpu_init()
1531 sq_dyn_gpr_size_simd_ab_0 = (SIMDA_RING0((rdev->config.rv770.max_gprs * 38)/64) | in rv770_gpu_init()
1532 SIMDA_RING1((rdev->config.rv770.max_gprs * 38)/64) | in rv770_gpu_init()
1533 SIMDB_RING0((rdev->config.rv770.max_gprs * 38)/64) | in rv770_gpu_init()
1534 SIMDB_RING1((rdev->config.rv770.max_gprs * 38)/64)); in rv770_gpu_init()
1548 if (rdev->family == CHIP_RV710) in rv770_gpu_init()
1555 switch (rdev->family) { in rv770_gpu_init()
1568 num_gs_verts_per_thread = rdev->config.rv770.max_pipes * 16; in rv770_gpu_init()
1614 void r700_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc) in r700_vram_gtt_location() argument
1620 dev_warn(rdev->dev, "limiting VRAM\n"); in r700_vram_gtt_location()
1624 if (rdev->flags & RADEON_IS_AGP) { in r700_vram_gtt_location()
1629 dev_warn(rdev->dev, "limiting VRAM\n"); in r700_vram_gtt_location()
1636 dev_warn(rdev->dev, "limiting VRAM\n"); in r700_vram_gtt_location()
1643 dev_info(rdev->dev, "VRAM: %lluM 0x%08llX - 0x%08llX (%lluM used)\n", in r700_vram_gtt_location()
1647 radeon_vram_location(rdev, &rdev->mc, 0); in r700_vram_gtt_location()
1648 rdev->mc.gtt_base_align = 0; in r700_vram_gtt_location()
1649 radeon_gtt_location(rdev, mc); in r700_vram_gtt_location()
1653 static int rv770_mc_init(struct radeon_device *rdev) in rv770_mc_init() argument
1659 rdev->mc.vram_is_ddr = true; in rv770_mc_init()
1684 rdev->mc.vram_width = numchan * chansize; in rv770_mc_init()
1686 rdev->mc.aper_base = pci_resource_start(rdev->pdev, 0); in rv770_mc_init()
1687 rdev->mc.aper_size = pci_resource_len(rdev->pdev, 0); in rv770_mc_init()
1689 rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE); in rv770_mc_init()
1690 rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE); in rv770_mc_init()
1691 rdev->mc.visible_vram_size = rdev->mc.aper_size; in rv770_mc_init()
1692 r700_vram_gtt_location(rdev, &rdev->mc); in rv770_mc_init()
1693 radeon_update_bandwidth_info(rdev); in rv770_mc_init()
1698 static void rv770_uvd_init(struct radeon_device *rdev) in rv770_uvd_init() argument
1702 if (!rdev->has_uvd) in rv770_uvd_init()
1705 r = radeon_uvd_init(rdev); in rv770_uvd_init()
1707 dev_err(rdev->dev, "failed UVD (%d) init.\n", r); in rv770_uvd_init()
1714 rdev->has_uvd = false; in rv770_uvd_init()
1717 rdev->ring[R600_RING_TYPE_UVD_INDEX].ring_obj = NULL; in rv770_uvd_init()
1718 r600_ring_init(rdev, &rdev->ring[R600_RING_TYPE_UVD_INDEX], 4096); in rv770_uvd_init()
1721 static void rv770_uvd_start(struct radeon_device *rdev) in rv770_uvd_start() argument
1725 if (!rdev->has_uvd) in rv770_uvd_start()
1728 r = uvd_v2_2_resume(rdev); in rv770_uvd_start()
1730 dev_err(rdev->dev, "failed UVD resume (%d).\n", r); in rv770_uvd_start()
1733 r = radeon_fence_driver_start_ring(rdev, R600_RING_TYPE_UVD_INDEX); in rv770_uvd_start()
1735 dev_err(rdev->dev, "failed initializing UVD fences (%d).\n", r); in rv770_uvd_start()
1741 rdev->ring[R600_RING_TYPE_UVD_INDEX].ring_size = 0; in rv770_uvd_start()
1744 static void rv770_uvd_resume(struct radeon_device *rdev) in rv770_uvd_resume() argument
1749 if (!rdev->has_uvd || !rdev->ring[R600_RING_TYPE_UVD_INDEX].ring_size) in rv770_uvd_resume()
1752 ring = &rdev->ring[R600_RING_TYPE_UVD_INDEX]; in rv770_uvd_resume()
1753 r = radeon_ring_init(rdev, ring, ring->ring_size, 0, PACKET0(UVD_NO_OP, 0)); in rv770_uvd_resume()
1755 dev_err(rdev->dev, "failed initializing UVD ring (%d).\n", r); in rv770_uvd_resume()
1758 r = uvd_v1_0_init(rdev); in rv770_uvd_resume()
1760 dev_err(rdev->dev, "failed initializing UVD (%d).\n", r); in rv770_uvd_resume()
1765 static int rv770_startup(struct radeon_device *rdev) in rv770_startup() argument
1771 rv770_pcie_gen2_enable(rdev); in rv770_startup()
1774 r = r600_vram_scratch_init(rdev); in rv770_startup()
1778 rv770_mc_program(rdev); in rv770_startup()
1780 if (rdev->flags & RADEON_IS_AGP) { in rv770_startup()
1781 rv770_agp_enable(rdev); in rv770_startup()
1783 r = rv770_pcie_gart_enable(rdev); in rv770_startup()
1788 rv770_gpu_init(rdev); in rv770_startup()
1791 r = radeon_wb_init(rdev); in rv770_startup()
1795 r = radeon_fence_driver_start_ring(rdev, RADEON_RING_TYPE_GFX_INDEX); in rv770_startup()
1797 dev_err(rdev->dev, "failed initializing CP fences (%d).\n", r); in rv770_startup()
1801 r = radeon_fence_driver_start_ring(rdev, R600_RING_TYPE_DMA_INDEX); in rv770_startup()
1803 dev_err(rdev->dev, "failed initializing DMA fences (%d).\n", r); in rv770_startup()
1807 rv770_uvd_start(rdev); in rv770_startup()
1810 if (!rdev->irq.installed) { in rv770_startup()
1811 r = radeon_irq_kms_init(rdev); in rv770_startup()
1816 r = r600_irq_init(rdev); in rv770_startup()
1819 radeon_irq_kms_fini(rdev); in rv770_startup()
1822 r600_irq_set(rdev); in rv770_startup()
1824 ring = &rdev->ring[RADEON_RING_TYPE_GFX_INDEX]; in rv770_startup()
1825 r = radeon_ring_init(rdev, ring, ring->ring_size, RADEON_WB_CP_RPTR_OFFSET, in rv770_startup()
1830 ring = &rdev->ring[R600_RING_TYPE_DMA_INDEX]; in rv770_startup()
1831 r = radeon_ring_init(rdev, ring, ring->ring_size, R600_WB_DMA_RPTR_OFFSET, in rv770_startup()
1836 r = rv770_cp_load_microcode(rdev); in rv770_startup()
1839 r = r600_cp_resume(rdev); in rv770_startup()
1843 r = r600_dma_resume(rdev); in rv770_startup()
1847 rv770_uvd_resume(rdev); in rv770_startup()
1849 r = radeon_ib_pool_init(rdev); in rv770_startup()
1851 dev_err(rdev->dev, "IB initialization failed (%d).\n", r); in rv770_startup()
1855 r = radeon_audio_init(rdev); in rv770_startup()
1864 int rv770_resume(struct radeon_device *rdev) in rv770_resume() argument
1873 atom_asic_init(rdev->mode_info.atom_context); in rv770_resume()
1876 rv770_init_golden_registers(rdev); in rv770_resume()
1878 if (rdev->pm.pm_method == PM_METHOD_DPM) in rv770_resume()
1879 radeon_pm_resume(rdev); in rv770_resume()
1881 rdev->accel_working = true; in rv770_resume()
1882 r = rv770_startup(rdev); in rv770_resume()
1885 rdev->accel_working = false; in rv770_resume()
1893 int rv770_suspend(struct radeon_device *rdev) in rv770_suspend() argument
1895 radeon_pm_suspend(rdev); in rv770_suspend()
1896 radeon_audio_fini(rdev); in rv770_suspend()
1897 if (rdev->has_uvd) { in rv770_suspend()
1898 radeon_uvd_suspend(rdev); in rv770_suspend()
1899 uvd_v1_0_fini(rdev); in rv770_suspend()
1901 r700_cp_stop(rdev); in rv770_suspend()
1902 r600_dma_stop(rdev); in rv770_suspend()
1903 r600_irq_suspend(rdev); in rv770_suspend()
1904 radeon_wb_disable(rdev); in rv770_suspend()
1905 rv770_pcie_gart_disable(rdev); in rv770_suspend()
1916 int rv770_init(struct radeon_device *rdev) in rv770_init() argument
1921 if (!radeon_get_bios(rdev)) { in rv770_init()
1922 if (ASIC_IS_AVIVO(rdev)) in rv770_init()
1926 if (!rdev->is_atom_bios) { in rv770_init()
1927 dev_err(rdev->dev, "Expecting atombios for R600 GPU\n"); in rv770_init()
1930 r = radeon_atombios_init(rdev); in rv770_init()
1934 if (!radeon_card_posted(rdev)) { in rv770_init()
1935 if (!rdev->bios) { in rv770_init()
1936 dev_err(rdev->dev, "Card not posted and no BIOS - ignoring\n"); in rv770_init()
1940 atom_asic_init(rdev->mode_info.atom_context); in rv770_init()
1943 rv770_init_golden_registers(rdev); in rv770_init()
1945 r600_scratch_init(rdev); in rv770_init()
1947 radeon_surface_init(rdev); in rv770_init()
1949 radeon_get_clock_info(rdev->ddev); in rv770_init()
1951 radeon_fence_driver_init(rdev); in rv770_init()
1953 if (rdev->flags & RADEON_IS_AGP) { in rv770_init()
1954 r = radeon_agp_init(rdev); in rv770_init()
1956 radeon_agp_disable(rdev); in rv770_init()
1958 r = rv770_mc_init(rdev); in rv770_init()
1962 r = radeon_bo_init(rdev); in rv770_init()
1966 if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw) { in rv770_init()
1967 r = r600_init_microcode(rdev); in rv770_init()
1975 radeon_pm_init(rdev); in rv770_init()
1977 rdev->ring[RADEON_RING_TYPE_GFX_INDEX].ring_obj = NULL; in rv770_init()
1978 r600_ring_init(rdev, &rdev->ring[RADEON_RING_TYPE_GFX_INDEX], 1024 * 1024); in rv770_init()
1980 rdev->ring[R600_RING_TYPE_DMA_INDEX].ring_obj = NULL; in rv770_init()
1981 r600_ring_init(rdev, &rdev->ring[R600_RING_TYPE_DMA_INDEX], 64 * 1024); in rv770_init()
1983 rv770_uvd_init(rdev); in rv770_init()
1985 rdev->ih.ring_obj = NULL; in rv770_init()
1986 r600_ih_ring_init(rdev, 64 * 1024); in rv770_init()
1988 r = r600_pcie_gart_init(rdev); in rv770_init()
1992 rdev->accel_working = true; in rv770_init()
1993 r = rv770_startup(rdev); in rv770_init()
1995 dev_err(rdev->dev, "disabling GPU acceleration\n"); in rv770_init()
1996 r700_cp_fini(rdev); in rv770_init()
1997 r600_dma_fini(rdev); in rv770_init()
1998 r600_irq_fini(rdev); in rv770_init()
1999 radeon_wb_fini(rdev); in rv770_init()
2000 radeon_ib_pool_fini(rdev); in rv770_init()
2001 radeon_irq_kms_fini(rdev); in rv770_init()
2002 rv770_pcie_gart_fini(rdev); in rv770_init()
2003 rdev->accel_working = false; in rv770_init()
2009 void rv770_fini(struct radeon_device *rdev) in rv770_fini() argument
2011 radeon_pm_fini(rdev); in rv770_fini()
2012 r700_cp_fini(rdev); in rv770_fini()
2013 r600_dma_fini(rdev); in rv770_fini()
2014 r600_irq_fini(rdev); in rv770_fini()
2015 radeon_wb_fini(rdev); in rv770_fini()
2016 radeon_ib_pool_fini(rdev); in rv770_fini()
2017 radeon_irq_kms_fini(rdev); in rv770_fini()
2018 uvd_v1_0_fini(rdev); in rv770_fini()
2019 radeon_uvd_fini(rdev); in rv770_fini()
2020 rv770_pcie_gart_fini(rdev); in rv770_fini()
2021 r600_vram_scratch_fini(rdev); in rv770_fini()
2022 radeon_gem_fini(rdev); in rv770_fini()
2023 radeon_fence_driver_fini(rdev); in rv770_fini()
2024 radeon_agp_fini(rdev); in rv770_fini()
2025 radeon_bo_fini(rdev); in rv770_fini()
2026 radeon_atombios_fini(rdev); in rv770_fini()
2027 kfree(rdev->bios); in rv770_fini()
2028 rdev->bios = NULL; in rv770_fini()
2031 static void rv770_pcie_gen2_enable(struct radeon_device *rdev) in rv770_pcie_gen2_enable() argument
2039 if (rdev->flags & RADEON_IS_IGP) in rv770_pcie_gen2_enable()
2042 if (!(rdev->flags & RADEON_IS_PCIE)) in rv770_pcie_gen2_enable()
2046 if (ASIC_IS_X2(rdev)) in rv770_pcie_gen2_enable()
2049 if ((rdev->pdev->bus->max_bus_speed != PCIE_SPEED_5_0GT) && in rv770_pcie_gen2_enable()
2050 (rdev->pdev->bus->max_bus_speed != PCIE_SPEED_8_0GT)) in rv770_pcie_gen2_enable()