arch/riscv: Pass the bootrom-provided FDT to the payload
The RISC-V boot protocol foresees that at every stage boundary (bootrom to boot loader, boot loader -> OS), register a0 contains the Hart ID and a1 contains the physical address of the Flattened Device Tree that the stage shall use. As a first step, pass the bootrom-provided FDT to the payload, unmodified. Change-Id: I468bc64a47153d564087235f1c7e2d10e3d7a658 Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net> Reviewed-on: https://review.coreboot.org/23797 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
This commit is contained in:
committed by
Martin Roth
parent
b26759d703
commit
042a8336f3
@@ -15,20 +15,35 @@
|
||||
|
||||
#include <program_loading.h>
|
||||
#include <vm.h>
|
||||
#include <arch/boot.h>
|
||||
#include <arch/encoding.h>
|
||||
#include <rules.h>
|
||||
#include <console/console.h>
|
||||
|
||||
/*
|
||||
* A pointer to the Flattened Device Tree passed to coreboot by the boot ROM.
|
||||
* Presumably this FDT is also in ROM.
|
||||
*
|
||||
* This pointer is only used in ramstage!
|
||||
*/
|
||||
const void *rom_fdt;
|
||||
|
||||
void arch_prog_run(struct prog *prog)
|
||||
{
|
||||
void (*doit)(void *) = prog_entry(prog);
|
||||
void riscvpayload(const char *configstring, void *payload);
|
||||
const char *config = NULL;
|
||||
void riscvpayload(const void *fdt, void *payload);
|
||||
|
||||
if (ENV_RAMSTAGE && prog_type(prog) == PROG_PAYLOAD) {
|
||||
printk(BIOS_SPEW, "Config string: '%s'\n", config);
|
||||
/*
|
||||
* FIXME: This is wrong and will crash. Linux can't (in early
|
||||
* boot) access memory that's before its own loading address.
|
||||
* We need to copy the FDT to a place where Linux can access it.
|
||||
*/
|
||||
const void *fdt = rom_fdt;
|
||||
|
||||
printk(BIOS_SPEW, "FDT is at %p\n", fdt);
|
||||
printk(BIOS_SPEW, "OK, let's go\n");
|
||||
riscvpayload(config, doit);
|
||||
riscvpayload(fdt, doit);
|
||||
}
|
||||
|
||||
doit(prog_entry_arg(prog));
|
||||
|
Reference in New Issue
Block a user