]> err.no Git - linux-2.6/commitdiff
[MIPS] Make __pa() aware of XKPHYS/CKSEG0 address mix for 64 bit kernels
authorFranck Bui-Huu <vagabon.xyz@gmail.com>
Thu, 19 Oct 2006 11:20:00 +0000 (13:20 +0200)
committerRalf Baechle <ralf@linux-mips.org>
Thu, 30 Nov 2006 01:14:41 +0000 (01:14 +0000)
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@gmail.com>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
include/asm-mips/page.h

index edb33a14ae9e332bbbd6788b093861d38a10931b..c3b13dedf21af574abfba586985cd6721d37f47e 100644 (file)
@@ -136,8 +136,13 @@ typedef struct { unsigned long pgprot; } pgprot_t;
 /* 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_64BIT) && !defined(CONFIG_BUILD_ELF64)
+#define __pa_page_offset(x)    ((unsigned long)(x) < CKSEG0 ? PAGE_OFFSET : CKSEG0)
+#else
+#define __pa_page_offset(x)    PAGE_OFFSET
+#endif
+#define __pa(x)                        ((unsigned long)(x) - __pa_page_offset(x))
+#define __va(x)                        ((void *)((unsigned long)(x) + PAGE_OFFSET))
 
 #define pfn_to_kaddr(pfn)      __va((pfn) << PAGE_SHIFT)