qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Benoît Canet" <benoit.canet@gmail.com>
To: qemu-devel@nongnu.org
Cc: "Benoît Canet" <benoit.canet@gmail.com>, avi@redhat.com
Subject: [Qemu-devel] [PATCH 7/7] stellaris: convert gptm to memory API
Date: Mon, 17 Oct 2011 17:28:32 +0200	[thread overview]
Message-ID: <1318865312-27483-8-git-send-email-benoit.canet@gmail.com> (raw)
In-Reply-To: <1318865312-27483-1-git-send-email-benoit.canet@gmail.com>

Signed-off-by: Benoit Canet <benoit.canet@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
---
 hw/stellaris.c |   29 ++++++++++++-----------------
 1 files changed, 12 insertions(+), 17 deletions(-)

diff --git a/hw/stellaris.c b/hw/stellaris.c
index 533d9c1..2ab7ec7 100644
--- a/hw/stellaris.c
+++ b/hw/stellaris.c
@@ -45,6 +45,7 @@ typedef const struct {
 
 typedef struct gptm_state {
     SysBusDevice busdev;
+    MemoryRegion iomem;
     uint32_t config;
     uint32_t mode[2];
     uint32_t control;
@@ -140,7 +141,8 @@ static void gptm_tick(void *opaque)
     gptm_update_irq(s);
 }
 
-static uint32_t gptm_read(void *opaque, target_phys_addr_t offset)
+static uint64_t gptm_read(void *opaque, target_phys_addr_t offset,
+                          unsigned size)
 {
     gptm_state *s = (gptm_state *)opaque;
 
@@ -188,7 +190,8 @@ static uint32_t gptm_read(void *opaque, target_phys_addr_t offset)
     }
 }
 
-static void gptm_write(void *opaque, target_phys_addr_t offset, uint32_t value)
+static void gptm_write(void *opaque, target_phys_addr_t offset,
+                       uint64_t value, unsigned size)
 {
     gptm_state *s = (gptm_state *)opaque;
     uint32_t oldval;
@@ -268,16 +271,10 @@ static void gptm_write(void *opaque, target_phys_addr_t offset, uint32_t value)
     gptm_update_irq(s);
 }
 
-static CPUReadMemoryFunc * const gptm_readfn[] = {
-   gptm_read,
-   gptm_read,
-   gptm_read
-};
-
-static CPUWriteMemoryFunc * const gptm_writefn[] = {
-   gptm_write,
-   gptm_write,
-   gptm_write
+static const MemoryRegionOps gptm_ops = {
+    .read = gptm_read,
+    .write = gptm_write,
+    .endianness = DEVICE_NATIVE_ENDIAN,
 };
 
 static const VMStateDescription vmstate_stellaris_gptm = {
@@ -305,16 +302,14 @@ static const VMStateDescription vmstate_stellaris_gptm = {
 
 static int stellaris_gptm_init(SysBusDevice *dev)
 {
-    int iomemtype;
     gptm_state *s = FROM_SYSBUS(gptm_state, dev);
 
     sysbus_init_irq(dev, &s->irq);
     qdev_init_gpio_out(&dev->qdev, &s->trigger, 1);
 
-    iomemtype = cpu_register_io_memory(gptm_readfn,
-                                       gptm_writefn, s,
-                                       DEVICE_NATIVE_ENDIAN);
-    sysbus_init_mmio(dev, 0x1000, iomemtype);
+    memory_region_init_io(&s->iomem, &gptm_ops, s,
+                          "gptm", 0x1000);
+    sysbus_init_mmio_region(dev, &s->iomem);
 
     s->opaque[0] = s->opaque[1] = s;
     s->timer[0] = qemu_new_timer_ns(vm_clock, gptm_tick, &s->opaque[0]);
-- 
1.7.5.4

  parent reply	other threads:[~2011-10-17 15:38 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-17 15:28 [Qemu-devel] [PATCH 0/7] V2. Finish to convert integratorcp and stellaris to memory API Benoît Canet
2011-10-17 15:28 ` [Qemu-devel] [PATCH 1/7] integratorcp: convert core " Benoît Canet
2011-10-17 15:28 ` [Qemu-devel] [PATCH 2/7] integratorcp: convert icp pic " Benoît Canet
2011-10-18 11:37   ` Peter Maydell
2011-10-17 15:28 ` [Qemu-devel] [PATCH 3/7] integratorcp: convert control " Benoît Canet
2011-10-18 11:44   ` Peter Maydell
2011-10-18 14:06     ` Avi Kivity
2011-10-18 14:32       ` Avi Kivity
2011-10-18 14:54         ` Peter Maydell
2011-10-17 15:28 ` [Qemu-devel] [PATCH 4/7] stellaris: convert sys " Benoît Canet
2011-10-18 11:37   ` Peter Maydell
2011-10-17 15:28 ` [Qemu-devel] [PATCH 5/7] stellaris: convert i2c " Benoît Canet
2011-10-17 15:28 ` [Qemu-devel] [PATCH 6/7] stellaris: convert adc " Benoît Canet
2011-10-18 11:36   ` Peter Maydell
2011-10-17 15:28 ` Benoît Canet [this message]
2011-10-19 10:54 ` [Qemu-devel] [PATCH 0/7] V2. Finish to convert integratorcp and stellaris " Avi Kivity
  -- strict thread matches above, loose matches on Subject: below --
2011-10-13 19:45 [Qemu-devel] [PATCH] finish to convert integratorcp.c and stellaris.c to the new " Benoît Canet
2011-10-13 19:45 ` [Qemu-devel] [PATCH 7/7] stellaris: convert gptm to " Benoît Canet
2011-10-17 14:29   ` Peter Maydell

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=1318865312-27483-8-git-send-email-benoit.canet@gmail.com \
    --to=benoit.canet@gmail.com \
    --cc=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).