Arthur Heymans has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/36145 )
Change subject: [RFC,POC]arch/arm: Pass cbmem_top to ramstage via calling argument ......................................................................
[RFC,POC]arch/arm: Pass cbmem_top to ramstage via calling argument
This solution is very generic and can in principle be implemented on all arch/soc.
Change-Id: If31f0f1de17ffc92c9397f32b26db25aff4b7cab Signed-off-by: Arthur Heymans arthur@aheymans.xyz --- M src/arch/arm/include/arch/stages.h M src/arch/arm/stages.c M src/mainboard/emulation/qemu-armv7/Makefile.inc 3 files changed, 17 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/45/36145/1
diff --git a/src/arch/arm/include/arch/stages.h b/src/arch/arm/include/arch/stages.h index 3841265..16cfbbc 100644 --- a/src/arch/arm/include/arch/stages.h +++ b/src/arch/arm/include/arch/stages.h @@ -16,6 +16,6 @@
#include <main_decl.h>
-void stage_entry(void); +void stage_entry(void *stage_arg);
#endif diff --git a/src/arch/arm/stages.c b/src/arch/arm/stages.c index c9f5744..50526c4 100644 --- a/src/arch/arm/stages.c +++ b/src/arch/arm/stages.c @@ -22,13 +22,28 @@ * .text.stage_entry section created by -ffunction-sections). */
+#include <cbmem.h> #include <arch/stages.h> #include <arch/cache.h>
/** * generic stage entry point. override this if board specific code is needed. */ -__weak void stage_entry(void) +#if ENV_RAMSTAGE +static uintptr_t cbmem_top_ptr; +#endif + +__weak void stage_entry(void *stage_arg) { +#if ENV_RAMSTAGE + cbmem_top_ptr = (uintptr_t)stage_arg; +#endif main(); } + +#if ENV_RAMSTAGE +void *cbmem_top(void) +{ + return (void *)cbmem_top_ptr; +} +#endif diff --git a/src/mainboard/emulation/qemu-armv7/Makefile.inc b/src/mainboard/emulation/qemu-armv7/Makefile.inc index d5742e1..c62915b 100644 --- a/src/mainboard/emulation/qemu-armv7/Makefile.inc +++ b/src/mainboard/emulation/qemu-armv7/Makefile.inc @@ -15,7 +15,6 @@ romstage-y += romstage.c
romstage-y += cbmem.c -ramstage-y += cbmem.c
bootblock-y += media.c romstage-y += media.c