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 <wxjstz@126.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/31477
Reviewed-by: ron minnich <rminnich@gmail.com>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Philipp Hug <philipp@hug.cx>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Xiang Wang 2019-02-19 15:59:48 +08:00 committed by Patrick Rudolph
parent b1e6654d86
commit e56fb89e7c
1 changed files with 7 additions and 0 deletions

View File

@ -19,6 +19,7 @@
#include <arch/encoding.h>
#include <arch/smp/smp.h>
#include <mcall.h>
#include <commonlib/cbfs_serialized.h>
/*
* 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.