diff options
author | Evgeny Voevodin <e.voevodin@samsung.com> | 2012-06-08 13:45:29 +0400 |
---|---|---|
committer | Evgeny Voevodin <e.voevodin@samsung.com> | 2012-06-15 11:21:10 +0400 |
commit | 02935a553fb88f79fb0c79f094fb5ca0b42c96f3 (patch) | |
tree | 7a317e392c43f920faa1044cdb3df4c75b2c3639 /hw/slavio_intctl.c | |
parent | 5b1adc390502140a03bc1e872b0b103d09e048f6 (diff) | |
download | qemu-02935a553fb88f79fb0c79f094fb5ca0b42c96f3.tar.gz qemu-02935a553fb88f79fb0c79f094fb5ca0b42c96f3.tar.bz2 qemu-02935a553fb88f79fb0c79f094fb5ca0b42c96f3.zip |
Upgrade to upstream v1.1.0.
Signed-off-by: Evgeny Voevodin <e.voevodin@samsung.com>
Diffstat (limited to 'hw/slavio_intctl.c')
-rw-r--r-- | hw/slavio_intctl.c | 94 |
1 files changed, 51 insertions, 43 deletions
diff --git a/hw/slavio_intctl.c b/hw/slavio_intctl.c index 329c251845..7fdc3be086 100644 --- a/hw/slavio_intctl.c +++ b/hw/slavio_intctl.c @@ -46,6 +46,7 @@ struct SLAVIO_INTCTLState; typedef struct SLAVIO_CPUINTCTLState { + MemoryRegion iomem; struct SLAVIO_INTCTLState *master; uint32_t intreg_pending; uint32_t cpu; @@ -54,6 +55,7 @@ typedef struct SLAVIO_CPUINTCTLState { typedef struct SLAVIO_INTCTLState { SysBusDevice busdev; + MemoryRegion iomem; #ifdef DEBUG_IRQ_COUNT uint64_t irq_count[32]; #endif @@ -76,7 +78,8 @@ typedef struct SLAVIO_INTCTLState { static void slavio_check_interrupts(SLAVIO_INTCTLState *s, int set_irqs); // per-cpu interrupt controller -static uint32_t slavio_intctl_mem_readl(void *opaque, target_phys_addr_t addr) +static uint64_t slavio_intctl_mem_readl(void *opaque, target_phys_addr_t addr, + unsigned size) { SLAVIO_CPUINTCTLState *s = opaque; uint32_t saddr, ret; @@ -96,7 +99,7 @@ static uint32_t slavio_intctl_mem_readl(void *opaque, target_phys_addr_t addr) } static void slavio_intctl_mem_writel(void *opaque, target_phys_addr_t addr, - uint32_t val) + uint64_t val, unsigned size) { SLAVIO_CPUINTCTLState *s = opaque; uint32_t saddr; @@ -121,20 +124,19 @@ static void slavio_intctl_mem_writel(void *opaque, target_phys_addr_t addr, } } -static CPUReadMemoryFunc * const slavio_intctl_mem_read[3] = { - NULL, - NULL, - slavio_intctl_mem_readl, -}; - -static CPUWriteMemoryFunc * const slavio_intctl_mem_write[3] = { - NULL, - NULL, - slavio_intctl_mem_writel, +static const MemoryRegionOps slavio_intctl_mem_ops = { + .read = slavio_intctl_mem_readl, + .write = slavio_intctl_mem_writel, + .endianness = DEVICE_NATIVE_ENDIAN, + .valid = { + .min_access_size = 4, + .max_access_size = 4, + }, }; // master system interrupt controller -static uint32_t slavio_intctlm_mem_readl(void *opaque, target_phys_addr_t addr) +static uint64_t slavio_intctlm_mem_readl(void *opaque, target_phys_addr_t addr, + unsigned size) { SLAVIO_INTCTLState *s = opaque; uint32_t saddr, ret; @@ -160,7 +162,7 @@ static uint32_t slavio_intctlm_mem_readl(void *opaque, target_phys_addr_t addr) } static void slavio_intctlm_mem_writel(void *opaque, target_phys_addr_t addr, - uint32_t val) + uint64_t val, unsigned size) { SLAVIO_INTCTLState *s = opaque; uint32_t saddr; @@ -192,16 +194,14 @@ static void slavio_intctlm_mem_writel(void *opaque, target_phys_addr_t addr, } } -static CPUReadMemoryFunc * const slavio_intctlm_mem_read[3] = { - NULL, - NULL, - slavio_intctlm_mem_readl, -}; - -static CPUWriteMemoryFunc * const slavio_intctlm_mem_write[3] = { - NULL, - NULL, - slavio_intctlm_mem_writel, +static const MemoryRegionOps slavio_intctlm_mem_ops = { + .read = slavio_intctlm_mem_readl, + .write = slavio_intctlm_mem_writel, + .endianness = DEVICE_NATIVE_ENDIAN, + .valid = { + .min_access_size = 4, + .max_access_size = 4, + }, }; void slavio_pic_info(Monitor *mon, DeviceState *dev) @@ -422,24 +422,23 @@ static void slavio_intctl_reset(DeviceState *d) static int slavio_intctl_init1(SysBusDevice *dev) { SLAVIO_INTCTLState *s = FROM_SYSBUS(SLAVIO_INTCTLState, dev); - int io_memory; unsigned int i, j; + char slave_name[45]; qdev_init_gpio_in(&dev->qdev, slavio_set_irq_all, 32 + MAX_CPUS); - io_memory = cpu_register_io_memory(slavio_intctlm_mem_read, - slavio_intctlm_mem_write, s, - DEVICE_NATIVE_ENDIAN); - sysbus_init_mmio(dev, INTCTLM_SIZE, io_memory); + memory_region_init_io(&s->iomem, &slavio_intctlm_mem_ops, s, + "master-interrupt-controller", INTCTLM_SIZE); + sysbus_init_mmio(dev, &s->iomem); for (i = 0; i < MAX_CPUS; i++) { + snprintf(slave_name, sizeof(slave_name), + "slave-interrupt-controller-%i", i); for (j = 0; j < MAX_PILS; j++) { sysbus_init_irq(dev, &s->cpu_irqs[i][j]); } - io_memory = cpu_register_io_memory(slavio_intctl_mem_read, - slavio_intctl_mem_write, - &s->slaves[i], - DEVICE_NATIVE_ENDIAN); - sysbus_init_mmio(dev, INTCTL_SIZE, io_memory); + memory_region_init_io(&s->slaves[i].iomem, &slavio_intctl_mem_ops, + &s->slaves[i], slave_name, INTCTL_SIZE); + sysbus_init_mmio(dev, &s->slaves[i].iomem); s->slaves[i].cpu = i; s->slaves[i].master = s; } @@ -447,17 +446,26 @@ static int slavio_intctl_init1(SysBusDevice *dev) return 0; } -static SysBusDeviceInfo slavio_intctl_info = { - .init = slavio_intctl_init1, - .qdev.name = "slavio_intctl", - .qdev.size = sizeof(SLAVIO_INTCTLState), - .qdev.vmsd = &vmstate_intctl, - .qdev.reset = slavio_intctl_reset, +static void slavio_intctl_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(klass); + SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); + + k->init = slavio_intctl_init1; + dc->reset = slavio_intctl_reset; + dc->vmsd = &vmstate_intctl; +} + +static TypeInfo slavio_intctl_info = { + .name = "slavio_intctl", + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(SLAVIO_INTCTLState), + .class_init = slavio_intctl_class_init, }; -static void slavio_intctl_register_devices(void) +static void slavio_intctl_register_types(void) { - sysbus_register_withprop(&slavio_intctl_info); + type_register_static(&slavio_intctl_info); } -device_init(slavio_intctl_register_devices) +type_init(slavio_intctl_register_types) |