From b3847e64242228166976f425cd42331db7857551 Mon Sep 17 00:00:00 2001 From: Aaron Durbin Date: Fri, 20 Mar 2015 15:55:08 -0500 Subject: program loading: add prog_run() function The prog_run() function abstracts away what is required for running a given program. Within it, there are 2 calls: 1. platform_prog_run() and 2. arch_prog_run(). The platform_prog_run() allows for a chipset to intercept a program that will be run. This allows for CPU switching as currently needed in t124 and t132. Change-Id: I22a5dd5bfb1018e7e46475e47ac993a0941e2a8c Signed-off-by: Aaron Durbin Reviewed-on: http://review.coreboot.org/8846 Tested-by: build bot (Jenkins) Tested-by: Raptor Engineering Automated Test Stand Reviewed-by: Marc Jones --- src/arch/riscv/Makefile.inc | 2 ++ src/arch/riscv/boot.c | 14 ++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'src/arch/riscv') diff --git a/src/arch/riscv/Makefile.inc b/src/arch/riscv/Makefile.inc index 242fd404e6..30c84a93e2 100644 --- a/src/arch/riscv/Makefile.inc +++ b/src/arch/riscv/Makefile.inc @@ -31,6 +31,7 @@ ifeq ($(CONFIG_ARCH_BOOTBLOCK_RISCV),y) bootblock_lds = $(src)/arch/riscv/bootblock.ld bootblock-y = bootblock.S stages.c +bootblock-y += boot.c bootblock-y += rom_media.c bootblock-y += \ $(top)/src/lib/memchr.c \ @@ -52,6 +53,7 @@ endif ################################################################################ ifeq ($(CONFIG_ARCH_ROMSTAGE_RISCV),y) +romstage-y += boot.c romstage-y += stages.c romstage-y += rom_media.c romstage-y += \ diff --git a/src/arch/riscv/boot.c b/src/arch/riscv/boot.c index 4c2be031c2..f66c02ff2e 100644 --- a/src/arch/riscv/boot.c +++ b/src/arch/riscv/boot.c @@ -17,11 +17,17 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include #include -void arch_payload_run(const struct payload *payload) +void arch_prog_run(struct prog *prog) { -// uart_rx_byte(0); - stage_exit(prog_entry(&payload->prog)); + void (*doit)(void *); + + doit = prog_entry(prog); + doit(prog_entry_arg(prog)); +} + +void arch_payload_run(struct payload *payload) +{ + arch_prog_run(&payload->prog); } -- cgit v1.2.3