pl181: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com>
This commit is contained in:
parent
1a6b31cec7
commit
ca45842ab6
26
hw/pl181.c
26
hw/pl181.c
@ -24,6 +24,7 @@ do { printf("pl181: " fmt , ## __VA_ARGS__); } while (0)
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
SysBusDevice busdev;
|
SysBusDevice busdev;
|
||||||
|
MemoryRegion iomem;
|
||||||
SDState *card;
|
SDState *card;
|
||||||
uint32_t clock;
|
uint32_t clock;
|
||||||
uint32_t power;
|
uint32_t power;
|
||||||
@ -259,7 +260,8 @@ static void pl181_fifo_run(pl181_state *s)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t pl181_read(void *opaque, target_phys_addr_t offset)
|
static uint64_t pl181_read(void *opaque, target_phys_addr_t offset,
|
||||||
|
unsigned size)
|
||||||
{
|
{
|
||||||
pl181_state *s = (pl181_state *)opaque;
|
pl181_state *s = (pl181_state *)opaque;
|
||||||
uint32_t tmp;
|
uint32_t tmp;
|
||||||
@ -342,7 +344,7 @@ static uint32_t pl181_read(void *opaque, target_phys_addr_t offset)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void pl181_write(void *opaque, target_phys_addr_t offset,
|
static void pl181_write(void *opaque, target_phys_addr_t offset,
|
||||||
uint32_t value)
|
uint64_t value, unsigned size)
|
||||||
{
|
{
|
||||||
pl181_state *s = (pl181_state *)opaque;
|
pl181_state *s = (pl181_state *)opaque;
|
||||||
|
|
||||||
@ -412,16 +414,10 @@ static void pl181_write(void *opaque, target_phys_addr_t offset,
|
|||||||
pl181_update(s);
|
pl181_update(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
static CPUReadMemoryFunc * const pl181_readfn[] = {
|
static const MemoryRegionOps pl181_ops = {
|
||||||
pl181_read,
|
.read = pl181_read,
|
||||||
pl181_read,
|
.write = pl181_write,
|
||||||
pl181_read
|
.endianness = DEVICE_NATIVE_ENDIAN,
|
||||||
};
|
|
||||||
|
|
||||||
static CPUWriteMemoryFunc * const pl181_writefn[] = {
|
|
||||||
pl181_write,
|
|
||||||
pl181_write,
|
|
||||||
pl181_write
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static void pl181_reset(void *opaque)
|
static void pl181_reset(void *opaque)
|
||||||
@ -453,13 +449,11 @@ static void pl181_reset(void *opaque)
|
|||||||
|
|
||||||
static int pl181_init(SysBusDevice *dev)
|
static int pl181_init(SysBusDevice *dev)
|
||||||
{
|
{
|
||||||
int iomemtype;
|
|
||||||
pl181_state *s = FROM_SYSBUS(pl181_state, dev);
|
pl181_state *s = FROM_SYSBUS(pl181_state, dev);
|
||||||
DriveInfo *dinfo;
|
DriveInfo *dinfo;
|
||||||
|
|
||||||
iomemtype = cpu_register_io_memory(pl181_readfn, pl181_writefn, s,
|
memory_region_init_io(&s->iomem, &pl181_ops, s, "pl181", 0x1000);
|
||||||
DEVICE_NATIVE_ENDIAN);
|
sysbus_init_mmio_region(dev, &s->iomem);
|
||||||
sysbus_init_mmio(dev, 0x1000, iomemtype);
|
|
||||||
sysbus_init_irq(dev, &s->irq[0]);
|
sysbus_init_irq(dev, &s->irq[0]);
|
||||||
sysbus_init_irq(dev, &s->irq[1]);
|
sysbus_init_irq(dev, &s->irq[1]);
|
||||||
qdev_init_gpio_out(&s->busdev.qdev, s->cardstatus, 2);
|
qdev_init_gpio_out(&s->busdev.qdev, s->cardstatus, 2);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user