diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-03-30 13:54:50 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-03-30 13:54:50 -0700 |
commit | dfbbe89e197a77f2c8046a51c74e33e35f878080 (patch) | |
tree | 23b860ad3d68a12503f04c44c2e4465fbb8bdae9 /drivers/gpu/drm/ati_pcigart.c | |
parent | 712b0006bf3a9ed0b14a56c3291975e582127766 (diff) | |
parent | f23c20c83d523e5f8cda1f8f7ed52fe6afffbe29 (diff) |
Merge branch 'drm-next' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6
* 'drm-next' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6: (53 commits)
drm: detect hdmi monitor by hdmi identifier (v3)
drm: drm_fops.c unlock missing on error path
drm: reorder struct drm_ioctl_desc to save space on 64 bit builds
radeon: add some new pci ids
drm: read EDID extensions from monitor
drm: Use a little stash on the stack to avoid kmalloc in most DRM ioctls.
drm/radeon: add regs required for occlusion queries support
drm/i915: check the return value from the copy from user
drm/radeon: fix logic in r600_page_table_init() to match ati_gart
drm/radeon: r600 ptes are 64-bit, cleanup cleanup function.
drm/radeon: don't call irq changes on r600 suspend/resume
drm/radeon: fix r600 writeback across suspend/resume
drm/radeon: fix r600 writeback setup.
drm: fix warnings about new mappings in info code.
drm/radeon: NULL noise: drivers/gpu/drm/radeon/radeon_*.c
drm/radeon: fix r600 pci mapping calls.
drm/radeon: r6xx/r7xx: fix possible oops in r600_page_table_cleanup()
radeon: call the correct idle function, logic got inverted.
drm/radeon: RS600: fix interrupt handling
drm/r600: fix rptr address along lines of previous fixes to radeon.
...
Diffstat (limited to 'drivers/gpu/drm/ati_pcigart.c')
-rw-r--r-- | drivers/gpu/drm/ati_pcigart.c | 40 |
1 files changed, 27 insertions, 13 deletions
diff --git a/drivers/gpu/drm/ati_pcigart.c b/drivers/gpu/drm/ati_pcigart.c index c533d0c9ec6..628eae3e9b8 100644 --- a/drivers/gpu/drm/ati_pcigart.c +++ b/drivers/gpu/drm/ati_pcigart.c @@ -77,7 +77,7 @@ int drm_ati_pcigart_cleanup(struct drm_device *dev, struct drm_ati_pcigart_info if (!entry->busaddr[i]) break; pci_unmap_page(dev->pdev, entry->busaddr[i], - PAGE_SIZE, PCI_DMA_TODEVICE); + PAGE_SIZE, PCI_DMA_BIDIRECTIONAL); } if (gart_info->gart_table_location == DRM_ATI_GART_MAIN) @@ -95,13 +95,14 @@ EXPORT_SYMBOL(drm_ati_pcigart_cleanup); int drm_ati_pcigart_init(struct drm_device *dev, struct drm_ati_pcigart_info *gart_info) { + struct drm_local_map *map = &gart_info->mapping; struct drm_sg_mem *entry = dev->sg; void *address = NULL; unsigned long pages; - u32 *pci_gart, page_base; + u32 *pci_gart = NULL, page_base, gart_idx; dma_addr_t bus_address = 0; int i, j, ret = 0; - int max_pages; + int max_ati_pages, max_real_pages; if (!entry) { DRM_ERROR("no scatter/gather memory!\n"); @@ -117,6 +118,7 @@ int drm_ati_pcigart_init(struct drm_device *dev, struct drm_ati_pcigart_info *ga goto done; } + pci_gart = gart_info->table_handle->vaddr; address = gart_info->table_handle->vaddr; bus_address = gart_info->table_handle->busaddr; } else { @@ -127,18 +129,23 @@ int drm_ati_pcigart_init(struct drm_device *dev, struct drm_ati_pcigart_info *ga (unsigned long)address); } - pci_gart = (u32 *) address; - max_pages = (gart_info->table_size / sizeof(u32)); - pages = (entry->pages <= max_pages) - ? entry->pages : max_pages; + max_ati_pages = (gart_info->table_size / sizeof(u32)); + max_real_pages = max_ati_pages / (PAGE_SIZE / ATI_PCIGART_PAGE_SIZE); + pages = (entry->pages <= max_real_pages) + ? entry->pages : max_real_pages; - memset(pci_gart, 0, max_pages * sizeof(u32)); + if (gart_info->gart_table_location == DRM_ATI_GART_MAIN) { + memset(pci_gart, 0, max_ati_pages * sizeof(u32)); + } else { + memset_io((void __iomem *)map->handle, 0, max_ati_pages * sizeof(u32)); + } + gart_idx = 0; for (i = 0; i < pages; i++) { /* we need to support large memory configurations */ entry->busaddr[i] = pci_map_page(dev->pdev, entry->pagelist[i], - 0, PAGE_SIZE, PCI_DMA_TODEVICE); + 0, PAGE_SIZE, PCI_DMA_BIDIRECTIONAL); if (entry->busaddr[i] == 0) { DRM_ERROR("unable to map PCIGART pages!\n"); drm_ati_pcigart_cleanup(dev, gart_info); @@ -149,19 +156,26 @@ int drm_ati_pcigart_init(struct drm_device *dev, struct drm_ati_pcigart_info *ga page_base = (u32) entry->busaddr[i]; for (j = 0; j < (PAGE_SIZE / ATI_PCIGART_PAGE_SIZE); j++) { + u32 val; + switch(gart_info->gart_reg_if) { case DRM_ATI_GART_IGP: - *pci_gart = cpu_to_le32((page_base) | 0xc); + val = page_base | 0xc; break; case DRM_ATI_GART_PCIE: - *pci_gart = cpu_to_le32((page_base >> 8) | 0xc); + val = (page_base >> 8) | 0xc; break; default: case DRM_ATI_GART_PCI: - *pci_gart = cpu_to_le32(page_base); + val = page_base; break; } - pci_gart++; + if (gart_info->gart_table_location == + DRM_ATI_GART_MAIN) + pci_gart[gart_idx] = cpu_to_le32(val); + else + DRM_WRITE32(map, gart_idx * sizeof(u32), val); + gart_idx++; page_base += ATI_PCIGART_PAGE_SIZE; } } |