ia64/xen-unstable

view patches/linux-2.6.11/agpgart.patch @ 4115:aa5288628539

bitkeeper revision 1.1236.25.11 (42336012SennigZlIjzUQ-DGht1vaw)

Update to Linux 2.6.11.
Signed-off-by: Christian Limpach <chris@xensource.com>
author cl349@firebug.cl.cam.ac.uk
date Sat Mar 12 21:33:06 2005 +0000 (2005-03-12)
parents db5a30a327e6
children f234096eb41e 77fce201bf8b 5b5ebfc03e24
line source
1 diff -rup pristine-linux-2.6.11/drivers/char/agp/ali-agp.c linux-2.6.11/drivers/char/agp/ali-agp.c
2 --- pristine-linux-2.6.11/drivers/char/agp/ali-agp.c 2005-03-02 07:38:13.000000000 +0000
3 +++ linux-2.6.11/drivers/char/agp/ali-agp.c 2005-03-11 00:35:21.320192760 +0000
4 @@ -150,7 +150,7 @@ static void *m1541_alloc_page(void)
5 pci_read_config_dword(agp_bridge->dev, ALI_CACHE_FLUSH_CTRL, &temp);
6 pci_write_config_dword(agp_bridge->dev, ALI_CACHE_FLUSH_CTRL,
7 (((temp & ALI_CACHE_FLUSH_ADDR_MASK) |
8 - virt_to_phys(addr)) | ALI_CACHE_FLUSH_EN ));
9 + virt_to_bus(addr)) | ALI_CACHE_FLUSH_EN ));
10 return addr;
11 }
13 @@ -174,7 +174,7 @@ static void m1541_destroy_page(void * ad
14 pci_read_config_dword(agp_bridge->dev, ALI_CACHE_FLUSH_CTRL, &temp);
15 pci_write_config_dword(agp_bridge->dev, ALI_CACHE_FLUSH_CTRL,
16 (((temp & ALI_CACHE_FLUSH_ADDR_MASK) |
17 - virt_to_phys(addr)) | ALI_CACHE_FLUSH_EN));
18 + virt_to_bus(addr)) | ALI_CACHE_FLUSH_EN));
19 agp_generic_destroy_page(addr);
20 }
22 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
23 --- pristine-linux-2.6.11/drivers/char/agp/amd-k7-agp.c 2005-03-02 07:38:33.000000000 +0000
24 +++ linux-2.6.11/drivers/char/agp/amd-k7-agp.c 2005-03-11 00:35:21.321192788 +0000
25 @@ -43,7 +43,7 @@ static int amd_create_page_map(struct am
27 SetPageReserved(virt_to_page(page_map->real));
28 global_cache_flush();
29 - page_map->remapped = ioremap_nocache(virt_to_phys(page_map->real),
30 + page_map->remapped = ioremap_nocache(virt_to_bus(page_map->real),
31 PAGE_SIZE);
32 if (page_map->remapped == NULL) {
33 ClearPageReserved(virt_to_page(page_map->real));
34 @@ -154,7 +154,7 @@ static int amd_create_gatt_table(void)
36 agp_bridge->gatt_table_real = (u32 *)page_dir.real;
37 agp_bridge->gatt_table = (u32 __iomem *)page_dir.remapped;
38 - agp_bridge->gatt_bus_addr = virt_to_phys(page_dir.real);
39 + agp_bridge->gatt_bus_addr = virt_to_bus(page_dir.real);
41 /* Get the address for the gart region.
42 * This is a bus address even on the alpha, b/c its
43 @@ -167,7 +167,7 @@ static int amd_create_gatt_table(void)
45 /* Calculate the agp offset */
46 for (i = 0; i < value->num_entries / 1024; i++, addr += 0x00400000) {
47 - writel(virt_to_phys(amd_irongate_private.gatt_pages[i]->real) | 1,
48 + writel(virt_to_bus(amd_irongate_private.gatt_pages[i]->real) | 1,
49 page_dir.remapped+GET_PAGE_DIR_OFF(addr));
50 readl(page_dir.remapped+GET_PAGE_DIR_OFF(addr)); /* PCI Posting. */
51 }
52 diff -rup pristine-linux-2.6.11/drivers/char/agp/amd64-agp.c linux-2.6.11/drivers/char/agp/amd64-agp.c
53 --- pristine-linux-2.6.11/drivers/char/agp/amd64-agp.c 2005-03-02 07:38:13.000000000 +0000
54 +++ linux-2.6.11/drivers/char/agp/amd64-agp.c 2005-03-11 00:35:21.322192816 +0000
55 @@ -218,7 +218,7 @@ static struct aper_size_info_32 amd_8151
57 static int amd_8151_configure(void)
58 {
59 - unsigned long gatt_bus = virt_to_phys(agp_bridge->gatt_table_real);
60 + unsigned long gatt_bus = virt_to_bus(agp_bridge->gatt_table_real);
62 /* Configure AGP regs in each x86-64 host bridge. */
63 for_each_nb() {
64 @@ -590,7 +590,7 @@ static void __devexit agp_amd64_remove(s
65 {
66 struct agp_bridge_data *bridge = pci_get_drvdata(pdev);
68 - release_mem_region(virt_to_phys(bridge->gatt_table_real),
69 + release_mem_region(virt_to_bus(bridge->gatt_table_real),
70 amd64_aperture_sizes[bridge->aperture_size_idx].size);
71 agp_remove_bridge(bridge);
72 agp_put_bridge(bridge);
73 diff -rup pristine-linux-2.6.11/drivers/char/agp/ati-agp.c linux-2.6.11/drivers/char/agp/ati-agp.c
74 --- pristine-linux-2.6.11/drivers/char/agp/ati-agp.c 2005-03-02 07:38:13.000000000 +0000
75 +++ linux-2.6.11/drivers/char/agp/ati-agp.c 2005-03-11 00:41:25.848450763 +0000
76 @@ -61,7 +61,7 @@ static int ati_create_page_map(ati_page_
78 SetPageReserved(virt_to_page(page_map->real));
79 err = map_page_into_agp(virt_to_page(page_map->real));
80 - page_map->remapped = ioremap_nocache(virt_to_phys(page_map->real),
81 + page_map->remapped = ioremap_nocache(virt_to_bus(page_map->real),
82 PAGE_SIZE);
83 if (page_map->remapped == NULL || err) {
84 ClearPageReserved(virt_to_page(page_map->real));
85 diff -rup pristine-linux-2.6.11/drivers/char/agp/backend.c linux-2.6.11/drivers/char/agp/backend.c
86 --- pristine-linux-2.6.11/drivers/char/agp/backend.c 2005-03-02 07:38:13.000000000 +0000
87 +++ linux-2.6.11/drivers/char/agp/backend.c 2005-03-11 00:35:21.323192844 +0000
88 @@ -142,7 +142,7 @@ static int agp_backend_initialize(struct
89 return -ENOMEM;
90 }
92 - bridge->scratch_page_real = virt_to_phys(addr);
93 + bridge->scratch_page_real = virt_to_bus(addr);
94 bridge->scratch_page =
95 bridge->driver->mask_memory(bridge->scratch_page_real, 0);
96 }
97 @@ -186,7 +186,7 @@ static int agp_backend_initialize(struct
98 err_out:
99 if (bridge->driver->needs_scratch_page)
100 bridge->driver->agp_destroy_page(
101 - phys_to_virt(bridge->scratch_page_real));
102 + bus_to_virt(bridge->scratch_page_real));
103 if (got_gatt)
104 bridge->driver->free_gatt_table();
105 if (got_keylist) {
106 @@ -211,7 +211,7 @@ static void agp_backend_cleanup(struct a
107 if (bridge->driver->agp_destroy_page &&
108 bridge->driver->needs_scratch_page)
109 bridge->driver->agp_destroy_page(
110 - phys_to_virt(bridge->scratch_page_real));
111 + bus_to_virt(bridge->scratch_page_real));
112 }
114 /* XXX Kludge alert: agpgart isn't ready for multiple bridges yet */
115 diff -rup pristine-linux-2.6.11/drivers/char/agp/efficeon-agp.c linux-2.6.11/drivers/char/agp/efficeon-agp.c
116 --- pristine-linux-2.6.11/drivers/char/agp/efficeon-agp.c 2005-03-02 07:37:30.000000000 +0000
117 +++ linux-2.6.11/drivers/char/agp/efficeon-agp.c 2005-03-11 00:35:21.324192872 +0000
118 @@ -219,7 +219,7 @@ static int efficeon_create_gatt_table(vo
120 efficeon_private.l1_table[index] = page;
122 - value = __pa(page) | pati | present | index;
123 + value = virt_to_bus(page) | pati | present | index;
125 pci_write_config_dword(agp_bridge->dev,
126 EFFICEON_ATTPAGE, value);
127 diff -rup pristine-linux-2.6.11/drivers/char/agp/generic.c linux-2.6.11/drivers/char/agp/generic.c
128 --- pristine-linux-2.6.11/drivers/char/agp/generic.c 2005-03-02 07:37:55.000000000 +0000
129 +++ linux-2.6.11/drivers/char/agp/generic.c 2005-03-11 00:44:53.858248651 +0000
130 @@ -151,7 +151,7 @@ void agp_free_memory(struct agp_memory *
131 }
132 if (curr->page_count != 0) {
133 for (i = 0; i < curr->page_count; i++) {
134 - agp_bridge->driver->agp_destroy_page(phys_to_virt(curr->memory[i]));
135 + agp_bridge->driver->agp_destroy_page(bus_to_virt(curr->memory[i]));
136 }
137 }
138 agp_free_key(curr->key);
139 @@ -204,7 +204,7 @@ struct agp_memory *agp_allocate_memory(s
140 agp_free_memory(new);
141 return NULL;
142 }
143 - new->memory[i] = virt_to_phys(addr);
144 + new->memory[i] = virt_to_bus(addr);
145 new->page_count++;
146 }
148 @@ -659,6 +659,7 @@ int agp_generic_create_gatt_table(void)
149 int i;
150 void *temp;
151 struct page *page;
152 + dma_addr_t dma;
154 /* The generic routines can't handle 2 level gatt's */
155 if (agp_bridge->driver->size_type == LVL2_APER_SIZE)
156 @@ -697,8 +698,10 @@ int agp_generic_create_gatt_table(void)
157 break;
158 }
160 - table = (char *) __get_free_pages(GFP_KERNEL,
161 - page_order);
162 + table = dma_alloc_coherent(
163 + &agp_bridge->dev->dev,
164 + PAGE_SIZE << page_order, &dma,
165 + GFP_KERNEL);
167 if (table == NULL) {
168 i++;
169 @@ -729,7 +732,9 @@ int agp_generic_create_gatt_table(void)
170 size = ((struct aper_size_info_fixed *) temp)->size;
171 page_order = ((struct aper_size_info_fixed *) temp)->page_order;
172 num_entries = ((struct aper_size_info_fixed *) temp)->num_entries;
173 - table = (char *) __get_free_pages(GFP_KERNEL, page_order);
174 + table = dma_alloc_coherent(
175 + &agp_bridge->dev->dev,
176 + PAGE_SIZE << page_order, &dma, GFP_KERNEL);
177 }
179 if (table == NULL)
180 @@ -744,7 +749,7 @@ int agp_generic_create_gatt_table(void)
181 agp_gatt_table = (void *)table;
183 agp_bridge->driver->cache_flush();
184 - agp_bridge->gatt_table = ioremap_nocache(virt_to_phys(table),
185 + agp_bridge->gatt_table = ioremap_nocache(virt_to_bus(table),
186 (PAGE_SIZE * (1 << page_order)));
187 agp_bridge->driver->cache_flush();
189 @@ -752,11 +757,12 @@ int agp_generic_create_gatt_table(void)
190 for (page = virt_to_page(table); page <= virt_to_page(table_end); page++)
191 ClearPageReserved(page);
193 - free_pages((unsigned long) table, page_order);
194 + dma_free_coherent(&agp_bridge->dev->dev, PAGE_SIZE<<page_order,
195 + table, dma);
197 return -ENOMEM;
198 }
199 - agp_bridge->gatt_bus_addr = virt_to_phys(agp_bridge->gatt_table_real);
200 + agp_bridge->gatt_bus_addr = virt_to_bus(table);
202 /* AK: bogus, should encode addresses > 4GB */
203 for (i = 0; i < num_entries; i++) {
204 @@ -810,7 +816,8 @@ int agp_generic_free_gatt_table(void)
205 for (page = virt_to_page(table); page <= virt_to_page(table_end); page++)
206 ClearPageReserved(page);
208 - free_pages((unsigned long) agp_bridge->gatt_table_real, page_order);
209 + dma_free_coherent(&agp_bridge->dev->dev, PAGE_SIZE<<page_order,
210 + agp_bridge->gatt_table_real, agp_bridge->gatt_bus_addr);
212 agp_gatt_table = NULL;
213 agp_bridge->gatt_table = NULL;
214 diff -rup pristine-linux-2.6.11/drivers/char/agp/hp-agp.c linux-2.6.11/drivers/char/agp/hp-agp.c
215 --- pristine-linux-2.6.11/drivers/char/agp/hp-agp.c 2005-03-02 07:38:19.000000000 +0000
216 +++ linux-2.6.11/drivers/char/agp/hp-agp.c 2005-03-11 00:47:41.424653508 +0000
217 @@ -110,7 +110,7 @@ static int __init hp_zx1_ioc_shared(void
218 hp->gart_size = HP_ZX1_GART_SIZE;
219 hp->gatt_entries = hp->gart_size / hp->io_page_size;
221 - hp->io_pdir = phys_to_virt(readq(hp->ioc_regs+HP_ZX1_PDIR_BASE));
222 + hp->io_pdir = bus_to_virt(readq(hp->ioc_regs+HP_ZX1_PDIR_BASE));
223 hp->gatt = &hp->io_pdir[HP_ZX1_IOVA_TO_PDIR(hp->gart_base)];
225 if (hp->gatt[0] != HP_ZX1_SBA_IOMMU_COOKIE) {
226 @@ -248,7 +248,7 @@ hp_zx1_configure (void)
227 agp_bridge->mode = readl(hp->lba_regs+hp->lba_cap_offset+PCI_AGP_STATUS);
229 if (hp->io_pdir_owner) {
230 - writel(virt_to_phys(hp->io_pdir), hp->ioc_regs+HP_ZX1_PDIR_BASE);
231 + writel(virt_to_bus(hp->io_pdir), hp->ioc_regs+HP_ZX1_PDIR_BASE);
232 readl(hp->ioc_regs+HP_ZX1_PDIR_BASE);
233 writel(hp->io_tlb_ps, hp->ioc_regs+HP_ZX1_TCNFG);
234 readl(hp->ioc_regs+HP_ZX1_TCNFG);
235 diff -rup pristine-linux-2.6.11/drivers/char/agp/i460-agp.c linux-2.6.11/drivers/char/agp/i460-agp.c
236 --- pristine-linux-2.6.11/drivers/char/agp/i460-agp.c 2005-03-02 07:38:10.000000000 +0000
237 +++ linux-2.6.11/drivers/char/agp/i460-agp.c 2005-03-11 00:35:21.327192957 +0000
238 @@ -371,7 +371,7 @@ static int i460_alloc_large_page (struct
239 }
240 memset(lp->alloced_map, 0, map_size);
242 - lp->paddr = virt_to_phys(lpage);
243 + lp->paddr = virt_to_bus(lpage);
244 lp->refcount = 0;
245 atomic_add(I460_KPAGES_PER_IOPAGE, &agp_bridge->current_memory_agp);
246 return 0;
247 @@ -382,7 +382,7 @@ static void i460_free_large_page (struct
248 kfree(lp->alloced_map);
249 lp->alloced_map = NULL;
251 - free_pages((unsigned long) phys_to_virt(lp->paddr), I460_IO_PAGE_SHIFT - PAGE_SHIFT);
252 + free_pages((unsigned long) bus_to_virt(lp->paddr), I460_IO_PAGE_SHIFT - PAGE_SHIFT);
253 atomic_sub(I460_KPAGES_PER_IOPAGE, &agp_bridge->current_memory_agp);
254 }
256 diff -rup pristine-linux-2.6.11/drivers/char/agp/intel-agp.c linux-2.6.11/drivers/char/agp/intel-agp.c
257 --- pristine-linux-2.6.11/drivers/char/agp/intel-agp.c 2005-03-02 07:38:09.000000000 +0000
258 +++ linux-2.6.11/drivers/char/agp/intel-agp.c 2005-03-11 00:35:21.328192985 +0000
259 @@ -285,7 +285,7 @@ static struct agp_memory *alloc_agpphysm
260 if (new == NULL)
261 return NULL;
263 - new->memory[0] = virt_to_phys(addr);
264 + new->memory[0] = virt_to_bus(addr);
265 if (pg_count == 4) {
266 /* kludge to get 4 physical pages for ARGB cursor */
267 new->memory[1] = new->memory[0] + PAGE_SIZE;
268 @@ -328,10 +328,10 @@ static void intel_i810_free_by_type(stru
269 agp_free_key(curr->key);
270 if(curr->type == AGP_PHYS_MEMORY) {
271 if (curr->page_count == 4)
272 - i8xx_destroy_pages(phys_to_virt(curr->memory[0]));
273 + i8xx_destroy_pages(bus_to_virt(curr->memory[0]));
274 else
275 agp_bridge->driver->agp_destroy_page(
276 - phys_to_virt(curr->memory[0]));
277 + bus_to_virt(curr->memory[0]));
278 vfree(curr->memory);
279 }
280 kfree(curr);
281 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
282 --- pristine-linux-2.6.11/drivers/char/agp/intel-mch-agp.c 2005-03-02 07:37:48.000000000 +0000
283 +++ linux-2.6.11/drivers/char/agp/intel-mch-agp.c 2005-03-11 00:49:37.713063638 +0000
284 @@ -51,7 +51,7 @@ static struct agp_memory *alloc_agpphysm
285 if (new == NULL)
286 return NULL;
288 - new->memory[0] = virt_to_phys(addr);
289 + new->memory[0] = virt_to_bus(addr);
290 new->page_count = 1;
291 new->num_scratch_pages = 1;
292 new->type = AGP_PHYS_MEMORY;
293 @@ -63,7 +63,7 @@ static void intel_i810_free_by_type(stru
294 {
295 agp_free_key(curr->key);
296 if(curr->type == AGP_PHYS_MEMORY) {
297 - agp_bridge->driver->agp_destroy_page(phys_to_virt(curr->memory[0]));
298 + agp_bridge->driver->agp_destroy_page(bus_to_virt(curr->memory[0]));
299 vfree(curr->memory);
300 }
301 kfree(curr);
302 diff -rup pristine-linux-2.6.11/drivers/char/agp/sworks-agp.c linux-2.6.11/drivers/char/agp/sworks-agp.c
303 --- pristine-linux-2.6.11/drivers/char/agp/sworks-agp.c 2005-03-02 07:38:37.000000000 +0000
304 +++ linux-2.6.11/drivers/char/agp/sworks-agp.c 2005-03-11 00:35:21.330193041 +0000
305 @@ -51,7 +51,7 @@ static int serverworks_create_page_map(s
306 }
307 SetPageReserved(virt_to_page(page_map->real));
308 global_cache_flush();
309 - page_map->remapped = ioremap_nocache(virt_to_phys(page_map->real),
310 + page_map->remapped = ioremap_nocache(virt_to_bus(page_map->real),
311 PAGE_SIZE);
312 if (page_map->remapped == NULL) {
313 ClearPageReserved(virt_to_page(page_map->real));
314 @@ -162,7 +162,7 @@ static int serverworks_create_gatt_table
315 /* Create a fake scratch directory */
316 for(i = 0; i < 1024; i++) {
317 writel(agp_bridge->scratch_page, serverworks_private.scratch_dir.remapped+i);
318 - writel(virt_to_phys(serverworks_private.scratch_dir.real) | 1, page_dir.remapped+i);
319 + writel(virt_to_bus(serverworks_private.scratch_dir.real) | 1, page_dir.remapped+i);
320 }
322 retval = serverworks_create_gatt_pages(value->num_entries / 1024);
323 @@ -174,7 +174,7 @@ static int serverworks_create_gatt_table
325 agp_bridge->gatt_table_real = (u32 *)page_dir.real;
326 agp_bridge->gatt_table = (u32 __iomem *)page_dir.remapped;
327 - agp_bridge->gatt_bus_addr = virt_to_phys(page_dir.real);
328 + agp_bridge->gatt_bus_addr = virt_to_bus(page_dir.real);
330 /* Get the address for the gart region.
331 * This is a bus address even on the alpha, b/c its
332 @@ -187,7 +187,7 @@ static int serverworks_create_gatt_table
333 /* Calculate the agp offset */
335 for(i = 0; i < value->num_entries / 1024; i++)
336 - writel(virt_to_phys(serverworks_private.gatt_pages[i]->real)|1, page_dir.remapped+i);
337 + writel(virt_to_bus(serverworks_private.gatt_pages[i]->real)|1, page_dir.remapped+i);
339 return 0;
340 }
341 diff -rup pristine-linux-2.6.11/drivers/char/agp/uninorth-agp.c linux-2.6.11/drivers/char/agp/uninorth-agp.c
342 --- pristine-linux-2.6.11/drivers/char/agp/uninorth-agp.c 2005-03-02 07:38:09.000000000 +0000
343 +++ linux-2.6.11/drivers/char/agp/uninorth-agp.c 2005-03-11 00:35:21.330193041 +0000
344 @@ -200,7 +200,7 @@ static int uninorth_create_gatt_table(vo
346 agp_bridge->gatt_table_real = (u32 *) table;
347 agp_bridge->gatt_table = (u32 *)table;
348 - agp_bridge->gatt_bus_addr = virt_to_phys(table);
349 + agp_bridge->gatt_bus_addr = virt_to_bus(table);
351 for (i = 0; i < num_entries; i++) {
352 agp_bridge->gatt_table[i] =
353 diff -rup pristine-linux-2.6.11/include/asm-i386/agp.h linux-2.6.11/include/asm-i386/agp.h
354 --- pristine-linux-2.6.11/include/asm-i386/agp.h 2005-03-02 07:37:31.000000000 +0000
355 +++ linux-2.6.11/include/asm-i386/agp.h 2005-03-11 00:35:21.331193069 +0000
356 @@ -3,6 +3,7 @@
358 #include <asm/pgtable.h>
359 #include <asm/cacheflush.h>
360 +#include <asm/system.h>
362 /*
363 * Functions to keep the agpgart mappings coherent with the MMU.
364 @@ -19,6 +20,6 @@ int unmap_page_from_agp(struct page *pag
365 /* Could use CLFLUSH here if the cpu supports it. But then it would
366 need to be called for each cacheline of the whole page so it may not be
367 worth it. Would need a page for it. */
368 -#define flush_agp_cache() asm volatile("wbinvd":::"memory")
369 +#define flush_agp_cache() wbinvd()
371 #endif