|
39 | 39 |
|
40 | 40 | static void evergreen_gpu_init(struct radeon_device *rdev); |
41 | 41 | void evergreen_fini(struct radeon_device *rdev); |
| 42 | +static void evergreen_pcie_gen2_enable(struct radeon_device *rdev); |
42 | 43 |
|
43 | 44 | void evergreen_pre_page_flip(struct radeon_device *rdev, int crtc) |
44 | 45 | { |
@@ -400,16 +401,28 @@ static u32 evergreen_line_buffer_adjust(struct radeon_device *rdev, |
400 | 401 | case 0: |
401 | 402 | case 4: |
402 | 403 | default: |
403 | | - return 3840 * 2; |
| 404 | + if (ASIC_IS_DCE5(rdev)) |
| 405 | + return 4096 * 2; |
| 406 | + else |
| 407 | + return 3840 * 2; |
404 | 408 | case 1: |
405 | 409 | case 5: |
406 | | - return 5760 * 2; |
| 410 | + if (ASIC_IS_DCE5(rdev)) |
| 411 | + return 6144 * 2; |
| 412 | + else |
| 413 | + return 5760 * 2; |
407 | 414 | case 2: |
408 | 415 | case 6: |
409 | | - return 7680 * 2; |
| 416 | + if (ASIC_IS_DCE5(rdev)) |
| 417 | + return 8192 * 2; |
| 418 | + else |
| 419 | + return 7680 * 2; |
410 | 420 | case 3: |
411 | 421 | case 7: |
412 | | - return 1920 * 2; |
| 422 | + if (ASIC_IS_DCE5(rdev)) |
| 423 | + return 2048 * 2; |
| 424 | + else |
| 425 | + return 1920 * 2; |
413 | 426 | } |
414 | 427 | } |
415 | 428 |
|
@@ -1146,7 +1159,7 @@ static void evergreen_mc_program(struct radeon_device *rdev) |
1146 | 1159 | tmp |= ((rdev->mc.vram_start >> 24) & 0xFFFF); |
1147 | 1160 | WREG32(MC_VM_FB_LOCATION, tmp); |
1148 | 1161 | WREG32(HDP_NONSURFACE_BASE, (rdev->mc.vram_start >> 8)); |
1149 | | - WREG32(HDP_NONSURFACE_INFO, (2 << 7)); |
| 1162 | + WREG32(HDP_NONSURFACE_INFO, (2 << 7) | (1 << 30)); |
1150 | 1163 | WREG32(HDP_NONSURFACE_SIZE, 0x3FFFFFFF); |
1151 | 1164 | if (rdev->flags & RADEON_IS_AGP) { |
1152 | 1165 | WREG32(MC_VM_AGP_TOP, rdev->mc.gtt_end >> 16); |
@@ -1371,11 +1384,14 @@ static u32 evergreen_get_tile_pipe_to_backend_map(struct radeon_device *rdev, |
1371 | 1384 | case CHIP_CEDAR: |
1372 | 1385 | case CHIP_REDWOOD: |
1373 | 1386 | case CHIP_PALM: |
| 1387 | + case CHIP_TURKS: |
| 1388 | + case CHIP_CAICOS: |
1374 | 1389 | force_no_swizzle = false; |
1375 | 1390 | break; |
1376 | 1391 | case CHIP_CYPRESS: |
1377 | 1392 | case CHIP_HEMLOCK: |
1378 | 1393 | case CHIP_JUNIPER: |
| 1394 | + case CHIP_BARTS: |
1379 | 1395 | default: |
1380 | 1396 | force_no_swizzle = true; |
1381 | 1397 | break; |
@@ -1489,13 +1505,16 @@ static void evergreen_program_channel_remap(struct radeon_device *rdev) |
1489 | 1505 | switch (rdev->family) { |
1490 | 1506 | case CHIP_HEMLOCK: |
1491 | 1507 | case CHIP_CYPRESS: |
| 1508 | + case CHIP_BARTS: |
1492 | 1509 | tcp_chan_steer_lo = 0x54763210; |
1493 | 1510 | tcp_chan_steer_hi = 0x0000ba98; |
1494 | 1511 | break; |
1495 | 1512 | case CHIP_JUNIPER: |
1496 | 1513 | case CHIP_REDWOOD: |
1497 | 1514 | case CHIP_CEDAR: |
1498 | 1515 | case CHIP_PALM: |
| 1516 | + case CHIP_TURKS: |
| 1517 | + case CHIP_CAICOS: |
1499 | 1518 | default: |
1500 | 1519 | tcp_chan_steer_lo = 0x76543210; |
1501 | 1520 | tcp_chan_steer_hi = 0x0000ba98; |
@@ -1635,6 +1654,69 @@ static void evergreen_gpu_init(struct radeon_device *rdev) |
1635 | 1654 | rdev->config.evergreen.max_hw_contexts = 4; |
1636 | 1655 | rdev->config.evergreen.sq_num_cf_insts = 1; |
1637 | 1656 |
|
| 1657 | + rdev->config.evergreen.sc_prim_fifo_size = 0x40; |
| 1658 | + rdev->config.evergreen.sc_hiz_tile_fifo_size = 0x30; |
| 1659 | + rdev->config.evergreen.sc_earlyz_tile_fifo_size = 0x130; |
| 1660 | + break; |
| 1661 | + case CHIP_BARTS: |
| 1662 | + rdev->config.evergreen.num_ses = 2; |
| 1663 | + rdev->config.evergreen.max_pipes = 4; |
| 1664 | + rdev->config.evergreen.max_tile_pipes = 8; |
| 1665 | + rdev->config.evergreen.max_simds = 7; |
| 1666 | + rdev->config.evergreen.max_backends = 4 * rdev->config.evergreen.num_ses; |
| 1667 | + rdev->config.evergreen.max_gprs = 256; |
| 1668 | + rdev->config.evergreen.max_threads = 248; |
| 1669 | + rdev->config.evergreen.max_gs_threads = 32; |
| 1670 | + rdev->config.evergreen.max_stack_entries = 512; |
| 1671 | + rdev->config.evergreen.sx_num_of_sets = 4; |
| 1672 | + rdev->config.evergreen.sx_max_export_size = 256; |
| 1673 | + rdev->config.evergreen.sx_max_export_pos_size = 64; |
| 1674 | + rdev->config.evergreen.sx_max_export_smx_size = 192; |
| 1675 | + rdev->config.evergreen.max_hw_contexts = 8; |
| 1676 | + rdev->config.evergreen.sq_num_cf_insts = 2; |
| 1677 | + |
| 1678 | + rdev->config.evergreen.sc_prim_fifo_size = 0x100; |
| 1679 | + rdev->config.evergreen.sc_hiz_tile_fifo_size = 0x30; |
| 1680 | + rdev->config.evergreen.sc_earlyz_tile_fifo_size = 0x130; |
| 1681 | + break; |
| 1682 | + case CHIP_TURKS: |
| 1683 | + rdev->config.evergreen.num_ses = 1; |
| 1684 | + rdev->config.evergreen.max_pipes = 4; |
| 1685 | + rdev->config.evergreen.max_tile_pipes = 4; |
| 1686 | + rdev->config.evergreen.max_simds = 6; |
| 1687 | + rdev->config.evergreen.max_backends = 2 * rdev->config.evergreen.num_ses; |
| 1688 | + rdev->config.evergreen.max_gprs = 256; |
| 1689 | + rdev->config.evergreen.max_threads = 248; |
| 1690 | + rdev->config.evergreen.max_gs_threads = 32; |
| 1691 | + rdev->config.evergreen.max_stack_entries = 256; |
| 1692 | + rdev->config.evergreen.sx_num_of_sets = 4; |
| 1693 | + rdev->config.evergreen.sx_max_export_size = 256; |
| 1694 | + rdev->config.evergreen.sx_max_export_pos_size = 64; |
| 1695 | + rdev->config.evergreen.sx_max_export_smx_size = 192; |
| 1696 | + rdev->config.evergreen.max_hw_contexts = 8; |
| 1697 | + rdev->config.evergreen.sq_num_cf_insts = 2; |
| 1698 | + |
| 1699 | + rdev->config.evergreen.sc_prim_fifo_size = 0x100; |
| 1700 | + rdev->config.evergreen.sc_hiz_tile_fifo_size = 0x30; |
| 1701 | + rdev->config.evergreen.sc_earlyz_tile_fifo_size = 0x130; |
| 1702 | + break; |
| 1703 | + case CHIP_CAICOS: |
| 1704 | + rdev->config.evergreen.num_ses = 1; |
| 1705 | + rdev->config.evergreen.max_pipes = 4; |
| 1706 | + rdev->config.evergreen.max_tile_pipes = 2; |
| 1707 | + rdev->config.evergreen.max_simds = 2; |
| 1708 | + rdev->config.evergreen.max_backends = 1 * rdev->config.evergreen.num_ses; |
| 1709 | + rdev->config.evergreen.max_gprs = 256; |
| 1710 | + rdev->config.evergreen.max_threads = 192; |
| 1711 | + rdev->config.evergreen.max_gs_threads = 16; |
| 1712 | + rdev->config.evergreen.max_stack_entries = 256; |
| 1713 | + rdev->config.evergreen.sx_num_of_sets = 4; |
| 1714 | + rdev->config.evergreen.sx_max_export_size = 128; |
| 1715 | + rdev->config.evergreen.sx_max_export_pos_size = 32; |
| 1716 | + rdev->config.evergreen.sx_max_export_smx_size = 96; |
| 1717 | + rdev->config.evergreen.max_hw_contexts = 4; |
| 1718 | + rdev->config.evergreen.sq_num_cf_insts = 1; |
| 1719 | + |
1638 | 1720 | rdev->config.evergreen.sc_prim_fifo_size = 0x40; |
1639 | 1721 | rdev->config.evergreen.sc_hiz_tile_fifo_size = 0x30; |
1640 | 1722 | rdev->config.evergreen.sc_earlyz_tile_fifo_size = 0x130; |
@@ -1780,6 +1862,7 @@ static void evergreen_gpu_init(struct radeon_device *rdev) |
1780 | 1862 | switch (rdev->family) { |
1781 | 1863 | case CHIP_CYPRESS: |
1782 | 1864 | case CHIP_HEMLOCK: |
| 1865 | + case CHIP_BARTS: |
1783 | 1866 | gb_backend_map = 0x66442200; |
1784 | 1867 | break; |
1785 | 1868 | case CHIP_JUNIPER: |
@@ -1918,6 +2001,7 @@ static void evergreen_gpu_init(struct radeon_device *rdev) |
1918 | 2001 | switch (rdev->family) { |
1919 | 2002 | case CHIP_CEDAR: |
1920 | 2003 | case CHIP_PALM: |
| 2004 | + case CHIP_CAICOS: |
1921 | 2005 | /* no vertex cache */ |
1922 | 2006 | sq_config &= ~VC_ENABLE; |
1923 | 2007 | break; |
@@ -1977,6 +2061,7 @@ static void evergreen_gpu_init(struct radeon_device *rdev) |
1977 | 2061 | switch (rdev->family) { |
1978 | 2062 | case CHIP_CEDAR: |
1979 | 2063 | case CHIP_PALM: |
| 2064 | + case CHIP_CAICOS: |
1980 | 2065 | vgt_cache_invalidation = CACHE_INVALIDATION(TC_ONLY); |
1981 | 2066 | break; |
1982 | 2067 | default: |
@@ -2767,12 +2852,31 @@ static int evergreen_startup(struct radeon_device *rdev) |
2767 | 2852 | { |
2768 | 2853 | int r; |
2769 | 2854 |
|
2770 | | - if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw) { |
2771 | | - r = r600_init_microcode(rdev); |
| 2855 | + /* enable pcie gen2 link */ |
| 2856 | + if (!ASIC_IS_DCE5(rdev)) |
| 2857 | + evergreen_pcie_gen2_enable(rdev); |
| 2858 | + |
| 2859 | + if (ASIC_IS_DCE5(rdev)) { |
| 2860 | + if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw || !rdev->mc_fw) { |
| 2861 | + r = ni_init_microcode(rdev); |
| 2862 | + if (r) { |
| 2863 | + DRM_ERROR("Failed to load firmware!\n"); |
| 2864 | + return r; |
| 2865 | + } |
| 2866 | + } |
| 2867 | + r = btc_mc_load_microcode(rdev); |
2772 | 2868 | if (r) { |
2773 | | - DRM_ERROR("Failed to load firmware!\n"); |
| 2869 | + DRM_ERROR("Failed to load MC firmware!\n"); |
2774 | 2870 | return r; |
2775 | 2871 | } |
| 2872 | + } else { |
| 2873 | + if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw) { |
| 2874 | + r = r600_init_microcode(rdev); |
| 2875 | + if (r) { |
| 2876 | + DRM_ERROR("Failed to load firmware!\n"); |
| 2877 | + return r; |
| 2878 | + } |
| 2879 | + } |
2776 | 2880 | } |
2777 | 2881 |
|
2778 | 2882 | evergreen_mc_program(rdev); |
@@ -3049,3 +3153,52 @@ void evergreen_fini(struct radeon_device *rdev) |
3049 | 3153 | rdev->bios = NULL; |
3050 | 3154 | radeon_dummy_page_fini(rdev); |
3051 | 3155 | } |
| 3156 | + |
| 3157 | +static void evergreen_pcie_gen2_enable(struct radeon_device *rdev) |
| 3158 | +{ |
| 3159 | + u32 link_width_cntl, speed_cntl; |
| 3160 | + |
| 3161 | + if (rdev->flags & RADEON_IS_IGP) |
| 3162 | + return; |
| 3163 | + |
| 3164 | + if (!(rdev->flags & RADEON_IS_PCIE)) |
| 3165 | + return; |
| 3166 | + |
| 3167 | + /* x2 cards have a special sequence */ |
| 3168 | + if (ASIC_IS_X2(rdev)) |
| 3169 | + return; |
| 3170 | + |
| 3171 | + speed_cntl = RREG32_PCIE_P(PCIE_LC_SPEED_CNTL); |
| 3172 | + if ((speed_cntl & LC_OTHER_SIDE_EVER_SENT_GEN2) || |
| 3173 | + (speed_cntl & LC_OTHER_SIDE_SUPPORTS_GEN2)) { |
| 3174 | + |
| 3175 | + link_width_cntl = RREG32_PCIE_P(PCIE_LC_LINK_WIDTH_CNTL); |
| 3176 | + link_width_cntl &= ~LC_UPCONFIGURE_DIS; |
| 3177 | + WREG32_PCIE_P(PCIE_LC_LINK_WIDTH_CNTL, link_width_cntl); |
| 3178 | + |
| 3179 | + speed_cntl = RREG32_PCIE_P(PCIE_LC_SPEED_CNTL); |
| 3180 | + speed_cntl &= ~LC_TARGET_LINK_SPEED_OVERRIDE_EN; |
| 3181 | + WREG32_PCIE_P(PCIE_LC_SPEED_CNTL, speed_cntl); |
| 3182 | + |
| 3183 | + speed_cntl = RREG32_PCIE_P(PCIE_LC_SPEED_CNTL); |
| 3184 | + speed_cntl |= LC_CLR_FAILED_SPD_CHANGE_CNT; |
| 3185 | + WREG32_PCIE_P(PCIE_LC_SPEED_CNTL, speed_cntl); |
| 3186 | + |
| 3187 | + speed_cntl = RREG32_PCIE_P(PCIE_LC_SPEED_CNTL); |
| 3188 | + speed_cntl &= ~LC_CLR_FAILED_SPD_CHANGE_CNT; |
| 3189 | + WREG32_PCIE_P(PCIE_LC_SPEED_CNTL, speed_cntl); |
| 3190 | + |
| 3191 | + speed_cntl = RREG32_PCIE_P(PCIE_LC_SPEED_CNTL); |
| 3192 | + speed_cntl |= LC_GEN2_EN_STRAP; |
| 3193 | + WREG32_PCIE_P(PCIE_LC_SPEED_CNTL, speed_cntl); |
| 3194 | + |
| 3195 | + } else { |
| 3196 | + link_width_cntl = RREG32_PCIE_P(PCIE_LC_LINK_WIDTH_CNTL); |
| 3197 | + /* XXX: only disable it if gen1 bridge vendor == 0x111d or 0x1106 */ |
| 3198 | + if (1) |
| 3199 | + link_width_cntl |= LC_UPCONFIGURE_DIS; |
| 3200 | + else |
| 3201 | + link_width_cntl &= ~LC_UPCONFIGURE_DIS; |
| 3202 | + WREG32_PCIE_P(PCIE_LC_LINK_WIDTH_CNTL, link_width_cntl); |
| 3203 | + } |
| 3204 | +} |
0 commit comments