From: minyard@acm.org
To: qemu-devel@nongnu.org
Cc: Corey Minyard <cminyard@mvista.com>
Subject: [Qemu-devel] [PATCH 3/9] isa: Add a way to query for a free interrupt
Date: Mon, 09 Jul 2012 14:17:03 -0500 [thread overview]
Message-ID: <1341861429-6297-4-git-send-email-minyard@acm.org> (raw)
In-Reply-To: <1341861429-6297-1-git-send-email-minyard@acm.org>
From: Corey Minyard <cminyard@mvista.com>
This lets devices that don't care about their interrupt number, like
IPMI, just grab any unused interrupt.
Signed-off-by: Corey Minyard <cminyard@mvista.com>
---
hw/isa-bus.c | 13 +++++++++++++
hw/isa.h | 2 ++
2 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/hw/isa-bus.c b/hw/isa-bus.c
index 5a43f03..f561f21 100644
--- a/hw/isa-bus.c
+++ b/hw/isa-bus.c
@@ -71,6 +71,7 @@ qemu_irq isa_get_irq(ISADevice *dev, int isairq)
if (isairq < 0 || isairq > 15) {
hw_error("isa irq %d invalid", isairq);
}
+ isabus->irq_inuse[isairq] = 1;
return isabus->irqs[isairq];
}
@@ -82,6 +83,18 @@ void isa_init_irq(ISADevice *dev, qemu_irq *p, int isairq)
dev->nirqs++;
}
+int isa_find_free_irq(ISABus *bus)
+{
+ unsigned int i;
+
+ /* 0 and 1 are called for, 2 is the chain interrupt */
+ for (i = 3; i < ISA_NUM_IRQS; i++) {
+ if (!bus->irq_inuse[i])
+ return i;
+ }
+ return 0;
+}
+
static inline void isa_init_ioport(ISADevice *dev, uint16_t ioport)
{
if (dev && (dev->ioport_id == 0 || ioport < dev->ioport_id)) {
diff --git a/hw/isa.h b/hw/isa.h
index f7bc4b5..9447296 100644
--- a/hw/isa.h
+++ b/hw/isa.h
@@ -28,6 +28,7 @@ struct ISABus {
BusState qbus;
MemoryRegion *address_space_io;
qemu_irq *irqs;
+ int irq_inuse[ISA_NUM_IRQS];
};
struct ISADevice {
@@ -41,6 +42,7 @@ ISABus *isa_bus_new(DeviceState *dev, MemoryRegion *address_space_io);
void isa_bus_irqs(ISABus *bus, qemu_irq *irqs);
qemu_irq isa_get_irq(ISADevice *dev, int isairq);
void isa_init_irq(ISADevice *dev, qemu_irq *p, int isairq);
+int isa_find_free_irq(ISABus *bus);
MemoryRegion *isa_address_space(ISADevice *dev);
ISADevice *isa_create(ISABus *bus, const char *name);
ISADevice *isa_try_create(ISABus *bus, const char *name);
--
1.7.4.1
next prev parent reply other threads:[~2012-07-09 19:17 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-09 19:17 [Qemu-devel] First shot at adding IPMI to qemu minyard
2012-07-09 19:17 ` [Qemu-devel] [PATCH 1/9] smbios: Add a function to directly add an entry minyard
2012-07-09 19:17 ` [Qemu-devel] [PATCH 2/9] pc: move SMBIOS setup to after device init minyard
2012-07-09 19:17 ` minyard [this message]
2012-07-10 9:16 ` [Qemu-devel] [PATCH 3/9] isa: Add a way to query for a free interrupt Paolo Bonzini
2012-07-09 19:17 ` [Qemu-devel] [PATCH 4/9] Add a base IPMI interface minyard
2012-07-10 9:17 ` Daniel P. Berrange
2012-07-10 11:12 ` Markus Armbruster
2012-07-10 16:19 ` Corey Minyard
2012-07-10 9:29 ` Paolo Bonzini
2012-07-09 19:17 ` [Qemu-devel] [PATCH 5/9] IPMI: Add a PC ISA type structure minyard
2012-07-10 9:17 ` Paolo Bonzini
2012-07-10 9:33 ` Paolo Bonzini
2012-07-10 20:00 ` Corey Minyard
2012-07-09 19:17 ` [Qemu-devel] [PATCH 6/9] IPMI: Add a KCS low-level interface minyard
2012-07-09 19:17 ` [Qemu-devel] [PATCH 7/9] IPMI: Add a BT " minyard
2012-07-09 19:17 ` [Qemu-devel] [PATCH 8/9] IPMI: Add a local BMC simulation minyard
2012-07-09 19:17 ` [Qemu-devel] [PATCH 9/9] IPMI: Add an external connection simulation interface minyard
2012-07-10 9:35 ` [Qemu-devel] First shot at adding IPMI to qemu Paolo Bonzini
2012-07-10 15:43 ` Corey Minyard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1341861429-6297-4-git-send-email-minyard@acm.org \
--to=minyard@acm.org \
--cc=cminyard@mvista.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).