aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKumar Gala <galak@kernel.crashing.org>2010-04-21 03:12:58 -0400
committerKumar Gala <galak@kernel.crashing.org>2010-04-26 18:54:15 -0400
commitdbc9632a8c25c6efcc1ca3f3a2177c855b6e053e (patch)
treefe9ef8dfc37ab28ade8f8316563394fadc9fd24a
parentb4d0a038e0f856313ca26fd3872bc209a2e616ad (diff)
powerpc/fsl-booke: Fix CONFIG_RELOCATABLE support on FSL Book-E ppc32
The following commit broke CONFIG_RELOCATABLE support on FSL Book-E parts: commit 549e8152de8039506f69c677a4546e5427aa6ae7 Author: Paul Mackerras <paulus@samba.org> Date: Sat Aug 30 11:43:47 2008 +1000 powerpc: Make the 64-bit kernel as a position-independent executable The change to __va and __pa to use PAGE_OFFSET & MEMORY_START causes problems on the Book-E parts because we don't know MEMORY_START until after we parse the device tree. We need __va to work properly to even parse the device tree so we have a chicken an egg. So go back to using he other definition of __va/__pa on CONFIG_BOOKE and use the PAGE_OFFSET/MEMORY_START version on "Classic" PPC64. Also updated casts to handle phys_addr_t being a different size from unsigned long (ie 36-bit physical on PPC32). Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
-rw-r--r--arch/powerpc/include/asm/page.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/arch/powerpc/include/asm/page.h b/arch/powerpc/include/asm/page.h
index e96d52a516ba..53b64be40eb2 100644
--- a/arch/powerpc/include/asm/page.h
+++ b/arch/powerpc/include/asm/page.h
@@ -108,8 +108,21 @@ extern phys_addr_t kernstart_addr;
108#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) 108#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
109#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) 109#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
110 110
111#define __va(x) ((void *)((unsigned long)(x) + PAGE_OFFSET - MEMORY_START)) 111/*
112 * On Book-E parts we need __va to parse the device tree and we can't
113 * determine MEMORY_START until then. However we can determine PHYSICAL_START
114 * from information at hand (program counter, TLB lookup).
115 *
116 * On non-Book-E PPC64 PAGE_OFFSET and MEMORY_START are constants so use
117 * the other definitions for __va & __pa.
118 */
119#ifdef CONFIG_BOOKE
120#define __va(x) ((void *)(unsigned long)((phys_addr_t)(x) - PHYSICAL_START + KERNELBASE))
121#define __pa(x) ((unsigned long)(x) + PHYSICAL_START - KERNELBASE)
122#else
123#define __va(x) ((void *)(unsigned long)((phys_addr_t)(x) + PAGE_OFFSET - MEMORY_START))
112#define __pa(x) ((unsigned long)(x) - PAGE_OFFSET + MEMORY_START) 124#define __pa(x) ((unsigned long)(x) - PAGE_OFFSET + MEMORY_START)
125#endif
113 126
114/* 127/*
115 * Unfortunately the PLT is in the BSS in the PPC32 ELF ABI, 128 * Unfortunately the PLT is in the BSS in the PPC32 ELF ABI,