mirror of https://github.com/xemu-project/xemu.git
mpc8544_guts: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com>
This commit is contained in:
parent
561e182755
commit
1c7af35f96
|
@ -53,11 +53,13 @@
|
||||||
|
|
||||||
struct GutsState {
|
struct GutsState {
|
||||||
SysBusDevice busdev;
|
SysBusDevice busdev;
|
||||||
|
MemoryRegion iomem;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct GutsState GutsState;
|
typedef struct GutsState GutsState;
|
||||||
|
|
||||||
static uint32_t mpc8544_guts_read32(void *opaque, target_phys_addr_t addr)
|
static uint64_t mpc8544_guts_read(void *opaque, target_phys_addr_t addr,
|
||||||
|
unsigned size)
|
||||||
{
|
{
|
||||||
uint32_t value = 0;
|
uint32_t value = 0;
|
||||||
CPUState *env = cpu_single_env;
|
CPUState *env = cpu_single_env;
|
||||||
|
@ -78,14 +80,8 @@ static uint32_t mpc8544_guts_read32(void *opaque, target_phys_addr_t addr)
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
static CPUReadMemoryFunc * const mpc8544_guts_read[] = {
|
static void mpc8544_guts_write(void *opaque, target_phys_addr_t addr,
|
||||||
NULL,
|
uint64_t value, unsigned size)
|
||||||
NULL,
|
|
||||||
&mpc8544_guts_read32,
|
|
||||||
};
|
|
||||||
|
|
||||||
static void mpc8544_guts_write32(void *opaque, target_phys_addr_t addr,
|
|
||||||
uint32_t value)
|
|
||||||
{
|
{
|
||||||
addr &= MPC8544_GUTS_MMIO_SIZE - 1;
|
addr &= MPC8544_GUTS_MMIO_SIZE - 1;
|
||||||
|
|
||||||
|
@ -97,27 +93,30 @@ static void mpc8544_guts_write32(void *opaque, target_phys_addr_t addr,
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "guts: Unknown register write: %x = %x\n",
|
fprintf(stderr, "guts: Unknown register write: %x = %x\n",
|
||||||
(int)addr, value);
|
(int)addr, (unsigned)value);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static CPUWriteMemoryFunc * const mpc8544_guts_write[] = {
|
static const MemoryRegionOps mpc8544_guts_ops = {
|
||||||
NULL,
|
.read = mpc8544_guts_read,
|
||||||
NULL,
|
.write = mpc8544_guts_write,
|
||||||
&mpc8544_guts_write32,
|
.endianness = DEVICE_BIG_ENDIAN,
|
||||||
|
.valid = {
|
||||||
|
.min_access_size = 4,
|
||||||
|
.max_access_size = 4,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
static int mpc8544_guts_initfn(SysBusDevice *dev)
|
static int mpc8544_guts_initfn(SysBusDevice *dev)
|
||||||
{
|
{
|
||||||
GutsState *s;
|
GutsState *s;
|
||||||
int iomem;
|
|
||||||
|
|
||||||
s = FROM_SYSBUS(GutsState, sysbus_from_qdev(dev));
|
s = FROM_SYSBUS(GutsState, sysbus_from_qdev(dev));
|
||||||
|
|
||||||
iomem = cpu_register_io_memory(mpc8544_guts_read, mpc8544_guts_write, s,
|
memory_region_init_io(&s->iomem, &mpc8544_guts_ops, s,
|
||||||
DEVICE_BIG_ENDIAN);
|
"mpc6544.guts", MPC8544_GUTS_MMIO_SIZE);
|
||||||
sysbus_init_mmio(dev, MPC8544_GUTS_MMIO_SIZE, iomem);
|
sysbus_init_mmio_region(dev, &s->iomem);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue