summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2008-06-10 16:27:50 +1000
committerDave Airlie <airlied@redhat.com>2008-06-10 16:27:50 +1000
commitcdd0cb0ab372ac93adc73945627f4071f86f75c0 (patch)
tree77254be6ab7b7905dd5edf836090a945d429a4de
parent4b8aecbde8e62af5370d5401d49a8ab8d089fe8e (diff)
ati_pcigart: split out the page insert function
-rw-r--r--linux-core/ati_pcigart.c39
1 files changed, 23 insertions, 16 deletions
diff --git a/linux-core/ati_pcigart.c b/linux-core/ati_pcigart.c
index c2aafd22..fb663a0a 100644
--- a/linux-core/ati_pcigart.c
+++ b/linux-core/ati_pcigart.c
@@ -39,6 +39,28 @@
#define ATI_PCIE_WRITE 0x4
#define ATI_PCIE_READ 0x8
+static __inline__ void gart_insert_page_into_table(struct drm_ati_pcigart_info *gart_info, dma_addr_t addr, u32 *pci_gart)
+{
+ u32 page_base;
+
+ page_base = (u32)addr & ATI_PCIGART_PAGE_MASK;
+ switch(gart_info->gart_reg_if) {
+ case DRM_ATI_GART_IGP:
+ page_base |= (upper_32_bits(addr) & 0xff) << 4;
+ page_base |= 0xc;
+ break;
+ case DRM_ATI_GART_PCIE:
+ page_base >>= 8;
+ page_base |= (upper_32_bits(addr) & 0xff) << 24;
+ page_base |= ATI_PCIE_READ | ATI_PCIE_WRITE;
+ break;
+ default:
+ case DRM_ATI_GART_PCI:
+ break;
+ }
+ *pci_gart = cpu_to_le32(page_base);
+}
+
static int drm_ati_alloc_pcigart_table(struct drm_device *dev,
struct drm_ati_pcigart_info *gart_info)
{
@@ -155,22 +177,7 @@ int drm_ati_pcigart_init(struct drm_device *dev, struct drm_ati_pcigart_info *ga
entry_addr = entry->busaddr[i];
for (j = 0; j < (PAGE_SIZE / ATI_PCIGART_PAGE_SIZE); j++) {
- page_base = (u32) entry_addr & ATI_PCIGART_PAGE_MASK;
- switch(gart_info->gart_reg_if) {
- case DRM_ATI_GART_IGP:
- page_base |= (upper_32_bits(entry_addr) & 0xff) << 4;
- page_base |= 0xc;
- break;
- case DRM_ATI_GART_PCIE:
- page_base >>= 8;
- page_base |= (upper_32_bits(entry_addr) & 0xff) << 24;
- page_base |= ATI_PCIE_READ | ATI_PCIE_WRITE;
- break;
- default:
- case DRM_ATI_GART_PCI:
- break;
- }
- *pci_gart = cpu_to_le32(page_base);
+ gart_insert_page_into_table(gart_info, entry_addr, pci_gart);
pci_gart++;
entry_addr += ATI_PCIGART_PAGE_SIZE;
}