diff mbox series

[07/15] m68k: remove bios_name

Message ID 20201026143028.3034018-8-pbonzini@redhat.com
State New
Headers show
Series remove bios_name variable | expand

Commit Message

Paolo Bonzini Oct. 26, 2020, 2:30 p.m. UTC
Cc: Laurent Vivier <lvivier@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/m68k/mcf5208.c   | 10 +++++-----
 hw/m68k/next-cube.c |  4 +---
 hw/m68k/q800.c      |  4 +---
 3 files changed, 7 insertions(+), 11 deletions(-)

Comments

Alex Bennée Oct. 26, 2020, 5:17 p.m. UTC | #1
Paolo Bonzini <pbonzini@redhat.com> writes:

> Cc: Laurent Vivier <lvivier@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Philippe Mathieu-Daudé Oct. 26, 2020, 6:13 p.m. UTC | #2
On 10/26/20 3:30 PM, Paolo Bonzini wrote:
> Cc: Laurent Vivier <lvivier@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   hw/m68k/mcf5208.c   | 10 +++++-----
>   hw/m68k/next-cube.c |  4 +---
>   hw/m68k/q800.c      |  4 +---
>   3 files changed, 7 insertions(+), 11 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Thomas Huth Oct. 26, 2020, 6:54 p.m. UTC | #3
On 26/10/2020 15.30, Paolo Bonzini wrote:
> Cc: Laurent Vivier <lvivier@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  hw/m68k/mcf5208.c   | 10 +++++-----
>  hw/m68k/next-cube.c |  4 +---
>  hw/m68k/q800.c      |  4 +---
>  3 files changed, 7 insertions(+), 11 deletions(-)

