aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/lib/dma-noncoherent.c4
-rw-r--r--arch/powerpc/mm/pgtable_32.c28
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);
306static int __init dma_alloc_init(void) 306static 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
354get_pteptr(struct mm_struct *mm, unsigned long addr, pte_t **ptep, pmd_t **pmdp) 354get_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}