diff --git a/src/cpu/intel/car/romstage.c b/src/cpu/intel/car/romstage.c index 28801458cd..e24225e71e 100644 --- a/src/cpu/intel/car/romstage.c +++ b/src/cpu/intel/car/romstage.c @@ -21,6 +21,8 @@ #include #include +/* If we do not have a constrained _car_stack region size, use the + following as a guideline for acceptable stack usage. */ #define DCACHE_RAM_ROMSTAGE_STACK_SIZE 0x2000 static struct postcar_frame early_mtrrs; @@ -43,16 +45,18 @@ static void prepare_and_run_postcar(struct postcar_frame *pcf) static void romstage_main(unsigned long bist) { int i; - const int num_guards = 4; + const int num_guards = 64; const u32 stack_guard = 0xdeadbeef; u32 *stack_base; u32 size; + const size_t stack_size = MAX(CONFIG_DCACHE_BSP_STACK_SIZE, + DCACHE_RAM_ROMSTAGE_STACK_SIZE); /* Size of unallocated CAR. */ size = ALIGN_DOWN(_car_stack_size, 16); - size = MIN(size, DCACHE_RAM_ROMSTAGE_STACK_SIZE); - if (size < DCACHE_RAM_ROMSTAGE_STACK_SIZE) + size = MIN(size, stack_size); + if (size < stack_size) printk(BIOS_DEBUG, "Romstage stack size limited to 0x%x!\n", size);