From patchwork Sun Oct 30 14:33:45 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avi Kivity X-Patchwork-Id: 122639 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 A67DDB6F7B for ; Mon, 31 Oct 2011 02:47:46 +1100 (EST) Received: from localhost ([::1]:58771 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RKWTC-00073q-Ry for incoming@patchwork.ozlabs.org; Sun, 30 Oct 2011 10:34:42 -0400 Received: from eggs.gnu.org ([140.186.70.92]:55484) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RKWSj-00061q-3X for qemu-devel@nongnu.org; Sun, 30 Oct 2011 10:34:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RKWSf-0003sy-3f for qemu-devel@nongnu.org; Sun, 30 Oct 2011 10:34:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:24437) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RKWSe-0003sL-Q7 for qemu-devel@nongnu.org; Sun, 30 Oct 2011 10:34:09 -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 p9UEY8KR019145 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 30 Oct 2011 10:34:08 -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 p9UEY67b003132 for ; Sun, 30 Oct 2011 10:34:07 -0400 Received: from s01.tlv.redhat.com (s01.tlv.redhat.com [10.35.255.8]) by cleopatra.tlv.redhat.com (Postfix) with ESMTP id 8546C250B9F; Sun, 30 Oct 2011 16:34:01 +0200 (IST) From: Avi Kivity To: qemu-devel@nongnu.org Date: Sun, 30 Oct 2011 16:33:45 +0200 Message-Id: <1319985234-32371-9-git-send-email-avi@redhat.com> In-Reply-To: <1319985234-32371-1-git-send-email-avi@redhat.com> References: <1319985234-32371-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 08/17] zaurus: convert to memory API 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: Avi Kivity --- hw/zaurus.c | 26 +++++++++++--------------- 1 files changed, 11 insertions(+), 15 deletions(-) diff --git a/hw/zaurus.c b/hw/zaurus.c index 0eeacf7..3c27cd8 100644 --- a/hw/zaurus.c +++ b/hw/zaurus.c @@ -28,6 +28,7 @@ struct ScoopInfo { SysBusDevice busdev; qemu_irq handler[16]; + MemoryRegion iomem; uint16_t status; uint16_t power; uint32_t gpio_level; @@ -67,7 +68,8 @@ static inline void scoop_gpio_handler_update(ScoopInfo *s) { s->prev_level = level; } -static uint32_t scoop_readb(void *opaque, target_phys_addr_t addr) +static uint64_t scoop_read(void *opaque, target_phys_addr_t addr, + unsigned size) { ScoopInfo *s = (ScoopInfo *) opaque; @@ -100,7 +102,8 @@ static uint32_t scoop_readb(void *opaque, target_phys_addr_t addr) return 0; } -static void scoop_writeb(void *opaque, target_phys_addr_t addr, uint32_t value) +static void scoop_write(void *opaque, target_phys_addr_t addr, + uint64_t value, unsigned size) { ScoopInfo *s = (ScoopInfo *) opaque; value &= 0xffff; @@ -143,15 +146,10 @@ static void scoop_writeb(void *opaque, target_phys_addr_t addr, uint32_t value) } } -static CPUReadMemoryFunc * const scoop_readfn[] = { - scoop_readb, - scoop_readb, - scoop_readb, -}; -static CPUWriteMemoryFunc * const scoop_writefn[] = { - scoop_writeb, - scoop_writeb, - scoop_writeb, +static const MemoryRegionOps scoop_ops = { + .read = scoop_read, + .write = scoop_write, + .endianness = DEVICE_NATIVE_ENDIAN, }; static void scoop_gpio_set(void *opaque, int line, int level) @@ -167,15 +165,13 @@ static void scoop_gpio_set(void *opaque, int line, int level) static int scoop_init(SysBusDevice *dev) { ScoopInfo *s = FROM_SYSBUS(ScoopInfo, dev); - int iomemtype; s->status = 0x02; qdev_init_gpio_out(&s->busdev.qdev, s->handler, 16); qdev_init_gpio_in(&s->busdev.qdev, scoop_gpio_set, 16); - iomemtype = cpu_register_io_memory(scoop_readfn, - scoop_writefn, s, DEVICE_NATIVE_ENDIAN); + memory_region_init_io(&s->iomem, &scoop_ops, s, "scoop", 0x1000); - sysbus_init_mmio(dev, 0x1000, iomemtype); + sysbus_init_mmio_region(dev, &s->iomem); return 0; }