[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2/3] qdev: irq allocation in generic code.
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PATCH 2/3] qdev: irq allocation in generic code. |
Date: |
Tue, 9 Jun 2009 13:01:00 +0200 |
Almost all devices have a static number of irqs, so we can easily move
the setup into generic code by adding some fields to DeviceInfo.
Signed-off-by: Gerd Hoffmann <address@hidden>
---
hw/qdev.c | 9 +++++++++
hw/qdev.h | 4 ++++
2 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/hw/qdev.c b/hw/qdev.c
index 9fd22cf..c70ae8f 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -99,6 +99,15 @@ DeviceState *qdev_create(BusState *bus, const char *name)
}
dev->parent_bus = bus;
LIST_INSERT_HEAD(&bus->children, dev, sibling);
+
+ if (t->info->num_gpio_in) {
+ qdev_init_gpio_in(dev, t->info->irq, t->info->num_gpio_in);
+ }
+ if (t->info->num_gpio_out) {
+ qemu_irq *irqs = qemu_mallocz(sizeof(irqs[0]) * t->info->num_gpio_out);
+ qdev_init_gpio_out(dev, irqs, t->info->num_gpio_out);
+ }
+
return dev;
}
diff --git a/hw/qdev.h b/hw/qdev.h
index 7b523b6..bed3d6a 100644
--- a/hw/qdev.h
+++ b/hw/qdev.h
@@ -82,6 +82,10 @@ struct DeviceInfo {
const char *name;
size_t size;
+ int num_gpio_in;
+ int num_gpio_out;
+ qemu_irq_handler irq;
+
/* private to qdev / bus */
qdev_initfn init;
BusType bus_type;
--
1.6.2.2
- [Qemu-devel] [PATCH 1/3] qdev-ify isa pic, Gerd Hoffmann, 2009/06/09
- [Qemu-devel] [PATCH 3/3] qdev: switch isa pic to generic irq allocation., Gerd Hoffmann, 2009/06/09
- [Qemu-devel] [PATCH 2/3] qdev: irq allocation in generic code.,
Gerd Hoffmann <=
- Re: [Qemu-devel] [PATCH 1/3] qdev-ify isa pic, Paul Brook, 2009/06/09
- Re: [Qemu-devel] [PATCH 1/3] qdev-ify isa pic, Gerd Hoffmann, 2009/06/09
- Re: [Qemu-devel] [PATCH 1/3] qdev-ify isa pic, Paul Brook, 2009/06/09
- Re: [Qemu-devel] [PATCH 1/3] qdev-ify isa pic, Gerd Hoffmann, 2009/06/09
- Re: [Qemu-devel] [PATCH 1/3] qdev-ify isa pic, Paul Brook, 2009/06/09
- Re: [Qemu-devel] [PATCH 1/3] qdev-ify isa pic, Gerd Hoffmann, 2009/06/10
- Re: [Qemu-devel] [PATCH 1/3] qdev-ify isa pic, Filip Navara, 2009/06/10
- Re: [Qemu-devel] [PATCH 1/3] qdev-ify isa pic, Gerd Hoffmann, 2009/06/10
- Re: [Qemu-devel] [PATCH 1/3] qdev-ify isa pic, Paul Brook, 2009/06/10