diff options
author | Kevin Hao <haokexin@gmail.com> | 2013-12-24 02:12:06 -0500 |
---|---|---|
committer | Scott Wood <scottwood@freescale.com> | 2014-01-09 18:52:16 -0500 |
commit | dd189692d40948d6445bbaeb8cb9bf9d15f54dc6 (patch) | |
tree | a52bf15f5aaa9cecb53efe0cd2bdf3bcc9c463ef /arch/powerpc/mm/fsl_booke_mmu.c | |
parent | 1c49abec677c7ff495837dbaafad8e12f09c29fc (diff) |
powerpc: enable the relocatable support for the fsl booke 32bit kernel
This is based on the codes in the head_44x.S. The difference is that
the init tlb size we used is 64M. With this patch we can only load the
kernel at address between memstart_addr ~ memstart_addr + 64M. We will
fix this restriction in the following patches.
Signed-off-by: Kevin Hao <haokexin@gmail.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Diffstat (limited to 'arch/powerpc/mm/fsl_booke_mmu.c')
-rw-r--r-- | arch/powerpc/mm/fsl_booke_mmu.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/arch/powerpc/mm/fsl_booke_mmu.c b/arch/powerpc/mm/fsl_booke_mmu.c index 07ba45b0f07c..ce4a1163ddd3 100644 --- a/arch/powerpc/mm/fsl_booke_mmu.c +++ b/arch/powerpc/mm/fsl_booke_mmu.c | |||
@@ -241,4 +241,32 @@ void setup_initial_memory_limit(phys_addr_t first_memblock_base, | |||
241 | /* 64M mapped initially according to head_fsl_booke.S */ | 241 | /* 64M mapped initially according to head_fsl_booke.S */ |
242 | memblock_set_current_limit(min_t(u64, limit, 0x04000000)); | 242 | memblock_set_current_limit(min_t(u64, limit, 0x04000000)); |
243 | } | 243 | } |
244 | |||
245 | #ifdef CONFIG_RELOCATABLE | ||
246 | notrace void __init relocate_init(phys_addr_t start) | ||
247 | { | ||
248 | unsigned long base = KERNELBASE; | ||
249 | |||
250 | /* | ||
251 | * Relocatable kernel support based on processing of dynamic | ||
252 | * relocation entries. | ||
253 | * Compute the virt_phys_offset : | ||
254 | * virt_phys_offset = stext.run - kernstart_addr | ||
255 | * | ||
256 | * stext.run = (KERNELBASE & ~0x3ffffff) + (kernstart_addr & 0x3ffffff) | ||
257 | * When we relocate, we have : | ||
258 | * | ||
259 | * (kernstart_addr & 0x3ffffff) = (stext.run & 0x3ffffff) | ||
260 | * | ||
261 | * hence: | ||
262 | * virt_phys_offset = (KERNELBASE & ~0x3ffffff) - | ||
263 | * (kernstart_addr & ~0x3ffffff) | ||
264 | * | ||
265 | */ | ||
266 | kernstart_addr = start; | ||
267 | start &= ~0x3ffffff; | ||
268 | base &= ~0x3ffffff; | ||
269 | virt_phys_offset = base - start; | ||
270 | } | ||
271 | #endif | ||
244 | #endif | 272 | #endif |