diff mbox series

[2/7] hw/arm/raspi4b: Introduce abstract raspi4-base machine type

Message ID 20250201091528.1177-3-philmd@linaro.org
State New
Headers show
Series None | expand

Commit Message

Philippe Mathieu-Daudé Feb. 1, 2025, 9:15 a.m. UTC
In preparation of adding more machines based on the raspi4,
introduce TYPE_RASPI4_MACHINE. Remove TYPE_RASPI4B_MACHINE
definitions, declaring the machine name in place via the
MACHINE_TYPE_NAME("raspi4b") macro.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/arm/raspi4b.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/hw/arm/raspi4b.c b/hw/arm/raspi4b.c
index 5c78d26f957..548059f6d69 100644
--- a/hw/arm/raspi4b.c
+++ b/hw/arm/raspi4b.c
@@ -23,8 +23,8 @@ 
 #include "hw/arm/bcm2838.h"
 #include <libfdt.h>
 
-#define TYPE_RASPI4B_MACHINE MACHINE_TYPE_NAME("raspi4b")
-OBJECT_DECLARE_SIMPLE_TYPE(Raspi4bMachineState, RASPI4B_MACHINE)
+#define TYPE_RASPI4_MACHINE MACHINE_TYPE_NAME("raspi4-base")
+OBJECT_DECLARE_SIMPLE_TYPE(Raspi4bMachineState, RASPI4_MACHINE)
 
 struct Raspi4bMachineState {
     RaspiBaseMachineState parent_obj;
@@ -93,7 +93,7 @@  static void raspi4_modify_dtb(const struct arm_boot_info *info, void *fdt)
 
 static void raspi4b_machine_init(MachineState *machine)
 {
-    Raspi4bMachineState *s = RASPI4B_MACHINE(machine);
+    Raspi4bMachineState *s = RASPI4_MACHINE(machine);
     RaspiBaseMachineState *s_base = RASPI_BASE_MACHINE(machine);
     RaspiBaseMachineClass *mc = RASPI_BASE_MACHINE_GET_CLASS(machine);
     BCM2838State *soc = &s->soc;
@@ -123,11 +123,15 @@  static void raspi4b_machine_class_init(ObjectClass *oc, void *data)
 
 static const TypeInfo raspi4_machine_types[] = {
     {
-        .name           = TYPE_RASPI4B_MACHINE,
+        .name           = MACHINE_TYPE_NAME("raspi4b"),
+        .parent         = TYPE_RASPI4_MACHINE,
+        .class_init     = raspi4b_machine_class_init,
+    }, {
+        .name           = TYPE_RASPI4_MACHINE,
         .parent         = TYPE_RASPI_BASE_MACHINE,
         .instance_size  = sizeof(Raspi4bMachineState),
-        .class_init     = raspi4b_machine_class_init,
-    },
+        .abstract       = true,
+    }
 };
 
 DEFINE_TYPES(raspi4_machine_types)