diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2010-12-23 17:19:54 +0000 |
---|---|---|
committer | Aurelien Jarno <aurelien@aurel32.net> | 2011-01-20 12:37:21 +0100 |
commit | d6ac172a84ba0d3ced0250bafbd63e36aed34378 (patch) | |
tree | ccddd77a59fa2d8603ec777c0ea250b68310fa53 /hw/pl050.c | |
parent | b5ad0ae767b633305562150734c17bf430ccc045 (diff) | |
download | qemu-d6ac172a84ba0d3ced0250bafbd63e36aed34378.zip qemu-d6ac172a84ba0d3ced0250bafbd63e36aed34378.tar.gz qemu-d6ac172a84ba0d3ced0250bafbd63e36aed34378.tar.bz2 |
pl050: Implement save/restore
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Diffstat (limited to 'hw/pl050.c')
-rw-r--r-- | hw/pl050.c | 35 |
1 files changed, 30 insertions, 5 deletions
@@ -21,6 +21,20 @@ typedef struct { int is_mouse; } pl050_state; +static const VMStateDescription vmstate_pl050 = { + .name = "pl050", + .version_id = 1, + .minimum_version_id = 1, + .fields = (VMStateField[]) { + VMSTATE_UINT32(cr, pl050_state), + VMSTATE_UINT32(clk, pl050_state), + VMSTATE_UINT32(last, pl050_state), + VMSTATE_INT32(pending, pl050_state), + VMSTATE_INT32(is_mouse, pl050_state), + VMSTATE_END_OF_LIST() + } +}; + #define PL050_TXEMPTY (1 << 6) #define PL050_TXBUSY (1 << 5) #define PL050_RXFULL (1 << 4) @@ -137,7 +151,6 @@ static int pl050_init(SysBusDevice *dev, int is_mouse) s->dev = ps2_mouse_init(pl050_update, s); else s->dev = ps2_kbd_init(pl050_update, s); - /* ??? Save/restore. */ return 0; } @@ -151,12 +164,24 @@ static int pl050_init_mouse(SysBusDevice *dev) return pl050_init(dev, 1); } +static SysBusDeviceInfo pl050_kbd_info = { + .init = pl050_init_keyboard, + .qdev.name = "pl050_keyboard", + .qdev.size = sizeof(pl050_state), + .qdev.vmsd = &vmstate_pl050, +}; + +static SysBusDeviceInfo pl050_mouse_info = { + .init = pl050_init_mouse, + .qdev.name = "pl050_mouse", + .qdev.size = sizeof(pl050_state), + .qdev.vmsd = &vmstate_pl050, +}; + 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); + sysbus_register_withprop(&pl050_kbd_info); + sysbus_register_withprop(&pl050_mouse_info); } device_init(pl050_register_devices) |