From: Avi Kivity <avi@redhat.com>
To: "Benoît Canet" <benoit.canet@gmail.com>
Cc: peter.maydell@linaro.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/5] omap_sx1: convert to memory API
Date: Sun, 27 Nov 2011 10:49:27 +0200 [thread overview]
Message-ID: <4ED1F997.2090308@redhat.com> (raw)
In-Reply-To: <1322230897-7470-2-git-send-email-benoit.canet@gmail.com>
On 11/25/2011 04:21 PM, Benoît Canet wrote:
> Signed-off-by: Benoît Canet <benoit.canet@gmail.com>
> ---
> 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
next prev parent reply other threads:[~2011-11-27 8:49 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-25 14:21 [Qemu-devel] [PATCH 0/5] convert some omap devices to memory API Benoît Canet
2011-11-25 14:21 ` [Qemu-devel] [PATCH 1/5] omap_sx1: convert " Benoît Canet
2011-11-27 8:49 ` Avi Kivity [this message]
2011-11-25 14:21 ` [Qemu-devel] [PATCH 2/5] omap_spi: " Benoît Canet
2011-11-25 14:21 ` [Qemu-devel] [PATCH 3/5] omap_lcdc: " Benoît Canet
2011-11-25 14:21 ` [Qemu-devel] [PATCH 4/5] omap_l4: " Benoît Canet
2011-11-25 14:21 ` [Qemu-devel] [PATCH 5/5] omap_i2c: " Benoît Canet
2011-11-28 13:32 ` [Qemu-devel] [PATCH 0/5] convert some omap devices " Avi Kivity
2011-11-29 14:43 ` Benoît Canet
2011-11-29 14:51 ` Avi Kivity
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4ED1F997.2090308@redhat.com \
--to=avi@redhat.com \
--cc=benoit.canet@gmail.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).