]> git.proxmox.com Git - qemu.git/commitdiff
PL110 qdev conversion
authorPaul Brook <paul@codesourcery.com>
Thu, 14 May 2009 21:35:07 +0000 (22:35 +0100)
committerPaul Brook <paul@codesourcery.com>
Thu, 14 May 2009 21:35:07 +0000 (22:35 +0100)
Signed-off-by: Paul Brook <paul@codesourcery.com>
hw/integratorcp.c
hw/pl110.c
hw/primecell.h
hw/realview.c
hw/versatilepb.c

index 8dfc63ed52330975c75cd92cc4c6c255f4303991..7f27d075c24ca69c452df85392bba8241df59cb2 100644 (file)
@@ -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;
index f37b20a106126a4ee8b1c7c64c62d8d723153464..b45204c63fdb7196991e8b458be02e2d27d7dff4 100644 (file)
@@ -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)
index 09e73ed69fee1399573a63e1d455ed9a96dbd8e3..5d270ffe98351e58d1b3af3b01c26cb4a1c4c54d 100644 (file)
@@ -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,
index 74fd9d82ddf60f62872dbe7e067fcb28d178b7b4..4c24ac25d4b017108d84e4f86aa703835042dc3d 100644 (file)
@@ -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) {
index 95de81fee396f01f936f3dd2a34b7102b0077dcc..f00ebf95c3c78759cdf5e4f142371efd60a0b573 100644 (file)
@@ -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) {