hw/intc/loongarch_pch: Inherit from loongarch_pic_common

Set TYPE_LOONGARCH_PIC inherit from TYPE_LOONGARCH_PIC_COMMON object,
it shares vmsate and property of TYPE_LOONGARCH_PIC_COMMON, and has
its own realize() function.

Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Reviewed-by: Song Gao <gaosong@loongson.cn>
This commit is contained in:
Bibo Mao 2024-09-18 14:45:50 +08:00
parent b7563779f9
commit 8bf26a9ea3
5 changed files with 77 additions and 26 deletions

View file

@ -40,6 +40,10 @@
#define POL_LO_START 0x40
#define POL_HI_START 0x44
#define TYPE_LOONGARCH_PIC_COMMON "loongarch_pic_common"
OBJECT_DECLARE_TYPE(LoongArchPICCommonState,
LoongArchPICCommonClass, LOONGARCH_PIC_COMMON)
struct LoongArchPICCommonState {
SysBusDevice parent_obj;
@ -67,4 +71,10 @@ struct LoongArchPICCommonState {
MemoryRegion iomem8;
unsigned int irq_num;
};
struct LoongArchPICCommonClass {
SysBusDeviceClass parent_class;
DeviceRealize parent_realize;
};
#endif /* HW_LOONGARCH_PIC_COMMON_H */