From patchwork Wed Jun 8 18:55:11 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: 99557 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 6ABA7B6FDD for ; Thu, 9 Jun 2011 06:51:46 +1000 (EST) Received: from localhost ([::1]:58340 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QUPj5-0003gj-Ck for incoming@patchwork.ozlabs.org; Wed, 08 Jun 2011 16:51:43 -0400 Received: from eggs.gnu.org ([140.186.70.92]:42033) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QUNue-0006Mg-0n for qemu-devel@nongnu.org; Wed, 08 Jun 2011 14:55:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QUNuY-00068c-J9 for qemu-devel@nongnu.org; Wed, 08 Jun 2011 14:55:31 -0400 Received: from fmmailgate03.web.de ([217.72.192.234]:36073) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QUNuX-00067j-5D for qemu-devel@nongnu.org; Wed, 08 Jun 2011 14:55:25 -0400 Received: from smtp01.web.de ( [172.20.0.243]) by fmmailgate03.web.de (Postfix) with ESMTP id EA182191FD261; Wed, 8 Jun 2011 20:55:23 +0200 (CEST) Received: from [87.173.123.15] (helo=af.local) by smtp01.web.de with asmtp (WEB.DE 4.110 #2) id 1QUNuV-0002zl-01; Wed, 08 Jun 2011 20:55:23 +0200 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Date: Wed, 8 Jun 2011 20:55:11 +0200 Message-Id: <1307559319-16183-5-git-send-email-andreas.faerber@web.de> X-Mailer: git-send-email 1.7.5.3 In-Reply-To: <1307559319-16183-4-git-send-email-andreas.faerber@web.de> References: <4DEF2F25.5070104@redhat.com> <1307559319-16183-1-git-send-email-andreas.faerber@web.de> <1307559319-16183-2-git-send-email-andreas.faerber@web.de> <1307559319-16183-3-git-send-email-andreas.faerber@web.de> <1307559319-16183-4-git-send-email-andreas.faerber@web.de> MIME-Version: 1.0 X-Sender: Andreas.Faerber@web.de X-Provags-ID: V01U2FsdGVkX181Lgbubn/U9J9jTB0eajMtiNcIfGM+SA1NrGTB 3Qje34UDuWzq6KAS9RF66ZhVmyfvCrMxZe5sVo4MKXZOOOI0ra AQSMQMkmZkpf9+kquARg== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 X-Received-From: 217.72.192.234 Cc: =?UTF-8?q?Andreas=20F=C3=A4rber?= , hpoussin@reactos.org, kraxel@redhat.com Subject: [Qemu-devel] [RFC v4 04/12] isa: Allow to un-assign I/O ports 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 Signed-off-by: Andreas Färber --- hw/isa-bus.c | 14 ++++++++++++++ hw/isa.h | 1 + 2 files changed, 15 insertions(+), 0 deletions(-) diff --git a/hw/isa-bus.c b/hw/isa-bus.c index d258932..1f64673 100644 --- a/hw/isa-bus.c +++ b/hw/isa-bus.c @@ -105,6 +105,20 @@ void isa_init_ioport(ISADevice *dev, uint16_t ioport) isa_init_ioport_range(dev, ioport, 1); } +void isa_discard_ioport_range(ISADevice *dev, uint16_t start, uint16_t length) +{ + int i, j; + for (i = 0; i < dev->nioports; i++) { + if (dev->ioports[i] == start) { + for (j = 0; j < dev->nioports - i; j++) { + dev->ioports[i + j] = dev->ioports[i + length + j]; + } + dev->nioports -= length; + break; + } + } +} + static int isa_qdev_init(DeviceState *qdev, DeviceInfo *base) { ISADevice *dev = DO_UPCAST(ISADevice, qdev, qdev); diff --git a/hw/isa.h b/hw/isa.h index 5d460ab..ba7a696 100644 --- a/hw/isa.h +++ b/hw/isa.h @@ -33,6 +33,7 @@ qemu_irq isa_get_irq(int isairq); void isa_init_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); void isa_qdev_register(ISADeviceInfo *info); ISADevice *isa_create(const char *name); ISADevice *isa_try_create(const char *name);