aboutsummaryrefslogtreecommitdiff
path: root/hw/pl011.c
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2011-10-10 17:08:49 +0200
committerAvi Kivity <avi@redhat.com>2011-11-24 18:31:55 +0200
commit484847579417855b1640f7786064bf25d8324226 (patch)
tree925255c0f48f177198bfc54e121c5a34cf181eca /hw/pl011.c
parente71ceafc7d5792438639a4ecf87227c997e349f2 (diff)
downloadqemu-484847579417855b1640f7786064bf25d8324226.zip
qemu-484847579417855b1640f7786064bf25d8324226.tar.gz
qemu-484847579417855b1640f7786064bf25d8324226.tar.bz2
pl011: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'hw/pl011.c')
-rw-r--r--hw/pl011.c27
1 files changed, 10 insertions, 17 deletions
diff --git a/hw/pl011.c b/hw/pl011.c
index 707a161..9cf6dea 100644
--- a/hw/pl011.c
+++ b/hw/pl011.c
@@ -12,6 +12,7 @@
typedef struct {
SysBusDevice busdev;
+ MemoryRegion iomem;
uint32_t readbuff;
uint32_t flags;
uint32_t lcr;
@@ -53,7 +54,8 @@ static void pl011_update(pl011_state *s)
qemu_set_irq(s->irq, flags != 0);
}
-static uint32_t pl011_read(void *opaque, target_phys_addr_t offset)
+static uint64_t pl011_read(void *opaque, target_phys_addr_t offset,
+ unsigned size)
{
pl011_state *s = (pl011_state *)opaque;
uint32_t c;
@@ -123,7 +125,7 @@ static void pl011_set_read_trigger(pl011_state *s)
}
static void pl011_write(void *opaque, target_phys_addr_t offset,
- uint32_t value)
+ uint64_t value, unsigned size)
{
pl011_state *s = (pl011_state *)opaque;
unsigned char ch;
@@ -223,16 +225,10 @@ static void pl011_event(void *opaque, int event)
pl011_put_fifo(opaque, 0x400);
}
-static CPUReadMemoryFunc * const pl011_readfn[] = {
- pl011_read,
- pl011_read,
- pl011_read
-};
-
-static CPUWriteMemoryFunc * const pl011_writefn[] = {
- pl011_write,
- pl011_write,
- pl011_write
+static const MemoryRegionOps pl011_ops = {
+ .read = pl011_read,
+ .write = pl011_write,
+ .endianness = DEVICE_NATIVE_ENDIAN,
};
static const VMStateDescription vmstate_pl011 = {
@@ -262,13 +258,10 @@ static const VMStateDescription vmstate_pl011 = {
static int pl011_init(SysBusDevice *dev, const unsigned char *id)
{
- int iomemtype;
pl011_state *s = FROM_SYSBUS(pl011_state, dev);
- iomemtype = cpu_register_io_memory(pl011_readfn,
- pl011_writefn, s,
- DEVICE_NATIVE_ENDIAN);
- sysbus_init_mmio(dev, 0x1000,iomemtype);
+ memory_region_init_io(&s->iomem, &pl011_ops, s, "pl011", 0x1000);
+ sysbus_init_mmio_region(dev, &s->iomem);
sysbus_init_irq(dev, &s->irq);
s->id = id;
s->chr = qdev_init_chardev(&dev->qdev);