ia64/xen-unstable

view patches/linux-2.6.11/agpgart.patch @ 4547:73ef7f1fc714

bitkeeper revision 1.1307 (42604f23zhUwzxPQ-mNyzol0cpHWlg)

[PATCH] Eliminate kernel version checks from

Eliminate kernel version checks from x86_64/kernel/pci-dma.c as a trivial
first pass cleanup towards merging.

Signed-off-by: Chris Wright <chrisw@osdl.org>
author chrisw@osdl.org[iap10]
date Fri Apr 15 23:32:51 2005 +0000 (2005-04-15)
parents a01199a95070
children 56a63f9f378f
line source
1 --- linux-2.6.11/drivers/char/agp/agp.h 2005-03-02 07:38:07 +00:00
2 +++ linux-2.6.11-agp/drivers/char/agp/agp.h 2005-03-22 11:14:02 +00:00
3 @@ -272,6 +272,8 @@
4 #define AGP_GENERIC_SIZES_ENTRIES 11
5 extern struct aper_size_info_16 agp3_generic_sizes[];
7 +#define virt_to_gart(x) (phys_to_gart(virt_to_phys(x)))
8 +#define gart_to_virt(x) (phys_to_virt(gart_to_phys(x)))
10 extern int agp_off;
11 extern int agp_try_unsupported_boot;
12 --- linux-2.6.11/drivers/char/agp/ali-agp.c 2005-03-02 07:38:13 +00:00
13 +++ linux-2.6.11-agp/drivers/char/agp/ali-agp.c 2005-03-22 11:14:56 +00:00
14 @@ -150,7 +150,7 @@
15 pci_read_config_dword(agp_bridge->dev, ALI_CACHE_FLUSH_CTRL, &temp);
16 pci_write_config_dword(agp_bridge->dev, ALI_CACHE_FLUSH_CTRL,
17 (((temp & ALI_CACHE_FLUSH_ADDR_MASK) |
18 - virt_to_phys(addr)) | ALI_CACHE_FLUSH_EN ));
19 + virt_to_gart(addr)) | ALI_CACHE_FLUSH_EN ));
20 return addr;
21 }
23 @@ -174,7 +174,7 @@
24 pci_read_config_dword(agp_bridge->dev, ALI_CACHE_FLUSH_CTRL, &temp);
25 pci_write_config_dword(agp_bridge->dev, ALI_CACHE_FLUSH_CTRL,
26 (((temp & ALI_CACHE_FLUSH_ADDR_MASK) |
27 - virt_to_phys(addr)) | ALI_CACHE_FLUSH_EN));
28 + virt_to_gart(addr)) | ALI_CACHE_FLUSH_EN));
29 agp_generic_destroy_page(addr);
30 }
32 --- linux-2.6.11/drivers/char/agp/amd-k7-agp.c 2005-03-02 07:38:33 +00:00
33 +++ linux-2.6.11-agp/drivers/char/agp/amd-k7-agp.c 2005-03-22 11:14:56 +00:00
34 @@ -43,7 +43,7 @@
36 SetPageReserved(virt_to_page(page_map->real));
37 global_cache_flush();
38 - page_map->remapped = ioremap_nocache(virt_to_phys(page_map->real),
39 + page_map->remapped = ioremap_nocache(virt_to_gart(page_map->real),
40 PAGE_SIZE);
41 if (page_map->remapped == NULL) {
42 ClearPageReserved(virt_to_page(page_map->real));
43 @@ -154,7 +154,7 @@
45 agp_bridge->gatt_table_real = (u32 *)page_dir.real;
46 agp_bridge->gatt_table = (u32 __iomem *)page_dir.remapped;
47 - agp_bridge->gatt_bus_addr = virt_to_phys(page_dir.real);
48 + agp_bridge->gatt_bus_addr = virt_to_gart(page_dir.real);
50 /* Get the address for the gart region.
51 * This is a bus address even on the alpha, b/c its
52 @@ -167,7 +167,7 @@
54 /* Calculate the agp offset */
55 for (i = 0; i < value->num_entries / 1024; i++, addr += 0x00400000) {
56 - writel(virt_to_phys(amd_irongate_private.gatt_pages[i]->real) | 1,
57 + writel(virt_to_gart(amd_irongate_private.gatt_pages[i]->real) | 1,
58 page_dir.remapped+GET_PAGE_DIR_OFF(addr));
59 readl(page_dir.remapped+GET_PAGE_DIR_OFF(addr)); /* PCI Posting. */
60 }
61 --- linux-2.6.11/drivers/char/agp/amd64-agp.c 2005-03-02 07:38:13 +00:00
62 +++ linux-2.6.11-agp/drivers/char/agp/amd64-agp.c 2005-03-22 11:14:56 +00:00
63 @@ -218,7 +218,7 @@
65 static int amd_8151_configure(void)
66 {
67 - unsigned long gatt_bus = virt_to_phys(agp_bridge->gatt_table_real);
68 + unsigned long gatt_bus = virt_to_gart(agp_bridge->gatt_table_real);
70 /* Configure AGP regs in each x86-64 host bridge. */
71 for_each_nb() {
72 @@ -590,7 +590,7 @@
73 {
74 struct agp_bridge_data *bridge = pci_get_drvdata(pdev);
76 - release_mem_region(virt_to_phys(bridge->gatt_table_real),
77 + release_mem_region(virt_to_gart(bridge->gatt_table_real),
78 amd64_aperture_sizes[bridge->aperture_size_idx].size);
79 agp_remove_bridge(bridge);
80 agp_put_bridge(bridge);
81 --- linux-2.6.11/drivers/char/agp/ati-agp.c 2005-03-02 07:38:13 +00:00
82 +++ linux-2.6.11-agp/drivers/char/agp/ati-agp.c 2005-03-22 11:14:56 +00:00
83 @@ -61,7 +61,7 @@
85 SetPageReserved(virt_to_page(page_map->real));
86 err = map_page_into_agp(virt_to_page(page_map->real));
87 - page_map->remapped = ioremap_nocache(virt_to_phys(page_map->real),
88 + page_map->remapped = ioremap_nocache(virt_to_gart(page_map->real),
89 PAGE_SIZE);
90 if (page_map->remapped == NULL || err) {
91 ClearPageReserved(virt_to_page(page_map->real));
92 --- linux-2.6.11/drivers/char/agp/backend.c 2005-03-02 07:38:13 +00:00
93 +++ linux-2.6.11-agp/drivers/char/agp/backend.c 2005-03-22 11:14:56 +00:00
94 @@ -142,7 +142,7 @@
95 return -ENOMEM;
96 }
98 - bridge->scratch_page_real = virt_to_phys(addr);
99 + bridge->scratch_page_real = virt_to_gart(addr);
100 bridge->scratch_page =
101 bridge->driver->mask_memory(bridge->scratch_page_real, 0);
102 }
103 @@ -186,7 +186,7 @@
104 err_out:
105 if (bridge->driver->needs_scratch_page)
106 bridge->driver->agp_destroy_page(
107 - phys_to_virt(bridge->scratch_page_real));
108 + gart_to_virt(bridge->scratch_page_real));
109 if (got_gatt)
110 bridge->driver->free_gatt_table();
111 if (got_keylist) {
112 @@ -211,7 +211,7 @@
113 if (bridge->driver->agp_destroy_page &&
114 bridge->driver->needs_scratch_page)
115 bridge->driver->agp_destroy_page(
116 - phys_to_virt(bridge->scratch_page_real));
117 + gart_to_virt(bridge->scratch_page_real));
118 }
120 /* XXX Kludge alert: agpgart isn't ready for multiple bridges yet */
121 --- linux-2.6.11/drivers/char/agp/efficeon-agp.c 2005-03-02 07:37:30 +00:00
122 +++ linux-2.6.11-agp/drivers/char/agp/efficeon-agp.c 2005-03-22 11:15:17 +00:00
123 @@ -219,7 +219,7 @@
125 efficeon_private.l1_table[index] = page;
127 - value = __pa(page) | pati | present | index;
128 + value = virt_to_gart(page) | pati | present | index;
130 pci_write_config_dword(agp_bridge->dev,
131 EFFICEON_ATTPAGE, value);
132 --- linux-2.6.11/drivers/char/agp/generic.c 2005-03-02 07:37:55 +00:00
133 +++ linux-2.6.11-agp/drivers/char/agp/generic.c 2005-03-22 11:17:37 +00:00
134 @@ -151,7 +151,7 @@
135 }
136 if (curr->page_count != 0) {
137 for (i = 0; i < curr->page_count; i++) {
138 - agp_bridge->driver->agp_destroy_page(phys_to_virt(curr->memory[i]));
139 + agp_bridge->driver->agp_destroy_page(gart_to_virt(curr->memory[i]));
140 }
141 }
142 agp_free_key(curr->key);
143 @@ -204,7 +204,7 @@
144 agp_free_memory(new);
145 return NULL;
146 }
147 - new->memory[i] = virt_to_phys(addr);
148 + new->memory[i] = virt_to_gart(addr);
149 new->page_count++;
150 }
152 @@ -697,8 +697,7 @@
153 break;
154 }
156 - table = (char *) __get_free_pages(GFP_KERNEL,
157 - page_order);
158 + table = alloc_gatt_pages(page_order);
160 if (table == NULL) {
161 i++;
162 @@ -729,7 +728,7 @@
163 size = ((struct aper_size_info_fixed *) temp)->size;
164 page_order = ((struct aper_size_info_fixed *) temp)->page_order;
165 num_entries = ((struct aper_size_info_fixed *) temp)->num_entries;
166 - table = (char *) __get_free_pages(GFP_KERNEL, page_order);
167 + table = alloc_gatt_pages(page_order);
168 }
170 if (table == NULL)
171 @@ -744,7 +743,7 @@
172 agp_gatt_table = (void *)table;
174 agp_bridge->driver->cache_flush();
175 - agp_bridge->gatt_table = ioremap_nocache(virt_to_phys(table),
176 + agp_bridge->gatt_table = ioremap_nocache(virt_to_gart(table),
177 (PAGE_SIZE * (1 << page_order)));
178 agp_bridge->driver->cache_flush();
180 @@ -752,11 +751,11 @@
181 for (page = virt_to_page(table); page <= virt_to_page(table_end); page++)
182 ClearPageReserved(page);
184 - free_pages((unsigned long) table, page_order);
185 + free_gatt_pages(table, page_order);
187 return -ENOMEM;
188 }
189 - agp_bridge->gatt_bus_addr = virt_to_phys(agp_bridge->gatt_table_real);
190 + agp_bridge->gatt_bus_addr = virt_to_gart(agp_bridge->gatt_table_real);
192 /* AK: bogus, should encode addresses > 4GB */
193 for (i = 0; i < num_entries; i++) {
194 @@ -810,7 +809,7 @@
195 for (page = virt_to_page(table); page <= virt_to_page(table_end); page++)
196 ClearPageReserved(page);
198 - free_pages((unsigned long) agp_bridge->gatt_table_real, page_order);
199 + free_gatt_pages(agp_bridge->gatt_table_real, page_order);
201 agp_gatt_table = NULL;
202 agp_bridge->gatt_table = NULL;
203 --- linux-2.6.11/drivers/char/agp/hp-agp.c 2005-03-02 07:38:19 +00:00
204 +++ linux-2.6.11-agp/drivers/char/agp/hp-agp.c 2005-03-22 11:14:56 +00:00
205 @@ -110,7 +110,7 @@
206 hp->gart_size = HP_ZX1_GART_SIZE;
207 hp->gatt_entries = hp->gart_size / hp->io_page_size;
209 - hp->io_pdir = phys_to_virt(readq(hp->ioc_regs+HP_ZX1_PDIR_BASE));
210 + hp->io_pdir = gart_to_virt(readq(hp->ioc_regs+HP_ZX1_PDIR_BASE));
211 hp->gatt = &hp->io_pdir[HP_ZX1_IOVA_TO_PDIR(hp->gart_base)];
213 if (hp->gatt[0] != HP_ZX1_SBA_IOMMU_COOKIE) {
214 @@ -248,7 +248,7 @@
215 agp_bridge->mode = readl(hp->lba_regs+hp->lba_cap_offset+PCI_AGP_STATUS);
217 if (hp->io_pdir_owner) {
218 - writel(virt_to_phys(hp->io_pdir), hp->ioc_regs+HP_ZX1_PDIR_BASE);
219 + writel(virt_to_gart(hp->io_pdir), hp->ioc_regs+HP_ZX1_PDIR_BASE);
220 readl(hp->ioc_regs+HP_ZX1_PDIR_BASE);
221 writel(hp->io_tlb_ps, hp->ioc_regs+HP_ZX1_TCNFG);
222 readl(hp->ioc_regs+HP_ZX1_TCNFG);
223 --- linux-2.6.11/drivers/char/agp/i460-agp.c 2005-03-02 07:38:10 +00:00
224 +++ linux-2.6.11-agp/drivers/char/agp/i460-agp.c 2005-03-22 11:14:56 +00:00
225 @@ -371,7 +371,7 @@
226 }
227 memset(lp->alloced_map, 0, map_size);
229 - lp->paddr = virt_to_phys(lpage);
230 + lp->paddr = virt_to_gart(lpage);
231 lp->refcount = 0;
232 atomic_add(I460_KPAGES_PER_IOPAGE, &agp_bridge->current_memory_agp);
233 return 0;
234 @@ -382,7 +382,7 @@
235 kfree(lp->alloced_map);
236 lp->alloced_map = NULL;
238 - free_pages((unsigned long) phys_to_virt(lp->paddr), I460_IO_PAGE_SHIFT - PAGE_SHIFT);
239 + free_pages((unsigned long) gart_to_virt(lp->paddr), I460_IO_PAGE_SHIFT - PAGE_SHIFT);
240 atomic_sub(I460_KPAGES_PER_IOPAGE, &agp_bridge->current_memory_agp);
241 }
243 --- linux-2.6.11/drivers/char/agp/intel-agp.c 2005-03-02 07:38:09 +00:00
244 +++ linux-2.6.11-agp/drivers/char/agp/intel-agp.c 2005-03-22 11:14:56 +00:00
245 @@ -285,7 +285,7 @@
246 if (new == NULL)
247 return NULL;
249 - new->memory[0] = virt_to_phys(addr);
250 + new->memory[0] = virt_to_gart(addr);
251 if (pg_count == 4) {
252 /* kludge to get 4 physical pages for ARGB cursor */
253 new->memory[1] = new->memory[0] + PAGE_SIZE;
254 @@ -328,10 +328,10 @@
255 agp_free_key(curr->key);
256 if(curr->type == AGP_PHYS_MEMORY) {
257 if (curr->page_count == 4)
258 - i8xx_destroy_pages(phys_to_virt(curr->memory[0]));
259 + i8xx_destroy_pages(gart_to_virt(curr->memory[0]));
260 else
261 agp_bridge->driver->agp_destroy_page(
262 - phys_to_virt(curr->memory[0]));
263 + gart_to_virt(curr->memory[0]));
264 vfree(curr->memory);
265 }
266 kfree(curr);
267 --- linux-2.6.11/drivers/char/agp/intel-mch-agp.c 2005-03-02 07:37:48 +00:00
268 +++ linux-2.6.11-agp/drivers/char/agp/intel-mch-agp.c 2005-03-22 11:14:56 +00:00
269 @@ -51,7 +51,7 @@
270 if (new == NULL)
271 return NULL;
273 - new->memory[0] = virt_to_phys(addr);
274 + new->memory[0] = virt_to_gart(addr);
275 new->page_count = 1;
276 new->num_scratch_pages = 1;
277 new->type = AGP_PHYS_MEMORY;
278 @@ -63,7 +63,7 @@
279 {
280 agp_free_key(curr->key);
281 if(curr->type == AGP_PHYS_MEMORY) {
282 - agp_bridge->driver->agp_destroy_page(phys_to_virt(curr->memory[0]));
283 + agp_bridge->driver->agp_destroy_page(gart_to_virt(curr->memory[0]));
284 vfree(curr->memory);
285 }
286 kfree(curr);
287 --- linux-2.6.11/drivers/char/agp/sworks-agp.c 2005-03-02 07:38:37 +00:00
288 +++ linux-2.6.11-agp/drivers/char/agp/sworks-agp.c 2005-03-22 11:14:56 +00:00
289 @@ -51,7 +51,7 @@
290 }
291 SetPageReserved(virt_to_page(page_map->real));
292 global_cache_flush();
293 - page_map->remapped = ioremap_nocache(virt_to_phys(page_map->real),
294 + page_map->remapped = ioremap_nocache(virt_to_gart(page_map->real),
295 PAGE_SIZE);
296 if (page_map->remapped == NULL) {
297 ClearPageReserved(virt_to_page(page_map->real));
298 @@ -162,7 +162,7 @@
299 /* Create a fake scratch directory */
300 for(i = 0; i < 1024; i++) {
301 writel(agp_bridge->scratch_page, serverworks_private.scratch_dir.remapped+i);
302 - writel(virt_to_phys(serverworks_private.scratch_dir.real) | 1, page_dir.remapped+i);
303 + writel(virt_to_gart(serverworks_private.scratch_dir.real) | 1, page_dir.remapped+i);
304 }
306 retval = serverworks_create_gatt_pages(value->num_entries / 1024);
307 @@ -174,7 +174,7 @@
309 agp_bridge->gatt_table_real = (u32 *)page_dir.real;
310 agp_bridge->gatt_table = (u32 __iomem *)page_dir.remapped;
311 - agp_bridge->gatt_bus_addr = virt_to_phys(page_dir.real);
312 + agp_bridge->gatt_bus_addr = virt_to_gart(page_dir.real);
314 /* Get the address for the gart region.
315 * This is a bus address even on the alpha, b/c its
316 @@ -187,7 +187,7 @@
317 /* Calculate the agp offset */
319 for(i = 0; i < value->num_entries / 1024; i++)
320 - writel(virt_to_phys(serverworks_private.gatt_pages[i]->real)|1, page_dir.remapped+i);
321 + writel(virt_to_gart(serverworks_private.gatt_pages[i]->real)|1, page_dir.remapped+i);
323 return 0;
324 }
325 --- linux-2.6.11/drivers/char/agp/uninorth-agp.c 2005-03-02 07:38:09 +00:00
326 +++ linux-2.6.11-agp/drivers/char/agp/uninorth-agp.c 2005-03-22 11:14:56 +00:00
327 @@ -200,7 +200,7 @@
329 agp_bridge->gatt_table_real = (u32 *) table;
330 agp_bridge->gatt_table = (u32 *)table;
331 - agp_bridge->gatt_bus_addr = virt_to_phys(table);
332 + agp_bridge->gatt_bus_addr = virt_to_gart(table);
334 for (i = 0; i < num_entries; i++) {
335 agp_bridge->gatt_table[i] =
336 --- linux-2.6.11/include/asm-alpha/agp.h 2005-03-02 07:37:39 +00:00
337 +++ linux-2.6.11-agp/include/asm-alpha/agp.h 2005-03-22 11:18:34 +00:00
338 @@ -10,4 +10,14 @@
339 #define flush_agp_mappings()
340 #define flush_agp_cache() mb()
342 +/* Convert a physical address to an address suitable for the GART. */
343 +#define phys_to_gart(x) (x)
344 +#define gart_to_phys(x) (x)
345 +
346 +/* GATT allocation. Returns/accepts GATT kernel virtual address. */
347 +#define alloc_gatt_pages(order) \
348 + ((char *)__get_free_pages(GFP_KERNEL, (order)))
349 +#define free_gatt_pages(table, order) \
350 + free_pages((unsigned long)(table), (order))
351 +
352 #endif
353 --- linux-2.6.11/include/asm-i386/agp.h 2005-03-02 07:37:31 +00:00
354 +++ linux-2.6.11-agp/include/asm-i386/agp.h 2005-03-22 11:18:39 +00:00
355 @@ -21,4 +21,14 @@
356 worth it. Would need a page for it. */
357 #define flush_agp_cache() asm volatile("wbinvd":::"memory")
359 +/* Convert a physical address to an address suitable for the GART. */
360 +#define phys_to_gart(x) (x)
361 +#define gart_to_phys(x) (x)
362 +
363 +/* GATT allocation. Returns/accepts GATT kernel virtual address. */
364 +#define alloc_gatt_pages(order) \
365 + ((char *)__get_free_pages(GFP_KERNEL, (order)))
366 +#define free_gatt_pages(table, order) \
367 + free_pages((unsigned long)(table), (order))
368 +
369 #endif
370 --- linux-2.6.11/include/asm-ia64/agp.h 2005-03-02 07:38:09 +00:00
371 +++ linux-2.6.11-agp/include/asm-ia64/agp.h 2005-03-22 11:18:45 +00:00
372 @@ -18,4 +18,14 @@
373 #define flush_agp_mappings() /* nothing */
374 #define flush_agp_cache() mb()
376 +/* Convert a physical address to an address suitable for the GART. */
377 +#define phys_to_gart(x) (x)
378 +#define gart_to_phys(x) (x)
379 +
380 +/* GATT allocation. Returns/accepts GATT kernel virtual address. */
381 +#define alloc_gatt_pages(order) \
382 + ((char *)__get_free_pages(GFP_KERNEL, (order)))
383 +#define free_gatt_pages(table, order) \
384 + free_pages((unsigned long)(table), (order))
385 +
386 #endif /* _ASM_IA64_AGP_H */
387 --- linux-2.6.11/include/asm-ppc/agp.h 2005-03-02 07:38:08 +00:00
388 +++ linux-2.6.11-agp/include/asm-ppc/agp.h 2005-03-22 11:18:52 +00:00
389 @@ -10,4 +10,14 @@
390 #define flush_agp_mappings()
391 #define flush_agp_cache() mb()
393 +/* Convert a physical address to an address suitable for the GART. */
394 +#define phys_to_gart(x) (x)
395 +#define gart_to_phys(x) (x)
396 +
397 +/* GATT allocation. Returns/accepts GATT kernel virtual address. */
398 +#define alloc_gatt_pages(order) \
399 + ((char *)__get_free_pages(GFP_KERNEL, (order)))
400 +#define free_gatt_pages(table, order) \
401 + free_pages((unsigned long)(table), (order))
402 +
403 #endif
404 --- linux-2.6.11/include/asm-sparc64/agp.h 2005-03-02 07:37:48 +00:00
405 +++ linux-2.6.11-agp/include/asm-sparc64/agp.h 2005-03-22 11:18:59 +00:00
406 @@ -8,4 +8,14 @@
407 #define flush_agp_mappings()
408 #define flush_agp_cache() mb()
410 +/* Convert a physical address to an address suitable for the GART. */
411 +#define phys_to_gart(x) (x)
412 +#define gart_to_phys(x) (x)
413 +
414 +/* GATT allocation. Returns/accepts GATT kernel virtual address. */
415 +#define alloc_gatt_pages(order) \
416 + ((char *)__get_free_pages(GFP_KERNEL, (order)))
417 +#define free_gatt_pages(table, order) \
418 + free_pages((unsigned long)(table), (order))
419 +
420 #endif
421 --- linux-2.6.11/include/asm-x86_64/agp.h 2005-03-02 07:37:30 +00:00
422 +++ linux-2.6.11-agp/include/asm-x86_64/agp.h 2005-03-22 11:18:22 +00:00
423 @@ -19,4 +19,14 @@
424 worth it. Would need a page for it. */
425 #define flush_agp_cache() asm volatile("wbinvd":::"memory")
427 +/* Convert a physical address to an address suitable for the GART. */
428 +#define phys_to_gart(x) (x)
429 +#define gart_to_phys(x) (x)
430 +
431 +/* GATT allocation. Returns/accepts GATT kernel virtual address. */
432 +#define alloc_gatt_pages(order) \
433 + ((char *)__get_free_pages(GFP_KERNEL, (order)))
434 +#define free_gatt_pages(table, order) \
435 + free_pages((unsigned long)(table), (order))
436 +
437 #endif