summaryrefslogtreecommitdiff
path: root/lib_ppc
diff options
context:
space:
mode:
authorKumar Gala <galak@kernel.crashing.org>2008-02-27 21:51:50 -0600
committerMarian Balakowicz <m8@semihalf.com>2008-02-29 13:15:56 +0100
commitd3f2fa0d278467b2232e4eb2372f905c3febfbeb (patch)
tree354a389881ddaacfc29a0b02c6fb12b9cb7c1f81 /lib_ppc
parente822d7fc4dd4755d4d0a22f05e33f33d1a0481da (diff)
downloadu-boot-imx-d3f2fa0d278467b2232e4eb2372f905c3febfbeb.zip
u-boot-imx-d3f2fa0d278467b2232e4eb2372f905c3febfbeb.tar.gz
u-boot-imx-d3f2fa0d278467b2232e4eb2372f905c3febfbeb.tar.bz2
[new uImage] Provide ability to restrict region used for boot images
Allow the user to set 'bootm_low' and 'bootm_size' env vars as a way to restrict what memory range is used for bootm. Signed-off-by: Kumar Gala <galak@kernel.crashing.org> Acked-by: Marian Balakowicz <m8@semihalf.com>
Diffstat (limited to 'lib_ppc')
-rw-r--r--lib_ppc/bootm.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/lib_ppc/bootm.c b/lib_ppc/bootm.c
index d74a3f4..59cc2a4 100644
--- a/lib_ppc/bootm.c
+++ b/lib_ppc/bootm.c
@@ -59,6 +59,10 @@ extern ulong get_effective_memsize(void);
static ulong get_sp (void);
static void set_clocks_in_mhz (bd_t *kbd);
+#ifndef CFG_LINUX_LOWMEM_MAX_SIZE
+#define CFG_LINUX_LOWMEM_MAX_SIZE (768*1024*1024)
+#endif
+
void __attribute__((noinline))
do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
bootm_headers_t *images)
@@ -67,6 +71,7 @@ do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
ulong initrd_start, initrd_end;
ulong rd_data_start, rd_data_end, rd_len;
+ ulong size;
ulong cmd_start, cmd_end, bootmap_base;
bd_t *kbd;
@@ -80,7 +85,24 @@ do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
char *of_flat_tree = NULL;
#endif
- bootmap_base = 0;
+ bootmap_base = getenv_bootm_low();
+ size = getenv_bootm_size();
+
+#ifdef DEBUG
+ if (((u64)bootmap_base + size) > (CFG_SDRAM_BASE + (u64)gd->ram_size))
+ puts("WARNING: bootm_low + bootm_size exceed total memory\n");
+ if ((bootmap_base + size) > get_effective_memsize())
+ puts("WARNING: bootm_low + bootm_size exceed eff. memory\n");
+#endif
+
+ size = min(size, get_effective_memsize());
+ size = min(size, CFG_LINUX_LOWMEM_MAX_SIZE);
+
+ if (size < getenv_bootm_size()) {
+ ulong base = bootmap_base + size;
+ printf("WARNING: adjusting available memory to %x\n", size);
+ lmb_reserve(lmb, base, getenv_bootm_size() - size);
+ }
/*
* Booting a (Linux) kernel image
@@ -92,7 +114,7 @@ do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
* pointer.
*/
sp = get_sp();
- debug ("## Current stack ends at 0x%08lx ", sp);
+ debug ("## Current stack ends at 0x%08lx\n", sp);
/* adjust sp by 1K to be safe */
sp -= 1024;