hw/riscv: Use macros for BIOS image names

The OpenSBI BIOS image names are used by many RISC-V machines.
Let's define macros for them.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-id: 20210430071302.1489082-7-bmeng.cn@gmail.com
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
This commit is contained in:
Bin Meng 2021-04-30 15:13:01 +08:00 committed by Alistair Francis
parent 0147af69ab
commit a0acd0a175
4 changed files with 11 additions and 12 deletions

View File

@ -560,12 +560,10 @@ static void sifive_u_machine_init(MachineState *machine)
if (riscv_is_32bit(&s->soc.u_cpus)) { if (riscv_is_32bit(&s->soc.u_cpus)) {
firmware_end_addr = riscv_find_and_load_firmware(machine, firmware_end_addr = riscv_find_and_load_firmware(machine,
"opensbi-riscv32-generic-fw_dynamic.bin", RISCV32_BIOS_BIN, start_addr, NULL);
start_addr, NULL);
} else { } else {
firmware_end_addr = riscv_find_and_load_firmware(machine, firmware_end_addr = riscv_find_and_load_firmware(machine,
"opensbi-riscv64-generic-fw_dynamic.bin", RISCV64_BIOS_BIN, start_addr, NULL);
start_addr, NULL);
} }
if (machine->kernel_filename) { if (machine->kernel_filename) {

View File

@ -258,13 +258,11 @@ static void spike_board_init(MachineState *machine)
*/ */
if (riscv_is_32bit(&s->soc[0])) { if (riscv_is_32bit(&s->soc[0])) {
firmware_end_addr = riscv_find_and_load_firmware(machine, firmware_end_addr = riscv_find_and_load_firmware(machine,
"opensbi-riscv32-generic-fw_dynamic.elf", RISCV32_BIOS_ELF, memmap[SPIKE_DRAM].base,
memmap[SPIKE_DRAM].base,
htif_symbol_callback); htif_symbol_callback);
} else { } else {
firmware_end_addr = riscv_find_and_load_firmware(machine, firmware_end_addr = riscv_find_and_load_firmware(machine,
"opensbi-riscv64-generic-fw_dynamic.elf", RISCV64_BIOS_ELF, memmap[SPIKE_DRAM].base,
memmap[SPIKE_DRAM].base,
htif_symbol_callback); htif_symbol_callback);
} }

View File

@ -681,12 +681,10 @@ static void virt_machine_init(MachineState *machine)
if (riscv_is_32bit(&s->soc[0])) { if (riscv_is_32bit(&s->soc[0])) {
firmware_end_addr = riscv_find_and_load_firmware(machine, firmware_end_addr = riscv_find_and_load_firmware(machine,
"opensbi-riscv32-generic-fw_dynamic.bin", RISCV32_BIOS_BIN, start_addr, NULL);
start_addr, NULL);
} else { } else {
firmware_end_addr = riscv_find_and_load_firmware(machine, firmware_end_addr = riscv_find_and_load_firmware(machine,
"opensbi-riscv64-generic-fw_dynamic.bin", RISCV64_BIOS_BIN, start_addr, NULL);
start_addr, NULL);
} }
if (machine->kernel_filename) { if (machine->kernel_filename) {

View File

@ -24,6 +24,11 @@
#include "hw/loader.h" #include "hw/loader.h"
#include "hw/riscv/riscv_hart.h" #include "hw/riscv/riscv_hart.h"
#define RISCV32_BIOS_BIN "opensbi-riscv32-generic-fw_dynamic.bin"
#define RISCV32_BIOS_ELF "opensbi-riscv32-generic-fw_dynamic.elf"
#define RISCV64_BIOS_BIN "opensbi-riscv64-generic-fw_dynamic.bin"
#define RISCV64_BIOS_ELF "opensbi-riscv64-generic-fw_dynamic.elf"
bool riscv_is_32bit(RISCVHartArrayState *harts); bool riscv_is_32bit(RISCVHartArrayState *harts);
target_ulong riscv_calc_kernel_start_addr(RISCVHartArrayState *harts, target_ulong riscv_calc_kernel_start_addr(RISCVHartArrayState *harts,