^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) #ifndef _ASM_X86_AGP_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) #define _ASM_X86_AGP_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) #include <linux/pgtable.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #include <asm/cacheflush.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) * Functions to keep the agpgart mappings coherent with the MMU. The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) * GART gives the CPU a physical alias of pages in memory. The alias
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) * region is mapped uncacheable. Make sure there are no conflicting
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) * mappings with different cachability attributes for the same
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) * page. This avoids data corruption on some CPUs.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #define map_page_into_agp(page) set_pages_uc(page, 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #define unmap_page_from_agp(page) set_pages_wb(page, 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) * Could use CLFLUSH here if the cpu supports it. But then it would
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) * need to be called for each cacheline of the whole page so it may
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) * not be worth it. Would need a page for it.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #define flush_agp_cache() wbinvd()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) /* GATT allocation. Returns/accepts GATT kernel virtual address. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) #define alloc_gatt_pages(order) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) ((char *)__get_free_pages(GFP_KERNEL, (order)))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) #define free_gatt_pages(table, order) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) free_pages((unsigned long)(table), (order))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) #endif /* _ASM_X86_AGP_H */