From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:45502) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RFUPH-0007pF-Gh for qemu-devel@nongnu.org; Sun, 16 Oct 2011 13:21:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RFUPG-00017G-3Q for qemu-devel@nongnu.org; Sun, 16 Oct 2011 13:21:51 -0400 Received: from fmmailgate01.web.de ([217.72.192.221]:38397) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RFUPF-000171-OX for qemu-devel@nongnu.org; Sun, 16 Oct 2011 13:21:50 -0400 Received: from moweb001.kundenserver.de (moweb001.kundenserver.de [172.19.20.114]) by fmmailgate01.web.de (Postfix) with ESMTP id 90CFE19D395BE for ; Sun, 16 Oct 2011 19:21:41 +0200 (CEST) Message-ID: <4E9B12A4.30100@web.de> Date: Sun, 16 Oct 2011 19:21:40 +0200 From: Jan Kiszka MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH] ioapic: Convert to memory API List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Avi Kivity Cc: qemu-devel From: Jan Kiszka Dispatching byte and word accesses like dwords looks strange, but let's just convert mechanically. Signed-off-by: Jan Kiszka --- hw/ioapic.c | 24 +++++++++--------------- 1 files changed, 9 insertions(+), 15 deletions(-) diff --git a/hw/ioapic.c b/hw/ioapic.c index 61991d7..5786b86 100644 --- a/hw/ioapic.c +++ b/hw/ioapic.c @@ -86,6 +86,7 @@ typedef struct IOAPICState IOAPICState; struct IOAPICState { SysBusDevice busdev; + MemoryRegion io_memory; uint8_t id; uint8_t ioregsel; uint32_t irr; @@ -309,32 +310,25 @@ static void ioapic_reset(DeviceState *d) } } -static CPUReadMemoryFunc * const ioapic_mem_read[3] = { - ioapic_mem_readl, - ioapic_mem_readl, - ioapic_mem_readl, -}; - -static CPUWriteMemoryFunc * const ioapic_mem_write[3] = { - ioapic_mem_writel, - ioapic_mem_writel, - ioapic_mem_writel, +static const MemoryRegionOps ioapic_io_ops = { + .old_mmio = { + .read = { ioapic_mem_readl, ioapic_mem_readl, ioapic_mem_readl, }, + .write = { ioapic_mem_writel, ioapic_mem_writel, ioapic_mem_writel, }, + }, + .endianness = DEVICE_NATIVE_ENDIAN, }; static int ioapic_init1(SysBusDevice *dev) { IOAPICState *s = FROM_SYSBUS(IOAPICState, dev); - int io_memory; static int ioapic_no; if (ioapic_no >= MAX_IOAPICS) { return -1; } - io_memory = cpu_register_io_memory(ioapic_mem_read, - ioapic_mem_write, s, - DEVICE_NATIVE_ENDIAN); - sysbus_init_mmio(dev, 0x1000, io_memory); + memory_region_init_io(&s->io_memory, &ioapic_io_ops, s, "ioapic", 0x1000); + sysbus_init_mmio_region(dev, &s->io_memory); qdev_init_gpio_in(&dev->qdev, ioapic_set_irq, IOAPIC_NUM_PINS); -- 1.7.3.4