|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 17/22] xen/xen-hvm.c: introduce TYPE_XEN_I8259_PIC device
This device represents the Xen PIC for an x86 machine.
Signed-off-by: Mark Cave-Ayland <mark.caveayland@xxxxxxxxxxx>
---
hw/i386/xen/xen-hvm.c | 38 +++++++++++++++++++++++++++++++++++++-
1 file changed, 37 insertions(+), 1 deletion(-)
diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c
index af3a90987c..b2378fe3f0 100644
--- a/hw/i386/xen/xen-hvm.c
+++ b/hw/i386/xen/xen-hvm.c
@@ -13,6 +13,7 @@
#include "qemu/error-report.h"
#include "qapi/error.h"
#include "qapi/qapi-commands-migration.h"
+#include "qom/object.h"
#include "trace.h"
#include "hw/core/hw-error.h"
@@ -69,6 +70,12 @@ static unsigned long *dirty_bitmap;
static Notifier suspend;
static Notifier wakeup;
+#define TYPE_XEN_I8259_PIC "xen-i8259-pic"
+
+DECLARE_OBJ_CHECKERS(DeviceState, DeviceClass, XEN_I8259_PIC,
+ TYPE_XEN_I8259_PIC)
+
+
/* Xen specific function for piix pci */
int xen_pci_slot_get_pirq(PCIDevice *pci_dev, int irq_num)
@@ -114,9 +121,28 @@ static void xen_set_irq(void *opaque, int irq, int level)
qemu_irq *xen_i8259_init(void)
{
- return qemu_allocate_irqs(xen_set_irq, NULL, 16);
+ qemu_irq *irq_set;
+ DeviceState *dev;
+ int i;
+
+ irq_set = g_new0(qemu_irq, 16);
+
+ dev = qdev_new(TYPE_XEN_I8259_PIC);
+ qdev_realize_and_unref(dev, NULL, &error_fatal);
+
+ for (i = 0 ; i < 16; i++) {
+ irq_set[i] = qdev_get_gpio_in(dev, i);
+ }
+
+ return irq_set;
}
+static void xen_i8259_pic_init(Object *obj)
+{
+ qdev_init_gpio_in(DEVICE(obj), xen_set_irq, 16);
+}
+
+
/* Memory Ops */
static void xen_ram_init(PCMachineState *pcms,
@@ -760,3 +786,13 @@ void arch_handle_ioreq(XenIOState *state, ioreq_t *req)
hw_error("Invalid ioreq type 0x%x\n", req->type);
}
}
+
+static const TypeInfo xen_i8259_type_infos[] = {
+ {
+ .name = TYPE_XEN_I8259_PIC,
+ .parent = TYPE_DEVICE,
+ .instance_init = xen_i8259_pic_init,
+ },
+};
+
+DEFINE_TYPES(xen_i8259_type_infos)
--
2.43.0
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |