diff mbox series

[03/10] hw/arm/realview: Introduce abstract RealviewMachineClass

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

Commit Message

Philippe Mathieu-Daudé May 24, 2023, 2:58 p.m. UTC
Introduce the abstract QOM TYPE_REALVIEW_MACHINE to
handle fields common to all Realview machines.

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

Comments

Richard Henderson May 24, 2023, 7:04 p.m. UTC | #1
On 5/24/23 07:58, Philippe Mathieu-Daudé wrote:
> Introduce the abstract QOM TYPE_REALVIEW_MACHINE to
> handle fields common to all Realview machines.
> 
> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> ---
>   hw/arm/realview.c | 22 ++++++++++++++++++----
>   1 file changed, 18 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 07a80d0de3..f0a8a93b08 100644
--- a/hw/arm/realview.c
+++ b/hw/arm/realview.c
@@ -30,6 +30,15 @@ 
 #include "hw/i2c/arm_sbcon_i2c.h"
 #include "hw/sd/sd.h"
 
+struct RealviewMachineClass {
+    MachineClass parent_obj;
+};
+typedef struct RealviewMachineClass RealviewMachineClass;
+
+#define TYPE_REALVIEW_MACHINE   MACHINE_TYPE_NAME("realview-common")
+DECLARE_CLASS_CHECKERS(RealviewMachineClass,
+                       REALVIEW_MACHINE, TYPE_REALVIEW_MACHINE)
+
 #define SMP_BOOT_ADDR 0xe0000000
 #define SMP_BOOTREG_ADDR 0x10000030
 
@@ -448,20 +457,25 @@  static void realview_pbx_a9_class_init(ObjectClass *oc, void *data)
 static const TypeInfo realview_machine_types[] = {
     {
         .name           = MACHINE_TYPE_NAME("realview-eb"),
-        .parent         = TYPE_MACHINE,
+        .parent         = TYPE_REALVIEW_MACHINE,
         .class_init     = realview_eb_class_init,
     }, {
         .name           = MACHINE_TYPE_NAME("realview-eb-mpcore"),
-        .parent         = TYPE_MACHINE,
+        .parent         = TYPE_REALVIEW_MACHINE,
         .class_init     = realview_eb_mpcore_class_init,
     }, {
         .name           = MACHINE_TYPE_NAME("realview-pb-a8"),
-        .parent         = TYPE_MACHINE,
+        .parent         = TYPE_REALVIEW_MACHINE,
         .class_init     = realview_pb_a8_class_init,
     }, {
         .name           = MACHINE_TYPE_NAME("realview-pbx-a9"),
-        .parent         = TYPE_MACHINE,
+        .parent         = TYPE_REALVIEW_MACHINE,
         .class_init     = realview_pbx_a9_class_init,
+    }, {
+        .name           = TYPE_REALVIEW_MACHINE,
+        .parent         = TYPE_MACHINE,
+        .class_size     = sizeof(RealviewMachineClass),
+        .abstract       = true,
     }
 };