diff mbox series

[v2,20/40] sh4: shix: use generic cpu_model parsing

Message ID 1507211474-188400-21-git-send-email-imammedo@redhat.com
State New
Headers show
Series generalize parsing of cpu_model (part 2) | expand

Commit Message

Igor Mammedov Oct. 5, 2017, 1:50 p.m. UTC
default cpu model 'any' resolves to type TYPE_SH7750R_CPU
in superh_cpu_class_by_name(), so use it directly.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Acked-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
v2:
  - Explain in commit message why default cpu model 'any' is
    replaced by TYPE_SH7750R_CPU (Philippe Mathieu-Daudé)

CC: Magnus Damm <magnus.damm@gmail.com>
CC: Aurelien Jarno <aurelien@aurel32.net>
---
 hw/sh4/shix.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

Comments

Philippe Mathieu-Daudé Oct. 5, 2017, 3:15 p.m. UTC | #1
On 10/05/2017 10:50 AM, Igor Mammedov wrote:
> default cpu model 'any' resolves to type TYPE_SH7750R_CPU
> in superh_cpu_class_by_name(), so use it directly.
> 
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> ---
> v2:
>   - Explain in commit message why default cpu model 'any' is
>     replaced by TYPE_SH7750R_CPU (Philippe Mathieu-Daudé)
> 
> CC: Magnus Damm <magnus.damm@gmail.com>
> CC: Aurelien Jarno <aurelien@aurel32.net>
> ---
>  hw/sh4/shix.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/hw/sh4/shix.c b/hw/sh4/shix.c
> index 50ee36a..4add230 100644
> --- a/hw/sh4/shix.c
> +++ b/hw/sh4/shix.c
> @@ -45,7 +45,6 @@
>  
>  static void shix_init(MachineState *machine)
>  {
> -    const char *cpu_model = machine->cpu_model;
>      int ret;
>      SuperHCPU *cpu;
>      struct SH7750State *s;
> @@ -53,10 +52,7 @@ static void shix_init(MachineState *machine)
>      MemoryRegion *rom = g_new(MemoryRegion, 1);
>      MemoryRegion *sdram = g_new(MemoryRegion, 2);
>      
> -    if (!cpu_model)
> -        cpu_model = "any";
> -
> -    cpu = SUPERH_CPU(cpu_generic_init(TYPE_SUPERH_CPU, cpu_model));
> +    cpu = SUPERH_CPU(cpu_create(machine->cpu_type));
>  
>      /* Allocate memory space */
>      memory_region_init_ram(rom, NULL, "shix.rom", 0x4000, &error_fatal);
> @@ -89,6 +85,7 @@ static void shix_machine_init(MachineClass *mc)
>      mc->desc = "shix card";
>      mc->init = shix_init;
>      mc->is_default = 1;
> +    mc->default_cpu_type = TYPE_SH7750R_CPU;
>  }
>  
>  DEFINE_MACHINE("shix", shix_machine_init)
>
diff mbox series

Patch

diff --git a/hw/sh4/shix.c b/hw/sh4/shix.c
index 50ee36a..4add230 100644
--- a/hw/sh4/shix.c
+++ b/hw/sh4/shix.c
@@ -45,7 +45,6 @@ 
 
 static void shix_init(MachineState *machine)
 {
-    const char *cpu_model = machine->cpu_model;
     int ret;
     SuperHCPU *cpu;
     struct SH7750State *s;
@@ -53,10 +52,7 @@  static void shix_init(MachineState *machine)
     MemoryRegion *rom = g_new(MemoryRegion, 1);
     MemoryRegion *sdram = g_new(MemoryRegion, 2);
     
-    if (!cpu_model)
-        cpu_model = "any";
-
-    cpu = SUPERH_CPU(cpu_generic_init(TYPE_SUPERH_CPU, cpu_model));
+    cpu = SUPERH_CPU(cpu_create(machine->cpu_type));
 
     /* Allocate memory space */
     memory_region_init_ram(rom, NULL, "shix.rom", 0x4000, &error_fatal);
@@ -89,6 +85,7 @@  static void shix_machine_init(MachineClass *mc)
     mc->desc = "shix card";
     mc->init = shix_init;
     mc->is_default = 1;
+    mc->default_cpu_type = TYPE_SH7750R_CPU;
 }
 
 DEFINE_MACHINE("shix", shix_machine_init)