On 29/12/22 19:11, Daniel Henrique Barboza wrote:
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 <pal...@dabbelt.com>
Signed-off-by: Daniel Henrique Barboza <dbarb...@ventanamicro.com>
Reviewed-by: Bin Meng <bm...@tinylab.org>
---
  hw/riscv/boot.c            | 18 ++++++++++++------
  hw/riscv/microchip_pfsoc.c | 10 ++--------
  hw/riscv/sifive_u.c        | 10 ++--------
  hw/riscv/spike.c           | 10 ++--------
  hw/riscv/virt.c            | 10 ++--------
  include/hw/riscv/boot.h    |  4 ++--
  6 files changed, 22 insertions(+), 40 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <phi...@linaro.org>


Reply via email to