Introduce pci_device_init() and use it to initialise an output IRQ. Signed-off-by: Mark Cave-Ayland <mark.cave-ayl...@ilande.co.uk> --- hw/pci/pci.c | 8 ++++++++ include/hw/pci/pci_device.h | 3 +++ 2 files changed, 11 insertions(+)
diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 8a87ccc8b0..f29ac20895 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -2161,6 +2161,13 @@ static void pci_qdev_realize(DeviceState *qdev, Error **errp) pci_dev->msi_trigger = pci_msi_trigger; } +static void pci_device_init(Object *obj) +{ + PCIDevice *pci_dev = PCI_DEVICE(obj); + + qdev_init_gpio_out(DEVICE(obj), &pci_dev->irq, 1); +} + PCIDevice *pci_new_multifunction(int devfn, bool multifunction, const char *name) { @@ -2812,6 +2819,7 @@ void pci_set_power(PCIDevice *d, bool state) static const TypeInfo pci_device_type_info = { .name = TYPE_PCI_DEVICE, .parent = TYPE_DEVICE, + .instance_init = pci_device_init, .instance_size = sizeof(PCIDevice), .abstract = true, .class_size = sizeof(PCIDeviceClass), diff --git a/include/hw/pci/pci_device.h b/include/hw/pci/pci_device.h index d3dd0f64b2..2c6dca5d15 100644 --- a/include/hw/pci/pci_device.h +++ b/include/hw/pci/pci_device.h @@ -149,6 +149,9 @@ struct PCIDevice { MemoryRegion rom; uint32_t rom_bar; + /* PCI IRQ */ + qemu_irq irq; + /* INTx routing notifier */ PCIINTxRoutingNotifier intx_routing_notifier; -- 2.30.2