From nobody Wed Nov 5 16:41:01 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1536612606621894.0131450867214; Mon, 10 Sep 2018 13:50:06 -0700 (PDT) Received: from localhost ([::1]:53929 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fzT8H-00011b-KF for importer@patchew.org; Mon, 10 Sep 2018 16:50:05 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51665) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fzT5C-000696-KO for qemu-devel@nongnu.org; Mon, 10 Sep 2018 16:46:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fzT59-00036j-BR for qemu-devel@nongnu.org; Mon, 10 Sep 2018 16:46:54 -0400 Received: from chuckie.co.uk ([82.165.15.123]:36850 helo=s16892447.onlinehome-server.info) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fzT59-000363-4d; Mon, 10 Sep 2018 16:46:51 -0400 Received: from host86-138-87-37.range86-138.btcentralplus.com ([86.138.87.37] helo=kentang.home) by s16892447.onlinehome-server.info with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1fzT5D-0001Wq-Rx; Mon, 10 Sep 2018 21:46:57 +0100 From: Mark Cave-Ayland To: hpoussin@reactos.org, david@gibson.dropbear.id.au, pbonzini@redhat.com, famz@redhat.com, qemu-devel@nongnu.org, qemu-ppc@nongnu.org Date: Mon, 10 Sep 2018 21:46:30 +0100 Message-Id: <20180910204631.24106-2-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180910204631.24106-1-mark.cave-ayland@ilande.co.uk> References: <20180910204631.24106-1-mark.cave-ayland@ilande.co.uk> X-SA-Exim-Connect-IP: 86.138.87.37 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk X-SA-Exim-Version: 4.2.1 (built Sun, 08 Jan 2012 02:45:44 +0000) X-SA-Exim-Scanned: Yes (on s16892447.onlinehome-server.info) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 82.165.15.123 Subject: [Qemu-devel] [PATCH v3 1/2] lsi53c895a: add optional external IRQ via qdev X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" On some early machines the on-board PCI devices IRQs are wired directly to the interrupt controller instead of via the PCI host bridge. Add an optional external IRQ that if wired up via qdev will replace the in-built PCI IRQ. Signed-off-by: Mark Cave-Ayland --- hw/scsi/lsi53c895a.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c index f5cbbf653c..996b40650d 100644 --- a/hw/scsi/lsi53c895a.c +++ b/hw/scsi/lsi53c895a.c @@ -207,6 +207,7 @@ typedef struct { PCIDevice parent_obj; /*< public >*/ =20 + qemu_irq ext_irq; MemoryRegion mmio_io; MemoryRegion ram_io; MemoryRegion io_io; @@ -443,9 +444,19 @@ static void lsi_stop_script(LSIState *s) s->istat1 &=3D ~LSI_ISTAT1_SRUN; } =20 -static void lsi_update_irq(LSIState *s) +static void lsi_set_irq(LSIState *s, int level) { PCIDevice *d =3D PCI_DEVICE(s); + + if (s->ext_irq) { + qemu_set_irq(s->ext_irq, level); + } else { + pci_set_irq(d, level); + } +} + +static void lsi_update_irq(LSIState *s) +{ int level; static int last_level; lsi_request *p; @@ -477,7 +488,7 @@ static void lsi_update_irq(LSIState *s) level, s->dstat, s->sist1, s->sist0); last_level =3D level; } - pci_set_irq(d, level); + lsi_set_irq(s, level); =20 if (!level && lsi_irq_on_rsl(s) && !(s->scntl1 & LSI_SCNTL1_CON)) { DPRINTF("Handled IRQs & disconnected, looking for pending " @@ -2213,6 +2224,7 @@ static void lsi_scsi_realize(PCIDevice *dev, Error **= errp) "lsi-io", 256); =20 address_space_init(&s->pci_io_as, pci_address_space_io(dev), "lsi-pci-= io"); + qdev_init_gpio_out(d, &s->ext_irq, 1); =20 pci_register_bar(dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &s->io_io); pci_register_bar(dev, 1, PCI_BASE_ADDRESS_SPACE_MEMORY, &s->mmio_io); --=20 2.11.0