Remove qdev irq sink handling

We have both IRQ sinks and GPIO inputs.  These are in principle exactly
the same thing, so remove the former.

Signed-off-by: Paul Brook <paul@codesourcery.com>
This commit is contained in:
Paul Brook 2009-05-26 14:56:11 +01:00
parent c2fb26379e
commit 067a3ddc88
18 changed files with 27 additions and 43 deletions

View File

@ -721,7 +721,7 @@ static void gic_init(gic_state *s)
{
int i;
qdev_init_irq_sink(&s->busdev.qdev, gic_set_irq, GIC_NIRQ - 32);
qdev_init_gpio_in(&s->busdev.qdev, gic_set_irq, GIC_NIRQ - 32);
for (i = 0; i < NCPU; i++) {
sysbus_init_irq(&s->busdev, &s->parent_irq[i]);
}

View File

@ -186,7 +186,7 @@ qemu_irq *armv7m_init(int flash_size, int sram_size,
cpu_pic = arm_pic_init_cpu(env);
sysbus_connect_irq(sysbus_from_qdev(nvic), 0, cpu_pic[ARM_PIC_CPU_IRQ]);
for (i = 0; i < 64; i++) {
pic[i] = qdev_get_irq_sink(nvic, i);
pic[i] = qdev_get_gpio_in(nvic, i);
}
image_size = load_elf(kernel_filename, 0, &entry, &lowaddr, NULL);

View File

@ -304,10 +304,10 @@ void axisdev88_init (ram_addr_t ram_size,
sysbus_connect_irq(s, 0, cpu_irq[0]);
sysbus_connect_irq(s, 1, cpu_irq[1]);
for (i = 0; i < 30; i++) {
irq[i] = qdev_get_irq_sink(dev, i);
irq[i] = qdev_get_gpio_in(dev, i);
}
nmi[0] = qdev_get_irq_sink(dev, 30);
nmi[1] = qdev_get_irq_sink(dev, 31);
nmi[0] = qdev_get_gpio_in(dev, 30);
nmi[1] = qdev_get_gpio_in(dev, 31);
etraxfs_dmac = etraxfs_dmac_init(env, 0x30000000, 10);
for (i = 0; i < 10; i++) {

View File

@ -684,7 +684,7 @@ static void esp_init1(SysBusDevice *dev)
register_savevm("esp", -1, 3, esp_save, esp_load, s);
qemu_register_reset(esp_reset, 0, s);
qdev_init_irq_sink(&dev->qdev, parent_esp_reset, 1);
qdev_init_gpio_in(&dev->qdev, parent_esp_reset, 1);
scsi_bus_new(&dev->qdev, esp_scsi_attach);
}

View File

@ -90,10 +90,10 @@ void bareetraxfs_init (ram_addr_t ram_size,
/* FIXME: Is there a proper way to signal vectors to the CPU core? */
qdev_set_prop_ptr(dev, "interrupt_vector", &env->interrupt_vector);
for (i = 0; i < 30; i++) {
irq[i] = qdev_get_irq_sink(dev, i);
irq[i] = qdev_get_gpio_in(dev, i);
}
nmi[0] = qdev_get_irq_sink(dev, 30);
nmi[1] = qdev_get_irq_sink(dev, 31);
nmi[0] = qdev_get_gpio_in(dev, 30);
nmi[1] = qdev_get_gpio_in(dev, 31);
etraxfs_dmac = etraxfs_dmac_init(env, 0x30000000, 10);
for (i = 0; i < 10; i++) {

View File

@ -141,7 +141,7 @@ static void etraxfs_pic_init(SysBusDevice *dev)
int intr_vect_regs;
s->interrupt_vector = qdev_get_prop_ptr(&dev->qdev, "interrupt_vector");
qdev_init_irq_sink(&dev->qdev, irq_handler, 32);
qdev_init_gpio_in(&dev->qdev, irq_handler, 32);
sysbus_init_irq(dev, &s->parent_irq);
sysbus_init_irq(dev, &s->parent_nmi);

View File

@ -378,7 +378,7 @@ static void icp_pic_init(SysBusDevice *dev)
icp_pic_state *s = FROM_SYSBUS(icp_pic_state, dev);
int iomemtype;
qdev_init_irq_sink(&dev->qdev, icp_pic_set_irq, 32);
qdev_init_gpio_in(&dev->qdev, icp_pic_set_irq, 32);
sysbus_init_irq(dev, &s->parent_irq);
sysbus_init_irq(dev, &s->parent_fiq);
iomemtype = cpu_register_io_memory(0, icp_pic_readfn,
@ -484,7 +484,7 @@ static void integratorcp_init(ram_addr_t ram_size,
cpu_pic[ARM_PIC_CPU_IRQ],
cpu_pic[ARM_PIC_CPU_FIQ], NULL);
for (i = 0; i < 32; i++) {
pic[i] = qdev_get_irq_sink(dev, i);
pic[i] = qdev_get_gpio_in(dev, i);
}
sysbus_create_simple("integrator_pic", 0xca000000, pic[26]);
sysbus_create_varargs("integrator_pit", 0x13000000,

View File

@ -320,17 +320,17 @@ static void realview_mpcore_init(SysBusDevice *dev)
priv = sysbus_create_simple("arm11mpcore_priv", MPCORE_PRIV_BASE, NULL);
sysbus_pass_irq(dev, sysbus_from_qdev(priv));
for (i = 0; i < 32; i++) {
s->cpuic[i] = qdev_get_irq_sink(priv, i);
s->cpuic[i] = qdev_get_gpio_in(priv, i);
}
/* ??? IRQ routing is hardcoded to "normal" mode. */
for (n = 0; n < 4; n++) {
gic = sysbus_create_simple("realview_gic", 0x10040000 + n * 0x10000,
s->cpuic[10 + n]);
for (i = 0; i < 64; i++) {
s->rvic[n][i] = qdev_get_irq_sink(gic, i);
s->rvic[n][i] = qdev_get_gpio_in(gic, i);
}
}
qdev_init_irq_sink(&dev->qdev, mpcore_rirq_set_irq, 64);
qdev_init_gpio_in(&dev->qdev, mpcore_rirq_set_irq, 64);
}
static void mpcore_register_devices(void)

View File

@ -1040,7 +1040,7 @@ static void mv88w8618_pic_init(SysBusDevice *dev)
mv88w8618_pic_state *s = FROM_SYSBUS(mv88w8618_pic_state, dev);
int iomemtype;
qdev_init_irq_sink(&dev->qdev, mv88w8618_pic_set_irq, 32);
qdev_init_gpio_in(&dev->qdev, mv88w8618_pic_set_irq, 32);
sysbus_init_irq(dev, &s->parent_irq);
iomemtype = cpu_register_io_memory(0, mv88w8618_pic_readfn,
mv88w8618_pic_writefn, s);
@ -1534,7 +1534,7 @@ static void musicpal_init(ram_addr_t ram_size,
dev = sysbus_create_simple("mv88w8618_pic", MP_PIC_BASE,
cpu_pic[ARM_PIC_CPU_IRQ]);
for (i = 0; i < 32; i++) {
pic[i] = qdev_get_irq_sink(dev, i);
pic[i] = qdev_get_gpio_in(dev, i);
}
sysbus_create_varargs("mv88w8618_pit", MP_PIT_BASE, pic[MP_TIMER1_IRQ],
pic[MP_TIMER2_IRQ], pic[MP_TIMER3_IRQ],

View File

@ -2127,7 +2127,7 @@ static void lance_init(SysBusDevice *dev)
s->dma_opaque = qdev_get_prop_ptr(&dev->qdev, "dma");
qdev_init_irq_sink(&dev->qdev, parent_lance_reset, 1);
qdev_init_gpio_in(&dev->qdev, parent_lance_reset, 1);
sysbus_init_mmio(dev, 4, s->mmio_index);

View File

@ -235,7 +235,7 @@ static void pl190_init(SysBusDevice *dev)
iomemtype = cpu_register_io_memory(0, pl190_readfn,
pl190_writefn, s);
sysbus_init_mmio(dev, 0x1000, iomemtype);
qdev_init_irq_sink(&dev->qdev, pl190_set_irq, 32);
qdev_init_gpio_in(&dev->qdev, pl190_set_irq, 32);
sysbus_init_irq(dev, &s->irq);
sysbus_init_irq(dev, &s->fiq);
pl190_reset(s);

View File

@ -156,19 +156,6 @@ void qdev_set_netdev(DeviceState *dev, NICInfo *nd)
}
qemu_irq qdev_get_irq_sink(DeviceState *dev, int n)
{
assert(n >= 0 && n < dev->num_irq_sink);
return dev->irq_sink[n];
}
/* Register device IRQ sinks. */
void qdev_init_irq_sink(DeviceState *dev, qemu_irq_handler handler, int nirq)
{
dev->num_irq_sink = nirq;
dev->irq_sink = qemu_allocate_irqs(handler, dev, nirq);
}
/* Get a character (serial) device interface. */
CharDriverState *qdev_init_chardev(DeviceState *dev)
{

View File

@ -17,8 +17,6 @@ struct DeviceState {
DeviceType *type;
BusState *parent_bus;
DeviceProperty *props;
int num_irq_sink;
qemu_irq *irq_sink;
int num_gpio_out;
qemu_irq *gpio_out;
int num_gpio_in;
@ -55,7 +53,6 @@ void qdev_set_prop_int(DeviceState *dev, const char *name, uint64_t value);
void qdev_set_prop_ptr(DeviceState *dev, const char *name, void *value);
void qdev_set_netdev(DeviceState *dev, NICInfo *nd);
qemu_irq qdev_get_irq_sink(DeviceState *dev, int n);
qemu_irq qdev_get_gpio_in(DeviceState *dev, int n);
void qdev_connect_gpio_out(DeviceState *dev, int n, qemu_irq pin);
@ -77,7 +74,7 @@ struct DeviceInfo {
void qdev_register(const char *name, int size, DeviceInfo *info);
/* Register device properties. */
void qdev_init_irq_sink(DeviceState *dev, qemu_irq_handler handler, int nirq);
/* GPIO inputs also double as IRQ sinks. */
void qdev_init_gpio_in(DeviceState *dev, qemu_irq_handler handler, int n);
void qdev_init_gpio_out(DeviceState *dev, qemu_irq *pins, int n);

View File

@ -84,7 +84,7 @@ static void realview_init(ram_addr_t ram_size,
cpu_irq[3], NULL);
}
for (n = 0; n < 64; n++) {
pic[n] = qdev_get_irq_sink(dev, n);
pic[n] = qdev_get_gpio_in(dev, n);
}
sysbus_create_simple("pl050_keyboard", 0x10006000, pic[20]);

View File

@ -379,7 +379,7 @@ static void lance_init(NICInfo *nd, target_phys_addr_t leaddr,
s = sysbus_from_qdev(dev);
sysbus_mmio_map(s, 0, leaddr);
sysbus_connect_irq(s, 0, irq);
*reset = qdev_get_irq_sink(dev, 0);
*reset = qdev_get_gpio_in(dev, 0);
}
static void sun4m_hw_init(const struct sun4m_hwdef *hwdef, ram_addr_t RAM_size,

View File

@ -58,7 +58,7 @@ static void syborg_init(ram_addr_t ram_size,
dev = sysbus_create_simple("syborg,interrupt", 0xC0000000,
cpu_pic[ARM_PIC_CPU_IRQ]);
for (i = 0; i < 64; i++) {
pic[i] = qdev_get_irq_sink(dev, i);
pic[i] = qdev_get_gpio_in(dev, i);
}
sysbus_create_simple("syborg,rtc", 0xC0001000, NULL);

View File

@ -209,7 +209,7 @@ static void syborg_int_init(SysBusDevice *dev)
sysbus_init_irq(dev, &s->parent_irq);
s->num_irqs = qdev_get_prop_int(&dev->qdev, "num-interrupts", 64);
qdev_init_irq_sink(&dev->qdev, syborg_int_set_irq, s->num_irqs);
qdev_init_gpio_in(&dev->qdev, syborg_int_set_irq, s->num_irqs);
iomemtype = cpu_register_io_memory(0, syborg_int_readfn,
syborg_int_writefn, s);
sysbus_init_mmio(dev, 0x1000, iomemtype);

View File

@ -135,7 +135,7 @@ static void vpb_sic_init(SysBusDevice *dev)
int iomemtype;
int i;
qdev_init_irq_sink(&dev->qdev, vpb_sic_set_irq, 32);
qdev_init_gpio_in(&dev->qdev, vpb_sic_set_irq, 32);
for (i = 0; i < 32; i++) {
sysbus_init_irq(dev, &s->parent[i]);
}
@ -188,12 +188,12 @@ static void versatile_init(ram_addr_t ram_size,
dev = sysbus_create_varargs("pl190", 0x10140000,
cpu_pic[0], cpu_pic[1], NULL);
for (n = 0; n < 32; n++) {
pic[n] = qdev_get_irq_sink(dev, n);
pic[n] = qdev_get_gpio_in(dev, n);
}
dev = sysbus_create_simple("versatilepb_sic", 0x10003000, NULL);
for (n = 0; n < 32; n++) {
sysbus_connect_irq(sysbus_from_qdev(dev), n, pic[n]);
sic[n] = qdev_get_irq_sink(dev, n);
sic[n] = qdev_get_gpio_in(dev, n);
}
sysbus_create_simple("pl050_keyboard", 0x10006000, sic[3]);