mirror of https://github.com/xemu-project/xemu.git
integratorcp: convert control to memory API
Signed-off-by: Benoit Canet <benoit.canet@gmail.com> Signed-off-by: Avi Kivity <avi@redhat.com>
This commit is contained in:
parent
61074e46de
commit
0c36493e51
|
@ -392,7 +392,9 @@ static int icp_pic_init(SysBusDevice *dev)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* CP control registers. */
|
/* CP control registers. */
|
||||||
static uint32_t icp_control_read(void *opaque, target_phys_addr_t offset)
|
|
||||||
|
static uint64_t icp_control_read(void *opaque, target_phys_addr_t offset,
|
||||||
|
unsigned size)
|
||||||
{
|
{
|
||||||
switch (offset >> 2) {
|
switch (offset >> 2) {
|
||||||
case 0: /* CP_IDFIELD */
|
case 0: /* CP_IDFIELD */
|
||||||
|
@ -410,7 +412,7 @@ static uint32_t icp_control_read(void *opaque, target_phys_addr_t offset)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void icp_control_write(void *opaque, target_phys_addr_t offset,
|
static void icp_control_write(void *opaque, target_phys_addr_t offset,
|
||||||
uint32_t value)
|
uint64_t value, unsigned size)
|
||||||
{
|
{
|
||||||
switch (offset >> 2) {
|
switch (offset >> 2) {
|
||||||
case 1: /* CP_FLASHPROG */
|
case 1: /* CP_FLASHPROG */
|
||||||
|
@ -422,26 +424,21 @@ static void icp_control_write(void *opaque, target_phys_addr_t offset,
|
||||||
hw_error("icp_control_write: Bad offset %x\n", (int)offset);
|
hw_error("icp_control_write: Bad offset %x\n", (int)offset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static CPUReadMemoryFunc * const icp_control_readfn[] = {
|
|
||||||
icp_control_read,
|
static const MemoryRegionOps icp_control_ops = {
|
||||||
icp_control_read,
|
.read = icp_control_read,
|
||||||
icp_control_read
|
.write = icp_control_write,
|
||||||
|
.endianness = DEVICE_NATIVE_ENDIAN,
|
||||||
};
|
};
|
||||||
|
|
||||||
static CPUWriteMemoryFunc * const icp_control_writefn[] = {
|
static void icp_control_init(target_phys_addr_t base)
|
||||||
icp_control_write,
|
|
||||||
icp_control_write,
|
|
||||||
icp_control_write
|
|
||||||
};
|
|
||||||
|
|
||||||
static void icp_control_init(uint32_t base)
|
|
||||||
{
|
{
|
||||||
int iomemtype;
|
MemoryRegion *io;
|
||||||
|
|
||||||
iomemtype = cpu_register_io_memory(icp_control_readfn,
|
io = (MemoryRegion *)g_malloc0(sizeof(MemoryRegion));
|
||||||
icp_control_writefn, NULL,
|
memory_region_init_io(io, &icp_control_ops, NULL,
|
||||||
DEVICE_NATIVE_ENDIAN);
|
"control", 0x00800000);
|
||||||
cpu_register_physical_memory(base, 0x00800000, iomemtype);
|
memory_region_add_subregion(get_system_memory(), base, io);
|
||||||
/* ??? Save/restore. */
|
/* ??? Save/restore. */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue