Received: from eggs.gnu.org ([2001:4830:134:3::10]:44666) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1boEID-00077g-H5 for qemu-devel@nongnu.org; Sun, 25 Sep 2016 14:36:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1boEIA-00069u-9j for qemu-devel@nongnu.org; Sun, 25 Sep 2016 14:36:49 -0400 Received: from smtp2-g21.free.fr ([212.27.42.2]:16547) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1boEIA-00061v-1e for qemu-devel@nongnu.org; Sun, 25 Sep 2016 14:36:46 -0400 From: =?UTF-8?q?Herv=C3=A9=20Poussineau?= Date: Sun, 25 Sep 2016 20:36:08 +0200 Message-Id: <1474828572-25187-3-git-send-email-hpoussin@reactos.org> In-Reply-To: <1474828572-25187-1-git-send-email-hpoussin@reactos.org> References: <1474828572-25187-1-git-send-email-hpoussin@reactos.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH 2/6] intc/i8259: implement IntCtrl interface List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Luiz Capitulino , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , "Michael S. Tsirkin" , Paolo Bonzini Signed-off-by: Herv=C3=A9 Poussineau --- hw/intc/i8259.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/hw/intc/i8259.c b/hw/intc/i8259.c index c2607a5..c778b5d 100644 --- a/hw/intc/i8259.c +++ b/hw/intc/i8259.c @@ -29,6 +29,7 @@ #include "qemu/timer.h" #include "qemu/log.h" #include "hw/isa/i8259_internal.h" +#include "hw/intc/intc.h" =20 /* debug PIC */ //#define DEBUG_PIC @@ -251,6 +252,35 @@ static void pic_reset(DeviceState *dev) pic_init_reset(s); } =20 +static bool pic_get_statistics(IntCtrl *obj, uint64_t **irq_counts, + unsigned int *nb_irqs) +{ + PICCommonState *s =3D PIC_COMMON(obj); + + if (s->master) { +#ifdef DEBUG_IRQ_COUNT + *irq_counts =3D irq_count; + *nb_irqs =3D ARRAY_SIZE(irq_count); +#else + return false; +#endif + } else { + *irq_counts =3D NULL; + *nb_irqs =3D 0; + } + return true; +} + +static void pic_print_info(IntCtrl *obj, Monitor *mon) +{ + PICCommonState *s =3D PIC_COMMON(obj); + monitor_printf(mon, "pic%d: irr=3D%02x imr=3D%02x isr=3D%02x hprio=3D= %d " + "irq_base=3D%02x rr_sel=3D%d elcr=3D%02x fnm=3D%d\n", + s->master ? 0 : 1, s->irr, s->imr, s->isr, s->priorit= y_add, + s->irq_base, s->read_reg_select, s->elcr, + s->special_fully_nested_mode); +} + static void pic_ioport_write(void *opaque, hwaddr addr64, uint64_t val64, unsigned size) { @@ -503,10 +533,13 @@ static void i8259_class_init(ObjectClass *klass, vo= id *data) { PICClass *k =3D PIC_CLASS(klass); DeviceClass *dc =3D DEVICE_CLASS(klass); + IntCtrlClass *ic =3D INTCTRL_CLASS(klass); =20 k->parent_realize =3D dc->realize; dc->realize =3D pic_realize; dc->reset =3D pic_reset; + ic->get_statistics =3D pic_get_statistics; + ic->print_info =3D pic_print_info; } =20 static const TypeInfo i8259_info =3D { @@ -515,6 +548,10 @@ static const TypeInfo i8259_info =3D { .parent =3D TYPE_PIC_COMMON, .class_init =3D i8259_class_init, .class_size =3D sizeof(PICClass), + .interfaces =3D (InterfaceInfo[]) { + { TYPE_INTCTRL }, + { } + }, }; =20 static void pic_register_types(void) --=20 2.1.4