From patchwork Wed Jun 8 11:33:33 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 1777 Return-Path: Delivered-To: unknown Received: from imap.gmail.com (74.125.159.109) by localhost6.localdomain6 with IMAP4-SSL; 08 Jun 2011 14:55:47 -0000 Delivered-To: patches@linaro.org Received: by 10.52.181.10 with SMTP id ds10cs168047vdc; Wed, 8 Jun 2011 04:33:45 -0700 (PDT) Received: by 10.42.1.84 with SMTP id 20mr6059667icf.160.1307532825241; Wed, 08 Jun 2011 04:33:45 -0700 (PDT) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk [81.2.115.146]) by mx.google.com with ESMTPS id x9si3129917ics.8.2011.06.08.04.33.43 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 08 Jun 2011 04:33:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) client-ip=81.2.115.146; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) smtp.mail=pm215@archaic.org.uk Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1QUH0v-00074q-GC; Wed, 08 Jun 2011 12:33:33 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Paul Brook , Anthony Liguori , Markus Armbruster , =?UTF-8?q?Juha=20Riihim=C3=A4ki?= Subject: [PATCH RFC 3/3] sysbus: Allow passthrough of single IRQ Date: Wed, 8 Jun 2011 12:33:33 +0100 Message-Id: <1307532813-27175-4-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1307532813-27175-1-git-send-email-peter.maydell@linaro.org> References: <1307532813-27175-1-git-send-email-peter.maydell@linaro.org> Add a sysbus_pass_one_irq() function to allow one sysbus device to pass a single IRQ through to another. (It is already possible to delegate all your IRQs to another device with sysbus_pass_irq().) Signed-off-by: Peter Maydell --- hw/sysbus.c | 9 +++++++++ hw/sysbus.h | 1 + 2 files changed, 10 insertions(+), 0 deletions(-) diff --git a/hw/sysbus.c b/hw/sysbus.c index 793b0c1..8211e8f 100644 --- a/hw/sysbus.c +++ b/hw/sysbus.c @@ -134,6 +134,15 @@ void sysbus_pass_irq(SysBusDevice *dev, SysBusDevice *target) } } +void sysbus_pass_one_irq(SysBusDevice *dev, SysBusDevice *target, int tn) +{ + int n; + + assert(dev->num_irq < QDEV_MAX_IRQ); + n = dev->num_irq++; + dev->irqp[n] = target->irqp[tn]; +} + void sysbus_init_mmio(SysBusDevice *dev, target_phys_addr_t size, ram_addr_t iofunc) { diff --git a/hw/sysbus.h b/hw/sysbus.h index 789e4c5..a6a873c 100644 --- a/hw/sysbus.h +++ b/hw/sysbus.h @@ -51,6 +51,7 @@ void sysbus_init_mmio_cb(SysBusDevice *dev, target_phys_addr_t size, void sysbus_pass_mmio(SysBusDevice *dev, SysBusDevice *target, int target_mmio); void sysbus_init_irq(SysBusDevice *dev, qemu_irq *p); void sysbus_pass_irq(SysBusDevice *dev, SysBusDevice *target); +void sysbus_pass_one_irq(SysBusDevice *dev, SysBusDevice *target, int tn); void sysbus_init_ioports(SysBusDevice *dev, pio_addr_t ioport, pio_addr_t size);