From e56fb89e7c04655ec0fed36484d9e509e08f662f Mon Sep 17 00:00:00 2001 From: Xiang Wang Date: Tue, 19 Feb 2019 15:59:48 +0800 Subject: riscv: workaround selfboot putting the coreboot table into prog_entry_arg On RISC-V the argument to a payload is always the hartid and a pointer to a FDT. selfboot sets the coreboot tables as an argument, work around this here. Change-Id: If6929897c7f12d8acb079eeebaef512ae506ca8b Signed-off-by: Xiang Wang Reviewed-on: https://review.coreboot.org/c/coreboot/+/31477 Reviewed-by: ron minnich Reviewed-by: Patrick Rudolph Reviewed-by: Philipp Hug Tested-by: build bot (Jenkins) --- src/arch/riscv/boot.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/arch/riscv/boot.c b/src/arch/riscv/boot.c index edf5295d79..8e4bb36af5 100644 --- a/src/arch/riscv/boot.c +++ b/src/arch/riscv/boot.c @@ -19,6 +19,7 @@ #include #include #include +#include /* * A pointer to the Flattened Device Tree passed to coreboot by the boot ROM. @@ -33,6 +34,12 @@ static void do_arch_prog_run(struct prog *prog) int hart_id; void *fdt = prog_entry_arg(prog); + /* + * Workaround selfboot putting the coreboot table into prog_entry_arg + */ + if (prog_cbfs_type(prog) == CBFS_TYPE_SELF) + fdt = HLS()->fdt; + /* * If prog_entry_arg is not set (e.g. by fit_payload), use fdt from HLS * instead. -- cgit v1.2.3