aboutsummaryrefslogtreecommitdiff
path: root/hw
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
commit2e9bdce56f307db907f4d6533d3a3917259f859f (patch)
tree46ec3a61450149bd244e72730a8e4658e7434eb0 /hw
parent6f68ecb2c11d90212d6f7d06c857843d30abcfdc (diff)
PL110 qdev conversion
Signed-off-by: Paul Brook <paul@codesourcery.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/integratorcp.c5
-rw-r--r--hw/pl110.c33
-rw-r--r--hw/primecell.h3
-rw-r--r--hw/realview.c4
-rw-r--r--hw/versatilepb.c4
5 files changed, 30 insertions, 19 deletions
diff --git a/hw/integratorcp.c b/hw/integratorcp.c
index 8dfc63ed52..7f27d075c2 100644
--- a/hw/integratorcp.c
+++ b/hw/integratorcp.c
@@ -7,7 +7,7 @@
* This code is licenced under the GPL
*/
-#include "hw.h"
+#include "sysbus.h"
#include "primecell.h"
#include "devices.h"
#include "sysemu.h"
@@ -495,7 +495,8 @@ static void integratorcp_init(ram_addr_t ram_size,
pl181_init(0x1c000000, drives_table[sd].bdrv, pic[23], pic[24]);
if (nd_table[0].vlan)
smc91c111_init(&nd_table[0], 0xc8000000, pic[27]);
- pl110_init(0xc0000000, pic[22], 0);
+
+ sysbus_create_simple("pl110", 0xc0000000, pic[22]);
integrator_binfo.ram_size = ram_size;
integrator_binfo.kernel_filename = kernel_filename;
diff --git a/hw/pl110.c b/hw/pl110.c
index f37b20a106..b45204c63f 100644
--- a/hw/pl110.c
+++ b/hw/pl110.c
@@ -1,14 +1,13 @@
/*
* Arm PrimeCell PL110 Color LCD Controller
*
- * Copyright (c) 2005-2006 CodeSourcery.
+ * Copyright (c) 2005-2009 CodeSourcery.
* Written by Paul Brook
*
* This code is licenced under the GNU LGPL
*/
-#include "hw.h"
-#include "primecell.h"
+#include "sysbus.h"
#include "console.h"
#include "framebuffer.h"
@@ -29,6 +28,7 @@ enum pl110_bppmode
};
typedef struct {
+ SysBusDevice busdev;
DisplayState *ds;
/* The Versatile/PB uses a slightly modified PL110 controller. */
@@ -349,20 +349,33 @@ static CPUWriteMemoryFunc *pl110_writefn[] = {
pl110_write
};
-void *pl110_init(uint32_t base, qemu_irq irq, int versatile)
+static void pl110_init(SysBusDevice *dev)
{
- pl110_state *s;
+ pl110_state *s = FROM_SYSBUS(pl110_state, dev);
int iomemtype;
- s = (pl110_state *)qemu_mallocz(sizeof(pl110_state));
iomemtype = cpu_register_io_memory(0, pl110_readfn,
pl110_writefn, s);
- cpu_register_physical_memory(base, 0x00001000, iomemtype);
- s->versatile = versatile;
- s->irq = irq;
+ sysbus_init_mmio(dev, 0x1000, iomemtype);
+ sysbus_init_irq(dev, &s->irq);
s->ds = graphic_console_init(pl110_update_display,
pl110_invalidate_display,
NULL, NULL, s);
/* ??? Save/restore. */
- return s;
}
+
+static void pl110_versatile_init(SysBusDevice *dev)
+{
+ pl110_state *s = FROM_SYSBUS(pl110_state, dev);
+ s->versatile = 1;
+ pl110_init(dev);
+}
+
+static void pl110_register_devices(void)
+{
+ sysbus_register_dev("pl110", sizeof(pl110_state), pl110_init);
+ sysbus_register_dev("pl110_versatile", sizeof(pl110_state),
+ pl110_versatile_init);
+}
+
+device_init(pl110_register_devices)
diff --git a/hw/primecell.h b/hw/primecell.h
index 09e73ed69f..5d270ffe98 100644
--- a/hw/primecell.h
+++ b/hw/primecell.h
@@ -8,9 +8,6 @@
/* pl031.c */
void pl031_init(uint32_t base, qemu_irq irq);
-/* pl110.c */
-void *pl110_init(uint32_t base, qemu_irq irq, int);
-
/* pl011.c */
enum pl011_type {
PL011_ARM,
diff --git a/hw/realview.c b/hw/realview.c
index 74fd9d82dd..4c24ac25d4 100644
--- a/hw/realview.c
+++ b/hw/realview.c
@@ -7,7 +7,7 @@
* This code is licenced under the GPL.
*/
-#include "hw.h"
+#include "sysbus.h"
#include "arm-misc.h"
#include "primecell.h"
#include "devices.h"
@@ -96,7 +96,7 @@ static void realview_init(ram_addr_t ram_size,
sp804_init(0x10011000, pic[4]);
sp804_init(0x10012000, pic[5]);
- pl110_init(0x10020000, pic[23], 1);
+ sysbus_create_simple("pl110_versatile", 0x10020000, pic[23]);
index = drive_get_index(IF_SD, 0, 0);
if (index == -1) {
diff --git a/hw/versatilepb.c b/hw/versatilepb.c
index 95de81fee3..f00ebf95c3 100644
--- a/hw/versatilepb.c
+++ b/hw/versatilepb.c
@@ -7,7 +7,7 @@
* This code is licenced under the GPL.
*/
-#include "hw.h"
+#include "sysbus.h"
#include "arm-misc.h"
#include "primecell.h"
#include "devices.h"
@@ -228,7 +228,7 @@ static void versatile_init(ram_addr_t ram_size,
/* The versatile/PB actually has a modified Color LCD controller
that includes hardware cursor support from the PL111. */
- pl110_init(0x10120000, pic[16], 1);
+ sysbus_create_simple("pl110_versatile", 0x10120000, pic[16]);
index = drive_get_index(IF_SD, 0, 0);
if (index == -1) {