qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 4/8] pl050: Implement save/restore
Date: Thu, 23 Dec 2010 17:19:54 +0000	[thread overview]
Message-ID: <1293124798-5335-5-git-send-email-peter.maydell@linaro.org> (raw)
In-Reply-To: <1293124798-5335-1-git-send-email-peter.maydell@linaro.org>

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 hw/pl050.c |   35 ++++++++++++++++++++++++++++++-----
 1 files changed, 30 insertions(+), 5 deletions(-)

diff --git a/hw/pl050.c b/hw/pl050.c
index 0573839..b155cc0 100644
--- a/hw/pl050.c
+++ b/hw/pl050.c
@@ -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)
-- 
1.6.3.3

  parent reply	other threads:[~2010-12-23 17:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-23 17:19 [Qemu-devel] [PATCH 0/8] Add save/restore support to ARM versatilepb devices Peter Maydell
2010-12-23 17:19 ` [Qemu-devel] [PATCH 1/8] pl190: Implement save/restore Peter Maydell
2010-12-23 17:19 ` [Qemu-devel] [PATCH 2/8] vpb_sic: " Peter Maydell
2010-12-23 17:19 ` [Qemu-devel] [PATCH 3/8] arm_sysctl: " Peter Maydell
2010-12-23 17:19 ` Peter Maydell [this message]
2010-12-23 17:19 ` [Qemu-devel] [PATCH 5/8] pl031: " Peter Maydell
2010-12-23 17:19 ` [Qemu-devel] [PATCH 6/8] pl110: " Peter Maydell
2010-12-23 17:19 ` [Qemu-devel] [PATCH 7/8] pl080: " Peter Maydell
2010-12-23 17:19 ` [Qemu-devel] [PATCH 8/8] stc91c111: " Peter Maydell
2011-01-12 12:33 ` [Qemu-devel] [PATCH 0/8] Add save/restore support to ARM versatilepb devices Peter Maydell
2011-01-20 11:44 ` Aurelien Jarno

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1293124798-5335-5-git-send-email-peter.maydell@linaro.org \
    --to=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).