diff options
Diffstat (limited to 'drivers/gpu/drm/radeon/evergreen.c')
-rw-r--r-- | drivers/gpu/drm/radeon/evergreen.c | 81 |
1 files changed, 71 insertions, 10 deletions
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index f58254a3fb01..cfa372cb1cb3 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c | |||
@@ -43,6 +43,37 @@ void evergreen_pcie_gen2_enable(struct radeon_device *rdev); | |||
43 | extern void cayman_cp_int_cntl_setup(struct radeon_device *rdev, | 43 | extern void cayman_cp_int_cntl_setup(struct radeon_device *rdev, |
44 | int ring, u32 cp_int_cntl); | 44 | int ring, u32 cp_int_cntl); |
45 | 45 | ||
46 | void evergreen_tiling_fields(unsigned tiling_flags, unsigned *bankw, | ||
47 | unsigned *bankh, unsigned *mtaspect, | ||
48 | unsigned *tile_split) | ||
49 | { | ||
50 | *bankw = (tiling_flags >> RADEON_TILING_EG_BANKW_SHIFT) & RADEON_TILING_EG_BANKW_MASK; | ||
51 | *bankh = (tiling_flags >> RADEON_TILING_EG_BANKH_SHIFT) & RADEON_TILING_EG_BANKH_MASK; | ||
52 | *mtaspect = (tiling_flags >> RADEON_TILING_EG_MACRO_TILE_ASPECT_SHIFT) & RADEON_TILING_EG_MACRO_TILE_ASPECT_MASK; | ||
53 | *tile_split = (tiling_flags >> RADEON_TILING_EG_TILE_SPLIT_SHIFT) & RADEON_TILING_EG_TILE_SPLIT_MASK; | ||
54 | switch (*bankw) { | ||
55 | default: | ||
56 | case 1: *bankw = EVERGREEN_ADDR_SURF_BANK_WIDTH_1; break; | ||
57 | case 2: *bankw = EVERGREEN_ADDR_SURF_BANK_WIDTH_2; break; | ||
58 | case 4: *bankw = EVERGREEN_ADDR_SURF_BANK_WIDTH_4; break; | ||
59 | case 8: *bankw = EVERGREEN_ADDR_SURF_BANK_WIDTH_8; break; | ||
60 | } | ||
61 | switch (*bankh) { | ||
62 | default: | ||
63 | case 1: *bankh = EVERGREEN_ADDR_SURF_BANK_HEIGHT_1; break; | ||
64 | case 2: *bankh = EVERGREEN_ADDR_SURF_BANK_HEIGHT_2; break; | ||
65 | case 4: *bankh = EVERGREEN_ADDR_SURF_BANK_HEIGHT_4; break; | ||
66 | case 8: *bankh = EVERGREEN_ADDR_SURF_BANK_HEIGHT_8; break; | ||
67 | } | ||
68 | switch (*mtaspect) { | ||
69 | default: | ||
70 | case 1: *mtaspect = EVERGREEN_ADDR_SURF_MACRO_TILE_ASPECT_1; break; | ||
71 | case 2: *mtaspect = EVERGREEN_ADDR_SURF_MACRO_TILE_ASPECT_2; break; | ||
72 | case 4: *mtaspect = EVERGREEN_ADDR_SURF_MACRO_TILE_ASPECT_4; break; | ||
73 | case 8: *mtaspect = EVERGREEN_ADDR_SURF_MACRO_TILE_ASPECT_8; break; | ||
74 | } | ||
75 | } | ||
76 | |||
46 | void evergreen_fix_pci_max_read_req_size(struct radeon_device *rdev) | 77 | void evergreen_fix_pci_max_read_req_size(struct radeon_device *rdev) |
47 | { | 78 | { |
48 | u16 ctl, v; | 79 | u16 ctl, v; |
@@ -68,6 +99,25 @@ void evergreen_fix_pci_max_read_req_size(struct radeon_device *rdev) | |||
68 | } | 99 | } |
69 | } | 100 | } |
70 | 101 | ||
102 | void dce4_wait_for_vblank(struct radeon_device *rdev, int crtc) | ||
103 | { | ||
104 | struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc]; | ||
105 | int i; | ||
106 | |||
107 | if (RREG32(EVERGREEN_CRTC_CONTROL + radeon_crtc->crtc_offset) & EVERGREEN_CRTC_MASTER_EN) { | ||
108 | for (i = 0; i < rdev->usec_timeout; i++) { | ||
109 | if (!(RREG32(EVERGREEN_CRTC_STATUS + radeon_crtc->crtc_offset) & EVERGREEN_CRTC_V_BLANK)) | ||
110 | break; | ||
111 | udelay(1); | ||
112 | } | ||
113 | for (i = 0; i < rdev->usec_timeout; i++) { | ||
114 | if (RREG32(EVERGREEN_CRTC_STATUS + radeon_crtc->crtc_offset) & EVERGREEN_CRTC_V_BLANK) | ||
115 | break; | ||
116 | udelay(1); | ||
117 | } | ||
118 | } | ||
119 | } | ||
120 | |||
71 | void evergreen_pre_page_flip(struct radeon_device *rdev, int crtc) | 121 | void evergreen_pre_page_flip(struct radeon_device *rdev, int crtc) |
72 | { | 122 | { |
73 | /* enable the pflip int */ | 123 | /* enable the pflip int */ |
@@ -531,7 +581,7 @@ static u32 evergreen_line_buffer_adjust(struct radeon_device *rdev, | |||
531 | return 0; | 581 | return 0; |
532 | } | 582 | } |
533 | 583 | ||
534 | static u32 evergreen_get_number_of_dram_channels(struct radeon_device *rdev) | 584 | u32 evergreen_get_number_of_dram_channels(struct radeon_device *rdev) |
535 | { | 585 | { |
536 | u32 tmp = RREG32(MC_SHARED_CHMAP); | 586 | u32 tmp = RREG32(MC_SHARED_CHMAP); |
537 | 587 | ||
@@ -1278,7 +1328,10 @@ void evergreen_mc_program(struct radeon_device *rdev) | |||
1278 | rdev->mc.vram_end >> 12); | 1328 | rdev->mc.vram_end >> 12); |
1279 | } | 1329 | } |
1280 | WREG32(MC_VM_SYSTEM_APERTURE_DEFAULT_ADDR, rdev->vram_scratch.gpu_addr >> 12); | 1330 | WREG32(MC_VM_SYSTEM_APERTURE_DEFAULT_ADDR, rdev->vram_scratch.gpu_addr >> 12); |
1281 | if (rdev->flags & RADEON_IS_IGP) { | 1331 | /* llano/ontario only */ |
1332 | if ((rdev->family == CHIP_PALM) || | ||
1333 | (rdev->family == CHIP_SUMO) || | ||
1334 | (rdev->family == CHIP_SUMO2)) { | ||
1282 | tmp = RREG32(MC_FUS_VM_FB_OFFSET) & 0x000FFFFF; | 1335 | tmp = RREG32(MC_FUS_VM_FB_OFFSET) & 0x000FFFFF; |
1283 | tmp |= ((rdev->mc.vram_end >> 20) & 0xF) << 24; | 1336 | tmp |= ((rdev->mc.vram_end >> 20) & 0xF) << 24; |
1284 | tmp |= ((rdev->mc.vram_start >> 20) & 0xF) << 20; | 1337 | tmp |= ((rdev->mc.vram_start >> 20) & 0xF) << 20; |
@@ -1489,7 +1542,7 @@ int evergreen_cp_resume(struct radeon_device *rdev) | |||
1489 | 1542 | ||
1490 | evergreen_cp_start(rdev); | 1543 | evergreen_cp_start(rdev); |
1491 | ring->ready = true; | 1544 | ring->ready = true; |
1492 | r = radeon_ring_test(rdev, ring); | 1545 | r = radeon_ring_test(rdev, RADEON_RING_TYPE_GFX_INDEX, ring); |
1493 | if (r) { | 1546 | if (r) { |
1494 | ring->ready = false; | 1547 | ring->ready = false; |
1495 | return r; | 1548 | return r; |
@@ -1922,7 +1975,9 @@ static void evergreen_gpu_init(struct radeon_device *rdev) | |||
1922 | 1975 | ||
1923 | 1976 | ||
1924 | mc_shared_chmap = RREG32(MC_SHARED_CHMAP); | 1977 | mc_shared_chmap = RREG32(MC_SHARED_CHMAP); |
1925 | if (rdev->flags & RADEON_IS_IGP) | 1978 | if ((rdev->family == CHIP_PALM) || |
1979 | (rdev->family == CHIP_SUMO) || | ||
1980 | (rdev->family == CHIP_SUMO2)) | ||
1926 | mc_arb_ramcfg = RREG32(FUS_MC_ARB_RAMCFG); | 1981 | mc_arb_ramcfg = RREG32(FUS_MC_ARB_RAMCFG); |
1927 | else | 1982 | else |
1928 | mc_arb_ramcfg = RREG32(MC_ARB_RAMCFG); | 1983 | mc_arb_ramcfg = RREG32(MC_ARB_RAMCFG); |
@@ -2312,7 +2367,9 @@ int evergreen_mc_init(struct radeon_device *rdev) | |||
2312 | 2367 | ||
2313 | /* Get VRAM informations */ | 2368 | /* Get VRAM informations */ |
2314 | rdev->mc.vram_is_ddr = true; | 2369 | rdev->mc.vram_is_ddr = true; |
2315 | if (rdev->flags & RADEON_IS_IGP) | 2370 | if ((rdev->family == CHIP_PALM) || |
2371 | (rdev->family == CHIP_SUMO) || | ||
2372 | (rdev->family == CHIP_SUMO2)) | ||
2316 | tmp = RREG32(FUS_MC_ARB_RAMCFG); | 2373 | tmp = RREG32(FUS_MC_ARB_RAMCFG); |
2317 | else | 2374 | else |
2318 | tmp = RREG32(MC_ARB_RAMCFG); | 2375 | tmp = RREG32(MC_ARB_RAMCFG); |
@@ -2344,12 +2401,14 @@ int evergreen_mc_init(struct radeon_device *rdev) | |||
2344 | rdev->mc.aper_base = pci_resource_start(rdev->pdev, 0); | 2401 | rdev->mc.aper_base = pci_resource_start(rdev->pdev, 0); |
2345 | rdev->mc.aper_size = pci_resource_len(rdev->pdev, 0); | 2402 | rdev->mc.aper_size = pci_resource_len(rdev->pdev, 0); |
2346 | /* Setup GPU memory space */ | 2403 | /* Setup GPU memory space */ |
2347 | if (rdev->flags & RADEON_IS_IGP) { | 2404 | if ((rdev->family == CHIP_PALM) || |
2405 | (rdev->family == CHIP_SUMO) || | ||
2406 | (rdev->family == CHIP_SUMO2)) { | ||
2348 | /* size in bytes on fusion */ | 2407 | /* size in bytes on fusion */ |
2349 | rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE); | 2408 | rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE); |
2350 | rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE); | 2409 | rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE); |
2351 | } else { | 2410 | } else { |
2352 | /* size in MB on evergreen */ | 2411 | /* size in MB on evergreen/cayman/tn */ |
2353 | rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE) * 1024 * 1024; | 2412 | rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE) * 1024 * 1024; |
2354 | rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE) * 1024 * 1024; | 2413 | rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE) * 1024 * 1024; |
2355 | } | 2414 | } |
@@ -2507,7 +2566,9 @@ void evergreen_disable_interrupt_state(struct radeon_device *rdev) | |||
2507 | WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC5_REGISTER_OFFSET, 0); | 2566 | WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC5_REGISTER_OFFSET, 0); |
2508 | } | 2567 | } |
2509 | 2568 | ||
2510 | WREG32(DACA_AUTODETECT_INT_CONTROL, 0); | 2569 | /* only one DAC on DCE6 */ |
2570 | if (!ASIC_IS_DCE6(rdev)) | ||
2571 | WREG32(DACA_AUTODETECT_INT_CONTROL, 0); | ||
2511 | WREG32(DACB_AUTODETECT_INT_CONTROL, 0); | 2572 | WREG32(DACB_AUTODETECT_INT_CONTROL, 0); |
2512 | 2573 | ||
2513 | tmp = RREG32(DC_HPD1_INT_CONTROL) & DC_HPDx_INT_POLARITY; | 2574 | tmp = RREG32(DC_HPD1_INT_CONTROL) & DC_HPDx_INT_POLARITY; |
@@ -3147,7 +3208,7 @@ static int evergreen_startup(struct radeon_device *rdev) | |||
3147 | r = evergreen_blit_init(rdev); | 3208 | r = evergreen_blit_init(rdev); |
3148 | if (r) { | 3209 | if (r) { |
3149 | r600_blit_fini(rdev); | 3210 | r600_blit_fini(rdev); |
3150 | rdev->asic->copy = NULL; | 3211 | rdev->asic->copy.copy = NULL; |
3151 | dev_warn(rdev->dev, "failed blitter (%d) falling back to memcpy\n", r); | 3212 | dev_warn(rdev->dev, "failed blitter (%d) falling back to memcpy\n", r); |
3152 | } | 3213 | } |
3153 | 3214 | ||
@@ -3187,7 +3248,7 @@ static int evergreen_startup(struct radeon_device *rdev) | |||
3187 | if (r) | 3248 | if (r) |
3188 | return r; | 3249 | return r; |
3189 | 3250 | ||
3190 | r = r600_ib_test(rdev, RADEON_RING_TYPE_GFX_INDEX); | 3251 | r = radeon_ib_test(rdev, RADEON_RING_TYPE_GFX_INDEX, &rdev->ring[RADEON_RING_TYPE_GFX_INDEX]); |
3191 | if (r) { | 3252 | if (r) { |
3192 | DRM_ERROR("radeon: failed testing IB (%d).\n", r); | 3253 | DRM_ERROR("radeon: failed testing IB (%d).\n", r); |
3193 | rdev->accel_working = false; | 3254 | rdev->accel_working = false; |