diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2007-05-07 22:46:49 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-05-07 23:40:31 -0400 |
commit | d1953c8888ef034b912ee33bc2ea2cce6a414402 (patch) | |
tree | 525e581603a2dd8622b821304440b6ce14b535ae /arch | |
parent | 00c2ae35bd50664bcd841becc6efceef8aa5d074 (diff) |
[POWERPC] Remove use of 4level-fixup.h for ppc32
For 32-bit systems, powerpc still relies on the 4level-fixup.h hack,
to pretend that the generic pagetable handling stuff is 3-levels
rather than 4. This patch removes this, instead using the newer
pgtable-nopmd.h to handle the elision of both the pud and pmd
pagetable levels (ppc32 pagetables are actually 2 levels).
This removes a little extraneous code, and makes it more easily
compared to the 64-bit pagetable code.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/lib/dma-noncoherent.c | 4 | ||||
-rw-r--r-- | arch/powerpc/mm/pgtable_32.c | 28 |
2 files changed, 19 insertions, 13 deletions
diff --git a/arch/powerpc/lib/dma-noncoherent.c b/arch/powerpc/lib/dma-noncoherent.c index 48f3d13a3de5..6656d47841d0 100644 --- a/arch/powerpc/lib/dma-noncoherent.c +++ b/arch/powerpc/lib/dma-noncoherent.c | |||
@@ -306,13 +306,15 @@ EXPORT_SYMBOL(__dma_free_coherent); | |||
306 | static int __init dma_alloc_init(void) | 306 | static int __init dma_alloc_init(void) |
307 | { | 307 | { |
308 | pgd_t *pgd; | 308 | pgd_t *pgd; |
309 | pud_t *pud; | ||
309 | pmd_t *pmd; | 310 | pmd_t *pmd; |
310 | pte_t *pte; | 311 | pte_t *pte; |
311 | int ret = 0; | 312 | int ret = 0; |
312 | 313 | ||
313 | do { | 314 | do { |
314 | pgd = pgd_offset(&init_mm, CONSISTENT_BASE); | 315 | pgd = pgd_offset(&init_mm, CONSISTENT_BASE); |
315 | pmd = pmd_alloc(&init_mm, pgd, CONSISTENT_BASE); | 316 | pud = pud_alloc(&init_mm, pgd, CONSISTENT_BASE); |
317 | pmd = pmd_alloc(&init_mm, pud, CONSISTENT_BASE); | ||
316 | if (!pmd) { | 318 | if (!pmd) { |
317 | printk(KERN_ERR "%s: no pmd tables\n", __func__); | 319 | printk(KERN_ERR "%s: no pmd tables\n", __func__); |
318 | ret = -ENOMEM; | 320 | ret = -ENOMEM; |
diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c index bca560374927..d8232b7a08f7 100644 --- a/arch/powerpc/mm/pgtable_32.c +++ b/arch/powerpc/mm/pgtable_32.c | |||
@@ -261,7 +261,7 @@ int map_page(unsigned long va, phys_addr_t pa, int flags) | |||
261 | int err = -ENOMEM; | 261 | int err = -ENOMEM; |
262 | 262 | ||
263 | /* Use upper 10 bits of VA to index the first level map */ | 263 | /* Use upper 10 bits of VA to index the first level map */ |
264 | pd = pmd_offset(pgd_offset_k(va), va); | 264 | pd = pmd_offset(pud_offset(pgd_offset_k(va), va), va); |
265 | /* Use middle 10 bits of VA to index the second-level map */ | 265 | /* Use middle 10 bits of VA to index the second-level map */ |
266 | pg = pte_alloc_kernel(pd, va); | 266 | pg = pte_alloc_kernel(pd, va); |
267 | if (pg != 0) { | 267 | if (pg != 0) { |
@@ -354,23 +354,27 @@ int | |||
354 | get_pteptr(struct mm_struct *mm, unsigned long addr, pte_t **ptep, pmd_t **pmdp) | 354 | get_pteptr(struct mm_struct *mm, unsigned long addr, pte_t **ptep, pmd_t **pmdp) |
355 | { | 355 | { |
356 | pgd_t *pgd; | 356 | pgd_t *pgd; |
357 | pud_t *pud; | ||
357 | pmd_t *pmd; | 358 | pmd_t *pmd; |
358 | pte_t *pte; | 359 | pte_t *pte; |
359 | int retval = 0; | 360 | int retval = 0; |
360 | 361 | ||
361 | pgd = pgd_offset(mm, addr & PAGE_MASK); | 362 | pgd = pgd_offset(mm, addr & PAGE_MASK); |
362 | if (pgd) { | 363 | if (pgd) { |
363 | pmd = pmd_offset(pgd, addr & PAGE_MASK); | 364 | pud = pud_offset(pgd, addr & PAGE_MASK); |
364 | if (pmd_present(*pmd)) { | 365 | if (pud && pud_present(*pud)) { |
365 | pte = pte_offset_map(pmd, addr & PAGE_MASK); | 366 | pmd = pmd_offset(pud, addr & PAGE_MASK); |
366 | if (pte) { | 367 | if (pmd_present(*pmd)) { |
367 | retval = 1; | 368 | pte = pte_offset_map(pmd, addr & PAGE_MASK); |
368 | *ptep = pte; | 369 | if (pte) { |
369 | if (pmdp) | 370 | retval = 1; |
370 | *pmdp = pmd; | 371 | *ptep = pte; |
371 | /* XXX caller needs to do pte_unmap, yuck */ | 372 | if (pmdp) |
372 | } | 373 | *pmdp = pmd; |
373 | } | 374 | /* XXX caller needs to do pte_unmap, yuck */ |
375 | } | ||
376 | } | ||
377 | } | ||
374 | } | 378 | } |
375 | return(retval); | 379 | return(retval); |
376 | } | 380 | } |