Hi Andy, On 12 July 2017 at 20:12, Andy Yan <andy....@rock-chips.com> wrote: > > Some platforms has very small sram to run spl code, so it has no > enough sapce for so much malloc pool before relocation in > spl stage as the normal u-boot stake. > Make spl and normal u-boot stage use independent SYS_MALLOC_F_LEN, > Then people can sets the pre-relocation malloc pool according to > the memory space indepently. > > Signed-off-by: Andy Yan <andy....@rock-chips.com> > > --- > > Changes in v2: > - introduce a new control CONFIG_SPL_SYS_MALLOC_F_LEN, adviced by Simon > > Kconfig | 10 ++++++++++ > arch/sandbox/cpu/start.c | 2 +- > cmd/bdinfo.c | 2 +- > common/Makefile | 2 +- > common/board_f.c | 4 ++-- > common/board_r.c | 2 +- > common/dlmalloc.c | 12 ++++++------ > common/init/board_init.c | 4 ++-- > common/spl/spl.c | 6 +++--- > drivers/core/Kconfig | 8 ++++---- > drivers/serial/serial-uclass.c | 4 ++-- > include/asm-generic/global_data.h | 2 +- > include/common.h | 11 +++++++++++ > lib/asm-offsets.c | 2 +- > lib/efi/efi_app.c | 2 +- > 15 files changed, 47 insertions(+), 26 deletions(-) > > diff --git a/Kconfig b/Kconfig > index bb80ada..c1451bc 100644 > --- a/Kconfig > +++ b/Kconfig > @@ -95,6 +95,16 @@ config SYS_MALLOC_F_LEN > particular needs this to operate, so that it can allocate the > initial serial device and any others that are needed. > > +config SPL_SYS_MALLOC_F_LEN > + hex "Size of malloc() pool in spl before relocation" > + depends on SYS_MALLOC_F > + default SYS_MALLOC_F_LEN > + help > + Before relocation, memory is very limited on many platforms. Still, > + we can provide a small malloc() pool if needed. Driver model in > + particular needs this to operate, so that it can allocate the > + initial serial device and any others that are needed. > + > menuconfig EXPERT > bool "Configure standard U-Boot features (expert users)" > default y > diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c > index f605d4d..17e531a 100644 > --- a/arch/sandbox/cpu/start.c > +++ b/arch/sandbox/cpu/start.c > @@ -310,7 +310,7 @@ int main(int argc, char *argv[]) > > memset(&data, '\0', sizeof(data)); > gd = &data; > -#ifdef CONFIG_SYS_MALLOC_F_LEN > +#ifdef CONFIG_SYS_MALLOC_F
This is a good change. Can you please split out the change to move to SYS_MALLOC_F into its own patch? It seems to be separate from the change to support an SPL version. > gd->malloc_base = CONFIG_MALLOC_F_ADDR; > #endif > setup_ram_buf(state); > diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c > index 8971697..64836e9 100644 > --- a/cmd/bdinfo.c > +++ b/cmd/bdinfo.c > @@ -346,7 +346,7 @@ static int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, > #endif > #ifdef CONFIG_SYS_MALLOC_F > printf("Early malloc usage: %lx / %x\n", gd->malloc_ptr, > - CONFIG_SYS_MALLOC_F_LEN); > + get_sys_malloc_f_len()); Can you use CONFIG_VAL(SYS_MALLOC_F_LEN) here instead of the function? [...] Regards, Simon _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot