diff options
author | Bin Meng | 2015-08-20 06:40:19 -0700 |
---|---|---|
committer | Simon Glass | 2015-08-26 07:54:11 -0700 |
commit | 57b10f59b7c6ff0d3827e39acb6c3e348adbc14a (patch) | |
tree | 699e8a5d501d168cc5f3e03039dcbddf438722bd /arch | |
parent | a52a068eb189c6268017a25d48f50f26b2a08a0b (diff) |
x86: fsp: Enlarge the size of malloc() pool before relocation
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>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/Kconfig | 7 | ||||
-rw-r--r-- | arch/x86/cpu/start.S | 8 | ||||
-rw-r--r-- | arch/x86/lib/fsp/fsp_common.c | 16 |
3 files changed, 30 insertions, 1 deletions
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 065bbe49b7f..687208fb300 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -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 diff --git a/arch/x86/cpu/start.S b/arch/x86/cpu/start.S index e94ddc45ddb..e2b5ef4b742 100644 --- a/arch/x86/cpu/start.S +++ b/arch/x86/cpu/start.S @@ -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 */ diff --git a/arch/x86/lib/fsp/fsp_common.c b/arch/x86/lib/fsp/fsp_common.c index d564cb9043e..658f32d5832 100644 --- a/arch/x86/lib/fsp/fsp_common.c +++ b/arch/x86/lib/fsp/fsp_common.c @@ -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; } |