Ronald G. Minnich (rminnich@gmail.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17256
-gerrit
commit c5135bda156304f312153af2ff21f7165f0fea4b Author: Ronald G. Minnich rminnich@gmail.com Date: Sun Nov 6 20:54:20 2016 -0800
riscv: start to use the configstring functions
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.
Change-Id: I7dd3f553d3e61f1c49752fb04402b134fdfdf979 Signed-off-by: Ronald G. Minnich rminnich@gmail.com --- src/arch/riscv/Makefile.inc | 9 ++++++--- src/arch/riscv/boot.c | 8 ++++---- src/mainboard/emulation/spike-riscv/romstage.c | 7 +++++++ 3 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/src/arch/riscv/Makefile.inc b/src/arch/riscv/Makefile.inc index cf6ce99..f5b0958 100644 --- a/src/arch/riscv/Makefile.inc +++ b/src/arch/riscv/Makefile.inc @@ -42,7 +42,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" @@ -68,7 +69,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 0fa4d5f..9483c48 100644 --- a/src/arch/riscv/boot.c +++ b/src/arch/riscv/boot.c @@ -18,19 +18,19 @@ #include <arch/encoding.h> #include <rules.h> #include <console/console.h> +#include <commonlib/configstring.h>
void arch_prog_run(struct prog *prog) { void (*doit)(void *) = prog_entry(prog); void riscvpayload(const char *configstring, void *payload); - uint32_t addr = *(uint32_t *)CONFIG_ARCH_CONFIGSTRING_RISCV; - const char *configstring = (const char *)(uintptr_t)addr; + const char *config = configstring();
if (ENV_RAMSTAGE && prog_type(prog) == PROG_PAYLOAD) { - printk(BIOS_SPEW, "Config string: '%s'\n", configstring); + printk(BIOS_SPEW, "Config string: '%s'\n", config); initVirtualMemory(); printk(BIOS_SPEW, "OK, let's go\n"); - riscvpayload(configstring, doit); + riscvpayload(config, doit); }
doit(prog_entry_arg(prog)); diff --git a/src/mainboard/emulation/spike-riscv/romstage.c b/src/mainboard/emulation/spike-riscv/romstage.c index b6314ccd..1317b00 100644 --- a/src/mainboard/emulation/spike-riscv/romstage.c +++ b/src/mainboard/emulation/spike-riscv/romstage.c @@ -15,9 +15,16 @@
#include <console/console.h> #include <program_loading.h> +#include <string.h> +#include <commonlib/configstring.h>
void main(void) { + uintptr_t base; + size_t size; + console_init(); + query_mem(configstring(), &base, &size); + printk(BIOS_SPEW, "0x%lx bytes of memory at 0x%llx\n", size, base); run_ramstage(); }