qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 10/17] pl022: convert to memory API
Date: Sun, 30 Oct 2011 16:33:47 +0200	[thread overview]
Message-ID: <1319985234-32371-11-git-send-email-avi@redhat.com> (raw)
In-Reply-To: <1319985234-32371-1-git-send-email-avi@redhat.com>

Signed-off-by: Avi Kivity <avi@redhat.com>
---
 hw/pl022.c |   29 +++++++++++------------------
 1 files changed, 11 insertions(+), 18 deletions(-)

diff --git a/hw/pl022.c b/hw/pl022.c
index 9a1cb71..e0cf2b0 100644
--- a/hw/pl022.c
+++ b/hw/pl022.c
@@ -42,6 +42,7 @@
 
 typedef struct {
     SysBusDevice busdev;
+    MemoryRegion iomem;
     uint32_t cr0;
     uint32_t cr1;
     uint32_t bitmask;
@@ -130,7 +131,8 @@ static void pl022_xfer(pl022_state *s)
     pl022_update(s);
 }
 
-static uint32_t pl022_read(void *opaque, target_phys_addr_t offset)
+static uint64_t pl022_read(void *opaque, target_phys_addr_t offset,
+                           unsigned size)
 {
     pl022_state *s = (pl022_state *)opaque;
     int val;
@@ -173,7 +175,7 @@ static uint32_t pl022_read(void *opaque, target_phys_addr_t offset)
 }
 
 static void pl022_write(void *opaque, target_phys_addr_t offset,
-                        uint32_t value)
+                        uint64_t value, unsigned size)
 {
     pl022_state *s = (pl022_state *)opaque;
 
@@ -193,7 +195,7 @@ static void pl022_write(void *opaque, target_phys_addr_t offset,
         break;
     case 0x08: /* DR */
         if (s->tx_fifo_len < 8) {
-            DPRINTF("TX %02x\n", value);
+            DPRINTF("TX %02x\n", (unsigned)value);
             s->tx_fifo[s->tx_fifo_head] = value & s->bitmask;
             s->tx_fifo_head = (s->tx_fifo_head + 1) & 7;
             s->tx_fifo_len++;
@@ -227,16 +229,10 @@ static void pl022_reset(pl022_state *s)
     s->sr = PL022_SR_TFE | PL022_SR_TNF;
 }
 
-static CPUReadMemoryFunc * const pl022_readfn[] = {
-   pl022_read,
-   pl022_read,
-   pl022_read
-};
-
-static CPUWriteMemoryFunc * const pl022_writefn[] = {
-   pl022_write,
-   pl022_write,
-   pl022_write
+static const MemoryRegionOps pl022_ops = {
+    .read = pl022_read,
+    .write = pl022_write,
+    .endianness = DEVICE_NATIVE_ENDIAN,
 };
 
 static const VMStateDescription vmstate_pl022 = {
@@ -279,12 +275,9 @@ static void pl022_reset(pl022_state *s)
 static int pl022_init(SysBusDevice *dev)
 {
     pl022_state *s = FROM_SYSBUS(pl022_state, dev);
-    int iomemtype;
 
-    iomemtype = cpu_register_io_memory(pl022_readfn,
-                                       pl022_writefn, s,
-                                       DEVICE_NATIVE_ENDIAN);
-    sysbus_init_mmio(dev, 0x1000, iomemtype);
+    memory_region_init_io(&s->iomem, &pl022_ops, s, "pl022", 0x1000);
+    sysbus_init_mmio_region(dev, &s->iomem);
     sysbus_init_irq(dev, &s->irq);
     s->ssi = ssi_create_bus(&dev->qdev, "ssi");
     pl022_reset(s);
-- 
1.7.6.3

  parent reply	other threads:[~2011-10-30 14:34 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-30 14:33 [Qemu-devel] [PATCH 00/17] Memory API conversions, batch 13 Avi Kivity
2011-10-30 14:33 ` [Qemu-devel] [PATCH 01/17] tosa: convert to memory API Avi Kivity
2011-10-30 14:33 ` [Qemu-devel] [PATCH 02/17] versatilepb: " Avi Kivity
2011-10-30 14:33 ` [Qemu-devel] [PATCH 03/17] vexpress: " Avi Kivity
2011-10-30 14:33 ` [Qemu-devel] [PATCH 04/17] virtex_ml507: " Avi Kivity
2011-10-30 14:33 ` [Qemu-devel] [PATCH 05/17] shix: " Avi Kivity
2011-10-30 14:33 ` [Qemu-devel] [PATCH 06/17] jazz_led: " Avi Kivity
2011-10-30 14:33 ` [Qemu-devel] [PATCH 07/17] parallel: " Avi Kivity
2011-10-30 14:33 ` [Qemu-devel] [PATCH 08/17] zaurus: " Avi Kivity
2011-10-30 14:33 ` [Qemu-devel] [PATCH 09/17] pl011: " Avi Kivity
2011-10-30 14:33 ` Avi Kivity [this message]
2011-10-30 14:33 ` [Qemu-devel] [PATCH 11/17] pl031: " Avi Kivity
2011-10-30 14:33 ` [Qemu-devel] [PATCH 12/17] pl050: " Avi Kivity
2011-10-30 14:33 ` [Qemu-devel] [PATCH 13/17] pl061: " Avi Kivity
2011-10-30 14:33 ` [Qemu-devel] [PATCH 14/17] pl080: " Avi Kivity
2011-10-30 14:33 ` [Qemu-devel] [PATCH 15/17] pl110: " Avi Kivity
2011-10-30 14:33 ` [Qemu-devel] [PATCH 16/17] pl181: " Avi Kivity
2011-10-30 14:33 ` [Qemu-devel] [PATCH 17/17] pl190: " Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1319985234-32371-11-git-send-email-avi@redhat.com \
    --to=avi@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).