[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 3/7] hw/ide/cmd646: Configure IDE bus IRQs after realization
From: |
Philippe Mathieu-Daudé |
Subject: |
[RFC PATCH 3/7] hw/ide/cmd646: Configure IDE bus IRQs after realization |
Date: |
Fri, 9 Feb 2024 13:32:21 +0100 |
We shouldn't call qdev_get_gpio_in() on unrealized devices.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
Ideally we should rework the current IDE bus model to really
use QOM and not globals. Left for later.
---
hw/ide/cmd646.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/hw/ide/cmd646.c b/hw/ide/cmd646.c
index c0bcfa4414..92e1e7a4fc 100644
--- a/hw/ide/cmd646.c
+++ b/hw/ide/cmd646.c
@@ -291,9 +291,18 @@ static void pci_cmd646_ide_realize(PCIDevice *dev, Error
**errp)
/* TODO: RST# value should be 0 */
pci_conf[PCI_INTERRUPT_PIN] = 0x01; // interrupt on pin 1
- qdev_init_gpio_in(ds, cmd646_set_irq, 2);
for (i = 0; i < 2; i++) {
ide_bus_init(&d->bus[i], sizeof(d->bus[i]), ds, i, 2);
+ }
+}
+
+static void pci_cmd646_ide_wire(DeviceState *dev)
+{
+ PCIIDEState *d = PCI_IDE(dev);
+ DeviceState *ds = DEVICE(dev);
+
+ qdev_init_gpio_in(ds, cmd646_set_irq, 2);
+ for (unsigned i = 0; i < 2; i++) {
ide_bus_init_output_irq(&d->bus[i], qdev_get_gpio_in(ds, i));
bmdma_init(&d->bus[i], &d->bmdma[i], d);
@@ -324,6 +333,7 @@ static void cmd646_ide_class_init(ObjectClass *klass, void
*data)
dc->reset = cmd646_reset;
dc->vmsd = &vmstate_ide_pci;
+ dc->wire = pci_cmd646_ide_wire;
k->realize = pci_cmd646_ide_realize;
k->exit = pci_cmd646_ide_exitfn;
k->vendor_id = PCI_VENDOR_ID_CMD;
--
2.41.0
- [RFC PATCH 0/7] hw/qdev: Split 'wiring' phase from 'realize', Philippe Mathieu-Daudé, 2024/02/09
- [RFC PATCH 1/7] hw/qdev: Introduce DeviceClass::[un]wire() handlers, Philippe Mathieu-Daudé, 2024/02/09
- [RFC PATCH 2/7] hw/input/pckbd: Connect i8042 GPIOs once mouse/keyboard are realized, Philippe Mathieu-Daudé, 2024/02/09
- [RFC PATCH 4/7] hw/ide/sii3112: Configure IDE bus IRQs after realization, Philippe Mathieu-Daudé, 2024/02/09
- [RFC PATCH 3/7] hw/ide/cmd646: Configure IDE bus IRQs after realization,
Philippe Mathieu-Daudé <=
- [RFC PATCH 5/7] hw/ide/via: Configure IDE bus IRQs after realization, Philippe Mathieu-Daudé, 2024/02/09
- [RFC PATCH 6/7] hw/intc/mips_gic: Initialize IRQ array once device is realized, Philippe Mathieu-Daudé, 2024/02/09
- [RFC PATCH 7/7] hw/misc/mac_via: Have VIA1 child access parent IRQ once realized, Philippe Mathieu-Daudé, 2024/02/09
- Re: [RFC PATCH 0/7] hw/qdev: Split 'wiring' phase from 'realize', BALATON Zoltan, 2024/02/09
- Re: [RFC PATCH 0/7] hw/qdev: Split 'wiring' phase from 'realize', Bernhard Beschow, 2024/02/09