pl110: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com>
This commit is contained in:
parent
63b02e041b
commit
1a6b31cec7
27
hw/pl110.c
27
hw/pl110.c
@ -40,6 +40,7 @@ enum pl110_version
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
SysBusDevice busdev;
|
SysBusDevice busdev;
|
||||||
|
MemoryRegion iomem;
|
||||||
DisplayState *ds;
|
DisplayState *ds;
|
||||||
|
|
||||||
int version;
|
int version;
|
||||||
@ -301,7 +302,8 @@ static void pl110_update(pl110_state *s)
|
|||||||
/* TODO: Implement interrupts. */
|
/* TODO: Implement interrupts. */
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t pl110_read(void *opaque, target_phys_addr_t offset)
|
static uint64_t pl110_read(void *opaque, target_phys_addr_t offset,
|
||||||
|
unsigned size)
|
||||||
{
|
{
|
||||||
pl110_state *s = (pl110_state *)opaque;
|
pl110_state *s = (pl110_state *)opaque;
|
||||||
|
|
||||||
@ -350,7 +352,7 @@ static uint32_t pl110_read(void *opaque, target_phys_addr_t offset)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void pl110_write(void *opaque, target_phys_addr_t offset,
|
static void pl110_write(void *opaque, target_phys_addr_t offset,
|
||||||
uint32_t val)
|
uint64_t val, unsigned size)
|
||||||
{
|
{
|
||||||
pl110_state *s = (pl110_state *)opaque;
|
pl110_state *s = (pl110_state *)opaque;
|
||||||
int n;
|
int n;
|
||||||
@ -416,16 +418,10 @@ static void pl110_write(void *opaque, target_phys_addr_t offset,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static CPUReadMemoryFunc * const pl110_readfn[] = {
|
static const MemoryRegionOps pl110_ops = {
|
||||||
pl110_read,
|
.read = pl110_read,
|
||||||
pl110_read,
|
.write = pl110_write,
|
||||||
pl110_read
|
.endianness = DEVICE_NATIVE_ENDIAN,
|
||||||
};
|
|
||||||
|
|
||||||
static CPUWriteMemoryFunc * const pl110_writefn[] = {
|
|
||||||
pl110_write,
|
|
||||||
pl110_write,
|
|
||||||
pl110_write
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static void pl110_mux_ctrl_set(void *opaque, int line, int level)
|
static void pl110_mux_ctrl_set(void *opaque, int line, int level)
|
||||||
@ -437,12 +433,9 @@ static void pl110_mux_ctrl_set(void *opaque, int line, int level)
|
|||||||
static int pl110_init(SysBusDevice *dev)
|
static int pl110_init(SysBusDevice *dev)
|
||||||
{
|
{
|
||||||
pl110_state *s = FROM_SYSBUS(pl110_state, dev);
|
pl110_state *s = FROM_SYSBUS(pl110_state, dev);
|
||||||
int iomemtype;
|
|
||||||
|
|
||||||
iomemtype = cpu_register_io_memory(pl110_readfn,
|
memory_region_init_io(&s->iomem, &pl110_ops, s, "pl110", 0x1000);
|
||||||
pl110_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);
|
||||||
qdev_init_gpio_in(&s->busdev.qdev, pl110_mux_ctrl_set, 1);
|
qdev_init_gpio_in(&s->busdev.qdev, pl110_mux_ctrl_set, 1);
|
||||||
s->ds = graphic_console_init(pl110_update_display,
|
s->ds = graphic_console_init(pl110_update_display,
|
||||||
|
Loading…
Reference in New Issue
Block a user