[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 01/18] hw/pci: add device IRQ to PCIDevice
|
From: |
Mark Cave-Ayland |
|
Subject: |
[RFC PATCH 01/18] hw/pci: add device IRQ to PCIDevice |
|
Date: |
Thu, 11 May 2023 09:57:14 +0100 |
Introduce pci_device_init() and use it to initialise an output IRQ.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@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
- [RFC PATCH 00/18] PCI: convert IRQs to use qdev gpios, Mark Cave-Ayland, 2023/05/11
- [RFC PATCH 02/18] hw/pci: introduce PCI bus input IRQs, Mark Cave-Ayland, 2023/05/11
- [RFC PATCH 05/18] hw/char/serial-pci.c: switch SerialState to use PCI device input gpio, Mark Cave-Ayland, 2023/05/11
- [RFC PATCH 06/18] hw/ide/ich.c: switch AHCIState to use PCI device input gpio, Mark Cave-Ayland, 2023/05/11
- [RFC PATCH 07/18] hw/net/can/can_mioe3680_pci.c: switch Mioe3680PCIState to use PCI device input gpio, Mark Cave-Ayland, 2023/05/11