From 6d569e0c6b9a3e16d2a2c7276b26aba163b97dbc Mon Sep 17 00:00:00 2001 From: Aamir Bohra Date: Mon, 27 Aug 2018 13:36:15 +0530 Subject: intel/fsp2_0: Add fsp2.1 shared stack feature support FSP 2.1 implementation is adding features on top of fsp2_0. One such feature is a shared stack implementation that requires coreboot to allocate stack for fspm and then fsp uses the same stack as coreboot. This implementation adds support for shared stack feature. Change-Id: I6581111dbaddfa403eca14100577ccc8a05c4ec7 Signed-off-by: Aamir Bohra Reviewed-on: https://review.coreboot.org/28358 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin Reviewed-by: Subrata Banik Reviewed-by: Furquan Shaikh --- src/drivers/intel/fsp2_0/Kconfig | 9 +++++++++ src/drivers/intel/fsp2_0/memory_init.c | 33 +++++++++++++++++++++++++-------- 2 files changed, 34 insertions(+), 8 deletions(-) diff --git a/src/drivers/intel/fsp2_0/Kconfig b/src/drivers/intel/fsp2_0/Kconfig index f14954463b..4c4dfb2f24 100644 --- a/src/drivers/intel/fsp2_0/Kconfig +++ b/src/drivers/intel/fsp2_0/Kconfig @@ -97,6 +97,15 @@ config FSP_M_XIP help Select this value when FSP-M is execute-in-place. +config FSP_USES_CB_STACK + bool + default n + help + Enable support for fsp to use same stack as coreboot. + This option allows fsp to continue using coreboot stack + without reinitializing stack pointer. This feature is + supported Icelake onwards. + config VERIFY_HOBS bool "Verify the FSP hand-off-blocks" default n diff --git a/src/drivers/intel/fsp2_0/memory_init.c b/src/drivers/intel/fsp2_0/memory_init.c index cf033d7077..accb70ba91 100644 --- a/src/drivers/intel/fsp2_0/memory_init.c +++ b/src/drivers/intel/fsp2_0/memory_init.c @@ -165,27 +165,44 @@ static enum cb_err check_region_overlap(const struct memranges *ranges, return CB_SUCCESS; } - -static enum cb_err fsp_fill_common_arch_params(FSPM_ARCH_UPD *arch_upd, - bool s3wake, uint32_t fsp_version, - const struct memranges *memmap) +static enum cb_err setup_fsp_stack_frame(FSPM_ARCH_UPD *arch_upd, + const struct memranges *memmap) { uintptr_t stack_begin; uintptr_t stack_end; /* - * FSPM_UPD passed here is populated with default values provided by - * the blob itself. We let FSPM use top of CAR region of the size it - * requests. + * FSP 2.1 version would use same stack as coreboot instead of + * setting up seprate stack frame. FSP 2.1 would not relocate stack + * top and does not reinitialize stack pointer. + */ + if (IS_ENABLED(CONFIG_FSP_USES_CB_STACK)) { + arch_upd->StackBase = (void *)_car_stack_end; + arch_upd->StackSize = CONFIG_DCACHE_BSP_STACK_SIZE; + return CB_SUCCESS; + } + + /* + * FSPM_UPD passed here is populated with default values + * provided by the blob itself. We let FSPM use top of CAR + * region of the size it requests. */ stack_end = (uintptr_t)_car_region_end; stack_begin = stack_end - arch_upd->StackSize; - if (check_region_overlap(memmap, "FSPM stack", stack_begin, stack_end) != CB_SUCCESS) return CB_ERR; arch_upd->StackBase = (void *)stack_begin; + return CB_SUCCESS; +} + +static enum cb_err fsp_fill_common_arch_params(FSPM_ARCH_UPD *arch_upd, + bool s3wake, uint32_t fsp_version, + const struct memranges *memmap) +{ + if (setup_fsp_stack_frame(arch_upd, memmap)) + return CB_ERR; fsp_fill_mrc_cache(arch_upd, fsp_version); -- cgit v1.2.3