diff options
author | Dave Airlie <airlied@redhat.com> | 2009-06-29 04:29:11 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2009-07-15 03:13:02 -0400 |
commit | ed10f95d60d41033d356fdcf88c240d7065bd5b4 (patch) | |
tree | 319558df2249b066c6678c2b54a8ae2fdfa7ae5c | |
parent | 44b572809581d5a10dbe35aa6bf689f32b9c5ad6 (diff) |
drm/radeon/kms: fix some GART table entry bugs.
1. rv370 can accept 40-bit addresses - also at 24-bit shift not 4 bits
2. rs480 table can be in 40-bit space. - 4 bit shift for top 8 bits
3. rs480 table entries can be in 40-bit space.
Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r-- | drivers/gpu/drm/radeon/r100.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/r300.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_gart.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/rs400.c | 13 |
4 files changed, 16 insertions, 5 deletions
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c index c550932a108f..1b23106f9552 100644 --- a/drivers/gpu/drm/radeon/r100.c +++ b/drivers/gpu/drm/radeon/r100.c | |||
@@ -110,7 +110,7 @@ int r100_pci_gart_set_page(struct radeon_device *rdev, int i, uint64_t addr) | |||
110 | if (i < 0 || i > rdev->gart.num_gpu_pages) { | 110 | if (i < 0 || i > rdev->gart.num_gpu_pages) { |
111 | return -EINVAL; | 111 | return -EINVAL; |
112 | } | 112 | } |
113 | rdev->gart.table.ram.ptr[i] = cpu_to_le32((uint32_t)addr); | 113 | rdev->gart.table.ram.ptr[i] = cpu_to_le32(lower_32_bits(addr)); |
114 | return 0; | 114 | return 0; |
115 | } | 115 | } |
116 | 116 | ||
diff --git a/drivers/gpu/drm/radeon/r300.c b/drivers/gpu/drm/radeon/r300.c index e2ed5bc08170..cd9ea98e9c6f 100644 --- a/drivers/gpu/drm/radeon/r300.c +++ b/drivers/gpu/drm/radeon/r300.c | |||
@@ -150,7 +150,9 @@ int rv370_pcie_gart_set_page(struct radeon_device *rdev, int i, uint64_t addr) | |||
150 | if (i < 0 || i > rdev->gart.num_gpu_pages) { | 150 | if (i < 0 || i > rdev->gart.num_gpu_pages) { |
151 | return -EINVAL; | 151 | return -EINVAL; |
152 | } | 152 | } |
153 | addr = (((u32)addr) >> 8) | ((upper_32_bits(addr) & 0xff) << 4) | 0xC; | 153 | addr = (lower_32_bits(addr) >> 8) | |
154 | ((upper_32_bits(addr) & 0xff) << 24) | | ||
155 | 0xc; | ||
154 | writel(cpu_to_le32(addr), ((void __iomem *)ptr) + (i * 4)); | 156 | writel(cpu_to_le32(addr), ((void __iomem *)ptr) + (i * 4)); |
155 | return 0; | 157 | return 0; |
156 | } | 158 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c index d343a15316ec..2977539880fb 100644 --- a/drivers/gpu/drm/radeon/radeon_gart.c +++ b/drivers/gpu/drm/radeon/radeon_gart.c | |||
@@ -177,7 +177,7 @@ int radeon_gart_bind(struct radeon_device *rdev, unsigned offset, | |||
177 | return -ENOMEM; | 177 | return -ENOMEM; |
178 | } | 178 | } |
179 | rdev->gart.pages[p] = pagelist[i]; | 179 | rdev->gart.pages[p] = pagelist[i]; |
180 | page_base = (uint32_t)rdev->gart.pages_addr[p]; | 180 | page_base = rdev->gart.pages_addr[p]; |
181 | for (j = 0; j < (PAGE_SIZE / 4096); j++, t++) { | 181 | for (j = 0; j < (PAGE_SIZE / 4096); j++, t++) { |
182 | radeon_gart_set_page(rdev, t, page_base); | 182 | radeon_gart_set_page(rdev, t, page_base); |
183 | page_base += 4096; | 183 | page_base += 4096; |
diff --git a/drivers/gpu/drm/radeon/rs400.c b/drivers/gpu/drm/radeon/rs400.c index cc074b5a8f74..3275de4b6e3b 100644 --- a/drivers/gpu/drm/radeon/rs400.c +++ b/drivers/gpu/drm/radeon/rs400.c | |||
@@ -164,7 +164,9 @@ int rs400_gart_enable(struct radeon_device *rdev) | |||
164 | WREG32(RADEON_BUS_CNTL, tmp); | 164 | WREG32(RADEON_BUS_CNTL, tmp); |
165 | } | 165 | } |
166 | /* Table should be in 32bits address space so ignore bits above. */ | 166 | /* Table should be in 32bits address space so ignore bits above. */ |
167 | tmp = rdev->gart.table_addr & 0xfffff000; | 167 | tmp = (u32)rdev->gart.table_addr & 0xfffff000; |
168 | tmp |= (upper_32_bits(rdev->gart.table_addr) & 0xff) << 4; | ||
169 | |||
168 | WREG32_MC(RS480_GART_BASE, tmp); | 170 | WREG32_MC(RS480_GART_BASE, tmp); |
169 | /* TODO: more tweaking here */ | 171 | /* TODO: more tweaking here */ |
170 | WREG32_MC(RS480_GART_FEATURE_ID, | 172 | WREG32_MC(RS480_GART_FEATURE_ID, |
@@ -201,10 +203,17 @@ void rs400_gart_disable(struct radeon_device *rdev) | |||
201 | 203 | ||
202 | int rs400_gart_set_page(struct radeon_device *rdev, int i, uint64_t addr) | 204 | int rs400_gart_set_page(struct radeon_device *rdev, int i, uint64_t addr) |
203 | { | 205 | { |
206 | uint32_t entry; | ||
207 | |||
204 | if (i < 0 || i > rdev->gart.num_gpu_pages) { | 208 | if (i < 0 || i > rdev->gart.num_gpu_pages) { |
205 | return -EINVAL; | 209 | return -EINVAL; |
206 | } | 210 | } |
207 | rdev->gart.table.ram.ptr[i] = cpu_to_le32(((uint32_t)addr) | 0xC); | 211 | |
212 | entry = (lower_32_bits(addr) & PAGE_MASK) | | ||
213 | ((upper_32_bits(addr) & 0xff) << 4) | | ||
214 | 0xc; | ||
215 | entry = cpu_to_le32(entry); | ||
216 | rdev->gart.table.ram.ptr[i] = entry; | ||
208 | return 0; | 217 | return 0; |
209 | } | 218 | } |
210 | 219 | ||