ia64/xen-unstable

changeset 3862:cb47fd96099e

bitkeeper revision 1.1224 (4215f001YcEPrr6IeqP8EV-aRe7dMw)

agpgart.patch:
mvdir
author kaf24@scramble.cl.cam.ac.uk
date Fri Feb 18 13:39:13 2005 +0000 (2005-02-18)
parents f25349622916
children f6e13cb6944f
files .rootkeys patches/linux-2.6.10/agpgart.patch patches/linux-2.6.9/agpgart.patch
line diff
     1.1 --- a/.rootkeys	Fri Feb 18 13:34:28 2005 +0000
     1.2 +++ b/.rootkeys	Fri Feb 18 13:39:13 2005 +0000
     1.3 @@ -314,7 +314,7 @@ 413cb3b5rIKB3TbyhK3pbNyVkYysqA netbsd-2.
     1.4  413cb3b5eKxnzoodEqaWn2wrPnHWnA netbsd-2.0-xen-sparse/sys/arch/xen/xen/xencons.c
     1.5  413cb3b5F56TvQWAmO5TsuzhtzLFPQ netbsd-2.0-xen-sparse/sys/arch/xen/xen/xenkbc.c
     1.6  413cb3b53nyOv1OIeDSsCXhBFDXvJA netbsd-2.0-xen-sparse/sys/nfs/files.nfs
     1.7 -413aa1d0oNP8HXLvfPuMe6cSroUfSA patches/linux-2.6.9/agpgart.patch
     1.8 +413aa1d0oNP8HXLvfPuMe6cSroUfSA patches/linux-2.6.10/agpgart.patch
     1.9  3f776bd1Hy9rn69ntXBhPReUFw9IEA tools/Makefile
    1.10  40e1b09db5mN69Ijj0X_Eol-S7dXiw tools/Rules.mk
    1.11  4209033eUwhDBJ_bxejiv5c6gjXS4A tools/blktap/Makefile
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/patches/linux-2.6.10/agpgart.patch	Fri Feb 18 13:39:13 2005 +0000
     2.3 @@ -0,0 +1,371 @@
     2.4 +diff -ur linux-2.6.9/drivers/char/agp/ali-agp.c linux-2.6.9-new/drivers/char/agp/ali-agp.c
     2.5 +--- linux-2.6.9/drivers/char/agp/ali-agp.c	2004-10-18 22:54:38.000000000 +0100
     2.6 ++++ linux-2.6.9-new/drivers/char/agp/ali-agp.c	2004-11-28 19:32:03.000000000 +0000
     2.7 +@@ -150,7 +150,7 @@
     2.8 + 	pci_read_config_dword(agp_bridge->dev, ALI_CACHE_FLUSH_CTRL, &temp);
     2.9 + 	pci_write_config_dword(agp_bridge->dev, ALI_CACHE_FLUSH_CTRL,
    2.10 + 			(((temp & ALI_CACHE_FLUSH_ADDR_MASK) |
    2.11 +-			  virt_to_phys(addr)) | ALI_CACHE_FLUSH_EN ));
    2.12 ++			  virt_to_bus(addr)) | ALI_CACHE_FLUSH_EN ));
    2.13 + 	return addr;
    2.14 + }
    2.15 + 
    2.16 +@@ -174,7 +174,7 @@
    2.17 + 	pci_read_config_dword(agp_bridge->dev, ALI_CACHE_FLUSH_CTRL, &temp);
    2.18 + 	pci_write_config_dword(agp_bridge->dev, ALI_CACHE_FLUSH_CTRL,
    2.19 + 			(((temp & ALI_CACHE_FLUSH_ADDR_MASK) |
    2.20 +-			  virt_to_phys(addr)) | ALI_CACHE_FLUSH_EN));
    2.21 ++			  virt_to_bus(addr)) | ALI_CACHE_FLUSH_EN));
    2.22 + 	agp_generic_destroy_page(addr);
    2.23 + }
    2.24 + 
    2.25 +diff -ur linux-2.6.9/drivers/char/agp/amd-k7-agp.c linux-2.6.9-new/drivers/char/agp/amd-k7-agp.c
    2.26 +--- linux-2.6.9/drivers/char/agp/amd-k7-agp.c	2004-10-18 22:55:36.000000000 +0100
    2.27 ++++ linux-2.6.9-new/drivers/char/agp/amd-k7-agp.c	2004-11-28 19:36:39.000000000 +0000
    2.28 +@@ -43,7 +43,7 @@
    2.29 + 
    2.30 + 	SetPageReserved(virt_to_page(page_map->real));
    2.31 + 	global_cache_flush();
    2.32 +-	page_map->remapped = ioremap_nocache(virt_to_phys(page_map->real),
    2.33 ++	page_map->remapped = ioremap_nocache(virt_to_bus(page_map->real),
    2.34 + 					    PAGE_SIZE);
    2.35 + 	if (page_map->remapped == NULL) {
    2.36 + 		ClearPageReserved(virt_to_page(page_map->real));
    2.37 +@@ -152,7 +152,7 @@
    2.38 + 
    2.39 + 	agp_bridge->gatt_table_real = (u32 *)page_dir.real;
    2.40 + 	agp_bridge->gatt_table = (u32 __iomem *)page_dir.remapped;
    2.41 +-	agp_bridge->gatt_bus_addr = virt_to_phys(page_dir.real);
    2.42 ++	agp_bridge->gatt_bus_addr = virt_to_bus(page_dir.real);
    2.43 + 
    2.44 + 	/* Get the address for the gart region.
    2.45 + 	 * This is a bus address even on the alpha, b/c its
    2.46 +@@ -165,7 +165,7 @@
    2.47 + 
    2.48 + 	/* Calculate the agp offset */
    2.49 + 	for (i = 0; i < value->num_entries / 1024; i++, addr += 0x00400000) {
    2.50 +-		writel(virt_to_phys(amd_irongate_private.gatt_pages[i]->real) | 1,
    2.51 ++		writel(virt_to_bus(amd_irongate_private.gatt_pages[i]->real) | 1,
    2.52 + 			page_dir.remapped+GET_PAGE_DIR_OFF(addr));
    2.53 + 	}
    2.54 + 
    2.55 +diff -ur linux-2.6.9/drivers/char/agp/amd64-agp.c linux-2.6.9-new/drivers/char/agp/amd64-agp.c
    2.56 +--- linux-2.6.9/drivers/char/agp/amd64-agp.c	2004-10-18 22:54:38.000000000 +0100
    2.57 ++++ linux-2.6.9-new/drivers/char/agp/amd64-agp.c	2004-11-28 19:32:03.000000000 +0000
    2.58 +@@ -212,7 +212,7 @@
    2.59 + 
    2.60 + static int amd_8151_configure(void)
    2.61 + {
    2.62 +-	unsigned long gatt_bus = virt_to_phys(agp_bridge->gatt_table_real);
    2.63 ++	unsigned long gatt_bus = virt_to_bus(agp_bridge->gatt_table_real);
    2.64 + 
    2.65 + 	/* Configure AGP regs in each x86-64 host bridge. */
    2.66 + 	for_each_nb() {
    2.67 +@@ -521,7 +521,7 @@
    2.68 + {
    2.69 + 	struct agp_bridge_data *bridge = pci_get_drvdata(pdev);
    2.70 + 
    2.71 +-	release_mem_region(virt_to_phys(bridge->gatt_table_real),
    2.72 ++	release_mem_region(virt_to_bus(bridge->gatt_table_real),
    2.73 + 			   amd64_aperture_sizes[bridge->aperture_size_idx].size);
    2.74 + 	agp_remove_bridge(bridge);
    2.75 + 	agp_put_bridge(bridge);
    2.76 +diff -ur linux-2.6.9/drivers/char/agp/ati-agp.c linux-2.6.9-new/drivers/char/agp/ati-agp.c
    2.77 +--- linux-2.6.9/drivers/char/agp/ati-agp.c	2004-10-18 22:54:40.000000000 +0100
    2.78 ++++ linux-2.6.9-new/drivers/char/agp/ati-agp.c	2004-11-28 19:32:03.000000000 +0000
    2.79 +@@ -64,7 +64,7 @@
    2.80 + 
    2.81 + 	/* CACHE_FLUSH(); */
    2.82 + 	global_cache_flush();
    2.83 +-	page_map->remapped = ioremap_nocache(virt_to_phys(page_map->real),
    2.84 ++	page_map->remapped = ioremap_nocache(virt_to_bus(page_map->real),
    2.85 + 					    PAGE_SIZE);
    2.86 + 	if (page_map->remapped == NULL || err) {
    2.87 + 		ClearPageReserved(virt_to_page(page_map->real));
    2.88 +diff -ur linux-2.6.9/drivers/char/agp/backend.c linux-2.6.9-new/drivers/char/agp/backend.c
    2.89 +--- linux-2.6.9/drivers/char/agp/backend.c	2004-10-18 22:54:39.000000000 +0100
    2.90 ++++ linux-2.6.9-new/drivers/char/agp/backend.c	2004-11-28 19:32:03.000000000 +0000
    2.91 +@@ -142,7 +142,7 @@
    2.92 + 			return -ENOMEM;
    2.93 + 		}
    2.94 + 
    2.95 +-		bridge->scratch_page_real = virt_to_phys(addr);
    2.96 ++		bridge->scratch_page_real = virt_to_bus(addr);
    2.97 + 		bridge->scratch_page =
    2.98 + 		    bridge->driver->mask_memory(bridge->scratch_page_real, 0);
    2.99 + 	}
   2.100 +@@ -186,7 +186,7 @@
   2.101 + err_out:
   2.102 + 	if (bridge->driver->needs_scratch_page)
   2.103 + 		bridge->driver->agp_destroy_page(
   2.104 +-				phys_to_virt(bridge->scratch_page_real));
   2.105 ++				bus_to_virt(bridge->scratch_page_real));
   2.106 + 	if (got_gatt)
   2.107 + 		bridge->driver->free_gatt_table();
   2.108 + 	if (got_keylist) {
   2.109 +@@ -211,7 +211,7 @@
   2.110 + 	if (bridge->driver->agp_destroy_page &&
   2.111 + 	    bridge->driver->needs_scratch_page)
   2.112 + 		bridge->driver->agp_destroy_page(
   2.113 +-				phys_to_virt(bridge->scratch_page_real));
   2.114 ++				bus_to_virt(bridge->scratch_page_real));
   2.115 + }
   2.116 + 
   2.117 + static const drm_agp_t drm_agp = {
   2.118 +diff -ur linux-2.6.9/drivers/char/agp/efficeon-agp.c linux-2.6.9-new/drivers/char/agp/efficeon-agp.c
   2.119 +--- linux-2.6.9/drivers/char/agp/efficeon-agp.c	2004-10-18 22:53:06.000000000 +0100
   2.120 ++++ linux-2.6.9-new/drivers/char/agp/efficeon-agp.c	2004-11-28 19:38:28.000000000 +0000
   2.121 +@@ -219,7 +219,7 @@
   2.122 + 
   2.123 + 		efficeon_private.l1_table[index] = page;
   2.124 + 
   2.125 +-		value = __pa(page) | pati | present | index;
   2.126 ++		value = virt_to_bus(page) | pati | present | index;
   2.127 + 
   2.128 + 		pci_write_config_dword(agp_bridge->dev,
   2.129 + 			EFFICEON_ATTPAGE, value);
   2.130 +diff -ur linux-2.6.9/drivers/char/agp/generic.c linux-2.6.9-new/drivers/char/agp/generic.c
   2.131 +--- linux-2.6.9/drivers/char/agp/generic.c	2004-10-18 22:53:50.000000000 +0100
   2.132 ++++ linux-2.6.9-new/drivers/char/agp/generic.c	2004-11-28 19:32:03.000000000 +0000
   2.133 +@@ -128,7 +128,7 @@
   2.134 + 	}
   2.135 + 	if (curr->page_count != 0) {
   2.136 + 		for (i = 0; i < curr->page_count; i++) {
   2.137 +-			agp_bridge->driver->agp_destroy_page(phys_to_virt(curr->memory[i]));
   2.138 ++			agp_bridge->driver->agp_destroy_page(bus_to_virt(curr->memory[i]));
   2.139 + 		}
   2.140 + 	}
   2.141 + 	agp_free_key(curr->key);
   2.142 +@@ -182,7 +182,7 @@
   2.143 + 			return NULL;
   2.144 + 		}
   2.145 + 		new->memory[i] =
   2.146 +-			agp_bridge->driver->mask_memory(virt_to_phys(addr), type);
   2.147 ++			agp_bridge->driver->mask_memory(virt_to_bus(addr), type);
   2.148 + 		new->page_count++;
   2.149 + 	}
   2.150 + 
   2.151 +@@ -637,6 +637,7 @@
   2.152 + 	int i;
   2.153 + 	void *temp;
   2.154 + 	struct page *page;
   2.155 ++	dma_addr_t dma;
   2.156 + 
   2.157 + 	/* The generic routines can't handle 2 level gatt's */
   2.158 + 	if (agp_bridge->driver->size_type == LVL2_APER_SIZE)
   2.159 +@@ -675,8 +676,10 @@
   2.160 + 				break;
   2.161 + 			}
   2.162 + 
   2.163 +-			table = (char *) __get_free_pages(GFP_KERNEL,
   2.164 +-							  page_order);
   2.165 ++			table = dma_alloc_coherent(
   2.166 ++					&agp_bridge->dev->dev,
   2.167 ++					PAGE_SIZE << page_order, &dma,
   2.168 ++					GFP_KERNEL);
   2.169 + 
   2.170 + 			if (table == NULL) {
   2.171 + 				i++;
   2.172 +@@ -707,7 +710,9 @@
   2.173 + 		size = ((struct aper_size_info_fixed *) temp)->size;
   2.174 + 		page_order = ((struct aper_size_info_fixed *) temp)->page_order;
   2.175 + 		num_entries = ((struct aper_size_info_fixed *) temp)->num_entries;
   2.176 +-		table = (char *) __get_free_pages(GFP_KERNEL, page_order);
   2.177 ++		table = dma_alloc_coherent(
   2.178 ++				&agp_bridge->dev->dev,
   2.179 ++				PAGE_SIZE << page_order, &dma, GFP_KERNEL);
   2.180 + 	}
   2.181 + 
   2.182 + 	if (table == NULL)
   2.183 +@@ -722,7 +727,7 @@
   2.184 + 	agp_gatt_table = (void *)table;
   2.185 + 
   2.186 + 	agp_bridge->driver->cache_flush();
   2.187 +-	agp_bridge->gatt_table = ioremap_nocache(virt_to_phys(table),
   2.188 ++	agp_bridge->gatt_table = ioremap_nocache(virt_to_bus(table),
   2.189 + 					(PAGE_SIZE * (1 << page_order)));
   2.190 + 	agp_bridge->driver->cache_flush();
   2.191 + 
   2.192 +@@ -730,11 +735,12 @@
   2.193 + 		for (page = virt_to_page(table); page <= virt_to_page(table_end); page++)
   2.194 + 			ClearPageReserved(page);
   2.195 + 
   2.196 +-		free_pages((unsigned long) table, page_order);
   2.197 ++		dma_free_coherent(&agp_bridge->dev->dev, PAGE_SIZE<<page_order,
   2.198 ++					table, dma);
   2.199 + 
   2.200 + 		return -ENOMEM;
   2.201 + 	}
   2.202 +-	agp_bridge->gatt_bus_addr = virt_to_phys(agp_bridge->gatt_table_real);
   2.203 ++	agp_bridge->gatt_bus_addr = virt_to_bus(table);
   2.204 + 
   2.205 + 	/* AK: bogus, should encode addresses > 4GB */
   2.206 + 	for (i = 0; i < num_entries; i++)
   2.207 +@@ -786,7 +792,8 @@
   2.208 + 	for (page = virt_to_page(table); page <= virt_to_page(table_end); page++)
   2.209 + 		ClearPageReserved(page);
   2.210 + 
   2.211 +-	free_pages((unsigned long) agp_bridge->gatt_table_real, page_order);
   2.212 ++	dma_free_coherent(&agp_bridge->dev->dev, PAGE_SIZE<<page_order,
   2.213 ++		agp_bridge->gatt_table_real, agp_bridge->gatt_bus_addr);
   2.214 + 
   2.215 + 	agp_gatt_table = NULL;
   2.216 + 	agp_bridge->gatt_table = NULL;
   2.217 +diff -ur linux-2.6.9/drivers/char/agp/hp-agp.c linux-2.6.9-new/drivers/char/agp/hp-agp.c
   2.218 +--- linux-2.6.9/drivers/char/agp/hp-agp.c	2004-10-18 22:54:55.000000000 +0100
   2.219 ++++ linux-2.6.9-new/drivers/char/agp/hp-agp.c	2004-11-28 19:32:03.000000000 +0000
   2.220 +@@ -110,7 +110,7 @@
   2.221 + 	hp->gart_size = HP_ZX1_GART_SIZE;
   2.222 + 	hp->gatt_entries = hp->gart_size / hp->io_page_size;
   2.223 + 
   2.224 +-	hp->io_pdir = phys_to_virt(INREG64(hp->ioc_regs, HP_ZX1_PDIR_BASE));
   2.225 ++	hp->io_pdir = bus_to_virt(INREG64(hp->ioc_regs, HP_ZX1_PDIR_BASE));
   2.226 + 	hp->gatt = &hp->io_pdir[HP_ZX1_IOVA_TO_PDIR(hp->gart_base)];
   2.227 + 
   2.228 + 	if (hp->gatt[0] != HP_ZX1_SBA_IOMMU_COOKIE) {
   2.229 +@@ -248,7 +248,7 @@
   2.230 + 	agp_bridge->mode = INREG32(hp->lba_regs, hp->lba_cap_offset + PCI_AGP_STATUS);
   2.231 + 
   2.232 + 	if (hp->io_pdir_owner) {
   2.233 +-		OUTREG64(hp->ioc_regs, HP_ZX1_PDIR_BASE, virt_to_phys(hp->io_pdir));
   2.234 ++		OUTREG64(hp->ioc_regs, HP_ZX1_PDIR_BASE, virt_to_bus(hp->io_pdir));
   2.235 + 		OUTREG64(hp->ioc_regs, HP_ZX1_TCNFG, hp->io_tlb_ps);
   2.236 + 		OUTREG64(hp->ioc_regs, HP_ZX1_IMASK, ~(HP_ZX1_IOVA_SIZE - 1));
   2.237 + 		OUTREG64(hp->ioc_regs, HP_ZX1_IBASE, hp->iova_base | 0x1);
   2.238 +diff -ur linux-2.6.9/drivers/char/agp/i460-agp.c linux-2.6.9-new/drivers/char/agp/i460-agp.c
   2.239 +--- linux-2.6.9/drivers/char/agp/i460-agp.c	2004-10-18 22:54:32.000000000 +0100
   2.240 ++++ linux-2.6.9-new/drivers/char/agp/i460-agp.c	2004-11-28 19:32:03.000000000 +0000
   2.241 +@@ -371,7 +371,7 @@
   2.242 + 	}
   2.243 + 	memset(lp->alloced_map, 0, map_size);
   2.244 + 
   2.245 +-	lp->paddr = virt_to_phys(lpage);
   2.246 ++	lp->paddr = virt_to_bus(lpage);
   2.247 + 	lp->refcount = 0;
   2.248 + 	atomic_add(I460_KPAGES_PER_IOPAGE, &agp_bridge->current_memory_agp);
   2.249 + 	return 0;
   2.250 +@@ -382,7 +382,7 @@
   2.251 + 	kfree(lp->alloced_map);
   2.252 + 	lp->alloced_map = NULL;
   2.253 + 
   2.254 +-	free_pages((unsigned long) phys_to_virt(lp->paddr), I460_IO_PAGE_SHIFT - PAGE_SHIFT);
   2.255 ++	free_pages((unsigned long) bus_to_virt(lp->paddr), I460_IO_PAGE_SHIFT - PAGE_SHIFT);
   2.256 + 	atomic_sub(I460_KPAGES_PER_IOPAGE, &agp_bridge->current_memory_agp);
   2.257 + }
   2.258 + 
   2.259 +diff -ur linux-2.6.9/drivers/char/agp/intel-agp.c linux-2.6.9-new/drivers/char/agp/intel-agp.c
   2.260 +--- linux-2.6.9/drivers/char/agp/intel-agp.c	2004-10-18 22:54:08.000000000 +0100
   2.261 ++++ linux-2.6.9-new/drivers/char/agp/intel-agp.c	2004-11-28 19:37:22.000000000 +0000
   2.262 +@@ -285,7 +285,7 @@
   2.263 + 	if (new == NULL)
   2.264 + 		return NULL;
   2.265 + 
   2.266 +-	new->memory[0] = virt_to_phys(addr);
   2.267 ++	new->memory[0] = virt_to_bus(addr);
   2.268 + 	if (pg_count == 4) {
   2.269 + 		/* kludge to get 4 physical pages for ARGB cursor */
   2.270 + 		new->memory[1] = new->memory[0] + PAGE_SIZE;
   2.271 +@@ -328,10 +328,10 @@
   2.272 + 	agp_free_key(curr->key);
   2.273 + 	if(curr->type == AGP_PHYS_MEMORY) {
   2.274 + 		if (curr->page_count == 4)
   2.275 +-			i8xx_destroy_pages(phys_to_virt(curr->memory[0]));
   2.276 ++			i8xx_destroy_pages(bus_to_virt(curr->memory[0]));
   2.277 + 		else
   2.278 + 			agp_bridge->driver->agp_destroy_page(
   2.279 +-				 phys_to_virt(curr->memory[0]));
   2.280 ++				 bus_to_virt(curr->memory[0]));
   2.281 + 		vfree(curr->memory);
   2.282 + 	}
   2.283 + 	kfree(curr);
   2.284 +diff -ur linux-2.6.9/drivers/char/agp/intel-mch-agp.c linux-2.6.9-new/drivers/char/agp/intel-mch-agp.c
   2.285 +--- linux-2.6.9/drivers/char/agp/intel-mch-agp.c	2004-10-18 22:53:13.000000000 +0100
   2.286 ++++ linux-2.6.9-new/drivers/char/agp/intel-mch-agp.c	2004-11-28 19:32:03.000000000 +0000
   2.287 +@@ -51,7 +51,7 @@
   2.288 + 	if (new == NULL)
   2.289 + 		return NULL;
   2.290 + 
   2.291 +-	new->memory[0] = agp_bridge->driver->mask_memory(virt_to_phys(addr), type);
   2.292 ++	new->memory[0] = agp_bridge->driver->mask_memory(virt_to_bus(addr), type);
   2.293 + 	new->page_count = 1;
   2.294 + 	new->num_scratch_pages = 1;
   2.295 + 	new->type = AGP_PHYS_MEMORY;
   2.296 +@@ -63,7 +63,7 @@
   2.297 + {
   2.298 + 	agp_free_key(curr->key);
   2.299 + 	if(curr->type == AGP_PHYS_MEMORY) {
   2.300 +-		agp_bridge->driver->agp_destroy_page(phys_to_virt(curr->memory[0]));
   2.301 ++		agp_bridge->driver->agp_destroy_page(bus_to_virt(curr->memory[0]));
   2.302 + 		vfree(curr->memory);
   2.303 + 	}
   2.304 + 	kfree(curr);
   2.305 +diff -ur linux-2.6.9/drivers/char/agp/sworks-agp.c linux-2.6.9-new/drivers/char/agp/sworks-agp.c
   2.306 +--- linux-2.6.9/drivers/char/agp/sworks-agp.c	2004-10-18 22:53:50.000000000 +0100
   2.307 ++++ linux-2.6.9-new/drivers/char/agp/sworks-agp.c	2004-11-28 19:38:02.000000000 +0000
   2.308 +@@ -51,7 +51,7 @@
   2.309 + 	}
   2.310 + 	SetPageReserved(virt_to_page(page_map->real));
   2.311 + 	global_cache_flush();
   2.312 +-	page_map->remapped = ioremap_nocache(virt_to_phys(page_map->real), 
   2.313 ++	page_map->remapped = ioremap_nocache(virt_to_bus(page_map->real), 
   2.314 + 					    PAGE_SIZE);
   2.315 + 	if (page_map->remapped == NULL) {
   2.316 + 		ClearPageReserved(virt_to_page(page_map->real));
   2.317 +@@ -162,7 +162,7 @@
   2.318 + 	/* Create a fake scratch directory */
   2.319 + 	for(i = 0; i < 1024; i++) {
   2.320 + 		writel(agp_bridge->scratch_page, serverworks_private.scratch_dir.remapped+i);
   2.321 +-		writel(virt_to_phys(serverworks_private.scratch_dir.real) | 1, page_dir.remapped+i);
   2.322 ++		writel(virt_to_bus(serverworks_private.scratch_dir.real) | 1, page_dir.remapped+i);
   2.323 + 	}
   2.324 + 
   2.325 + 	retval = serverworks_create_gatt_pages(value->num_entries / 1024);
   2.326 +@@ -174,7 +174,7 @@
   2.327 + 
   2.328 + 	agp_bridge->gatt_table_real = (u32 *)page_dir.real;
   2.329 + 	agp_bridge->gatt_table = (u32 __iomem *)page_dir.remapped;
   2.330 +-	agp_bridge->gatt_bus_addr = virt_to_phys(page_dir.real);
   2.331 ++	agp_bridge->gatt_bus_addr = virt_to_bus(page_dir.real);
   2.332 + 
   2.333 + 	/* Get the address for the gart region.
   2.334 + 	 * This is a bus address even on the alpha, b/c its
   2.335 +@@ -187,7 +187,7 @@
   2.336 + 	/* Calculate the agp offset */	
   2.337 + 
   2.338 + 	for(i = 0; i < value->num_entries / 1024; i++)
   2.339 +-		writel(virt_to_phys(serverworks_private.gatt_pages[i]->real)|1, page_dir.remapped+i);
   2.340 ++		writel(virt_to_bus(serverworks_private.gatt_pages[i]->real)|1, page_dir.remapped+i);
   2.341 + 
   2.342 + 	return 0;
   2.343 + }
   2.344 +diff -ur linux-2.6.9/drivers/char/agp/uninorth-agp.c linux-2.6.9-new/drivers/char/agp/uninorth-agp.c
   2.345 +--- linux-2.6.9/drivers/char/agp/uninorth-agp.c	2004-10-18 22:54:29.000000000 +0100
   2.346 ++++ linux-2.6.9-new/drivers/char/agp/uninorth-agp.c	2004-11-28 19:32:03.000000000 +0000
   2.347 +@@ -200,7 +200,7 @@
   2.348 + 
   2.349 + 	agp_bridge->gatt_table_real = (u32 *) table;
   2.350 + 	agp_bridge->gatt_table = (u32 *)table;
   2.351 +-	agp_bridge->gatt_bus_addr = virt_to_phys(table);
   2.352 ++	agp_bridge->gatt_bus_addr = virt_to_bus(table);
   2.353 + 
   2.354 + 	for (i = 0; i < num_entries; i++) {
   2.355 + 		agp_bridge->gatt_table[i] =
   2.356 +diff -ur linux-2.6.9/include/asm-i386/agp.h linux-2.6.9-new/include/asm-i386/agp.h
   2.357 +--- linux-2.6.9/include/asm-i386/agp.h	2004-10-18 22:53:06.000000000 +0100
   2.358 ++++ linux-2.6.9-new/include/asm-i386/agp.h	2004-11-28 19:32:03.000000000 +0000
   2.359 +@@ -3,6 +3,7 @@
   2.360 + 
   2.361 + #include <asm/pgtable.h>
   2.362 + #include <asm/cacheflush.h>
   2.363 ++#include <asm/system.h>
   2.364 + 
   2.365 + /* 
   2.366 +  * Functions to keep the agpgart mappings coherent with the MMU.
   2.367 +@@ -19,6 +20,6 @@
   2.368 + /* Could use CLFLUSH here if the cpu supports it. But then it would
   2.369 +    need to be called for each cacheline of the whole page so it may not be 
   2.370 +    worth it. Would need a page for it. */
   2.371 +-#define flush_agp_cache() asm volatile("wbinvd":::"memory")
   2.372 ++#define flush_agp_cache() wbinvd()
   2.373 + 
   2.374 + #endif
     3.1 --- a/patches/linux-2.6.9/agpgart.patch	Fri Feb 18 13:34:28 2005 +0000
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,371 +0,0 @@
     3.4 -diff -ur linux-2.6.9/drivers/char/agp/ali-agp.c linux-2.6.9-new/drivers/char/agp/ali-agp.c
     3.5 ---- linux-2.6.9/drivers/char/agp/ali-agp.c	2004-10-18 22:54:38.000000000 +0100
     3.6 -+++ linux-2.6.9-new/drivers/char/agp/ali-agp.c	2004-11-28 19:32:03.000000000 +0000
     3.7 -@@ -150,7 +150,7 @@
     3.8 - 	pci_read_config_dword(agp_bridge->dev, ALI_CACHE_FLUSH_CTRL, &temp);
     3.9 - 	pci_write_config_dword(agp_bridge->dev, ALI_CACHE_FLUSH_CTRL,
    3.10 - 			(((temp & ALI_CACHE_FLUSH_ADDR_MASK) |
    3.11 --			  virt_to_phys(addr)) | ALI_CACHE_FLUSH_EN ));
    3.12 -+			  virt_to_bus(addr)) | ALI_CACHE_FLUSH_EN ));
    3.13 - 	return addr;
    3.14 - }
    3.15 - 
    3.16 -@@ -174,7 +174,7 @@
    3.17 - 	pci_read_config_dword(agp_bridge->dev, ALI_CACHE_FLUSH_CTRL, &temp);
    3.18 - 	pci_write_config_dword(agp_bridge->dev, ALI_CACHE_FLUSH_CTRL,
    3.19 - 			(((temp & ALI_CACHE_FLUSH_ADDR_MASK) |
    3.20 --			  virt_to_phys(addr)) | ALI_CACHE_FLUSH_EN));
    3.21 -+			  virt_to_bus(addr)) | ALI_CACHE_FLUSH_EN));
    3.22 - 	agp_generic_destroy_page(addr);
    3.23 - }
    3.24 - 
    3.25 -diff -ur linux-2.6.9/drivers/char/agp/amd-k7-agp.c linux-2.6.9-new/drivers/char/agp/amd-k7-agp.c
    3.26 ---- linux-2.6.9/drivers/char/agp/amd-k7-agp.c	2004-10-18 22:55:36.000000000 +0100
    3.27 -+++ linux-2.6.9-new/drivers/char/agp/amd-k7-agp.c	2004-11-28 19:36:39.000000000 +0000
    3.28 -@@ -43,7 +43,7 @@
    3.29 - 
    3.30 - 	SetPageReserved(virt_to_page(page_map->real));
    3.31 - 	global_cache_flush();
    3.32 --	page_map->remapped = ioremap_nocache(virt_to_phys(page_map->real),
    3.33 -+	page_map->remapped = ioremap_nocache(virt_to_bus(page_map->real),
    3.34 - 					    PAGE_SIZE);
    3.35 - 	if (page_map->remapped == NULL) {
    3.36 - 		ClearPageReserved(virt_to_page(page_map->real));
    3.37 -@@ -152,7 +152,7 @@
    3.38 - 
    3.39 - 	agp_bridge->gatt_table_real = (u32 *)page_dir.real;
    3.40 - 	agp_bridge->gatt_table = (u32 __iomem *)page_dir.remapped;
    3.41 --	agp_bridge->gatt_bus_addr = virt_to_phys(page_dir.real);
    3.42 -+	agp_bridge->gatt_bus_addr = virt_to_bus(page_dir.real);
    3.43 - 
    3.44 - 	/* Get the address for the gart region.
    3.45 - 	 * This is a bus address even on the alpha, b/c its
    3.46 -@@ -165,7 +165,7 @@
    3.47 - 
    3.48 - 	/* Calculate the agp offset */
    3.49 - 	for (i = 0; i < value->num_entries / 1024; i++, addr += 0x00400000) {
    3.50 --		writel(virt_to_phys(amd_irongate_private.gatt_pages[i]->real) | 1,
    3.51 -+		writel(virt_to_bus(amd_irongate_private.gatt_pages[i]->real) | 1,
    3.52 - 			page_dir.remapped+GET_PAGE_DIR_OFF(addr));
    3.53 - 	}
    3.54 - 
    3.55 -diff -ur linux-2.6.9/drivers/char/agp/amd64-agp.c linux-2.6.9-new/drivers/char/agp/amd64-agp.c
    3.56 ---- linux-2.6.9/drivers/char/agp/amd64-agp.c	2004-10-18 22:54:38.000000000 +0100
    3.57 -+++ linux-2.6.9-new/drivers/char/agp/amd64-agp.c	2004-11-28 19:32:03.000000000 +0000
    3.58 -@@ -212,7 +212,7 @@
    3.59 - 
    3.60 - static int amd_8151_configure(void)
    3.61 - {
    3.62 --	unsigned long gatt_bus = virt_to_phys(agp_bridge->gatt_table_real);
    3.63 -+	unsigned long gatt_bus = virt_to_bus(agp_bridge->gatt_table_real);
    3.64 - 
    3.65 - 	/* Configure AGP regs in each x86-64 host bridge. */
    3.66 - 	for_each_nb() {
    3.67 -@@ -521,7 +521,7 @@
    3.68 - {
    3.69 - 	struct agp_bridge_data *bridge = pci_get_drvdata(pdev);
    3.70 - 
    3.71 --	release_mem_region(virt_to_phys(bridge->gatt_table_real),
    3.72 -+	release_mem_region(virt_to_bus(bridge->gatt_table_real),
    3.73 - 			   amd64_aperture_sizes[bridge->aperture_size_idx].size);
    3.74 - 	agp_remove_bridge(bridge);
    3.75 - 	agp_put_bridge(bridge);
    3.76 -diff -ur linux-2.6.9/drivers/char/agp/ati-agp.c linux-2.6.9-new/drivers/char/agp/ati-agp.c
    3.77 ---- linux-2.6.9/drivers/char/agp/ati-agp.c	2004-10-18 22:54:40.000000000 +0100
    3.78 -+++ linux-2.6.9-new/drivers/char/agp/ati-agp.c	2004-11-28 19:32:03.000000000 +0000
    3.79 -@@ -64,7 +64,7 @@
    3.80 - 
    3.81 - 	/* CACHE_FLUSH(); */
    3.82 - 	global_cache_flush();
    3.83 --	page_map->remapped = ioremap_nocache(virt_to_phys(page_map->real),
    3.84 -+	page_map->remapped = ioremap_nocache(virt_to_bus(page_map->real),
    3.85 - 					    PAGE_SIZE);
    3.86 - 	if (page_map->remapped == NULL || err) {
    3.87 - 		ClearPageReserved(virt_to_page(page_map->real));
    3.88 -diff -ur linux-2.6.9/drivers/char/agp/backend.c linux-2.6.9-new/drivers/char/agp/backend.c
    3.89 ---- linux-2.6.9/drivers/char/agp/backend.c	2004-10-18 22:54:39.000000000 +0100
    3.90 -+++ linux-2.6.9-new/drivers/char/agp/backend.c	2004-11-28 19:32:03.000000000 +0000
    3.91 -@@ -142,7 +142,7 @@
    3.92 - 			return -ENOMEM;
    3.93 - 		}
    3.94 - 
    3.95 --		bridge->scratch_page_real = virt_to_phys(addr);
    3.96 -+		bridge->scratch_page_real = virt_to_bus(addr);
    3.97 - 		bridge->scratch_page =
    3.98 - 		    bridge->driver->mask_memory(bridge->scratch_page_real, 0);
    3.99 - 	}
   3.100 -@@ -186,7 +186,7 @@
   3.101 - err_out:
   3.102 - 	if (bridge->driver->needs_scratch_page)
   3.103 - 		bridge->driver->agp_destroy_page(
   3.104 --				phys_to_virt(bridge->scratch_page_real));
   3.105 -+				bus_to_virt(bridge->scratch_page_real));
   3.106 - 	if (got_gatt)
   3.107 - 		bridge->driver->free_gatt_table();
   3.108 - 	if (got_keylist) {
   3.109 -@@ -211,7 +211,7 @@
   3.110 - 	if (bridge->driver->agp_destroy_page &&
   3.111 - 	    bridge->driver->needs_scratch_page)
   3.112 - 		bridge->driver->agp_destroy_page(
   3.113 --				phys_to_virt(bridge->scratch_page_real));
   3.114 -+				bus_to_virt(bridge->scratch_page_real));
   3.115 - }
   3.116 - 
   3.117 - static const drm_agp_t drm_agp = {
   3.118 -diff -ur linux-2.6.9/drivers/char/agp/efficeon-agp.c linux-2.6.9-new/drivers/char/agp/efficeon-agp.c
   3.119 ---- linux-2.6.9/drivers/char/agp/efficeon-agp.c	2004-10-18 22:53:06.000000000 +0100
   3.120 -+++ linux-2.6.9-new/drivers/char/agp/efficeon-agp.c	2004-11-28 19:38:28.000000000 +0000
   3.121 -@@ -219,7 +219,7 @@
   3.122 - 
   3.123 - 		efficeon_private.l1_table[index] = page;
   3.124 - 
   3.125 --		value = __pa(page) | pati | present | index;
   3.126 -+		value = virt_to_bus(page) | pati | present | index;
   3.127 - 
   3.128 - 		pci_write_config_dword(agp_bridge->dev,
   3.129 - 			EFFICEON_ATTPAGE, value);
   3.130 -diff -ur linux-2.6.9/drivers/char/agp/generic.c linux-2.6.9-new/drivers/char/agp/generic.c
   3.131 ---- linux-2.6.9/drivers/char/agp/generic.c	2004-10-18 22:53:50.000000000 +0100
   3.132 -+++ linux-2.6.9-new/drivers/char/agp/generic.c	2004-11-28 19:32:03.000000000 +0000
   3.133 -@@ -128,7 +128,7 @@
   3.134 - 	}
   3.135 - 	if (curr->page_count != 0) {
   3.136 - 		for (i = 0; i < curr->page_count; i++) {
   3.137 --			agp_bridge->driver->agp_destroy_page(phys_to_virt(curr->memory[i]));
   3.138 -+			agp_bridge->driver->agp_destroy_page(bus_to_virt(curr->memory[i]));
   3.139 - 		}
   3.140 - 	}
   3.141 - 	agp_free_key(curr->key);
   3.142 -@@ -182,7 +182,7 @@
   3.143 - 			return NULL;
   3.144 - 		}
   3.145 - 		new->memory[i] =
   3.146 --			agp_bridge->driver->mask_memory(virt_to_phys(addr), type);
   3.147 -+			agp_bridge->driver->mask_memory(virt_to_bus(addr), type);
   3.148 - 		new->page_count++;
   3.149 - 	}
   3.150 - 
   3.151 -@@ -637,6 +637,7 @@
   3.152 - 	int i;
   3.153 - 	void *temp;
   3.154 - 	struct page *page;
   3.155 -+	dma_addr_t dma;
   3.156 - 
   3.157 - 	/* The generic routines can't handle 2 level gatt's */
   3.158 - 	if (agp_bridge->driver->size_type == LVL2_APER_SIZE)
   3.159 -@@ -675,8 +676,10 @@
   3.160 - 				break;
   3.161 - 			}
   3.162 - 
   3.163 --			table = (char *) __get_free_pages(GFP_KERNEL,
   3.164 --							  page_order);
   3.165 -+			table = dma_alloc_coherent(
   3.166 -+					&agp_bridge->dev->dev,
   3.167 -+					PAGE_SIZE << page_order, &dma,
   3.168 -+					GFP_KERNEL);
   3.169 - 
   3.170 - 			if (table == NULL) {
   3.171 - 				i++;
   3.172 -@@ -707,7 +710,9 @@
   3.173 - 		size = ((struct aper_size_info_fixed *) temp)->size;
   3.174 - 		page_order = ((struct aper_size_info_fixed *) temp)->page_order;
   3.175 - 		num_entries = ((struct aper_size_info_fixed *) temp)->num_entries;
   3.176 --		table = (char *) __get_free_pages(GFP_KERNEL, page_order);
   3.177 -+		table = dma_alloc_coherent(
   3.178 -+				&agp_bridge->dev->dev,
   3.179 -+				PAGE_SIZE << page_order, &dma, GFP_KERNEL);
   3.180 - 	}
   3.181 - 
   3.182 - 	if (table == NULL)
   3.183 -@@ -722,7 +727,7 @@
   3.184 - 	agp_gatt_table = (void *)table;
   3.185 - 
   3.186 - 	agp_bridge->driver->cache_flush();
   3.187 --	agp_bridge->gatt_table = ioremap_nocache(virt_to_phys(table),
   3.188 -+	agp_bridge->gatt_table = ioremap_nocache(virt_to_bus(table),
   3.189 - 					(PAGE_SIZE * (1 << page_order)));
   3.190 - 	agp_bridge->driver->cache_flush();
   3.191 - 
   3.192 -@@ -730,11 +735,12 @@
   3.193 - 		for (page = virt_to_page(table); page <= virt_to_page(table_end); page++)
   3.194 - 			ClearPageReserved(page);
   3.195 - 
   3.196 --		free_pages((unsigned long) table, page_order);
   3.197 -+		dma_free_coherent(&agp_bridge->dev->dev, PAGE_SIZE<<page_order,
   3.198 -+					table, dma);
   3.199 - 
   3.200 - 		return -ENOMEM;
   3.201 - 	}
   3.202 --	agp_bridge->gatt_bus_addr = virt_to_phys(agp_bridge->gatt_table_real);
   3.203 -+	agp_bridge->gatt_bus_addr = virt_to_bus(table);
   3.204 - 
   3.205 - 	/* AK: bogus, should encode addresses > 4GB */
   3.206 - 	for (i = 0; i < num_entries; i++)
   3.207 -@@ -786,7 +792,8 @@
   3.208 - 	for (page = virt_to_page(table); page <= virt_to_page(table_end); page++)
   3.209 - 		ClearPageReserved(page);
   3.210 - 
   3.211 --	free_pages((unsigned long) agp_bridge->gatt_table_real, page_order);
   3.212 -+	dma_free_coherent(&agp_bridge->dev->dev, PAGE_SIZE<<page_order,
   3.213 -+		agp_bridge->gatt_table_real, agp_bridge->gatt_bus_addr);
   3.214 - 
   3.215 - 	agp_gatt_table = NULL;
   3.216 - 	agp_bridge->gatt_table = NULL;
   3.217 -diff -ur linux-2.6.9/drivers/char/agp/hp-agp.c linux-2.6.9-new/drivers/char/agp/hp-agp.c
   3.218 ---- linux-2.6.9/drivers/char/agp/hp-agp.c	2004-10-18 22:54:55.000000000 +0100
   3.219 -+++ linux-2.6.9-new/drivers/char/agp/hp-agp.c	2004-11-28 19:32:03.000000000 +0000
   3.220 -@@ -110,7 +110,7 @@
   3.221 - 	hp->gart_size = HP_ZX1_GART_SIZE;
   3.222 - 	hp->gatt_entries = hp->gart_size / hp->io_page_size;
   3.223 - 
   3.224 --	hp->io_pdir = phys_to_virt(INREG64(hp->ioc_regs, HP_ZX1_PDIR_BASE));
   3.225 -+	hp->io_pdir = bus_to_virt(INREG64(hp->ioc_regs, HP_ZX1_PDIR_BASE));
   3.226 - 	hp->gatt = &hp->io_pdir[HP_ZX1_IOVA_TO_PDIR(hp->gart_base)];
   3.227 - 
   3.228 - 	if (hp->gatt[0] != HP_ZX1_SBA_IOMMU_COOKIE) {
   3.229 -@@ -248,7 +248,7 @@
   3.230 - 	agp_bridge->mode = INREG32(hp->lba_regs, hp->lba_cap_offset + PCI_AGP_STATUS);
   3.231 - 
   3.232 - 	if (hp->io_pdir_owner) {
   3.233 --		OUTREG64(hp->ioc_regs, HP_ZX1_PDIR_BASE, virt_to_phys(hp->io_pdir));
   3.234 -+		OUTREG64(hp->ioc_regs, HP_ZX1_PDIR_BASE, virt_to_bus(hp->io_pdir));
   3.235 - 		OUTREG64(hp->ioc_regs, HP_ZX1_TCNFG, hp->io_tlb_ps);
   3.236 - 		OUTREG64(hp->ioc_regs, HP_ZX1_IMASK, ~(HP_ZX1_IOVA_SIZE - 1));
   3.237 - 		OUTREG64(hp->ioc_regs, HP_ZX1_IBASE, hp->iova_base | 0x1);
   3.238 -diff -ur linux-2.6.9/drivers/char/agp/i460-agp.c linux-2.6.9-new/drivers/char/agp/i460-agp.c
   3.239 ---- linux-2.6.9/drivers/char/agp/i460-agp.c	2004-10-18 22:54:32.000000000 +0100
   3.240 -+++ linux-2.6.9-new/drivers/char/agp/i460-agp.c	2004-11-28 19:32:03.000000000 +0000
   3.241 -@@ -371,7 +371,7 @@
   3.242 - 	}
   3.243 - 	memset(lp->alloced_map, 0, map_size);
   3.244 - 
   3.245 --	lp->paddr = virt_to_phys(lpage);
   3.246 -+	lp->paddr = virt_to_bus(lpage);
   3.247 - 	lp->refcount = 0;
   3.248 - 	atomic_add(I460_KPAGES_PER_IOPAGE, &agp_bridge->current_memory_agp);
   3.249 - 	return 0;
   3.250 -@@ -382,7 +382,7 @@
   3.251 - 	kfree(lp->alloced_map);
   3.252 - 	lp->alloced_map = NULL;
   3.253 - 
   3.254 --	free_pages((unsigned long) phys_to_virt(lp->paddr), I460_IO_PAGE_SHIFT - PAGE_SHIFT);
   3.255 -+	free_pages((unsigned long) bus_to_virt(lp->paddr), I460_IO_PAGE_SHIFT - PAGE_SHIFT);
   3.256 - 	atomic_sub(I460_KPAGES_PER_IOPAGE, &agp_bridge->current_memory_agp);
   3.257 - }
   3.258 - 
   3.259 -diff -ur linux-2.6.9/drivers/char/agp/intel-agp.c linux-2.6.9-new/drivers/char/agp/intel-agp.c
   3.260 ---- linux-2.6.9/drivers/char/agp/intel-agp.c	2004-10-18 22:54:08.000000000 +0100
   3.261 -+++ linux-2.6.9-new/drivers/char/agp/intel-agp.c	2004-11-28 19:37:22.000000000 +0000
   3.262 -@@ -285,7 +285,7 @@
   3.263 - 	if (new == NULL)
   3.264 - 		return NULL;
   3.265 - 
   3.266 --	new->memory[0] = virt_to_phys(addr);
   3.267 -+	new->memory[0] = virt_to_bus(addr);
   3.268 - 	if (pg_count == 4) {
   3.269 - 		/* kludge to get 4 physical pages for ARGB cursor */
   3.270 - 		new->memory[1] = new->memory[0] + PAGE_SIZE;
   3.271 -@@ -328,10 +328,10 @@
   3.272 - 	agp_free_key(curr->key);
   3.273 - 	if(curr->type == AGP_PHYS_MEMORY) {
   3.274 - 		if (curr->page_count == 4)
   3.275 --			i8xx_destroy_pages(phys_to_virt(curr->memory[0]));
   3.276 -+			i8xx_destroy_pages(bus_to_virt(curr->memory[0]));
   3.277 - 		else
   3.278 - 			agp_bridge->driver->agp_destroy_page(
   3.279 --				 phys_to_virt(curr->memory[0]));
   3.280 -+				 bus_to_virt(curr->memory[0]));
   3.281 - 		vfree(curr->memory);
   3.282 - 	}
   3.283 - 	kfree(curr);
   3.284 -diff -ur linux-2.6.9/drivers/char/agp/intel-mch-agp.c linux-2.6.9-new/drivers/char/agp/intel-mch-agp.c
   3.285 ---- linux-2.6.9/drivers/char/agp/intel-mch-agp.c	2004-10-18 22:53:13.000000000 +0100
   3.286 -+++ linux-2.6.9-new/drivers/char/agp/intel-mch-agp.c	2004-11-28 19:32:03.000000000 +0000
   3.287 -@@ -51,7 +51,7 @@
   3.288 - 	if (new == NULL)
   3.289 - 		return NULL;
   3.290 - 
   3.291 --	new->memory[0] = agp_bridge->driver->mask_memory(virt_to_phys(addr), type);
   3.292 -+	new->memory[0] = agp_bridge->driver->mask_memory(virt_to_bus(addr), type);
   3.293 - 	new->page_count = 1;
   3.294 - 	new->num_scratch_pages = 1;
   3.295 - 	new->type = AGP_PHYS_MEMORY;
   3.296 -@@ -63,7 +63,7 @@
   3.297 - {
   3.298 - 	agp_free_key(curr->key);
   3.299 - 	if(curr->type == AGP_PHYS_MEMORY) {
   3.300 --		agp_bridge->driver->agp_destroy_page(phys_to_virt(curr->memory[0]));
   3.301 -+		agp_bridge->driver->agp_destroy_page(bus_to_virt(curr->memory[0]));
   3.302 - 		vfree(curr->memory);
   3.303 - 	}
   3.304 - 	kfree(curr);
   3.305 -diff -ur linux-2.6.9/drivers/char/agp/sworks-agp.c linux-2.6.9-new/drivers/char/agp/sworks-agp.c
   3.306 ---- linux-2.6.9/drivers/char/agp/sworks-agp.c	2004-10-18 22:53:50.000000000 +0100
   3.307 -+++ linux-2.6.9-new/drivers/char/agp/sworks-agp.c	2004-11-28 19:38:02.000000000 +0000
   3.308 -@@ -51,7 +51,7 @@
   3.309 - 	}
   3.310 - 	SetPageReserved(virt_to_page(page_map->real));
   3.311 - 	global_cache_flush();
   3.312 --	page_map->remapped = ioremap_nocache(virt_to_phys(page_map->real), 
   3.313 -+	page_map->remapped = ioremap_nocache(virt_to_bus(page_map->real), 
   3.314 - 					    PAGE_SIZE);
   3.315 - 	if (page_map->remapped == NULL) {
   3.316 - 		ClearPageReserved(virt_to_page(page_map->real));
   3.317 -@@ -162,7 +162,7 @@
   3.318 - 	/* Create a fake scratch directory */
   3.319 - 	for(i = 0; i < 1024; i++) {
   3.320 - 		writel(agp_bridge->scratch_page, serverworks_private.scratch_dir.remapped+i);
   3.321 --		writel(virt_to_phys(serverworks_private.scratch_dir.real) | 1, page_dir.remapped+i);
   3.322 -+		writel(virt_to_bus(serverworks_private.scratch_dir.real) | 1, page_dir.remapped+i);
   3.323 - 	}
   3.324 - 
   3.325 - 	retval = serverworks_create_gatt_pages(value->num_entries / 1024);
   3.326 -@@ -174,7 +174,7 @@
   3.327 - 
   3.328 - 	agp_bridge->gatt_table_real = (u32 *)page_dir.real;
   3.329 - 	agp_bridge->gatt_table = (u32 __iomem *)page_dir.remapped;
   3.330 --	agp_bridge->gatt_bus_addr = virt_to_phys(page_dir.real);
   3.331 -+	agp_bridge->gatt_bus_addr = virt_to_bus(page_dir.real);
   3.332 - 
   3.333 - 	/* Get the address for the gart region.
   3.334 - 	 * This is a bus address even on the alpha, b/c its
   3.335 -@@ -187,7 +187,7 @@
   3.336 - 	/* Calculate the agp offset */	
   3.337 - 
   3.338 - 	for(i = 0; i < value->num_entries / 1024; i++)
   3.339 --		writel(virt_to_phys(serverworks_private.gatt_pages[i]->real)|1, page_dir.remapped+i);
   3.340 -+		writel(virt_to_bus(serverworks_private.gatt_pages[i]->real)|1, page_dir.remapped+i);
   3.341 - 
   3.342 - 	return 0;
   3.343 - }
   3.344 -diff -ur linux-2.6.9/drivers/char/agp/uninorth-agp.c linux-2.6.9-new/drivers/char/agp/uninorth-agp.c
   3.345 ---- linux-2.6.9/drivers/char/agp/uninorth-agp.c	2004-10-18 22:54:29.000000000 +0100
   3.346 -+++ linux-2.6.9-new/drivers/char/agp/uninorth-agp.c	2004-11-28 19:32:03.000000000 +0000
   3.347 -@@ -200,7 +200,7 @@
   3.348 - 
   3.349 - 	agp_bridge->gatt_table_real = (u32 *) table;
   3.350 - 	agp_bridge->gatt_table = (u32 *)table;
   3.351 --	agp_bridge->gatt_bus_addr = virt_to_phys(table);
   3.352 -+	agp_bridge->gatt_bus_addr = virt_to_bus(table);
   3.353 - 
   3.354 - 	for (i = 0; i < num_entries; i++) {
   3.355 - 		agp_bridge->gatt_table[i] =
   3.356 -diff -ur linux-2.6.9/include/asm-i386/agp.h linux-2.6.9-new/include/asm-i386/agp.h
   3.357 ---- linux-2.6.9/include/asm-i386/agp.h	2004-10-18 22:53:06.000000000 +0100
   3.358 -+++ linux-2.6.9-new/include/asm-i386/agp.h	2004-11-28 19:32:03.000000000 +0000
   3.359 -@@ -3,6 +3,7 @@
   3.360 - 
   3.361 - #include <asm/pgtable.h>
   3.362 - #include <asm/cacheflush.h>
   3.363 -+#include <asm/system.h>
   3.364 - 
   3.365 - /* 
   3.366 -  * Functions to keep the agpgart mappings coherent with the MMU.
   3.367 -@@ -19,6 +20,6 @@
   3.368 - /* Could use CLFLUSH here if the cpu supports it. But then it would
   3.369 -    need to be called for each cacheline of the whole page so it may not be 
   3.370 -    worth it. Would need a page for it. */
   3.371 --#define flush_agp_cache() asm volatile("wbinvd":::"memory")
   3.372 -+#define flush_agp_cache() wbinvd()
   3.373 - 
   3.374 - #endif