Lines Matching refs:rdev

37 int rs690_mc_wait_for_idle(struct radeon_device *rdev)  in rs690_mc_wait_for_idle()  argument
42 for (i = 0; i < rdev->usec_timeout; i++) { in rs690_mc_wait_for_idle()
52 static void rs690_gpu_init(struct radeon_device *rdev) in rs690_gpu_init() argument
55 r420_pipes_init(rdev); in rs690_gpu_init()
56 if (rs690_mc_wait_for_idle(rdev)) { in rs690_gpu_init()
66 void rs690_pm_info(struct radeon_device *rdev) in rs690_pm_info() argument
74 if (atom_parse_data_header(rdev->mode_info.atom_context, index, NULL, in rs690_pm_info()
76 info = (union igp_info *)(rdev->mode_info.atom_context->bios + data_offset); in rs690_pm_info()
82 rdev->pm.igp_sideport_mclk.full = dfixed_const(le32_to_cpu(info->info.ulBootUpMemoryClock)); in rs690_pm_info()
83 rdev->pm.igp_sideport_mclk.full = dfixed_div(rdev->pm.igp_sideport_mclk, tmp); in rs690_pm_info()
85 rdev->pm.igp_system_mclk.full = dfixed_const(le16_to_cpu(info->info.usK8MemoryClock)); in rs690_pm_info()
86 else if (rdev->clock.default_mclk) { in rs690_pm_info()
87 rdev->pm.igp_system_mclk.full = dfixed_const(rdev->clock.default_mclk); in rs690_pm_info()
88 rdev->pm.igp_system_mclk.full = dfixed_div(rdev->pm.igp_system_mclk, tmp); in rs690_pm_info()
90 rdev->pm.igp_system_mclk.full = dfixed_const(400); in rs690_pm_info()
91 rdev->pm.igp_ht_link_clk.full = dfixed_const(le16_to_cpu(info->info.usFSBClock)); in rs690_pm_info()
92 rdev->pm.igp_ht_link_width.full = dfixed_const(info->info.ucHTLinkWidth); in rs690_pm_info()
96 rdev->pm.igp_sideport_mclk.full = dfixed_const(le32_to_cpu(info->info_v2.ulBootUpSidePortClock)); in rs690_pm_info()
97 rdev->pm.igp_sideport_mclk.full = dfixed_div(rdev->pm.igp_sideport_mclk, tmp); in rs690_pm_info()
99 rdev->pm.igp_system_mclk.full = dfixed_const(le32_to_cpu(info->info_v2.ulBootUpUMAClock)); in rs690_pm_info()
100 else if (rdev->clock.default_mclk) in rs690_pm_info()
101 rdev->pm.igp_system_mclk.full = dfixed_const(rdev->clock.default_mclk); in rs690_pm_info()
103 rdev->pm.igp_system_mclk.full = dfixed_const(66700); in rs690_pm_info()
104 rdev->pm.igp_system_mclk.full = dfixed_div(rdev->pm.igp_system_mclk, tmp); in rs690_pm_info()
105 rdev->pm.igp_ht_link_clk.full = dfixed_const(le32_to_cpu(info->info_v2.ulHTLinkFreq)); in rs690_pm_info()
106 rdev->pm.igp_ht_link_clk.full = dfixed_div(rdev->pm.igp_ht_link_clk, tmp); in rs690_pm_info()
107 rdev->pm.igp_ht_link_width.full = dfixed_const(le16_to_cpu(info->info_v2.usMinHTLinkWidth)); in rs690_pm_info()
111 rdev->pm.igp_sideport_mclk.full = dfixed_const(200); in rs690_pm_info()
112 rdev->pm.igp_system_mclk.full = dfixed_const(200); in rs690_pm_info()
113 rdev->pm.igp_ht_link_clk.full = dfixed_const(1000); in rs690_pm_info()
114 rdev->pm.igp_ht_link_width.full = dfixed_const(8); in rs690_pm_info()
120 rdev->pm.igp_sideport_mclk.full = dfixed_const(200); in rs690_pm_info()
121 rdev->pm.igp_system_mclk.full = dfixed_const(200); in rs690_pm_info()
122 rdev->pm.igp_ht_link_clk.full = dfixed_const(1000); in rs690_pm_info()
123 rdev->pm.igp_ht_link_width.full = dfixed_const(8); in rs690_pm_info()
129 rdev->pm.k8_bandwidth.full = dfixed_mul(rdev->pm.igp_system_mclk, tmp); in rs690_pm_info()
134 rdev->pm.ht_bandwidth.full = dfixed_mul(rdev->pm.igp_ht_link_clk, in rs690_pm_info()
135 rdev->pm.igp_ht_link_width); in rs690_pm_info()
136 rdev->pm.ht_bandwidth.full = dfixed_div(rdev->pm.ht_bandwidth, tmp); in rs690_pm_info()
137 if (tmp.full < rdev->pm.max_bandwidth.full) { in rs690_pm_info()
139 rdev->pm.max_bandwidth.full = tmp.full; in rs690_pm_info()
145 rdev->pm.sideport_bandwidth.full = dfixed_mul(rdev->pm.igp_sideport_mclk, tmp); in rs690_pm_info()
147 rdev->pm.sideport_bandwidth.full = dfixed_div(rdev->pm.sideport_bandwidth, tmp); in rs690_pm_info()
150 static void rs690_mc_init(struct radeon_device *rdev) in rs690_mc_init() argument
156 rs400_gart_adjust_size(rdev); in rs690_mc_init()
157 rdev->mc.vram_is_ddr = true; in rs690_mc_init()
158 rdev->mc.vram_width = 128; in rs690_mc_init()
159 rdev->mc.real_vram_size = RREG32(RADEON_CONFIG_MEMSIZE); in rs690_mc_init()
160 rdev->mc.mc_vram_size = rdev->mc.real_vram_size; in rs690_mc_init()
161 rdev->mc.aper_base = pci_resource_start(rdev->pdev, 0); in rs690_mc_init()
162 rdev->mc.aper_size = pci_resource_len(rdev->pdev, 0); in rs690_mc_init()
163 rdev->mc.visible_vram_size = rdev->mc.aper_size; in rs690_mc_init()
166 rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev); in rs690_mc_init()
171 if (rdev->mc.igp_sideport_enabled && in rs690_mc_init()
172 (rdev->mc.real_vram_size == (384 * 1024 * 1024))) { in rs690_mc_init()
174 rdev->mc.real_vram_size -= 128 * 1024 * 1024; in rs690_mc_init()
175 rdev->mc.mc_vram_size = rdev->mc.real_vram_size; in rs690_mc_init()
179 rdev->fastfb_working = false; in rs690_mc_init()
184 if (k8_addr + rdev->mc.visible_vram_size < 0x100000000ULL) in rs690_mc_init()
190 if (!rdev->mc.igp_sideport_enabled && radeon_fastfb == 1) { in rs690_mc_init()
192 (unsigned long long)rdev->mc.aper_base, k8_addr); in rs690_mc_init()
193 rdev->mc.aper_base = (resource_size_t)k8_addr; in rs690_mc_init()
194 rdev->fastfb_working = true; in rs690_mc_init()
198 rs690_pm_info(rdev); in rs690_mc_init()
199 radeon_vram_location(rdev, &rdev->mc, base); in rs690_mc_init()
200 rdev->mc.gtt_base_align = rdev->mc.gtt_size - 1; in rs690_mc_init()
201 radeon_gtt_location(rdev, &rdev->mc); in rs690_mc_init()
202 radeon_update_bandwidth_info(rdev); in rs690_mc_init()
205 void rs690_line_buffer_adjust(struct radeon_device *rdev, in rs690_line_buffer_adjust() argument
253 rdev->mode_info.crtcs[0]->lb_vblank_lead_lines = DIV_ROUND_UP(lb_size, mode1->crtc_hdisplay); in rs690_line_buffer_adjust()
256 rdev->mode_info.crtcs[1]->lb_vblank_lead_lines = DIV_ROUND_UP(lb_size, mode2->crtc_hdisplay); in rs690_line_buffer_adjust()
272 static void rs690_crtc_bandwidth_compute(struct radeon_device *rdev, in rs690_crtc_bandwidth_compute() argument
290 if (((rdev->family == CHIP_RS780) || (rdev->family == CHIP_RS880)) && in rs690_crtc_bandwidth_compute()
291 (rdev->pm.pm_method == PM_METHOD_DPM) && rdev->pm.dpm_enabled) in rs690_crtc_bandwidth_compute()
292 selected_sclk = radeon_dpm_get_sclk(rdev, low); in rs690_crtc_bandwidth_compute()
294 selected_sclk = rdev->pm.current_sclk; in rs690_crtc_bandwidth_compute()
303 core_bandwidth.full = dfixed_div(rdev->pm.sclk, a); in rs690_crtc_bandwidth_compute()
366 if (rdev->mc.igp_sideport_enabled) { in rs690_crtc_bandwidth_compute()
367 if (max_bandwidth.full > rdev->pm.sideport_bandwidth.full && in rs690_crtc_bandwidth_compute()
368 rdev->pm.sideport_bandwidth.full) in rs690_crtc_bandwidth_compute()
369 max_bandwidth = rdev->pm.sideport_bandwidth; in rs690_crtc_bandwidth_compute()
372 b.full = dfixed_div(rdev->pm.igp_sideport_mclk, a); in rs690_crtc_bandwidth_compute()
376 if (max_bandwidth.full > rdev->pm.k8_bandwidth.full && in rs690_crtc_bandwidth_compute()
377 rdev->pm.k8_bandwidth.full) in rs690_crtc_bandwidth_compute()
378 max_bandwidth = rdev->pm.k8_bandwidth; in rs690_crtc_bandwidth_compute()
379 if (max_bandwidth.full > rdev->pm.ht_bandwidth.full && in rs690_crtc_bandwidth_compute()
380 rdev->pm.ht_bandwidth.full) in rs690_crtc_bandwidth_compute()
381 max_bandwidth = rdev->pm.ht_bandwidth; in rs690_crtc_bandwidth_compute()
460 static void rs690_compute_mode_priority(struct radeon_device *rdev, in rs690_compute_mode_priority() argument
523 if (rdev->disp_priority == 2) { in rs690_compute_mode_priority()
552 if (rdev->disp_priority == 2) in rs690_compute_mode_priority()
579 if (rdev->disp_priority == 2) in rs690_compute_mode_priority()
584 void rs690_bandwidth_update(struct radeon_device *rdev) in rs690_bandwidth_update() argument
594 if (!rdev->mode_info.mode_config_initialized) in rs690_bandwidth_update()
597 radeon_update_display_priority(rdev); in rs690_bandwidth_update()
599 if (rdev->mode_info.crtcs[0]->base.enabled) in rs690_bandwidth_update()
600 mode0 = &rdev->mode_info.crtcs[0]->base.mode; in rs690_bandwidth_update()
601 if (rdev->mode_info.crtcs[1]->base.enabled) in rs690_bandwidth_update()
602 mode1 = &rdev->mode_info.crtcs[1]->base.mode; in rs690_bandwidth_update()
608 if ((rdev->disp_priority == 2) && in rs690_bandwidth_update()
609 ((rdev->family == CHIP_RS690) || (rdev->family == CHIP_RS740))) { in rs690_bandwidth_update()
619 rs690_line_buffer_adjust(rdev, mode0, mode1); in rs690_bandwidth_update()
621 if ((rdev->family == CHIP_RS690) || (rdev->family == CHIP_RS740)) in rs690_bandwidth_update()
623 if ((rdev->family == CHIP_RS780) || (rdev->family == CHIP_RS880)) in rs690_bandwidth_update()
626 rs690_crtc_bandwidth_compute(rdev, rdev->mode_info.crtcs[0], &wm0_high, false); in rs690_bandwidth_update()
627 rs690_crtc_bandwidth_compute(rdev, rdev->mode_info.crtcs[1], &wm1_high, false); in rs690_bandwidth_update()
629 rs690_crtc_bandwidth_compute(rdev, rdev->mode_info.crtcs[0], &wm0_low, true); in rs690_bandwidth_update()
630 rs690_crtc_bandwidth_compute(rdev, rdev->mode_info.crtcs[1], &wm1_low, true); in rs690_bandwidth_update()
636 rs690_compute_mode_priority(rdev, in rs690_bandwidth_update()
640 rs690_compute_mode_priority(rdev, in rs690_bandwidth_update()
651 uint32_t rs690_mc_rreg(struct radeon_device *rdev, uint32_t reg) in rs690_mc_rreg() argument
656 spin_lock_irqsave(&rdev->mc_idx_lock, flags); in rs690_mc_rreg()
660 spin_unlock_irqrestore(&rdev->mc_idx_lock, flags); in rs690_mc_rreg()
664 void rs690_mc_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v) in rs690_mc_wreg() argument
668 spin_lock_irqsave(&rdev->mc_idx_lock, flags); in rs690_mc_wreg()
673 spin_unlock_irqrestore(&rdev->mc_idx_lock, flags); in rs690_mc_wreg()
676 static void rs690_mc_program(struct radeon_device *rdev) in rs690_mc_program() argument
681 rv515_mc_stop(rdev, &save); in rs690_mc_program()
684 if (rs690_mc_wait_for_idle(rdev)) in rs690_mc_program()
685 dev_warn(rdev->dev, "Wait MC idle timeout before updating MC.\n"); in rs690_mc_program()
688 S_000100_MC_FB_START(rdev->mc.vram_start >> 16) | in rs690_mc_program()
689 S_000100_MC_FB_TOP(rdev->mc.vram_end >> 16)); in rs690_mc_program()
691 S_000134_HDP_FB_START(rdev->mc.vram_start >> 16)); in rs690_mc_program()
693 rv515_mc_resume(rdev, &save); in rs690_mc_program()
696 static int rs690_startup(struct radeon_device *rdev) in rs690_startup() argument
700 rs690_mc_program(rdev); in rs690_startup()
702 rv515_clock_startup(rdev); in rs690_startup()
704 rs690_gpu_init(rdev); in rs690_startup()
707 r = rs400_gart_enable(rdev); in rs690_startup()
712 r = radeon_wb_init(rdev); in rs690_startup()
716 r = radeon_fence_driver_start_ring(rdev, RADEON_RING_TYPE_GFX_INDEX); in rs690_startup()
718 dev_err(rdev->dev, "failed initializing CP fences (%d).\n", r); in rs690_startup()
723 if (!rdev->irq.installed) { in rs690_startup()
724 r = radeon_irq_kms_init(rdev); in rs690_startup()
729 rs600_irq_set(rdev); in rs690_startup()
730 rdev->config.r300.hdp_cntl = RREG32(RADEON_HOST_PATH_CNTL); in rs690_startup()
732 r = r100_cp_init(rdev, 1024 * 1024); in rs690_startup()
734 dev_err(rdev->dev, "failed initializing CP (%d).\n", r); in rs690_startup()
738 r = radeon_ib_pool_init(rdev); in rs690_startup()
740 dev_err(rdev->dev, "IB initialization failed (%d).\n", r); in rs690_startup()
744 r = radeon_audio_init(rdev); in rs690_startup()
746 dev_err(rdev->dev, "failed initializing audio\n"); in rs690_startup()
753 int rs690_resume(struct radeon_device *rdev) in rs690_resume() argument
758 rs400_gart_disable(rdev); in rs690_resume()
760 rv515_clock_startup(rdev); in rs690_resume()
762 if (radeon_asic_reset(rdev)) { in rs690_resume()
763 dev_warn(rdev->dev, "GPU reset failed ! (0xE40=0x%08X, 0x7C0=0x%08X)\n", in rs690_resume()
768 atom_asic_init(rdev->mode_info.atom_context); in rs690_resume()
770 rv515_clock_startup(rdev); in rs690_resume()
772 radeon_surface_init(rdev); in rs690_resume()
774 rdev->accel_working = true; in rs690_resume()
775 r = rs690_startup(rdev); in rs690_resume()
777 rdev->accel_working = false; in rs690_resume()
782 int rs690_suspend(struct radeon_device *rdev) in rs690_suspend() argument
784 radeon_pm_suspend(rdev); in rs690_suspend()
785 radeon_audio_fini(rdev); in rs690_suspend()
786 r100_cp_disable(rdev); in rs690_suspend()
787 radeon_wb_disable(rdev); in rs690_suspend()
788 rs600_irq_disable(rdev); in rs690_suspend()
789 rs400_gart_disable(rdev); in rs690_suspend()
793 void rs690_fini(struct radeon_device *rdev) in rs690_fini() argument
795 radeon_pm_fini(rdev); in rs690_fini()
796 radeon_audio_fini(rdev); in rs690_fini()
797 r100_cp_fini(rdev); in rs690_fini()
798 radeon_wb_fini(rdev); in rs690_fini()
799 radeon_ib_pool_fini(rdev); in rs690_fini()
800 radeon_gem_fini(rdev); in rs690_fini()
801 rs400_gart_fini(rdev); in rs690_fini()
802 radeon_irq_kms_fini(rdev); in rs690_fini()
803 radeon_fence_driver_fini(rdev); in rs690_fini()
804 radeon_bo_fini(rdev); in rs690_fini()
805 radeon_atombios_fini(rdev); in rs690_fini()
806 kfree(rdev->bios); in rs690_fini()
807 rdev->bios = NULL; in rs690_fini()
810 int rs690_init(struct radeon_device *rdev) in rs690_init() argument
815 rv515_vga_render_disable(rdev); in rs690_init()
817 radeon_scratch_init(rdev); in rs690_init()
819 radeon_surface_init(rdev); in rs690_init()
821 r100_restore_sanity(rdev); in rs690_init()
824 if (!radeon_get_bios(rdev)) { in rs690_init()
825 if (ASIC_IS_AVIVO(rdev)) in rs690_init()
828 if (rdev->is_atom_bios) { in rs690_init()
829 r = radeon_atombios_init(rdev); in rs690_init()
833 dev_err(rdev->dev, "Expecting atombios for RV515 GPU\n"); in rs690_init()
837 if (radeon_asic_reset(rdev)) { in rs690_init()
838 dev_warn(rdev->dev, in rs690_init()
844 if (radeon_boot_test_post_card(rdev) == false) in rs690_init()
848 radeon_get_clock_info(rdev_to_drm(rdev)); in rs690_init()
850 rs690_mc_init(rdev); in rs690_init()
851 rv515_debugfs(rdev); in rs690_init()
853 radeon_fence_driver_init(rdev); in rs690_init()
855 r = radeon_bo_init(rdev); in rs690_init()
858 r = rs400_gart_init(rdev); in rs690_init()
861 rs600_set_safe_registers(rdev); in rs690_init()
864 radeon_pm_init(rdev); in rs690_init()
866 rdev->accel_working = true; in rs690_init()
867 r = rs690_startup(rdev); in rs690_init()
870 dev_err(rdev->dev, "Disabling GPU acceleration\n"); in rs690_init()
871 r100_cp_fini(rdev); in rs690_init()
872 radeon_wb_fini(rdev); in rs690_init()
873 radeon_ib_pool_fini(rdev); in rs690_init()
874 rs400_gart_fini(rdev); in rs690_init()
875 radeon_irq_kms_fini(rdev); in rs690_init()
876 rdev->accel_working = false; in rs690_init()