Rev 1986 | Rev 2004 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1986 | Rev 1990 | ||
---|---|---|---|
Line 39... | Line 39... | ||
39 | 39 | ||
40 | static void evergreen_gpu_init(struct radeon_device *rdev); |
40 | static void evergreen_gpu_init(struct radeon_device *rdev); |
41 | void evergreen_fini(struct radeon_device *rdev); |
41 | void evergreen_fini(struct radeon_device *rdev); |
Line -... | Line 42... | ||
- | 42 | static void evergreen_pcie_gen2_enable(struct radeon_device *rdev); |
|
- | 43 | ||
- | 44 | ||
- | 45 | ||
- | 46 | u32 evergreen_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base) |
|
- | 47 | { |
|
- | 48 | struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id]; |
|
- | 49 | u32 tmp = RREG32(EVERGREEN_GRPH_UPDATE + radeon_crtc->crtc_offset); |
|
- | 50 | ||
- | 51 | /* Lock the graphics update lock */ |
|
- | 52 | tmp |= EVERGREEN_GRPH_UPDATE_LOCK; |
|
- | 53 | WREG32(EVERGREEN_GRPH_UPDATE + radeon_crtc->crtc_offset, tmp); |
|
- | 54 | ||
- | 55 | /* update the scanout addresses */ |
|
- | 56 | WREG32(EVERGREEN_GRPH_SECONDARY_SURFACE_ADDRESS_HIGH + radeon_crtc->crtc_offset, |
|
- | 57 | upper_32_bits(crtc_base)); |
|
- | 58 | WREG32(EVERGREEN_GRPH_SECONDARY_SURFACE_ADDRESS + radeon_crtc->crtc_offset, |
|
- | 59 | (u32)crtc_base); |
|
- | 60 | ||
- | 61 | WREG32(EVERGREEN_GRPH_PRIMARY_SURFACE_ADDRESS_HIGH + radeon_crtc->crtc_offset, |
|
- | 62 | upper_32_bits(crtc_base)); |
|
- | 63 | WREG32(EVERGREEN_GRPH_PRIMARY_SURFACE_ADDRESS + radeon_crtc->crtc_offset, |
|
- | 64 | (u32)crtc_base); |
|
- | 65 | ||
- | 66 | /* Wait for update_pending to go high. */ |
|
- | 67 | while (!(RREG32(EVERGREEN_GRPH_UPDATE + radeon_crtc->crtc_offset) & EVERGREEN_GRPH_SURFACE_UPDATE_PENDING)); |
|
- | 68 | DRM_DEBUG("Update pending now high. Unlocking vupdate_lock.\n"); |
|
- | 69 | ||
- | 70 | /* Unlock the lock, so double-buffering can take place inside vblank */ |
|
- | 71 | tmp &= ~EVERGREEN_GRPH_UPDATE_LOCK; |
|
- | 72 | WREG32(EVERGREEN_GRPH_UPDATE + radeon_crtc->crtc_offset, tmp); |
|
- | 73 | ||
- | 74 | /* Return current update_pending status: */ |
|
- | 75 | return RREG32(EVERGREEN_GRPH_UPDATE + radeon_crtc->crtc_offset) & EVERGREEN_GRPH_SURFACE_UPDATE_PENDING; |
|
- | 76 | } |
|
- | 77 | ||
- | 78 | /* get temperature in millidegrees */ |
|
- | 79 | int evergreen_get_temp(struct radeon_device *rdev) |
|
- | 80 | { |
|
- | 81 | u32 temp, toffset; |
|
- | 82 | int actual_temp = 0; |
|
- | 83 | ||
- | 84 | if (rdev->family == CHIP_JUNIPER) { |
|
- | 85 | toffset = (RREG32(CG_THERMAL_CTRL) & TOFFSET_MASK) >> |
|
- | 86 | TOFFSET_SHIFT; |
|
- | 87 | temp = (RREG32(CG_TS0_STATUS) & TS0_ADC_DOUT_MASK) >> |
|
- | 88 | TS0_ADC_DOUT_SHIFT; |
|
- | 89 | ||
- | 90 | if (toffset & 0x100) |
|
- | 91 | actual_temp = temp / 2 - (0x200 - toffset); |
|
- | 92 | else |
|
- | 93 | actual_temp = temp / 2 + toffset; |
|
- | 94 | ||
- | 95 | actual_temp = actual_temp * 1000; |
|
- | 96 | ||
- | 97 | } else { |
|
- | 98 | temp = (RREG32(CG_MULT_THERMAL_STATUS) & ASIC_T_MASK) >> |
|
- | 99 | ASIC_T_SHIFT; |
|
- | 100 | ||
- | 101 | if (temp & 0x400) |
|
- | 102 | actual_temp = -256; |
|
- | 103 | else if (temp & 0x200) |
|
- | 104 | actual_temp = 255; |
|
- | 105 | else if (temp & 0x100) { |
|
- | 106 | actual_temp = temp & 0x1ff; |
|
- | 107 | actual_temp |= ~0x1ff; |
|
- | 108 | } else |
|
- | 109 | actual_temp = temp & 0xff; |
|
- | 110 | ||
- | 111 | actual_temp = (actual_temp * 1000) / 2; |
|
- | 112 | } |
|
- | 113 | ||
- | 114 | return actual_temp; |
|
- | 115 | } |
|
- | 116 | ||
- | 117 | int sumo_get_temp(struct radeon_device *rdev) |
|
- | 118 | { |
|
- | 119 | u32 temp = RREG32(CG_THERMAL_STATUS) & 0xff; |
|
- | 120 | int actual_temp = temp - 49; |
|
- | 121 | ||
- | 122 | return actual_temp * 1000; |
|
- | 123 | } |
|
- | 124 | ||
- | 125 | void evergreen_pm_misc(struct radeon_device *rdev) |
|
- | 126 | { |
|
- | 127 | int req_ps_idx = rdev->pm.requested_power_state_index; |
|
- | 128 | int req_cm_idx = rdev->pm.requested_clock_mode_index; |
|
- | 129 | struct radeon_power_state *ps = &rdev->pm.power_state[req_ps_idx]; |
|
- | 130 | struct radeon_voltage *voltage = &ps->clock_info[req_cm_idx].voltage; |
|
- | 131 | ||
- | 132 | if (voltage->type == VOLTAGE_SW) { |
|
- | 133 | /* 0xff01 is a flag rather then an actual voltage */ |
|
- | 134 | if (voltage->voltage == 0xff01) |
|
- | 135 | return; |
|
- | 136 | if (voltage->voltage && (voltage->voltage != rdev->pm.current_vddc)) { |
|
- | 137 | radeon_atom_set_voltage(rdev, voltage->voltage, SET_VOLTAGE_TYPE_ASIC_VDDC); |
|
- | 138 | rdev->pm.current_vddc = voltage->voltage; |
|
- | 139 | DRM_DEBUG("Setting: vddc: %d\n", voltage->voltage); |
|
- | 140 | } |
|
- | 141 | /* 0xff01 is a flag rather then an actual voltage */ |
|
- | 142 | if (voltage->vddci == 0xff01) |
|
- | 143 | return; |
|
- | 144 | if (voltage->vddci && (voltage->vddci != rdev->pm.current_vddci)) { |
|
- | 145 | radeon_atom_set_voltage(rdev, voltage->vddci, SET_VOLTAGE_TYPE_ASIC_VDDCI); |
|
- | 146 | rdev->pm.current_vddci = voltage->vddci; |
|
- | 147 | DRM_DEBUG("Setting: vddci: %d\n", voltage->vddci); |
|
- | 148 | } |
|
- | 149 | } |
|
- | 150 | } |
|
- | 151 | ||
- | 152 | void evergreen_pm_prepare(struct radeon_device *rdev) |
|
- | 153 | { |
|
- | 154 | struct drm_device *ddev = rdev->ddev; |
|
- | 155 | struct drm_crtc *crtc; |
|
- | 156 | struct radeon_crtc *radeon_crtc; |
|
- | 157 | u32 tmp; |
|
- | 158 | ||
- | 159 | /* disable any active CRTCs */ |
|
- | 160 | list_for_each_entry(crtc, &ddev->mode_config.crtc_list, head) { |
|
- | 161 | radeon_crtc = to_radeon_crtc(crtc); |
|
- | 162 | if (radeon_crtc->enabled) { |
|
- | 163 | tmp = RREG32(EVERGREEN_CRTC_CONTROL + radeon_crtc->crtc_offset); |
|
- | 164 | tmp |= EVERGREEN_CRTC_DISP_READ_REQUEST_DISABLE; |
|
- | 165 | WREG32(EVERGREEN_CRTC_CONTROL + radeon_crtc->crtc_offset, tmp); |
|
- | 166 | } |
|
- | 167 | } |
|
- | 168 | } |
|
- | 169 | ||
- | 170 | void evergreen_pm_finish(struct radeon_device *rdev) |
|
- | 171 | { |
|
- | 172 | struct drm_device *ddev = rdev->ddev; |
|
- | 173 | struct drm_crtc *crtc; |
|
- | 174 | struct radeon_crtc *radeon_crtc; |
|
- | 175 | u32 tmp; |
|
- | 176 | ||
- | 177 | /* enable any active CRTCs */ |
|
- | 178 | list_for_each_entry(crtc, &ddev->mode_config.crtc_list, head) { |
|
- | 179 | radeon_crtc = to_radeon_crtc(crtc); |
|
- | 180 | if (radeon_crtc->enabled) { |
|
- | 181 | tmp = RREG32(EVERGREEN_CRTC_CONTROL + radeon_crtc->crtc_offset); |
|
- | 182 | tmp &= ~EVERGREEN_CRTC_DISP_READ_REQUEST_DISABLE; |
|
- | 183 | WREG32(EVERGREEN_CRTC_CONTROL + radeon_crtc->crtc_offset, tmp); |
|
- | 184 | } |
|
- | 185 | } |
|
42 | static void evergreen_pcie_gen2_enable(struct radeon_device *rdev); |
186 | } |
43 | 187 | ||
44 | bool evergreen_hpd_sense(struct radeon_device *rdev, enum radeon_hpd_id hpd) |
188 | bool evergreen_hpd_sense(struct radeon_device *rdev, enum radeon_hpd_id hpd) |
Line 45... | Line 189... | ||
45 | { |
189 | { |
Line 2297... | Line 2441... | ||
2297 | } |
2441 | } |
2298 | static int evergreen_startup(struct radeon_device *rdev) |
2442 | static int evergreen_startup(struct radeon_device *rdev) |
2299 | { |
2443 | { |
2300 | int r; |
2444 | int r; |
Line -... | Line 2445... | ||
- | 2445 | ||
- | 2446 | /* enable pcie gen2 link */ |
|
- | 2447 | if (!ASIC_IS_DCE5(rdev)) |
|
- | 2448 | evergreen_pcie_gen2_enable(rdev); |
|
- | 2449 | ||
- | 2450 | if (ASIC_IS_DCE5(rdev)) { |
|
- | 2451 | if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw || !rdev->mc_fw) { |
|
- | 2452 | r = ni_init_microcode(rdev); |
|
- | 2453 | if (r) { |
|
- | 2454 | DRM_ERROR("Failed to load firmware!\n"); |
|
- | 2455 | return r; |
|
- | 2456 | } |
|
- | 2457 | } |
|
- | 2458 | r = ni_mc_load_microcode(rdev); |
|
- | 2459 | if (r) { |
|
- | 2460 | DRM_ERROR("Failed to load MC firmware!\n"); |
|
- | 2461 | return r; |
|
- | 2462 | } |
|
2301 | 2463 | } else { |
|
2302 | if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw) { |
2464 | if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw) { |
2303 | r = r600_init_microcode(rdev); |
2465 | r = r600_init_microcode(rdev); |
2304 | if (r) { |
2466 | if (r) { |
2305 | DRM_ERROR("Failed to load firmware!\n"); |
2467 | DRM_ERROR("Failed to load firmware!\n"); |
2306 | return r; |
2468 | return r; |
2307 | } |
2469 | } |
- | 2470 | } |
|
Line 2308... | Line 2471... | ||
2308 | } |
2471 | } |
2309 | 2472 | ||
2310 | evergreen_mc_program(rdev); |
2473 | evergreen_mc_program(rdev); |
2311 | if (rdev->flags & RADEON_IS_AGP) { |
2474 | if (rdev->flags & RADEON_IS_AGP) { |