diff mbox series

[04/10] hw/arm/realview: Factor realview_common_class_init() out

Message ID 20230524145906.33156-5-philmd@linaro.org
State New
Headers show
Series hw/arm/realview: Introduce abstract RealviewMachineClass | expand

Commit Message

Philippe Mathieu-Daudé May 24, 2023, 2:59 p.m. UTC
Introduce realview_common_class_init() where we'll set
fields common to all Realview classes.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/arm/realview.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

Comments

Richard Henderson May 24, 2023, 7:05 p.m. UTC | #1
On 5/24/23 07:59, Philippe Mathieu-Daudé wrote:
> Introduce realview_common_class_init() where we'll set
> fields common to all Realview classes.
> 
> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> ---
>   hw/arm/realview.c | 12 ++++++++----
>   1 file changed, 8 insertions(+), 4 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~
diff mbox series

Patch

diff --git a/hw/arm/realview.c b/hw/arm/realview.c
index f0a8a93b08..6970e8a469 100644
--- a/hw/arm/realview.c
+++ b/hw/arm/realview.c
@@ -410,6 +410,13 @@  static void realview_pbx_a9_init(MachineState *machine)
     realview_init(machine, BOARD_PBX_A9);
 }
 
+static void realview_common_class_init(ObjectClass *oc, void *data)
+{
+    MachineClass *mc = MACHINE_CLASS(oc);
+
+    mc->ignore_memory_transaction_failures = true;
+}
+
 static void realview_eb_class_init(ObjectClass *oc, void *data)
 {
     MachineClass *mc = MACHINE_CLASS(oc);
@@ -417,7 +424,6 @@  static void realview_eb_class_init(ObjectClass *oc, void *data)
     mc->desc = "ARM RealView Emulation Baseboard (ARM926EJ-S)";
     mc->init = realview_eb_init;
     mc->block_default_type = IF_SCSI;
-    mc->ignore_memory_transaction_failures = true;
     mc->default_cpu_type = ARM_CPU_TYPE_NAME("arm926");
 }
 
@@ -429,7 +435,6 @@  static void realview_eb_mpcore_class_init(ObjectClass *oc, void *data)
     mc->init = realview_eb_mpcore_init;
     mc->block_default_type = IF_SCSI;
     mc->max_cpus = 4;
-    mc->ignore_memory_transaction_failures = true;
     mc->default_cpu_type = ARM_CPU_TYPE_NAME("arm11mpcore");
 }
 
@@ -439,7 +444,6 @@  static void realview_pb_a8_class_init(ObjectClass *oc, void *data)
 
     mc->desc = "ARM RealView Platform Baseboard for Cortex-A8";
     mc->init = realview_pb_a8_init;
-    mc->ignore_memory_transaction_failures = true;
     mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a8");
 }
 
@@ -450,7 +454,6 @@  static void realview_pbx_a9_class_init(ObjectClass *oc, void *data)
     mc->desc = "ARM RealView Platform Baseboard Explore for Cortex-A9";
     mc->init = realview_pbx_a9_init;
     mc->max_cpus = 4;
-    mc->ignore_memory_transaction_failures = true;
     mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a9");
 }
 
@@ -475,6 +478,7 @@  static const TypeInfo realview_machine_types[] = {
         .name           = TYPE_REALVIEW_MACHINE,
         .parent         = TYPE_MACHINE,
         .class_size     = sizeof(RealviewMachineClass),
+        .class_init     = realview_common_class_init,
         .abstract       = true,
     }
 };