aboutsummaryrefslogtreecommitdiff
path: root/hw/m68k/mcf5206.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2018-06-15 14:57:13 +0100
committerPeter Maydell <peter.maydell@linaro.org>2018-06-15 15:23:34 +0100
commitbb428791c8bf9ffed6940e15c6c255c28ea74e72 (patch)
tree365590496b1b6f100f7b0d2abe9c23d167f5ddcc /hw/m68k/mcf5206.c
parentd2af524a18dae38691cd13e1aa70d133e9c645b7 (diff)
hw/m68k/mcf5206: Convert away from old_mmio
Convert the mcf5206 device away from using the old_mmio field of MemoryRegionOps. This device is used by the an5206 board. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Acked-by: Thomas Huth <huth@tuxfamily.org> Message-id: 20180601141223.26630-3-peter.maydell@linaro.org
Diffstat (limited to 'hw/m68k/mcf5206.c')
-rw-r--r--hw/m68k/mcf5206.c48
1 files changed, 36 insertions, 12 deletions
diff --git a/hw/m68k/mcf5206.c b/hw/m68k/mcf5206.c
index 7abd84ac47..d7f26d6810 100644
--- a/hw/m68k/mcf5206.c
+++ b/hw/m68k/mcf5206.c
@@ -512,19 +512,43 @@ static void m5206_mbar_writel(void *opaque, hwaddr offset,
m5206_mbar_write(s, offset, value, 4);
}
+static uint64_t m5206_mbar_readfn(void *opaque, hwaddr addr, unsigned size)
+{
+ switch (size) {
+ case 1:
+ return m5206_mbar_readb(opaque, addr);
+ case 2:
+ return m5206_mbar_readw(opaque, addr);
+ case 4:
+ return m5206_mbar_readl(opaque, addr);
+ default:
+ g_assert_not_reached();
+ }
+}
+
+static void m5206_mbar_writefn(void *opaque, hwaddr addr,
+ uint64_t value, unsigned size)
+{
+ switch (size) {
+ case 1:
+ m5206_mbar_writeb(opaque, addr, value);
+ break;
+ case 2:
+ m5206_mbar_writew(opaque, addr, value);
+ break;
+ case 4:
+ m5206_mbar_writel(opaque, addr, value);
+ break;
+ default:
+ g_assert_not_reached();
+ }
+}
+
static const MemoryRegionOps m5206_mbar_ops = {
- .old_mmio = {
- .read = {
- m5206_mbar_readb,
- m5206_mbar_readw,
- m5206_mbar_readl,
- },
- .write = {
- m5206_mbar_writeb,
- m5206_mbar_writew,
- m5206_mbar_writel,
- },
- },
+ .read = m5206_mbar_readfn,
+ .write = m5206_mbar_writefn,
+ .valid.min_access_size = 1,
+ .valid.max_access_size = 4,
.endianness = DEVICE_NATIVE_ENDIAN,
};