aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-mips/pgtable.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-mips/pgtable.h')
-rw-r--r--include/asm-mips/pgtable.h24
1 files changed, 14 insertions, 10 deletions
diff --git a/include/asm-mips/pgtable.h b/include/asm-mips/pgtable.h
index eaf5d9b3a0e1..34facd996503 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,6 +16,7 @@
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
23#define PAGE_NONE __pgprot(_PAGE_PRESENT | _CACHE_CACHABLE_NONCOHERENT) 22#define PAGE_NONE __pgprot(_PAGE_PRESENT | _CACHE_CACHABLE_NONCOHERENT)
@@ -76,7 +75,6 @@ extern void paging_init(void);
76 * Conversion functions: convert a page and protection to a page entry, 75 * Conversion functions: convert a page and protection to a page entry,
77 * and a page entry and page directory to the page they refer to. 76 * and a page entry and page directory to the page they refer to.
78 */ 77 */
79#define page_pte(page) page_pte_prot(page, __pgprot(0))
80#define pmd_phys(pmd) (pmd_val(pmd) - PAGE_OFFSET) 78#define pmd_phys(pmd) (pmd_val(pmd) - PAGE_OFFSET)
81#define pmd_page(pmd) (pfn_to_page(pmd_phys(pmd) >> PAGE_SHIFT)) 79#define pmd_page(pmd) (pfn_to_page(pmd_phys(pmd) >> PAGE_SHIFT))
82#define pmd_page_kernel(pmd) pmd_val(pmd) 80#define pmd_page_kernel(pmd) pmd_val(pmd)
@@ -84,7 +82,7 @@ extern void paging_init(void);
84#define pte_none(pte) (!(pte_val(pte) & ~_PAGE_GLOBAL)) 82#define pte_none(pte) (!(pte_val(pte) & ~_PAGE_GLOBAL))
85#define pte_present(pte) (pte_val(pte) & _PAGE_PRESENT) 83#define pte_present(pte) (pte_val(pte) & _PAGE_PRESENT)
86 84
87#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32) 85#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32_R1)
88static inline void set_pte(pte_t *ptep, pte_t pte) 86static inline void set_pte(pte_t *ptep, pte_t pte)
89{ 87{
90 ptep->pte_high = pte.pte_high; 88 ptep->pte_high = pte.pte_high;
@@ -148,11 +146,18 @@ static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *pt
148#endif 146#endif
149 147
150/* 148/*
151 * (pmds are folded into pgds so this doesn't get actually called, 149 * (pmds are folded into puds so this doesn't get actually called,
152 * but the define is needed for a generic inline function.) 150 * but the define is needed for a generic inline function.)
153 */ 151 */
154#define set_pmd(pmdptr, pmdval) do { *(pmdptr) = (pmdval); } while(0) 152#define set_pmd(pmdptr, pmdval) do { *(pmdptr) = (pmdval); } while(0)
155#define set_pgd(pgdptr, pgdval) do { *(pgdptr) = (pgdval); } while(0) 153
154#ifdef CONFIG_64BIT
155/*
156 * (puds are folded into pgds so this doesn't get actually called,
157 * but the define is needed for a generic inline function.)
158 */
159#define set_pud(pudptr, pudval) do { *(pudptr) = (pudval); } while(0)
160#endif
156 161
157#define PGD_T_LOG2 ffz(~sizeof(pgd_t)) 162#define PGD_T_LOG2 ffz(~sizeof(pgd_t))
158#define PMD_T_LOG2 ffz(~sizeof(pmd_t)) 163#define PMD_T_LOG2 ffz(~sizeof(pmd_t))
@@ -165,7 +170,7 @@ extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
165 * Undefined behaviour if not.. 170 * Undefined behaviour if not..
166 */ 171 */
167static inline int pte_user(pte_t pte) { BUG(); return 0; } 172static inline int pte_user(pte_t pte) { BUG(); return 0; }
168#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32) 173#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32_R1)
169static inline int pte_read(pte_t pte) { return (pte).pte_low & _PAGE_READ; } 174static inline int pte_read(pte_t pte) { return (pte).pte_low & _PAGE_READ; }
170static inline int pte_write(pte_t pte) { return (pte).pte_low & _PAGE_WRITE; } 175static inline int pte_write(pte_t pte) { return (pte).pte_low & _PAGE_WRITE; }
171static inline int pte_dirty(pte_t pte) { return (pte).pte_low & _PAGE_MODIFIED; } 176static inline int pte_dirty(pte_t pte) { return (pte).pte_low & _PAGE_MODIFIED; }
@@ -324,7 +329,7 @@ static inline pgprot_t pgprot_noncached(pgprot_t _prot)
324 */ 329 */
325#define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot)) 330#define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot))
326 331
327#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32) 332#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32_R1)
328static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) 333static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
329{ 334{
330 pte.pte_low &= _PAGE_CHG_MASK; 335 pte.pte_low &= _PAGE_CHG_MASK;
@@ -357,7 +362,6 @@ static inline void update_mmu_cache(struct vm_area_struct *vma,
357#endif 362#endif
358 363
359#ifdef CONFIG_64BIT_PHYS_ADDR 364#ifdef CONFIG_64BIT_PHYS_ADDR
360extern phys_t fixup_bigphys_addr(phys_t phys_addr, phys_t size);
361extern int remap_pfn_range(struct vm_area_struct *vma, unsigned long from, unsigned long pfn, unsigned long size, pgprot_t prot); 365extern int remap_pfn_range(struct vm_area_struct *vma, unsigned long from, unsigned long pfn, unsigned long size, pgprot_t prot);
362 366
363static inline int io_remap_pfn_range(struct vm_area_struct *vma, 367static inline int io_remap_pfn_range(struct vm_area_struct *vma,
@@ -367,7 +371,7 @@ static inline int io_remap_pfn_range(struct vm_area_struct *vma,
367 pgprot_t prot) 371 pgprot_t prot)
368{ 372{
369 phys_t phys_addr_high = fixup_bigphys_addr(pfn << PAGE_SHIFT, size); 373 phys_t phys_addr_high = fixup_bigphys_addr(pfn << PAGE_SHIFT, size);
370 return remap_pfn_range(vma, vaddr, pfn, size, prot); 374 return remap_pfn_range(vma, vaddr, phys_addr_high >> PAGE_SHIFT, size, prot);
371} 375}
372#else 376#else
373#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \ 377#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \