diff options
-rw-r--r-- | drivers/gpu/drm/ati_pcigart.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/gpu/drm/ati_pcigart.c b/drivers/gpu/drm/ati_pcigart.c index 7972ec8762c7..4d86a629a517 100644 --- a/drivers/gpu/drm/ati_pcigart.c +++ b/drivers/gpu/drm/ati_pcigart.c | |||
@@ -102,7 +102,7 @@ int drm_ati_pcigart_init(struct drm_device *dev, struct drm_ati_pcigart_info *ga | |||
102 | u32 *pci_gart, page_base, gart_idx; | 102 | u32 *pci_gart, page_base, gart_idx; |
103 | dma_addr_t bus_address = 0; | 103 | dma_addr_t bus_address = 0; |
104 | int i, j, ret = 0; | 104 | int i, j, ret = 0; |
105 | int max_pages; | 105 | int max_ati_pages, max_real_pages; |
106 | 106 | ||
107 | if (!entry) { | 107 | if (!entry) { |
108 | DRM_ERROR("no scatter/gather memory!\n"); | 108 | DRM_ERROR("no scatter/gather memory!\n"); |
@@ -130,14 +130,15 @@ int drm_ati_pcigart_init(struct drm_device *dev, struct drm_ati_pcigart_info *ga | |||
130 | 130 | ||
131 | pci_gart = (u32 *) address; | 131 | pci_gart = (u32 *) address; |
132 | 132 | ||
133 | max_pages = (gart_info->table_size / sizeof(u32)); | 133 | max_ati_pages = (gart_info->table_size / sizeof(u32)); |
134 | pages = (entry->pages <= max_pages) | 134 | max_real_pages = max_ati_pages / (PAGE_SIZE / ATI_PCIGART_PAGE_SIZE); |
135 | ? entry->pages : max_pages; | 135 | pages = (entry->pages <= max_real_pages) |
136 | ? entry->pages : max_real_pages; | ||
136 | 137 | ||
137 | if (gart_info->gart_table_location == DRM_ATI_GART_MAIN) { | 138 | if (gart_info->gart_table_location == DRM_ATI_GART_MAIN) { |
138 | memset(pci_gart, 0, max_pages * sizeof(u32)); | 139 | memset(pci_gart, 0, max_ati_pages * sizeof(u32)); |
139 | } else { | 140 | } else { |
140 | for (gart_idx = 0; gart_idx < max_pages; gart_idx++) | 141 | for (gart_idx = 0; gart_idx < max_ati_pages; gart_idx++) |
141 | DRM_WRITE32(map, gart_idx * sizeof(u32), 0); | 142 | DRM_WRITE32(map, gart_idx * sizeof(u32), 0); |
142 | } | 143 | } |
143 | 144 | ||