mirror of https://github.com/proxmox/mirror_qemu
intc/i8259: implement InterruptStatsProvider interface
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org> Message-Id: <1474921408-24710-3-git-send-email-hpoussin@reactos.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>master
parent
120e512b7f
commit
4f2e39e103
|
@ -29,6 +29,7 @@
|
||||||
#include "qemu/timer.h"
|
#include "qemu/timer.h"
|
||||||
#include "qemu/log.h"
|
#include "qemu/log.h"
|
||||||
#include "hw/isa/i8259_internal.h"
|
#include "hw/isa/i8259_internal.h"
|
||||||
|
#include "hw/intc/intc.h"
|
||||||
|
|
||||||
/* debug PIC */
|
/* debug PIC */
|
||||||
//#define DEBUG_PIC
|
//#define DEBUG_PIC
|
||||||
|
@ -251,6 +252,35 @@ static void pic_reset(DeviceState *dev)
|
||||||
pic_init_reset(s);
|
pic_init_reset(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool pic_get_statistics(InterruptStatsProvider *obj,
|
||||||
|
uint64_t **irq_counts, unsigned int *nb_irqs)
|
||||||
|
{
|
||||||
|
PICCommonState *s = PIC_COMMON(obj);
|
||||||
|
|
||||||
|
if (s->master) {
|
||||||
|
#ifdef DEBUG_IRQ_COUNT
|
||||||
|
*irq_counts = irq_count;
|
||||||
|
*nb_irqs = ARRAY_SIZE(irq_count);
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
*irq_counts = NULL;
|
||||||
|
*nb_irqs = 0;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void pic_print_info(InterruptStatsProvider *obj, Monitor *mon)
|
||||||
|
{
|
||||||
|
PICCommonState *s = PIC_COMMON(obj);
|
||||||
|
monitor_printf(mon, "pic%d: irr=%02x imr=%02x isr=%02x hprio=%d "
|
||||||
|
"irq_base=%02x rr_sel=%d elcr=%02x fnm=%d\n",
|
||||||
|
s->master ? 0 : 1, s->irr, s->imr, s->isr, s->priority_add,
|
||||||
|
s->irq_base, s->read_reg_select, s->elcr,
|
||||||
|
s->special_fully_nested_mode);
|
||||||
|
}
|
||||||
|
|
||||||
static void pic_ioport_write(void *opaque, hwaddr addr64,
|
static void pic_ioport_write(void *opaque, hwaddr addr64,
|
||||||
uint64_t val64, unsigned size)
|
uint64_t val64, unsigned size)
|
||||||
{
|
{
|
||||||
|
@ -503,10 +533,13 @@ static void i8259_class_init(ObjectClass *klass, void *data)
|
||||||
{
|
{
|
||||||
PICClass *k = PIC_CLASS(klass);
|
PICClass *k = PIC_CLASS(klass);
|
||||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||||
|
InterruptStatsProviderClass *ic = INTERRUPT_STATS_PROVIDER_CLASS(klass);
|
||||||
|
|
||||||
k->parent_realize = dc->realize;
|
k->parent_realize = dc->realize;
|
||||||
dc->realize = pic_realize;
|
dc->realize = pic_realize;
|
||||||
dc->reset = pic_reset;
|
dc->reset = pic_reset;
|
||||||
|
ic->get_statistics = pic_get_statistics;
|
||||||
|
ic->print_info = pic_print_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo i8259_info = {
|
static const TypeInfo i8259_info = {
|
||||||
|
@ -515,6 +548,10 @@ static const TypeInfo i8259_info = {
|
||||||
.parent = TYPE_PIC_COMMON,
|
.parent = TYPE_PIC_COMMON,
|
||||||
.class_init = i8259_class_init,
|
.class_init = i8259_class_init,
|
||||||
.class_size = sizeof(PICClass),
|
.class_size = sizeof(PICClass),
|
||||||
|
.interfaces = (InterfaceInfo[]) {
|
||||||
|
{ TYPE_INTERRUPT_STATS_PROVIDER },
|
||||||
|
{ }
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
static void pic_register_types(void)
|
static void pic_register_types(void)
|
||||||
|
|
Loading…
Reference in New Issue