qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org, Bernhard Beschow <shentey@gmail.com>
Cc: "John Snow" <jsnow@redhat.com>,
	"David Woodhouse" <dwmw2@infradead.org>,
	"BALATON Zoltan" <balaton@eik.bme.hu>,
	"Hervé Poussineau" <hpoussin@reactos.org>,
	qemu-ppc@nongnu.org, "Philippe Mathieu-Daudé" <philmd@linaro.org>,
	qemu-block@nongnu.org
Subject: [PATCH v3 01/18] hw/ide/piix: Expose output IRQ as properties for late object population
Date: Thu,  2 Mar 2023 23:40:41 +0100	[thread overview]
Message-ID: <20230302224058.43315-2-philmd@linaro.org> (raw)
In-Reply-To: <20230302224058.43315-1-philmd@linaro.org>

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/ide/piix.c         | 14 ++++++++++++--
 include/hw/ide/piix.h |  4 ++++
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/hw/ide/piix.c b/hw/ide/piix.c
index 41d60921e3..a36dac8469 100644
--- a/hw/ide/piix.c
+++ b/hw/ide/piix.c
@@ -121,6 +121,13 @@ static void piix_ide_reset(DeviceState *dev)
     pci_set_byte(pci_conf + 0x20, 0x01);  /* BMIBA: 20-23h */
 }
 
+static void piix_ide_initfn(Object *obj)
+{
+    PCIIDEState *dev = PCI_IDE(obj);
+
+    qdev_init_gpio_out_named(DEVICE(obj), dev->isa_irq, "ide-irq", 2);
+}
+
 static bool pci_piix_init_bus(PCIIDEState *d, unsigned i, Error **errp)
 {
     static const struct {
@@ -133,6 +140,7 @@ static bool pci_piix_init_bus(PCIIDEState *d, unsigned i, Error **errp)
     };
     int ret;
 
+    qemu_irq irq_out = d->isa_irq[i] ? : isa_get_irq(NULL, port_info[i].isairq);
     ide_bus_init(&d->bus[i], sizeof(d->bus[i]), DEVICE(d), i, 2);
     ret = ide_init_ioport(&d->bus[i], NULL, port_info[i].iobase,
                           port_info[i].iobase2);
@@ -141,7 +149,7 @@ static bool pci_piix_init_bus(PCIIDEState *d, unsigned i, Error **errp)
                          object_get_typename(OBJECT(d)), i);
         return false;
     }
-    ide_bus_init_output_irq(&d->bus[i], isa_get_irq(NULL, port_info[i].isairq));
+    ide_bus_init_output_irq(&d->bus[i], irq_out);
 
     bmdma_init(&d->bus[i], &d->bmdma[i], d);
     d->bmdma[i].bus = &d->bus[i];
@@ -162,7 +170,7 @@ static void pci_piix_ide_realize(PCIDevice *dev, Error **errp)
 
     vmstate_register(VMSTATE_IF(dev), 0, &vmstate_ide_pci, d);
 
