sysbus_create_simple("pl011", 0x16000000, pic[1]);
sysbus_create_simple("pl011", 0x17000000, pic[2]);
icp_control_init(0xcb000000);
- pl050_init(0x18000000, pic[3], 0);
- pl050_init(0x19000000, pic[4], 1);
+ sysbus_create_simple("pl050_keyboard", 0x18000000, pic[3]);
+ sysbus_create_simple("pl050_mouse", 0x19000000, pic[4]);
sd = drive_get_index(IF_SD, 0, 0);
if (sd == -1) {
fprintf(stderr, "qemu: missing SecureDigital card\n");
* This code is licenced under the GPL.
*/
-#include "hw.h"
-#include "primecell.h"
+#include "sysbus.h"
#include "ps2.h"
typedef struct {
+ SysBusDevice busdev;
void *dev;
uint32_t cr;
uint32_t clk;
pl050_write
};
-void pl050_init(uint32_t base, qemu_irq irq, int is_mouse)
+static void pl050_init(SysBusDevice *dev, int is_mouse)
{
+ pl050_state *s = FROM_SYSBUS(pl050_state, dev);
int iomemtype;
- pl050_state *s;
- s = (pl050_state *)qemu_mallocz(sizeof(pl050_state));
iomemtype = cpu_register_io_memory(0, pl050_readfn,
pl050_writefn, s);
- cpu_register_physical_memory(base, 0x00001000, iomemtype);
- s->irq = irq;
+ sysbus_init_mmio(dev, 0x1000, iomemtype);
+ sysbus_init_irq(dev, &s->irq);
s->is_mouse = is_mouse;
- if (is_mouse)
+ if (s->is_mouse)
s->dev = ps2_mouse_init(pl050_update, s);
else
s->dev = ps2_kbd_init(pl050_update, s);
/* ??? Save/restore. */
}
+
+static void pl050_init_keyboard(SysBusDevice *dev)
+{
+ pl050_init(dev, 0);
+}
+
+static void pl050_init_mouse(SysBusDevice *dev)
+{
+ pl050_init(dev, 1);
+}
+
+static void pl050_register_devices(void)
+{
+ sysbus_register_dev("pl050_keyboard", sizeof(pl050_state),
+ pl050_init_keyboard);
+ sysbus_register_dev("pl050_mouse", sizeof(pl050_state),
+ pl050_init_mouse);
+}
+
+device_init(pl050_register_devices)
void pl022_init(uint32_t base, qemu_irq irq, ssi_xfer_cb xfer_cb,
void *opaque);
-/* pl050.c */
-void pl050_init(uint32_t base, qemu_irq irq, int is_mouse);
-
/* pl061.c */
void pl061_float_high(void *opaque, uint8_t mask);
qemu_irq *pl061_init(uint32_t base, qemu_irq irq, qemu_irq **out);
pic = mpcore_irq_init(cpu_irq);
}
- pl050_init(0x10006000, pic[20], 0);
- pl050_init(0x10007000, pic[21], 1);
+ sysbus_create_simple("pl050_keyboard", 0x10006000, pic[20]);
+ sysbus_create_simple("pl050_mouse", 0x10007000, pic[21]);
sysbus_create_simple("pl011", 0x10009000, pic[12]);
sysbus_create_simple("pl011", 0x1000a000, pic[13]);
pic = arm_pic_init_cpu(env);
pic = pl190_init(0x10140000, pic[0], pic[1]);
sic = vpb_sic_init(0x10003000, pic, 31);
- pl050_init(0x10006000, sic[3], 0);
- pl050_init(0x10007000, sic[4], 1);
+
+ sysbus_create_simple("pl050_keyboard", 0x10006000, sic[3]);
+ sysbus_create_simple("pl050_mouse", 0x10007000, sic[4]);
pci_bus = pci_vpb_init(sic, 27, 0);
/* The Versatile PCI bridge does not provide access to PCI IO space,