aboutsummaryrefslogtreecommitdiff
path: root/hw/versatilepb.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
commit3950f18b9fd4f069f5b77587bda8cacb6dc95583 (patch)
tree55a95a30fc5c19457b3972d5158c119342ae973d /hw/versatilepb.c
parent97aff481656b984559a3b6602e6be69ebbe746a4 (diff)
Versatile/PB core qdev conversion
Signed-off-by: Paul Brook <paul@codesourcery.com>
Diffstat (limited to 'hw/versatilepb.c')
-rw-r--r--hw/versatilepb.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/hw/versatilepb.c b/hw/versatilepb.c
index f1c529cd0c..415111974e 100644
--- a/hw/versatilepb.c
+++ b/hw/versatilepb.c
@@ -20,6 +20,7 @@
typedef struct vpb_sic_state
{
+ SysBusDevice busdev;
uint32_t level;
uint32_t mask;
uint32_t pic_enable;
@@ -128,24 +129,21 @@ static CPUWriteMemoryFunc *vpb_sic_writefn[] = {
vpb_sic_write
};
-static qemu_irq *vpb_sic_init(uint32_t base, qemu_irq *parent, int irq)
+static void vpb_sic_init(SysBusDevice *dev)
{
- vpb_sic_state *s;
- qemu_irq *qi;
+ vpb_sic_state *s = FROM_SYSBUS(vpb_sic_state, dev);
int iomemtype;
int i;
- s = (vpb_sic_state *)qemu_mallocz(sizeof(vpb_sic_state));
- qi = qemu_allocate_irqs(vpb_sic_set_irq, s, 32);
+ qdev_init_irq_sink(&dev->qdev, vpb_sic_set_irq, 32);
for (i = 0; i < 32; i++) {
- s->parent[i] = parent[i];
+ sysbus_init_irq(dev, &s->parent[i]);
}
- s->irq = irq;
+ s->irq = 31;
iomemtype = cpu_register_io_memory(0, vpb_sic_readfn,
vpb_sic_writefn, s);
- cpu_register_physical_memory(base, 0x00001000, iomemtype);
+ sysbus_init_mmio(dev, 0x1000, iomemtype);
/* ??? Save/restore. */
- return qi;
}
/* Board init. */
@@ -166,7 +164,7 @@ static void versatile_init(ram_addr_t ram_size,
ram_addr_t ram_offset;
qemu_irq *cpu_pic;
qemu_irq pic[32];
- qemu_irq *sic;
+ qemu_irq sic[32];
DeviceState *dev;
PCIBus *pci_bus;
NICInfo *nd;
@@ -192,7 +190,11 @@ static void versatile_init(ram_addr_t ram_size,
for (n = 0; n < 32; n++) {
pic[n] = qdev_get_irq_sink(dev, n);
}
- sic = vpb_sic_init(0x10003000, pic, 31);
+ dev = sysbus_create_simple("versatilepb_sic", 0x10003000, NULL);
+ for (n = 0; n < 32; n++) {
+ sysbus_connect_irq(sysbus_from_qdev(dev), n, pic[n]);
+ sic[n] = qdev_get_irq_sink(dev, n);
+ }
sysbus_create_simple("pl050_keyboard", 0x10006000, sic[3]);
sysbus_create_simple("pl050_mouse", 0x10007000, sic[4]);
@@ -317,3 +319,11 @@ QEMUMachine versatileab_machine = {
.init = vab_init,
.use_scsi = 1,
};
+
+static void versatilepb_register_devices(void)
+{
+ sysbus_register_dev("versatilepb_sic", sizeof(vpb_sic_state),
+ vpb_sic_init);
+}
+
+device_init(versatilepb_register_devices)