[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 02/12] pcspk: adding vmstate for save/restore
From: |
Pavel Dovgalyuk |
Subject: |
[Qemu-devel] [PATCH v2 02/12] pcspk: adding vmstate for save/restore |
Date: |
Thu, 28 Aug 2014 15:18:35 +0400 |
User-agent: |
StGit/0.16 |
VMState added by this patch preserves correct
loading of the PC speaker device state.
Signed-off-by: Pavel Dovgalyuk <address@hidden>
---
hw/audio/pcspk.c | 17 +++++++++++++++--
1 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/hw/audio/pcspk.c b/hw/audio/pcspk.c
index 1d81bbe..1d58ef0 100644
--- a/hw/audio/pcspk.c
+++ b/hw/audio/pcspk.c
@@ -50,8 +50,8 @@ typedef struct {
unsigned int pit_count;
unsigned int samples;
unsigned int play_pos;
- int data_on;
- int dummy_refresh_clock;
+ uint8_t data_on;
+ uint8_t dummy_refresh_clock;
} PCSpkState;
static const char *s_spk = "pcspk";
@@ -163,6 +163,18 @@ static const MemoryRegionOps pcspk_io_ops = {
},
};
+static const VMStateDescription vmstate_spk = {
+ .name = "pcspk",
+ .version_id = 1,
+ .minimum_version_id = 1,
+ .minimum_version_id_old = 1,
+ .fields = (VMStateField[]) {
+ VMSTATE_UINT8(data_on, PCSpkState),
+ VMSTATE_UINT8(dummy_refresh_clock, PCSpkState),
+ VMSTATE_END_OF_LIST()
+ }
+};
+
static void pcspk_initfn(Object *obj)
{
PCSpkState *s = PC_SPEAKER(obj);
@@ -192,6 +204,7 @@ static void pcspk_class_initfn(ObjectClass *klass, void
*data)
dc->realize = pcspk_realizefn;
set_bit(DEVICE_CATEGORY_SOUND, dc->categories);
+ dc->vmsd = &vmstate_spk;
dc->props = pcspk_properties;
/* Reason: pointer property "pit", realize sets global pcspk_state */
dc->cannot_instantiate_with_device_add_yet = true;
- [Qemu-devel] [PATCH v2 00/12] Fixing hardware migration issues, Pavel Dovgalyuk, 2014/08/28
- [Qemu-devel] [PATCH v2 01/12] integratorcp: adding vmstate for save/restore, Pavel Dovgalyuk, 2014/08/28
- [Qemu-devel] [PATCH v2 02/12] pcspk: adding vmstate for save/restore,
Pavel Dovgalyuk <=
- [Qemu-devel] [PATCH v2 03/12] fdc: adding vmstate for save/restore, Pavel Dovgalyuk, 2014/08/28
- [Qemu-devel] [PATCH v2 04/12] parallel: adding vmstate for save/restore, Pavel Dovgalyuk, 2014/08/28
- [Qemu-devel] [PATCH v2 05/12] serial: fixing vmstate for save/restore, Pavel Dovgalyuk, 2014/08/28
- [Qemu-devel] [PATCH v2 06/12] apic_common: fixing loading vmstate, Pavel Dovgalyuk, 2014/08/28
- [Qemu-devel] [PATCH v2 07/12] apic_common: vapic_paddr synchronization fix, Pavel Dovgalyuk, 2014/08/28
- [Qemu-devel] [PATCH v2 08/12] hpet: fixing saving and loading process, Pavel Dovgalyuk, 2014/08/28
- [Qemu-devel] [PATCH v2 09/12] pckbd: adding new fields to vmstate, Pavel Dovgalyuk, 2014/08/28