aboutsummaryrefslogtreecommitdiff
path: root/hw/slavio_intctl.c
diff options
context:
space:
mode:
authorBenoƮt Canet <benoit.canet@gmail.com>2011-11-15 12:14:00 +0100
committerAvi Kivity <avi@redhat.com>2011-11-24 18:32:02 +0200
commit8bb5ef333ae82632845785265fdb0a5ee52c34b2 (patch)
tree09d4741066d2bba1db4c625740c3f99eb0f9e716 /hw/slavio_intctl.c
parent13c89a1125feb48a9e21019223fdb99f4d8bcd41 (diff)
downloadqemu-8bb5ef333ae82632845785265fdb0a5ee52c34b2.zip
qemu-8bb5ef333ae82632845785265fdb0a5ee52c34b2.tar.gz
qemu-8bb5ef333ae82632845785265fdb0a5ee52c34b2.tar.bz2
slavio_intctl: convert slaves interrupt controllers to memory API
Signed-off-by: Benoit Canet <benoit.canet@gmail.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'hw/slavio_intctl.c')
-rw-r--r--hw/slavio_intctl.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/hw/slavio_intctl.c b/hw/slavio_intctl.c
index 0bc2a0b..e7812ed 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;
@@ -77,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;
@@ -97,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;
@@ -122,16 +124,14 @@ 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
@@ -422,8 +422,8 @@ 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);
memory_region_init_io(&s->iomem, &slavio_intctlm_mem_ops, s,
@@ -431,14 +431,14 @@ static int slavio_intctl_init1(SysBusDevice *dev)
sysbus_init_mmio_region(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_region(dev, &s->slaves[i].iomem);
s->slaves[i].cpu = i;
s->slaves[i].master = s;
}