From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:55513) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RKWSl-00068s-2Y for qemu-devel@nongnu.org; Sun, 30 Oct 2011 10:34:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RKWSg-0003tj-B3 for qemu-devel@nongnu.org; Sun, 30 Oct 2011 10:34:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51860) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RKWSf-0003sd-8d for qemu-devel@nongnu.org; Sun, 30 Oct 2011 10:34:09 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p9UEY84i012200 (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-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p9UEY5Da005292 for ; Sun, 30 Oct 2011 10:34:08 -0400 From: Avi Kivity Date: Sun, 30 Oct 2011 16:33:48 +0200 Message-Id: <1319985234-32371-12-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> Subject: [Qemu-devel] [PATCH 11/17] pl031: convert to memory API List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Signed-off-by: Avi Kivity --- hw/pl031.c | 30 ++++++++++-------------------- 1 files changed, 10 insertions(+), 20 deletions(-) diff --git a/hw/pl031.c b/hw/pl031.c index 017a313..4ff96f9 100644 --- a/hw/pl031.c +++ b/hw/pl031.c @@ -32,6 +32,7 @@ typedef struct { SysBusDevice busdev; + MemoryRegion iomem; QEMUTimer *timer; qemu_irq irq; @@ -105,7 +106,8 @@ static void pl031_set_alarm(pl031_state *s) } } -static uint32_t pl031_read(void *opaque, target_phys_addr_t offset) +static uint64_t pl031_read(void *opaque, target_phys_addr_t offset, + unsigned size) { pl031_state *s = (pl031_state *)opaque; @@ -141,7 +143,7 @@ static uint32_t pl031_read(void *opaque, target_phys_addr_t offset) } static void pl031_write(void * opaque, target_phys_addr_t offset, - uint32_t value) + uint64_t value, unsigned size) { pl031_state *s = (pl031_state *)opaque; @@ -186,31 +188,19 @@ static void pl031_write(void * opaque, target_phys_addr_t offset, } } -static CPUWriteMemoryFunc * const pl031_writefn[] = { - pl031_write, - pl031_write, - pl031_write -}; - -static CPUReadMemoryFunc * const pl031_readfn[] = { - pl031_read, - pl031_read, - pl031_read +static const MemoryRegionOps pl031_ops = { + .read = pl031_read, + .write = pl031_write, + .endianness = DEVICE_NATIVE_ENDIAN, }; static int pl031_init(SysBusDevice *dev) { - int iomemtype; pl031_state *s = FROM_SYSBUS(pl031_state, dev); struct tm tm; - iomemtype = cpu_register_io_memory(pl031_readfn, pl031_writefn, s, - DEVICE_NATIVE_ENDIAN); - if (iomemtype == -1) { - hw_error("pl031_init: Can't register I/O memory\n"); - } - - sysbus_init_mmio(dev, 0x1000, iomemtype); + memory_region_init_io(&s->iomem, &pl031_ops, s, "pl031", 0x1000); + sysbus_init_mmio_region(dev, &s->iomem); sysbus_init_irq(dev, &s->irq); /* ??? We assume vm_clock is zero at this point. */ -- 1.7.6.3