summary refs log tree commit diff stats
path: root/hw/ide/pci.c
diff options
context:
space:
mode:
authorJuan Quintela <quintela@redhat.com>2010-07-26 21:38:45 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2010-07-26 16:19:51 -0500
commit5ee84c3375f9dff8fdee7209195c8c5327a92551 (patch)
tree527700d14b32c870e178ae5bca788adad1837f4b /hw/ide/pci.c
parent50641c5ce258220fc63ba5be1afd1a37f023aba9 (diff)
downloadfocaccia-qemu-5ee84c3375f9dff8fdee7209195c8c5327a92551.tar.gz
focaccia-qemu-5ee84c3375f9dff8fdee7209195c8c5327a92551.zip
ide: fix migration in the middle of a bmdma transfer
It reintroduces
    Revert "ide save/restore pio/atapi cmd transfer fields and io buffer"

but using subsections.  Added bonus is the addition of ide_dummy_transfer_stop
to transfer_end_table, that was missing.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/ide/pci.c')
-rw-r--r--hw/ide/pci.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/hw/ide/pci.c b/hw/ide/pci.c
index 780fc5f115..4331d77232 100644
--- a/hw/ide/pci.c
+++ b/hw/ide/pci.c
@@ -121,6 +121,28 @@ void bmdma_addr_writel(void *opaque, uint32_t addr, uint32_t val)
     bm->cur_addr = bm->addr;
 }
 
+static bool ide_bmdma_current_needed(void *opaque)
+{
+    BMDMAState *bm = opaque;
+
+    return (bm->cur_prd_len != 0);
+}
+
+static const VMStateDescription vmstate_bmdma_current = {
+    .name = "ide bmdma_current",
+    .version_id = 1,
+    .minimum_version_id = 1,
+    .minimum_version_id_old = 1,
+    .fields      = (VMStateField []) {
+        VMSTATE_UINT32(cur_addr, BMDMAState),
+        VMSTATE_UINT32(cur_prd_last, BMDMAState),
+        VMSTATE_UINT32(cur_prd_addr, BMDMAState),
+        VMSTATE_UINT32(cur_prd_len, BMDMAState),
+        VMSTATE_END_OF_LIST()
+    }
+};
+
+
 static const VMStateDescription vmstate_bmdma = {
     .name = "ide bmdma",
     .version_id = 3,
@@ -134,6 +156,14 @@ static const VMStateDescription vmstate_bmdma = {
         VMSTATE_UINT32(nsector, BMDMAState),
         VMSTATE_UINT8(unit, BMDMAState),
         VMSTATE_END_OF_LIST()
+    },
+    .subsections = (VMStateSubsection []) {
+        {
+            .vmsd = &vmstate_bmdma_current,
+            .needed = ide_bmdma_current_needed,
+        }, {
+            /* empty */
+        }
     }
 };