During early boot mem init, some configs couldn't use __pa() to convert virtual into physical addresses. Specially for 64 bit kernel cases when CONFIG_BUILD_ELF64=n. This patch make __pa() work for _all_ configs and thus make CPHYSADDR() useless. Signed-off-by: Franck Bui-Huu <fbuihuu@xxxxxxxxx> --- include/asm-mips/page.h | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/include/asm-mips/page.h b/include/asm-mips/page.h index 0821eb0..5da4733 100644 --- a/include/asm-mips/page.h +++ b/include/asm-mips/page.h @@ -131,8 +131,13 @@ #endif /* !__ASSEMBLY__ */ /* to align the pointer to the (next) page boundary */ #define PAGE_ALIGN(addr) (((addr) + PAGE_SIZE - 1) & PAGE_MASK) -#define __pa(x) ((unsigned long) (x) - PAGE_OFFSET) -#define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET)) +#if defined(CONFIG_64BITS) && !defined(CONFIG_BUILD_ELF64) +#define __page_offset(x) ((unsigned long)(x) < CKSEG0 ? PAGE_OFFSET : CKSEG0) +#else +#define __page_offset(x) PAGE_OFFSET +#endif +#define __pa(x) ((unsigned long)(x) - __page_offset(x)) +#define __va(x) ((void *)((unsigned long)(x) + __page_offset(x))) #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) -- 1.4.2.3