diff mbox series

[06/10] hw/arm/realview: Move 'is_pb' to RealviewMachineClass

Message ID 20230524145906.33156-7-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
Instead of having each machine instance set whether EP/PB,
set it once in their class_init() handler.

Arguably this could be extracted from the board_id field.

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

Comments

Richard Henderson May 24, 2023, 7:06 p.m. UTC | #1
On 5/24/23 07:59, Philippe Mathieu-Daudé wrote:
> Instead of having each machine instance set whether EP/PB,
> set it once in their class_init() handler.
> 
> Arguably this could be extracted from the board_id field.
> 
> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> ---
>   hw/arm/realview.c | 7 ++++---
>   1 file changed, 4 insertions(+), 3 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 c354ce0cfa..1a3a64e0ce 100644
--- a/hw/arm/realview.c
+++ b/hw/arm/realview.c
@@ -34,6 +34,7 @@  struct RealviewMachineClass {
     MachineClass parent_obj;
 
     int board_id;
+    bool is_pb;
 };
 typedef struct RealviewMachineClass RealviewMachineClass;
 
@@ -94,7 +95,7 @@  static void realview_init(MachineState *machine,
     unsigned int smp_cpus = machine->smp.cpus;
     qemu_irq cpu_irq[4];
     int is_mpcore = 0;
-    int is_pb = 0;
+    bool is_pb = rmc->is_pb;
     uint32_t proc_id = 0;
     uint32_t sys_id;
     ram_addr_t low_ram_size;
@@ -109,11 +110,9 @@  static void realview_init(MachineState *machine,
         periphbase = 0x10100000;
         break;
     case BOARD_PB_A8:
-        is_pb = 1;
         break;
     case BOARD_PBX_A9:
         is_mpcore = 1;
-        is_pb = 1;
         periphbase = 0x1f000000;
         break;
     }
@@ -446,6 +445,7 @@  static void realview_pb_a8_class_init(ObjectClass *oc, void *data)
     mc->init = realview_pb_a8_init;
     mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a8");
     rmc->board_id = 0x769;
+    rmc->is_pb = true;
 }
 
 static void realview_pbx_a9_class_init(ObjectClass *oc, void *data)
@@ -458,6 +458,7 @@  static void realview_pbx_a9_class_init(ObjectClass *oc, void *data)
     mc->max_cpus = 4;
     mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a9");
     rmc->board_id = 0x76d;
+    rmc->is_pb = true;
 }
 
 static const TypeInfo realview_machine_types[] = {