On 01.06.2018 16:12, Peter Maydell wrote:
> 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.mayd...@linaro.org>
> ---
>  hw/m68k/mcf5206.c | 48 +++++++++++++++++++++++++++++++++++------------
>  1 file changed, 36 insertions(+), 12 deletions(-)
> 
> diff --git a/hw/m68k/mcf5206.c b/hw/m68k/mcf5206.c
> index 6ad1e4bd2d..0962911837 100644
> --- a/hw/m68k/mcf5206.c
> +++ b/hw/m68k/mcf5206.c
> @@ -513,19 +513,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,
>  };

Acked-by: Thomas Huth <h...@tuxfamily.org>

Reply via email to