@@ -113,7 +113,7 @@ static void leon3_generic_hw_init(MachineState *machine)
MemoryRegion *prom = g_new(MemoryRegion, 1);
int ret;
char *filename;
- qemu_irq *cpu_irqs = NULL;
+ DeviceState *grlib_irqmp;
int bios_size;
int prom_size;
ResetData *reset_info;
@@ -139,7 +139,8 @@ static void leon3_generic_hw_init(MachineState *machine)
qemu_register_reset(main_cpu_reset, reset_info);
/* Allocate IRQ manager */
- grlib_irqmp_create(0x80000200, env, &cpu_irqs, MAX_PILS, &leon3_set_pil_in);
+ grlib_irqmp = grlib_irqmp_create(0x80000200, env, MAX_PILS,
+ &leon3_set_pil_in);
env->qemu_irq_ack = leon3_irq_manager;
@@ -208,11 +209,12 @@ static void leon3_generic_hw_init(MachineState *machine)
}
/* Allocate timers */
- grlib_gptimer_create(0x80000300, 2, CPU_CLK, cpu_irqs, 6);
+ grlib_gptimer_create(0x80000300, 2, CPU_CLK, grlib_irqmp, 6);
/* Allocate uart */
if (serial_hds[0]) {
- grlib_apbuart_create(0x80000100, serial_hds[0], cpu_irqs[3]);
+ grlib_apbuart_create(0x80000100, serial_hds[0],
+ qdev_get_gpio_in(grlib_irqmp, 3));
}
}
@@ -43,14 +43,11 @@ void grlib_irqmp_ack(DeviceState *dev, int intno);
static inline
DeviceState *grlib_irqmp_create(hwaddr base,
CPUSPARCState *env,
- qemu_irq **cpu_irqs,
uint32_t nr_irqs,
set_pil_in_fn set_pil_in)
{
DeviceState *dev;
- assert(cpu_irqs != NULL);
-
dev = qdev_create(NULL, "grlib,irqmp");
qdev_prop_set_ptr(dev, "set_pil_in", set_pil_in);
qdev_prop_set_ptr(dev, "set_pil_in_opaque", env);
@@ -61,9 +58,7 @@ DeviceState *grlib_irqmp_create(hwaddr base,
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base);
- *cpu_irqs = qemu_allocate_irqs(grlib_irqmp_set_irq,
- dev,
- nr_irqs);
+ qdev_init_gpio_in(dev, grlib_irqmp_set_irq, nr_irqs);
return dev;
}
@@ -74,7 +69,7 @@ static inline
DeviceState *grlib_gptimer_create(hwaddr base,
uint32_t nr_timers,
uint32_t freq,
- qemu_irq *cpu_irqs,
+ DeviceState *grlib_irqmp,
int base_irq)
{
DeviceState *dev;
@@ -90,7 +85,8 @@ DeviceState *grlib_gptimer_create(hwaddr base,
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base);
for (i = 0; i < nr_timers; i++) {
- sysbus_connect_irq(SYS_BUS_DEVICE(dev), i, cpu_irqs[base_irq + i]);
+ sysbus_connect_irq(SYS_BUS_DEVICE(dev), i,
+ qdev_get_gpio_in(grlib_irqmp, base_irq + i));
}
return dev;