aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@siemens.com>2011-02-19 18:56:22 +0100
committerAurelien Jarno <aurelien@aurel32.net>2011-02-21 15:46:53 +0100
commitee951a37d8873bff7aa58e23222dfd984111b6cb (patch)
treec8304bedb44ce8b6f69877547c34d521923b74eb
parent7096a96db2d0227598e3c9fb154e53f912a34da8 (diff)
isa-bus: Remove bogus IRQ sharing check
Nothing prevented IRQ sharing on the ISA bus in principle. Not all boards supported this, neither each and every card nor driver and OS. Still, there existed valid IRQ sharing scenarios, (at least) two of them can also be found in QEMU: >2 PC UARTs and the PREP IDE buses. So remove this artificial restriction from our ISA model. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
-rw-r--r--hw/hpet.c1
-rw-r--r--hw/i8254.c2
-rw-r--r--hw/ide/piix.c2
-rw-r--r--hw/ide/via.c2
-rw-r--r--hw/isa-bus.c16
-rw-r--r--hw/isa.h2
-rw-r--r--hw/mips_malta.c2
-rw-r--r--hw/pc_piix.c4
8 files changed, 10 insertions, 21 deletions
diff --git a/hw/hpet.c b/hw/hpet.c
index 82a9a21978..91ebb75551 100644
--- a/hw/hpet.c
+++ b/hw/hpet.c
@@ -713,7 +713,6 @@ static int hpet_init(SysBusDevice *dev)
s->capability |= (s->num_timers - 1) << HPET_ID_NUM_TIM_SHIFT;
s->capability |= ((HPET_CLK_PERIOD) << 32);
- isa_reserve_irq(RTC_ISA_IRQ);
qdev_init_gpio_in(&dev->qdev, hpet_handle_rtc_irq, 1);
/* HPET Area */
diff --git a/hw/i8254.c b/hw/i8254.c
index 680caabf3c..eaf5d3e174 100644
--- a/hw/i8254.c
+++ b/hw/i8254.c
@@ -514,7 +514,7 @@ static int pit_initfn(ISADevice *dev)
s = &pit->channels[0];
/* the timer 0 is connected to an IRQ */
s->irq_timer = qemu_new_timer(vm_clock, pit_irq_timer, s);
- s->irq = isa_reserve_irq(pit->irq);
+ s->irq = isa_get_irq(pit->irq);
register_ioport_write(pit->iobase, 4, 1, pit_ioport_write, pit);
register_ioport_read(pit->iobase, 3, 1, pit_ioport_read, pit);
diff --git a/hw/ide/piix.c b/hw/ide/piix.c
index d4289af9c4..c3496448c3 100644
--- a/hw/ide/piix.c
+++ b/hw/ide/piix.c
@@ -122,7 +122,7 @@ static void pci_piix_init_ports(PCIIDEState *d) {
for (i = 0; i < 2; i++) {
ide_bus_new(&d->bus[i], &d->dev.qdev, i);
ide_init_ioport(&d->bus[i], port_info[i].iobase, port_info[i].iobase2);
- ide_init2(&d->bus[i], isa_reserve_irq(port_info[i].isairq));
+ ide_init2(&d->bus[i], isa_get_irq(port_info[i].isairq));
bmdma_init(&d->bus[i], &d->bmdma[i]);
d->bmdma[i].bus = &d->bus[i];
diff --git a/hw/ide/via.c b/hw/ide/via.c
index 0e906797cd..04f3290960 100644
--- a/hw/ide/via.c
+++ b/hw/ide/via.c
@@ -145,7 +145,7 @@ static void vt82c686b_init_ports(PCIIDEState *d) {
for (i = 0; i < 2; i++) {
ide_bus_new(&d->bus[i], &d->dev.qdev, i);
ide_init_ioport(&d->bus[i], port_info[i].iobase, port_info[i].iobase2);
- ide_init2(&d->bus[i], isa_reserve_irq(port_info[i].isairq));
+ ide_init2(&d->bus[i], isa_get_irq(port_info[i].isairq));
bmdma_init(&d->bus[i], &d->bmdma[i]);
d->bmdma[i].bus = &d->bus[i];
diff --git a/hw/isa-bus.c b/hw/isa-bus.c
index 6f349a574a..d07aa410f7 100644
--- a/hw/isa-bus.c
+++ b/hw/isa-bus.c
@@ -25,7 +25,6 @@
struct ISABus {
BusState qbus;
qemu_irq *irqs;
- uint32_t assigned;
};
static ISABus *isabus;
target_phys_addr_t isa_mem_base = 0;
@@ -61,33 +60,24 @@ void isa_bus_irqs(qemu_irq *irqs)
}
/*
- * isa_reserve_irq() reserves the ISA irq and returns the corresponding
- * qemu_irq entry for the i8259.
+ * isa_get_irq() 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)
+qemu_irq isa_get_irq(int isairq)
{
if (isairq < 0 || isairq > 15) {
hw_error("isa irq %d invalid", isairq);
}
- if (isabus->assigned & (1 << isairq)) {
- hw_error("isa irq %d already assigned", isairq);
- }
- isabus->assigned |= (1 << isairq);
return isabus->irqs[isairq];
}
void isa_init_irq(ISADevice *dev, qemu_irq *p, int isairq)
{
assert(dev->nirqs < ARRAY_SIZE(dev->isairq));
- if (isabus->assigned & (1 << isairq)) {
- hw_error("isa irq %d already assigned", isairq);
- }
- isabus->assigned |= (1 << isairq);
dev->isairq[dev->nirqs] = isairq;
- *p = isabus->irqs[isairq];
+ *p = isa_get_irq(isairq);
dev->nirqs++;
}
diff --git a/hw/isa.h b/hw/isa.h
index e26abfa063..d2b6126602 100644
--- a/hw/isa.h
+++ b/hw/isa.h
@@ -26,7 +26,7 @@ struct ISADeviceInfo {
ISABus *isa_bus_new(DeviceState *dev);
void isa_bus_irqs(qemu_irq *irqs);
-qemu_irq isa_reserve_irq(int isairq);
+qemu_irq isa_get_irq(int isairq);
void isa_init_irq(ISADevice *dev, qemu_irq *p, int isairq);
void isa_init_ioport(ISADevice *dev, uint16_t ioport);
void isa_init_ioport_range(ISADevice *dev, uint16_t start, uint16_t length);
diff --git a/hw/mips_malta.c b/hw/mips_malta.c
index ca6c6d7063..d8baa6d7e3 100644
--- a/hw/mips_malta.c
+++ b/hw/mips_malta.c
@@ -919,7 +919,7 @@ void mips_malta_init (ram_addr_t ram_size,
isa_bus_irqs(i8259);
pci_piix4_ide_init(pci_bus, hd, piix4_devfn + 1);
usb_uhci_piix4_init(pci_bus, piix4_devfn + 2);
- smbus = piix4_pm_init(pci_bus, piix4_devfn + 3, 0x1100, isa_reserve_irq(9),
+ smbus = piix4_pm_init(pci_bus, piix4_devfn + 3, 0x1100, isa_get_irq(9),
NULL, NULL, 0);
eeprom_buf = qemu_mallocz(8 * 256); /* XXX: make this persistent */
for (i = 0; i < 8; i++) {
diff --git a/hw/pc_piix.c b/hw/pc_piix.c
index b4ca9ec908..b3ede8941f 100644
--- a/hw/pc_piix.c
+++ b/hw/pc_piix.c
@@ -113,7 +113,7 @@ static void pc_init1(ram_addr_t ram_size,
}
isa_bus_irqs(isa_irq);
- pc_register_ferr_irq(isa_reserve_irq(13));
+ pc_register_ferr_irq(isa_get_irq(13));
pc_vga_init(pci_enabled? pci_bus: NULL);
@@ -169,7 +169,7 @@ static void pc_init1(ram_addr_t ram_size,
smi_irq = qemu_allocate_irqs(pc_acpi_smi_interrupt, first_cpu, 1);
/* TODO: Populate SPD eeprom data. */
smbus = piix4_pm_init(pci_bus, piix3_devfn + 3, 0xb100,
- isa_reserve_irq(9), *cmos_s3, *smi_irq,
+ isa_get_irq(9), *cmos_s3, *smi_irq,
kvm_enabled());
for (i = 0; i < 8; i++) {
DeviceState *eeprom;