diff --git a/src/arch/x86/include/arch/romstage.h b/src/arch/x86/include/arch/romstage.h index 063d4edd6b..e0e82fd96e 100644 --- a/src/arch/x86/include/arch/romstage.h +++ b/src/arch/x86/include/arch/romstage.h @@ -7,6 +7,19 @@ #include #include +/* + * Platform-specific hooks for logic surrounding memory initialization. + * + * platform_romstage_pre_mem() is invoked before memory training. + * + * platform_romstage_post_mem() is invoked after DRAM is initialized but + * before the transition to the RAM-based stack (Post-CAR). + * + * Default: No-op. These are weak symbols to be overridden by SoC or mainboard. + */ +void platform_romstage_pre_mem(void); +void platform_romstage_post_mem(void); + void mainboard_romstage_entry(void); /* diff --git a/src/cpu/intel/car/romstage.c b/src/cpu/intel/car/romstage.c index 285c2f48b2..f0a55f14b3 100644 --- a/src/cpu/intel/car/romstage.c +++ b/src/cpu/intel/car/romstage.c @@ -16,6 +16,19 @@ following as a guideline for acceptable stack usage. */ #define DCACHE_RAM_ROMSTAGE_STACK_SIZE 0x2000 +/* + * Platform-specific hooks for logic surrounding memory initialization. + * + * platform_romstage_pre_mem() is invoked before memory training. + * + * platform_romstage_post_mem() is invoked after DRAM is initialized but + * before the transition to the RAM-based stack (Post-CAR). + * + * Default: No-op. These are weak symbols to be overridden by SoC or mainboard. + */ +__weak void platform_romstage_pre_mem(void) { /* no-op */ } +__weak void platform_romstage_post_mem(void) { /* no-op */ } + void __noreturn romstage_main(void) { int i; @@ -71,7 +84,9 @@ void __noreturn romstage_main(void) */ romstage_adainit(); + platform_romstage_pre_mem(); mainboard_romstage_entry(); + platform_romstage_post_mem(); /* Check the stack. */ for (i = 0; i < num_guards; i++) {