]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
x86: fsp: Enlarge the size of malloc() pool before relocation
authorBin Meng <bmeng.cn@gmail.com>
Thu, 20 Aug 2015 13:40:19 +0000 (06:40 -0700)
committerLothar Waßmann <LW@KARO-electronics.de>
Thu, 10 Sep 2015 09:29:46 +0000 (11:29 +0200)
After fsp_init() returns, the stack has already been switched to a
place within system memory as defined by CONFIG_FSP_TEMP_RAM_ADDR.
Enlarge the size of malloc() pool before relocation since we have
plenty of memory now.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
arch/x86/Kconfig
arch/x86/cpu/start.S
arch/x86/lib/fsp/fsp_common.c

index 065bbe49b7f190b40aa3f5bfd6566eabce60d6d6..687208fb3001f050fb589015986ad1df00d78458 100644 (file)
@@ -232,6 +232,13 @@ config FSP_TEMP_RAM_ADDR
          Stack top address which is used in FspInit after DRAM is ready and
          CAR is disabled.
 
+config FSP_SYS_MALLOC_F_LEN
+       hex
+       depends on HAVE_FSP
+       default 0x100000
+       help
+         Additional size of malloc() pool before relocation.
+
 config SMP
        bool "Enable Symmetric Multiprocessing"
        default n
index e94ddc45ddb78475eefa3e306b9f352d1f378755..e2b5ef4b742173919401c1dd7ae99f84c00e6ae7 100644 (file)
@@ -141,6 +141,14 @@ car_init_ret:
        jz      skip_hob
        movl    %esi, GD_HOB_LIST(%edx)
 
+       /*
+        * After fsp_init() returns, the stack has already been switched to a
+        * place within system memory as defined by CONFIG_FSP_TEMP_RAM_ADDR.
+        * Enlarge the size of malloc() pool before relocation since we have
+        * plenty of memory now.
+        */
+       subl    $CONFIG_FSP_SYS_MALLOC_F_LEN, %esp
+       movl    %esp, GD_MALLOC_BASE(%edx)
 skip_hob:
 #else
        /* Store table pointer */
index d564cb9043eb84fa6ec1abbfe966708655ce644a..658f32d583257a237a2390258896dd6e8ee941a4 100644 (file)
@@ -56,8 +56,22 @@ void board_final_cleanup(void)
 
 int x86_fsp_init(void)
 {
-       if (!gd->arch.hob_list)
+       if (!gd->arch.hob_list) {
+               /*
+                * The first time we enter here, call fsp_init().
+                * Note the execution does not return to this function,
+                * instead it jumps to fsp_continue().
+                */
                fsp_init(CONFIG_FSP_TEMP_RAM_ADDR, BOOT_FULL_CONFIG, NULL);
+       } else {
+               /*
+                * The second time we enter here, adjust the size of malloc()
+                * pool before relocation. Given gd->malloc_base was adjusted
+                * after the call to board_init_f_mem() in arch/x86/cpu/start.S,
+                * we should fix up gd->malloc_limit here.
+                */
+               gd->malloc_limit += CONFIG_FSP_SYS_MALLOC_F_LEN;
+       }
 
        return 0;
 }