[34] | 1 | #ifndef AGP_H |
---|
| 2 | #define AGP_H 1 |
---|
| 3 | |
---|
| 4 | #include <asm/pgtable.h> |
---|
| 5 | #include <asm/cacheflush.h> |
---|
| 6 | #include <asm/system.h> |
---|
| 7 | |
---|
| 8 | /* |
---|
| 9 | * Functions to keep the agpgart mappings coherent with the MMU. |
---|
| 10 | * The GART gives the CPU a physical alias of pages in memory. The alias region is |
---|
| 11 | * mapped uncacheable. Make sure there are no conflicting mappings |
---|
| 12 | * with different cachability attributes for the same page. This avoids |
---|
| 13 | * data corruption on some CPUs. |
---|
| 14 | */ |
---|
| 15 | |
---|
| 16 | int map_page_into_agp(struct page *page); |
---|
| 17 | int unmap_page_from_agp(struct page *page); |
---|
| 18 | #define flush_agp_mappings() global_flush_tlb() |
---|
| 19 | |
---|
| 20 | /* Could use CLFLUSH here if the cpu supports it. But then it would |
---|
| 21 | need to be called for each cacheline of the whole page so it may not be |
---|
| 22 | worth it. Would need a page for it. */ |
---|
| 23 | #define flush_agp_cache() wbinvd() |
---|
| 24 | |
---|
| 25 | /* Convert a physical address to an address suitable for the GART. */ |
---|
| 26 | #define phys_to_gart(x) phys_to_machine(x) |
---|
| 27 | #define gart_to_phys(x) machine_to_phys(x) |
---|
| 28 | |
---|
| 29 | /* GATT allocation. Returns/accepts GATT kernel virtual address. */ |
---|
| 30 | #define alloc_gatt_pages(order) ({ \ |
---|
| 31 | char *_t; dma_addr_t _d; \ |
---|
| 32 | _t = dma_alloc_coherent(NULL,PAGE_SIZE<<(order),&_d,GFP_KERNEL); \ |
---|
| 33 | _t; }) |
---|
| 34 | #define free_gatt_pages(table, order) \ |
---|
| 35 | dma_free_coherent(NULL,PAGE_SIZE<<(order),(table),virt_to_bus(table)) |
---|
| 36 | |
---|
| 37 | #endif |
---|