arm: remove bios_name
Get the firmware name from the MachineState object.
Cc: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20201026143028.3034018-4-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
diff --git a/hw/arm/cubieboard.c b/hw/arm/cubieboard.c
index 1c6c792..9d0d728 100644
--- a/hw/arm/cubieboard.c
+++ b/hw/arm/cubieboard.c
@@ -40,7 +40,7 @@
DeviceState *carddev;
/* BIOS is not supported by this board */
- if (bios_name) {
+ if (machine->firmware) {
error_report("BIOS not supported for this machine");
exit(1);
}
diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c
index f710878..fd34297 100644
--- a/hw/arm/highbank.c
+++ b/hw/arm/highbank.c
@@ -297,16 +297,16 @@
memory_region_init_ram(sysram, NULL, "highbank.sysram", 0x8000,
&error_fatal);
memory_region_add_subregion(sysmem, 0xfff88000, sysram);
- if (bios_name != NULL) {
- sysboot_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
+ if (machine->firmware != NULL) {
+ sysboot_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, machine->firmware);
if (sysboot_filename != NULL) {
if (load_image_targphys(sysboot_filename, 0xfff88000, 0x8000) < 0) {
- error_report("Unable to load %s", bios_name);
+ error_report("Unable to load %s", machine->firmware);
exit(1);
}
g_free(sysboot_filename);
} else {
- error_report("Unable to find %s", bios_name);
+ error_report("Unable to find %s", machine->firmware);
exit(1);
}
}
diff --git a/hw/arm/npcm7xx_boards.c b/hw/arm/npcm7xx_boards.c
index 79e2e27..9821013 100644
--- a/hw/arm/npcm7xx_boards.c
+++ b/hw/arm/npcm7xx_boards.c
@@ -33,13 +33,10 @@
static void npcm7xx_load_bootrom(MachineState *machine, NPCM7xxState *soc)
{
+ const char *bios_name = machine->firmware ?: npcm7xx_default_bootrom;
g_autofree char *filename = NULL;
int ret;
- if (!bios_name) {
- bios_name = npcm7xx_default_bootrom;
- }
-
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
if (!filename) {
error_report("Could not find ROM image '%s'", bios_name);
diff --git a/hw/arm/orangepi.c b/hw/arm/orangepi.c
index 17a568a..d6306df 100644
--- a/hw/arm/orangepi.c
+++ b/hw/arm/orangepi.c
@@ -41,7 +41,7 @@
DeviceState *carddev;
/* BIOS is not supported by this board */
- if (bios_name) {
+ if (machine->firmware) {
error_report("BIOS not supported for this machine");
exit(1);
}
diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c
index 4a5ea42..8272983 100644
--- a/hw/arm/sbsa-ref.c
+++ b/hw/arm/sbsa-ref.c
@@ -319,6 +319,7 @@
MemoryRegion *sysmem,
MemoryRegion *secure_sysmem)
{
+ const char *bios_name;
int i;
BlockBackend *pflash_blk0;
@@ -332,6 +333,7 @@
pflash_blk0 = pflash_cfi01_get_blk(sms->flash[0]);
+ bios_name = MACHINE(sms)->firmware;
if (bios_name) {
char *fname;
MemoryRegion *mr;
diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c
index 531f3a1..1adb663 100644
--- a/hw/arm/vexpress.c
+++ b/hw/arm/vexpress.c
@@ -560,7 +560,7 @@
/*
* If a bios file was provided, attempt to map it into memory
*/
- if (bios_name) {
+ if (machine->firmware) {
char *fn;
int image_size;
@@ -570,16 +570,16 @@
"but you cannot use both options at once");
exit(1);
}
- fn = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
+ fn = qemu_find_file(QEMU_FILE_TYPE_BIOS, machine->firmware);
if (!fn) {
- error_report("Could not find ROM image '%s'", bios_name);
+ error_report("Could not find ROM image '%s'", machine->firmware);
exit(1);
}
image_size = load_image_targphys(fn, map[VE_NORFLASH0],
VEXPRESS_FLASH_SIZE);
g_free(fn);
if (image_size < 0) {
- error_report("Could not load ROM image '%s'", bios_name);
+ error_report("Could not load ROM image '%s'", machine->firmware);
exit(1);
}
}
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 22572c3..d091248 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -1047,6 +1047,7 @@
MemoryRegion *secure_sysmem)
{
int i;
+ const char *bios_name;
BlockBackend *pflash_blk0;
/* Map legacy -drive if=pflash to machine properties */
@@ -1059,6 +1060,7 @@
pflash_blk0 = pflash_cfi01_get_blk(vms->flash[0]);
+ bios_name = MACHINE(vms)->firmware;
if (bios_name) {
char *fname;
MemoryRegion *mr;