aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>2022-06-24 14:40:56 +0100
committerMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>2022-06-26 18:40:12 +0100
commit63195aa5a55a885a5c56b7103eb6e698abf2b95a (patch)
tree6016905efeee7f966b8f6a3ff65eaf3f93897742 /hw
parent5cbf35d20f71f87ade944b3835db389c260f2c59 (diff)
downloadqemu-63195aa5a55a885a5c56b7103eb6e698abf2b95a.zip
qemu-63195aa5a55a885a5c56b7103eb6e698abf2b95a.tar.gz
qemu-63195aa5a55a885a5c56b7103eb6e698abf2b95a.tar.bz2
lasips2: implement lasips2_init() function
Move the initialisation of the keyboard and mouse memory regions to lasips2_init() and expose them as SysBus memory regions. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Acked-by: Helge Deller <deller@gmx.de> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-Id: <20220624134109.881989-42-mark.cave-ayland@ilande.co.uk>
Diffstat (limited to 'hw')
-rw-r--r--hw/input/lasips2.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c
index 85da408..8d3a2d8 100644
--- a/hw/input/lasips2.c
+++ b/hw/input/lasips2.c
@@ -265,20 +265,30 @@ LASIPS2State *lasips2_initfn(MemoryRegion *address_space,
s->kbd.dev = ps2_kbd_init(lasips2_port_set_irq, &s->kbd);
s->mouse.dev = ps2_mouse_init(lasips2_port_set_irq, &s->mouse);
- memory_region_init_io(&s->kbd.reg, NULL, &lasips2_reg_ops, &s->kbd,
- "lasips2-kbd", 0x100);
memory_region_add_subregion(address_space, base, &s->kbd.reg);
- memory_region_init_io(&s->mouse.reg, NULL, &lasips2_reg_ops, &s->mouse,
- "lasips2-mouse", 0x100);
memory_region_add_subregion(address_space, base + 0x100, &s->mouse.reg);
return s;
}
+static void lasips2_init(Object *obj)
+{
+ LASIPS2State *s = LASIPS2(obj);
+
+ memory_region_init_io(&s->kbd.reg, obj, &lasips2_reg_ops, &s->kbd,
+ "lasips2-kbd", 0x100);
+ memory_region_init_io(&s->mouse.reg, obj, &lasips2_reg_ops, &s->mouse,
+ "lasips2-mouse", 0x100);
+
+ sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->kbd.reg);
+ sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->mouse.reg);
+}
+
static const TypeInfo lasips2_info = {
.name = TYPE_LASIPS2,
.parent = TYPE_SYS_BUS_DEVICE,
+ .instance_init = lasips2_init,
.instance_size = sizeof(LASIPS2State)
};