aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/r100.c
diff options
context:
space:
mode:
authorJerome Glisse <jglisse@redhat.com>2009-09-14 12:29:49 -0400
committerDave Airlie <airlied@redhat.com>2009-09-14 18:53:14 -0400
commit4aac047323e3082d0866b8ad3784236632105af4 (patch)
treeaf4c118e42b9ea55c961c4f5bbb02998dc2cc4fe /drivers/gpu/drm/radeon/r100.c
parent21f9a437222e92adb3abc68584a5f04801b92739 (diff)
drm/radeon/kms: clear confusion in GART init/deinit path
GART static one time initialization was mixed up with GART enabling/disabling which could happen several time for instance during suspend/resume cycles. This patch splits all GART handling into 4 differents function. gart_init is for one time initialization, gart_deinit is called upon module unload to free resources allocated by gart_init, gart_enable enable the GART and is intented to be call after first initialization and at each resume cycle or reset cycle. Finaly gart_disable stop the GART and is intended to be call at suspend time or when unloading the module. Signed-off-by: Jerome Glisse <jglisse@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/r100.c')
-rw-r--r--drivers/gpu/drm/radeon/r100.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c
index 47263d3ede98..fa0fdc1e3457 100644
--- a/drivers/gpu/drm/radeon/r100.c
+++ b/drivers/gpu/drm/radeon/r100.c
@@ -84,23 +84,28 @@ void r100_pci_gart_tlb_flush(struct radeon_device *rdev)
84 * could end up in wrong address. */ 84 * could end up in wrong address. */
85} 85}
86 86
87int r100_pci_gart_enable(struct radeon_device *rdev) 87int r100_pci_gart_init(struct radeon_device *rdev)
88{ 88{
89 uint32_t tmp;
90 int r; 89 int r;
91 90
91 if (rdev->gart.table.ram.ptr) {
92 WARN(1, "R100 PCI GART already initialized.\n");
93 return 0;
94 }
92 /* Initialize common gart structure */ 95 /* Initialize common gart structure */
93 r = radeon_gart_init(rdev); 96 r = radeon_gart_init(rdev);
94 if (r) { 97 if (r)
95 return r; 98 return r;
96 } 99 rdev->gart.table_size = rdev->gart.num_gpu_pages * 4;
97 if (rdev->gart.table.ram.ptr == NULL) { 100 rdev->asic->gart_tlb_flush = &r100_pci_gart_tlb_flush;
98 rdev->gart.table_size = rdev->gart.num_gpu_pages * 4; 101 rdev->asic->gart_set_page = &r100_pci_gart_set_page;
99 r = radeon_gart_table_ram_alloc(rdev); 102 return radeon_gart_table_ram_alloc(rdev);
100 if (r) { 103}
101 return r; 104
102 } 105int r100_pci_gart_enable(struct radeon_device *rdev)
103 } 106{
107 uint32_t tmp;
108
104 /* discard memory request outside of configured range */ 109 /* discard memory request outside of configured range */
105 tmp = RREG32(RADEON_AIC_CNTL) | RADEON_DIS_OUT_OF_PCI_GART_ACCESS; 110 tmp = RREG32(RADEON_AIC_CNTL) | RADEON_DIS_OUT_OF_PCI_GART_ACCESS;
106 WREG32(RADEON_AIC_CNTL, tmp); 111 WREG32(RADEON_AIC_CNTL, tmp);
@@ -140,13 +145,11 @@ int r100_pci_gart_set_page(struct radeon_device *rdev, int i, uint64_t addr)
140 return 0; 145 return 0;
141} 146}
142 147
143int r100_gart_enable(struct radeon_device *rdev) 148void r100_pci_gart_fini(struct radeon_device *rdev)
144{ 149{
145 if (rdev->flags & RADEON_IS_AGP) { 150 r100_pci_gart_disable(rdev);
146 r100_pci_gart_disable(rdev); 151 radeon_gart_table_ram_free(rdev);
147 return 0; 152 radeon_gart_fini(rdev);
148 }
149 return r100_pci_gart_enable(rdev);
150} 153}
151 154
152 155
@@ -273,9 +276,6 @@ int r100_mc_init(struct radeon_device *rdev)
273 276
274void r100_mc_fini(struct radeon_device *rdev) 277void r100_mc_fini(struct radeon_device *rdev)
275{ 278{
276 r100_pci_gart_disable(rdev);
277 radeon_gart_table_ram_free(rdev);
278 radeon_gart_fini(rdev);
279} 279}
280 280
281 281