diff options
Diffstat (limited to 'arch')
| -rw-r--r-- | arch/arm/include/asm/memory.h | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h index e750a938fd3c..c133bd915f48 100644 --- a/arch/arm/include/asm/memory.h +++ b/arch/arm/include/asm/memory.h | |||
| @@ -185,22 +185,32 @@ extern unsigned long __pv_phys_offset; | |||
| 185 | : "=r" (to) \ | 185 | : "=r" (to) \ |
| 186 | : "r" (from), "I" (type)) | 186 | : "r" (from), "I" (type)) |
| 187 | 187 | ||
| 188 | static inline unsigned long __virt_to_phys(unsigned long x) | 188 | static inline phys_addr_t __virt_to_phys(unsigned long x) |
| 189 | { | 189 | { |
| 190 | unsigned long t; | 190 | unsigned long t; |
| 191 | __pv_stub(x, t, "add", __PV_BITS_31_24); | 191 | __pv_stub(x, t, "add", __PV_BITS_31_24); |
| 192 | return t; | 192 | return t; |
| 193 | } | 193 | } |
| 194 | 194 | ||
| 195 | static inline unsigned long __phys_to_virt(unsigned long x) | 195 | static inline unsigned long __phys_to_virt(phys_addr_t x) |
| 196 | { | 196 | { |
| 197 | unsigned long t; | 197 | unsigned long t; |
| 198 | __pv_stub(x, t, "sub", __PV_BITS_31_24); | 198 | __pv_stub(x, t, "sub", __PV_BITS_31_24); |
| 199 | return t; | 199 | return t; |
| 200 | } | 200 | } |
| 201 | |||
| 201 | #else | 202 | #else |
| 202 | #define __virt_to_phys(x) ((x) - PAGE_OFFSET + PHYS_OFFSET) | 203 | |
| 203 | #define __phys_to_virt(x) ((x) - PHYS_OFFSET + PAGE_OFFSET) | 204 | static inline phys_addr_t __virt_to_phys(unsigned long x) |
| 205 | { | ||
| 206 | return (phys_addr_t)x - PAGE_OFFSET + PHYS_OFFSET; | ||
| 207 | } | ||
| 208 | |||
| 209 | static inline unsigned long __phys_to_virt(phys_addr_t x) | ||
| 210 | { | ||
| 211 | return x - PHYS_OFFSET + PAGE_OFFSET; | ||
| 212 | } | ||
| 213 | |||
| 204 | #endif | 214 | #endif |
| 205 | #endif | 215 | #endif |
| 206 | #endif /* __ASSEMBLY__ */ | 216 | #endif /* __ASSEMBLY__ */ |
| @@ -238,14 +248,14 @@ static inline phys_addr_t virt_to_phys(const volatile void *x) | |||
| 238 | 248 | ||
| 239 | static inline void *phys_to_virt(phys_addr_t x) | 249 | static inline void *phys_to_virt(phys_addr_t x) |
| 240 | { | 250 | { |
| 241 | return (void *)(__phys_to_virt((unsigned long)(x))); | 251 | return (void *)__phys_to_virt(x); |
| 242 | } | 252 | } |
| 243 | 253 | ||
| 244 | /* | 254 | /* |
| 245 | * Drivers should NOT use these either. | 255 | * Drivers should NOT use these either. |
| 246 | */ | 256 | */ |
| 247 | #define __pa(x) __virt_to_phys((unsigned long)(x)) | 257 | #define __pa(x) __virt_to_phys((unsigned long)(x)) |
| 248 | #define __va(x) ((void *)__phys_to_virt((unsigned long)(x))) | 258 | #define __va(x) ((void *)__phys_to_virt((phys_addr_t)(x))) |
| 249 | #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) | 259 | #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) |
| 250 | 260 | ||
| 251 | /* | 261 | /* |
