aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorFranck Bui-Huu <fbuihuu@gmail.com>2007-06-04 11:46:35 -0400
committerRalf Baechle <ralf@linux-mips.org>2007-07-10 12:32:57 -0400
commitb1c65b3988c6e29ac371ab1cbbf6c4f8fb7092f8 (patch)
treeba2927d45030cf317fbda3534b7d56a8b13f0a11 /include
parent41b0483ee54d89f9ad068ceae3c91cdc7594d050 (diff)
[MIPS] Fix PHYS_OFFSET for 64-bits kernels with 32-bits symbols
The current implementation of __pa() for 64-bits kernels with 32-bits symbols is broken. In this configuration, we need 2 values for PAGE_OFFSET, one in XKPHYS and the other in CKSEG0 space. When the value in CKSEG0 space is used, it doesn't take into account of PHYS_OFFSET. Even worse we can't redefine this value. The patch restores CPHYSADDR() but in __pa()'s implementation because it removes the need of 2 PAGE_OFFSET. OTOH, CPHYSADDR() is quite bad when dealing with mapped kernels. So this patch assumes there's no need to deal with such kernel in 64-bits world. Signed-off-by: Franck Bui-Huu <fbuihuu@gmail.com> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'include')
-rw-r--r--include/asm-mips/page.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/include/asm-mips/page.h b/include/asm-mips/page.h
index c56c6a85908d..b92dd8c760da 100644
--- a/include/asm-mips/page.h
+++ b/include/asm-mips/page.h
@@ -35,7 +35,7 @@
35#ifndef __ASSEMBLY__ 35#ifndef __ASSEMBLY__
36 36
37#include <linux/pfn.h> 37#include <linux/pfn.h>
38#include <linux/io.h> 38#include <asm/io.h>
39 39
40/* 40/*
41 * It's normally defined only for FLATMEM config but it's 41 * It's normally defined only for FLATMEM config but it's
@@ -143,11 +143,15 @@ typedef struct { unsigned long pgprot; } pgprot_t;
143 * __pa()/__va() should be used only during mem init. 143 * __pa()/__va() should be used only during mem init.
144 */ 144 */
145#if defined(CONFIG_64BIT) && !defined(CONFIG_BUILD_ELF64) 145#if defined(CONFIG_64BIT) && !defined(CONFIG_BUILD_ELF64)
146#define __pa_page_offset(x) ((unsigned long)(x) < CKSEG0 ? PAGE_OFFSET : CKSEG0) 146#define __pa(x) \
147({ \
148 unsigned long __x = (unsigned long)(x); \
149 __x < CKSEG0 ? XPHYSADDR(__x) : CPHYSADDR(__x); \
150})
147#else 151#else
148#define __pa_page_offset(x) PAGE_OFFSET 152#define __pa(x) \
153 ((unsigned long)(x) - PAGE_OFFSET + PHYS_OFFSET)
149#endif 154#endif
150#define __pa(x) ((unsigned long)(x) - __pa_page_offset(x) + PHYS_OFFSET)
151#define __va(x) ((void *)((unsigned long)(x) + PAGE_OFFSET - PHYS_OFFSET)) 155#define __va(x) ((void *)((unsigned long)(x) + PAGE_OFFSET - PHYS_OFFSET))
152#define __pa_symbol(x) __pa(RELOC_HIDE((unsigned long)(x),0)) 156#define __pa_symbol(x) __pa(RELOC_HIDE((unsigned long)(x),0))
153 157