diff options
Diffstat (limited to 'arch/arm/mm/mm-armv.c')
-rw-r--r-- | arch/arm/mm/mm-armv.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/arch/arm/mm/mm-armv.c b/arch/arm/mm/mm-armv.c index 585dfb8e20b9..2a514b05cd5c 100644 --- a/arch/arm/mm/mm-armv.c +++ b/arch/arm/mm/mm-armv.c | |||
@@ -142,6 +142,16 @@ __setup("noalign", noalign_setup); | |||
142 | 142 | ||
143 | #define FIRST_KERNEL_PGD_NR (FIRST_USER_PGD_NR + USER_PTRS_PER_PGD) | 143 | #define FIRST_KERNEL_PGD_NR (FIRST_USER_PGD_NR + USER_PTRS_PER_PGD) |
144 | 144 | ||
145 | static inline pmd_t *pmd_off(pgd_t *pgd, unsigned long virt) | ||
146 | { | ||
147 | return pmd_offset(pgd, virt); | ||
148 | } | ||
149 | |||
150 | static inline pmd_t *pmd_off_k(unsigned long virt) | ||
151 | { | ||
152 | return pmd_off(pgd_offset_k(virt), virt); | ||
153 | } | ||
154 | |||
145 | /* | 155 | /* |
146 | * need to get a 16k page for level 1 | 156 | * need to get a 16k page for level 1 |
147 | */ | 157 | */ |
@@ -220,7 +230,7 @@ void free_pgd_slow(pgd_t *pgd) | |||
220 | return; | 230 | return; |
221 | 231 | ||
222 | /* pgd is always present and good */ | 232 | /* pgd is always present and good */ |
223 | pmd = (pmd_t *)pgd; | 233 | pmd = pmd_off(pgd, 0); |
224 | if (pmd_none(*pmd)) | 234 | if (pmd_none(*pmd)) |
225 | goto free; | 235 | goto free; |
226 | if (pmd_bad(*pmd)) { | 236 | if (pmd_bad(*pmd)) { |
@@ -246,9 +256,8 @@ free: | |||
246 | static inline void | 256 | static inline void |
247 | alloc_init_section(unsigned long virt, unsigned long phys, int prot) | 257 | alloc_init_section(unsigned long virt, unsigned long phys, int prot) |
248 | { | 258 | { |
249 | pmd_t *pmdp; | 259 | pmd_t *pmdp = pmd_off_k(virt); |
250 | 260 | ||
251 | pmdp = pmd_offset(pgd_offset_k(virt), virt); | ||
252 | if (virt & (1 << 20)) | 261 | if (virt & (1 << 20)) |
253 | pmdp++; | 262 | pmdp++; |
254 | 263 | ||
@@ -283,11 +292,9 @@ alloc_init_supersection(unsigned long virt, unsigned long phys, int prot) | |||
283 | static inline void | 292 | static inline void |
284 | alloc_init_page(unsigned long virt, unsigned long phys, unsigned int prot_l1, pgprot_t prot) | 293 | alloc_init_page(unsigned long virt, unsigned long phys, unsigned int prot_l1, pgprot_t prot) |
285 | { | 294 | { |
286 | pmd_t *pmdp; | 295 | pmd_t *pmdp = pmd_off_k(virt); |
287 | pte_t *ptep; | 296 | pte_t *ptep; |
288 | 297 | ||
289 | pmdp = pmd_offset(pgd_offset_k(virt), virt); | ||
290 | |||
291 | if (pmd_none(*pmdp)) { | 298 | if (pmd_none(*pmdp)) { |
292 | unsigned long pmdval; | 299 | unsigned long pmdval; |
293 | ptep = alloc_bootmem_low_pages(2 * PTRS_PER_PTE * | 300 | ptep = alloc_bootmem_low_pages(2 * PTRS_PER_PTE * |
@@ -310,7 +317,7 @@ alloc_init_page(unsigned long virt, unsigned long phys, unsigned int prot_l1, pg | |||
310 | */ | 317 | */ |
311 | static inline void clear_mapping(unsigned long virt) | 318 | static inline void clear_mapping(unsigned long virt) |
312 | { | 319 | { |
313 | pmd_clear(pmd_offset(pgd_offset_k(virt), virt)); | 320 | pmd_clear(pmd_off_k(virt)); |
314 | } | 321 | } |
315 | 322 | ||
316 | struct mem_types { | 323 | struct mem_types { |
@@ -578,7 +585,7 @@ void setup_mm_for_reboot(char mode) | |||
578 | PMD_TYPE_SECT; | 585 | PMD_TYPE_SECT; |
579 | if (cpu_arch <= CPU_ARCH_ARMv5) | 586 | if (cpu_arch <= CPU_ARCH_ARMv5) |
580 | pmdval |= PMD_BIT4; | 587 | pmdval |= PMD_BIT4; |
581 | pmd = pmd_offset(pgd + i, i << PGDIR_SHIFT); | 588 | pmd = pmd_off(pgd, i << PGDIR_SHIFT); |
582 | pmd[0] = __pmd(pmdval); | 589 | pmd[0] = __pmd(pmdval); |
583 | pmd[1] = __pmd(pmdval + (1 << (PGDIR_SHIFT - 1))); | 590 | pmd[1] = __pmd(pmdval + (1 << (PGDIR_SHIFT - 1))); |
584 | flush_pmd_entry(pmd); | 591 | flush_pmd_entry(pmd); |