From 574df1ba670aaac265ba44b2c94e831dfff9f96d Mon Sep 17 00:00:00 2001 From: "Ronald G. Minnich" Date: Sun, 6 Nov 2016 20:54:20 -0800 Subject: riscv: start to use the configstring functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These functions will allow us to remove hardcodes, as long as we can verify the qemu and lowrisc targets implement the configstring correctly. Hence, for the most part, we'll start with mainboard changes first. Define a new config variable, CONFIG_RISCV_CONFIGSTRING, which has a default value that works on all existing systems but which can be changed as needed for a new SOC or mainboard. Change-Id: I7dd3f553d3e61f1c49752fb04402b134fdfdf979 Signed-off-by: Ronald G. Minnich Reviewed-on: https://review.coreboot.org/17256 Tested-by: build bot (Jenkins) Reviewed-by: Jonathan Neuschäfer --- src/arch/riscv/Kconfig | 5 +++++ src/arch/riscv/Makefile.inc | 9 ++++++--- src/arch/riscv/boot.c | 7 +++++-- 3 files changed, 16 insertions(+), 5 deletions(-) (limited to 'src/arch/riscv') diff --git a/src/arch/riscv/Kconfig b/src/arch/riscv/Kconfig index a30cb7091b..f05a98b106 100644 --- a/src/arch/riscv/Kconfig +++ b/src/arch/riscv/Kconfig @@ -19,3 +19,8 @@ config ARCH_ROMSTAGE_RISCV config ARCH_RAMSTAGE_RISCV bool default n + +config RISCV_CONFIGSTRING + hex "Location of pointer to RISCV config string" + default 0x100c + depends on ARCH_RISCV diff --git a/src/arch/riscv/Makefile.inc b/src/arch/riscv/Makefile.inc index 1fe8f7c268..c68fd1e066 100644 --- a/src/arch/riscv/Makefile.inc +++ b/src/arch/riscv/Makefile.inc @@ -43,7 +43,8 @@ bootblock-y += \ $(top)/src/lib/memcmp.c \ $(top)/src/lib/memcpy.c \ $(top)/src/lib/memmove.c \ - $(top)/src/lib/memset.c + $(top)/src/lib/memset.c \ + $(top)/src/commonlib/configstring.c $(objcbfs)/bootblock.debug: $$(bootblock-objs) @printf " LINK $(subst $(obj)/,,$(@))\n" @@ -69,7 +70,8 @@ romstage-y += \ $(top)/src/lib/memcmp.c \ $(top)/src/lib/memcpy.c \ $(top)/src/lib/memmove.c \ - $(top)/src/lib/memset.c + $(top)/src/lib/memset.c \ + $(top)/src/commonlib/configstring.c romstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c @@ -102,7 +104,8 @@ ramstage-y += \ $(top)/src/lib/memcmp.c \ $(top)/src/lib/memcpy.c \ $(top)/src/lib/memmove.c \ - $(top)/src/lib/memset.c + $(top)/src/lib/memset.c \ + $(top)/src/commonlib/configstring.c $(eval $(call create_class_compiler,rmodules,riscv)) diff --git a/src/arch/riscv/boot.c b/src/arch/riscv/boot.c index ff1844eb0a..9483c48177 100644 --- a/src/arch/riscv/boot.c +++ b/src/arch/riscv/boot.c @@ -18,16 +18,19 @@ #include #include #include +#include void arch_prog_run(struct prog *prog) { void (*doit)(void *) = prog_entry(prog); - void riscvpayload(void *); + void riscvpayload(const char *configstring, void *payload); + const char *config = configstring(); if (ENV_RAMSTAGE && prog_type(prog) == PROG_PAYLOAD) { + printk(BIOS_SPEW, "Config string: '%s'\n", config); initVirtualMemory(); printk(BIOS_SPEW, "OK, let's go\n"); - riscvpayload(doit); + riscvpayload(config, doit); } doit(prog_entry_arg(prog)); -- cgit v1.2.3