diff options
Diffstat (limited to 'include/asm-mips/pgtable.h')
-rw-r--r-- | include/asm-mips/pgtable.h | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/include/asm-mips/pgtable.h b/include/asm-mips/pgtable.h index cbd1672c94cb..702a28fa7a34 100644 --- a/include/asm-mips/pgtable.h +++ b/include/asm-mips/pgtable.h | |||
@@ -8,8 +8,6 @@ | |||
8 | #ifndef _ASM_PGTABLE_H | 8 | #ifndef _ASM_PGTABLE_H |
9 | #define _ASM_PGTABLE_H | 9 | #define _ASM_PGTABLE_H |
10 | 10 | ||
11 | #include <asm-generic/4level-fixup.h> | ||
12 | |||
13 | #include <linux/config.h> | 11 | #include <linux/config.h> |
14 | #ifdef CONFIG_32BIT | 12 | #ifdef CONFIG_32BIT |
15 | #include <asm/pgtable-32.h> | 13 | #include <asm/pgtable-32.h> |
@@ -18,8 +16,12 @@ | |||
18 | #include <asm/pgtable-64.h> | 16 | #include <asm/pgtable-64.h> |
19 | #endif | 17 | #endif |
20 | 18 | ||
19 | #include <asm/io.h> | ||
21 | #include <asm/pgtable-bits.h> | 20 | #include <asm/pgtable-bits.h> |
22 | 21 | ||
22 | struct mm_struct; | ||
23 | struct vm_area_struct; | ||
24 | |||
23 | #define PAGE_NONE __pgprot(_PAGE_PRESENT | _CACHE_CACHABLE_NONCOHERENT) | 25 | #define PAGE_NONE __pgprot(_PAGE_PRESENT | _CACHE_CACHABLE_NONCOHERENT) |
24 | #define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE | \ | 26 | #define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE | \ |
25 | PAGE_CACHABLE_DEFAULT) | 27 | PAGE_CACHABLE_DEFAULT) |
@@ -68,13 +70,14 @@ extern unsigned long zero_page_mask; | |||
68 | #define ZERO_PAGE(vaddr) \ | 70 | #define ZERO_PAGE(vaddr) \ |
69 | (virt_to_page(empty_zero_page + (((unsigned long)(vaddr)) & zero_page_mask))) | 71 | (virt_to_page(empty_zero_page + (((unsigned long)(vaddr)) & zero_page_mask))) |
70 | 72 | ||
73 | #define __HAVE_ARCH_MULTIPLE_ZERO_PAGE | ||
74 | |||
71 | extern void paging_init(void); | 75 | extern void paging_init(void); |
72 | 76 | ||
73 | /* | 77 | /* |
74 | * Conversion functions: convert a page and protection to a page entry, | 78 | * Conversion functions: convert a page and protection to a page entry, |
75 | * and a page entry and page directory to the page they refer to. | 79 | * and a page entry and page directory to the page they refer to. |
76 | */ | 80 | */ |
77 | #define page_pte(page) page_pte_prot(page, __pgprot(0)) | ||
78 | #define pmd_phys(pmd) (pmd_val(pmd) - PAGE_OFFSET) | 81 | #define pmd_phys(pmd) (pmd_val(pmd) - PAGE_OFFSET) |
79 | #define pmd_page(pmd) (pfn_to_page(pmd_phys(pmd) >> PAGE_SHIFT)) | 82 | #define pmd_page(pmd) (pfn_to_page(pmd_phys(pmd) >> PAGE_SHIFT)) |
80 | #define pmd_page_kernel(pmd) pmd_val(pmd) | 83 | #define pmd_page_kernel(pmd) pmd_val(pmd) |
@@ -82,7 +85,7 @@ extern void paging_init(void); | |||
82 | #define pte_none(pte) (!(pte_val(pte) & ~_PAGE_GLOBAL)) | 85 | #define pte_none(pte) (!(pte_val(pte) & ~_PAGE_GLOBAL)) |
83 | #define pte_present(pte) (pte_val(pte) & _PAGE_PRESENT) | 86 | #define pte_present(pte) (pte_val(pte) & _PAGE_PRESENT) |
84 | 87 | ||
85 | #if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32) | 88 | #if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32_R1) |
86 | static inline void set_pte(pte_t *ptep, pte_t pte) | 89 | static inline void set_pte(pte_t *ptep, pte_t pte) |
87 | { | 90 | { |
88 | ptep->pte_high = pte.pte_high; | 91 | ptep->pte_high = pte.pte_high; |
@@ -146,11 +149,18 @@ static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *pt | |||
146 | #endif | 149 | #endif |
147 | 150 | ||
148 | /* | 151 | /* |
149 | * (pmds are folded into pgds so this doesn't get actually called, | 152 | * (pmds are folded into puds so this doesn't get actually called, |
150 | * but the define is needed for a generic inline function.) | 153 | * but the define is needed for a generic inline function.) |
151 | */ | 154 | */ |
152 | #define set_pmd(pmdptr, pmdval) do { *(pmdptr) = (pmdval); } while(0) | 155 | #define set_pmd(pmdptr, pmdval) do { *(pmdptr) = (pmdval); } while(0) |
153 | #define set_pgd(pgdptr, pgdval) do { *(pgdptr) = (pgdval); } while(0) | 156 | |
157 | #ifdef CONFIG_64BIT | ||
158 | /* | ||
159 | * (puds are folded into pgds so this doesn't get actually called, | ||
160 | * but the define is needed for a generic inline function.) | ||
161 | */ | ||
162 | #define set_pud(pudptr, pudval) do { *(pudptr) = (pudval); } while(0) | ||
163 | #endif | ||
154 | 164 | ||
155 | #define PGD_T_LOG2 ffz(~sizeof(pgd_t)) | 165 | #define PGD_T_LOG2 ffz(~sizeof(pgd_t)) |
156 | #define PMD_T_LOG2 ffz(~sizeof(pmd_t)) | 166 | #define PMD_T_LOG2 ffz(~sizeof(pmd_t)) |
@@ -163,7 +173,7 @@ extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; | |||
163 | * Undefined behaviour if not.. | 173 | * Undefined behaviour if not.. |
164 | */ | 174 | */ |
165 | static inline int pte_user(pte_t pte) { BUG(); return 0; } | 175 | static inline int pte_user(pte_t pte) { BUG(); return 0; } |
166 | #if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32) | 176 | #if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32_R1) |
167 | static inline int pte_read(pte_t pte) { return (pte).pte_low & _PAGE_READ; } | 177 | static inline int pte_read(pte_t pte) { return (pte).pte_low & _PAGE_READ; } |
168 | static inline int pte_write(pte_t pte) { return (pte).pte_low & _PAGE_WRITE; } | 178 | static inline int pte_write(pte_t pte) { return (pte).pte_low & _PAGE_WRITE; } |
169 | static inline int pte_dirty(pte_t pte) { return (pte).pte_low & _PAGE_MODIFIED; } | 179 | static inline int pte_dirty(pte_t pte) { return (pte).pte_low & _PAGE_MODIFIED; } |
@@ -322,7 +332,7 @@ static inline pgprot_t pgprot_noncached(pgprot_t _prot) | |||
322 | */ | 332 | */ |
323 | #define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot)) | 333 | #define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot)) |
324 | 334 | ||
325 | #if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32) | 335 | #if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32_R1) |
326 | static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | 336 | static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) |
327 | { | 337 | { |
328 | pte.pte_low &= _PAGE_CHG_MASK; | 338 | pte.pte_low &= _PAGE_CHG_MASK; |
@@ -355,7 +365,6 @@ static inline void update_mmu_cache(struct vm_area_struct *vma, | |||
355 | #endif | 365 | #endif |
356 | 366 | ||
357 | #ifdef CONFIG_64BIT_PHYS_ADDR | 367 | #ifdef CONFIG_64BIT_PHYS_ADDR |
358 | extern phys_t fixup_bigphys_addr(phys_t phys_addr, phys_t size); | ||
359 | extern int remap_pfn_range(struct vm_area_struct *vma, unsigned long from, unsigned long pfn, unsigned long size, pgprot_t prot); | 368 | extern int remap_pfn_range(struct vm_area_struct *vma, unsigned long from, unsigned long pfn, unsigned long size, pgprot_t prot); |
360 | 369 | ||
361 | static inline int io_remap_pfn_range(struct vm_area_struct *vma, | 370 | static inline int io_remap_pfn_range(struct vm_area_struct *vma, |
@@ -365,7 +374,7 @@ static inline int io_remap_pfn_range(struct vm_area_struct *vma, | |||
365 | pgprot_t prot) | 374 | pgprot_t prot) |
366 | { | 375 | { |
367 | phys_t phys_addr_high = fixup_bigphys_addr(pfn << PAGE_SHIFT, size); | 376 | phys_t phys_addr_high = fixup_bigphys_addr(pfn << PAGE_SHIFT, size); |
368 | return remap_pfn_range(vma, vaddr, pfn, size, prot); | 377 | return remap_pfn_range(vma, vaddr, phys_addr_high >> PAGE_SHIFT, size, prot); |
369 | } | 378 | } |
370 | #else | 379 | #else |
371 | #define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \ | 380 | #define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \ |