diff options
Diffstat (limited to 'drivers/gpu/drm/radeon/evergreen.c')
-rw-r--r-- | drivers/gpu/drm/radeon/evergreen.c | 64 |
1 files changed, 50 insertions, 14 deletions
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index a8973acb3987..d270b3ff896b 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c | |||
@@ -97,26 +97,29 @@ u32 evergreen_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base) | |||
97 | } | 97 | } |
98 | 98 | ||
99 | /* get temperature in millidegrees */ | 99 | /* get temperature in millidegrees */ |
100 | u32 evergreen_get_temp(struct radeon_device *rdev) | 100 | int evergreen_get_temp(struct radeon_device *rdev) |
101 | { | 101 | { |
102 | u32 temp = (RREG32(CG_MULT_THERMAL_STATUS) & ASIC_T_MASK) >> | 102 | u32 temp = (RREG32(CG_MULT_THERMAL_STATUS) & ASIC_T_MASK) >> |
103 | ASIC_T_SHIFT; | 103 | ASIC_T_SHIFT; |
104 | u32 actual_temp = 0; | 104 | u32 actual_temp = 0; |
105 | 105 | ||
106 | if ((temp >> 10) & 1) | 106 | if (temp & 0x400) |
107 | actual_temp = 0; | 107 | actual_temp = -256; |
108 | else if ((temp >> 9) & 1) | 108 | else if (temp & 0x200) |
109 | actual_temp = 255; | 109 | actual_temp = 255; |
110 | else | 110 | else if (temp & 0x100) { |
111 | actual_temp = (temp >> 1) & 0xff; | 111 | actual_temp = temp & 0x1ff; |
112 | actual_temp |= ~0x1ff; | ||
113 | } else | ||
114 | actual_temp = temp & 0xff; | ||
112 | 115 | ||
113 | return actual_temp * 1000; | 116 | return (actual_temp * 1000) / 2; |
114 | } | 117 | } |
115 | 118 | ||
116 | u32 sumo_get_temp(struct radeon_device *rdev) | 119 | int sumo_get_temp(struct radeon_device *rdev) |
117 | { | 120 | { |
118 | u32 temp = RREG32(CG_THERMAL_STATUS) & 0xff; | 121 | u32 temp = RREG32(CG_THERMAL_STATUS) & 0xff; |
119 | u32 actual_temp = (temp >> 1) & 0xff; | 122 | int actual_temp = temp - 49; |
120 | 123 | ||
121 | return actual_temp * 1000; | 124 | return actual_temp * 1000; |
122 | } | 125 | } |
@@ -1182,6 +1185,22 @@ static void evergreen_mc_program(struct radeon_device *rdev) | |||
1182 | /* | 1185 | /* |
1183 | * CP. | 1186 | * CP. |
1184 | */ | 1187 | */ |
1188 | void evergreen_ring_ib_execute(struct radeon_device *rdev, struct radeon_ib *ib) | ||
1189 | { | ||
1190 | /* set to DX10/11 mode */ | ||
1191 | radeon_ring_write(rdev, PACKET3(PACKET3_MODE_CONTROL, 0)); | ||
1192 | radeon_ring_write(rdev, 1); | ||
1193 | /* FIXME: implement */ | ||
1194 | radeon_ring_write(rdev, PACKET3(PACKET3_INDIRECT_BUFFER, 2)); | ||
1195 | radeon_ring_write(rdev, | ||
1196 | #ifdef __BIG_ENDIAN | ||
1197 | (2 << 0) | | ||
1198 | #endif | ||
1199 | (ib->gpu_addr & 0xFFFFFFFC)); | ||
1200 | radeon_ring_write(rdev, upper_32_bits(ib->gpu_addr) & 0xFF); | ||
1201 | radeon_ring_write(rdev, ib->length_dw); | ||
1202 | } | ||
1203 | |||
1185 | 1204 | ||
1186 | static int evergreen_cp_load_microcode(struct radeon_device *rdev) | 1205 | static int evergreen_cp_load_microcode(struct radeon_device *rdev) |
1187 | { | 1206 | { |
@@ -1192,7 +1211,11 @@ static int evergreen_cp_load_microcode(struct radeon_device *rdev) | |||
1192 | return -EINVAL; | 1211 | return -EINVAL; |
1193 | 1212 | ||
1194 | r700_cp_stop(rdev); | 1213 | r700_cp_stop(rdev); |
1195 | WREG32(CP_RB_CNTL, RB_NO_UPDATE | (15 << 8) | (3 << 0)); | 1214 | WREG32(CP_RB_CNTL, |
1215 | #ifdef __BIG_ENDIAN | ||
1216 | BUF_SWAP_32BIT | | ||
1217 | #endif | ||
1218 | RB_NO_UPDATE | RB_BLKSZ(15) | RB_BUFSZ(3)); | ||
1196 | 1219 | ||
1197 | fw_data = (const __be32 *)rdev->pfp_fw->data; | 1220 | fw_data = (const __be32 *)rdev->pfp_fw->data; |
1198 | WREG32(CP_PFP_UCODE_ADDR, 0); | 1221 | WREG32(CP_PFP_UCODE_ADDR, 0); |
@@ -1233,7 +1256,7 @@ static int evergreen_cp_start(struct radeon_device *rdev) | |||
1233 | cp_me = 0xff; | 1256 | cp_me = 0xff; |
1234 | WREG32(CP_ME_CNTL, cp_me); | 1257 | WREG32(CP_ME_CNTL, cp_me); |
1235 | 1258 | ||
1236 | r = radeon_ring_lock(rdev, evergreen_default_size + 15); | 1259 | r = radeon_ring_lock(rdev, evergreen_default_size + 19); |
1237 | if (r) { | 1260 | if (r) { |
1238 | DRM_ERROR("radeon: cp failed to lock ring (%d).\n", r); | 1261 | DRM_ERROR("radeon: cp failed to lock ring (%d).\n", r); |
1239 | return r; | 1262 | return r; |
@@ -1266,6 +1289,11 @@ static int evergreen_cp_start(struct radeon_device *rdev) | |||
1266 | radeon_ring_write(rdev, 0xffffffff); | 1289 | radeon_ring_write(rdev, 0xffffffff); |
1267 | radeon_ring_write(rdev, 0xffffffff); | 1290 | radeon_ring_write(rdev, 0xffffffff); |
1268 | 1291 | ||
1292 | radeon_ring_write(rdev, 0xc0026900); | ||
1293 | radeon_ring_write(rdev, 0x00000316); | ||
1294 | radeon_ring_write(rdev, 0x0000000e); /* VGT_VERTEX_REUSE_BLOCK_CNTL */ | ||
1295 | radeon_ring_write(rdev, 0x00000010); /* */ | ||
1296 | |||
1269 | radeon_ring_unlock_commit(rdev); | 1297 | radeon_ring_unlock_commit(rdev); |
1270 | 1298 | ||
1271 | return 0; | 1299 | return 0; |
@@ -1306,7 +1334,11 @@ int evergreen_cp_resume(struct radeon_device *rdev) | |||
1306 | WREG32(CP_RB_WPTR, 0); | 1334 | WREG32(CP_RB_WPTR, 0); |
1307 | 1335 | ||
1308 | /* set the wb address wether it's enabled or not */ | 1336 | /* set the wb address wether it's enabled or not */ |
1309 | WREG32(CP_RB_RPTR_ADDR, (rdev->wb.gpu_addr + RADEON_WB_CP_RPTR_OFFSET) & 0xFFFFFFFC); | 1337 | WREG32(CP_RB_RPTR_ADDR, |
1338 | #ifdef __BIG_ENDIAN | ||
1339 | RB_RPTR_SWAP(2) | | ||
1340 | #endif | ||
1341 | ((rdev->wb.gpu_addr + RADEON_WB_CP_RPTR_OFFSET) & 0xFFFFFFFC)); | ||
1310 | WREG32(CP_RB_RPTR_ADDR_HI, upper_32_bits(rdev->wb.gpu_addr + RADEON_WB_CP_RPTR_OFFSET) & 0xFF); | 1342 | WREG32(CP_RB_RPTR_ADDR_HI, upper_32_bits(rdev->wb.gpu_addr + RADEON_WB_CP_RPTR_OFFSET) & 0xFF); |
1311 | WREG32(SCRATCH_ADDR, ((rdev->wb.gpu_addr + RADEON_WB_SCRATCH_OFFSET) >> 8) & 0xFFFFFFFF); | 1343 | WREG32(SCRATCH_ADDR, ((rdev->wb.gpu_addr + RADEON_WB_SCRATCH_OFFSET) >> 8) & 0xFFFFFFFF); |
1312 | 1344 | ||
@@ -2072,6 +2104,7 @@ static void evergreen_gpu_init(struct radeon_device *rdev) | |||
2072 | WREG32(VGT_CACHE_INVALIDATION, vgt_cache_invalidation); | 2104 | WREG32(VGT_CACHE_INVALIDATION, vgt_cache_invalidation); |
2073 | 2105 | ||
2074 | WREG32(VGT_GS_VERTEX_REUSE, 16); | 2106 | WREG32(VGT_GS_VERTEX_REUSE, 16); |
2107 | WREG32(PA_SU_LINE_STIPPLE_VALUE, 0); | ||
2075 | WREG32(PA_SC_LINE_STIPPLE_STATE, 0); | 2108 | WREG32(PA_SC_LINE_STIPPLE_STATE, 0); |
2076 | 2109 | ||
2077 | WREG32(VGT_VERTEX_REUSE_BLOCK_CNTL, 14); | 2110 | WREG32(VGT_VERTEX_REUSE_BLOCK_CNTL, 14); |
@@ -2201,6 +2234,9 @@ static int evergreen_gpu_soft_reset(struct radeon_device *rdev) | |||
2201 | struct evergreen_mc_save save; | 2234 | struct evergreen_mc_save save; |
2202 | u32 grbm_reset = 0; | 2235 | u32 grbm_reset = 0; |
2203 | 2236 | ||
2237 | if (!(RREG32(GRBM_STATUS) & GUI_ACTIVE)) | ||
2238 | return 0; | ||
2239 | |||
2204 | dev_info(rdev->dev, "GPU softreset \n"); | 2240 | dev_info(rdev->dev, "GPU softreset \n"); |
2205 | dev_info(rdev->dev, " GRBM_STATUS=0x%08X\n", | 2241 | dev_info(rdev->dev, " GRBM_STATUS=0x%08X\n", |
2206 | RREG32(GRBM_STATUS)); | 2242 | RREG32(GRBM_STATUS)); |
@@ -2603,8 +2639,8 @@ restart_ih: | |||
2603 | while (rptr != wptr) { | 2639 | while (rptr != wptr) { |
2604 | /* wptr/rptr are in bytes! */ | 2640 | /* wptr/rptr are in bytes! */ |
2605 | ring_index = rptr / 4; | 2641 | ring_index = rptr / 4; |
2606 | src_id = rdev->ih.ring[ring_index] & 0xff; | 2642 | src_id = le32_to_cpu(rdev->ih.ring[ring_index]) & 0xff; |
2607 | src_data = rdev->ih.ring[ring_index + 1] & 0xfffffff; | 2643 | src_data = le32_to_cpu(rdev->ih.ring[ring_index + 1]) & 0xfffffff; |
2608 | 2644 | ||
2609 | switch (src_id) { | 2645 | switch (src_id) { |
2610 | case 1: /* D1 vblank/vline */ | 2646 | case 1: /* D1 vblank/vline */ |