diff options
Diffstat (limited to 'include/asm-sparc/page_64.h')
-rw-r--r-- | include/asm-sparc/page_64.h | 142 |
1 files changed, 142 insertions, 0 deletions
diff --git a/include/asm-sparc/page_64.h b/include/asm-sparc/page_64.h new file mode 100644 index 000000000000..93f0881b766e --- /dev/null +++ b/include/asm-sparc/page_64.h | |||
@@ -0,0 +1,142 @@ | |||
1 | #ifndef _SPARC64_PAGE_H | ||
2 | #define _SPARC64_PAGE_H | ||
3 | |||
4 | #include <linux/const.h> | ||
5 | |||
6 | #if defined(CONFIG_SPARC64_PAGE_SIZE_8KB) | ||
7 | #define PAGE_SHIFT 13 | ||
8 | #elif defined(CONFIG_SPARC64_PAGE_SIZE_64KB) | ||
9 | #define PAGE_SHIFT 16 | ||
10 | #elif defined(CONFIG_SPARC64_PAGE_SIZE_512KB) | ||
11 | #define PAGE_SHIFT 19 | ||
12 | #elif defined(CONFIG_SPARC64_PAGE_SIZE_4MB) | ||
13 | #define PAGE_SHIFT 22 | ||
14 | #else | ||
15 | #error No page size specified in kernel configuration | ||
16 | #endif | ||
17 | |||
18 | #define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT) | ||
19 | #define PAGE_MASK (~(PAGE_SIZE-1)) | ||
20 | |||
21 | /* Flushing for D-cache alias handling is only needed if | ||
22 | * the page size is smaller than 16K. | ||
23 | */ | ||
24 | #if PAGE_SHIFT < 14 | ||
25 | #define DCACHE_ALIASING_POSSIBLE | ||
26 | #endif | ||
27 | |||
28 | #if defined(CONFIG_HUGETLB_PAGE_SIZE_4MB) | ||
29 | #define HPAGE_SHIFT 22 | ||
30 | #elif defined(CONFIG_HUGETLB_PAGE_SIZE_512K) | ||
31 | #define HPAGE_SHIFT 19 | ||
32 | #elif defined(CONFIG_HUGETLB_PAGE_SIZE_64K) | ||
33 | #define HPAGE_SHIFT 16 | ||
34 | #endif | ||
35 | |||
36 | #ifdef CONFIG_HUGETLB_PAGE | ||
37 | #define HPAGE_SIZE (_AC(1,UL) << HPAGE_SHIFT) | ||
38 | #define HPAGE_MASK (~(HPAGE_SIZE - 1UL)) | ||
39 | #define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) | ||
40 | #define HAVE_ARCH_HUGETLB_UNMAPPED_AREA | ||
41 | #endif | ||
42 | |||
43 | #ifndef __ASSEMBLY__ | ||
44 | |||
45 | extern void _clear_page(void *page); | ||
46 | #define clear_page(X) _clear_page((void *)(X)) | ||
47 | struct page; | ||
48 | extern void clear_user_page(void *addr, unsigned long vaddr, struct page *page); | ||
49 | #define copy_page(X,Y) memcpy((void *)(X), (void *)(Y), PAGE_SIZE) | ||
50 | extern void copy_user_page(void *to, void *from, unsigned long vaddr, struct page *topage); | ||
51 | |||
52 | /* Unlike sparc32, sparc64's parameter passing API is more | ||
53 | * sane in that structures which as small enough are passed | ||
54 | * in registers instead of on the stack. Thus, setting | ||
55 | * STRICT_MM_TYPECHECKS does not generate worse code so | ||
56 | * let's enable it to get the type checking. | ||
57 | */ | ||
58 | |||
59 | #define STRICT_MM_TYPECHECKS | ||
60 | |||
61 | #ifdef STRICT_MM_TYPECHECKS | ||
62 | /* These are used to make use of C type-checking.. */ | ||
63 | typedef struct { unsigned long pte; } pte_t; | ||
64 | typedef struct { unsigned long iopte; } iopte_t; | ||
65 | typedef struct { unsigned int pmd; } pmd_t; | ||
66 | typedef struct { unsigned int pgd; } pgd_t; | ||
67 | typedef struct { unsigned long pgprot; } pgprot_t; | ||
68 | |||
69 | #define pte_val(x) ((x).pte) | ||
70 | #define iopte_val(x) ((x).iopte) | ||
71 | #define pmd_val(x) ((x).pmd) | ||
72 | #define pgd_val(x) ((x).pgd) | ||
73 | #define pgprot_val(x) ((x).pgprot) | ||
74 | |||
75 | #define __pte(x) ((pte_t) { (x) } ) | ||
76 | #define __iopte(x) ((iopte_t) { (x) } ) | ||
77 | #define __pmd(x) ((pmd_t) { (x) } ) | ||
78 | #define __pgd(x) ((pgd_t) { (x) } ) | ||
79 | #define __pgprot(x) ((pgprot_t) { (x) } ) | ||
80 | |||
81 | #else | ||
82 | /* .. while these make it easier on the compiler */ | ||
83 | typedef unsigned long pte_t; | ||
84 | typedef unsigned long iopte_t; | ||
85 | typedef unsigned int pmd_t; | ||
86 | typedef unsigned int pgd_t; | ||
87 | typedef unsigned long pgprot_t; | ||
88 | |||
89 | #define pte_val(x) (x) | ||
90 | #define iopte_val(x) (x) | ||
91 | #define pmd_val(x) (x) | ||
92 | #define pgd_val(x) (x) | ||
93 | #define pgprot_val(x) (x) | ||
94 | |||
95 | #define __pte(x) (x) | ||
96 | #define __iopte(x) (x) | ||
97 | #define __pmd(x) (x) | ||
98 | #define __pgd(x) (x) | ||
99 | #define __pgprot(x) (x) | ||
100 | |||
101 | #endif /* (STRICT_MM_TYPECHECKS) */ | ||
102 | |||
103 | typedef struct page *pgtable_t; | ||
104 | |||
105 | #define TASK_UNMAPPED_BASE (test_thread_flag(TIF_32BIT) ? \ | ||
106 | (_AC(0x0000000070000000,UL)) : \ | ||
107 | (_AC(0xfffff80000000000,UL) + (1UL << 32UL))) | ||
108 | |||
109 | #include <asm-generic/memory_model.h> | ||
110 | |||
111 | #endif /* !(__ASSEMBLY__) */ | ||
112 | |||
113 | /* to align the pointer to the (next) page boundary */ | ||
114 | #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK) | ||
115 | |||
116 | /* We used to stick this into a hard-coded global register (%g4) | ||
117 | * but that does not make sense anymore. | ||
118 | */ | ||
119 | #define PAGE_OFFSET _AC(0xFFFFF80000000000,UL) | ||
120 | |||
121 | #ifndef __ASSEMBLY__ | ||
122 | |||
123 | #define __pa(x) ((unsigned long)(x) - PAGE_OFFSET) | ||
124 | #define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET)) | ||
125 | |||
126 | #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) | ||
127 | |||
128 | #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr)>>PAGE_SHIFT) | ||
129 | |||
130 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) | ||
131 | |||
132 | #define virt_to_phys __pa | ||
133 | #define phys_to_virt __va | ||
134 | |||
135 | #endif /* !(__ASSEMBLY__) */ | ||
136 | |||
137 | #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ | ||
138 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) | ||
139 | |||
140 | #include <asm-generic/page.h> | ||
141 | |||
142 | #endif /* _SPARC64_PAGE_H */ | ||