^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 _ALPHA_PAGE_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) #define _ALPHA_PAGE_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) #include <linux/const.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #include <asm/pal.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) /* PAGE_SHIFT determines the page size */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #define PAGE_SHIFT 13
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #define PAGE_MASK (~(PAGE_SIZE-1))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #ifndef __ASSEMBLY__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #define STRICT_MM_TYPECHECKS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) extern void clear_page(void *page);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #define clear_user_page(page, vaddr, pg) clear_page(page)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #define alloc_zeroed_user_highpage_movable(vma, vaddr) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) alloc_page_vma(GFP_HIGHUSER_MOVABLE | __GFP_ZERO, vma, vmaddr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE_MOVABLE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) extern void copy_page(void * _to, void * _from);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) #ifdef STRICT_MM_TYPECHECKS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) * These are used to make use of C type-checking..
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) typedef struct { unsigned long pte; } pte_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) typedef struct { unsigned long pmd; } pmd_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) typedef struct { unsigned long pgd; } pgd_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) typedef struct { unsigned long pgprot; } pgprot_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) #define pte_val(x) ((x).pte)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) #define pmd_val(x) ((x).pmd)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) #define pgd_val(x) ((x).pgd)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) #define pgprot_val(x) ((x).pgprot)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) #define __pte(x) ((pte_t) { (x) } )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) #define __pmd(x) ((pmd_t) { (x) } )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) #define __pgd(x) ((pgd_t) { (x) } )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) #define __pgprot(x) ((pgprot_t) { (x) } )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) * .. while these make it easier on the compiler
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) typedef unsigned long pte_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) typedef unsigned long pmd_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) typedef unsigned long pgd_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) typedef unsigned long pgprot_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) #define pte_val(x) (x)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) #define pmd_val(x) (x)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) #define pgd_val(x) (x)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) #define pgprot_val(x) (x)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) #define __pte(x) (x)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) #define __pgd(x) (x)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) #define __pgprot(x) (x)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) #endif /* STRICT_MM_TYPECHECKS */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) typedef struct page *pgtable_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) #ifdef USE_48_BIT_KSEG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) #define PAGE_OFFSET 0xffff800000000000UL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) #define PAGE_OFFSET 0xfffffc0000000000UL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) #ifdef USE_48_BIT_KSEG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) #define PAGE_OFFSET 0xffff800000000000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) #define PAGE_OFFSET 0xfffffc0000000000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) #endif /* !__ASSEMBLY__ */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) #define __pa(x) ((unsigned long) (x) - PAGE_OFFSET)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) #define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) #ifndef CONFIG_DISCONTIGMEM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) #define pfn_valid(pfn) ((pfn) < max_mapnr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) #endif /* CONFIG_DISCONTIGMEM */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) #include <asm-generic/memory_model.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) #include <asm-generic/getorder.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) #endif /* _ALPHA_PAGE_H */