[U-Boot] [PATCH v3 4/7] malloc_f: add ARCH_MALLOC_F_LEN to specify SoC-default malloc_f_len

Masahiro Yamada
2015-02-20T05:24:58Z

Now the default value of CONFIG_SYS_MALLOC_F_LEN can be overridden
by SoC Kconfig file, but we still have to add the same conditional
"if SYS_MALLOC_F" to every default. Otherwise, a broken .config
file could be generated. It is too painful.

This commit intends to solve it by introducing SoC-default
ARCH_MALLOC_F_LEN. This works as follows:

- If ARCH_MALLOC_F_LEN is defined, it overrides the default of
SYS_MALLOC_F_LEN. If you have the SoC-optimized value,
you might wish to do this.

- If ARCH_MALLOC_F_LEN is not defined, SYS_MALLOC_F_LEN is default
to 0x400. This is the global default and it should work well
enough in most cases.

- You can still change SYS_MALLOC_F_LEN per board, although you do
not probably have to do so. Per-board default should be saved
into each defconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
---

Changes in v3:
- Newly added

Changes in v2: None

Kconfig | 1 +
arch/arm/cpu/armv7/tegra-common/Kconfig | 5 +++--
arch/x86/Kconfig | 5 +++--
3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/Kconfig b/Kconfig
index 351e5c9..cb5a6a8 100644
--- a/Kconfig
+++ b/Kconfig
@@ -70,6 +70,7 @@ config SYS_MALLOC_F
config SYS_MALLOC_F_LEN
hex "Size of malloc() pool before relocation"
depends on SYS_MALLOC_F
+ default ARCH_MALLOC_F_LEN if ARCH_MALLOC_F_LEN
default 0x400
help
Before relocation memory is very limited on many platforms. Still,
diff --git a/arch/arm/cpu/armv7/tegra-common/Kconfig b/arch/arm/cpu/armv7/tegra-common/Kconfig
index 8b51558..c326106 100644
--- a/arch/arm/cpu/armv7/tegra-common/Kconfig
+++ b/arch/arm/cpu/armv7/tegra-common/Kconfig
@@ -20,8 +20,9 @@ endchoice
config SYS_MALLOC_F
default y

-config SYS_MALLOC_F_LEN
- default 0x1800 if SYS_MALLOC_F
+config ARCH_MALLOC_F_LEN
+ hex
+ default 0x1800

config USE_PRIVATE_LIBGCC
default y if SPL_BUILD
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 65909e7..0e49dd3 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -79,8 +79,9 @@ config DM_SERIAL
config SYS_MALLOC_F
default y

-config SYS_MALLOC_F_LEN
- default 0x800 if SYS_MALLOC_F
+config ARCH_MALLOC_F_LEN
+ hex
+ default 0x800

config RAMBASE
hex
--
1.9.1