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>
This commit is contained in:
parent
5cbf35d20f
commit
63195aa5a5
@ -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)
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user