[U-Boot] [PATCH v2 3/9] powerpc: spl and normal u-boot stage set SYS_MALLOC_F indepently

Andy Yan andy.yan at rock-chips.com
Thu Jul 13 03:25:49 UTC 2017


Some platforms has very small sram to run spl code, so
it may have no enough sapce for so much malloc pool before
relocation in spl stage as the normal u-boot stage.

Signed-off-by: Andy Yan <andy.yan at rock-chips.com>
---

Changes in v2: None

 arch/powerpc/cpu/mpc83xx/start.S | 13 +++++++++----
 arch/powerpc/cpu/mpc85xx/start.S | 16 ++++++++++------
 2 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/arch/powerpc/cpu/mpc83xx/start.S b/arch/powerpc/cpu/mpc83xx/start.S
index 2fed4a1..f067b9e 100644
--- a/arch/powerpc/cpu/mpc83xx/start.S
+++ b/arch/powerpc/cpu/mpc83xx/start.S
@@ -48,6 +48,11 @@
 #define CONFIG_SYS_FLASHBOOT
 #endif
 
+#if defined(CONFIG_SPL_BUILD)
+#define MALLOC_F_LEN   CONFIG_SPL_SYS_MALLOC_F_LEN
+#else
+#define MALLOC_F_LEN   CONFIG_SYS_MALLOC_F_LEN
+#endif
 /*
  * Set up GOT: Global Offset Table
  *
@@ -274,14 +279,14 @@ in_flash:
 	cmplw	r3, r4
 	bne	1b
 
-#ifdef CONFIG_SYS_MALLOC_F_LEN
+#ifdef CONFIG_SYS_MALLOC_F
 
-#if CONFIG_SYS_MALLOC_F_LEN + GENERATED_GBL_DATA_SIZE > CONFIG_SYS_INIT_RAM_SIZE
-#error "CONFIG_SYS_MALLOC_F_LEN too large to fit into initial RAM."
+#if MALLOC_F_LEN + GENERATED_GBL_DATA_SIZE > CONFIG_SYS_INIT_RAM_SIZE
+#error "MALLOC_F_LEN too large to fit into initial RAM."
 #endif
 
 	/* r3 = new stack pointer / pre-reloc malloc area */
-	subi    r3, r3, CONFIG_SYS_MALLOC_F_LEN
+	subi    r3, r3, MALLOC_F_LEN
 
 	/* Set pointer to pre-reloc malloc area in GD */
 	stw     r3, GD_MALLOC_BASE(r4)
diff --git a/arch/powerpc/cpu/mpc85xx/start.S b/arch/powerpc/cpu/mpc85xx/start.S
index 63fdffd..6fa7592 100644
--- a/arch/powerpc/cpu/mpc85xx/start.S
+++ b/arch/powerpc/cpu/mpc85xx/start.S
@@ -38,6 +38,11 @@
 #define NOR_BOOT
 #endif
 
+#if defined(CONFIG_SPL_BUILD)
+#define MALLOC_F_LEN	CONFIG_SPL_SYS_MALLOC_F_LEN
+#else
+#define MALLOC_F_LEN	CONFIG_SYS_MALLOC_F_LEN
+#endif
 /*
  * Set up GOT: Global Offset Table
  *
@@ -1183,14 +1188,13 @@ _start_cont:
 	lis	r3,(CONFIG_SYS_INIT_RAM_ADDR)@h
 	ori	r3,r3,((CONFIG_SYS_INIT_SP_OFFSET-16)&~0xf)@l /* Align to 16 */
 
-#ifdef CONFIG_SYS_MALLOC_F_LEN
-
-#if CONFIG_SYS_MALLOC_F_LEN + GENERATED_GBL_DATA_SIZE > CONFIG_SYS_INIT_RAM_SIZE
-#error "CONFIG_SYS_MALLOC_F_LEN too large to fit into initial RAM."
+#ifdef CONFIG_SYS_MALLOC_F
+#if MALLOC_F_LEN + GENERATED_GBL_DATA_SIZE > CONFIG_SYS_INIT_RAM_SIZE
+#error "MALLOC_F_LEN too large to fit into initial RAM."
 #endif
 
 	/* Leave 16+ byte for back chain termination and NULL return address */
-	subi	r3,r3,((CONFIG_SYS_MALLOC_F_LEN+16+15)&~0xf)
+	subi	r3,r3,((MALLOC_F_LEN+16+15)&~0xf)
 #endif
 
 	/* End of RAM */
@@ -1204,7 +1208,7 @@ _start_cont:
 	cmplw 	r4,r3
 	bne	1b
 
-#ifdef CONFIG_SYS_MALLOC_F_LEN
+#ifdef CONFIG_SYS_MALLOC_F
 	lis	r4,(CONFIG_SYS_INIT_RAM_ADDR)@h
 	ori	r4,r4,(CONFIG_SYS_GBL_DATA_OFFSET)@l
 
-- 
2.7.4




More information about the U-Boot mailing list