From fc14cf0e95e8974cb451961391d1ecc626c34407 Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Sat, 16 Sep 2017 17:46:18 +0100 Subject: [PATCH] hw/arm/omap2.c: Don't use old_mmio Don't use old_mmio in the memory region ops struct. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 1505580378-9044-7-git-send-email-peter.maydell@linaro.org --- hw/arm/omap2.c | 49 +++++++++++++++++++++++++++++++++++++------------ 1 file changed, 37 insertions(+), 12 deletions(-) diff --git a/hw/arm/omap2.c b/hw/arm/omap2.c index 3f6076ede8..f5b148881c 100644 --- a/hw/arm/omap2.c +++ b/hw/arm/omap2.c @@ -2087,19 +2087,44 @@ static void omap_sysctl_write(void *opaque, hwaddr addr, } } +static uint64_t omap_sysctl_readfn(void *opaque, hwaddr addr, + unsigned size) +{ + switch (size) { + case 1: + return omap_sysctl_read8(opaque, addr); + case 2: + return omap_badwidth_read32(opaque, addr); /* TODO */ + case 4: + return omap_sysctl_read(opaque, addr); + default: + g_assert_not_reached(); + } +} + +static void omap_sysctl_writefn(void *opaque, hwaddr addr, + uint64_t value, unsigned size) +{ + switch (size) { + case 1: + omap_sysctl_write8(opaque, addr, value); + break; + case 2: + omap_badwidth_write32(opaque, addr, value); /* TODO */ + break; + case 4: + omap_sysctl_write(opaque, addr, value); + break; + default: + g_assert_not_reached(); + } +} + static const MemoryRegionOps omap_sysctl_ops = { - .old_mmio = { - .read = { - omap_sysctl_read8, - omap_badwidth_read32, /* TODO */ - omap_sysctl_read, - }, - .write = { - omap_sysctl_write8, - omap_badwidth_write32, /* TODO */ - omap_sysctl_write, - }, - }, + .read = omap_sysctl_readfn, + .write = omap_sysctl_writefn, + .valid.min_access_size = 1, + .valid.max_access_size = 4, .endianness = DEVICE_NATIVE_ENDIAN, };