aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-mips/page.h
diff options
context:
space:
mode:
authorFranck Bui-Huu <vagabon.xyz@gmail.com>2006-10-19 07:20:00 -0400
committerRalf Baechle <ralf@linux-mips.org>2006-11-29 20:14:41 -0500
commit620a4802be8ee7989b1b6684b7198ebae02af854 (patch)
tree4ded5391f23ab02cddcd9d40c3017340c9af027d /include/asm-mips/page.h
parent99e3b942c62f42c8d5added63305e12372b06daf (diff)
[MIPS] Make __pa() aware of XKPHYS/CKSEG0 address mix for 64 bit kernels
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>
Diffstat (limited to 'include/asm-mips/page.h')
-rw-r--r--include/asm-mips/page.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/include/asm-mips/page.h b/include/asm-mips/page.h
index edb33a14ae9e..c3b13dedf21a 100644
--- a/include/asm-mips/page.h
+++ b/include/asm-mips/page.h
@@ -136,8 +136,13 @@ typedef struct { unsigned long pgprot; } pgprot_t;
136/* to align the pointer to the (next) page boundary */ 136/* to align the pointer to the (next) page boundary */
137#define PAGE_ALIGN(addr) (((addr) + PAGE_SIZE - 1) & PAGE_MASK) 137#define PAGE_ALIGN(addr) (((addr) + PAGE_SIZE - 1) & PAGE_MASK)
138 138
139#define __pa(x) ((unsigned long) (x) - PAGE_OFFSET) 139#if defined(CONFIG_64BIT) && !defined(CONFIG_BUILD_ELF64)
140#define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET)) 140#define __pa_page_offset(x) ((unsigned long)(x) < CKSEG0 ? PAGE_OFFSET : CKSEG0)
141#else
142#define __pa_page_offset(x) PAGE_OFFSET
143#endif
144#define __pa(x) ((unsigned long)(x) - __pa_page_offset(x))
145#define __va(x) ((void *)((unsigned long)(x) + PAGE_OFFSET))
141 146
142#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) 147#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
143 148