提交 63b02e04 编写于 作者: A Avi Kivity

pl080: convert to memory API

Signed-off-by: NAvi Kivity <avi@redhat.com>
上级 3cf89f8a
...@@ -37,6 +37,7 @@ typedef struct { ...@@ -37,6 +37,7 @@ typedef struct {
typedef struct { typedef struct {
SysBusDevice busdev; SysBusDevice busdev;
MemoryRegion iomem;
uint8_t tc_int; uint8_t tc_int;
uint8_t tc_mask; uint8_t tc_mask;
uint8_t err_int; uint8_t err_int;
...@@ -217,7 +218,8 @@ again: ...@@ -217,7 +218,8 @@ again:
} }
} }
static uint32_t pl080_read(void *opaque, target_phys_addr_t offset) static uint64_t pl080_read(void *opaque, target_phys_addr_t offset,
unsigned size)
{ {
pl080_state *s = (pl080_state *)opaque; pl080_state *s = (pl080_state *)opaque;
uint32_t i; uint32_t i;
...@@ -285,7 +287,7 @@ static uint32_t pl080_read(void *opaque, target_phys_addr_t offset) ...@@ -285,7 +287,7 @@ static uint32_t pl080_read(void *opaque, target_phys_addr_t offset)
} }
static void pl080_write(void *opaque, target_phys_addr_t offset, static void pl080_write(void *opaque, target_phys_addr_t offset,
uint32_t value) uint64_t value, unsigned size)
{ {
pl080_state *s = (pl080_state *)opaque; pl080_state *s = (pl080_state *)opaque;
int i; int i;
...@@ -344,27 +346,18 @@ static void pl080_write(void *opaque, target_phys_addr_t offset, ...@@ -344,27 +346,18 @@ static void pl080_write(void *opaque, target_phys_addr_t offset,
pl080_update(s); pl080_update(s);
} }
static CPUReadMemoryFunc * const pl080_readfn[] = { static const MemoryRegionOps pl080_ops = {
pl080_read, .read = pl080_read,
pl080_read, .write = pl080_write,
pl080_read .endianness = DEVICE_NATIVE_ENDIAN,
};
static CPUWriteMemoryFunc * const pl080_writefn[] = {
pl080_write,
pl080_write,
pl080_write
}; };
static int pl08x_init(SysBusDevice *dev, int nchannels) static int pl08x_init(SysBusDevice *dev, int nchannels)
{ {
int iomemtype;
pl080_state *s = FROM_SYSBUS(pl080_state, dev); pl080_state *s = FROM_SYSBUS(pl080_state, dev);
iomemtype = cpu_register_io_memory(pl080_readfn, memory_region_init_io(&s->iomem, &pl080_ops, s, "pl080", 0x1000);
pl080_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->nchannels = nchannels; s->nchannels = nchannels;
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册