Merge to Fedora kernel-2.6.18-1.2224_FC5 patched with stable patch-2.6.18.1-vs2.0...
[linux-2.6.git] / include / asm-ia64 / agp.h
1 #ifndef _ASM_IA64_AGP_H
2 #define _ASM_IA64_AGP_H
3
4 /*
5  * IA-64 specific AGP definitions.
6  *
7  * Copyright (C) 2002-2003 Hewlett-Packard Co
8  *      David Mosberger-Tang <davidm@hpl.hp.com>
9  */
10
11 /*
12  * To avoid memory-attribute aliasing issues, we require that the AGPGART engine operate
13  * in coherent mode, which lets us map the AGP memory as normal (write-back) memory
14  * (unlike x86, where it gets mapped "write-coalescing").
15  */
16 #define map_page_into_agp(page)         /* nothing */
17 #define unmap_page_from_agp(page)       /* nothing */
18 #define flush_agp_mappings()            /* nothing */
19 #define flush_agp_cache()               mb()
20
21 /* Convert a physical address to an address suitable for the GART. */
22 #ifndef CONFIG_XEN
23 #define phys_to_gart(x) (x)
24 #define gart_to_phys(x) (x)
25 #else
26 #define phys_to_gart(x) phys_to_machine_for_dma(x)
27 #define gart_to_phys(x) machine_to_phys_for_dma(x)
28 #endif
29
30 /* GATT allocation. Returns/accepts GATT kernel virtual address. */
31 #ifdef CONFIG_XEN
32 #include <asm/hypervisor.h>
33 static inline char*
34 alloc_gatt_pages(unsigned int order)
35 {
36         unsigned long error;
37         unsigned long ret = __get_free_pages(GFP_KERNEL, (order));
38         if (ret == 0) {
39                 goto out;
40         }
41         error = xen_create_contiguous_region(ret, order, 0);
42         if (error) {
43                 free_pages(ret, order);
44                 ret = 0;
45         }
46 out:
47         return (char*)ret;
48 }
49 static inline void
50 free_gatt_pages(void* table, unsigned int order)
51 {
52         xen_destroy_contiguous_region((unsigned long)table, order);
53         free_pages((unsigned long)table, order);
54 }
55 #else   /* CONFIG_XEN */
56 /* Convert a physical address to an address suitable for the GART. */
57 #define phys_to_gart(x) (x)
58 #define gart_to_phys(x) (x)
59
60 /* GATT allocation. Returns/accepts GATT kernel virtual address. */
61 #define alloc_gatt_pages(order)         \
62         ((char *)__get_free_pages(GFP_KERNEL, (order)))
63 #define free_gatt_pages(table, order)   \
64         free_pages((unsigned long)(table), (order))
65 #endif  /* CONFIG_XEN */
66
67 #endif /* _ASM_IA64_AGP_H */