summary refs log tree commit diff stats
path: root/include/hw/intc
diff options
context:
space:
mode:
authorBibo Mao <maobibo@loongson.cn>2024-12-13 15:32:39 +0800
committerBibo Mao <maobibo@loongson.cn>2024-12-19 15:23:29 +0800
commit272c467a48815e77db89b69dcd251b9f5b22203e (patch)
treef34147edf0fc4dbba8c2275b8dbdb9aa3048317e /include/hw/intc
parent6b69f778176d6d00842ec4e7ac9400af1620387a (diff)
downloadfocaccia-qemu-272c467a48815e77db89b69dcd251b9f5b22203e.tar.gz
focaccia-qemu-272c467a48815e77db89b69dcd251b9f5b22203e.zip
hw/intc/loongarch_extioi: Inherit from loongarch_extioi_common
Set TYPE_LOONGARCH_EXTIOI inherit from TYPE_LOONGARCH_EXTIOI_COMMON
object, it shares vmsate and property of TYPE_LOONGARCH_EXTIOI_COMMON,
and has its own realize() function.

Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Reviewed-by: Song Gao <gaosong@loongson.cn>
Diffstat (limited to 'include/hw/intc')
-rw-r--r--include/hw/intc/loongarch_extioi.h17
-rw-r--r--include/hw/intc/loongarch_extioi_common.h12
2 files changed, 27 insertions, 2 deletions
diff --git a/include/hw/intc/loongarch_extioi.h b/include/hw/intc/loongarch_extioi.h
index d6747046b4..cc160c52dc 100644
--- a/include/hw/intc/loongarch_extioi.h
+++ b/include/hw/intc/loongarch_extioi.h
@@ -10,7 +10,20 @@
 
 #include "hw/intc/loongarch_extioi_common.h"
 
-#define LoongArchExtIOI LoongArchExtIOICommonState
 #define TYPE_LOONGARCH_EXTIOI "loongarch.extioi"
-OBJECT_DECLARE_SIMPLE_TYPE(LoongArchExtIOI, LOONGARCH_EXTIOI)
+OBJECT_DECLARE_TYPE(LoongArchExtIOIState, LoongArchExtIOIClass, LOONGARCH_EXTIOI)
+
+struct LoongArchExtIOIState {
+    LoongArchExtIOICommonState parent_obj;
+};
+
+struct LoongArchExtIOIClass {
+    LoongArchExtIOICommonClass parent_class;
+
+    DeviceRealize parent_realize;
+    DeviceUnrealize parent_unrealize;
+};
+
+#define LoongArchExtIOI         LoongArchExtIOICommonState
+#define LOONGARCH_EXTIOI(obj)   ((LoongArchExtIOICommonState *)obj)
 #endif /* LOONGARCH_EXTIOI_H */
diff --git a/include/hw/intc/loongarch_extioi_common.h b/include/hw/intc/loongarch_extioi_common.h
index 51243b8092..d45caa45f2 100644
--- a/include/hw/intc/loongarch_extioi_common.h
+++ b/include/hw/intc/loongarch_extioi_common.h
@@ -7,6 +7,7 @@
 #ifndef LOONGARCH_EXTIOI_COMMON_H
 #define LOONGARCH_EXTIOI_COMMON_H
 
+#include "qom/object.h"
 #include "hw/sysbus.h"
 #include "hw/loongarch/virt.h"
 
@@ -56,6 +57,10 @@
 #define EXTIOI_VIRT_COREMAP_START    (0x40)
 #define EXTIOI_VIRT_COREMAP_END      (0x240)
 
+#define TYPE_LOONGARCH_EXTIOI_COMMON "loongarch_extioi_common"
+OBJECT_DECLARE_TYPE(LoongArchExtIOICommonState,
+                    LoongArchExtIOICommonClass, LOONGARCH_EXTIOI_COMMON)
+
 typedef struct ExtIOICore {
     uint32_t coreisr[EXTIOI_IRQS_GROUP_COUNT];
     DECLARE_BITMAP(sw_isr[LS3A_INTC_IP], EXTIOI_IRQS);
@@ -82,4 +87,11 @@ struct LoongArchExtIOICommonState {
     MemoryRegion extioi_system_mem;
     MemoryRegion virt_extend;
 };
+
+struct LoongArchExtIOICommonClass {
+    SysBusDeviceClass parent_class;
+
+    DeviceRealize parent_realize;
+    int (*post_load)(void *s, int version_id);
+};
 #endif /* LOONGARCH_EXTIOI_H */