diff options
| author | Anthony Liguori <aliguori@us.ibm.com> | 2011-12-05 08:43:38 -0600 |
|---|---|---|
| committer | Anthony Liguori <aliguori@us.ibm.com> | 2011-12-05 08:43:38 -0600 |
| commit | 01e7a53aed945adafc3ee54e2159227839daf0b4 (patch) | |
| tree | 992b5c4a38316289ed5b2fa6ddf486cb3d59bead /hw/lm32_sys.c | |
| parent | 4eb2d2d900eb6f63cad2b5cb6ca4273bfb9b230c (diff) | |
| parent | f44336c594c7e7887ee43ece3b53ba68b827fd1d (diff) | |
| download | focaccia-qemu-01e7a53aed945adafc3ee54e2159227839daf0b4.tar.gz focaccia-qemu-01e7a53aed945adafc3ee54e2159227839daf0b4.zip | |
Merge remote-tracking branch 'qemu-kvm/memory/batch' into staging
Diffstat (limited to 'hw/lm32_sys.c')
| -rw-r--r-- | hw/lm32_sys.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/hw/lm32_sys.c b/hw/lm32_sys.c index e5ff962f43..83974ee4fb 100644 --- a/hw/lm32_sys.c +++ b/hw/lm32_sys.c @@ -47,6 +47,7 @@ enum { struct LM32SysState { SysBusDevice busdev; + MemoryRegion iomem; uint32_t base; uint32_t regs[R_MAX]; uint8_t testname[MAX_TESTNAME_LEN]; @@ -60,7 +61,8 @@ static void copy_testname(LM32SysState *s) s->testname[MAX_TESTNAME_LEN - 1] = '\0'; } -static void sys_write(void *opaque, target_phys_addr_t addr, uint32_t value) +static void sys_write(void *opaque, target_phys_addr_t addr, + uint64_t value, unsigned size) { LM32SysState *s = opaque; char *testname; @@ -89,16 +91,16 @@ static void sys_write(void *opaque, target_phys_addr_t addr, uint32_t value) } } -static CPUReadMemoryFunc * const sys_read_fn[] = { - NULL, - NULL, - NULL, -}; +static bool sys_ops_accepts(void *opaque, target_phys_addr_t addr, + unsigned size, bool is_write) +{ + return is_write && size == 4; +} -static CPUWriteMemoryFunc * const sys_write_fn[] = { - NULL, - NULL, - &sys_write, +static const MemoryRegionOps sys_ops = { + .write = sys_write, + .valid.accepts = sys_ops_accepts, + .endianness = DEVICE_NATIVE_ENDIAN, }; static void sys_reset(DeviceState *d) @@ -115,11 +117,9 @@ static void sys_reset(DeviceState *d) static int lm32_sys_init(SysBusDevice *dev) { LM32SysState *s = FROM_SYSBUS(typeof(*s), dev); - int sys_regs; - sys_regs = cpu_register_io_memory(sys_read_fn, sys_write_fn, s, - DEVICE_NATIVE_ENDIAN); - sysbus_init_mmio(dev, R_MAX * 4, sys_regs); + memory_region_init_io(&s->iomem, &sys_ops , s, "sys", R_MAX * 4); + sysbus_init_mmio(dev, &s->iomem); /* Note: This device is not created in the board initialization, * instead it has to be added with the -device parameter. Therefore, |