Marshall Dawson has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/35266 )
Change subject: drivers/intel/fsp2_0: Use generic defines for early storage ......................................................................
drivers/intel/fsp2_0: Use generic defines for early storage
Add the ability to run memory_init.c in an enviornment where there exists no CAR storage. CONFIG(RESET_VECTOR_IN_RAM) uses DRAM as early storage and created using a .ld file without _car symbols.
Substitute _car* with #defines and account for symbols generated when RESET_VECTOR_IN_RAM is active.
Change-Id: Ie9d102c3c1110bbb54ce788ec432da1a27e2f61f Signed-off-by: Marshall Dawson marshalldawson3rd@gmail.com --- M src/drivers/intel/fsp2_0/memory_init.c 1 file changed, 22 insertions(+), 7 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/66/35266/1
diff --git a/src/drivers/intel/fsp2_0/memory_init.c b/src/drivers/intel/fsp2_0/memory_init.c index 56771e2..b209786 100644 --- a/src/drivers/intel/fsp2_0/memory_init.c +++ b/src/drivers/intel/fsp2_0/memory_init.c @@ -34,6 +34,20 @@ #include <fsp/memory_init.h> #include <types.h>
+#if CONFIG(RESET_VECTOR_IN_RAM) + #define EARLY_STORAGE_START _earlyram_region_start + #define EARLY_STORAGE_USED (_earlyram_unallocated_start - _earlyram_region_start) + #define END_OF_ALLOCATED _earlyram_region_end + #define BSP_STACK_BASE _earlyram_stack_start + #define BSP_STACK_SIZE CONFIG_EARLYRAM_BSP_STACK_SIZE +#else + #define EARLY_STORAGE_START _car_region_start + #define EARLY_STORAGE_USED (_car_unallocated_start - _car_region_start) + #define END_OF_ALLOCATED _car_region_end + #define BSP_STACK_BASE _car_stack_start + #define BSP_STACK_SIZE CONFIG_DCACHE_BSP_STACK_SIZE +#endif + /* TPM MRC hash functionality depends on vboot starting before memory init. */ _Static_assert(!CONFIG(FSP2_0_USES_TPM_MRC_HASH) || CONFIG(VBOOT_STARTS_IN_BOOTBLOCK), @@ -174,17 +188,18 @@ * top and does not reinitialize stack pointer. */ if (CONFIG(FSP_USES_CB_STACK)) { - arch_upd->StackBase = (void *)_car_stack_start; - arch_upd->StackSize = CONFIG_DCACHE_BSP_STACK_SIZE; + arch_upd->StackBase = (void *)BSP_STACK_BASE; + arch_upd->StackSize = 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. + * provided by the blob itself. We let FSPM use unallocated + * space at the top of CAR or EARLYRAM region for the size + * it requests. */ - stack_end = (uintptr_t)_car_region_end; + stack_end = (uintptr_t)END_OF_ALLOCATED; stack_begin = stack_end - arch_upd->StackSize; if (check_region_overlap(memmap, "FSPM stack", stack_begin, stack_end) != CB_SUCCESS) @@ -404,8 +419,8 @@
/* Build up memory map of romstage address space including CAR. */ memranges_init_empty(&memmap, &freeranges[0], ARRAY_SIZE(freeranges)); - memranges_insert(&memmap, (uintptr_t)_car_region_start, - _car_unallocated_start - _car_region_start, 0); + memranges_insert(&memmap, (uintptr_t)EARLY_STORAGE_START, + EARLY_STORAGE_USED, 0); memranges_insert(&memmap, (uintptr_t)_program, REGION_SIZE(program), 0);
if (!CONFIG(FSP_M_XIP))