aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-mips/page.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-mips/page.h')
-rw-r--r--include/asm-mips/page.h16
1 files changed, 12 insertions, 4 deletions
diff --git a/include/asm-mips/page.h b/include/asm-mips/page.h
index 85b258ee7090..0dc1a45c27ed 100644
--- a/include/asm-mips/page.h
+++ b/include/asm-mips/page.h
@@ -34,7 +34,9 @@
34 34
35#ifndef __ASSEMBLY__ 35#ifndef __ASSEMBLY__
36 36
37#include <linux/pfn.h>
37#include <asm/cpu-features.h> 38#include <asm/cpu-features.h>
39#include <asm/io.h>
38 40
39extern void clear_page(void * page); 41extern void clear_page(void * page);
40extern void copy_page(void * to, void * from); 42extern void copy_page(void * to, void * from);
@@ -134,8 +136,14 @@ typedef struct { unsigned long pgprot; } pgprot_t;
134/* to align the pointer to the (next) page boundary */ 136/* to align the pointer to the (next) page boundary */
135#define PAGE_ALIGN(addr) (((addr) + PAGE_SIZE - 1) & PAGE_MASK) 137#define PAGE_ALIGN(addr) (((addr) + PAGE_SIZE - 1) & PAGE_MASK)
136 138
137#define __pa(x) ((unsigned long) (x) - PAGE_OFFSET) 139#if defined(CONFIG_64BIT) && !defined(CONFIG_BUILD_ELF64)
138#define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET)) 140#define __pa_page_offset(x) ((unsigned long)(x) < CKSEG0 ? PAGE_OFFSET : CKSEG0)
141#else
142#define __pa_page_offset(x) PAGE_OFFSET
143#endif
144#define __pa(x) ((unsigned long)(x) - __pa_page_offset(x))
145#define __pa_symbol(x) __pa(RELOC_HIDE((unsigned long)(x),0))
146#define __va(x) ((void *)((unsigned long)(x) + PAGE_OFFSET))
139 147
140#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) 148#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
141 149
@@ -160,8 +168,8 @@ typedef struct { unsigned long pgprot; } pgprot_t;
160 168
161#endif 169#endif
162 170
163#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) 171#define virt_to_page(kaddr) pfn_to_page(PFN_DOWN(virt_to_phys(kaddr)))
164#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) 172#define virt_addr_valid(kaddr) pfn_valid(PFN_DOWN(virt_to_phys(kaddr)))
165 173
166#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ 174#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
167 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 175 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)