From patchwork Sun Oct 30 14:33:54 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avi Kivity X-Patchwork-Id: 122625 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 90907B6F7C for ; Mon, 31 Oct 2011 01:52:53 +1100 (EST) Received: from localhost ([::1]:58804 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RKWTI-00074i-Nx for incoming@patchwork.ozlabs.org; Sun, 30 Oct 2011 10:34:48 -0400 Received: from eggs.gnu.org ([140.186.70.92]:55527) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RKWSl-0006Ar-KX for qemu-devel@nongnu.org; Sun, 30 Oct 2011 10:34:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RKWSg-0003uX-UK for qemu-devel@nongnu.org; Sun, 30 Oct 2011 10:34:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:6344) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RKWSg-0003tW-KH for qemu-devel@nongnu.org; Sun, 30 Oct 2011 10:34:10 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p9UEY9FI021179 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 30 Oct 2011 10:34:10 -0400 Received: from cleopatra.tlv.redhat.com (cleopatra.tlv.redhat.com [10.35.255.11]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p9UEY9Ja025547 for ; Sun, 30 Oct 2011 10:34:09 -0400 Received: from s01.tlv.redhat.com (s01.tlv.redhat.com [10.35.255.8]) by cleopatra.tlv.redhat.com (Postfix) with ESMTP id 9407E250BA8; Sun, 30 Oct 2011 16:34:01 +0200 (IST) From: Avi Kivity To: qemu-devel@nongnu.org Date: Sun, 30 Oct 2011 16:33:54 +0200 Message-Id: <1319985234-32371-18-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.68 on 10.5.11.25 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 17/17] pl190: 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/pl190.c | 28 +++++++++++----------------- 1 files changed, 11 insertions(+), 17 deletions(-) diff --git a/hw/pl190.c b/hw/pl190.c index 8dc7e42..a3d008d 100644 --- a/hw/pl190.c +++ b/hw/pl190.c @@ -17,6 +17,7 @@ typedef struct { SysBusDevice busdev; + MemoryRegion iomem; uint32_t level; uint32_t soft_level; uint32_t irq_enable; @@ -84,7 +85,8 @@ static void pl190_update_vectors(pl190_state *s) pl190_update(s); } -static uint32_t pl190_read(void *opaque, target_phys_addr_t offset) +static uint64_t pl190_read(void *opaque, target_phys_addr_t offset, + unsigned size) { pl190_state *s = (pl190_state *)opaque; int i; @@ -140,7 +142,8 @@ static uint32_t pl190_read(void *opaque, target_phys_addr_t offset) } } -static void pl190_write(void *opaque, target_phys_addr_t offset, uint32_t val) +static void pl190_write(void *opaque, target_phys_addr_t offset, + uint64_t val, unsigned size) { pl190_state *s = (pl190_state *)opaque; @@ -199,16 +202,10 @@ static void pl190_write(void *opaque, target_phys_addr_t offset, uint32_t val) pl190_update(s); } -static CPUReadMemoryFunc * const pl190_readfn[] = { - pl190_read, - pl190_read, - pl190_read -}; - -static CPUWriteMemoryFunc * const pl190_writefn[] = { - pl190_write, - pl190_write, - pl190_write +static const MemoryRegionOps pl190_ops = { + .read = pl190_read, + .write = pl190_write, + .endianness = DEVICE_NATIVE_ENDIAN, }; static void pl190_reset(DeviceState *d) @@ -230,12 +227,9 @@ static void pl190_reset(DeviceState *d) static int pl190_init(SysBusDevice *dev) { pl190_state *s = FROM_SYSBUS(pl190_state, dev); - int iomemtype; - iomemtype = cpu_register_io_memory(pl190_readfn, - pl190_writefn, s, - DEVICE_NATIVE_ENDIAN); - sysbus_init_mmio(dev, 0x1000, iomemtype); + memory_region_init_io(&s->iomem, &pl190_ops, s, "pl190", 0x1000); + sysbus_init_mmio_region(dev, &s->iomem); qdev_init_gpio_in(&dev->qdev, pl190_set_irq, 32); sysbus_init_irq(dev, &s->irq); sysbus_init_irq(dev, &s->fiq);