aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorDaniel Henrique Barboza <dbarboza@ventanamicro.com>2023-01-02 08:52:38 -0300
committerAlistair Francis <alistair.francis@wdc.com>2023-01-20 10:14:13 +1000
commit1f99146103dc49aabfa832f8527804087a4c2651 (patch)
tree3de212750e49c1bf43bca49e52afe6c615eb5709 /hw
parentb1f19f238cae53b5c90085db45e0335af19f5387 (diff)
downloadqemu-1f99146103dc49aabfa832f8527804087a4c2651.zip
qemu-1f99146103dc49aabfa832f8527804087a4c2651.tar.gz
qemu-1f99146103dc49aabfa832f8527804087a4c2651.tar.bz2
hw/riscv/boot.c: use MachineState in riscv_load_initrd()
'filename', 'mem_size' and 'fdt' from riscv_load_initrd() can all be retrieved by the MachineState object for all callers. Cc: Palmer Dabbelt <palmer@dabbelt.com> Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Bin Meng <bmeng@tinylab.org> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Message-Id: <20230102115241.25733-9-dbarboza@ventanamicro.com> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/riscv/boot.c6
-rw-r--r--hw/riscv/microchip_pfsoc.c3
-rw-r--r--hw/riscv/sifive_u.c3
-rw-r--r--hw/riscv/spike.c3
-rw-r--r--hw/riscv/virt.c3
5 files changed, 8 insertions, 10 deletions
diff --git a/hw/riscv/boot.c b/hw/riscv/boot.c
index 6b948d1..d3e780c 100644
--- a/hw/riscv/boot.c
+++ b/hw/riscv/boot.c
@@ -208,9 +208,11 @@ target_ulong riscv_load_kernel(const char *kernel_filename,
exit(1);
}
-void riscv_load_initrd(const char *filename, uint64_t mem_size,
- uint64_t kernel_entry, void *fdt)
+void riscv_load_initrd(MachineState *machine, uint64_t kernel_entry)
{
+ const char *filename = machine->initrd_filename;
+ uint64_t mem_size = machine->ram_size;
+ void *fdt = machine->fdt;
hwaddr start, end;
ssize_t size;
diff --git a/hw/riscv/microchip_pfsoc.c b/hw/riscv/microchip_pfsoc.c
index 593a799..1e9b0a4 100644
--- a/hw/riscv/microchip_pfsoc.c
+++ b/hw/riscv/microchip_pfsoc.c
@@ -633,8 +633,7 @@ static void microchip_icicle_kit_machine_init(MachineState *machine)
kernel_start_addr, NULL);
if (machine->initrd_filename) {
- riscv_load_initrd(machine->initrd_filename, machine->ram_size,
- kernel_entry, machine->fdt);
+ riscv_load_initrd(machine, kernel_entry);
}
if (machine->kernel_cmdline && *machine->kernel_cmdline) {
diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c
index 3e6df87..c40885e 100644
--- a/hw/riscv/sifive_u.c
+++ b/hw/riscv/sifive_u.c
@@ -602,8 +602,7 @@ static void sifive_u_machine_init(MachineState *machine)
kernel_start_addr, NULL);
if (machine->initrd_filename) {
- riscv_load_initrd(machine->initrd_filename, machine->ram_size,
- kernel_entry, machine->fdt);
+ riscv_load_initrd(machine, kernel_entry);
}
if (machine->kernel_cmdline && *machine->kernel_cmdline) {
diff --git a/hw/riscv/spike.c b/hw/riscv/spike.c
index 60e2912..99dec74 100644
--- a/hw/riscv/spike.c
+++ b/hw/riscv/spike.c
@@ -312,8 +312,7 @@ static void spike_board_init(MachineState *machine)
htif_symbol_callback);
if (machine->initrd_filename) {
- riscv_load_initrd(machine->initrd_filename, machine->ram_size,
- kernel_entry, machine->fdt);
+ riscv_load_initrd(machine, kernel_entry);
}
if (machine->kernel_cmdline && *machine->kernel_cmdline) {
diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
index 6c946b6..02f1369 100644
--- a/hw/riscv/virt.c
+++ b/hw/riscv/virt.c
@@ -1285,8 +1285,7 @@ static void virt_machine_done(Notifier *notifier, void *data)
kernel_start_addr, NULL);
if (machine->initrd_filename) {
- riscv_load_initrd(machine->initrd_filename, machine->ram_size,
- kernel_entry, machine->fdt);
+ riscv_load_initrd(machine, kernel_entry);
}
if (machine->kernel_cmdline && *machine->kernel_cmdline) {