From c3624e6ed0a36f54aa0b3e7f32d30a6fde434f51 Mon Sep 17 00:00:00 2001 From: Grant Likely Date: Mon, 28 Mar 2011 09:58:43 +0000 Subject: Default to bootm_size() when CONFIG_SYS_BOOTMAPSZ is not defined This patch adds a function getenv_bootm_mapsize() for obtaining the size of the early mapped region accessible by the kernel during early boot. It defaults to CONFIG_SYS_BOOTMAPSZ, or if not defined, defaults to getenv_bootm_size(), which in turn defaults to the size of RAM. getenv_bootm_mapsize() can also be overridden with a "bootm_mapsize" environmental variable. Signed-off-by: Grant Likely --- common/image.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'common') diff --git a/common/image.c b/common/image.c index c86b86fbe..d8ba2ab90 100644 --- a/common/image.c +++ b/common/image.c @@ -454,6 +454,22 @@ phys_size_t getenv_bootm_size(void) #endif } +phys_size_t getenv_bootm_mapsize(void) +{ + phys_size_t tmp; + char *s = getenv ("bootm_mapsize"); + if (s) { + tmp = (phys_size_t)simple_strtoull (s, NULL, 16); + return tmp; + } + +#if defined(CONFIG_SYS_BOOTMAPSZ) + return CONFIG_SYS_BOOTMAPSZ; +#else + return getenv_bootm_size(); +#endif +} + void memmove_wd (void *to, void *from, size_t len, ulong chunksz) { if (to == from) @@ -1207,7 +1223,7 @@ int boot_relocate_fdt (struct lmb *lmb, char **of_flat_tree, ulong *of_size) /* Pad the FDT by a specified amount */ of_len = *of_size + CONFIG_SYS_FDT_PAD; of_start = (void *)(unsigned long)lmb_alloc_base(lmb, of_len, 0x1000, - CONFIG_SYS_BOOTMAPSZ + getenv_bootm_low()); + getenv_bootm_mapsize() + getenv_bootm_low()); if (of_start == 0) { puts("device tree - allocation error\n"); @@ -1581,7 +1597,7 @@ int boot_get_cmdline (struct lmb *lmb, ulong *cmd_start, ulong *cmd_end) char *s; cmdline = (char *)(ulong)lmb_alloc_base(lmb, CONFIG_SYS_BARGSIZE, 0xf, - CONFIG_SYS_BOOTMAPSZ + getenv_bootm_low()); + getenv_bootm_mapsize() + getenv_bootm_low()); if (cmdline == NULL) return -1; @@ -1617,7 +1633,7 @@ int boot_get_cmdline (struct lmb *lmb, ulong *cmd_start, ulong *cmd_end) int boot_get_kbd (struct lmb *lmb, bd_t **kbd) { *kbd = (bd_t *)(ulong)lmb_alloc_base(lmb, sizeof(bd_t), 0xf, - CONFIG_SYS_BOOTMAPSZ + getenv_bootm_low()); + getenv_bootm_mapsize() + getenv_bootm_low()); if (*kbd == NULL) return -1; -- cgit v1.2.3