arch/x86: Add pre- and post-memory platform hooks to romstage
Introduce platform_romstage_pre_mem() and platform_romstage_post_mem() as weak symbols in the x86 romstage cycle. These hooks allow SoCs and mainboards to execute low-level setup or instrumentation immediately before and after memory initialization without modifying the core romstage.c flow. - platform_romstage_pre_mem: Called before mainboard_romstage_entry. - platform_romstage_post_mem: Called after memory is up but while still running on the Cache-as-RAM (CAR) stack. Change-Id: I59cb115de0d512106d9a029d683c10b025076893 Signed-off-by: Subrata Banik <subratabanik@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/90999 Reviewed-by: Jérémy Compostella <jeremy.compostella@intel.com> Reviewed-by: Pranava Y N <pranavayn@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
parent
57c6f5e995
commit
e13c79a31e
2 changed files with 28 additions and 0 deletions
|
|
@ -7,6 +7,19 @@
|
|||
#include <stdint.h>
|
||||
#include <cpu/x86/mtrr.h>
|
||||
|
||||
/*
|
||||
* 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);
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -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++) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue