From patchwork Tue Jun 14 02:37:46 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 100273 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 0EEE2B6FB1 for ; Tue, 14 Jun 2011 15:01:55 +1000 (EST) Received: from localhost ([::1]:43683 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QWLlA-0001C5-1I for incoming@patchwork.ozlabs.org; Tue, 14 Jun 2011 01:01:52 -0400 Received: from eggs.gnu.org ([140.186.70.92]:57333) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QWJW8-0006vB-NO for qemu-devel@nongnu.org; Mon, 13 Jun 2011 22:38:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QWJW3-0006i2-1s for qemu-devel@nongnu.org; Mon, 13 Jun 2011 22:38:11 -0400 Received: from fmmailgate02.web.de ([217.72.192.227]:57782) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QWJW2-0006hi-Cg for qemu-devel@nongnu.org; Mon, 13 Jun 2011 22:38:06 -0400 Received: from smtp03.web.de ( [172.20.0.65]) by fmmailgate02.web.de (Postfix) with ESMTP id 687E51A30DD21; Tue, 14 Jun 2011 04:38:05 +0200 (CEST) Received: from [87.173.124.240] (helo=af.local) by smtp03.web.de with asmtp (WEB.DE 4.110 #2) id 1QWJW1-0000Aw-00; Tue, 14 Jun 2011 04:38:05 +0200 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Date: Tue, 14 Jun 2011 04:37:46 +0200 Message-Id: <1308019077-61957-13-git-send-email-andreas.faerber@web.de> X-Mailer: git-send-email 1.7.5.3 In-Reply-To: <1308019077-61957-12-git-send-email-andreas.faerber@web.de> References: <1308019077-61957-1-git-send-email-andreas.faerber@web.de> <1308019077-61957-2-git-send-email-andreas.faerber@web.de> <1308019077-61957-3-git-send-email-andreas.faerber@web.de> <1308019077-61957-4-git-send-email-andreas.faerber@web.de> <1308019077-61957-5-git-send-email-andreas.faerber@web.de> <1308019077-61957-6-git-send-email-andreas.faerber@web.de> <1308019077-61957-7-git-send-email-andreas.faerber@web.de> <1308019077-61957-8-git-send-email-andreas.faerber@web.de> <1308019077-61957-9-git-send-email-andreas.faerber@web.de> <1308019077-61957-10-git-send-email-andreas.faerber@web.de> <1308019077-61957-11-git-send-email-andreas.faerber@web.de> <1308019077-61957-12-git-send-email-andreas.faerber@web.de> MIME-Version: 1.0 X-Sender: Andreas.Faerber@web.de X-Provags-ID: V01U2FsdGVkX18dSJKPAtOUt7BpUMKSUV3WpbQsCtSI6FH7J6Sq 9XU77V+X1iKP2BXeG2Fkyq2JeLnN0dr8YBiU8DGeX2X48IWUc1 CTNTx/7wzLeB6oMrGNjA== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 X-Received-From: 217.72.192.227 Cc: =?UTF-8?q?Andreas=20F=C3=A4rber?= , Gerd Hoffmann , Markus Armbruster Subject: [Qemu-devel] [RFC v5 12/23] isa: Allow to un-associate an IRQ X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org ISADevices keep a list of numeric IRQs. Remove one from that list. Also optionally NULL the qemu_irq, calling it "uninit" for symmetry. Cc: Gerd Hoffmann Cc: Markus Armbruster Signed-off-by: Andreas Färber --- hw/isa-bus.c | 17 +++++++++++++++++ hw/isa.h | 1 + 2 files changed, 18 insertions(+), 0 deletions(-) diff --git a/hw/isa-bus.c b/hw/isa-bus.c index 6e33d80..d037ed3 100644 --- a/hw/isa-bus.c +++ b/hw/isa-bus.c @@ -80,6 +80,23 @@ void isa_init_irq(ISADevice *dev, qemu_irq *p, int isairq) dev->nirqs++; } +void isa_uninit_irq(ISADevice *dev, qemu_irq *p, int isairq) +{ + int i, j; + for (i = 0; i < dev->nirqs; i++) { + if (dev->isairq[i] == isairq) { + for (j = i + 1; j < dev->nirqs; j++) { + dev->isairq[j - 1] = dev->isairq[j]; + } + dev->nirqs--; + break; + } + } + if (p != NULL) { + *p = NULL; + } +} + static void isa_init_ioport_one(ISADevice *dev, uint16_t ioport) { assert(dev->nioports < ARRAY_SIZE(dev->ioports)); diff --git a/hw/isa.h b/hw/isa.h index fe1a20c..72829bb 100644 --- a/hw/isa.h +++ b/hw/isa.h @@ -32,6 +32,7 @@ ISABus *isa_bus_new(DeviceState *dev); void isa_bus_irqs(qemu_irq *irqs); qemu_irq isa_get_irq(int isairq); void isa_init_irq(ISADevice *dev, qemu_irq *p, int isairq); +void isa_uninit_irq(ISADevice *dev, qemu_irq *p, int isairq); void isa_init_ioport(ISADevice *dev, uint16_t ioport); void isa_init_ioport_range(ISADevice *dev, uint16_t start, uint16_t length); void isa_discard_ioport_range(ISADevice *dev, uint16_t start, uint16_t length);