qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 02/11] mcf_uart: convert to memory API


From: Avi Kivity
Subject: Re: [Qemu-devel] [PATCH 02/11] mcf_uart: convert to memory API
Date: Tue, 22 Nov 2011 17:52:22 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111115 Thunderbird/8.0

On 11/22/2011 04:23 PM, Benoît Canet wrote:
> Signed-off-by: Benoît Canet <address@hidden>
> ---
>  hw/mcf.h      |   11 +++++++----
>  hw/mcf5206.c  |   25 +++++++++++++------------
>  hw/mcf5208.c  |    6 +++---
>  hw/mcf_uart.c |   34 +++++++++++++++-------------------
>  4 files changed, 38 insertions(+), 38 deletions(-)
>
>  
> -static uint32_t m5206_mbar_read(m5206_mbar_state *s, uint32_t offset)
> +static uint64_t m5206_mbar_read(m5206_mbar_state *s,
> +                                uint64_t offset, unsigned size)
>  {
>      if (offset >= 0x100 && offset < 0x120) {
>          return m5206_timer_read(s->timer[0], offset - 0x100);
>      } else if (offset >= 0x120 && offset < 0x140) {
>          return m5206_timer_read(s->timer[1], offset - 0x120);
>      } else if (offset >= 0x140 && offset < 0x160) {
> -        return mcf_uart_read(s->uart[0], offset - 0x140);
> +        return mcf_uart_read(s->uart[0], offset - 0x140, size);
>      } else if (offset >= 0x180 && offset < 0x1a0) {
> -        return mcf_uart_read(s->uart[1], offset - 0x180);
> +        return mcf_uart_read(s->uart[1], offset - 0x180, size);
>      }

Note: this is best done as subregions.  Of course, for the conversion it
is best to do the minimal change, as you did, and leave bigger changes
for later.

> @@ -387,7 +388,7 @@ static uint32_t m5206_mbar_readb(void *opaque, 
> target_phys_addr_t offset)
>          }
>          return val & 0xff;
>      }
> -    return m5206_mbar_read(s, offset);
> +    return (uint32_t)m5206_mbar_read(s, offset, 1);
>  }
>  
>  static uint32_t m5206_mbar_readw(void *opaque, target_phys_addr_t offset)
> @@ -411,7 +412,7 @@ static uint32_t m5206_mbar_readw(void *opaque, 
> target_phys_addr_t offset)
>          val |= m5206_mbar_readb(opaque, offset + 1);
>          return val;
>      }
> -    return m5206_mbar_read(s, offset);
> +    return (uint32_t)m5206_mbar_read(s, offset, 2);
>  }

No need for these pointless casts (but don't repost, unless there are
other comments).

-- 
error compiling committee.c: too many arguments to function




reply via email to

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