summaryrefslogtreecommitdiff
path: root/hw/pl190.c
diff options
context:
space:
mode:
authorPaul Brook <paul@codesourcery.com>2009-05-14 22:35:07 +0100
committerPaul Brook <paul@codesourcery.com>2009-05-14 22:35:07 +0100
commit97aff481656b984559a3b6602e6be69ebbe746a4 (patch)
treec3698b09ae5965e8a5d4e0ed10cbf2b9621caa8a /hw/pl190.c
parentcfb9de9ce48d108cfc56052dc9bc402a6197c199 (diff)
downloadqemu-97aff481656b984559a3b6602e6be69ebbe746a4.tar.gz
PL190 qdev conversion
Signed-off-by: Paul Brook <paul@codesourcery.com>
Diffstat (limited to 'hw/pl190.c')
-rw-r--r--hw/pl190.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/hw/pl190.c b/hw/pl190.c
index 0ab42efd42..b8c2018d3a 100644
--- a/hw/pl190.c
+++ b/hw/pl190.c
@@ -7,8 +7,7 @@
* This code is licenced under the GPL.
*/
-#include "hw.h"
-#include "primecell.h"
+#include "sysbus.h"
/* The number of virtual priority levels. 16 user vectors plus the
unvectored IRQ. Chained interrupts would require an additional level
@@ -17,6 +16,7 @@
#define PL190_NUM_PRIO 17
typedef struct {
+ SysBusDevice busdev;
uint32_t level;
uint32_t soft_level;
uint32_t irq_enable;
@@ -227,20 +227,24 @@ static void pl190_reset(pl190_state *s)
pl190_update_vectors(s);
}
-qemu_irq *pl190_init(uint32_t base, qemu_irq irq, qemu_irq fiq)
+static void pl190_init(SysBusDevice *dev)
{
- pl190_state *s;
- qemu_irq *qi;
+ pl190_state *s = FROM_SYSBUS(pl190_state, dev);
int iomemtype;
- s = (pl190_state *)qemu_mallocz(sizeof(pl190_state));
iomemtype = cpu_register_io_memory(0, pl190_readfn,
pl190_writefn, s);
- cpu_register_physical_memory(base, 0x00001000, iomemtype);
- qi = qemu_allocate_irqs(pl190_set_irq, s, 32);
- s->irq = irq;
- s->fiq = fiq;
+ sysbus_init_mmio(dev, 0x1000, iomemtype);
+ qdev_init_irq_sink(&dev->qdev, pl190_set_irq, 32);
+ sysbus_init_irq(dev, &s->irq);
+ sysbus_init_irq(dev, &s->fiq);
pl190_reset(s);
/* ??? Save/restore. */
- return qi;
}
+
+static void pl190_register_devices(void)
+{
+ sysbus_register_dev("pl190", sizeof(pl190_state), pl190_init);
+}
+
+device_init(pl190_register_devices)