提交 b8f7a738 编写于 作者: A Avi Kivity

pl050: convert to memory API

Signed-off-by: NAvi Kivity <avi@redhat.com>
上级 9edbe481
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
typedef struct { typedef struct {
SysBusDevice busdev; SysBusDevice busdev;
MemoryRegion iomem;
void *dev; void *dev;
uint32_t cr; uint32_t cr;
uint32_t clk; uint32_t clk;
...@@ -57,7 +58,8 @@ static void pl050_update(void *opaque, int level) ...@@ -57,7 +58,8 @@ static void pl050_update(void *opaque, int level)
qemu_set_irq(s->irq, raise); qemu_set_irq(s->irq, raise);
} }
static uint32_t pl050_read(void *opaque, target_phys_addr_t offset) static uint64_t pl050_read(void *opaque, target_phys_addr_t offset,
unsigned size)
{ {
pl050_state *s = (pl050_state *)opaque; pl050_state *s = (pl050_state *)opaque;
if (offset >= 0xfe0 && offset < 0x1000) if (offset >= 0xfe0 && offset < 0x1000)
...@@ -99,7 +101,7 @@ static uint32_t pl050_read(void *opaque, target_phys_addr_t offset) ...@@ -99,7 +101,7 @@ static uint32_t pl050_read(void *opaque, target_phys_addr_t offset)
} }
static void pl050_write(void *opaque, target_phys_addr_t offset, static void pl050_write(void *opaque, target_phys_addr_t offset,
uint32_t value) uint64_t value, unsigned size)
{ {
pl050_state *s = (pl050_state *)opaque; pl050_state *s = (pl050_state *)opaque;
switch (offset >> 2) { switch (offset >> 2) {
...@@ -124,27 +126,18 @@ static void pl050_write(void *opaque, target_phys_addr_t offset, ...@@ -124,27 +126,18 @@ static void pl050_write(void *opaque, target_phys_addr_t offset,
hw_error("pl050_write: Bad offset %x\n", (int)offset); hw_error("pl050_write: Bad offset %x\n", (int)offset);
} }
} }
static CPUReadMemoryFunc * const pl050_readfn[] = { static const MemoryRegionOps pl050_ops = {
pl050_read, .read = pl050_read,
pl050_read, .write = pl050_write,
pl050_read .endianness = DEVICE_NATIVE_ENDIAN,
};
static CPUWriteMemoryFunc * const pl050_writefn[] = {
pl050_write,
pl050_write,
pl050_write
}; };
static int pl050_init(SysBusDevice *dev, int is_mouse) static int pl050_init(SysBusDevice *dev, int is_mouse)
{ {
pl050_state *s = FROM_SYSBUS(pl050_state, dev); pl050_state *s = FROM_SYSBUS(pl050_state, dev);
int iomemtype;
iomemtype = cpu_register_io_memory(pl050_readfn, memory_region_init_io(&s->iomem, &pl050_ops, s, "pl050", 0x1000);
pl050_writefn, s, sysbus_init_mmio_region(dev, &s->iomem);
DEVICE_NATIVE_ENDIAN);
sysbus_init_mmio(dev, 0x1000, iomemtype);
sysbus_init_irq(dev, &s->irq); sysbus_init_irq(dev, &s->irq);
s->is_mouse = is_mouse; s->is_mouse = is_mouse;
if (s->is_mouse) if (s->is_mouse)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册