diff options
author | Tom St Denis <tom.stdenis@amd.com> | 2016-09-01 13:39:37 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2016-09-02 11:32:45 -0400 |
commit | 4aeacf0f9aa8a6ade9ce85f0074ba848230eb34f (patch) | |
tree | ac6e2e94c847a952e6a1fe8919318e1e554c7d56 /drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c | |
parent | 142333dbb9fbecf0e6693ac4545676f36225ee89 (diff) |
drm/amd/amdgpu: Various tidy ups for gfx6
Various whitespace and logical simplifications for gfx6.
Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c | 40 |
1 files changed, 5 insertions, 35 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c index 65695544435b..f430d6acc002 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c | |||
@@ -1211,11 +1211,8 @@ static void gfx_v6_0_gpu_init(struct amdgpu_device *adev) | |||
1211 | SC_EARLYZ_TILE_FIFO_SIZE(adev->gfx.config.sc_earlyz_tile_fifo_size))); | 1211 | SC_EARLYZ_TILE_FIFO_SIZE(adev->gfx.config.sc_earlyz_tile_fifo_size))); |
1212 | 1212 | ||
1213 | WREG32(VGT_NUM_INSTANCES, 1); | 1213 | WREG32(VGT_NUM_INSTANCES, 1); |
1214 | |||
1215 | WREG32(CP_PERFMON_CNTL, 0); | 1214 | WREG32(CP_PERFMON_CNTL, 0); |
1216 | |||
1217 | WREG32(SQ_CONFIG, 0); | 1215 | WREG32(SQ_CONFIG, 0); |
1218 | |||
1219 | WREG32(PA_SC_FORCE_EOV_MAX_CNTS, (FORCE_EOV_MAX_CLK_CNT(4095) | | 1216 | WREG32(PA_SC_FORCE_EOV_MAX_CNTS, (FORCE_EOV_MAX_CLK_CNT(4095) | |
1220 | FORCE_EOV_MAX_REZ_CNT(255))); | 1217 | FORCE_EOV_MAX_REZ_CNT(255))); |
1221 | 1218 | ||
@@ -1240,7 +1237,6 @@ static void gfx_v6_0_gpu_init(struct amdgpu_device *adev) | |||
1240 | WREG32(PA_CL_ENHANCE, CLIP_VTX_REORDER_ENA | NUM_CLIP_SEQ(3)); | 1237 | WREG32(PA_CL_ENHANCE, CLIP_VTX_REORDER_ENA | NUM_CLIP_SEQ(3)); |
1241 | 1238 | ||
1242 | udelay(50); | 1239 | udelay(50); |
1243 | |||
1244 | } | 1240 | } |
1245 | 1241 | ||
1246 | 1242 | ||
@@ -1661,21 +1657,14 @@ static int gfx_v6_0_cp_gfx_resume(struct amdgpu_device *adev) | |||
1661 | 1657 | ||
1662 | static u32 gfx_v6_0_ring_get_rptr_gfx(struct amdgpu_ring *ring) | 1658 | static u32 gfx_v6_0_ring_get_rptr_gfx(struct amdgpu_ring *ring) |
1663 | { | 1659 | { |
1664 | u32 rptr; | 1660 | return ring->adev->wb.wb[ring->rptr_offs]; |
1665 | |||
1666 | rptr = ring->adev->wb.wb[ring->rptr_offs]; | ||
1667 | |||
1668 | return rptr; | ||
1669 | } | 1661 | } |
1670 | 1662 | ||
1671 | static u32 gfx_v6_0_ring_get_wptr_gfx(struct amdgpu_ring *ring) | 1663 | static u32 gfx_v6_0_ring_get_wptr_gfx(struct amdgpu_ring *ring) |
1672 | { | 1664 | { |
1673 | struct amdgpu_device *adev = ring->adev; | 1665 | struct amdgpu_device *adev = ring->adev; |
1674 | u32 wptr; | ||
1675 | 1666 | ||
1676 | wptr = RREG32(CP_RB0_WPTR); | 1667 | return RREG32(CP_RB0_WPTR); |
1677 | |||
1678 | return wptr; | ||
1679 | } | 1668 | } |
1680 | 1669 | ||
1681 | static void gfx_v6_0_ring_set_wptr_gfx(struct amdgpu_ring *ring) | 1670 | static void gfx_v6_0_ring_set_wptr_gfx(struct amdgpu_ring *ring) |
@@ -1688,9 +1677,7 @@ static void gfx_v6_0_ring_set_wptr_gfx(struct amdgpu_ring *ring) | |||
1688 | 1677 | ||
1689 | static u32 gfx_v6_0_ring_get_rptr_compute(struct amdgpu_ring *ring) | 1678 | static u32 gfx_v6_0_ring_get_rptr_compute(struct amdgpu_ring *ring) |
1690 | { | 1679 | { |
1691 | u32 rptr = ring->adev->wb.wb[ring->rptr_offs]; | 1680 | return ring->adev->wb.wb[ring->rptr_offs]; |
1692 | |||
1693 | return rptr; | ||
1694 | } | 1681 | } |
1695 | 1682 | ||
1696 | static u32 gfx_v6_0_ring_get_wptr_compute(struct amdgpu_ring *ring) | 1683 | static u32 gfx_v6_0_ring_get_wptr_compute(struct amdgpu_ring *ring) |
@@ -1748,14 +1735,12 @@ static int gfx_v6_0_cp_compute_resume(struct amdgpu_device *adev) | |||
1748 | ring->wptr = 0; | 1735 | ring->wptr = 0; |
1749 | WREG32(CP_RB1_WPTR, ring->wptr); | 1736 | WREG32(CP_RB1_WPTR, ring->wptr); |
1750 | 1737 | ||
1751 | |||
1752 | rptr_addr = adev->wb.gpu_addr + (ring->rptr_offs * 4); | 1738 | rptr_addr = adev->wb.gpu_addr + (ring->rptr_offs * 4); |
1753 | WREG32(CP_RB1_RPTR_ADDR, lower_32_bits(rptr_addr)); | 1739 | WREG32(CP_RB1_RPTR_ADDR, lower_32_bits(rptr_addr)); |
1754 | WREG32(CP_RB1_RPTR_ADDR_HI, upper_32_bits(rptr_addr) & 0xFF); | 1740 | WREG32(CP_RB1_RPTR_ADDR_HI, upper_32_bits(rptr_addr) & 0xFF); |
1755 | 1741 | ||
1756 | mdelay(1); | 1742 | mdelay(1); |
1757 | WREG32(CP_RB1_CNTL, tmp); | 1743 | WREG32(CP_RB1_CNTL, tmp); |
1758 | |||
1759 | WREG32(CP_RB1_BASE, ring->gpu_addr >> 8); | 1744 | WREG32(CP_RB1_BASE, ring->gpu_addr >> 8); |
1760 | 1745 | ||
1761 | ring = &adev->gfx.compute_ring[1]; | 1746 | ring = &adev->gfx.compute_ring[1]; |
@@ -1775,7 +1760,6 @@ static int gfx_v6_0_cp_compute_resume(struct amdgpu_device *adev) | |||
1775 | 1760 | ||
1776 | mdelay(1); | 1761 | mdelay(1); |
1777 | WREG32(CP_RB2_CNTL, tmp); | 1762 | WREG32(CP_RB2_CNTL, tmp); |
1778 | |||
1779 | WREG32(CP_RB2_BASE, ring->gpu_addr >> 8); | 1763 | WREG32(CP_RB2_BASE, ring->gpu_addr >> 8); |
1780 | 1764 | ||
1781 | adev->gfx.compute_ring[0].ready = true; | 1765 | adev->gfx.compute_ring[0].ready = true; |
@@ -1803,12 +1787,7 @@ static void gfx_v6_0_cp_enable(struct amdgpu_device *adev, bool enable) | |||
1803 | 1787 | ||
1804 | static int gfx_v6_0_cp_load_microcode(struct amdgpu_device *adev) | 1788 | static int gfx_v6_0_cp_load_microcode(struct amdgpu_device *adev) |
1805 | { | 1789 | { |
1806 | int r; | 1790 | return gfx_v6_0_cp_gfx_load_microcode(adev); |
1807 | |||
1808 | r = gfx_v6_0_cp_gfx_load_microcode(adev); | ||
1809 | |||
1810 | return r; | ||
1811 | |||
1812 | } | 1791 | } |
1813 | 1792 | ||
1814 | static void gfx_v6_0_enable_gui_idle_interrupt(struct amdgpu_device *adev, | 1793 | static void gfx_v6_0_enable_gui_idle_interrupt(struct amdgpu_device *adev, |
@@ -2150,7 +2129,6 @@ static void gfx_v6_0_rlc_stop(struct amdgpu_device *adev) | |||
2150 | WREG32(RLC_CNTL, 0); | 2129 | WREG32(RLC_CNTL, 0); |
2151 | 2130 | ||
2152 | gfx_v6_0_enable_gui_idle_interrupt(adev, false); | 2131 | gfx_v6_0_enable_gui_idle_interrupt(adev, false); |
2153 | |||
2154 | gfx_v6_0_wait_for_rlc_serdes(adev); | 2132 | gfx_v6_0_wait_for_rlc_serdes(adev); |
2155 | } | 2133 | } |
2156 | 2134 | ||
@@ -2201,11 +2179,8 @@ static int gfx_v6_0_rlc_resume(struct amdgpu_device *adev) | |||
2201 | return -EINVAL; | 2179 | return -EINVAL; |
2202 | 2180 | ||
2203 | gfx_v6_0_rlc_stop(adev); | 2181 | gfx_v6_0_rlc_stop(adev); |
2204 | |||
2205 | gfx_v6_0_rlc_reset(adev); | 2182 | gfx_v6_0_rlc_reset(adev); |
2206 | |||
2207 | gfx_v6_0_init_pg(adev); | 2183 | gfx_v6_0_init_pg(adev); |
2208 | |||
2209 | gfx_v6_0_init_cg(adev); | 2184 | gfx_v6_0_init_cg(adev); |
2210 | 2185 | ||
2211 | WREG32(RLC_RL_BASE, 0); | 2186 | WREG32(RLC_RL_BASE, 0); |
@@ -2232,7 +2207,6 @@ static int gfx_v6_0_rlc_resume(struct amdgpu_device *adev) | |||
2232 | WREG32(RLC_UCODE_ADDR, 0); | 2207 | WREG32(RLC_UCODE_ADDR, 0); |
2233 | 2208 | ||
2234 | gfx_v6_0_enable_lbpw(adev, gfx_v6_0_lbpw_supported(adev)); | 2209 | gfx_v6_0_enable_lbpw(adev, gfx_v6_0_lbpw_supported(adev)); |
2235 | |||
2236 | gfx_v6_0_rlc_start(adev); | 2210 | gfx_v6_0_rlc_start(adev); |
2237 | 2211 | ||
2238 | return 0; | 2212 | return 0; |
@@ -2256,7 +2230,6 @@ static void gfx_v6_0_enable_cgcg(struct amdgpu_device *adev, bool enable) | |||
2256 | WREG32(RLC_SERDES_WR_CTRL, 0x00b000ff); | 2230 | WREG32(RLC_SERDES_WR_CTRL, 0x00b000ff); |
2257 | 2231 | ||
2258 | gfx_v6_0_wait_for_rlc_serdes(adev); | 2232 | gfx_v6_0_wait_for_rlc_serdes(adev); |
2259 | |||
2260 | gfx_v6_0_update_rlc(adev, tmp); | 2233 | gfx_v6_0_update_rlc(adev, tmp); |
2261 | 2234 | ||
2262 | WREG32(RLC_SERDES_WR_CTRL, 0x007000ff); | 2235 | WREG32(RLC_SERDES_WR_CTRL, 0x007000ff); |
@@ -2908,13 +2881,10 @@ static bool gfx_v6_0_is_idle(void *handle) | |||
2908 | static int gfx_v6_0_wait_for_idle(void *handle) | 2881 | static int gfx_v6_0_wait_for_idle(void *handle) |
2909 | { | 2882 | { |
2910 | unsigned i; | 2883 | unsigned i; |
2911 | u32 tmp; | ||
2912 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; | 2884 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
2913 | 2885 | ||
2914 | for (i = 0; i < adev->usec_timeout; i++) { | 2886 | for (i = 0; i < adev->usec_timeout; i++) { |
2915 | tmp = RREG32(GRBM_STATUS) & GRBM_STATUS__GUI_ACTIVE_MASK; | 2887 | if (gfx_v6_0_is_idle(handle)) |
2916 | |||
2917 | if (!tmp) | ||
2918 | return 0; | 2888 | return 0; |
2919 | udelay(1); | 2889 | udelay(1); |
2920 | } | 2890 | } |