diff options
author | Grant Likely <grant.likely@linaro.org> | 2011-03-28 09:58:43 +0000 |
---|---|---|
committer | Gerald Van Baren <gvb@unssw.com> | 2011-04-25 21:11:20 -0400 |
commit | c3624e6ed0a36f54aa0b3e7f32d30a6fde434f51 (patch) | |
tree | 9a9de9718b28b0a526708466f5eb12782352607d /common/image.c | |
parent | 590d3cacb98cb377b127869b58507d2afe9c904a (diff) | |
download | u-boot-imx-c3624e6ed0a36f54aa0b3e7f32d30a6fde434f51.zip u-boot-imx-c3624e6ed0a36f54aa0b3e7f32d30a6fde434f51.tar.gz u-boot-imx-c3624e6ed0a36f54aa0b3e7f32d30a6fde434f51.tar.bz2 |
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 <grant.likely@linaro.org>
Diffstat (limited to 'common/image.c')
-rw-r--r-- | common/image.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/common/image.c b/common/image.c index c86b86f..d8ba2ab 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; |