ia64/xen-unstable

changeset 4257:2a1695d83589

bitkeeper revision 1.1236.1.109 (4240035cz_rWFpiJ0nsZoaqmxNolnw)

Manual merge.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Tue Mar 22 11:37:00 2005 +0000 (2005-03-22)
parents 5f91e746684c e217816b8cad
children beb68750d6e0 0529fe941ec4
files .rootkeys linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/agp.h patches/linux-2.6.11/agpgart.patch
line diff
     1.1 --- a/.rootkeys	Tue Mar 22 09:39:10 2005 +0000
     1.2 +++ b/.rootkeys	Tue Mar 22 11:37:00 2005 +0000
     1.3 @@ -303,6 +303,7 @@ 41ee5e8bglvqKvZSY5uJ5JGQejEwyQ linux-2.6
     1.4  41ee5e8ckZ9xVNvu9NHIZDK7JqApmQ linux-2.6.11-xen-sparse/drivers/xen/usbfront/usbfront.c
     1.5  41ee5e8ck9scpGirfqEZRARbGDyTXA linux-2.6.11-xen-sparse/drivers/xen/usbfront/xhci.h
     1.6  412f47e4RKD-R5IS5gEXvcT8L4v8gA linux-2.6.11-xen-sparse/include/asm-generic/pgtable.h
     1.7 +42400318xlBIV46qyxLTaDepPLNyhg linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/agp.h
     1.8  40f56239YAjS52QG2FIAQpHDZAdGHg linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/desc.h
     1.9  4107adf1E5O4ztGHNGMzCCNhcvqNow linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/dma-mapping.h
    1.10  40f5623akIoBsQ3KxSB2kufkbgONXQ linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/fixmap.h
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/agp.h	Tue Mar 22 11:37:00 2005 +0000
     2.3 @@ -0,0 +1,37 @@
     2.4 +#ifndef AGP_H
     2.5 +#define AGP_H 1
     2.6 +
     2.7 +#include <asm/pgtable.h>
     2.8 +#include <asm/cacheflush.h>
     2.9 +#include <asm/system.h>
    2.10 +
    2.11 +/* 
    2.12 + * Functions to keep the agpgart mappings coherent with the MMU.
    2.13 + * The GART gives the CPU a physical alias of pages in memory. The alias region is
    2.14 + * mapped uncacheable. Make sure there are no conflicting mappings
    2.15 + * with different cachability attributes for the same page. This avoids
    2.16 + * data corruption on some CPUs.
    2.17 + */
    2.18 +
    2.19 +int map_page_into_agp(struct page *page);
    2.20 +int unmap_page_from_agp(struct page *page);
    2.21 +#define flush_agp_mappings() global_flush_tlb()
    2.22 +
    2.23 +/* Could use CLFLUSH here if the cpu supports it. But then it would
    2.24 +   need to be called for each cacheline of the whole page so it may not be 
    2.25 +   worth it. Would need a page for it. */
    2.26 +#define flush_agp_cache() wbinvd()
    2.27 +
    2.28 +/* Convert a physical address to an address suitable for the GART. */
    2.29 +#define phys_to_gart(x) phys_to_machine(x)
    2.30 +#define gart_to_phys(x) machine_to_phys(x)
    2.31 +
    2.32 +/* GATT allocation. Returns/accepts GATT kernel virtual address. */
    2.33 +#define alloc_gatt_pages(order)	({                                          \
    2.34 +	char *_t; dma_addr_t _d;                                            \
    2.35 +	_t = dma_alloc_coherent(NULL,PAGE_SIZE<<(order),&_d,GFP_KERNEL);    \
    2.36 +	_t; })
    2.37 +#define free_gatt_pages(table, order)	\
    2.38 +	dma_free_coherent(NULL,PAGE_SIZE<<(order),(table),virt_to_bus(table))
    2.39 +
    2.40 +#endif
     3.1 --- a/patches/linux-2.6.11/agpgart.patch	Tue Mar 22 09:39:10 2005 +0000
     3.2 +++ b/patches/linux-2.6.11/agpgart.patch	Tue Mar 22 11:37:00 2005 +0000
     3.3 @@ -1,352 +1,437 @@
     3.4 -diff -rup pristine-linux-2.6.11/drivers/char/agp/ali-agp.c linux-2.6.11/drivers/char/agp/ali-agp.c
     3.5 ---- pristine-linux-2.6.11/drivers/char/agp/ali-agp.c	2005-03-02 07:38:13.000000000 +0000
     3.6 -+++ linux-2.6.11/drivers/char/agp/ali-agp.c	2005-03-11 00:35:21.320192760 +0000
     3.7 -@@ -150,7 +150,7 @@ static void *m1541_alloc_page(void)
     3.8 +--- linux-2.6.11/drivers/char/agp/agp.h	2005-03-02 07:38:07 +00:00
     3.9 ++++ linux-2.6.11-agp/drivers/char/agp/agp.h	2005-03-22 11:14:02 +00:00
    3.10 +@@ -272,6 +272,8 @@
    3.11 + #define AGP_GENERIC_SIZES_ENTRIES 11
    3.12 + extern struct aper_size_info_16 agp3_generic_sizes[];
    3.13 + 
    3.14 ++#define virt_to_gart(x) (phys_to_gart(virt_to_phys(x)))
    3.15 ++#define gart_to_virt(x) (phys_to_virt(gart_to_phys(x)))
    3.16 + 
    3.17 + extern int agp_off;
    3.18 + extern int agp_try_unsupported_boot;
    3.19 +--- linux-2.6.11/drivers/char/agp/ali-agp.c	2005-03-02 07:38:13 +00:00
    3.20 ++++ linux-2.6.11-agp/drivers/char/agp/ali-agp.c	2005-03-22 11:14:56 +00:00
    3.21 +@@ -150,7 +150,7 @@
    3.22   	pci_read_config_dword(agp_bridge->dev, ALI_CACHE_FLUSH_CTRL, &temp);
    3.23   	pci_write_config_dword(agp_bridge->dev, ALI_CACHE_FLUSH_CTRL,
    3.24   			(((temp & ALI_CACHE_FLUSH_ADDR_MASK) |
    3.25  -			  virt_to_phys(addr)) | ALI_CACHE_FLUSH_EN ));
    3.26 -+			  virt_to_bus(addr)) | ALI_CACHE_FLUSH_EN ));
    3.27 ++			  virt_to_gart(addr)) | ALI_CACHE_FLUSH_EN ));
    3.28   	return addr;
    3.29   }
    3.30   
    3.31 -@@ -174,7 +174,7 @@ static void m1541_destroy_page(void * ad
    3.32 +@@ -174,7 +174,7 @@
    3.33   	pci_read_config_dword(agp_bridge->dev, ALI_CACHE_FLUSH_CTRL, &temp);
    3.34   	pci_write_config_dword(agp_bridge->dev, ALI_CACHE_FLUSH_CTRL,
    3.35   			(((temp & ALI_CACHE_FLUSH_ADDR_MASK) |
    3.36  -			  virt_to_phys(addr)) | ALI_CACHE_FLUSH_EN));
    3.37 -+			  virt_to_bus(addr)) | ALI_CACHE_FLUSH_EN));
    3.38 ++			  virt_to_gart(addr)) | ALI_CACHE_FLUSH_EN));
    3.39   	agp_generic_destroy_page(addr);
    3.40   }
    3.41   
    3.42 -diff -rup pristine-linux-2.6.11/drivers/char/agp/amd-k7-agp.c linux-2.6.11/drivers/char/agp/amd-k7-agp.c
    3.43 ---- pristine-linux-2.6.11/drivers/char/agp/amd-k7-agp.c	2005-03-02 07:38:33.000000000 +0000
    3.44 -+++ linux-2.6.11/drivers/char/agp/amd-k7-agp.c	2005-03-11 00:35:21.321192788 +0000
    3.45 -@@ -43,7 +43,7 @@ static int amd_create_page_map(struct am
    3.46 +--- linux-2.6.11/drivers/char/agp/amd-k7-agp.c	2005-03-02 07:38:33 +00:00
    3.47 ++++ linux-2.6.11-agp/drivers/char/agp/amd-k7-agp.c	2005-03-22 11:14:56 +00:00
    3.48 +@@ -43,7 +43,7 @@
    3.49   
    3.50   	SetPageReserved(virt_to_page(page_map->real));
    3.51   	global_cache_flush();
    3.52  -	page_map->remapped = ioremap_nocache(virt_to_phys(page_map->real),
    3.53 -+	page_map->remapped = ioremap_nocache(virt_to_bus(page_map->real),
    3.54 ++	page_map->remapped = ioremap_nocache(virt_to_gart(page_map->real),
    3.55   					    PAGE_SIZE);
    3.56   	if (page_map->remapped == NULL) {
    3.57   		ClearPageReserved(virt_to_page(page_map->real));
    3.58 -@@ -154,7 +154,7 @@ static int amd_create_gatt_table(void)
    3.59 +@@ -154,7 +154,7 @@
    3.60   
    3.61   	agp_bridge->gatt_table_real = (u32 *)page_dir.real;
    3.62   	agp_bridge->gatt_table = (u32 __iomem *)page_dir.remapped;
    3.63  -	agp_bridge->gatt_bus_addr = virt_to_phys(page_dir.real);
    3.64 -+	agp_bridge->gatt_bus_addr = virt_to_bus(page_dir.real);
    3.65 ++	agp_bridge->gatt_bus_addr = virt_to_gart(page_dir.real);
    3.66   
    3.67   	/* Get the address for the gart region.
    3.68   	 * This is a bus address even on the alpha, b/c its
    3.69 -@@ -167,7 +167,7 @@ static int amd_create_gatt_table(void)
    3.70 +@@ -167,7 +167,7 @@
    3.71   
    3.72   	/* Calculate the agp offset */
    3.73   	for (i = 0; i < value->num_entries / 1024; i++, addr += 0x00400000) {
    3.74  -		writel(virt_to_phys(amd_irongate_private.gatt_pages[i]->real) | 1,
    3.75 -+		writel(virt_to_bus(amd_irongate_private.gatt_pages[i]->real) | 1,
    3.76 ++		writel(virt_to_gart(amd_irongate_private.gatt_pages[i]->real) | 1,
    3.77   			page_dir.remapped+GET_PAGE_DIR_OFF(addr));
    3.78   		readl(page_dir.remapped+GET_PAGE_DIR_OFF(addr));	/* PCI Posting. */
    3.79   	}
    3.80 -diff -rup pristine-linux-2.6.11/drivers/char/agp/amd64-agp.c linux-2.6.11/drivers/char/agp/amd64-agp.c
    3.81 ---- pristine-linux-2.6.11/drivers/char/agp/amd64-agp.c	2005-03-02 07:38:13.000000000 +0000
    3.82 -+++ linux-2.6.11/drivers/char/agp/amd64-agp.c	2005-03-11 00:35:21.322192816 +0000
    3.83 -@@ -218,7 +218,7 @@ static struct aper_size_info_32 amd_8151
    3.84 +--- linux-2.6.11/drivers/char/agp/amd64-agp.c	2005-03-02 07:38:13 +00:00
    3.85 ++++ linux-2.6.11-agp/drivers/char/agp/amd64-agp.c	2005-03-22 11:14:56 +00:00
    3.86 +@@ -218,7 +218,7 @@
    3.87   
    3.88   static int amd_8151_configure(void)
    3.89   {
    3.90  -	unsigned long gatt_bus = virt_to_phys(agp_bridge->gatt_table_real);
    3.91 -+	unsigned long gatt_bus = virt_to_bus(agp_bridge->gatt_table_real);
    3.92 ++	unsigned long gatt_bus = virt_to_gart(agp_bridge->gatt_table_real);
    3.93   
    3.94   	/* Configure AGP regs in each x86-64 host bridge. */
    3.95   	for_each_nb() {
    3.96 -@@ -590,7 +590,7 @@ static void __devexit agp_amd64_remove(s
    3.97 +@@ -590,7 +590,7 @@
    3.98   {
    3.99   	struct agp_bridge_data *bridge = pci_get_drvdata(pdev);
   3.100   
   3.101  -	release_mem_region(virt_to_phys(bridge->gatt_table_real),
   3.102 -+	release_mem_region(virt_to_bus(bridge->gatt_table_real),
   3.103 ++	release_mem_region(virt_to_gart(bridge->gatt_table_real),
   3.104   			   amd64_aperture_sizes[bridge->aperture_size_idx].size);
   3.105   	agp_remove_bridge(bridge);
   3.106   	agp_put_bridge(bridge);
   3.107 -diff -rup pristine-linux-2.6.11/drivers/char/agp/ati-agp.c linux-2.6.11/drivers/char/agp/ati-agp.c
   3.108 ---- pristine-linux-2.6.11/drivers/char/agp/ati-agp.c	2005-03-02 07:38:13.000000000 +0000
   3.109 -+++ linux-2.6.11/drivers/char/agp/ati-agp.c	2005-03-11 00:41:25.848450763 +0000
   3.110 -@@ -61,7 +61,7 @@ static int ati_create_page_map(ati_page_
   3.111 +--- linux-2.6.11/drivers/char/agp/ati-agp.c	2005-03-02 07:38:13 +00:00
   3.112 ++++ linux-2.6.11-agp/drivers/char/agp/ati-agp.c	2005-03-22 11:14:56 +00:00
   3.113 +@@ -61,7 +61,7 @@
   3.114   
   3.115   	SetPageReserved(virt_to_page(page_map->real));
   3.116   	err = map_page_into_agp(virt_to_page(page_map->real));
   3.117  -	page_map->remapped = ioremap_nocache(virt_to_phys(page_map->real),
   3.118 -+	page_map->remapped = ioremap_nocache(virt_to_bus(page_map->real),
   3.119 ++	page_map->remapped = ioremap_nocache(virt_to_gart(page_map->real),
   3.120   					    PAGE_SIZE);
   3.121   	if (page_map->remapped == NULL || err) {
   3.122   		ClearPageReserved(virt_to_page(page_map->real));
   3.123 -diff -rup pristine-linux-2.6.11/drivers/char/agp/backend.c linux-2.6.11/drivers/char/agp/backend.c
   3.124 ---- pristine-linux-2.6.11/drivers/char/agp/backend.c	2005-03-02 07:38:13.000000000 +0000
   3.125 -+++ linux-2.6.11/drivers/char/agp/backend.c	2005-03-11 00:35:21.323192844 +0000
   3.126 -@@ -142,7 +142,7 @@ static int agp_backend_initialize(struct
   3.127 +--- linux-2.6.11/drivers/char/agp/backend.c	2005-03-02 07:38:13 +00:00
   3.128 ++++ linux-2.6.11-agp/drivers/char/agp/backend.c	2005-03-22 11:14:56 +00:00
   3.129 +@@ -142,7 +142,7 @@
   3.130   			return -ENOMEM;
   3.131   		}
   3.132   
   3.133  -		bridge->scratch_page_real = virt_to_phys(addr);
   3.134 -+		bridge->scratch_page_real = virt_to_bus(addr);
   3.135 ++		bridge->scratch_page_real = virt_to_gart(addr);
   3.136   		bridge->scratch_page =
   3.137   		    bridge->driver->mask_memory(bridge->scratch_page_real, 0);
   3.138   	}
   3.139 -@@ -186,7 +186,7 @@ static int agp_backend_initialize(struct
   3.140 +@@ -186,7 +186,7 @@
   3.141   err_out:
   3.142   	if (bridge->driver->needs_scratch_page)
   3.143   		bridge->driver->agp_destroy_page(
   3.144  -				phys_to_virt(bridge->scratch_page_real));
   3.145 -+				bus_to_virt(bridge->scratch_page_real));
   3.146 ++				gart_to_virt(bridge->scratch_page_real));
   3.147   	if (got_gatt)
   3.148   		bridge->driver->free_gatt_table();
   3.149   	if (got_keylist) {
   3.150 -@@ -211,7 +211,7 @@ static void agp_backend_cleanup(struct a
   3.151 +@@ -211,7 +211,7 @@
   3.152   	if (bridge->driver->agp_destroy_page &&
   3.153   	    bridge->driver->needs_scratch_page)
   3.154   		bridge->driver->agp_destroy_page(
   3.155  -				phys_to_virt(bridge->scratch_page_real));
   3.156 -+				bus_to_virt(bridge->scratch_page_real));
   3.157 ++				gart_to_virt(bridge->scratch_page_real));
   3.158   }
   3.159   
   3.160   /* XXX Kludge alert: agpgart isn't ready for multiple bridges yet */
   3.161 -diff -rup pristine-linux-2.6.11/drivers/char/agp/efficeon-agp.c linux-2.6.11/drivers/char/agp/efficeon-agp.c
   3.162 ---- pristine-linux-2.6.11/drivers/char/agp/efficeon-agp.c	2005-03-02 07:37:30.000000000 +0000
   3.163 -+++ linux-2.6.11/drivers/char/agp/efficeon-agp.c	2005-03-11 00:35:21.324192872 +0000
   3.164 -@@ -219,7 +219,7 @@ static int efficeon_create_gatt_table(vo
   3.165 +--- linux-2.6.11/drivers/char/agp/efficeon-agp.c	2005-03-02 07:37:30 +00:00
   3.166 ++++ linux-2.6.11-agp/drivers/char/agp/efficeon-agp.c	2005-03-22 11:15:17 +00:00
   3.167 +@@ -219,7 +219,7 @@
   3.168   
   3.169   		efficeon_private.l1_table[index] = page;
   3.170   
   3.171  -		value = __pa(page) | pati | present | index;
   3.172 -+		value = virt_to_bus(page) | pati | present | index;
   3.173 ++		value = virt_to_gart(page) | pati | present | index;
   3.174   
   3.175   		pci_write_config_dword(agp_bridge->dev,
   3.176   			EFFICEON_ATTPAGE, value);
   3.177 -diff -rup pristine-linux-2.6.11/drivers/char/agp/generic.c linux-2.6.11/drivers/char/agp/generic.c
   3.178 ---- pristine-linux-2.6.11/drivers/char/agp/generic.c	2005-03-02 07:37:55.000000000 +0000
   3.179 -+++ linux-2.6.11/drivers/char/agp/generic.c	2005-03-11 00:44:53.858248651 +0000
   3.180 -@@ -151,7 +151,7 @@ void agp_free_memory(struct agp_memory *
   3.181 +--- linux-2.6.11/drivers/char/agp/generic.c	2005-03-02 07:37:55 +00:00
   3.182 ++++ linux-2.6.11-agp/drivers/char/agp/generic.c	2005-03-22 11:17:37 +00:00
   3.183 +@@ -151,7 +151,7 @@
   3.184   	}
   3.185   	if (curr->page_count != 0) {
   3.186   		for (i = 0; i < curr->page_count; i++) {
   3.187  -			agp_bridge->driver->agp_destroy_page(phys_to_virt(curr->memory[i]));
   3.188 -+			agp_bridge->driver->agp_destroy_page(bus_to_virt(curr->memory[i]));
   3.189 ++			agp_bridge->driver->agp_destroy_page(gart_to_virt(curr->memory[i]));
   3.190   		}
   3.191   	}
   3.192   	agp_free_key(curr->key);
   3.193 -@@ -204,7 +204,7 @@ struct agp_memory *agp_allocate_memory(s
   3.194 +@@ -204,7 +204,7 @@
   3.195   			agp_free_memory(new);
   3.196   			return NULL;
   3.197   		}
   3.198  -		new->memory[i] = virt_to_phys(addr);
   3.199 -+		new->memory[i] = virt_to_bus(addr);
   3.200 ++		new->memory[i] = virt_to_gart(addr);
   3.201   		new->page_count++;
   3.202   	}
   3.203   
   3.204 -@@ -659,6 +659,7 @@ int agp_generic_create_gatt_table(void)
   3.205 - 	int i;
   3.206 - 	void *temp;
   3.207 - 	struct page *page;
   3.208 -+	dma_addr_t dma;
   3.209 - 
   3.210 - 	/* The generic routines can't handle 2 level gatt's */
   3.211 - 	if (agp_bridge->driver->size_type == LVL2_APER_SIZE)
   3.212 -@@ -697,8 +698,10 @@ int agp_generic_create_gatt_table(void)
   3.213 +@@ -697,8 +697,7 @@
   3.214   				break;
   3.215   			}
   3.216   
   3.217  -			table = (char *) __get_free_pages(GFP_KERNEL,
   3.218  -							  page_order);
   3.219 -+			table = dma_alloc_coherent(
   3.220 -+					&agp_bridge->dev->dev,
   3.221 -+					PAGE_SIZE << page_order, &dma,
   3.222 -+					GFP_KERNEL);
   3.223 ++			table = alloc_gatt_pages(page_order);
   3.224   
   3.225   			if (table == NULL) {
   3.226   				i++;
   3.227 -@@ -729,7 +732,9 @@ int agp_generic_create_gatt_table(void)
   3.228 +@@ -729,7 +728,7 @@
   3.229   		size = ((struct aper_size_info_fixed *) temp)->size;
   3.230   		page_order = ((struct aper_size_info_fixed *) temp)->page_order;
   3.231   		num_entries = ((struct aper_size_info_fixed *) temp)->num_entries;
   3.232  -		table = (char *) __get_free_pages(GFP_KERNEL, page_order);
   3.233 -+		table = dma_alloc_coherent(
   3.234 -+				&agp_bridge->dev->dev,
   3.235 -+				PAGE_SIZE << page_order, &dma, GFP_KERNEL);
   3.236 ++		table = alloc_gatt_pages(page_order);
   3.237   	}
   3.238   
   3.239   	if (table == NULL)
   3.240 -@@ -744,7 +749,7 @@ int agp_generic_create_gatt_table(void)
   3.241 +@@ -744,7 +743,7 @@
   3.242   	agp_gatt_table = (void *)table;
   3.243   
   3.244   	agp_bridge->driver->cache_flush();
   3.245  -	agp_bridge->gatt_table = ioremap_nocache(virt_to_phys(table),
   3.246 -+	agp_bridge->gatt_table = ioremap_nocache(virt_to_bus(table),
   3.247 ++	agp_bridge->gatt_table = ioremap_nocache(virt_to_gart(table),
   3.248   					(PAGE_SIZE * (1 << page_order)));
   3.249   	agp_bridge->driver->cache_flush();
   3.250   
   3.251 -@@ -752,11 +757,12 @@ int agp_generic_create_gatt_table(void)
   3.252 +@@ -752,11 +751,11 @@
   3.253   		for (page = virt_to_page(table); page <= virt_to_page(table_end); page++)
   3.254   			ClearPageReserved(page);
   3.255   
   3.256  -		free_pages((unsigned long) table, page_order);
   3.257 -+		dma_free_coherent(&agp_bridge->dev->dev, PAGE_SIZE<<page_order,
   3.258 -+					table, dma);
   3.259 ++		free_gatt_pages(table, page_order);
   3.260   
   3.261   		return -ENOMEM;
   3.262   	}
   3.263  -	agp_bridge->gatt_bus_addr = virt_to_phys(agp_bridge->gatt_table_real);
   3.264 -+	agp_bridge->gatt_bus_addr = virt_to_bus(table);
   3.265 ++	agp_bridge->gatt_bus_addr = virt_to_gart(agp_bridge->gatt_table_real);
   3.266   
   3.267   	/* AK: bogus, should encode addresses > 4GB */
   3.268   	for (i = 0; i < num_entries; i++) {
   3.269 -@@ -810,7 +816,8 @@ int agp_generic_free_gatt_table(void)
   3.270 +@@ -810,7 +809,7 @@
   3.271   	for (page = virt_to_page(table); page <= virt_to_page(table_end); page++)
   3.272   		ClearPageReserved(page);
   3.273   
   3.274  -	free_pages((unsigned long) agp_bridge->gatt_table_real, page_order);
   3.275 -+	dma_free_coherent(&agp_bridge->dev->dev, PAGE_SIZE<<page_order,
   3.276 -+		agp_bridge->gatt_table_real, agp_bridge->gatt_bus_addr);
   3.277 ++	free_gatt_pages(agp_bridge->gatt_table_real, page_order);
   3.278   
   3.279   	agp_gatt_table = NULL;
   3.280   	agp_bridge->gatt_table = NULL;
   3.281 -diff -rup pristine-linux-2.6.11/drivers/char/agp/hp-agp.c linux-2.6.11/drivers/char/agp/hp-agp.c
   3.282 ---- pristine-linux-2.6.11/drivers/char/agp/hp-agp.c	2005-03-02 07:38:19.000000000 +0000
   3.283 -+++ linux-2.6.11/drivers/char/agp/hp-agp.c	2005-03-11 00:47:41.424653508 +0000
   3.284 -@@ -110,7 +110,7 @@ static int __init hp_zx1_ioc_shared(void
   3.285 +--- linux-2.6.11/drivers/char/agp/hp-agp.c	2005-03-02 07:38:19 +00:00
   3.286 ++++ linux-2.6.11-agp/drivers/char/agp/hp-agp.c	2005-03-22 11:14:56 +00:00
   3.287 +@@ -110,7 +110,7 @@
   3.288   	hp->gart_size = HP_ZX1_GART_SIZE;
   3.289   	hp->gatt_entries = hp->gart_size / hp->io_page_size;
   3.290   
   3.291  -	hp->io_pdir = phys_to_virt(readq(hp->ioc_regs+HP_ZX1_PDIR_BASE));
   3.292 -+	hp->io_pdir = bus_to_virt(readq(hp->ioc_regs+HP_ZX1_PDIR_BASE));
   3.293 ++	hp->io_pdir = gart_to_virt(readq(hp->ioc_regs+HP_ZX1_PDIR_BASE));
   3.294   	hp->gatt = &hp->io_pdir[HP_ZX1_IOVA_TO_PDIR(hp->gart_base)];
   3.295   
   3.296   	if (hp->gatt[0] != HP_ZX1_SBA_IOMMU_COOKIE) {
   3.297 -@@ -248,7 +248,7 @@ hp_zx1_configure (void)
   3.298 +@@ -248,7 +248,7 @@
   3.299   	agp_bridge->mode = readl(hp->lba_regs+hp->lba_cap_offset+PCI_AGP_STATUS);
   3.300   
   3.301   	if (hp->io_pdir_owner) {
   3.302  -		writel(virt_to_phys(hp->io_pdir), hp->ioc_regs+HP_ZX1_PDIR_BASE);
   3.303 -+		writel(virt_to_bus(hp->io_pdir), hp->ioc_regs+HP_ZX1_PDIR_BASE);
   3.304 ++		writel(virt_to_gart(hp->io_pdir), hp->ioc_regs+HP_ZX1_PDIR_BASE);
   3.305   		readl(hp->ioc_regs+HP_ZX1_PDIR_BASE);
   3.306   		writel(hp->io_tlb_ps, hp->ioc_regs+HP_ZX1_TCNFG);
   3.307   		readl(hp->ioc_regs+HP_ZX1_TCNFG);
   3.308 -diff -rup pristine-linux-2.6.11/drivers/char/agp/i460-agp.c linux-2.6.11/drivers/char/agp/i460-agp.c
   3.309 ---- pristine-linux-2.6.11/drivers/char/agp/i460-agp.c	2005-03-02 07:38:10.000000000 +0000
   3.310 -+++ linux-2.6.11/drivers/char/agp/i460-agp.c	2005-03-11 00:35:21.327192957 +0000
   3.311 -@@ -371,7 +371,7 @@ static int i460_alloc_large_page (struct
   3.312 +--- linux-2.6.11/drivers/char/agp/i460-agp.c	2005-03-02 07:38:10 +00:00
   3.313 ++++ linux-2.6.11-agp/drivers/char/agp/i460-agp.c	2005-03-22 11:14:56 +00:00
   3.314 +@@ -371,7 +371,7 @@
   3.315   	}
   3.316   	memset(lp->alloced_map, 0, map_size);
   3.317   
   3.318  -	lp->paddr = virt_to_phys(lpage);
   3.319 -+	lp->paddr = virt_to_bus(lpage);
   3.320 ++	lp->paddr = virt_to_gart(lpage);
   3.321   	lp->refcount = 0;
   3.322   	atomic_add(I460_KPAGES_PER_IOPAGE, &agp_bridge->current_memory_agp);
   3.323   	return 0;
   3.324 -@@ -382,7 +382,7 @@ static void i460_free_large_page (struct
   3.325 +@@ -382,7 +382,7 @@
   3.326   	kfree(lp->alloced_map);
   3.327   	lp->alloced_map = NULL;
   3.328   
   3.329  -	free_pages((unsigned long) phys_to_virt(lp->paddr), I460_IO_PAGE_SHIFT - PAGE_SHIFT);
   3.330 -+	free_pages((unsigned long) bus_to_virt(lp->paddr), I460_IO_PAGE_SHIFT - PAGE_SHIFT);
   3.331 ++	free_pages((unsigned long) gart_to_virt(lp->paddr), I460_IO_PAGE_SHIFT - PAGE_SHIFT);
   3.332   	atomic_sub(I460_KPAGES_PER_IOPAGE, &agp_bridge->current_memory_agp);
   3.333   }
   3.334   
   3.335 -diff -rup pristine-linux-2.6.11/drivers/char/agp/intel-agp.c linux-2.6.11/drivers/char/agp/intel-agp.c
   3.336 ---- pristine-linux-2.6.11/drivers/char/agp/intel-agp.c	2005-03-02 07:38:09.000000000 +0000
   3.337 -+++ linux-2.6.11/drivers/char/agp/intel-agp.c	2005-03-11 00:35:21.328192985 +0000
   3.338 -@@ -285,7 +285,7 @@ static struct agp_memory *alloc_agpphysm
   3.339 +--- linux-2.6.11/drivers/char/agp/intel-agp.c	2005-03-02 07:38:09 +00:00
   3.340 ++++ linux-2.6.11-agp/drivers/char/agp/intel-agp.c	2005-03-22 11:14:56 +00:00
   3.341 +@@ -285,7 +285,7 @@
   3.342   	if (new == NULL)
   3.343   		return NULL;
   3.344   
   3.345  -	new->memory[0] = virt_to_phys(addr);
   3.346 -+	new->memory[0] = virt_to_bus(addr);
   3.347 ++	new->memory[0] = virt_to_gart(addr);
   3.348   	if (pg_count == 4) {
   3.349   		/* kludge to get 4 physical pages for ARGB cursor */
   3.350   		new->memory[1] = new->memory[0] + PAGE_SIZE;
   3.351 -@@ -328,10 +328,10 @@ static void intel_i810_free_by_type(stru
   3.352 +@@ -328,10 +328,10 @@
   3.353   	agp_free_key(curr->key);
   3.354   	if(curr->type == AGP_PHYS_MEMORY) {
   3.355   		if (curr->page_count == 4)
   3.356  -			i8xx_destroy_pages(phys_to_virt(curr->memory[0]));
   3.357 -+			i8xx_destroy_pages(bus_to_virt(curr->memory[0]));
   3.358 ++			i8xx_destroy_pages(gart_to_virt(curr->memory[0]));
   3.359   		else
   3.360   			agp_bridge->driver->agp_destroy_page(
   3.361  -				 phys_to_virt(curr->memory[0]));
   3.362 -+				 bus_to_virt(curr->memory[0]));
   3.363 ++				 gart_to_virt(curr->memory[0]));
   3.364   		vfree(curr->memory);
   3.365   	}
   3.366   	kfree(curr);
   3.367 -diff -rup pristine-linux-2.6.11/drivers/char/agp/intel-mch-agp.c linux-2.6.11/drivers/char/agp/intel-mch-agp.c
   3.368 ---- pristine-linux-2.6.11/drivers/char/agp/intel-mch-agp.c	2005-03-02 07:37:48.000000000 +0000
   3.369 -+++ linux-2.6.11/drivers/char/agp/intel-mch-agp.c	2005-03-11 00:49:37.713063638 +0000
   3.370 -@@ -51,7 +51,7 @@ static struct agp_memory *alloc_agpphysm
   3.371 +--- linux-2.6.11/drivers/char/agp/intel-mch-agp.c	2005-03-02 07:37:48 +00:00
   3.372 ++++ linux-2.6.11-agp/drivers/char/agp/intel-mch-agp.c	2005-03-22 11:14:56 +00:00
   3.373 +@@ -51,7 +51,7 @@
   3.374   	if (new == NULL)
   3.375   		return NULL;
   3.376   
   3.377  -	new->memory[0] = virt_to_phys(addr);
   3.378 -+	new->memory[0] = virt_to_bus(addr);
   3.379 ++	new->memory[0] = virt_to_gart(addr);
   3.380   	new->page_count = 1;
   3.381   	new->num_scratch_pages = 1;
   3.382   	new->type = AGP_PHYS_MEMORY;
   3.383 -@@ -63,7 +63,7 @@ static void intel_i810_free_by_type(stru
   3.384 +@@ -63,7 +63,7 @@
   3.385   {
   3.386   	agp_free_key(curr->key);
   3.387   	if(curr->type == AGP_PHYS_MEMORY) {
   3.388  -		agp_bridge->driver->agp_destroy_page(phys_to_virt(curr->memory[0]));
   3.389 -+		agp_bridge->driver->agp_destroy_page(bus_to_virt(curr->memory[0]));
   3.390 ++		agp_bridge->driver->agp_destroy_page(gart_to_virt(curr->memory[0]));
   3.391   		vfree(curr->memory);
   3.392   	}
   3.393   	kfree(curr);
   3.394 -diff -rup pristine-linux-2.6.11/drivers/char/agp/sworks-agp.c linux-2.6.11/drivers/char/agp/sworks-agp.c
   3.395 ---- pristine-linux-2.6.11/drivers/char/agp/sworks-agp.c	2005-03-02 07:38:37.000000000 +0000
   3.396 -+++ linux-2.6.11/drivers/char/agp/sworks-agp.c	2005-03-11 00:35:21.330193041 +0000
   3.397 -@@ -51,7 +51,7 @@ static int serverworks_create_page_map(s
   3.398 +--- linux-2.6.11/drivers/char/agp/sworks-agp.c	2005-03-02 07:38:37 +00:00
   3.399 ++++ linux-2.6.11-agp/drivers/char/agp/sworks-agp.c	2005-03-22 11:14:56 +00:00
   3.400 +@@ -51,7 +51,7 @@
   3.401   	}
   3.402   	SetPageReserved(virt_to_page(page_map->real));
   3.403   	global_cache_flush();
   3.404  -	page_map->remapped = ioremap_nocache(virt_to_phys(page_map->real), 
   3.405 -+	page_map->remapped = ioremap_nocache(virt_to_bus(page_map->real), 
   3.406 ++	page_map->remapped = ioremap_nocache(virt_to_gart(page_map->real), 
   3.407   					    PAGE_SIZE);
   3.408   	if (page_map->remapped == NULL) {
   3.409   		ClearPageReserved(virt_to_page(page_map->real));
   3.410 -@@ -162,7 +162,7 @@ static int serverworks_create_gatt_table
   3.411 +@@ -162,7 +162,7 @@
   3.412   	/* Create a fake scratch directory */
   3.413   	for(i = 0; i < 1024; i++) {
   3.414   		writel(agp_bridge->scratch_page, serverworks_private.scratch_dir.remapped+i);
   3.415  -		writel(virt_to_phys(serverworks_private.scratch_dir.real) | 1, page_dir.remapped+i);
   3.416 -+		writel(virt_to_bus(serverworks_private.scratch_dir.real) | 1, page_dir.remapped+i);
   3.417 ++		writel(virt_to_gart(serverworks_private.scratch_dir.real) | 1, page_dir.remapped+i);
   3.418   	}
   3.419   
   3.420   	retval = serverworks_create_gatt_pages(value->num_entries / 1024);
   3.421 -@@ -174,7 +174,7 @@ static int serverworks_create_gatt_table
   3.422 +@@ -174,7 +174,7 @@
   3.423   
   3.424   	agp_bridge->gatt_table_real = (u32 *)page_dir.real;
   3.425   	agp_bridge->gatt_table = (u32 __iomem *)page_dir.remapped;
   3.426  -	agp_bridge->gatt_bus_addr = virt_to_phys(page_dir.real);
   3.427 -+	agp_bridge->gatt_bus_addr = virt_to_bus(page_dir.real);
   3.428 ++	agp_bridge->gatt_bus_addr = virt_to_gart(page_dir.real);
   3.429   
   3.430   	/* Get the address for the gart region.
   3.431   	 * This is a bus address even on the alpha, b/c its
   3.432 -@@ -187,7 +187,7 @@ static int serverworks_create_gatt_table
   3.433 +@@ -187,7 +187,7 @@
   3.434   	/* Calculate the agp offset */	
   3.435   
   3.436   	for(i = 0; i < value->num_entries / 1024; i++)
   3.437  -		writel(virt_to_phys(serverworks_private.gatt_pages[i]->real)|1, page_dir.remapped+i);
   3.438 -+		writel(virt_to_bus(serverworks_private.gatt_pages[i]->real)|1, page_dir.remapped+i);
   3.439 ++		writel(virt_to_gart(serverworks_private.gatt_pages[i]->real)|1, page_dir.remapped+i);
   3.440   
   3.441   	return 0;
   3.442   }
   3.443 -diff -rup pristine-linux-2.6.11/drivers/char/agp/uninorth-agp.c linux-2.6.11/drivers/char/agp/uninorth-agp.c
   3.444 ---- pristine-linux-2.6.11/drivers/char/agp/uninorth-agp.c	2005-03-02 07:38:09.000000000 +0000
   3.445 -+++ linux-2.6.11/drivers/char/agp/uninorth-agp.c	2005-03-11 00:35:21.330193041 +0000
   3.446 -@@ -200,7 +200,7 @@ static int uninorth_create_gatt_table(vo
   3.447 +--- linux-2.6.11/drivers/char/agp/uninorth-agp.c	2005-03-02 07:38:09 +00:00
   3.448 ++++ linux-2.6.11-agp/drivers/char/agp/uninorth-agp.c	2005-03-22 11:14:56 +00:00
   3.449 +@@ -200,7 +200,7 @@
   3.450   
   3.451   	agp_bridge->gatt_table_real = (u32 *) table;
   3.452   	agp_bridge->gatt_table = (u32 *)table;
   3.453  -	agp_bridge->gatt_bus_addr = virt_to_phys(table);
   3.454 -+	agp_bridge->gatt_bus_addr = virt_to_bus(table);
   3.455 ++	agp_bridge->gatt_bus_addr = virt_to_gart(table);
   3.456   
   3.457   	for (i = 0; i < num_entries; i++) {
   3.458   		agp_bridge->gatt_table[i] =
   3.459 +--- linux-2.6.11/include/asm-alpha/agp.h	2005-03-02 07:37:39 +00:00
   3.460 ++++ linux-2.6.11-agp/include/asm-alpha/agp.h	2005-03-22 11:18:34 +00:00
   3.461 +@@ -10,4 +10,14 @@
   3.462 + #define flush_agp_mappings() 
   3.463 + #define flush_agp_cache() mb()
   3.464 + 
   3.465 ++/* Convert a physical address to an address suitable for the GART. */
   3.466 ++#define phys_to_gart(x) (x)
   3.467 ++#define gart_to_phys(x) (x)
   3.468 ++
   3.469 ++/* GATT allocation. Returns/accepts GATT kernel virtual address. */
   3.470 ++#define alloc_gatt_pages(order)		\
   3.471 ++	((char *)__get_free_pages(GFP_KERNEL, (order)))
   3.472 ++#define free_gatt_pages(table, order)	\
   3.473 ++	free_pages((unsigned long)(table), (order))
   3.474 ++
   3.475 + #endif
   3.476 +--- linux-2.6.11/include/asm-i386/agp.h	2005-03-02 07:37:31 +00:00
   3.477 ++++ linux-2.6.11-agp/include/asm-i386/agp.h	2005-03-22 11:18:39 +00:00
   3.478 +@@ -21,4 +21,14 @@
   3.479 +    worth it. Would need a page for it. */
   3.480 + #define flush_agp_cache() asm volatile("wbinvd":::"memory")
   3.481 + 
   3.482 ++/* Convert a physical address to an address suitable for the GART. */
   3.483 ++#define phys_to_gart(x) (x)
   3.484 ++#define gart_to_phys(x) (x)
   3.485 ++
   3.486 ++/* GATT allocation. Returns/accepts GATT kernel virtual address. */
   3.487 ++#define alloc_gatt_pages(order)		\
   3.488 ++	((char *)__get_free_pages(GFP_KERNEL, (order)))
   3.489 ++#define free_gatt_pages(table, order)	\
   3.490 ++	free_pages((unsigned long)(table), (order))
   3.491 ++
   3.492 + #endif
   3.493 +--- linux-2.6.11/include/asm-ia64/agp.h	2005-03-02 07:38:09 +00:00
   3.494 ++++ linux-2.6.11-agp/include/asm-ia64/agp.h	2005-03-22 11:18:45 +00:00
   3.495 +@@ -18,4 +18,14 @@
   3.496 + #define flush_agp_mappings()		/* nothing */
   3.497 + #define flush_agp_cache()		mb()
   3.498 + 
   3.499 ++/* Convert a physical address to an address suitable for the GART. */
   3.500 ++#define phys_to_gart(x) (x)
   3.501 ++#define gart_to_phys(x) (x)
   3.502 ++
   3.503 ++/* GATT allocation. Returns/accepts GATT kernel virtual address. */
   3.504 ++#define alloc_gatt_pages(order)		\
   3.505 ++	((char *)__get_free_pages(GFP_KERNEL, (order)))
   3.506 ++#define free_gatt_pages(table, order)	\
   3.507 ++	free_pages((unsigned long)(table), (order))
   3.508 ++
   3.509 + #endif /* _ASM_IA64_AGP_H */
   3.510 +--- linux-2.6.11/include/asm-ppc/agp.h	2005-03-02 07:38:08 +00:00
   3.511 ++++ linux-2.6.11-agp/include/asm-ppc/agp.h	2005-03-22 11:18:52 +00:00
   3.512 +@@ -10,4 +10,14 @@
   3.513 + #define flush_agp_mappings()
   3.514 + #define flush_agp_cache() mb()
   3.515 + 
   3.516 ++/* Convert a physical address to an address suitable for the GART. */
   3.517 ++#define phys_to_gart(x) (x)
   3.518 ++#define gart_to_phys(x) (x)
   3.519 ++
   3.520 ++/* GATT allocation. Returns/accepts GATT kernel virtual address. */
   3.521 ++#define alloc_gatt_pages(order)		\
   3.522 ++	((char *)__get_free_pages(GFP_KERNEL, (order)))
   3.523 ++#define free_gatt_pages(table, order)	\
   3.524 ++	free_pages((unsigned long)(table), (order))
   3.525 ++
   3.526 + #endif
   3.527 +--- linux-2.6.11/include/asm-sparc64/agp.h	2005-03-02 07:37:48 +00:00
   3.528 ++++ linux-2.6.11-agp/include/asm-sparc64/agp.h	2005-03-22 11:18:59 +00:00
   3.529 +@@ -8,4 +8,14 @@
   3.530 + #define flush_agp_mappings() 
   3.531 + #define flush_agp_cache() mb()
   3.532 + 
   3.533 ++/* Convert a physical address to an address suitable for the GART. */
   3.534 ++#define phys_to_gart(x) (x)
   3.535 ++#define gart_to_phys(x) (x)
   3.536 ++
   3.537 ++/* GATT allocation. Returns/accepts GATT kernel virtual address. */
   3.538 ++#define alloc_gatt_pages(order)		\
   3.539 ++	((char *)__get_free_pages(GFP_KERNEL, (order)))
   3.540 ++#define free_gatt_pages(table, order)	\
   3.541 ++	free_pages((unsigned long)(table), (order))
   3.542 ++
   3.543 + #endif
   3.544 +--- linux-2.6.11/include/asm-x86_64/agp.h	2005-03-02 07:37:30 +00:00
   3.545 ++++ linux-2.6.11-agp/include/asm-x86_64/agp.h	2005-03-22 11:18:22 +00:00
   3.546 +@@ -19,4 +19,14 @@
   3.547 +    worth it. Would need a page for it. */
   3.548 + #define flush_agp_cache() asm volatile("wbinvd":::"memory")
   3.549 + 
   3.550 ++/* Convert a physical address to an address suitable for the GART. */
   3.551 ++#define phys_to_gart(x) (x)
   3.552 ++#define gart_to_phys(x) (x)
   3.553 ++
   3.554 ++/* GATT allocation. Returns/accepts GATT kernel virtual address. */
   3.555 ++#define alloc_gatt_pages(order)		\
   3.556 ++	((char *)__get_free_pages(GFP_KERNEL, (order)))
   3.557 ++#define free_gatt_pages(table, order)	\
   3.558 ++	free_pages((unsigned long)(table), (order))
   3.559 ++
   3.560 + #endif