From: "Benoît Canet" <benoit.canet@gmail.com>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, "Benoît Canet" <benoit.canet@gmail.com>,
avi@redhat.com
Subject: [Qemu-devel] [PATCH 7/9] pxa2xx_pic: convert to memory API
Date: Sun, 30 Oct 2011 14:50:17 +0100 [thread overview]
Message-ID: <1319982619-26657-8-git-send-email-benoit.canet@gmail.com> (raw)
In-Reply-To: <1319982619-26657-1-git-send-email-benoit.canet@gmail.com>
The ARM documentation say transfers between the cpu and the
coprocessor are 32 bits wide.
Use 4 as size for coprocessor read and writes.
Signed-off-by: Benoit Canet <benoit.canet@gmail.com>
---
hw/pxa2xx_pic.c | 31 +++++++++++++------------------
1 files changed, 13 insertions(+), 18 deletions(-)
diff --git a/hw/pxa2xx_pic.c b/hw/pxa2xx_pic.c
index bdd82e6..13f96a9 100644
--- a/hw/pxa2xx_pic.c
+++ b/hw/pxa2xx_pic.c
@@ -33,6 +33,7 @@
typedef struct {
SysBusDevice busdev;
+ MemoryRegion iomem;
CPUState *cpu_env;
uint32_t int_enabled[2];
uint32_t int_pending[2];
@@ -115,7 +116,8 @@ static inline uint32_t pxa2xx_pic_highest(PXA2xxPICState *s) {
return ichp;
}
-static uint32_t pxa2xx_pic_mem_read(void *opaque, target_phys_addr_t offset)
+static uint64_t pxa2xx_pic_mem_read(void *opaque, target_phys_addr_t offset,
+ unsigned size)
{
PXA2xxPICState *s = (PXA2xxPICState *) opaque;
@@ -155,7 +157,7 @@ static uint32_t pxa2xx_pic_mem_read(void *opaque, target_phys_addr_t offset)
}
static void pxa2xx_pic_mem_write(void *opaque, target_phys_addr_t offset,
- uint32_t value)
+ uint64_t value, unsigned size)
{
PXA2xxPICState *s = (PXA2xxPICState *) opaque;
@@ -214,7 +216,7 @@ static uint32_t pxa2xx_pic_cp_read(void *opaque, int op2, int reg, int crm)
}
offset = pxa2xx_cp_reg_map[reg];
- return pxa2xx_pic_mem_read(opaque, offset);
+ return pxa2xx_pic_mem_read(opaque, offset, 4);
}
static void pxa2xx_pic_cp_write(void *opaque, int op2, int reg, int crm,
@@ -228,19 +230,13 @@ static void pxa2xx_pic_cp_write(void *opaque, int op2, int reg, int crm,
}
offset = pxa2xx_cp_reg_map[reg];
- pxa2xx_pic_mem_write(opaque, offset, value);
+ pxa2xx_pic_mem_write(opaque, offset, value, 4);
}
-static CPUReadMemoryFunc * const pxa2xx_pic_readfn[] = {
- pxa2xx_pic_mem_read,
- pxa2xx_pic_mem_read,
- pxa2xx_pic_mem_read,
-};
-
-static CPUWriteMemoryFunc * const pxa2xx_pic_writefn[] = {
- pxa2xx_pic_mem_write,
- pxa2xx_pic_mem_write,
- pxa2xx_pic_mem_write,
+static const MemoryRegionOps pxa2xx_pic_ops = {
+ .read = pxa2xx_pic_mem_read,
+ .write = pxa2xx_pic_mem_write,
+ .endianness = DEVICE_NATIVE_ENDIAN,
};
static int pxa2xx_pic_post_load(void *opaque, int version_id)
@@ -252,7 +248,6 @@ static int pxa2xx_pic_post_load(void *opaque, int version_id)
DeviceState *pxa2xx_pic_init(target_phys_addr_t base, CPUState *env)
{
DeviceState *dev = qdev_create(NULL, "pxa2xx_pic");
- int iomemtype;
PXA2xxPICState *s = FROM_SYSBUS(PXA2xxPICState, sysbus_from_qdev(dev));
s->cpu_env = env;
@@ -269,9 +264,9 @@ DeviceState *pxa2xx_pic_init(target_phys_addr_t base, CPUState *env)
qdev_init_gpio_in(dev, pxa2xx_pic_set_irq, PXA2XX_PIC_SRCS);
/* Enable IC memory-mapped registers access. */
- iomemtype = cpu_register_io_memory(pxa2xx_pic_readfn,
- pxa2xx_pic_writefn, s, DEVICE_NATIVE_ENDIAN);
- sysbus_init_mmio(sysbus_from_qdev(dev), 0x00100000, iomemtype);
+ memory_region_init_io(&s->iomem, &pxa2xx_pic_ops, s,
+ "pxa2xx-pic", 0x00100000);
+ sysbus_init_mmio_region(sysbus_from_qdev(dev), &s->iomem);
sysbus_mmio_map(sysbus_from_qdev(dev), 0, base);
/* Enable IC coprocessor access. */
--
1.7.5.4
next prev parent reply other threads:[~2011-10-30 14:00 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-30 13:50 [Qemu-devel] [PATCH V2 0/9] pxa2xx: memory API conversions Benoît Canet
2011-10-30 13:50 ` [Qemu-devel] [PATCH 1/9] pxa2xx_gpio: convert to memory API Benoît Canet
2011-10-30 13:50 ` [Qemu-devel] [PATCH 2/9] pxa2xx_pcmcia.c: convert common memory space " Benoît Canet
2011-10-30 13:50 ` [Qemu-devel] [PATCH 3/9] pxa2xx_pcmcia.c: convert attribute " Benoît Canet
2011-10-30 13:50 ` [Qemu-devel] [PATCH 4/9] pxa2xx_pcmcia.c: convert io " Benoît Canet
2011-10-30 13:50 ` [Qemu-devel] [PATCH 5/9] pxa2xx_keypad: convert " Benoît Canet
2011-10-30 13:50 ` [Qemu-devel] [PATCH 6/9] pxa2xx_timer: " Benoît Canet
2011-10-30 13:50 ` Benoît Canet [this message]
2011-10-30 13:50 ` [Qemu-devel] [PATCH 8/9] pxa2xx_mmci: " Benoît Canet
2011-10-30 13:50 ` [Qemu-devel] [PATCH 9/9] pxa2xx_lcd: " Benoît Canet
2011-10-30 14:09 ` [Qemu-devel] [PATCH V2 0/9] pxa2xx: memory API conversions 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=1319982619-26657-8-git-send-email-benoit.canet@gmail.com \
--to=benoit.canet@gmail.com \
--cc=avi@redhat.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).