diff options
Diffstat (limited to 'arch/mips/include/asm/pgtable-64.h')
-rw-r--r-- | arch/mips/include/asm/pgtable-64.h | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/arch/mips/include/asm/pgtable-64.h b/arch/mips/include/asm/pgtable-64.h index 8eda30b467da..26dc69d792a6 100644 --- a/arch/mips/include/asm/pgtable-64.h +++ b/arch/mips/include/asm/pgtable-64.h | |||
@@ -16,7 +16,11 @@ | |||
16 | #include <asm/cachectl.h> | 16 | #include <asm/cachectl.h> |
17 | #include <asm/fixmap.h> | 17 | #include <asm/fixmap.h> |
18 | 18 | ||
19 | #ifdef CONFIG_PAGE_SIZE_64KB | ||
20 | #include <asm-generic/pgtable-nopmd.h> | ||
21 | #else | ||
19 | #include <asm-generic/pgtable-nopud.h> | 22 | #include <asm-generic/pgtable-nopud.h> |
23 | #endif | ||
20 | 24 | ||
21 | /* | 25 | /* |
22 | * Each address space has 2 4K pages as its page directory, giving 1024 | 26 | * Each address space has 2 4K pages as its page directory, giving 1024 |
@@ -37,13 +41,20 @@ | |||
37 | * fault address - VMALLOC_START. | 41 | * fault address - VMALLOC_START. |
38 | */ | 42 | */ |
39 | 43 | ||
44 | |||
45 | /* PGDIR_SHIFT determines what a third-level page table entry can map */ | ||
46 | #ifdef __PAGETABLE_PMD_FOLDED | ||
47 | #define PGDIR_SHIFT (PAGE_SHIFT + PAGE_SHIFT + PTE_ORDER - 3) | ||
48 | #else | ||
49 | |||
40 | /* PMD_SHIFT determines the size of the area a second-level page table can map */ | 50 | /* PMD_SHIFT determines the size of the area a second-level page table can map */ |
41 | #define PMD_SHIFT (PAGE_SHIFT + (PAGE_SHIFT + PTE_ORDER - 3)) | 51 | #define PMD_SHIFT (PAGE_SHIFT + (PAGE_SHIFT + PTE_ORDER - 3)) |
42 | #define PMD_SIZE (1UL << PMD_SHIFT) | 52 | #define PMD_SIZE (1UL << PMD_SHIFT) |
43 | #define PMD_MASK (~(PMD_SIZE-1)) | 53 | #define PMD_MASK (~(PMD_SIZE-1)) |
44 | 54 | ||
45 | /* PGDIR_SHIFT determines what a third-level page table entry can map */ | 55 | |
46 | #define PGDIR_SHIFT (PMD_SHIFT + (PAGE_SHIFT + PMD_ORDER - 3)) | 56 | #define PGDIR_SHIFT (PMD_SHIFT + (PAGE_SHIFT + PMD_ORDER - 3)) |
57 | #endif | ||
47 | #define PGDIR_SIZE (1UL << PGDIR_SHIFT) | 58 | #define PGDIR_SIZE (1UL << PGDIR_SHIFT) |
48 | #define PGDIR_MASK (~(PGDIR_SIZE-1)) | 59 | #define PGDIR_MASK (~(PGDIR_SIZE-1)) |
49 | 60 | ||
@@ -92,12 +103,14 @@ | |||
92 | #ifdef CONFIG_PAGE_SIZE_64KB | 103 | #ifdef CONFIG_PAGE_SIZE_64KB |
93 | #define PGD_ORDER 0 | 104 | #define PGD_ORDER 0 |
94 | #define PUD_ORDER aieeee_attempt_to_allocate_pud | 105 | #define PUD_ORDER aieeee_attempt_to_allocate_pud |
95 | #define PMD_ORDER 0 | 106 | #define PMD_ORDER aieeee_attempt_to_allocate_pmd |
96 | #define PTE_ORDER 0 | 107 | #define PTE_ORDER 0 |
97 | #endif | 108 | #endif |
98 | 109 | ||
99 | #define PTRS_PER_PGD ((PAGE_SIZE << PGD_ORDER) / sizeof(pgd_t)) | 110 | #define PTRS_PER_PGD ((PAGE_SIZE << PGD_ORDER) / sizeof(pgd_t)) |
111 | #ifndef __PAGETABLE_PMD_FOLDED | ||
100 | #define PTRS_PER_PMD ((PAGE_SIZE << PMD_ORDER) / sizeof(pmd_t)) | 112 | #define PTRS_PER_PMD ((PAGE_SIZE << PMD_ORDER) / sizeof(pmd_t)) |
113 | #endif | ||
101 | #define PTRS_PER_PTE ((PAGE_SIZE << PTE_ORDER) / sizeof(pte_t)) | 114 | #define PTRS_PER_PTE ((PAGE_SIZE << PTE_ORDER) / sizeof(pte_t)) |
102 | 115 | ||
103 | #if PGDIR_SIZE >= TASK_SIZE | 116 | #if PGDIR_SIZE >= TASK_SIZE |
@@ -122,15 +135,30 @@ | |||
122 | 135 | ||
123 | #define pte_ERROR(e) \ | 136 | #define pte_ERROR(e) \ |
124 | printk("%s:%d: bad pte %016lx.\n", __FILE__, __LINE__, pte_val(e)) | 137 | printk("%s:%d: bad pte %016lx.\n", __FILE__, __LINE__, pte_val(e)) |
138 | #ifndef __PAGETABLE_PMD_FOLDED | ||
125 | #define pmd_ERROR(e) \ | 139 | #define pmd_ERROR(e) \ |
126 | printk("%s:%d: bad pmd %016lx.\n", __FILE__, __LINE__, pmd_val(e)) | 140 | printk("%s:%d: bad pmd %016lx.\n", __FILE__, __LINE__, pmd_val(e)) |
141 | #endif | ||
127 | #define pgd_ERROR(e) \ | 142 | #define pgd_ERROR(e) \ |
128 | printk("%s:%d: bad pgd %016lx.\n", __FILE__, __LINE__, pgd_val(e)) | 143 | printk("%s:%d: bad pgd %016lx.\n", __FILE__, __LINE__, pgd_val(e)) |
129 | 144 | ||
130 | extern pte_t invalid_pte_table[PTRS_PER_PTE]; | 145 | extern pte_t invalid_pte_table[PTRS_PER_PTE]; |
131 | extern pte_t empty_bad_page_table[PTRS_PER_PTE]; | 146 | extern pte_t empty_bad_page_table[PTRS_PER_PTE]; |
147 | |||
148 | |||
149 | #ifndef __PAGETABLE_PMD_FOLDED | ||
150 | /* | ||
151 | * For 3-level pagetables we defines these ourselves, for 2-level the | ||
152 | * definitions are supplied by <asm-generic/pgtable-nopmd.h>. | ||
153 | */ | ||
154 | typedef struct { unsigned long pmd; } pmd_t; | ||
155 | #define pmd_val(x) ((x).pmd) | ||
156 | #define __pmd(x) ((pmd_t) { (x) } ) | ||
157 | |||
158 | |||
132 | extern pmd_t invalid_pmd_table[PTRS_PER_PMD]; | 159 | extern pmd_t invalid_pmd_table[PTRS_PER_PMD]; |
133 | extern pmd_t empty_bad_pmd_table[PTRS_PER_PMD]; | 160 | extern pmd_t empty_bad_pmd_table[PTRS_PER_PMD]; |
161 | #endif | ||
134 | 162 | ||
135 | /* | 163 | /* |
136 | * Empty pgd/pmd entries point to the invalid_pte_table. | 164 | * Empty pgd/pmd entries point to the invalid_pte_table. |
@@ -151,6 +179,7 @@ static inline void pmd_clear(pmd_t *pmdp) | |||
151 | { | 179 | { |
152 | pmd_val(*pmdp) = ((unsigned long) invalid_pte_table); | 180 | pmd_val(*pmdp) = ((unsigned long) invalid_pte_table); |
153 | } | 181 | } |
182 | #ifndef __PAGETABLE_PMD_FOLDED | ||
154 | 183 | ||
155 | /* | 184 | /* |
156 | * Empty pud entries point to the invalid_pmd_table. | 185 | * Empty pud entries point to the invalid_pmd_table. |
@@ -174,6 +203,7 @@ static inline void pud_clear(pud_t *pudp) | |||
174 | { | 203 | { |
175 | pud_val(*pudp) = ((unsigned long) invalid_pmd_table); | 204 | pud_val(*pudp) = ((unsigned long) invalid_pmd_table); |
176 | } | 205 | } |
206 | #endif | ||
177 | 207 | ||
178 | #define pte_page(x) pfn_to_page(pte_pfn(x)) | 208 | #define pte_page(x) pfn_to_page(pte_pfn(x)) |
179 | 209 | ||
@@ -181,8 +211,8 @@ static inline void pud_clear(pud_t *pudp) | |||
181 | #define pte_pfn(x) ((unsigned long)((x).pte >> (PAGE_SHIFT + 2))) | 211 | #define pte_pfn(x) ((unsigned long)((x).pte >> (PAGE_SHIFT + 2))) |
182 | #define pfn_pte(pfn, prot) __pte(((pfn) << (PAGE_SHIFT + 2)) | pgprot_val(prot)) | 212 | #define pfn_pte(pfn, prot) __pte(((pfn) << (PAGE_SHIFT + 2)) | pgprot_val(prot)) |
183 | #else | 213 | #else |
184 | #define pte_pfn(x) ((unsigned long)((x).pte >> PAGE_SHIFT)) | 214 | #define pte_pfn(x) ((unsigned long)((x).pte >> _PFN_SHIFT)) |
185 | #define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot)) | 215 | #define pfn_pte(pfn, prot) __pte(((pfn) << _PFN_SHIFT) | pgprot_val(prot)) |
186 | #endif | 216 | #endif |
187 | 217 | ||
188 | #define __pgd_offset(address) pgd_index(address) | 218 | #define __pgd_offset(address) pgd_index(address) |
@@ -198,6 +228,7 @@ static inline void pud_clear(pud_t *pudp) | |||
198 | /* to find an entry in a page-table-directory */ | 228 | /* to find an entry in a page-table-directory */ |
199 | #define pgd_offset(mm, addr) ((mm)->pgd + pgd_index(addr)) | 229 | #define pgd_offset(mm, addr) ((mm)->pgd + pgd_index(addr)) |
200 | 230 | ||
231 | #ifndef __PAGETABLE_PMD_FOLDED | ||
201 | static inline unsigned long pud_page_vaddr(pud_t pud) | 232 | static inline unsigned long pud_page_vaddr(pud_t pud) |
202 | { | 233 | { |
203 | return pud_val(pud); | 234 | return pud_val(pud); |
@@ -210,6 +241,7 @@ static inline pmd_t *pmd_offset(pud_t * pud, unsigned long address) | |||
210 | { | 241 | { |
211 | return (pmd_t *) pud_page_vaddr(*pud) + pmd_index(address); | 242 | return (pmd_t *) pud_page_vaddr(*pud) + pmd_index(address); |
212 | } | 243 | } |
244 | #endif | ||
213 | 245 | ||
214 | /* Find an entry in the third-level page table.. */ | 246 | /* Find an entry in the third-level page table.. */ |
215 | #define __pte_offset(address) \ | 247 | #define __pte_offset(address) \ |