X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=include%2Fasm-ia64%2Fagp.h;fp=include%2Fasm-ia64%2Fagp.h;h=9458f58ade4af8ab916f0e3145019cc87f62f5e8;hb=16c70f8c1b54b61c3b951b6fb220df250fe09b32;hp=4e517f0e6afa34e81e9aecdeee51bf0eaec2b967;hpb=4e76c8a9fa413ccc09d3f7f664183dcce3555d57;p=linux-2.6.git diff --git a/include/asm-ia64/agp.h b/include/asm-ia64/agp.h index 4e517f0e6..9458f58ad 100644 --- a/include/asm-ia64/agp.h +++ b/include/asm-ia64/agp.h @@ -19,13 +19,49 @@ #define flush_agp_cache() mb() /* Convert a physical address to an address suitable for the GART. */ +#ifndef CONFIG_XEN #define phys_to_gart(x) (x) #define gart_to_phys(x) (x) +#else +#define phys_to_gart(x) phys_to_machine_for_dma(x) +#define gart_to_phys(x) machine_to_phys_for_dma(x) +#endif /* GATT allocation. Returns/accepts GATT kernel virtual address. */ -#define alloc_gatt_pages(order) \ - ((char *)__get_free_pages(GFP_KERNEL, (order))) -#define free_gatt_pages(table, order) \ - free_pages((unsigned long)(table), (order)) +#ifdef CONFIG_XEN +#include +static inline char* +alloc_gatt_pages(unsigned int order) +{ + unsigned long error; + unsigned long ret = __get_free_pages(GFP_KERNEL, (order)); + if (ret == 0) { + goto out; + } + error = xen_create_contiguous_region(ret, order, 0); + if (error) { + free_pages(ret, order); + ret = 0; + } +out: + return (char*)ret; +} +static inline void +free_gatt_pages(void* table, unsigned int order) +{ + xen_destroy_contiguous_region((unsigned long)table, order); + free_pages((unsigned long)table, order); +} +#else /* CONFIG_XEN */ +/* Convert a physical address to an address suitable for the GART. */ +#define phys_to_gart(x) (x) +#define gart_to_phys(x) (x) + +/* GATT allocation. Returns/accepts GATT kernel virtual address. */ +#define alloc_gatt_pages(order) \ + ((char *)__get_free_pages(GFP_KERNEL, (order))) +#define free_gatt_pages(table, order) \ + free_pages((unsigned long)(table), (order)) +#endif /* CONFIG_XEN */ #endif /* _ASM_IA64_AGP_H */