diff options
Diffstat (limited to 'include/asm-mips')
-rw-r--r-- | include/asm-mips/io.h | 4 | ||||
-rw-r--r-- | include/asm-mips/page.h | 25 |
2 files changed, 23 insertions, 6 deletions
diff --git a/include/asm-mips/io.h b/include/asm-mips/io.h index d77b657c09c7..67f081078904 100644 --- a/include/asm-mips/io.h +++ b/include/asm-mips/io.h | |||
@@ -115,7 +115,7 @@ static inline void set_io_port_base(unsigned long base) | |||
115 | */ | 115 | */ |
116 | static inline unsigned long virt_to_phys(volatile const void *address) | 116 | static inline unsigned long virt_to_phys(volatile const void *address) |
117 | { | 117 | { |
118 | return (unsigned long)address - PAGE_OFFSET; | 118 | return (unsigned long)address - PAGE_OFFSET + PHYS_OFFSET; |
119 | } | 119 | } |
120 | 120 | ||
121 | /* | 121 | /* |
@@ -132,7 +132,7 @@ static inline unsigned long virt_to_phys(volatile const void *address) | |||
132 | */ | 132 | */ |
133 | static inline void * phys_to_virt(unsigned long address) | 133 | static inline void * phys_to_virt(unsigned long address) |
134 | { | 134 | { |
135 | return (void *)(address + PAGE_OFFSET); | 135 | return (void *)(address + PAGE_OFFSET - PHYS_OFFSET); |
136 | } | 136 | } |
137 | 137 | ||
138 | /* | 138 | /* |
diff --git a/include/asm-mips/page.h b/include/asm-mips/page.h index 2f9e1a9ec51f..d3fbd83ff545 100644 --- a/include/asm-mips/page.h +++ b/include/asm-mips/page.h | |||
@@ -34,6 +34,20 @@ | |||
34 | 34 | ||
35 | #ifndef __ASSEMBLY__ | 35 | #ifndef __ASSEMBLY__ |
36 | 36 | ||
37 | /* | ||
38 | * This gives the physical RAM offset. | ||
39 | */ | ||
40 | #ifndef PHYS_OFFSET | ||
41 | #define PHYS_OFFSET 0UL | ||
42 | #endif | ||
43 | |||
44 | /* | ||
45 | * It's normally defined only for FLATMEM config but it's | ||
46 | * used in our early mem init code for all memory models. | ||
47 | * So always define it. | ||
48 | */ | ||
49 | #define ARCH_PFN_OFFSET PFN_UP(PHYS_OFFSET) | ||
50 | |||
37 | #include <linux/pfn.h> | 51 | #include <linux/pfn.h> |
38 | #include <asm/io.h> | 52 | #include <asm/io.h> |
39 | 53 | ||
@@ -132,20 +146,23 @@ typedef struct { unsigned long pgprot; } pgprot_t; | |||
132 | /* to align the pointer to the (next) page boundary */ | 146 | /* to align the pointer to the (next) page boundary */ |
133 | #define PAGE_ALIGN(addr) (((addr) + PAGE_SIZE - 1) & PAGE_MASK) | 147 | #define PAGE_ALIGN(addr) (((addr) + PAGE_SIZE - 1) & PAGE_MASK) |
134 | 148 | ||
149 | /* | ||
150 | * __pa()/__va() should be used only during mem init. | ||
151 | */ | ||
135 | #if defined(CONFIG_64BIT) && !defined(CONFIG_BUILD_ELF64) | 152 | #if defined(CONFIG_64BIT) && !defined(CONFIG_BUILD_ELF64) |
136 | #define __pa_page_offset(x) ((unsigned long)(x) < CKSEG0 ? PAGE_OFFSET : CKSEG0) | 153 | #define __pa_page_offset(x) ((unsigned long)(x) < CKSEG0 ? PAGE_OFFSET : CKSEG0) |
137 | #else | 154 | #else |
138 | #define __pa_page_offset(x) PAGE_OFFSET | 155 | #define __pa_page_offset(x) PAGE_OFFSET |
139 | #endif | 156 | #endif |
140 | #define __pa(x) ((unsigned long)(x) - __pa_page_offset(x)) | 157 | #define __pa(x) ((unsigned long)(x) - __pa_page_offset(x) + PHYS_OFFSET) |
141 | #define __pa_symbol(x) __pa(RELOC_HIDE((unsigned long)(x),0)) | 158 | #define __va(x) ((void *)((unsigned long)(x) + PAGE_OFFSET - PHYS_OFFSET)) |
142 | #define __va(x) ((void *)((unsigned long)(x) + PAGE_OFFSET)) | 159 | #define __pa_symbol(x) __pa(RELOC_HIDE((unsigned long)(x),0)) |
143 | 160 | ||
144 | #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) | 161 | #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) |
145 | 162 | ||
146 | #ifdef CONFIG_FLATMEM | 163 | #ifdef CONFIG_FLATMEM |
147 | 164 | ||
148 | #define pfn_valid(pfn) ((pfn) < max_mapnr) | 165 | #define pfn_valid(pfn) ((pfn) >= ARCH_PFN_OFFSET && (pfn) < max_mapnr) |
149 | 166 | ||
150 | #elif defined(CONFIG_SPARSEMEM) | 167 | #elif defined(CONFIG_SPARSEMEM) |
151 | 168 | ||