Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

agp: kill phys_to_gart() and gart_to_phys()

There seems to be no reason for these -- they're a 1:1 mapping on all
platforms.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>

+32 -60
-4
arch/alpha/include/asm/agp.h
··· 9 9 #define unmap_page_from_agp(page) 10 10 #define flush_agp_cache() mb() 11 11 12 - /* Convert a physical address to an address suitable for the GART. */ 13 - #define phys_to_gart(x) (x) 14 - #define gart_to_phys(x) (x) 15 - 16 12 /* GATT allocation. Returns/accepts GATT kernel virtual address. */ 17 13 #define alloc_gatt_pages(order) \ 18 14 ((char *)__get_free_pages(GFP_KERNEL, (order)))
-4
arch/ia64/include/asm/agp.h
··· 17 17 #define unmap_page_from_agp(page) /* nothing */ 18 18 #define flush_agp_cache() mb() 19 19 20 - /* Convert a physical address to an address suitable for the GART. */ 21 - #define phys_to_gart(x) (x) 22 - #define gart_to_phys(x) (x) 23 - 24 20 /* GATT allocation. Returns/accepts GATT kernel virtual address. */ 25 21 #define alloc_gatt_pages(order) \ 26 22 ((char *)__get_free_pages(GFP_KERNEL, (order)))
-4
arch/parisc/include/asm/agp.h
··· 11 11 #define unmap_page_from_agp(page) /* nothing */ 12 12 #define flush_agp_cache() mb() 13 13 14 - /* Convert a physical address to an address suitable for the GART. */ 15 - #define phys_to_gart(x) (x) 16 - #define gart_to_phys(x) (x) 17 - 18 14 /* GATT allocation. Returns/accepts GATT kernel virtual address. */ 19 15 #define alloc_gatt_pages(order) \ 20 16 ((char *)__get_free_pages(GFP_KERNEL, (order)))
-4
arch/powerpc/include/asm/agp.h
··· 8 8 #define unmap_page_from_agp(page) 9 9 #define flush_agp_cache() mb() 10 10 11 - /* Convert a physical address to an address suitable for the GART. */ 12 - #define phys_to_gart(x) (x) 13 - #define gart_to_phys(x) (x) 14 - 15 11 /* GATT allocation. Returns/accepts GATT kernel virtual address. */ 16 12 #define alloc_gatt_pages(order) \ 17 13 ((char *)__get_free_pages(GFP_KERNEL, (order)))
-4
arch/sparc/include/asm/agp.h
··· 7 7 #define unmap_page_from_agp(page) 8 8 #define flush_agp_cache() mb() 9 9 10 - /* Convert a physical address to an address suitable for the GART. */ 11 - #define phys_to_gart(x) (x) 12 - #define gart_to_phys(x) (x) 13 - 14 10 /* GATT allocation. Returns/accepts GATT kernel virtual address. */ 15 11 #define alloc_gatt_pages(order) \ 16 12 ((char *)__get_free_pages(GFP_KERNEL, (order)))
-4
arch/x86/include/asm/agp.h
··· 22 22 */ 23 23 #define flush_agp_cache() wbinvd() 24 24 25 - /* Convert a physical address to an address suitable for the GART. */ 26 - #define phys_to_gart(x) (x) 27 - #define gart_to_phys(x) (x) 28 - 29 25 /* GATT allocation. Returns/accepts GATT kernel virtual address. */ 30 26 #define alloc_gatt_pages(order) \ 31 27 ((char *)__get_free_pages(GFP_KERNEL, (order)))
-3
drivers/char/agp/agp.h
··· 318 318 #define AGP_GENERIC_SIZES_ENTRIES 11 319 319 extern const struct aper_size_info_16 agp3_generic_sizes[]; 320 320 321 - #define virt_to_gart(x) (phys_to_gart(virt_to_phys(x))) 322 - #define gart_to_virt(x) (phys_to_virt(gart_to_phys(x))) 323 - 324 321 extern int agp_off; 325 322 extern int agp_try_unsupported_boot; 326 323
+2 -2
drivers/char/agp/ali-agp.c
··· 152 152 pci_read_config_dword(agp_bridge->dev, ALI_CACHE_FLUSH_CTRL, &temp); 153 153 pci_write_config_dword(agp_bridge->dev, ALI_CACHE_FLUSH_CTRL, 154 154 (((temp & ALI_CACHE_FLUSH_ADDR_MASK) | 155 - phys_to_gart(page_to_phys(page))) | ALI_CACHE_FLUSH_EN )); 155 + page_to_phys(page)) | ALI_CACHE_FLUSH_EN )); 156 156 return page; 157 157 } 158 158 ··· 180 180 pci_read_config_dword(agp_bridge->dev, ALI_CACHE_FLUSH_CTRL, &temp); 181 181 pci_write_config_dword(agp_bridge->dev, ALI_CACHE_FLUSH_CTRL, 182 182 (((temp & ALI_CACHE_FLUSH_ADDR_MASK) | 183 - phys_to_gart(page_to_phys(page))) | ALI_CACHE_FLUSH_EN)); 183 + page_to_phys(page)) | ALI_CACHE_FLUSH_EN)); 184 184 } 185 185 agp_generic_destroy_page(page, flags); 186 186 }
+4 -4
drivers/char/agp/amd-k7-agp.c
··· 44 44 #ifndef CONFIG_X86 45 45 SetPageReserved(virt_to_page(page_map->real)); 46 46 global_cache_flush(); 47 - page_map->remapped = ioremap_nocache(virt_to_gart(page_map->real), 47 + page_map->remapped = ioremap_nocache(virt_to_phys(page_map->real), 48 48 PAGE_SIZE); 49 49 if (page_map->remapped == NULL) { 50 50 ClearPageReserved(virt_to_page(page_map->real)); ··· 160 160 161 161 agp_bridge->gatt_table_real = (u32 *)page_dir.real; 162 162 agp_bridge->gatt_table = (u32 __iomem *)page_dir.remapped; 163 - agp_bridge->gatt_bus_addr = virt_to_gart(page_dir.real); 163 + agp_bridge->gatt_bus_addr = virt_to_phys(page_dir.real); 164 164 165 165 /* Get the address for the gart region. 166 166 * This is a bus address even on the alpha, b/c its ··· 173 173 174 174 /* Calculate the agp offset */ 175 175 for (i = 0; i < value->num_entries / 1024; i++, addr += 0x00400000) { 176 - writel(virt_to_gart(amd_irongate_private.gatt_pages[i]->real) | 1, 176 + writel(virt_to_phys(amd_irongate_private.gatt_pages[i]->real) | 1, 177 177 page_dir.remapped+GET_PAGE_DIR_OFF(addr)); 178 178 readl(page_dir.remapped+GET_PAGE_DIR_OFF(addr)); /* PCI Posting. */ 179 179 } ··· 325 325 addr = (j * PAGE_SIZE) + agp_bridge->gart_bus_addr; 326 326 cur_gatt = GET_GATT(addr); 327 327 writel(agp_generic_mask_memory(agp_bridge, 328 - phys_to_gart(page_to_phys(mem->pages[i])), 328 + page_to_phys(mem->pages[i]), 329 329 mem->type), 330 330 cur_gatt+GET_GATT_OFF(addr)); 331 331 readl(cur_gatt+GET_GATT_OFF(addr)); /* PCI Posting. */
+3 -3
drivers/char/agp/amd64-agp.c
··· 79 79 80 80 for (i = 0, j = pg_start; i < mem->page_count; i++, j++) { 81 81 tmp = agp_bridge->driver->mask_memory(agp_bridge, 82 - phys_to_gart(page_to_phys(mem->pages[i])), 82 + page_to_phys(mem->pages[i]), 83 83 mask_type); 84 84 85 85 BUG_ON(tmp & 0xffffff0000000ffcULL); ··· 178 178 179 179 static int amd_8151_configure(void) 180 180 { 181 - unsigned long gatt_bus = virt_to_gart(agp_bridge->gatt_table_real); 181 + unsigned long gatt_bus = virt_to_phys(agp_bridge->gatt_table_real); 182 182 int i; 183 183 184 184 /* Configure AGP regs in each x86-64 host bridge. */ ··· 558 558 { 559 559 struct agp_bridge_data *bridge = pci_get_drvdata(pdev); 560 560 561 - release_mem_region(virt_to_gart(bridge->gatt_table_real), 561 + release_mem_region(virt_to_phys(bridge->gatt_table_real), 562 562 amd64_aperture_sizes[bridge->aperture_size_idx].size); 563 563 agp_remove_bridge(bridge); 564 564 agp_put_bridge(bridge);
+3 -3
drivers/char/agp/ati-agp.c
··· 302 302 addr = (j * PAGE_SIZE) + agp_bridge->gart_bus_addr; 303 303 cur_gatt = GET_GATT(addr); 304 304 writel(agp_bridge->driver->mask_memory(agp_bridge, 305 - phys_to_gart(page_to_phys(mem->pages[i])), 305 + page_to_phys(mem->pages[i]), 306 306 mem->type), 307 307 cur_gatt+GET_GATT_OFF(addr)); 308 308 } ··· 360 360 361 361 agp_bridge->gatt_table_real = (u32 *)page_dir.real; 362 362 agp_bridge->gatt_table = (u32 __iomem *) page_dir.remapped; 363 - agp_bridge->gatt_bus_addr = virt_to_gart(page_dir.real); 363 + agp_bridge->gatt_bus_addr = virt_to_phys(page_dir.real); 364 364 365 365 /* Write out the size register */ 366 366 current_size = A_SIZE_LVL2(agp_bridge->current_size); ··· 390 390 391 391 /* Calculate the agp offset */ 392 392 for (i = 0; i < value->num_entries / 1024; i++, addr += 0x00400000) { 393 - writel(virt_to_gart(ati_generic_private.gatt_pages[i]->real) | 1, 393 + writel(virt_to_phys(ati_generic_private.gatt_pages[i]->real) | 1, 394 394 page_dir.remapped+GET_PAGE_DIR_OFF(addr)); 395 395 readl(page_dir.remapped+GET_PAGE_DIR_OFF(addr)); /* PCI Posting. */ 396 396 }
+1 -1
drivers/char/agp/backend.c
··· 159 159 goto err_out_nounmap; 160 160 } 161 161 } else { 162 - bridge->scratch_page_dma = phys_to_gart(page_to_phys(page)); 162 + bridge->scratch_page_dma = page_to_phys(page); 163 163 } 164 164 165 165 bridge->scratch_page = bridge->driver->mask_memory(bridge,
+2 -2
drivers/char/agp/efficeon-agp.c
··· 67 67 /* This function does the same thing as mask_memory() for this chipset... */ 68 68 static inline unsigned long efficeon_mask_memory(struct page *page) 69 69 { 70 - unsigned long addr = phys_to_gart(page_to_phys(page)); 70 + unsigned long addr = page_to_phys(page); 71 71 return addr | 0x00000001; 72 72 } 73 73 ··· 226 226 227 227 efficeon_private.l1_table[index] = page; 228 228 229 - value = virt_to_gart((unsigned long *)page) | pati | present | index; 229 + value = virt_to_phys((unsigned long *)page) | pati | present | index; 230 230 231 231 pci_write_config_dword(agp_bridge->dev, 232 232 EFFICEON_ATTPAGE, value);
+3 -3
drivers/char/agp/generic.c
··· 988 988 set_memory_uc((unsigned long)table, 1 << page_order); 989 989 bridge->gatt_table = (void *)table; 990 990 #else 991 - bridge->gatt_table = ioremap_nocache(virt_to_gart(table), 991 + bridge->gatt_table = ioremap_nocache(virt_to_phys(table), 992 992 (PAGE_SIZE * (1 << page_order))); 993 993 bridge->driver->cache_flush(); 994 994 #endif ··· 1001 1001 1002 1002 return -ENOMEM; 1003 1003 } 1004 - bridge->gatt_bus_addr = virt_to_gart(bridge->gatt_table_real); 1004 + bridge->gatt_bus_addr = virt_to_phys(bridge->gatt_table_real); 1005 1005 1006 1006 /* AK: bogus, should encode addresses > 4GB */ 1007 1007 for (i = 0; i < num_entries; i++) { ··· 1142 1142 1143 1143 for (i = 0, j = pg_start; i < mem->page_count; i++, j++) { 1144 1144 writel(bridge->driver->mask_memory(bridge, 1145 - phys_to_gart(page_to_phys(mem->pages[i])), 1145 + page_to_phys(mem->pages[i]), 1146 1146 mask_type), 1147 1147 bridge->gatt_table+j); 1148 1148 }
+2 -2
drivers/char/agp/hp-agp.c
··· 107 107 hp->gart_size = HP_ZX1_GART_SIZE; 108 108 hp->gatt_entries = hp->gart_size / hp->io_page_size; 109 109 110 - hp->io_pdir = gart_to_virt(readq(hp->ioc_regs+HP_ZX1_PDIR_BASE)); 110 + hp->io_pdir = phys_to_virt(readq(hp->ioc_regs+HP_ZX1_PDIR_BASE)); 111 111 hp->gatt = &hp->io_pdir[HP_ZX1_IOVA_TO_PDIR(hp->gart_base)]; 112 112 113 113 if (hp->gatt[0] != HP_ZX1_SBA_IOMMU_COOKIE) { ··· 246 246 agp_bridge->mode = readl(hp->lba_regs+hp->lba_cap_offset+PCI_AGP_STATUS); 247 247 248 248 if (hp->io_pdir_owner) { 249 - writel(virt_to_gart(hp->io_pdir), hp->ioc_regs+HP_ZX1_PDIR_BASE); 249 + writel(virt_to_phys(hp->io_pdir), hp->ioc_regs+HP_ZX1_PDIR_BASE); 250 250 readl(hp->ioc_regs+HP_ZX1_PDIR_BASE); 251 251 writel(hp->io_tlb_ps, hp->ioc_regs+HP_ZX1_TCNFG); 252 252 readl(hp->ioc_regs+HP_ZX1_TCNFG);
+2 -2
drivers/char/agp/i460-agp.c
··· 325 325 326 326 io_page_size = 1UL << I460_IO_PAGE_SHIFT; 327 327 for (i = 0, j = io_pg_start; i < mem->page_count; i++) { 328 - paddr = phys_to_gart(page_to_phys(mem->pages[i])); 328 + paddr = page_to_phys(mem->pages[i]); 329 329 for (k = 0; k < I460_IOPAGES_PER_KPAGE; k++, j++, paddr += io_page_size) 330 330 WR_GATT(j, i460_mask_memory(agp_bridge, paddr, mem->type)); 331 331 } ··· 382 382 return -ENOMEM; 383 383 } 384 384 385 - lp->paddr = phys_to_gart(page_to_phys(lp->page)); 385 + lp->paddr = page_to_phys(lp->page); 386 386 lp->refcount = 0; 387 387 atomic_add(I460_KPAGES_PER_IOPAGE, &agp_bridge->current_memory_agp); 388 388 return 0;
+3 -4
drivers/char/agp/intel-agp.c
··· 288 288 289 289 for (i = 0, j = pg_start; i < mem->page_count; i++, j++) { 290 290 writel(agp_bridge->driver->mask_memory(agp_bridge, 291 - phys_to_gart(page_to_phys(mem->pages[i])), mask_type), 291 + page_to_phys(mem->pages[i]), mask_type), 292 292 intel_private.gtt+j); 293 293 } 294 294 ··· 470 470 global_cache_flush(); 471 471 for (i = 0, j = pg_start; i < mem->page_count; i++, j++) { 472 472 writel(agp_bridge->driver->mask_memory(agp_bridge, 473 - phys_to_gart(page_to_phys(mem->pages[i])), 474 - mask_type), 473 + page_to_phys(mem->pages[i]), mask_type), 475 474 intel_private.registers+I810_PTE_BASE+(j*4)); 476 475 } 477 476 readl(intel_private.registers+I810_PTE_BASE+((j-1)*4)); ··· 976 977 977 978 for (i = 0, j = pg_start; i < mem->page_count; i++, j++) { 978 979 writel(agp_bridge->driver->mask_memory(agp_bridge, 979 - phys_to_gart(page_to_phys(mem->pages[i])), mask_type), 980 + page_to_phys(mem->pages[i]), mask_type), 980 981 intel_private.registers+I810_PTE_BASE+(j*4)); 981 982 } 982 983 readl(intel_private.registers+I810_PTE_BASE+((j-1)*4));
+1 -1
drivers/char/agp/nvidia-agp.c
··· 225 225 } 226 226 for (i = 0, j = pg_start; i < mem->page_count; i++, j++) { 227 227 writel(agp_bridge->driver->mask_memory(agp_bridge, 228 - phys_to_gart(page_to_phys(mem->pages[i])), mask_type), 228 + page_to_phys(mem->pages[i]), mask_type), 229 229 agp_bridge->gatt_table+nvidia_private.pg_offset+j); 230 230 } 231 231
+1 -1
drivers/char/agp/sgi-agp.c
··· 190 190 for (i = 0, j = pg_start; i < mem->page_count; i++, j++) { 191 191 table[j] = 192 192 bridge->driver->mask_memory(bridge, 193 - phys_to_gart(page_to_phys(mem->pages[i])), 193 + page_to_phys(mem->pages[i]), 194 194 mem->type); 195 195 } 196 196
+4 -4
drivers/char/agp/sworks-agp.c
··· 155 155 /* Create a fake scratch directory */ 156 156 for (i = 0; i < 1024; i++) { 157 157 writel(agp_bridge->scratch_page, serverworks_private.scratch_dir.remapped+i); 158 - writel(virt_to_gart(serverworks_private.scratch_dir.real) | 1, page_dir.remapped+i); 158 + writel(virt_to_phys(serverworks_private.scratch_dir.real) | 1, page_dir.remapped+i); 159 159 } 160 160 161 161 retval = serverworks_create_gatt_pages(value->num_entries / 1024); ··· 167 167 168 168 agp_bridge->gatt_table_real = (u32 *)page_dir.real; 169 169 agp_bridge->gatt_table = (u32 __iomem *)page_dir.remapped; 170 - agp_bridge->gatt_bus_addr = virt_to_gart(page_dir.real); 170 + agp_bridge->gatt_bus_addr = virt_to_phys(page_dir.real); 171 171 172 172 /* Get the address for the gart region. 173 173 * This is a bus address even on the alpha, b/c its ··· 179 179 180 180 /* Calculate the agp offset */ 181 181 for (i = 0; i < value->num_entries / 1024; i++) 182 - writel(virt_to_gart(serverworks_private.gatt_pages[i]->real)|1, page_dir.remapped+i); 182 + writel(virt_to_phys(serverworks_private.gatt_pages[i]->real)|1, page_dir.remapped+i); 183 183 184 184 return 0; 185 185 } ··· 350 350 addr = (j * PAGE_SIZE) + agp_bridge->gart_bus_addr; 351 351 cur_gatt = SVRWRKS_GET_GATT(addr); 352 352 writel(agp_bridge->driver->mask_memory(agp_bridge, 353 - phys_to_gart(page_to_phys(mem->pages[i])), mem->type), 353 + page_to_phys(mem->pages[i]), mem->type), 354 354 cur_gatt+GET_GATT_OFF(addr)); 355 355 } 356 356 serverworks_tlbflush(mem);
+1 -1
drivers/char/agp/uninorth-agp.c
··· 431 431 432 432 bridge->gatt_table_real = (u32 *) table; 433 433 bridge->gatt_table = (u32 *)table; 434 - bridge->gatt_bus_addr = virt_to_gart(table); 434 + bridge->gatt_bus_addr = virt_to_phys(table); 435 435 436 436 for (i = 0; i < num_entries; i++) 437 437 bridge->gatt_table[i] = 0;