aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/agp
diff options
context:
space:
mode:
authorDavid Woodhouse <David.Woodhouse@intel.com>2009-07-29 05:25:58 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2009-08-03 04:05:00 -0400
commit6a12235c7d2d75c7d94b9afcaaecd422ff845ce0 (patch)
tree416ec7de6c42fa5dd7885b53388a1bbee0b3aeed /drivers/char/agp
parentf692775d7e0a22477143cd884e45c955448ac7d2 (diff)
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>
Diffstat (limited to 'drivers/char/agp')
-rw-r--r--drivers/char/agp/agp.h3
-rw-r--r--drivers/char/agp/ali-agp.c4
-rw-r--r--drivers/char/agp/amd-k7-agp.c8
-rw-r--r--drivers/char/agp/amd64-agp.c6
-rw-r--r--drivers/char/agp/ati-agp.c6
-rw-r--r--drivers/char/agp/backend.c2
-rw-r--r--drivers/char/agp/efficeon-agp.c4
-rw-r--r--drivers/char/agp/generic.c6
-rw-r--r--drivers/char/agp/hp-agp.c4
-rw-r--r--drivers/char/agp/i460-agp.c4
-rw-r--r--drivers/char/agp/intel-agp.c7
-rw-r--r--drivers/char/agp/nvidia-agp.c2
-rw-r--r--drivers/char/agp/sgi-agp.c2
-rw-r--r--drivers/char/agp/sworks-agp.c8
-rw-r--r--drivers/char/agp/uninorth-agp.c2
15 files changed, 32 insertions, 36 deletions
diff --git a/drivers/char/agp/agp.h b/drivers/char/agp/agp.h
index 4c6e5079d870..d6f36c004d9b 100644
--- a/drivers/char/agp/agp.h
+++ b/drivers/char/agp/agp.h
@@ -318,9 +318,6 @@ void agp3_generic_cleanup(void);
318#define AGP_GENERIC_SIZES_ENTRIES 11 318#define AGP_GENERIC_SIZES_ENTRIES 11
319extern const struct aper_size_info_16 agp3_generic_sizes[]; 319extern 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
324extern int agp_off; 321extern int agp_off;
325extern int agp_try_unsupported_boot; 322extern int agp_try_unsupported_boot;
326 323
diff --git a/drivers/char/agp/ali-agp.c b/drivers/char/agp/ali-agp.c
index 201ef3ffd484..d2ce68f27e4b 100644
--- a/drivers/char/agp/ali-agp.c
+++ b/drivers/char/agp/ali-agp.c
@@ -152,7 +152,7 @@ static struct page *m1541_alloc_page(struct agp_bridge_data *bridge)
152 pci_read_config_dword(agp_bridge->dev, ALI_CACHE_FLUSH_CTRL, &temp); 152 pci_read_config_dword(agp_bridge->dev, ALI_CACHE_FLUSH_CTRL, &temp);
153 pci_write_config_dword(agp_bridge->dev, ALI_CACHE_FLUSH_CTRL, 153 pci_write_config_dword(agp_bridge->dev, ALI_CACHE_FLUSH_CTRL,
154 (((temp & ALI_CACHE_FLUSH_ADDR_MASK) | 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 return page; 156 return page;
157} 157}
158 158
@@ -180,7 +180,7 @@ static void m1541_destroy_page(struct page *page, int flags)
180 pci_read_config_dword(agp_bridge->dev, ALI_CACHE_FLUSH_CTRL, &temp); 180 pci_read_config_dword(agp_bridge->dev, ALI_CACHE_FLUSH_CTRL, &temp);
181 pci_write_config_dword(agp_bridge->dev, ALI_CACHE_FLUSH_CTRL, 181 pci_write_config_dword(agp_bridge->dev, ALI_CACHE_FLUSH_CTRL,
182 (((temp & ALI_CACHE_FLUSH_ADDR_MASK) | 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 agp_generic_destroy_page(page, flags); 185 agp_generic_destroy_page(page, flags);
186} 186}
diff --git a/drivers/char/agp/amd-k7-agp.c b/drivers/char/agp/amd-k7-agp.c
index 542a87895ae9..73dbf40c874d 100644
--- a/drivers/char/agp/amd-k7-agp.c
+++ b/drivers/char/agp/amd-k7-agp.c
@@ -44,7 +44,7 @@ static int amd_create_page_map(struct amd_page_map *page_map)
44#ifndef CONFIG_X86 44#ifndef CONFIG_X86
45 SetPageReserved(virt_to_page(page_map->real)); 45 SetPageReserved(virt_to_page(page_map->real));
46 global_cache_flush(); 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 PAGE_SIZE); 48 PAGE_SIZE);
49 if (page_map->remapped == NULL) { 49 if (page_map->remapped == NULL) {
50 ClearPageReserved(virt_to_page(page_map->real)); 50 ClearPageReserved(virt_to_page(page_map->real));
@@ -160,7 +160,7 @@ static int amd_create_gatt_table(struct agp_bridge_data *bridge)
160 160
161 agp_bridge->gatt_table_real = (u32 *)page_dir.real; 161 agp_bridge->gatt_table_real = (u32 *)page_dir.real;
162 agp_bridge->gatt_table = (u32 __iomem *)page_dir.remapped; 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 /* Get the address for the gart region. 165 /* Get the address for the gart region.
166 * This is a bus address even on the alpha, b/c its 166 * This is a bus address even on the alpha, b/c its
@@ -173,7 +173,7 @@ static int amd_create_gatt_table(struct agp_bridge_data *bridge)
173 173
174 /* Calculate the agp offset */ 174 /* Calculate the agp offset */
175 for (i = 0; i < value->num_entries / 1024; i++, addr += 0x00400000) { 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 page_dir.remapped+GET_PAGE_DIR_OFF(addr)); 177 page_dir.remapped+GET_PAGE_DIR_OFF(addr));
178 readl(page_dir.remapped+GET_PAGE_DIR_OFF(addr)); /* PCI Posting. */ 178 readl(page_dir.remapped+GET_PAGE_DIR_OFF(addr)); /* PCI Posting. */
179 } 179 }
@@ -325,7 +325,7 @@ static int amd_insert_memory(struct agp_memory *mem, off_t pg_start, int type)
325 addr = (j * PAGE_SIZE) + agp_bridge->gart_bus_addr; 325 addr = (j * PAGE_SIZE) + agp_bridge->gart_bus_addr;
326 cur_gatt = GET_GATT(addr); 326 cur_gatt = GET_GATT(addr);
327 writel(agp_generic_mask_memory(agp_bridge, 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 mem->type), 329 mem->type),
330 cur_gatt+GET_GATT_OFF(addr)); 330 cur_gatt+GET_GATT_OFF(addr));
331 readl(cur_gatt+GET_GATT_OFF(addr)); /* PCI Posting. */ 331 readl(cur_gatt+GET_GATT_OFF(addr)); /* PCI Posting. */
diff --git a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c
index e85a5b3e952e..2fb2e6cc322a 100644
--- a/drivers/char/agp/amd64-agp.c
+++ b/drivers/char/agp/amd64-agp.c
@@ -79,7 +79,7 @@ static int amd64_insert_memory(struct agp_memory *mem, off_t pg_start, int type)
79 79
80 for (i = 0, j = pg_start; i < mem->page_count; i++, j++) { 80 for (i = 0, j = pg_start; i < mem->page_count; i++, j++) {
81 tmp = agp_bridge->driver->mask_memory(agp_bridge, 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 mask_type); 83 mask_type);
84 84
85 BUG_ON(tmp & 0xffffff0000000ffcULL); 85 BUG_ON(tmp & 0xffffff0000000ffcULL);
@@ -178,7 +178,7 @@ static const struct aper_size_info_32 amd_8151_sizes[7] =
178 178
179static int amd_8151_configure(void) 179static 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 int i; 182 int i;
183 183
184 /* Configure AGP regs in each x86-64 host bridge. */ 184 /* Configure AGP regs in each x86-64 host bridge. */
@@ -558,7 +558,7 @@ static void __devexit agp_amd64_remove(struct pci_dev *pdev)
558{ 558{
559 struct agp_bridge_data *bridge = pci_get_drvdata(pdev); 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 amd64_aperture_sizes[bridge->aperture_size_idx].size); 562 amd64_aperture_sizes[bridge->aperture_size_idx].size);
563 agp_remove_bridge(bridge); 563 agp_remove_bridge(bridge);
564 agp_put_bridge(bridge); 564 agp_put_bridge(bridge);
diff --git a/drivers/char/agp/ati-agp.c b/drivers/char/agp/ati-agp.c
index 59ebd60c1b60..3b2ecbe86ebe 100644
--- a/drivers/char/agp/ati-agp.c
+++ b/drivers/char/agp/ati-agp.c
@@ -302,7 +302,7 @@ static int ati_insert_memory(struct agp_memory * mem,
302 addr = (j * PAGE_SIZE) + agp_bridge->gart_bus_addr; 302 addr = (j * PAGE_SIZE) + agp_bridge->gart_bus_addr;
303 cur_gatt = GET_GATT(addr); 303 cur_gatt = GET_GATT(addr);
304 writel(agp_bridge->driver->mask_memory(agp_bridge, 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 mem->type), 306 mem->type),
307 cur_gatt+GET_GATT_OFF(addr)); 307 cur_gatt+GET_GATT_OFF(addr));
308 } 308 }
@@ -360,7 +360,7 @@ static int ati_create_gatt_table(struct agp_bridge_data *bridge)
360 360
361 agp_bridge->gatt_table_real = (u32 *)page_dir.real; 361 agp_bridge->gatt_table_real = (u32 *)page_dir.real;
362 agp_bridge->gatt_table = (u32 __iomem *) page_dir.remapped; 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 /* Write out the size register */ 365 /* Write out the size register */
366 current_size = A_SIZE_LVL2(agp_bridge->current_size); 366 current_size = A_SIZE_LVL2(agp_bridge->current_size);
@@ -390,7 +390,7 @@ static int ati_create_gatt_table(struct agp_bridge_data *bridge)
390 390
391 /* Calculate the agp offset */ 391 /* Calculate the agp offset */
392 for (i = 0; i < value->num_entries / 1024; i++, addr += 0x00400000) { 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 page_dir.remapped+GET_PAGE_DIR_OFF(addr)); 394 page_dir.remapped+GET_PAGE_DIR_OFF(addr));
395 readl(page_dir.remapped+GET_PAGE_DIR_OFF(addr)); /* PCI Posting. */ 395 readl(page_dir.remapped+GET_PAGE_DIR_OFF(addr)); /* PCI Posting. */
396 } 396 }
diff --git a/drivers/char/agp/backend.c b/drivers/char/agp/backend.c
index 343f102090a0..ad87753f6de4 100644
--- a/drivers/char/agp/backend.c
+++ b/drivers/char/agp/backend.c
@@ -159,7 +159,7 @@ static int agp_backend_initialize(struct agp_bridge_data *bridge)
159 goto err_out_nounmap; 159 goto err_out_nounmap;
160 } 160 }
161 } else { 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 bridge->scratch_page = bridge->driver->mask_memory(bridge, 165 bridge->scratch_page = bridge->driver->mask_memory(bridge,
diff --git a/drivers/char/agp/efficeon-agp.c b/drivers/char/agp/efficeon-agp.c
index 35d50f2861b6..793f39ea9618 100644
--- a/drivers/char/agp/efficeon-agp.c
+++ b/drivers/char/agp/efficeon-agp.c
@@ -67,7 +67,7 @@ static const struct gatt_mask efficeon_generic_masks[] =
67/* This function does the same thing as mask_memory() for this chipset... */ 67/* This function does the same thing as mask_memory() for this chipset... */
68static inline unsigned long efficeon_mask_memory(struct page *page) 68static 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 return addr | 0x00000001; 71 return addr | 0x00000001;
72} 72}
73 73
@@ -226,7 +226,7 @@ static int efficeon_create_gatt_table(struct agp_bridge_data *bridge)
226 226
227 efficeon_private.l1_table[index] = page; 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 pci_write_config_dword(agp_bridge->dev, 231 pci_write_config_dword(agp_bridge->dev,
232 EFFICEON_ATTPAGE, value); 232 EFFICEON_ATTPAGE, value);
diff --git a/drivers/char/agp/generic.c b/drivers/char/agp/generic.c
index 28f0208c66a6..c50543966eb2 100644
--- a/drivers/char/agp/generic.c
+++ b/drivers/char/agp/generic.c
@@ -988,7 +988,7 @@ int agp_generic_create_gatt_table(struct agp_bridge_data *bridge)
988 set_memory_uc((unsigned long)table, 1 << page_order); 988 set_memory_uc((unsigned long)table, 1 << page_order);
989 bridge->gatt_table = (void *)table; 989 bridge->gatt_table = (void *)table;
990#else 990#else
991 bridge->gatt_table = ioremap_nocache(virt_to_gart(table), 991 bridge->gatt_table = ioremap_nocache(virt_to_phys(table),
992 (PAGE_SIZE * (1 << page_order))); 992 (PAGE_SIZE * (1 << page_order)));
993 bridge->driver->cache_flush(); 993 bridge->driver->cache_flush();
994#endif 994#endif
@@ -1001,7 +1001,7 @@ int agp_generic_create_gatt_table(struct agp_bridge_data *bridge)
1001 1001
1002 return -ENOMEM; 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 /* AK: bogus, should encode addresses > 4GB */ 1006 /* AK: bogus, should encode addresses > 4GB */
1007 for (i = 0; i < num_entries; i++) { 1007 for (i = 0; i < num_entries; i++) {
@@ -1142,7 +1142,7 @@ int agp_generic_insert_memory(struct agp_memory * mem, off_t pg_start, int type)
1142 1142
1143 for (i = 0, j = pg_start; i < mem->page_count; i++, j++) { 1143 for (i = 0, j = pg_start; i < mem->page_count; i++, j++) {
1144 writel(bridge->driver->mask_memory(bridge, 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 mask_type), 1146 mask_type),
1147 bridge->gatt_table+j); 1147 bridge->gatt_table+j);
1148 } 1148 }
diff --git a/drivers/char/agp/hp-agp.c b/drivers/char/agp/hp-agp.c
index 64dbf4b1cf2f..501e293e5ad0 100644
--- a/drivers/char/agp/hp-agp.c
+++ b/drivers/char/agp/hp-agp.c
@@ -107,7 +107,7 @@ static int __init hp_zx1_ioc_shared(void)
107 hp->gart_size = HP_ZX1_GART_SIZE; 107 hp->gart_size = HP_ZX1_GART_SIZE;
108 hp->gatt_entries = hp->gart_size / hp->io_page_size; 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 hp->gatt = &hp->io_pdir[HP_ZX1_IOVA_TO_PDIR(hp->gart_base)]; 111 hp->gatt = &hp->io_pdir[HP_ZX1_IOVA_TO_PDIR(hp->gart_base)];
112 112
113 if (hp->gatt[0] != HP_ZX1_SBA_IOMMU_COOKIE) { 113 if (hp->gatt[0] != HP_ZX1_SBA_IOMMU_COOKIE) {
@@ -246,7 +246,7 @@ hp_zx1_configure (void)
246 agp_bridge->mode = readl(hp->lba_regs+hp->lba_cap_offset+PCI_AGP_STATUS); 246 agp_bridge->mode = readl(hp->lba_regs+hp->lba_cap_offset+PCI_AGP_STATUS);
247 247
248 if (hp->io_pdir_owner) { 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 readl(hp->ioc_regs+HP_ZX1_PDIR_BASE); 250 readl(hp->ioc_regs+HP_ZX1_PDIR_BASE);
251 writel(hp->io_tlb_ps, hp->ioc_regs+HP_ZX1_TCNFG); 251 writel(hp->io_tlb_ps, hp->ioc_regs+HP_ZX1_TCNFG);
252 readl(hp->ioc_regs+HP_ZX1_TCNFG); 252 readl(hp->ioc_regs+HP_ZX1_TCNFG);
diff --git a/drivers/char/agp/i460-agp.c b/drivers/char/agp/i460-agp.c
index 54191f860539..e763d3312ce7 100644
--- a/drivers/char/agp/i460-agp.c
+++ b/drivers/char/agp/i460-agp.c
@@ -325,7 +325,7 @@ static int i460_insert_memory_small_io_page (struct agp_memory *mem,
325 325
326 io_page_size = 1UL << I460_IO_PAGE_SHIFT; 326 io_page_size = 1UL << I460_IO_PAGE_SHIFT;
327 for (i = 0, j = io_pg_start; i < mem->page_count; i++) { 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 for (k = 0; k < I460_IOPAGES_PER_KPAGE; k++, j++, paddr += io_page_size) 329 for (k = 0; k < I460_IOPAGES_PER_KPAGE; k++, j++, paddr += io_page_size)
330 WR_GATT(j, i460_mask_memory(agp_bridge, paddr, mem->type)); 330 WR_GATT(j, i460_mask_memory(agp_bridge, paddr, mem->type));
331 } 331 }
@@ -382,7 +382,7 @@ static int i460_alloc_large_page (struct lp_desc *lp)
382 return -ENOMEM; 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 lp->refcount = 0; 386 lp->refcount = 0;
387 atomic_add(I460_KPAGES_PER_IOPAGE, &agp_bridge->current_memory_agp); 387 atomic_add(I460_KPAGES_PER_IOPAGE, &agp_bridge->current_memory_agp);
388 return 0; 388 return 0;
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c
index d8c80d8be5e2..aa8889e8afc8 100644
--- a/drivers/char/agp/intel-agp.c
+++ b/drivers/char/agp/intel-agp.c
@@ -288,7 +288,7 @@ static void intel_agp_insert_sg_entries(struct agp_memory *mem,
288 288
289 for (i = 0, j = pg_start; i < mem->page_count; i++, j++) { 289 for (i = 0, j = pg_start; i < mem->page_count; i++, j++) {
290 writel(agp_bridge->driver->mask_memory(agp_bridge, 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 intel_private.gtt+j); 292 intel_private.gtt+j);
293 } 293 }
294 294
@@ -470,8 +470,7 @@ static int intel_i810_insert_entries(struct agp_memory *mem, off_t pg_start,
470 global_cache_flush(); 470 global_cache_flush();
471 for (i = 0, j = pg_start; i < mem->page_count; i++, j++) { 471 for (i = 0, j = pg_start; i < mem->page_count; i++, j++) {
472 writel(agp_bridge->driver->mask_memory(agp_bridge, 472 writel(agp_bridge->driver->mask_memory(agp_bridge,
473 phys_to_gart(page_to_phys(mem->pages[i])), 473 page_to_phys(mem->pages[i]), mask_type),
474 mask_type),
475 intel_private.registers+I810_PTE_BASE+(j*4)); 474 intel_private.registers+I810_PTE_BASE+(j*4));
476 } 475 }
477 readl(intel_private.registers+I810_PTE_BASE+((j-1)*4)); 476 readl(intel_private.registers+I810_PTE_BASE+((j-1)*4));
@@ -977,7 +976,7 @@ static int intel_i830_insert_entries(struct agp_memory *mem, off_t pg_start,
977 976
978 for (i = 0, j = pg_start; i < mem->page_count; i++, j++) { 977 for (i = 0, j = pg_start; i < mem->page_count; i++, j++) {
979 writel(agp_bridge->driver->mask_memory(agp_bridge, 978 writel(agp_bridge->driver->mask_memory(agp_bridge,
980 phys_to_gart(page_to_phys(mem->pages[i])), mask_type), 979 page_to_phys(mem->pages[i]), mask_type),
981 intel_private.registers+I810_PTE_BASE+(j*4)); 980 intel_private.registers+I810_PTE_BASE+(j*4));
982 } 981 }
983 readl(intel_private.registers+I810_PTE_BASE+((j-1)*4)); 982 readl(intel_private.registers+I810_PTE_BASE+((j-1)*4));
diff --git a/drivers/char/agp/nvidia-agp.c b/drivers/char/agp/nvidia-agp.c
index cedacee30ec3..7e36d2b4f9d4 100644
--- a/drivers/char/agp/nvidia-agp.c
+++ b/drivers/char/agp/nvidia-agp.c
@@ -225,7 +225,7 @@ static int nvidia_insert_memory(struct agp_memory *mem, off_t pg_start, int type
225 } 225 }
226 for (i = 0, j = pg_start; i < mem->page_count; i++, j++) { 226 for (i = 0, j = pg_start; i < mem->page_count; i++, j++) {
227 writel(agp_bridge->driver->mask_memory(agp_bridge, 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 agp_bridge->gatt_table+nvidia_private.pg_offset+j); 229 agp_bridge->gatt_table+nvidia_private.pg_offset+j);
230 } 230 }
231 231
diff --git a/drivers/char/agp/sgi-agp.c b/drivers/char/agp/sgi-agp.c
index 0d47fa847404..0d426ae39c85 100644
--- a/drivers/char/agp/sgi-agp.c
+++ b/drivers/char/agp/sgi-agp.c
@@ -190,7 +190,7 @@ static int sgi_tioca_insert_memory(struct agp_memory *mem, off_t pg_start,
190 for (i = 0, j = pg_start; i < mem->page_count; i++, j++) { 190 for (i = 0, j = pg_start; i < mem->page_count; i++, j++) {
191 table[j] = 191 table[j] =
192 bridge->driver->mask_memory(bridge, 192 bridge->driver->mask_memory(bridge,
193 phys_to_gart(page_to_phys(mem->pages[i])), 193 page_to_phys(mem->pages[i]),
194 mem->type); 194 mem->type);
195 } 195 }
196 196
diff --git a/drivers/char/agp/sworks-agp.c b/drivers/char/agp/sworks-agp.c
index 07259952fc32..13acaaf64edb 100644
--- a/drivers/char/agp/sworks-agp.c
+++ b/drivers/char/agp/sworks-agp.c
@@ -155,7 +155,7 @@ static int serverworks_create_gatt_table(struct agp_bridge_data *bridge)
155 /* Create a fake scratch directory */ 155 /* Create a fake scratch directory */
156 for (i = 0; i < 1024; i++) { 156 for (i = 0; i < 1024; i++) {
157 writel(agp_bridge->scratch_page, serverworks_private.scratch_dir.remapped+i); 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 retval = serverworks_create_gatt_pages(value->num_entries / 1024); 161 retval = serverworks_create_gatt_pages(value->num_entries / 1024);
@@ -167,7 +167,7 @@ static int serverworks_create_gatt_table(struct agp_bridge_data *bridge)
167 167
168 agp_bridge->gatt_table_real = (u32 *)page_dir.real; 168 agp_bridge->gatt_table_real = (u32 *)page_dir.real;
169 agp_bridge->gatt_table = (u32 __iomem *)page_dir.remapped; 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 /* Get the address for the gart region. 172 /* Get the address for the gart region.
173 * This is a bus address even on the alpha, b/c its 173 * This is a bus address even on the alpha, b/c its
@@ -179,7 +179,7 @@ static int serverworks_create_gatt_table(struct agp_bridge_data *bridge)
179 179
180 /* Calculate the agp offset */ 180 /* Calculate the agp offset */
181 for (i = 0; i < value->num_entries / 1024; i++) 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 return 0; 184 return 0;
185} 185}
@@ -350,7 +350,7 @@ static int serverworks_insert_memory(struct agp_memory *mem,
350 addr = (j * PAGE_SIZE) + agp_bridge->gart_bus_addr; 350 addr = (j * PAGE_SIZE) + agp_bridge->gart_bus_addr;
351 cur_gatt = SVRWRKS_GET_GATT(addr); 351 cur_gatt = SVRWRKS_GET_GATT(addr);
352 writel(agp_bridge->driver->mask_memory(agp_bridge, 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 cur_gatt+GET_GATT_OFF(addr)); 354 cur_gatt+GET_GATT_OFF(addr));
355 } 355 }
356 serverworks_tlbflush(mem); 356 serverworks_tlbflush(mem);
diff --git a/drivers/char/agp/uninorth-agp.c b/drivers/char/agp/uninorth-agp.c
index f192c3b9ad41..2e993112ab88 100644
--- a/drivers/char/agp/uninorth-agp.c
+++ b/drivers/char/agp/uninorth-agp.c
@@ -431,7 +431,7 @@ static int uninorth_create_gatt_table(struct agp_bridge_data *bridge)
431 431
432 bridge->gatt_table_real = (u32 *) table; 432 bridge->gatt_table_real = (u32 *) table;
433 bridge->gatt_table = (u32 *)table; 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 for (i = 0; i < num_entries; i++) 436 for (i = 0; i < num_entries; i++)
437 bridge->gatt_table[i] = 0; 437 bridge->gatt_table[i] = 0;