Reviewed-by: Thomas Huth <thuth@redhat.com>
Laurent Vivier Oct. 26, 2020, 7:11 p.m. UTC | #4
Le 26/10/2020 à 15:30, Paolo Bonzini a écrit :
> Cc: Laurent Vivier <lvivier@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  hw/m68k/mcf5208.c   | 10 +++++-----
>  hw/m68k/next-cube.c |  4 +---
>  hw/m68k/q800.c      |  4 +---
>  3 files changed, 7 insertions(+), 11 deletions(-)
> 
> diff --git a/hw/m68k/mcf5208.c b/hw/m68k/mcf5208.c
> index d310a98e7b..7c8ca5ddf6 100644
> --- a/hw/m68k/mcf5208.c
> +++ b/hw/m68k/mcf5208.c
> @@ -301,17 +301,17 @@ static void mcf5208evb_init(MachineState *machine)
>      /* 0xfc0a8000 SDRAM controller.  */
>  
>      /* Load firmware */
> -    if (bios_name) {
> +    if (machine->firmware) {
>          char *fn;
>          uint8_t *ptr;
>  
> -        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);
>          }
>          if (load_image_targphys(fn, 0x0, ROM_SIZE) < 8) {
> -            error_report("Could not load ROM image '%s'", bios_name);
> +            error_report("Could not load ROM image '%s'", machine->firmware);
>              exit(1);
>          }
>          g_free(fn);
> @@ -323,7 +323,7 @@ static void mcf5208evb_init(MachineState *machine)
>  
>      /* Load kernel.  */
>      if (!kernel_filename) {
> -        if (qtest_enabled() || bios_name) {
> +        if (qtest_enabled() || machine->firmware) {
>              return;
>          }
>          error_report("Kernel image must be specified");

Why do you do differently for mcf5208 than the others?

    const char *bios_name = machine->firmware;

and no other changes?

With or without this:

Acked-by: Laurent Vivier <laurent@vivier.eu>


> diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c
> index e7045980b7..37bc35dfa4 100644
> --- a/hw/m68k/next-cube.c
> +++ b/hw/m68k/next-cube.c
> @@ -868,6 +868,7 @@ static void next_cube_init(MachineState *machine)
>      MemoryRegion *bmapm1 = g_new(MemoryRegion, 1);
>      MemoryRegion *bmapm2 = g_new(MemoryRegion, 1);
>      MemoryRegion *sysmem = get_system_memory();
> +    const char *bios_name = machine->firmware ?: ROM_FILE;
>      NeXTState *ns = NEXT_MACHINE(machine);
>      DeviceState *dev;
>  
> @@ -924,9 +925,6 @@ static void next_cube_init(MachineState *machine)
>      sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0x0200e000);
>  
>      /* Load ROM here */
> -    if (bios_name == NULL) {
> -        bios_name = ROM_FILE;
> -    }
>      /* still not sure if the rom should also be mapped at 0x0*/
>      memory_region_init_rom(rom, NULL, "next.rom", 0x20000, &error_fatal);
>      memory_region_add_subregion(sysmem, 0x01000000, rom);
> diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c
> index ce4b47c3e3..6ebcddcfb2 100644
> --- a/hw/m68k/q800.c
> +++ b/hw/m68k/q800.c
> @@ -167,6 +167,7 @@ static void q800_init(MachineState *machine)
>      const char *kernel_filename = machine->kernel_filename;
>      const char *initrd_filename = machine->initrd_filename;
>      const char *kernel_cmdline = machine->kernel_cmdline;
> +    const char *bios_name = machine->firmware ?: MACROM_FILENAME;
>      hwaddr parameters_base;
>      CPUState *cs;
>      DeviceState *dev;
> @@ -400,9 +401,6 @@ static void q800_init(MachineState *machine)
>          rom = g_malloc(sizeof(*rom));
>          memory_region_init_rom(rom, NULL, "m68k_mac.rom", MACROM_SIZE,
>                                 &error_abort);
> -        if (bios_name == NULL) {
> -            bios_name = MACROM_FILENAME;
> -        }
>          filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
>          memory_region_add_subregion(get_system_memory(), MACROM_ADDR, rom);
>  
>
Paolo Bonzini Oct. 27, 2020, 1:26 p.m. UTC | #5
On 26/10/20 20:11, Laurent Vivier wrote:
>>      /* Load kernel.  */
>>      if (!kernel_filename) {
>> -        if (qtest_enabled() || bios_name) {
>> +        if (qtest_enabled() || machine->firmware) {
>>              return;
>>          }
>>          error_report("Kernel image must be specified");
> Why do you do differently for mcf5208 than the others?
> 
>     const char *bios_name = machine->firmware;
> 
> and no other changes?

because in this case you can use machine->firmware, I'm keeping
bios_name for the cases where machine->firmware cannot be used directly
(e.g. there is a default).

Paolo
diff mbox series

Patch

diff --git a/hw/m68k/mcf5208.c b/hw/m68k/mcf5208.c
index d310a98e7b..7c8ca5ddf6 100644
--- a/hw/m68k/mcf5208.c
+++ b/hw/m68k/mcf5208.c
@@ -301,17 +301,17 @@  static void mcf5208evb_init(MachineState *machine)
     /* 0xfc0a8000 SDRAM controller.  */
 
     /* Load firmware */
-    if (bios_name) {
+    if (machine->firmware) {
         char *fn;
         uint8_t *ptr;
 
-        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);
         }
         if (load_image_targphys(fn, 0x0, ROM_SIZE) < 8) {
-            error_report("Could not load ROM image '%s'", bios_name);
+            error_report("Could not load ROM image '%s'", machine->firmware);
             exit(1);
         }
         g_free(fn);
@@ -323,7 +323,7 @@  static void mcf5208evb_init(MachineState *machine)
 
     /* Load kernel.  */
     if (!kernel_filename) {
-        if (qtest_enabled() || bios_name) {
+        if (qtest_enabled() || machine->firmware) {
             return;
         }
         error_report("Kernel image must be specified");
diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c
index e7045980b7..37bc35dfa4 100644
--- a/hw/m68k/next-cube.c
+++ b/hw/m68k/next-cube.c
@@ -868,6 +868,7 @@  static void next_cube_init(MachineState *machine)
     MemoryRegion *bmapm1 = g_new(MemoryRegion, 1);
     MemoryRegion *bmapm2 = g_new(MemoryRegion, 1);
     MemoryRegion *sysmem = get_system_memory();
+    const char *bios_name = machine->firmware ?: ROM_FILE;
     NeXTState *ns = NEXT_MACHINE(machine);
     DeviceState *dev;
 
@@ -924,9 +925,6 @@  static void next_cube_init(MachineState *machine)
     sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0x0200e000);
 
     /* Load ROM here */
-    if (bios_name == NULL) {
-        bios_name = ROM_FILE;
-    }
     /* still not sure if the rom should also be mapped at 0x0*/
     memory_region_init_rom(rom, NULL, "next.rom", 0x20000, &error_fatal);
     memory_region_add_subregion(sysmem, 0x01000000, rom);
diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c
index ce4b47c3e3..6ebcddcfb2 100644
--- a/hw/m68k/q800.c
+++ b/hw/m68k/q800.c
@@ -167,6 +167,7 @@  static void q800_init(MachineState *machine)
     const char *kernel_filename = machine->kernel_filename;
     const char *initrd_filename = machine->initrd_filename;
     const char *kernel_cmdline = machine->kernel_cmdline;
+    const char *bios_name = machine->firmware ?: MACROM_FILENAME;
     hwaddr parameters_base;
     CPUState *cs;
     DeviceState *dev;
@@ -400,9 +401,6 @@  static void q800_init(MachineState *machine)
         rom = g_malloc(sizeof(*rom));
         memory_region_init_rom(rom, NULL, "m68k_mac.rom", MACROM_SIZE,
                                &error_abort);
-        if (bios_name == NULL) {
-            bios_name = MACROM_FILENAME;
-        }
         filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
         memory_region_add_subregion(get_system_memory(), MACROM_ADDR, rom);