From 76da19df5b8e186d269f29190696bd31fb6c836b Mon Sep 17 00:00:00 2001 From: Kumar Gala Date: Thu, 16 Oct 2008 21:52:08 -0500 Subject: Added arch_lmb_reserve to allow arch specific memory regions protection Each architecture has different ways of determine what regions of memory might not be valid to get overwritten when we boot. This provides a hook to allow them to reserve any regions they care about. Currently only ppc, m68k and sparc need/use this. Signed-off-by: Kumar Gala --- lib_ppc/bootm.c | 50 ++++++++++++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 22 deletions(-) (limited to 'lib_ppc') diff --git a/lib_ppc/bootm.c b/lib_ppc/bootm.c index d498818370..1f3501ae32 100644 --- a/lib_ppc/bootm.c +++ b/lib_ppc/bootm.c @@ -55,30 +55,10 @@ static void set_clocks_in_mhz (bd_t *kbd); #define CONFIG_SYS_LINUX_LOWMEM_MAX_SIZE (768*1024*1024) #endif -__attribute__((noinline)) -int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images) +void arch_lmb_reserve(struct lmb *lmb) { - ulong sp; - - ulong initrd_start, initrd_end; - ulong rd_len; - ulong size; phys_size_t bootm_size; - - ulong cmd_start, cmd_end, bootmap_base; - bd_t *kbd; - void (*kernel)(bd_t *, ulong r4, ulong r5, ulong r6, - ulong r7, ulong r8, ulong r9); - int ret; - ulong of_size = images->ft_len; - struct lmb *lmb = &images->lmb; - -#if defined(CONFIG_OF_LIBFDT) - char *of_flat_tree = images->ft_addr; -#endif - - kernel = (void (*)(bd_t *, ulong, ulong, ulong, - ulong, ulong, ulong))images->ep; + ulong size, sp, bootmap_base; bootmap_base = getenv_bootm_low(); bootm_size = getenv_bootm_size(); @@ -116,6 +96,32 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images) sp -= 1024; lmb_reserve(lmb, sp, (CONFIG_SYS_SDRAM_BASE + get_effective_memsize() - sp)); + return ; +} + +__attribute__((noinline)) +int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images) +{ + ulong initrd_start, initrd_end; + ulong rd_len; + + ulong cmd_start, cmd_end, bootmap_base; + bd_t *kbd; + void (*kernel)(bd_t *, ulong r4, ulong r5, ulong r6, + ulong r7, ulong r8, ulong r9); + int ret; + ulong of_size = images->ft_len; + struct lmb *lmb = &images->lmb; + +#if defined(CONFIG_OF_LIBFDT) + char *of_flat_tree = images->ft_addr; +#endif + + kernel = (void (*)(bd_t *, ulong, ulong, ulong, + ulong, ulong, ulong))images->ep; + + bootmap_base = getenv_bootm_low(); + if (!of_size) { /* allocate space and init command line */ ret = boot_get_cmdline (lmb, &cmd_start, &cmd_end, bootmap_base); -- cgit v1.2.1