qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Cc: patches@linaro.org, Kevin Wolf <kwolf@redhat.com>,
	Max Reitz <mreitz@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Thomas Huth <huth@tuxfamily.org>,
	Aurelien Jarno <aurelien@aurel32.net>,
	qemu-block@nongnu.org, Yongbok Kim <yongbok.kim@mips.com>
Subject: [Qemu-devel] [PATCH 4/6] hw/watchdog/wdt_i6300esb: Convert away from old_mmio
Date: Fri,  1 Jun 2018 15:12:21 +0100	[thread overview]
Message-ID: <20180601141223.26630-5-peter.maydell@linaro.org> (raw)
In-Reply-To: <20180601141223.26630-1-peter.maydell@linaro.org>

Convert the wdt_i6300esb device away from using the old_mmio field
of MemoryRegionOps.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 hw/watchdog/wdt_i6300esb.c | 48 ++++++++++++++++++++++++++++----------
 1 file changed, 36 insertions(+), 12 deletions(-)

diff --git a/hw/watchdog/wdt_i6300esb.c b/hw/watchdog/wdt_i6300esb.c
index e596b0804d..7b59469888 100644
--- a/hw/watchdog/wdt_i6300esb.c
+++ b/hw/watchdog/wdt_i6300esb.c
@@ -361,19 +361,43 @@ static void i6300esb_mem_writel(void *vp, hwaddr addr, uint32_t val)
     }
 }
 
+static uint64_t i6300esb_mem_readfn(void *opaque, hwaddr addr, unsigned size)
+{
+    switch (size) {
+    case 1:
+        return i6300esb_mem_readb(opaque, addr);
+    case 2:
+        return i6300esb_mem_readw(opaque, addr);
+    case 4:
+        return i6300esb_mem_readl(opaque, addr);
+    default:
+        g_assert_not_reached();
+    }
+}
+
+static void i6300esb_mem_writefn(void *opaque, hwaddr addr,
+                                 uint64_t value, unsigned size)
+{
+    switch (size) {
+    case 1:
+        i6300esb_mem_writeb(opaque, addr, value);
+        break;
+    case 2:
+        i6300esb_mem_writew(opaque, addr, value);
+        break;
+    case 4:
+        i6300esb_mem_writel(opaque, addr, value);
+        break;
+    default:
+        g_assert_not_reached();
+    }
+}
+
 static const MemoryRegionOps i6300esb_ops = {
-    .old_mmio = {
-        .read = {
-            i6300esb_mem_readb,
-            i6300esb_mem_readw,
-            i6300esb_mem_readl,
-        },
-        .write = {
-            i6300esb_mem_writeb,
-            i6300esb_mem_writew,
-            i6300esb_mem_writel,
-        },
-    },
+    .read = i6300esb_mem_readfn,
+    .write = i6300esb_mem_writefn,
+    .valid.min_access_size = 1,
+    .valid.max_access_size = 4,
     .endianness = DEVICE_LITTLE_ENDIAN,
 };
 
-- 
2.17.1

  parent reply	other threads:[~2018-06-01 14:12 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-01 14:12 [Qemu-devel] [PATCH 0/6] More conversions away from old_mmio Peter Maydell
2018-06-01 14:12 ` [Qemu-devel] [PATCH 1/6] hw/sh/sh7750: Convert " Peter Maydell
2018-06-11 15:47   ` Philippe Mathieu-Daudé
2018-06-01 14:12 ` [Qemu-devel] [PATCH 2/6] hw/m68k/mcf5206: " Peter Maydell
2018-06-02  6:38   ` Thomas Huth
2018-06-01 14:12 ` [Qemu-devel] [PATCH 3/6] hw/block/pflash_cfi02: " Peter Maydell
2018-06-04 10:28   ` Max Reitz
2018-06-11 15:22   ` Philippe Mathieu-Daudé
2018-06-01 14:12 ` Peter Maydell [this message]
2018-06-11 15:48   ` [Qemu-devel] [PATCH 4/6] hw/watchdog/wdt_i6300esb: " Philippe Mathieu-Daudé
2018-06-01 14:12 ` [Qemu-devel] [PATCH 5/6] hw/input/pckbd: " Peter Maydell
2018-06-11 15:26   ` Philippe Mathieu-Daudé
2018-06-01 14:12 ` [Qemu-devel] [PATCH 6/6] hw/char/parallel: " Peter Maydell
2018-06-11 15:24   ` Philippe Mathieu-Daudé
2018-06-11 14:06 ` [Qemu-devel] [PATCH 0/6] More conversions " Peter Maydell
2018-06-15  9:58   ` 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=20180601141223.26630-5-peter.maydell@linaro.org \
    --to=peter.maydell@linaro.org \
    --cc=aurelien@aurel32.net \
    --cc=huth@tuxfamily.org \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=mst@redhat.com \
    --cc=patches@linaro.org \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=yongbok.kim@mips.com \
    /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).