aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Kconfig9
-rw-r--r--arch/arm/lib/bdinfo.c2
-rw-r--r--arch/mips/cpu/start.S4
-rw-r--r--arch/mips/mach-mtmips/mt7621/spl/start.S4
-rw-r--r--arch/powerpc/cpu/mpc83xx/start.S2
-rw-r--r--arch/powerpc/cpu/mpc85xx/start.S4
-rw-r--r--arch/sandbox/cpu/start.c2
-rw-r--r--arch/sh/lib/start.S4
-rw-r--r--common/Makefile6
-rw-r--r--common/board_f.c2
-rw-r--r--common/board_r.c2
-rw-r--r--common/dlmalloc.c12
-rw-r--r--common/init/board_init.c4
-rw-r--r--common/spl/spl.c6
-rw-r--r--include/asm-generic/global_data.h2
-rw-r--r--lib/asm-offsets.c2
16 files changed, 31 insertions, 36 deletions
diff --git a/Kconfig b/Kconfig
index 927e2de..068da61 100644
--- a/Kconfig
+++ b/Kconfig
@@ -307,8 +307,7 @@ config SPL_SYS_MALLOC_F
config SPL_SYS_MALLOC_F_LEN
hex "Size of malloc() pool in SPL"
- depends on SYS_MALLOC_F && SPL
- default 0x0 if !SPL_FRAMEWORK
+ depends on SPL_SYS_MALLOC_F
default 0x2800 if RCAR_GEN3
default 0x2000 if IMX8MQ
default SYS_MALLOC_F_LEN
@@ -332,7 +331,7 @@ config TPL_SYS_MALLOC_F
config TPL_SYS_MALLOC_F_LEN
hex "Size of malloc() pool in TPL"
- depends on SYS_MALLOC_F && TPL
+ depends on TPL_SYS_MALLOC_F
default SPL_SYS_MALLOC_F_LEN
help
Sets the size of the malloc() pool in TPL. This is used for
@@ -366,8 +365,8 @@ config VPL_SYS_MALLOC_F
config VPL_SYS_MALLOC_F_LEN
hex "Size of malloc() pool in VPL before relocation"
- depends on SYS_MALLOC_F && VPL
- default SYS_MALLOC_F_LEN
+ depends on VPL_SYS_MALLOC_F
+ default SPL_SYS_MALLOC_F_LEN
help
Sets the size of the malloc() pool in VPL. This is used for
driver model and other features, which must allocate memory for
diff --git a/arch/arm/lib/bdinfo.c b/arch/arm/lib/bdinfo.c
index 5e6eaad..b88b01e 100644
--- a/arch/arm/lib/bdinfo.c
+++ b/arch/arm/lib/bdinfo.c
@@ -57,7 +57,7 @@ void arch_print_bdinfo(void)
#ifdef CONFIG_BOARD_TYPES
printf("Board Type = %ld\n", gd->board_type);
#endif
-#if CONFIG_VAL(SYS_MALLOC_F_LEN)
+#if CONFIG_IS_ENABLED(SYS_MALLOC_F)
printf("Early malloc usage: %lx / %x\n", gd->malloc_ptr,
CONFIG_VAL(SYS_MALLOC_F_LEN));
#endif
diff --git a/arch/mips/cpu/start.S b/arch/mips/cpu/start.S
index 2acc21d..a95c95b 100644
--- a/arch/mips/cpu/start.S
+++ b/arch/mips/cpu/start.S
@@ -46,7 +46,7 @@
sp, sp, GD_SIZE # reserve space for gd
and sp, sp, t0 # force 16 byte alignment
move k0, sp # save gd pointer
-#if CONFIG_VAL(SYS_MALLOC_F_LEN) && \
+#if CONFIG_IS_ENABLED(SYS_MALLOC_F) && \
!CONFIG_IS_ENABLED(INIT_STACK_WITHOUT_MALLOC_F)
li t2, CONFIG_VAL(SYS_MALLOC_F_LEN)
PTR_SUBU \
@@ -63,7 +63,7 @@
blt t0, t1, 1b
nop
-#if CONFIG_VAL(SYS_MALLOC_F_LEN) && \
+#if CONFIG_IS_ENABLED(SYS_MALLOC_F) && \
!CONFIG_IS_ENABLED(INIT_STACK_WITHOUT_MALLOC_F)
PTR_S sp, GD_MALLOC_BASE(k0) # gd->malloc_base offset
#endif
diff --git a/arch/mips/mach-mtmips/mt7621/spl/start.S b/arch/mips/mach-mtmips/mt7621/spl/start.S
index d2f9c03..d56e624 100644
--- a/arch/mips/mach-mtmips/mt7621/spl/start.S
+++ b/arch/mips/mach-mtmips/mt7621/spl/start.S
@@ -37,7 +37,7 @@
sp, sp, GD_SIZE # reserve space for gd
and sp, sp, t0 # force 16 byte alignment
move k0, sp # save gd pointer
-#if CONFIG_VAL(SYS_MALLOC_F_LEN) && \
+#if CONFIG_IS_ENABLED(SYS_MALLOC_F) && \
!CONFIG_IS_ENABLED(INIT_STACK_WITHOUT_MALLOC_F)
li t2, CONFIG_VAL(SYS_MALLOC_F_LEN)
PTR_SUBU \
@@ -54,7 +54,7 @@
blt t0, t1, 1b
nop
-#if CONFIG_VAL(SYS_MALLOC_F_LEN) && \
+#if CONFIG_IS_ENABLED(SYS_MALLOC_F) && \
!CONFIG_IS_ENABLED(INIT_STACK_WITHOUT_MALLOC_F)
PTR_S sp, GD_MALLOC_BASE(k0) # gd->malloc_base offset
#endif
diff --git a/arch/powerpc/cpu/mpc83xx/start.S b/arch/powerpc/cpu/mpc83xx/start.S
index 6749263..d72d314 100644
--- a/arch/powerpc/cpu/mpc83xx/start.S
+++ b/arch/powerpc/cpu/mpc83xx/start.S
@@ -244,7 +244,7 @@ in_flash:
cmplw r3, r4
bne 1b
-#if CONFIG_VAL(SYS_MALLOC_F_LEN)
+#if CONFIG_IS_ENABLED(SYS_MALLOC_F)
#if CONFIG_VAL(SYS_MALLOC_F_LEN) + GENERATED_GBL_DATA_SIZE > CFG_SYS_INIT_RAM_SIZE
#error "SYS_MALLOC_F_LEN too large to fit into initial RAM."
diff --git a/arch/powerpc/cpu/mpc85xx/start.S b/arch/powerpc/cpu/mpc85xx/start.S
index 562b699..e9c3042 100644
--- a/arch/powerpc/cpu/mpc85xx/start.S
+++ b/arch/powerpc/cpu/mpc85xx/start.S
@@ -1233,7 +1233,7 @@ _start_cont:
lis r3,(CFG_SYS_INIT_RAM_ADDR)@h
ori r3,r3,((CFG_SYS_INIT_SP_OFFSET-16)&~0xf)@l /* Align to 16 */
-#if CONFIG_VAL(SYS_MALLOC_F_LEN)
+#if CONFIG_IS_ENABLED(SYS_MALLOC_F)
#if CONFIG_VAL(SYS_MALLOC_F_LEN) + GENERATED_GBL_DATA_SIZE > CFG_SYS_INIT_RAM_SIZE
#error "SYS_MALLOC_F_LEN too large to fit into initial RAM."
#endif
@@ -1253,7 +1253,7 @@ _start_cont:
cmplw r4,r3
bne 1b
-#if CONFIG_VAL(SYS_MALLOC_F_LEN)
+#if CONFIG_IS_ENABLED(SYS_MALLOC_F)
lis r4,SYS_INIT_SP_ADDR@h
ori r4,r4,SYS_INIT_SP_ADDR@l
diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c
index 1026898..bbd9e77 100644
--- a/arch/sandbox/cpu/start.c
+++ b/arch/sandbox/cpu/start.c
@@ -529,7 +529,7 @@ int sandbox_main(int argc, char *argv[])
goto err;
}
-#if CONFIG_VAL(SYS_MALLOC_F_LEN)
+#if CONFIG_IS_ENABLED(SYS_MALLOC_F)
gd->malloc_base = CFG_MALLOC_F_ADDR;
#endif
#if CONFIG_IS_ENABLED(LOG)
diff --git a/arch/sh/lib/start.S b/arch/sh/lib/start.S
index ddb9aa9..f0e1c80 100644
--- a/arch/sh/lib/start.S
+++ b/arch/sh/lib/start.S
@@ -53,7 +53,7 @@ _start:
mov.l ._gd_init, r13 /* global data */
mov.l ._stack_init, r15 /* stack */
-#if CONFIG_VAL(SYS_MALLOC_F_LEN)
+#if CONFIG_IS_ENABLED(SYS_MALLOC_F)
mov.l ._gd_malloc_base, r14
mov.l r15, @r14
#endif
@@ -73,7 +73,7 @@ loop:
._bss_start: .long bss_start
._bss_end: .long bss_end
._gd_init: .long (_start - GENERATED_GBL_DATA_SIZE)
-#if CONFIG_VAL(SYS_MALLOC_F_LEN)
+#if CONFIG_IS_ENABLED(SYS_MALLOC_F)
._gd_malloc_base: .long (_start - GENERATED_GBL_DATA_SIZE + GD_MALLOC_BASE)
#endif
._stack_init: .long (_start - GENERATED_GBL_DATA_SIZE - CONFIG_SYS_MALLOC_LEN - 16)
diff --git a/common/Makefile b/common/Makefile
index 5c16172..cdeadf7 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -74,11 +74,7 @@ endif # CONFIG_SPL_BUILD
obj-$(CONFIG_CROS_EC) += cros_ec.o
obj-y += dlmalloc.o
-ifdef CONFIG_SYS_MALLOC_F
-ifneq ($(CONFIG_$(SPL_TPL_)SYS_MALLOC_F_LEN),0x0)
-obj-y += malloc_simple.o
-endif
-endif
+obj-$(CONFIG_$(SPL_TPL_)SYS_MALLOC_F) += malloc_simple.o
obj-$(CONFIG_CYCLIC) += cyclic.o
obj-$(CONFIG_$(SPL_TPL_)EVENT) += event.o
diff --git a/common/board_f.c b/common/board_f.c
index aef395b..99c2a43 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -794,7 +794,7 @@ static int initf_bootstage(void)
static int initf_dm(void)
{
-#if defined(CONFIG_DM) && CONFIG_VAL(SYS_MALLOC_F_LEN)
+#if defined(CONFIG_DM) && CONFIG_IS_ENABLED(SYS_MALLOC_F)
int ret;
bootstage_start(BOOTSTAGE_ID_ACCUM_DM_F, "dm_f");
diff --git a/common/board_r.c b/common/board_r.c
index e309633..5278690 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -191,7 +191,7 @@ static int initr_malloc(void)
{
ulong start;
-#if CONFIG_VAL(SYS_MALLOC_F_LEN)
+#if CONFIG_IS_ENABLED(SYS_MALLOC_F)
debug("Pre-reloc malloc() used %#lx bytes (%ld KB)\n", gd->malloc_ptr,
gd->malloc_ptr / 1024);
#endif
diff --git a/common/dlmalloc.c b/common/dlmalloc.c
index aa933bd..87a09d3 100644
--- a/common/dlmalloc.c
+++ b/common/dlmalloc.c
@@ -1291,7 +1291,7 @@ Void_t* mALLOc(bytes) size_t bytes;
INTERNAL_SIZE_T nb;
-#if CONFIG_VAL(SYS_MALLOC_F_LEN)
+#if CONFIG_IS_ENABLED(SYS_MALLOC_F)
if (!(gd->flags & GD_FLG_FULL_MALLOC_INIT))
return malloc_simple(bytes);
#endif
@@ -1572,7 +1572,7 @@ void fREe(mem) Void_t* mem;
mchunkptr fwd; /* misc temp for linking */
int islr; /* track whether merging with last_remainder */
-#if CONFIG_VAL(SYS_MALLOC_F_LEN)
+#if CONFIG_IS_ENABLED(SYS_MALLOC_F)
/* free() is a no-op - all the memory will be freed on relocation */
if (!(gd->flags & GD_FLG_FULL_MALLOC_INIT)) {
VALGRIND_FREELIKE_BLOCK(mem, SIZE_SZ);
@@ -1735,7 +1735,7 @@ Void_t* rEALLOc(oldmem, bytes) Void_t* oldmem; size_t bytes;
/* realloc of null is supposed to be same as malloc */
if (oldmem == NULL) return mALLOc(bytes);
-#if CONFIG_VAL(SYS_MALLOC_F_LEN)
+#if CONFIG_IS_ENABLED(SYS_MALLOC_F)
if (!(gd->flags & GD_FLG_FULL_MALLOC_INIT)) {
/* This is harder to support and should not be needed */
panic("pre-reloc realloc() is not supported");
@@ -1957,7 +1957,7 @@ Void_t* mEMALIGn(alignment, bytes) size_t alignment; size_t bytes;
if ((long)bytes < 0) return NULL;
-#if CONFIG_VAL(SYS_MALLOC_F_LEN)
+#if CONFIG_IS_ENABLED(SYS_MALLOC_F)
if (!(gd->flags & GD_FLG_FULL_MALLOC_INIT)) {
return memalign_simple(alignment, bytes);
}
@@ -2153,7 +2153,7 @@ Void_t* cALLOc(n, elem_size) size_t n; size_t elem_size;
return NULL;
else
{
-#if CONFIG_VAL(SYS_MALLOC_F_LEN)
+#if CONFIG_IS_ENABLED(SYS_MALLOC_F)
if (!(gd->flags & GD_FLG_FULL_MALLOC_INIT)) {
memset(mem, 0, sz);
return mem;
@@ -2455,7 +2455,7 @@ int mALLOPt(param_number, value) int param_number; int value;
int initf_malloc(void)
{
-#if CONFIG_VAL(SYS_MALLOC_F_LEN)
+#if CONFIG_IS_ENABLED(SYS_MALLOC_F)
assert(gd->malloc_base); /* Set up by crt0.S */
gd->malloc_limit = CONFIG_VAL(SYS_MALLOC_F_LEN);
gd->malloc_ptr = 0;
diff --git a/common/init/board_init.c b/common/init/board_init.c
index ab8c508..ed2365d 100644
--- a/common/init/board_init.c
+++ b/common/init/board_init.c
@@ -79,7 +79,7 @@ ulong board_init_f_alloc_reserve(ulong top)
{
/* Reserve early malloc arena */
#ifndef CFG_MALLOC_F_ADDR
-#if CONFIG_VAL(SYS_MALLOC_F_LEN)
+#if CONFIG_IS_ENABLED(SYS_MALLOC_F)
top -= CONFIG_VAL(SYS_MALLOC_F_LEN);
#endif
#endif
@@ -159,7 +159,7 @@ void board_init_f_init_reserve(ulong base)
* Use gd as it is now properly set for all architectures.
*/
-#if CONFIG_VAL(SYS_MALLOC_F_LEN)
+#if CONFIG_IS_ENABLED(SYS_MALLOC_F)
/* go down one 'early malloc arena' */
gd->malloc_base = base;
#if CONFIG_IS_ENABLED(ZERO_MEM_BEFORE_USE)
diff --git a/common/spl/spl.c b/common/spl/spl.c
index 898ddfe..9b0276c 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -523,7 +523,7 @@ static int spl_common_init(bool setup_malloc)
{
int ret;
-#if CONFIG_VAL(SYS_MALLOC_F_LEN)
+#if CONFIG_IS_ENABLED(SYS_MALLOC_F)
if (setup_malloc) {
#ifdef CFG_MALLOC_F_ADDR
gd->malloc_base = CFG_MALLOC_F_ADDR;
@@ -860,7 +860,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
} else {
debug("Unsupported OS image.. Jumping nevertheless..\n");
}
-#if CONFIG_VAL(SYS_MALLOC_F_LEN) && !defined(CONFIG_SPL_SYS_MALLOC_SIZE)
+#if CONFIG_IS_ENABLED(SYS_MALLOC_F) && !defined(CONFIG_SPL_SYS_MALLOC_SIZE)
debug("SPL malloc() used 0x%lx bytes (%ld KB)\n", gd->malloc_ptr,
gd->malloc_ptr / 1024);
#endif
@@ -961,7 +961,7 @@ ulong spl_relocate_stack_gd(void)
if (CONFIG_IS_ENABLED(SYS_REPORT_STACK_F_USAGE))
spl_relocate_stack_check();
-#if defined(CONFIG_SPL_SYS_MALLOC_SIMPLE) && CONFIG_VAL(SYS_MALLOC_F_LEN)
+#if defined(CONFIG_SPL_SYS_MALLOC_SIMPLE) && CONFIG_IS_ENABLED(SYS_MALLOC_F)
if (CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN) {
debug("SPL malloc() before relocation used 0x%lx bytes (%ld KB)\n",
gd->malloc_ptr, gd->malloc_ptr / 1024);
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index c6d63b3..f8fc87f 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -307,7 +307,7 @@ struct global_data {
#if CONFIG_IS_ENABLED(CMD_BDINFO_EXTRA)
unsigned long malloc_start;
#endif
-#if CONFIG_VAL(SYS_MALLOC_F_LEN)
+#if CONFIG_IS_ENABLED(SYS_MALLOC_F)
/**
* @malloc_base: base address of early malloc()
*/
diff --git a/lib/asm-offsets.c b/lib/asm-offsets.c
index 0808cd4..216d971 100644
--- a/lib/asm-offsets.c
+++ b/lib/asm-offsets.c
@@ -32,7 +32,7 @@ int main(void)
DEFINE(GD_FLAGS, offsetof(struct global_data, flags));
-#if CONFIG_VAL(SYS_MALLOC_F_LEN)
+#if CONFIG_IS_ENABLED(SYS_MALLOC_F)
DEFINE(GD_MALLOC_BASE, offsetof(struct global_data, malloc_base));
#endif