diff options
Diffstat (limited to 'drivers/gpu/drm/radeon/rs690.c')
-rw-r--r-- | drivers/gpu/drm/radeon/rs690.c | 122 |
1 files changed, 72 insertions, 50 deletions
diff --git a/drivers/gpu/drm/radeon/rs690.c b/drivers/gpu/drm/radeon/rs690.c index 83b9174f76f2..bbf3da790fd5 100644 --- a/drivers/gpu/drm/radeon/rs690.c +++ b/drivers/gpu/drm/radeon/rs690.c | |||
@@ -27,6 +27,7 @@ | |||
27 | */ | 27 | */ |
28 | #include "drmP.h" | 28 | #include "drmP.h" |
29 | #include "radeon.h" | 29 | #include "radeon.h" |
30 | #include "radeon_asic.h" | ||
30 | #include "atom.h" | 31 | #include "atom.h" |
31 | #include "rs690d.h" | 32 | #include "rs690d.h" |
32 | 33 | ||
@@ -57,42 +58,57 @@ static void rs690_gpu_init(struct radeon_device *rdev) | |||
57 | } | 58 | } |
58 | } | 59 | } |
59 | 60 | ||
61 | union igp_info { | ||
62 | struct _ATOM_INTEGRATED_SYSTEM_INFO info; | ||
63 | struct _ATOM_INTEGRATED_SYSTEM_INFO_V2 info_v2; | ||
64 | }; | ||
65 | |||
60 | void rs690_pm_info(struct radeon_device *rdev) | 66 | void rs690_pm_info(struct radeon_device *rdev) |
61 | { | 67 | { |
62 | int index = GetIndexIntoMasterTable(DATA, IntegratedSystemInfo); | 68 | int index = GetIndexIntoMasterTable(DATA, IntegratedSystemInfo); |
63 | struct _ATOM_INTEGRATED_SYSTEM_INFO *info; | 69 | union igp_info *info; |
64 | struct _ATOM_INTEGRATED_SYSTEM_INFO_V2 *info_v2; | ||
65 | void *ptr; | ||
66 | uint16_t data_offset; | 70 | uint16_t data_offset; |
67 | uint8_t frev, crev; | 71 | uint8_t frev, crev; |
68 | fixed20_12 tmp; | 72 | fixed20_12 tmp; |
69 | 73 | ||
70 | atom_parse_data_header(rdev->mode_info.atom_context, index, NULL, | 74 | if (atom_parse_data_header(rdev->mode_info.atom_context, index, NULL, |
71 | &frev, &crev, &data_offset); | 75 | &frev, &crev, &data_offset)) { |
72 | ptr = rdev->mode_info.atom_context->bios + data_offset; | 76 | info = (union igp_info *)(rdev->mode_info.atom_context->bios + data_offset); |
73 | info = (struct _ATOM_INTEGRATED_SYSTEM_INFO *)ptr; | 77 | |
74 | info_v2 = (struct _ATOM_INTEGRATED_SYSTEM_INFO_V2 *)ptr; | 78 | /* Get various system informations from bios */ |
75 | /* Get various system informations from bios */ | 79 | switch (crev) { |
76 | switch (crev) { | 80 | case 1: |
77 | case 1: | 81 | tmp.full = rfixed_const(100); |
78 | tmp.full = rfixed_const(100); | 82 | rdev->pm.igp_sideport_mclk.full = rfixed_const(info->info.ulBootUpMemoryClock); |
79 | rdev->pm.igp_sideport_mclk.full = rfixed_const(info->ulBootUpMemoryClock); | 83 | rdev->pm.igp_sideport_mclk.full = rfixed_div(rdev->pm.igp_sideport_mclk, tmp); |
80 | rdev->pm.igp_sideport_mclk.full = rfixed_div(rdev->pm.igp_sideport_mclk, tmp); | 84 | rdev->pm.igp_system_mclk.full = rfixed_const(le16_to_cpu(info->info.usK8MemoryClock)); |
81 | rdev->pm.igp_system_mclk.full = rfixed_const(le16_to_cpu(info->usK8MemoryClock)); | 85 | rdev->pm.igp_ht_link_clk.full = rfixed_const(le16_to_cpu(info->info.usFSBClock)); |
82 | rdev->pm.igp_ht_link_clk.full = rfixed_const(le16_to_cpu(info->usFSBClock)); | 86 | rdev->pm.igp_ht_link_width.full = rfixed_const(info->info.ucHTLinkWidth); |
83 | rdev->pm.igp_ht_link_width.full = rfixed_const(info->ucHTLinkWidth); | 87 | break; |
84 | break; | 88 | case 2: |
85 | case 2: | 89 | tmp.full = rfixed_const(100); |
86 | tmp.full = rfixed_const(100); | 90 | rdev->pm.igp_sideport_mclk.full = rfixed_const(info->info_v2.ulBootUpSidePortClock); |
87 | rdev->pm.igp_sideport_mclk.full = rfixed_const(info_v2->ulBootUpSidePortClock); | 91 | rdev->pm.igp_sideport_mclk.full = rfixed_div(rdev->pm.igp_sideport_mclk, tmp); |
88 | rdev->pm.igp_sideport_mclk.full = rfixed_div(rdev->pm.igp_sideport_mclk, tmp); | 92 | rdev->pm.igp_system_mclk.full = rfixed_const(info->info_v2.ulBootUpUMAClock); |
89 | rdev->pm.igp_system_mclk.full = rfixed_const(info_v2->ulBootUpUMAClock); | 93 | rdev->pm.igp_system_mclk.full = rfixed_div(rdev->pm.igp_system_mclk, tmp); |
90 | rdev->pm.igp_system_mclk.full = rfixed_div(rdev->pm.igp_system_mclk, tmp); | 94 | rdev->pm.igp_ht_link_clk.full = rfixed_const(info->info_v2.ulHTLinkFreq); |
91 | rdev->pm.igp_ht_link_clk.full = rfixed_const(info_v2->ulHTLinkFreq); | 95 | rdev->pm.igp_ht_link_clk.full = rfixed_div(rdev->pm.igp_ht_link_clk, tmp); |
92 | rdev->pm.igp_ht_link_clk.full = rfixed_div(rdev->pm.igp_ht_link_clk, tmp); | 96 | rdev->pm.igp_ht_link_width.full = rfixed_const(le16_to_cpu(info->info_v2.usMinHTLinkWidth)); |
93 | rdev->pm.igp_ht_link_width.full = rfixed_const(le16_to_cpu(info_v2->usMinHTLinkWidth)); | 97 | break; |
94 | break; | 98 | default: |
95 | default: | 99 | tmp.full = rfixed_const(100); |
100 | /* We assume the slower possible clock ie worst case */ | ||
101 | /* DDR 333Mhz */ | ||
102 | rdev->pm.igp_sideport_mclk.full = rfixed_const(333); | ||
103 | /* FIXME: system clock ? */ | ||
104 | rdev->pm.igp_system_mclk.full = rfixed_const(100); | ||
105 | rdev->pm.igp_system_mclk.full = rfixed_div(rdev->pm.igp_system_mclk, tmp); | ||
106 | rdev->pm.igp_ht_link_clk.full = rfixed_const(200); | ||
107 | rdev->pm.igp_ht_link_width.full = rfixed_const(8); | ||
108 | DRM_ERROR("No integrated system info for your GPU, using safe default\n"); | ||
109 | break; | ||
110 | } | ||
111 | } else { | ||
96 | tmp.full = rfixed_const(100); | 112 | tmp.full = rfixed_const(100); |
97 | /* We assume the slower possible clock ie worst case */ | 113 | /* We assume the slower possible clock ie worst case */ |
98 | /* DDR 333Mhz */ | 114 | /* DDR 333Mhz */ |
@@ -103,7 +119,6 @@ void rs690_pm_info(struct radeon_device *rdev) | |||
103 | rdev->pm.igp_ht_link_clk.full = rfixed_const(200); | 119 | rdev->pm.igp_ht_link_clk.full = rfixed_const(200); |
104 | rdev->pm.igp_ht_link_width.full = rfixed_const(8); | 120 | rdev->pm.igp_ht_link_width.full = rfixed_const(8); |
105 | DRM_ERROR("No integrated system info for your GPU, using safe default\n"); | 121 | DRM_ERROR("No integrated system info for your GPU, using safe default\n"); |
106 | break; | ||
107 | } | 122 | } |
108 | /* Compute various bandwidth */ | 123 | /* Compute various bandwidth */ |
109 | /* k8_bandwidth = (memory_clk / 2) * 2 * 8 * 0.5 = memory_clk * 4 */ | 124 | /* k8_bandwidth = (memory_clk / 2) * 2 * 8 * 0.5 = memory_clk * 4 */ |
@@ -131,7 +146,6 @@ void rs690_pm_info(struct radeon_device *rdev) | |||
131 | 146 | ||
132 | void rs690_mc_init(struct radeon_device *rdev) | 147 | void rs690_mc_init(struct radeon_device *rdev) |
133 | { | 148 | { |
134 | fixed20_12 a; | ||
135 | u64 base; | 149 | u64 base; |
136 | 150 | ||
137 | rs400_gart_adjust_size(rdev); | 151 | rs400_gart_adjust_size(rdev); |
@@ -145,18 +159,10 @@ void rs690_mc_init(struct radeon_device *rdev) | |||
145 | base = RREG32_MC(R_000100_MCCFG_FB_LOCATION); | 159 | base = RREG32_MC(R_000100_MCCFG_FB_LOCATION); |
146 | base = G_000100_MC_FB_START(base) << 16; | 160 | base = G_000100_MC_FB_START(base) << 16; |
147 | rs690_pm_info(rdev); | 161 | rs690_pm_info(rdev); |
148 | /* FIXME: we should enforce default clock in case GPU is not in | ||
149 | * default setup | ||
150 | */ | ||
151 | a.full = rfixed_const(100); | ||
152 | rdev->pm.sclk.full = rfixed_const(rdev->clock.default_sclk); | ||
153 | rdev->pm.sclk.full = rfixed_div(rdev->pm.sclk, a); | ||
154 | a.full = rfixed_const(16); | ||
155 | /* core_bandwidth = sclk(Mhz) * 16 */ | ||
156 | rdev->pm.core_bandwidth.full = rfixed_div(rdev->pm.sclk, a); | ||
157 | rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev); | 162 | rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev); |
158 | radeon_vram_location(rdev, &rdev->mc, base); | 163 | radeon_vram_location(rdev, &rdev->mc, base); |
159 | radeon_gtt_location(rdev, &rdev->mc); | 164 | radeon_gtt_location(rdev, &rdev->mc); |
165 | radeon_update_bandwidth_info(rdev); | ||
160 | } | 166 | } |
161 | 167 | ||
162 | void rs690_line_buffer_adjust(struct radeon_device *rdev, | 168 | void rs690_line_buffer_adjust(struct radeon_device *rdev, |
@@ -394,10 +400,12 @@ void rs690_bandwidth_update(struct radeon_device *rdev) | |||
394 | struct drm_display_mode *mode1 = NULL; | 400 | struct drm_display_mode *mode1 = NULL; |
395 | struct rs690_watermark wm0; | 401 | struct rs690_watermark wm0; |
396 | struct rs690_watermark wm1; | 402 | struct rs690_watermark wm1; |
397 | u32 tmp; | 403 | u32 tmp, d1mode_priority_a_cnt, d2mode_priority_a_cnt; |
398 | fixed20_12 priority_mark02, priority_mark12, fill_rate; | 404 | fixed20_12 priority_mark02, priority_mark12, fill_rate; |
399 | fixed20_12 a, b; | 405 | fixed20_12 a, b; |
400 | 406 | ||
407 | radeon_update_display_priority(rdev); | ||
408 | |||
401 | if (rdev->mode_info.crtcs[0]->base.enabled) | 409 | if (rdev->mode_info.crtcs[0]->base.enabled) |
402 | mode0 = &rdev->mode_info.crtcs[0]->base.mode; | 410 | mode0 = &rdev->mode_info.crtcs[0]->base.mode; |
403 | if (rdev->mode_info.crtcs[1]->base.enabled) | 411 | if (rdev->mode_info.crtcs[1]->base.enabled) |
@@ -407,7 +415,8 @@ void rs690_bandwidth_update(struct radeon_device *rdev) | |||
407 | * modes if the user specifies HIGH for displaypriority | 415 | * modes if the user specifies HIGH for displaypriority |
408 | * option. | 416 | * option. |
409 | */ | 417 | */ |
410 | if (rdev->disp_priority == 2) { | 418 | if ((rdev->disp_priority == 2) && |
419 | ((rdev->family == CHIP_RS690) || (rdev->family == CHIP_RS740))) { | ||
411 | tmp = RREG32_MC(R_000104_MC_INIT_MISC_LAT_TIMER); | 420 | tmp = RREG32_MC(R_000104_MC_INIT_MISC_LAT_TIMER); |
412 | tmp &= C_000104_MC_DISP0R_INIT_LAT; | 421 | tmp &= C_000104_MC_DISP0R_INIT_LAT; |
413 | tmp &= C_000104_MC_DISP1R_INIT_LAT; | 422 | tmp &= C_000104_MC_DISP1R_INIT_LAT; |
@@ -482,10 +491,16 @@ void rs690_bandwidth_update(struct radeon_device *rdev) | |||
482 | priority_mark12.full = 0; | 491 | priority_mark12.full = 0; |
483 | if (wm1.priority_mark_max.full > priority_mark12.full) | 492 | if (wm1.priority_mark_max.full > priority_mark12.full) |
484 | priority_mark12.full = wm1.priority_mark_max.full; | 493 | priority_mark12.full = wm1.priority_mark_max.full; |
485 | WREG32(R_006548_D1MODE_PRIORITY_A_CNT, rfixed_trunc(priority_mark02)); | 494 | d1mode_priority_a_cnt = rfixed_trunc(priority_mark02); |
486 | WREG32(R_00654C_D1MODE_PRIORITY_B_CNT, rfixed_trunc(priority_mark02)); | 495 | d2mode_priority_a_cnt = rfixed_trunc(priority_mark12); |
487 | WREG32(R_006D48_D2MODE_PRIORITY_A_CNT, rfixed_trunc(priority_mark12)); | 496 | if (rdev->disp_priority == 2) { |
488 | WREG32(R_006D4C_D2MODE_PRIORITY_B_CNT, rfixed_trunc(priority_mark12)); | 497 | d1mode_priority_a_cnt |= S_006548_D1MODE_PRIORITY_A_ALWAYS_ON(1); |
498 | d2mode_priority_a_cnt |= S_006D48_D2MODE_PRIORITY_A_ALWAYS_ON(1); | ||
499 | } | ||
500 | WREG32(R_006548_D1MODE_PRIORITY_A_CNT, d1mode_priority_a_cnt); | ||
501 | WREG32(R_00654C_D1MODE_PRIORITY_B_CNT, d1mode_priority_a_cnt); | ||
502 | WREG32(R_006D48_D2MODE_PRIORITY_A_CNT, d2mode_priority_a_cnt); | ||
503 | WREG32(R_006D4C_D2MODE_PRIORITY_B_CNT, d2mode_priority_a_cnt); | ||
489 | } else if (mode0) { | 504 | } else if (mode0) { |
490 | if (rfixed_trunc(wm0.dbpp) > 64) | 505 | if (rfixed_trunc(wm0.dbpp) > 64) |
491 | a.full = rfixed_mul(wm0.dbpp, wm0.num_line_pair); | 506 | a.full = rfixed_mul(wm0.dbpp, wm0.num_line_pair); |
@@ -512,8 +527,11 @@ void rs690_bandwidth_update(struct radeon_device *rdev) | |||
512 | priority_mark02.full = 0; | 527 | priority_mark02.full = 0; |
513 | if (wm0.priority_mark_max.full > priority_mark02.full) | 528 | if (wm0.priority_mark_max.full > priority_mark02.full) |
514 | priority_mark02.full = wm0.priority_mark_max.full; | 529 | priority_mark02.full = wm0.priority_mark_max.full; |
515 | WREG32(R_006548_D1MODE_PRIORITY_A_CNT, rfixed_trunc(priority_mark02)); | 530 | d1mode_priority_a_cnt = rfixed_trunc(priority_mark02); |
516 | WREG32(R_00654C_D1MODE_PRIORITY_B_CNT, rfixed_trunc(priority_mark02)); | 531 | if (rdev->disp_priority == 2) |
532 | d1mode_priority_a_cnt |= S_006548_D1MODE_PRIORITY_A_ALWAYS_ON(1); | ||
533 | WREG32(R_006548_D1MODE_PRIORITY_A_CNT, d1mode_priority_a_cnt); | ||
534 | WREG32(R_00654C_D1MODE_PRIORITY_B_CNT, d1mode_priority_a_cnt); | ||
517 | WREG32(R_006D48_D2MODE_PRIORITY_A_CNT, | 535 | WREG32(R_006D48_D2MODE_PRIORITY_A_CNT, |
518 | S_006D48_D2MODE_PRIORITY_A_OFF(1)); | 536 | S_006D48_D2MODE_PRIORITY_A_OFF(1)); |
519 | WREG32(R_006D4C_D2MODE_PRIORITY_B_CNT, | 537 | WREG32(R_006D4C_D2MODE_PRIORITY_B_CNT, |
@@ -544,12 +562,15 @@ void rs690_bandwidth_update(struct radeon_device *rdev) | |||
544 | priority_mark12.full = 0; | 562 | priority_mark12.full = 0; |
545 | if (wm1.priority_mark_max.full > priority_mark12.full) | 563 | if (wm1.priority_mark_max.full > priority_mark12.full) |
546 | priority_mark12.full = wm1.priority_mark_max.full; | 564 | priority_mark12.full = wm1.priority_mark_max.full; |
565 | d2mode_priority_a_cnt = rfixed_trunc(priority_mark12); | ||
566 | if (rdev->disp_priority == 2) | ||
567 | d2mode_priority_a_cnt |= S_006D48_D2MODE_PRIORITY_A_ALWAYS_ON(1); | ||
547 | WREG32(R_006548_D1MODE_PRIORITY_A_CNT, | 568 | WREG32(R_006548_D1MODE_PRIORITY_A_CNT, |
548 | S_006548_D1MODE_PRIORITY_A_OFF(1)); | 569 | S_006548_D1MODE_PRIORITY_A_OFF(1)); |
549 | WREG32(R_00654C_D1MODE_PRIORITY_B_CNT, | 570 | WREG32(R_00654C_D1MODE_PRIORITY_B_CNT, |
550 | S_00654C_D1MODE_PRIORITY_B_OFF(1)); | 571 | S_00654C_D1MODE_PRIORITY_B_OFF(1)); |
551 | WREG32(R_006D48_D2MODE_PRIORITY_A_CNT, rfixed_trunc(priority_mark12)); | 572 | WREG32(R_006D48_D2MODE_PRIORITY_A_CNT, d2mode_priority_a_cnt); |
552 | WREG32(R_006D4C_D2MODE_PRIORITY_B_CNT, rfixed_trunc(priority_mark12)); | 573 | WREG32(R_006D4C_D2MODE_PRIORITY_B_CNT, d2mode_priority_a_cnt); |
553 | } | 574 | } |
554 | } | 575 | } |
555 | 576 | ||
@@ -657,6 +678,7 @@ int rs690_suspend(struct radeon_device *rdev) | |||
657 | 678 | ||
658 | void rs690_fini(struct radeon_device *rdev) | 679 | void rs690_fini(struct radeon_device *rdev) |
659 | { | 680 | { |
681 | radeon_pm_fini(rdev); | ||
660 | r100_cp_fini(rdev); | 682 | r100_cp_fini(rdev); |
661 | r100_wb_fini(rdev); | 683 | r100_wb_fini(rdev); |
662 | r100_ib_fini(rdev); | 684 | r100_ib_fini(rdev); |