From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tom Rini Date: Fri, 24 Oct 2014 14:59:05 -0400 Subject: [U-Boot] [PATCH v2 04/13] dm: spl: Make simple malloc() available when enabled In-Reply-To: <1414091770-26319-5-git-send-email-sjg@chromium.org> References: <1414091770-26319-1-git-send-email-sjg@chromium.org> <1414091770-26319-5-git-send-email-sjg@chromium.org> Message-ID: <20141024185905.GJ25506@bill-the-cat> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Thu, Oct 23, 2014 at 01:16:01PM -0600, Simon Glass wrote: > Set up the simple malloc() implementation when requested, in preference to > the full malloc(). > > Signed-off-by: Simon Glass > --- > > Changes in v2: None > > common/spl/spl.c | 11 ++++++++++- > 1 file changed, 10 insertions(+), 1 deletion(-) > > diff --git a/common/spl/spl.c b/common/spl/spl.c > index b16664f..7168854 100644 > --- a/common/spl/spl.c > +++ b/common/spl/spl.c > @@ -134,9 +134,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 > @@ -233,6 +237,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); > } I don't know if this is right. Take the example of am335x + booting from a FAT fs image. We'll need early malloc prior to DDR being available, so the tiny space (1-2kb). But once DDR is up we need a more complete malloc so that we can use FAT. I don't have the size handy but I'm going to guess that (a) it's bigger than 1-2kb (b) bigger than we can squeeze into SRAM. -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: