aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-ppc64/pgtable.h
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@shinybook.infradead.org>2005-05-03 03:14:09 -0400
committerDavid Woodhouse <dwmw2@shinybook.infradead.org>2005-05-03 03:14:09 -0400
commit27b030d58c8e72fc7a95187a791bd9406e350f02 (patch)
treeab3bab7f39a5ce5bab65578a7e08fa4dfdeb198c /include/asm-ppc64/pgtable.h
parent79d20b14a0d651f15b0ef9a22b6cf12d284a6d38 (diff)
parent6628465e33ca694bd8fd5c3cf4eb7ff9177bc694 (diff)
Merge with master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
Diffstat (limited to 'include/asm-ppc64/pgtable.h')
-rw-r--r--include/asm-ppc64/pgtable.h41
1 files changed, 23 insertions, 18 deletions
diff --git a/include/asm-ppc64/pgtable.h b/include/asm-ppc64/pgtable.h
index a26120517c54..b984e2747e0c 100644
--- a/include/asm-ppc64/pgtable.h
+++ b/include/asm-ppc64/pgtable.h
@@ -1,8 +1,6 @@
1#ifndef _PPC64_PGTABLE_H 1#ifndef _PPC64_PGTABLE_H
2#define _PPC64_PGTABLE_H 2#define _PPC64_PGTABLE_H
3 3
4#include <asm-generic/4level-fixup.h>
5
6/* 4/*
7 * This file contains the functions and defines necessary to modify and use 5 * This file contains the functions and defines necessary to modify and use
8 * the ppc64 hashed page table. 6 * the ppc64 hashed page table.
@@ -17,6 +15,8 @@
17#include <asm/tlbflush.h> 15#include <asm/tlbflush.h>
18#endif /* __ASSEMBLY__ */ 16#endif /* __ASSEMBLY__ */
19 17
18#include <asm-generic/pgtable-nopud.h>
19
20/* PMD_SHIFT determines what a second-level page table entry can map */ 20/* PMD_SHIFT determines what a second-level page table entry can map */
21#define PMD_SHIFT (PAGE_SHIFT + PAGE_SHIFT - 3) 21#define PMD_SHIFT (PAGE_SHIFT + PAGE_SHIFT - 3)
22#define PMD_SIZE (1UL << PMD_SHIFT) 22#define PMD_SIZE (1UL << PMD_SHIFT)
@@ -228,12 +228,13 @@ void hugetlb_mm_free_pgd(struct mm_struct *mm);
228#define pmd_page_kernel(pmd) \ 228#define pmd_page_kernel(pmd) \
229 (__bpn_to_ba(pmd_val(pmd) >> PMD_TO_PTEPAGE_SHIFT)) 229 (__bpn_to_ba(pmd_val(pmd) >> PMD_TO_PTEPAGE_SHIFT))
230#define pmd_page(pmd) virt_to_page(pmd_page_kernel(pmd)) 230#define pmd_page(pmd) virt_to_page(pmd_page_kernel(pmd))
231#define pgd_set(pgdp, pmdp) (pgd_val(*(pgdp)) = (__ba_to_bpn(pmdp))) 231
232#define pgd_none(pgd) (!pgd_val(pgd)) 232#define pud_set(pudp, pmdp) (pud_val(*(pudp)) = (__ba_to_bpn(pmdp)))
233#define pgd_bad(pgd) ((pgd_val(pgd)) == 0) 233#define pud_none(pud) (!pud_val(pud))
234#define pgd_present(pgd) (pgd_val(pgd) != 0UL) 234#define pud_bad(pud) ((pud_val(pud)) == 0UL)
235#define pgd_clear(pgdp) (pgd_val(*(pgdp)) = 0UL) 235#define pud_present(pud) (pud_val(pud) != 0UL)
236#define pgd_page(pgd) (__bpn_to_ba(pgd_val(pgd))) 236#define pud_clear(pudp) (pud_val(*(pudp)) = 0UL)
237#define pud_page(pud) (__bpn_to_ba(pud_val(pud)))
237 238
238/* 239/*
239 * Find an entry in a page-table-directory. We combine the address region 240 * Find an entry in a page-table-directory. We combine the address region
@@ -245,12 +246,13 @@ void hugetlb_mm_free_pgd(struct mm_struct *mm);
245#define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address)) 246#define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address))
246 247
247/* Find an entry in the second-level page table.. */ 248/* Find an entry in the second-level page table.. */
248#define pmd_offset(dir,addr) \ 249#define pmd_offset(pudp,addr) \
249 ((pmd_t *) pgd_page(*(dir)) + (((addr) >> PMD_SHIFT) & (PTRS_PER_PMD - 1))) 250 ((pmd_t *) pud_page(*(pudp)) + (((addr) >> PMD_SHIFT) & (PTRS_PER_PMD - 1)))
250 251
251/* Find an entry in the third-level page table.. */ 252/* Find an entry in the third-level page table.. */
252#define pte_offset_kernel(dir,addr) \ 253#define pte_offset_kernel(dir,addr) \
253 ((pte_t *) pmd_page_kernel(*(dir)) + (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))) 254 ((pte_t *) pmd_page_kernel(*(dir)) \
255 + (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)))
254 256
255#define pte_offset_map(dir,addr) pte_offset_kernel((dir), (addr)) 257#define pte_offset_map(dir,addr) pte_offset_kernel((dir), (addr))
256#define pte_offset_map_nested(dir,addr) pte_offset_kernel((dir), (addr)) 258#define pte_offset_map_nested(dir,addr) pte_offset_kernel((dir), (addr))
@@ -582,19 +584,22 @@ extern long native_hpte_insert(unsigned long hpte_group, unsigned long va,
582static inline pte_t *find_linux_pte(pgd_t *pgdir, unsigned long ea) 584static inline pte_t *find_linux_pte(pgd_t *pgdir, unsigned long ea)
583{ 585{
584 pgd_t *pg; 586 pgd_t *pg;
587 pud_t *pu;
585 pmd_t *pm; 588 pmd_t *pm;
586 pte_t *pt = NULL; 589 pte_t *pt = NULL;
587 pte_t pte; 590 pte_t pte;
588 591
589 pg = pgdir + pgd_index(ea); 592 pg = pgdir + pgd_index(ea);
590 if (!pgd_none(*pg)) { 593 if (!pgd_none(*pg)) {
591 594 pu = pud_offset(pg, ea);
592 pm = pmd_offset(pg, ea); 595 if (!pud_none(*pu)) {
593 if (pmd_present(*pm)) { 596 pm = pmd_offset(pu, ea);
594 pt = pte_offset_kernel(pm, ea); 597 if (pmd_present(*pm)) {
595 pte = *pt; 598 pt = pte_offset_kernel(pm, ea);
596 if (!pte_present(pte)) 599 pte = *pt;
597 pt = NULL; 600 if (!pte_present(pte))
601 pt = NULL;
602 }
598 } 603 }
599 } 604 }
600 605