This QOM interface provides two simple handlers. One is to get an ICS object from an irq number and a second to resend the irqs when needed.
Signed-off-by: Cédric Le Goater <c...@kaod.org> --- hw/intc/xics.c | 7 +++++++ include/hw/ppc/xics.h | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/hw/intc/xics.c b/hw/intc/xics.c index b1294417a0ae..3e80d2d0f0d9 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -726,6 +726,12 @@ static const TypeInfo ics_base_info = { .class_size = sizeof(ICSStateClass), }; +static const TypeInfo xics_interface_info = { + .name = TYPE_XICS_INTERFACE, + .parent = TYPE_INTERFACE, + .class_size = sizeof(XICSInterfaceClass), +}; + /* * Exported functions */ @@ -766,6 +772,7 @@ static void xics_register_types(void) type_register_static(&ics_simple_info); type_register_static(&ics_base_info); type_register_static(&icp_info); + type_register_static(&xics_interface_info); } type_init(xics_register_types) diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h index 6d443ce09dba..fe2bb5c8ef54 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -177,6 +177,24 @@ struct ICSIRQState { uint8_t flags; }; +typedef struct XICSInterface { + Object parent; +} XICSInterface; + +#define TYPE_XICS_INTERFACE "xics-interface" +#define XICS_INTERFACE(obj) \ + OBJECT_CHECK(XICSInterface, (obj), TYPE_XICS_INTERFACE) +#define XICS_INTERFACE_CLASS(klass) \ + OBJECT_CLASS_CHECK(XICSInterfaceClass, (klass), TYPE_XICS_INTERFACE) +#define XICS_INTERFACE_GET_CLASS(obj) \ + OBJECT_GET_CLASS(XICSInterfaceClass, (obj), TYPE_XICS_INTERFACE) + +typedef struct XICSInterfaceClass { + InterfaceClass parent; + ICSState *(*ics_get)(XICSInterface *xi, int irq); + void (*ics_resend)(XICSInterface *xi); +} XICSInterfaceClass; + #define XICS_IRQS_SPAPR 1024 qemu_irq xics_get_qirq(XICSState *icp, int irq); -- 2.7.4