diff options
author | Jes Sorensen <jes@sgi.com> | 2009-08-14 11:36:15 +0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2009-08-27 20:30:20 -0500 |
commit | 3a38d437ca60ce19ee92dbabbe6e672e9ba3c529 (patch) | |
tree | 809ea17e551a8e297c5377180cad61e063bb906d /hw/isa-bus.c | |
parent | 2091ba23e838c3a8773c246238d7381333789852 (diff) |
Add isa_reserve_irq().
Introduce isa_reserve_irq() which marks an irq reserved and returns
the appropriate qemu_irq entry from the i8259 table.
isa_reserve_irq() is a temporary interface to be used to allocate ISA
IRQs for devices which have not yet been converted to qdev, and for
special cases which are not suited for qdev conversions, such as the
'ferr'.
This patch goes on top of Gerd Hoffmann's which makes isa-bus.c own
the ISA irq table.
[ added isa-bus.o to some targets to fix build failures -- kraxel ]
Signed-off-by: Jes Sorensen <jes@sgi.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/isa-bus.c')
-rw-r--r-- | hw/isa-bus.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/hw/isa-bus.c b/hw/isa-bus.c index 90a171d99..9561c3112 100644 --- a/hw/isa-bus.c +++ b/hw/isa-bus.c @@ -76,6 +76,27 @@ void isa_connect_irq(ISADevice *dev, int devnr, int isairq) } } +/* + * isa_reserve_irq() reserves the ISA irq and returns the corresponding + * qemu_irq entry for the i8259. + * + * This function is only for special cases such as the 'ferr', and + * temporary use for normal devices until they are converted to qdev. + */ +qemu_irq isa_reserve_irq(int isairq) +{ + if (isairq < 0 || isairq > 15) { + fprintf(stderr, "isa irq %d invalid\n", isairq); + exit(1); + } + if (isabus->assigned & (1 << isairq)) { + fprintf(stderr, "isa irq %d already assigned\n", isairq); + exit(1); + } + isabus->assigned |= (1 << isairq); + return isabus->irqs[isairq]; +} + void isa_init_irq(ISADevice *dev, qemu_irq *p) { assert(dev->nirqs < ARRAY_SIZE(dev->irqs)); |