[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 8/9] isa: refine irq reservations
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PATCH 8/9] isa: refine irq reservations |
Date: |
Mon, 14 Sep 2009 17:49:23 +0200 |
There are a few cases where IRQ sharing on the ISA bus is used and
possible. In general only devices of the same kind can do that.
A few use cases:
* serial lines 1+3 share irq 4
* serial lines 2+4 share irq 3
* parallel ports share irq 7
* ppc/prep: ide ports share irq 13
This patch refines the irq reservation mechanism for the isa bus to
handle those cases. It keeps track of the driver which owns the IRQ in
question and allows irq sharing for devices handled by the same driver.
Signed-off-by: Gerd Hoffmann <address@hidden>
---
hw/isa-bus.c | 16 +++++++++++++---
1 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/hw/isa-bus.c b/hw/isa-bus.c
index 4ecc0f8..1d2ca90 100644
--- a/hw/isa-bus.c
+++ b/hw/isa-bus.c
@@ -26,6 +26,7 @@ struct ISABus {
BusState qbus;
qemu_irq *irqs;
uint32_t assigned;
+ DeviceInfo *irq_owner[16];
};
static ISABus *isabus;
@@ -71,7 +72,9 @@ qemu_irq isa_reserve_irq(int isairq)
exit(1);
}
if (isabus->assigned & (1 << isairq)) {
- fprintf(stderr, "isa irq %d already assigned\n", isairq);
+ DeviceInfo *owner = isabus->irq_owner[isairq];
+ fprintf(stderr, "isa irq %d already assigned (%s)\n",
+ isairq, owner ? owner->name : "unknown");
exit(1);
}
isabus->assigned |= (1 << isairq);
@@ -82,10 +85,17 @@ void isa_init_irq(ISADevice *dev, qemu_irq *p, int isairq)
{
assert(dev->nirqs < ARRAY_SIZE(dev->isairq));
if (isabus->assigned & (1 << isairq)) {
- fprintf(stderr, "isa irq %d already assigned\n", isairq);
- exit(1);
+ DeviceInfo *owner = isabus->irq_owner[isairq];
+ if (owner == dev->qdev.info) {
+ /* irq sharing is ok in case the same driver handles both */;
+ } else {
+ fprintf(stderr, "isa irq %d already assigned (%s)\n",
+ isairq, owner ? owner->name : "unknown");
+ exit(1);
+ }
}
isabus->assigned |= (1 << isairq);
+ isabus->irq_owner[isairq] = dev->qdev.info;
dev->isairq[dev->nirqs] = isairq;
*p = isabus->irqs[isairq];
dev->nirqs++;
--
1.6.2.5
- [Qemu-devel] [PATCH 0/9] ide: convert to qdev., Gerd Hoffmann, 2009/09/14
- [Qemu-devel] [PATCH 2/9] support media=cdrom for if=none, Gerd Hoffmann, 2009/09/14
- [Qemu-devel] [PATCH 1/9] qdev/pci: add pci_create_noinit(), Gerd Hoffmann, 2009/09/14
- [Qemu-devel] [PATCH 4/9] ide/qdev: add ide bus., Gerd Hoffmann, 2009/09/14
- [Qemu-devel] [PATCH 3/9] split away drive init from ide_init2(), Gerd Hoffmann, 2009/09/14
- [Qemu-devel] [PATCH 5/9] ide/pci: fix indention, Gerd Hoffmann, 2009/09/14
- [Qemu-devel] [PATCH 8/9] isa: refine irq reservations,
Gerd Hoffmann <=
- [Qemu-devel] [PATCH 9/9] unbreak ppc/prep, Gerd Hoffmann, 2009/09/14
- [Qemu-devel] [PATCH 7/9] ide/isa: convert to qdev., Gerd Hoffmann, 2009/09/14