From patchwork Thu Oct 6 10:23:23 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avi Kivity X-Patchwork-Id: 118069 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 E1784B6FAF for ; Thu, 6 Oct 2011 22:50:19 +1100 (EST) Received: from localhost ([::1]:39936 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RBl8E-00069g-9N for incoming@patchwork.ozlabs.org; Thu, 06 Oct 2011 06:24:50 -0400 Received: from eggs.gnu.org ([140.186.70.92]:52205) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RBl7Q-0003xe-6Z for qemu-devel@nongnu.org; Thu, 06 Oct 2011 06:24:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RBl7K-0002PI-Cv for qemu-devel@nongnu.org; Thu, 06 Oct 2011 06:24:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:13742) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RBl7J-0002Oe-KX for qemu-devel@nongnu.org; Thu, 06 Oct 2011 06:23:54 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p96ANqt6027727 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 6 Oct 2011 06:23:53 -0400 Received: from cleopatra.tlv.redhat.com (cleopatra.tlv.redhat.com [10.35.255.11]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p96ANnbu031329 for ; Thu, 6 Oct 2011 06:23:52 -0400 Received: from s01.tlv.redhat.com (s01.tlv.redhat.com [10.35.255.8]) by cleopatra.tlv.redhat.com (Postfix) with ESMTP id F042D250B6F; Thu, 6 Oct 2011 12:23:43 +0200 (IST) From: Avi Kivity To: qemu-devel@nongnu.org Date: Thu, 6 Oct 2011 12:23:23 +0200 Message-Id: <1317896615-25202-14-git-send-email-avi@redhat.com> In-Reply-To: <1317896615-25202-1-git-send-email-avi@redhat.com> References: <1317896615-25202-1-git-send-email-avi@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 13/25] isa: Add isa_register_portio_list() 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: Richard Henderson Signed-off-by: Avi Kivity --- hw/isa-bus.c | 17 +++++++++++++++++ hw/isa.h | 31 ++++++++++++++++++++++++++++++- 2 files changed, 47 insertions(+), 1 deletions(-) diff --git a/hw/isa-bus.c b/hw/isa-bus.c index e9c1712..5d8ff84 100644 --- a/hw/isa-bus.c +++ b/hw/isa-bus.c @@ -103,6 +103,23 @@ void isa_register_ioport(ISADevice *dev, MemoryRegion *io, uint16_t start) } } +void isa_register_portio_list(ISADevice *dev, uint16_t start, + const MemoryRegionPortio *pio_start, + void *opaque, const char *name) +{ + PortioList *piolist = g_new(PortioList, 1); + + /* START is how we should treat DEV, regardless of the actual + contents of the portio array. This is how the old code + actually handled e.g. the FDC device. */ + if (dev) { + isa_init_ioport(dev, start); + } + + portio_list_init(piolist, pio_start, opaque, name); + portio_list_add(piolist, isabus->address_space_io, start); +} + 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 c5c2618..177ef95 100644 --- a/hw/isa.h +++ b/hw/isa.h @@ -28,7 +28,6 @@ ISABus *isa_bus_new(DeviceState *dev, MemoryRegion *address_space_io); 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_register_ioport(ISADevice *dev, MemoryRegion *io, uint16_t start); void isa_init_ioport(ISADevice *dev, uint16_t ioport); void isa_init_ioport_range(ISADevice *dev, uint16_t start, uint16_t length); void isa_qdev_register(ISADeviceInfo *info); @@ -37,6 +36,36 @@ ISADevice *isa_create(const char *name); ISADevice *isa_try_create(const char *name); ISADevice *isa_create_simple(const char *name); +/** + * isa_register_ioport: Install an I/O port region on the ISA bus. + * + * Register an I/O port region via memory_region_add_subregion + * inside the ISA I/O address space. + * + * @dev: the ISADevice against which these are registered; may be NULL. + * @io: the #MemoryRegion being registered. + * @start: the base I/O port. + */ +void isa_register_ioport(ISADevice *dev, MemoryRegion *io, uint16_t start); + +/** + * isa_register_portio_list: Initialize a set of ISA io ports + * + * Several ISA devices have many dis-joint I/O ports. Worse, these I/O + * ports can be interleaved with I/O ports from other devices. This + * function makes it easy to create multiple MemoryRegions for a single + * device and use the legacy portio routines. + * + * @dev: the ISADevice against which these are registered; may be NULL. + * @start: the base I/O port against which the portio->offset is applied. + * @portio: the ports, sorted by offset. + * @opaque: passed into the old_portio callbacks. + * @name: passed into memory_region_init_io. + */ +void isa_register_portio_list(ISADevice *dev, uint16_t start, + const MemoryRegionPortio *portio, + void *opaque, const char *name); + extern target_phys_addr_t isa_mem_base; void isa_mmio_setup(MemoryRegion *mr, target_phys_addr_t size);