aboutsummaryrefslogtreecommitdiff
path: root/hw/pl181.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
commitaa9311d8cbd6250b9443b0f12b85d8176ec057ca (patch)
tree52c978c711b9c2b1bd0f2738a7389fdda8623d41 /hw/pl181.c
parenta63bdb31026648fef5d4ffb3caafc973c8ced53c (diff)
PL181 qdev conversion
Signed-off-by: Paul Brook <paul@codesourcery.com>
Diffstat (limited to 'hw/pl181.c')
-rw-r--r--hw/pl181.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/hw/pl181.c b/hw/pl181.c
index ab4e978ae3..277607c04c 100644
--- a/hw/pl181.c
+++ b/hw/pl181.c
@@ -7,9 +7,9 @@
* This code is licenced under the GPL.
*/
-#include "hw.h"
-#include "primecell.h"
+#include "sysbus.h"
#include "sd.h"
+#include "sysemu.h"
//#define DEBUG_PL181 1
@@ -23,6 +23,7 @@ do { printf("pl181: " fmt , ## __VA_ARGS__); } while (0)
#define PL181_FIFO_LEN 16
typedef struct {
+ SysBusDevice busdev;
SDState *card;
uint32_t clock;
uint32_t power;
@@ -444,20 +445,27 @@ static void pl181_reset(void *opaque)
s->mask[1] = 0;
}
-void pl181_init(uint32_t base, BlockDriverState *bd,
- qemu_irq irq0, qemu_irq irq1)
+static void pl181_init(SysBusDevice *dev)
{
int iomemtype;
- pl181_state *s;
+ pl181_state *s = FROM_SYSBUS(pl181_state, dev);
+ BlockDriverState *bd;
- s = (pl181_state *)qemu_mallocz(sizeof(pl181_state));
iomemtype = cpu_register_io_memory(0, pl181_readfn,
pl181_writefn, s);
- cpu_register_physical_memory(base, 0x00001000, iomemtype);
+ sysbus_init_mmio(dev, 0x1000, iomemtype);
+ sysbus_init_irq(dev, &s->irq[0]);
+ sysbus_init_irq(dev, &s->irq[1]);
+ bd = qdev_init_bdrv(&dev->qdev, IF_SD);
s->card = sd_init(bd, 0);
- s->irq[0] = irq0;
- s->irq[1] = irq1;
qemu_register_reset(pl181_reset, s);
pl181_reset(s);
/* ??? Save/restore. */
}
+
+static void pl181_register_devices(void)
+{
+ sysbus_register_dev("pl181", sizeof(pl181_state), pl181_init);
+}
+
+device_init(pl181_register_devices)