aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2020-10-22 11:12:46 -0400
committerPaolo Bonzini <pbonzini@redhat.com>2020-12-10 12:15:06 -0500
commitac6dd9b9f3dd6f0914a9c822fdeb43149bc9c9ff (patch)
tree988a774f175f3557c7de66a3d9e9cbcdf14628b1 /hw
parentcd7b94989a468bbdca40f663f35ce954c44a8c3f (diff)
downloadqemu-ac6dd9b9f3dd6f0914a9c822fdeb43149bc9c9ff.zip
qemu-ac6dd9b9f3dd6f0914a9c822fdeb43149bc9c9ff.tar.gz
qemu-ac6dd9b9f3dd6f0914a9c822fdeb43149bc9c9ff.tar.bz2
rx: move BIOS load from MCU to board
The ROM loader state is global and not part of the MCU, and the BIOS is in machine->firmware. So just like the kernel case, load it in the board. Due to the ordering between CPU reset and ROM reset, the ROM has to be registered before the CPU is realized, otherwise the reset vector is loaded before the ROM is there. Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/rx/rx-gdbsim.c10
-rw-r--r--hw/rx/rx62n.c9
2 files changed, 10 insertions, 9 deletions
diff --git a/hw/rx/rx-gdbsim.c b/hw/rx/rx-gdbsim.c
index 285549c..b1d7c24 100644
--- a/hw/rx/rx-gdbsim.c
+++ b/hw/rx/rx-gdbsim.c
@@ -106,6 +106,16 @@ static void rx_gdbsim_init(MachineState *machine)
rxc->xtal_freq_hz, &error_abort);
object_property_set_bool(OBJECT(&s->mcu), "load-kernel",
kernel_filename != NULL, &error_abort);
+
+ if (!kernel_filename) {
+ if (machine->firmware) {
+ rom_add_file_fixed(machine->firmware, RX62N_CFLASH_BASE, 0);
+ } else if (!qtest_enabled()) {
+ error_report("No bios or kernel specified");
+ exit(1);
+ }
+ }
+
qdev_realize(DEVICE(&s->mcu), NULL, &error_abort);
/* Load kernel and dtb */
diff --git a/hw/rx/rx62n.c b/hw/rx/rx62n.c
index 6eb4eea..17ec73f 100644
--- a/hw/rx/rx62n.c
+++ b/hw/rx/rx62n.c
@@ -245,15 +245,6 @@ static void rx62n_realize(DeviceState *dev, Error **errp)
rxc->rom_flash_size, &error_abort);
memory_region_add_subregion(s->sysmem, RX62N_CFLASH_BASE, &s->c_flash);
- if (!s->kernel) {
- if (bios_name) {
- rom_add_file_fixed(bios_name, RX62N_CFLASH_BASE, 0);
- } else if (!qtest_enabled()) {
- error_report("No bios or kernel specified");
- exit(1);
- }
- }
-
/* Initialize CPU */
object_initialize_child(OBJECT(s), "cpu", &s->cpu, TYPE_RX62N_CPU);
qdev_realize(DEVICE(&s->cpu), NULL, &error_abort);