qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 29/29] hpet: add qom property for hpet state


From: Michael Roth
Subject: [Qemu-devel] [PATCH 29/29] hpet: add qom property for hpet state
Date: Thu, 1 Nov 2012 08:04:31 -0500

Signed-off-by: Michael Roth <address@hidden>
---
 hw/hpet.c |   25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/hw/hpet.c b/hw/hpet.c
index 3beb61e..e1b8881 100644
--- a/hw/hpet.c
+++ b/hw/hpet.c
@@ -34,6 +34,8 @@
 #include "i8254.h"
 #include "qidl.h"
 
+QIDL_ENABLE()
+
 //#define HPET_DEBUG
 #ifdef HPET_DEBUG
 #define DPRINTF printf
@@ -682,6 +684,24 @@ static void hpet_handle_legacy_irq(void *opaque, int n, 
int level)
     }
 }
 
+
+static void hpet_get_state(Object *obj, Visitor *v, void *opaque,
+                           const char *name, Error **errp)
+{
+    HPETState *s = FROM_SYSBUS(HPETState, SYS_BUS_DEVICE(obj));
+    hpet_pre_save(s);
+    QIDL_VISIT_TYPE(HPETState, v, &s, name, errp);
+}
+
+static void hpet_set_state(Object *obj, Visitor *v, void *opaque,
+                           const char *name, Error **errp)
+{
+    HPETState *s = FROM_SYSBUS(HPETState, SYS_BUS_DEVICE(obj));
+    hpet_pre_load(s);
+    QIDL_VISIT_TYPE(HPETState, v, &s, name, errp);
+    hpet_post_load(s, -1);
+}
+
 static int hpet_init(SysBusDevice *dev)
 {
     HPETState *s = FROM_SYSBUS(HPETState, dev);
@@ -727,6 +747,11 @@ static int hpet_init(SysBusDevice *dev)
     /* HPET Area */
     memory_region_init_io(&s->iomem, &hpet_ram_ops, s, "hpet", 0x400);
     sysbus_init_mmio(dev, &s->iomem);
+
+    object_property_add(OBJECT(s), "state", "HPETState",
+                        hpet_get_state, hpet_set_state,
+                        NULL, NULL, NULL);
+    QIDL_SCHEMA_ADD_LINK(HPETState, OBJECT(s), "state_schema", NULL);
     return 0;
 }
 
-- 
1.7.9.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]