linux-mips
[Top] [All Lists]

[PATCH 2/7] Make __pa() aware of XKPHYS/CKSEG0 address mix for 64 bit ke

To: ralf@linux-mips.org
Subject: [PATCH 2/7] Make __pa() aware of XKPHYS/CKSEG0 address mix for 64 bit kernels
From: Franck Bui-Huu <vagabon.xyz@gmail.com>
Date: Thu, 19 Oct 2006 13:20:00 +0200
Cc: anemo@mba.ocn.ne.jp, ths@networkno.de, linux-mips@linux-mips.org, Franck Bui-Huu <fbuihuu@gmail.com>
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:to:cc:subject:date:message-id:x-mailer:in-reply-to:references:from; b=kXphQk9Yy/7EZ/tBR+lFbcDf0XFpkZXBA/ni0VjkaCA250wXVz45fmznEbaMZMB2wYjrcRfxxn/ZWRAFRv/qlaIIkwlpME4VWgaFjSX3i8/LgA1t11TwCbXwAqesPqXcFbFav3sBMkjzppvhD2bcgygv9/JGfcbLRc1tA5wA/2M=
In-reply-to: <11612568052624-git-send-email-fbuihuu@gmail.com>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <11612568052624-git-send-email-fbuihuu@gmail.com>
Sender: linux-mips-bounce@linux-mips.org
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>
---
 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 fa4e4d9..119daee 100644
--- a/include/asm-mips/page.h
+++ b/include/asm-mips/page.h
@@ -133,8 +133,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_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)
 
-- 
1.4.2.3


<Prev in Thread] Current Thread [Next in Thread>