Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef _ALPHA_PAGE_H |
| 2 | #define _ALPHA_PAGE_H |
| 3 | |
Sam Ravnborg | b2b5d37 | 2007-10-16 01:26:35 -0700 | [diff] [blame] | 4 | #include <linux/const.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5 | #include <asm/pal.h> |
| 6 | |
| 7 | /* PAGE_SHIFT determines the page size */ |
| 8 | #define PAGE_SHIFT 13 |
Sam Ravnborg | b2b5d37 | 2007-10-16 01:26:35 -0700 | [diff] [blame] | 9 | #define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | #define PAGE_MASK (~(PAGE_SIZE-1)) |
| 11 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | #ifndef __ASSEMBLY__ |
| 13 | |
| 14 | #define STRICT_MM_TYPECHECKS |
| 15 | |
| 16 | extern void clear_page(void *page); |
| 17 | #define clear_user_page(page, vaddr, pg) clear_page(page) |
| 18 | |
Mel Gorman | 769848c | 2007-07-17 04:03:05 -0700 | [diff] [blame] | 19 | #define __alloc_zeroed_user_highpage(movableflags, vma, vaddr) \ |
| 20 | alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO | movableflags, vma, vmaddr) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 21 | #define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE |
| 22 | |
| 23 | extern void copy_page(void * _to, void * _from); |
| 24 | #define copy_user_page(to, from, vaddr, pg) copy_page(to, from) |
| 25 | |
| 26 | #ifdef STRICT_MM_TYPECHECKS |
| 27 | /* |
| 28 | * These are used to make use of C type-checking.. |
| 29 | */ |
| 30 | typedef struct { unsigned long pte; } pte_t; |
| 31 | typedef struct { unsigned long pmd; } pmd_t; |
| 32 | typedef struct { unsigned long pgd; } pgd_t; |
| 33 | typedef struct { unsigned long pgprot; } pgprot_t; |
| 34 | |
| 35 | #define pte_val(x) ((x).pte) |
| 36 | #define pmd_val(x) ((x).pmd) |
| 37 | #define pgd_val(x) ((x).pgd) |
| 38 | #define pgprot_val(x) ((x).pgprot) |
| 39 | |
| 40 | #define __pte(x) ((pte_t) { (x) } ) |
| 41 | #define __pmd(x) ((pmd_t) { (x) } ) |
| 42 | #define __pgd(x) ((pgd_t) { (x) } ) |
| 43 | #define __pgprot(x) ((pgprot_t) { (x) } ) |
| 44 | |
| 45 | #else |
| 46 | /* |
| 47 | * .. while these make it easier on the compiler |
| 48 | */ |
| 49 | typedef unsigned long pte_t; |
| 50 | typedef unsigned long pmd_t; |
| 51 | typedef unsigned long pgd_t; |
| 52 | typedef unsigned long pgprot_t; |
| 53 | |
| 54 | #define pte_val(x) (x) |
| 55 | #define pmd_val(x) (x) |
| 56 | #define pgd_val(x) (x) |
| 57 | #define pgprot_val(x) (x) |
| 58 | |
| 59 | #define __pte(x) (x) |
| 60 | #define __pgd(x) (x) |
| 61 | #define __pgprot(x) (x) |
| 62 | |
| 63 | #endif /* STRICT_MM_TYPECHECKS */ |
| 64 | |
Martin Schwidefsky | 2f569af | 2008-02-08 04:22:04 -0800 | [diff] [blame] | 65 | typedef struct page *pgtable_t; |
| 66 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 67 | #ifdef USE_48_BIT_KSEG |
| 68 | #define PAGE_OFFSET 0xffff800000000000UL |
| 69 | #else |
| 70 | #define PAGE_OFFSET 0xfffffc0000000000UL |
| 71 | #endif |
| 72 | |
| 73 | #else |
| 74 | |
| 75 | #ifdef USE_48_BIT_KSEG |
| 76 | #define PAGE_OFFSET 0xffff800000000000 |
| 77 | #else |
| 78 | #define PAGE_OFFSET 0xfffffc0000000000 |
| 79 | #endif |
| 80 | |
| 81 | #endif /* !__ASSEMBLY__ */ |
| 82 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 83 | #define __pa(x) ((unsigned long) (x) - PAGE_OFFSET) |
| 84 | #define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET)) |
| 85 | #ifndef CONFIG_DISCONTIGMEM |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 86 | #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) |
| 87 | |
| 88 | #define pfn_valid(pfn) ((pfn) < max_mapnr) |
| 89 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) |
| 90 | #endif /* CONFIG_DISCONTIGMEM */ |
| 91 | |
| 92 | #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ |
| 93 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 94 | |
KAMEZAWA Hiroyuki | 1c05dda | 2006-03-27 01:15:36 -0800 | [diff] [blame] | 95 | #include <asm-generic/memory_model.h> |
Arnd Bergmann | 5b17e1c | 2009-05-13 22:56:30 +0000 | [diff] [blame] | 96 | #include <asm-generic/getorder.h> |
Stephen Rothwell | fd4fd5a | 2005-09-03 15:54:30 -0700 | [diff] [blame] | 97 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 98 | #endif /* _ALPHA_PAGE_H */ |