[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 1/5] omap_sx1: convert to memory API
From: |
Avi Kivity |
Subject: |
Re: [Qemu-devel] [PATCH 1/5] omap_sx1: convert to memory API |
Date: |
Sun, 27 Nov 2011 10:49:27 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111115 Thunderbird/8.0 |
On 11/25/2011 04:21 PM, Benoît Canet wrote:
> Signed-off-by: Benoît Canet <address@hidden>
> ---
> hw/omap_sx1.c | 113
> ++++++++++++++++++++++++++++++---------------------------
> 1 files changed, 59 insertions(+), 54 deletions(-)
>
> diff --git a/hw/omap_sx1.c b/hw/omap_sx1.c
> index fe53545..b056bc9 100644
> --- a/hw/omap_sx1.c
> +++ b/hw/omap_sx1.c
> @@ -59,46 +59,42 @@
> * - 1 RTC
> */
>
> -static uint32_t static_readb(void *opaque, target_phys_addr_t offset)
> -{
> - uint32_t *val = (uint32_t *) opaque;
> -
> - return *val >> ((offset & 3) << 3);
> -}
> -
> -static uint32_t static_readh(void *opaque, target_phys_addr_t offset)
> -{
> - uint32_t *val = (uint32_t *) opaque;
> -
> - return *val >> ((offset & 1) << 3);
> -}
> -
> -static uint32_t static_readw(void *opaque, target_phys_addr_t offset)
> +static uint64_t static_read(void *opaque, target_phys_addr_t offset,
> + unsigned size)
> {
> uint32_t *val = (uint32_t *) opaque;
> + uint32_t mask = 0;
> +
> + switch (size) {
> + case 1:
> + mask = 3;
> + break;
> + case 2:
> + mask = 1;
> + break;
> + case 4:
> + mask = 0;
> + break;
> + default:
> + mask = 0;
> + }
mask = (4 / size) - 1;
>
> - return *val >> ((offset & 0) << 3);
> + return *val >> ((offset & mask) << 3);
> }
>
>
>
Could also be done by just implementing the length 4 operation (which
just returns *val) and setting .impl.min_access_size =
.impl.max_access_size = 4, but unfortunately that is not implemented.
--
error compiling committee.c: too many arguments to function
- [Qemu-devel] [PATCH 0/5] convert some omap devices to memory API, Benoît Canet, 2011/11/25
- [Qemu-devel] [PATCH 3/5] omap_lcdc: convert to memory API, Benoît Canet, 2011/11/25
- [Qemu-devel] [PATCH 1/5] omap_sx1: convert to memory API, Benoît Canet, 2011/11/25
- Re: [Qemu-devel] [PATCH 1/5] omap_sx1: convert to memory API,
Avi Kivity <=
- [Qemu-devel] [PATCH 2/5] omap_spi: convert to memory API, Benoît Canet, 2011/11/25
- [Qemu-devel] [PATCH 4/5] omap_l4: convert to memory API, Benoît Canet, 2011/11/25
- [Qemu-devel] [PATCH 5/5] omap_i2c: convert to memory API, Benoît Canet, 2011/11/25
- Re: [Qemu-devel] [PATCH 0/5] convert some omap devices to memory API, Avi Kivity, 2011/11/28