summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2014-11-10 17:16:45 -0700
committerSimon Glass <sjg@chromium.org>2014-11-21 08:12:52 +0100
commitfb4f5e7c911745de1a6c7d0051abca9d2a4cd920 (patch)
tree15628afec9397b4d08290fc3a0f83fab893d4c3e
parentba19599b4433d1b5b4c8b6872453eec0441d2fc0 (diff)
downloadu-boot-imx-fb4f5e7c911745de1a6c7d0051abca9d2a4cd920.zip
u-boot-imx-fb4f5e7c911745de1a6c7d0051abca9d2a4cd920.tar.gz
u-boot-imx-fb4f5e7c911745de1a6c7d0051abca9d2a4cd920.tar.bz2
dm: spl: Make simple malloc() available when enabled
Set up the simple malloc() implementation when requested, in preference to the full malloc(). Signed-off-by: Simon Glass <sjg@chromium.org>
-rw-r--r--common/spl/spl.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/common/spl/spl.c b/common/spl/spl.c
index f01a21c..6b90ad8 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -139,9 +139,13 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
u32 boot_device;
debug(">>spl:board_init_r()\n");
-#ifdef CONFIG_SYS_SPL_MALLOC_START
+#if defined(CONFIG_SYS_SPL_MALLOC_START)
mem_malloc_init(CONFIG_SYS_SPL_MALLOC_START,
CONFIG_SYS_SPL_MALLOC_SIZE);
+ gd->flags |= GD_FLG_FULL_MALLOC_INIT;
+#elif defined(CONFIG_SYS_MALLOC_F_LEN)
+ gd->malloc_limit = gd->malloc_base + CONFIG_SYS_MALLOC_F_LEN;
+ gd->malloc_ptr = 0;
#endif
#ifndef CONFIG_PPC
@@ -238,6 +242,11 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
default:
debug("Unsupported OS image.. Jumping nevertheless..\n");
}
+#if defined(CONFIG_SYS_MALLOC_F_LEN) && !defined(CONFIG_SYS_SPL_MALLOC_SIZE)
+ debug("SPL malloc() used %#lx bytes (%ld KB)\n", gd->malloc_ptr,
+ gd->malloc_ptr / 1024);
+#endif
+
jump_to_image_no_args(&spl_image);
}