-    for (unsigned i = 0; i < 2; i++) {
+    for (unsigned i = 0; i < ARRAY_SIZE(d->isa_irq); i++) {
         if (!pci_piix_init_bus(d, i, errp)) {
             return;
         }
@@ -199,6 +207,7 @@ static void piix3_ide_class_init(ObjectClass *klass, void *data)
 static const TypeInfo piix3_ide_info = {
     .name          = TYPE_PIIX3_IDE,
     .parent        = TYPE_PCI_IDE,
+    .instance_init = piix_ide_initfn,
     .class_init    = piix3_ide_class_init,
 };
 
@@ -221,6 +230,7 @@ static void piix4_ide_class_init(ObjectClass *klass, void *data)
 static const TypeInfo piix4_ide_info = {
     .name          = TYPE_PIIX4_IDE,
     .parent        = TYPE_PCI_IDE,
+    .instance_init = piix_ide_initfn,
     .class_init    = piix4_ide_class_init,
 };
 
diff --git a/include/hw/ide/piix.h b/include/hw/ide/piix.h
index ef3ef3d62d..533d24d408 100644
--- a/include/hw/ide/piix.h
+++ b/include/hw/ide/piix.h
@@ -1,6 +1,10 @@
 #ifndef HW_IDE_PIIX_H
 #define HW_IDE_PIIX_H
 
+/*
+ * QEMU interface:
+ *  + named GPIO outputs "ide-irq": asserted by each IDE channel
+ */
 #define TYPE_PIIX3_IDE "piix3-ide"
 #define TYPE_PIIX4_IDE "piix4-ide"
 
-- 
2.38.1



  reply	other threads:[~2023-03-02 22:42 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-02 22:40 [PATCH v3 00/18] hw/ide: Untangle ISA/PCI abuses of ide_init_ioport() Philippe Mathieu-Daudé
2023-03-02 22:40 ` Philippe Mathieu-Daudé [this message]
2023-04-26 10:35   ` [PATCH v3 01/18] hw/ide/piix: Expose output IRQ as properties for late object population Mark Cave-Ayland
2023-03-02 22:40 ` [PATCH v3 02/18] hw/ide/piix: Allow using PIIX3-IDE as standalone PCI function Philippe Mathieu-Daudé
2023-04-26 12:48   ` Mark Cave-Ayland
2023-03-02 22:40 ` [PATCH v3 03/18] hw/i386/pc_piix: Wire PIIX3 IDE ouput IRQs to ISA bus IRQs 14/15 Philippe Mathieu-Daudé
2023-04-26 12:50   ` Mark Cave-Ayland
2023-04-27  7:54     ` Bernhard Beschow
2023-04-27  7:58     ` Bernhard Beschow
2023-04-27 11:23       ` Mark Cave-Ayland
2023-04-27 13:04         ` BALATON Zoltan
2023-04-28 16:09           ` Bernhard Beschow
2023-03-02 22:40 ` [PATCH v3 04/18] hw/isa/piix4: Wire PIIX4 " Philippe Mathieu-Daudé
2023-04-26 12:51   ` Mark Cave-Ayland
2023-03-02 22:40 ` [PATCH v3 05/18] hw/ide: Rename ISA specific ide_init_ioport -> ide_bus_init_ioport_isa Philippe Mathieu-Daudé
2023-04-26 13:05   ` Mark Cave-Ayland
2023-03-02 22:40 ` [PATCH v3 06/18] hw/ide/piix: Ensure IDE output IRQs are wired at realization Philippe Mathieu-Daudé
2023-04-26 13:10   ` Mark Cave-Ayland
2023-03-02 22:40 ` [PATCH v3 07/18] hw/isa: Deprecate isa_get_irq() in favor of isa_bus_get_irq() Philippe Mathieu-Daudé
2023-04-26 13:12   ` Mark Cave-Ayland
2023-03-02 22:40 ` [PATCH v3 08/18] hw/ide: Introduce generic ide_init_ioport() Philippe Mathieu-Daudé
2023-04-26 13:15   ` Mark Cave-Ayland
2023-03-02 22:40 ` [PATCH v3 09/18] hw/ide/piix: Use generic ide_bus_init_ioport() Philippe Mathieu-Daudé
2023-03-02 22:40 ` [PATCH v3 10/18] hw/isa: Ensure isa_register_portio_list() do not get NULL ISA device Philippe Mathieu-Daudé
2023-04-26 13:16   ` Mark Cave-Ayland
2023-03-02 22:40 ` [PATCH v3 11/18] hw/isa: Simplify isa_address_space[_io]() Philippe Mathieu-Daudé
2023-04-26 13:18   ` Mark Cave-Ayland
2023-03-02 22:40 ` [PATCH v3 12/18] hw/isa: Reduce 'isabus' singleton scope to isa_bus_new() Philippe Mathieu-Daudé
2023-04-26 13:19   ` Mark Cave-Ayland
2023-03-02 22:40 ` [PATCH v3 13/18] exec/ioport: Factor portio_list_register_flush_coalesced() out Philippe Mathieu-Daudé
2023-04-26 13:26   ` Mark Cave-Ayland
2023-03-02 22:40 ` [PATCH v3 14/18] exec/ioport: Factor portio_list_register() out Philippe Mathieu-Daudé
2023-04-26 13:28   ` Mark Cave-Ayland
2023-03-02 22:40 ` [PATCH v3 15/18] hw/southbridge/piix: Use OBJECT_DECLARE_SIMPLE_TYPE() macro Philippe Mathieu-Daudé
2023-04-26 13:29   ` Mark Cave-Ayland
2023-03-02 22:40 ` [PATCH v3 16/18] hw/isa/piix: Batch register QOM types using DEFINE_TYPES() macro Philippe Mathieu-Daudé
2023-04-26 13:30   ` Mark Cave-Ayland
2023-03-02 22:40 ` [PATCH v3 17/18] hw/isa/piix: Unify QOM type name of PIIX ISA function Philippe Mathieu-Daudé
2023-04-26 13:33   ` Mark Cave-Ayland
2023-03-02 22:40 ` [PATCH v3 18/18] hw/isa/piix: Unify PIIX-ISA QOM type names using qdev aliases Philippe Mathieu-Daudé
2023-04-26 13:35   ` Mark Cave-Ayland
2023-03-03  0:09 ` [PATCH v3 00/18] hw/ide: Untangle ISA/PCI abuses of ide_init_ioport() Michael S. Tsirkin
2023-03-03  6:58 ` David Woodhouse
2023-03-03  7:46   ` Mark Cave-Ayland
2023-03-03 12:50     ` Philippe Mathieu-Daudé
2023-03-03 12:57       ` BALATON Zoltan
2023-03-04 11:52     ` Bernhard Beschow
2023-03-03 12:47   ` BALATON Zoltan
2023-03-03 14:59   ` BALATON Zoltan
2023-04-21  8:25 ` Michael S. Tsirkin
2023-04-26 13:49   ` Mark Cave-Ayland
2023-04-22 15:25 ` Bernhard Beschow

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230302224058.43315-2-philmd@linaro.org \
    --to=philmd@linaro.org \
    --cc=balaton@eik.bme.hu \
    --cc=dwmw2@infradead.org \
    --cc=hpoussin@reactos.org \
    --cc=jsnow@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=shentey@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).