hw/riscv: write initrd 'chosen' FDT inside riscv_load_initrd()
commitb9a65476cbfc7a47a5c06ffdd58922fd295c5027
authorDaniel Henrique Barboza <dbarboza@ventanamicro.com>
Mon, 2 Jan 2023 11:52:36 +0000 (2 08:52 -0300)
committerAlistair Francis <alistair.francis@wdc.com>
Fri, 20 Jan 2023 00:14:13 +0000 (20 10:14 +1000)
tree529a073b9778749866d38c78211a0834fc0eb7fb
parentc44df400d9fc23d1d135f6aa723cb58ada858ee3
hw/riscv: write initrd 'chosen' FDT inside riscv_load_initrd()

riscv_load_initrd() returns the initrd end addr while also writing a
'start' var to mark the addr start. These informations are being used
just to write the initrd FDT node. Every existing caller of
riscv_load_initrd() is writing the FDT in the same manner.

We can simplify things by writing the FDT inside riscv_load_initrd(),
sparing callers from having to manage start/end addrs to write the FDT
themselves.

An 'if (fdt)' check is already inserted at the end of the function
because we'll end up using it later on with other boards that doesn´t
have a FDT.

Cc: Palmer Dabbelt <palmer@dabbelt.com>
Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Reviewed-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20230102115241.25733-7-dbarboza@ventanamicro.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
hw/riscv/boot.c
hw/riscv/microchip_pfsoc.c
hw/riscv/sifive_u.c
hw/riscv/spike.c
hw/riscv/virt.c
include/hw/riscv/boot.h