diff options
-rw-r--r-- | arch/powerpc/lib/dma-noncoherent.c | 4 | ||||
-rw-r--r-- | arch/powerpc/mm/pgtable_32.c | 28 | ||||
-rw-r--r-- | include/asm-powerpc/page.h | 12 | ||||
-rw-r--r-- | include/asm-powerpc/pgalloc-32.h | 4 | ||||
-rw-r--r-- | include/asm-powerpc/pgtable-ppc32.h | 30 |
5 files changed, 31 insertions, 47 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 | } |
diff --git a/include/asm-powerpc/page.h b/include/asm-powerpc/page.h index f37bff0ee889..10c51f457d48 100644 --- a/include/asm-powerpc/page.h +++ b/include/asm-powerpc/page.h | |||
@@ -121,16 +121,18 @@ typedef struct { pte_t pte; } real_pte_t; | |||
121 | #endif | 121 | #endif |
122 | 122 | ||
123 | /* PMD level */ | 123 | /* PMD level */ |
124 | #ifdef CONFIG_PPC64 | ||
124 | typedef struct { unsigned long pmd; } pmd_t; | 125 | typedef struct { unsigned long pmd; } pmd_t; |
125 | #define pmd_val(x) ((x).pmd) | 126 | #define pmd_val(x) ((x).pmd) |
126 | #define __pmd(x) ((pmd_t) { (x) }) | 127 | #define __pmd(x) ((pmd_t) { (x) }) |
127 | 128 | ||
128 | /* PUD level exusts only on 4k pages */ | 129 | /* PUD level exusts only on 4k pages */ |
129 | #if defined(CONFIG_PPC64) && !defined(CONFIG_PPC_64K_PAGES) | 130 | #ifndef CONFIG_PPC_64K_PAGES |
130 | typedef struct { unsigned long pud; } pud_t; | 131 | typedef struct { unsigned long pud; } pud_t; |
131 | #define pud_val(x) ((x).pud) | 132 | #define pud_val(x) ((x).pud) |
132 | #define __pud(x) ((pud_t) { (x) }) | 133 | #define __pud(x) ((pud_t) { (x) }) |
133 | #endif | 134 | #endif /* !CONFIG_PPC_64K_PAGES */ |
135 | #endif /* CONFIG_PPC64 */ | ||
134 | 136 | ||
135 | /* PGD level */ | 137 | /* PGD level */ |
136 | typedef struct { unsigned long pgd; } pgd_t; | 138 | typedef struct { unsigned long pgd; } pgd_t; |
@@ -159,15 +161,17 @@ typedef unsigned long real_pte_t; | |||
159 | #endif | 161 | #endif |
160 | 162 | ||
161 | 163 | ||
164 | #ifdef CONFIG_PPC64 | ||
162 | typedef unsigned long pmd_t; | 165 | typedef unsigned long pmd_t; |
163 | #define pmd_val(x) (x) | 166 | #define pmd_val(x) (x) |
164 | #define __pmd(x) (x) | 167 | #define __pmd(x) (x) |
165 | 168 | ||
166 | #if defined(CONFIG_PPC64) && !defined(CONFIG_PPC_64K_PAGES) | 169 | #ifndef CONFIG_PPC_64K_PAGES |
167 | typedef unsigned long pud_t; | 170 | typedef unsigned long pud_t; |
168 | #define pud_val(x) (x) | 171 | #define pud_val(x) (x) |
169 | #define __pud(x) (x) | 172 | #define __pud(x) (x) |
170 | #endif | 173 | #endif /* !CONFIG_PPC_64K_PAGES */ |
174 | #endif /* CONFIG_PPC64 */ | ||
171 | 175 | ||
172 | typedef unsigned long pgd_t; | 176 | typedef unsigned long pgd_t; |
173 | #define pgd_val(x) (x) | 177 | #define pgd_val(x) (x) |
diff --git a/include/asm-powerpc/pgalloc-32.h b/include/asm-powerpc/pgalloc-32.h index 235aef283edf..e1307432163c 100644 --- a/include/asm-powerpc/pgalloc-32.h +++ b/include/asm-powerpc/pgalloc-32.h | |||
@@ -12,10 +12,10 @@ extern void pgd_free(pgd_t *pgd); | |||
12 | * We don't have any real pmd's, and this code never triggers because | 12 | * We don't have any real pmd's, and this code never triggers because |
13 | * the pgd will always be present.. | 13 | * the pgd will always be present.. |
14 | */ | 14 | */ |
15 | #define pmd_alloc_one(mm,address) ({ BUG(); ((pmd_t *)2); }) | 15 | /* #define pmd_alloc_one(mm,address) ({ BUG(); ((pmd_t *)2); }) */ |
16 | #define pmd_free(x) do { } while (0) | 16 | #define pmd_free(x) do { } while (0) |
17 | #define __pmd_free_tlb(tlb,x) do { } while (0) | 17 | #define __pmd_free_tlb(tlb,x) do { } while (0) |
18 | #define pgd_populate(mm, pmd, pte) BUG() | 18 | /* #define pgd_populate(mm, pmd, pte) BUG() */ |
19 | 19 | ||
20 | #ifndef CONFIG_BOOKE | 20 | #ifndef CONFIG_BOOKE |
21 | #define pmd_populate_kernel(mm, pmd, pte) \ | 21 | #define pmd_populate_kernel(mm, pmd, pte) \ |
diff --git a/include/asm-powerpc/pgtable-ppc32.h b/include/asm-powerpc/pgtable-ppc32.h index e704640b3e48..09662a24f226 100644 --- a/include/asm-powerpc/pgtable-ppc32.h +++ b/include/asm-powerpc/pgtable-ppc32.h | |||
@@ -1,7 +1,7 @@ | |||
1 | #ifndef _ASM_POWERPC_PGTABLE_PPC32_H | 1 | #ifndef _ASM_POWERPC_PGTABLE_PPC32_H |
2 | #define _ASM_POWERPC_PGTABLE_PPC32_H | 2 | #define _ASM_POWERPC_PGTABLE_PPC32_H |
3 | 3 | ||
4 | #include <asm-generic/4level-fixup.h> | 4 | #include <asm-generic/pgtable-nopmd.h> |
5 | 5 | ||
6 | #ifndef __ASSEMBLY__ | 6 | #ifndef __ASSEMBLY__ |
7 | #include <linux/sched.h> | 7 | #include <linux/sched.h> |
@@ -76,13 +76,8 @@ extern unsigned long ioremap_bot, ioremap_base; | |||
76 | * level has 2048 entries and the second level has 512 64-bit PTE entries. | 76 | * level has 2048 entries and the second level has 512 64-bit PTE entries. |
77 | * -Matt | 77 | * -Matt |
78 | */ | 78 | */ |
79 | /* PMD_SHIFT determines the size of the area mapped by the PTE pages */ | ||
80 | #define PMD_SHIFT (PAGE_SHIFT + PTE_SHIFT) | ||
81 | #define PMD_SIZE (1UL << PMD_SHIFT) | ||
82 | #define PMD_MASK (~(PMD_SIZE-1)) | ||
83 | |||
84 | /* PGDIR_SHIFT determines what a top-level page table entry can map */ | 79 | /* PGDIR_SHIFT determines what a top-level page table entry can map */ |
85 | #define PGDIR_SHIFT PMD_SHIFT | 80 | #define PGDIR_SHIFT (PAGE_SHIFT + PTE_SHIFT) |
86 | #define PGDIR_SIZE (1UL << PGDIR_SHIFT) | 81 | #define PGDIR_SIZE (1UL << PGDIR_SHIFT) |
87 | #define PGDIR_MASK (~(PGDIR_SIZE-1)) | 82 | #define PGDIR_MASK (~(PGDIR_SIZE-1)) |
88 | 83 | ||
@@ -103,8 +98,6 @@ extern unsigned long ioremap_bot, ioremap_base; | |||
103 | #define pte_ERROR(e) \ | 98 | #define pte_ERROR(e) \ |
104 | printk("%s:%d: bad pte %llx.\n", __FILE__, __LINE__, \ | 99 | printk("%s:%d: bad pte %llx.\n", __FILE__, __LINE__, \ |
105 | (unsigned long long)pte_val(e)) | 100 | (unsigned long long)pte_val(e)) |
106 | #define pmd_ERROR(e) \ | ||
107 | printk("%s:%d: bad pmd %08lx.\n", __FILE__, __LINE__, pmd_val(e)) | ||
108 | #define pgd_ERROR(e) \ | 101 | #define pgd_ERROR(e) \ |
109 | printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e)) | 102 | printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e)) |
110 | 103 | ||
@@ -516,19 +509,6 @@ extern unsigned long empty_zero_page[1024]; | |||
516 | 509 | ||
517 | #ifndef __ASSEMBLY__ | 510 | #ifndef __ASSEMBLY__ |
518 | /* | 511 | /* |
519 | * The "pgd_xxx()" functions here are trivial for a folded two-level | ||
520 | * setup: the pgd is never bad, and a pmd always exists (as it's folded | ||
521 | * into the pgd entry) | ||
522 | */ | ||
523 | static inline int pgd_none(pgd_t pgd) { return 0; } | ||
524 | static inline int pgd_bad(pgd_t pgd) { return 0; } | ||
525 | static inline int pgd_present(pgd_t pgd) { return 1; } | ||
526 | #define pgd_clear(xp) do { } while (0) | ||
527 | |||
528 | #define pgd_page_vaddr(pgd) \ | ||
529 | ((unsigned long) __va(pgd_val(pgd) & PAGE_MASK)) | ||
530 | |||
531 | /* | ||
532 | * The following only work if pte_present() is true. | 512 | * The following only work if pte_present() is true. |
533 | * Undefined behaviour if not.. | 513 | * Undefined behaviour if not.. |
534 | */ | 514 | */ |
@@ -737,12 +717,6 @@ extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn, | |||
737 | #define pgd_index(address) ((address) >> PGDIR_SHIFT) | 717 | #define pgd_index(address) ((address) >> PGDIR_SHIFT) |
738 | #define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address)) | 718 | #define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address)) |
739 | 719 | ||
740 | /* Find an entry in the second-level page table.. */ | ||
741 | static inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address) | ||
742 | { | ||
743 | return (pmd_t *) dir; | ||
744 | } | ||
745 | |||
746 | /* Find an entry in the third-level page table.. */ | 720 | /* Find an entry in the third-level page table.. */ |
747 | #define pte_index(address) \ | 721 | #define pte_index(address) \ |
748 | (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) | 722 | (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) |