qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-block] [Qemu-devel] [PATCH 1/6] hw/sh/sh7750: Convert away fro


From: Philippe Mathieu-Daudé
Subject: Re: [Qemu-block] [Qemu-devel] [PATCH 1/6] hw/sh/sh7750: Convert away from old_mmio
Date: Mon, 11 Jun 2018 12:47:45 -0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0

On 06/01/2018 11:12 AM, Peter Maydell wrote:
> Convert the sh7750 device away from using the old_mmio field
> of MemoryRegionOps. This device is used by the sh4 r2d board.
> 
> Signed-off-by: Peter Maydell <address@hidden>

Reviewed-by: Philippe Mathieu-Daudé <address@hidden>

> ---
>  hw/sh4/sh7750.c | 44 ++++++++++++++++++++++++++++++++++++--------
>  1 file changed, 36 insertions(+), 8 deletions(-)
> 
> diff --git a/hw/sh4/sh7750.c b/hw/sh4/sh7750.c
> index 5a7d47d31e..b932f33409 100644
> --- a/hw/sh4/sh7750.c
> +++ b/hw/sh4/sh7750.c
> @@ -451,15 +451,43 @@ static void sh7750_mem_writel(void *opaque, hwaddr addr,
>      }
>  }
>  
> +static uint64_t sh7750_mem_readfn(void *opaque, hwaddr addr, unsigned size)
> +{
> +    switch (size) {
> +    case 1:
> +        return sh7750_mem_readb(opaque, addr);
> +    case 2:
> +        return sh7750_mem_readw(opaque, addr);
> +    case 4:
> +        return sh7750_mem_readl(opaque, addr);
> +    default:
> +        g_assert_not_reached();
> +    }
> +}
> +
> +static void sh7750_mem_writefn(void *opaque, hwaddr addr,
> +                               uint64_t value, unsigned size)
> +{
> +    switch (size) {
> +    case 1:
> +        sh7750_mem_writeb(opaque, addr, value);
> +        break;
> +    case 2:
> +        sh7750_mem_writew(opaque, addr, value);
> +        break;
> +    case 4:
> +        sh7750_mem_writel(opaque, addr, value);
> +        break;
> +    default:
> +        g_assert_not_reached();
> +    }
> +}
> +
>  static const MemoryRegionOps sh7750_mem_ops = {
> -    .old_mmio = {
> -        .read = {sh7750_mem_readb,
> -                 sh7750_mem_readw,
> -                 sh7750_mem_readl },
> -        .write = {sh7750_mem_writeb,
> -                  sh7750_mem_writew,
> -                  sh7750_mem_writel },
> -    },
> +    .read = sh7750_mem_readfn,
> +    .write = sh7750_mem_writefn,
> +    .valid.min_access_size = 1,
> +    .valid.max_access_size = 4,
>      .endianness = DEVICE_NATIVE_ENDIAN,
>  };
>  
> 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]