aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/rs600.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/radeon/rs600.c')
-rw-r--r--drivers/gpu/drm/radeon/rs600.c41
1 files changed, 30 insertions, 11 deletions
diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c
index 1b8d62f5e73c..c31bd8439259 100644
--- a/drivers/gpu/drm/radeon/rs600.c
+++ b/drivers/gpu/drm/radeon/rs600.c
@@ -68,22 +68,35 @@ void rs600_gart_tlb_flush(struct radeon_device *rdev)
68 tmp = RREG32_MC(RS600_MC_PT0_CNTL); 68 tmp = RREG32_MC(RS600_MC_PT0_CNTL);
69} 69}
70 70
71int rs600_gart_enable(struct radeon_device *rdev) 71int rs600_gart_init(struct radeon_device *rdev)
72{ 72{
73 uint32_t tmp;
74 int i;
75 int r; 73 int r;
76 74
75 if (rdev->gart.table.vram.robj) {
76 WARN(1, "RS600 GART already initialized.\n");
77 return 0;
78 }
77 /* Initialize common gart structure */ 79 /* Initialize common gart structure */
78 r = radeon_gart_init(rdev); 80 r = radeon_gart_init(rdev);
79 if (r) { 81 if (r) {
80 return r; 82 return r;
81 } 83 }
82 rdev->gart.table_size = rdev->gart.num_gpu_pages * 8; 84 rdev->gart.table_size = rdev->gart.num_gpu_pages * 8;
83 r = radeon_gart_table_vram_alloc(rdev); 85 return radeon_gart_table_vram_alloc(rdev);
84 if (r) { 86}
85 return r; 87
88int rs600_gart_enable(struct radeon_device *rdev)
89{
90 uint32_t tmp;
91 int r, i;
92
93 if (rdev->gart.table.vram.robj == NULL) {
94 dev_err(rdev->dev, "No VRAM object for PCIE GART.\n");
95 return -EINVAL;
86 } 96 }
97 r = radeon_gart_table_vram_pin(rdev);
98 if (r)
99 return r;
87 /* FIXME: setup default page */ 100 /* FIXME: setup default page */
88 WREG32_MC(RS600_MC_PT0_CNTL, 101 WREG32_MC(RS600_MC_PT0_CNTL,
89 (RS600_EFFECTIVE_L2_CACHE_SIZE(6) | 102 (RS600_EFFECTIVE_L2_CACHE_SIZE(6) |
@@ -138,8 +151,17 @@ void rs600_gart_disable(struct radeon_device *rdev)
138 tmp = RREG32_MC(RS600_MC_CNTL1); 151 tmp = RREG32_MC(RS600_MC_CNTL1);
139 tmp &= ~RS600_ENABLE_PAGE_TABLES; 152 tmp &= ~RS600_ENABLE_PAGE_TABLES;
140 WREG32_MC(RS600_MC_CNTL1, tmp); 153 WREG32_MC(RS600_MC_CNTL1, tmp);
141 radeon_object_kunmap(rdev->gart.table.vram.robj); 154 if (rdev->gart.table.vram.robj) {
142 radeon_object_unpin(rdev->gart.table.vram.robj); 155 radeon_object_kunmap(rdev->gart.table.vram.robj);
156 radeon_object_unpin(rdev->gart.table.vram.robj);
157 }
158}
159
160void rs600_gart_fini(struct radeon_device *rdev)
161{
162 rs600_gart_disable(rdev);
163 radeon_gart_table_vram_free(rdev);
164 radeon_gart_fini(rdev);
143} 165}
144 166
145#define R600_PTE_VALID (1 << 0) 167#define R600_PTE_VALID (1 << 0)
@@ -235,9 +257,6 @@ int rs600_mc_init(struct radeon_device *rdev)
235 257
236void rs600_mc_fini(struct radeon_device *rdev) 258void rs600_mc_fini(struct radeon_device *rdev)
237{ 259{
238 rs600_gart_disable(rdev);
239 radeon_gart_table_vram_free(rdev);
240 radeon_gart_fini(rdev);
241} 260}
242 261
243 262