From patchwork Mon Aug 8 17:06:51 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avi Kivity X-Patchwork-Id: 109031 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 32059B6F72 for ; Tue, 9 Aug 2011 04:02:09 +1000 (EST) Received: from localhost ([::1]:58499 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QqTJ0-0005aw-5W for incoming@patchwork.ozlabs.org; Mon, 08 Aug 2011 13:07:58 -0400 Received: from eggs.gnu.org ([140.186.70.92]:59563) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QqTIe-0004kB-7X for qemu-devel@nongnu.org; Mon, 08 Aug 2011 13:07:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QqTIS-000258-66 for qemu-devel@nongnu.org; Mon, 08 Aug 2011 13:07:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57225) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QqTIR-00022X-VQ for qemu-devel@nongnu.org; Mon, 08 Aug 2011 13:07:24 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p78H7D3f003371 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 8 Aug 2011 13:07:13 -0400 Received: from cleopatra.tlv.redhat.com (cleopatra.tlv.redhat.com [10.35.255.11]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p78H7CIA031718; Mon, 8 Aug 2011 13:07:13 -0400 Received: from s01.tlv.redhat.com (s01.tlv.redhat.com [10.35.255.8]) by cleopatra.tlv.redhat.com (Postfix) with ESMTP id C7FC2250B48; Mon, 8 Aug 2011 20:07:10 +0300 (IDT) From: Avi Kivity To: qemu-devel@nongnu.org Date: Mon, 8 Aug 2011 20:06:51 +0300 Message-Id: <1312823229-12822-7-git-send-email-avi@redhat.com> In-Reply-To: <1312823229-12822-1-git-send-email-avi@redhat.com> References: <1312823229-12822-1-git-send-email-avi@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: kvm@vger.kernel.org Subject: [Qemu-devel] [PATCH 06/24] armv7m: 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/armv7m.c | 24 ++++++++++-------------- 1 files changed, 10 insertions(+), 14 deletions(-) diff --git a/hw/armv7m.c b/hw/armv7m.c index 83f3393..a932f16 100644 --- a/hw/armv7m.c +++ b/hw/armv7m.c @@ -106,31 +106,27 @@ static void bitband_writel(void *opaque, target_phys_addr_t offset, cpu_physical_memory_write(addr, (uint8_t *)&v, 4); } -static CPUReadMemoryFunc * const bitband_readfn[] = { - bitband_readb, - bitband_readw, - bitband_readl -}; - -static CPUWriteMemoryFunc * const bitband_writefn[] = { - bitband_writeb, - bitband_writew, - bitband_writel +static const MemoryRegionOps bitband_ops = { + .old_mmio = { + .read = { bitband_readb, bitband_readw, bitband_readl, }, + .write = { bitband_writeb, bitband_writew, bitband_writel, }, + }, + .endianness = DEVICE_NATIVE_ENDIAN, }; typedef struct { SysBusDevice busdev; + MemoryRegion iomem; uint32_t base; } BitBandState; static int bitband_init(SysBusDevice *dev) { BitBandState *s = FROM_SYSBUS(BitBandState, dev); - int iomemtype; - iomemtype = cpu_register_io_memory(bitband_readfn, bitband_writefn, - &s->base, DEVICE_NATIVE_ENDIAN); - sysbus_init_mmio(dev, 0x02000000, iomemtype); + memory_region_init_io(&s->iomem, &bitband_ops, &s->base, "bitband", + 0x02000000); + sysbus_init_mmio_region(dev, &s->iomem); return 0; }