[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 38/69] ide: introduce ide_register_restart_cb
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 38/69] ide: introduce ide_register_restart_cb |
Date: |
Fri, 27 Feb 2015 18:18:36 +0000 |
From: Paolo Bonzini <address@hidden>
A helper is added that registers the IDEDMAOp .restart_cb()
via qemu_add_vm_change_state_handler instead of requiring
each HBA to register the callback themselves.
Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: John Snow <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
hw/ide/cmd646.c | 3 +--
hw/ide/core.c | 5 +++++
hw/ide/internal.h | 1 +
hw/ide/piix.c | 3 +--
hw/ide/via.c | 3 +--
5 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/hw/ide/cmd646.c b/hw/ide/cmd646.c
index c8b0322..0374653 100644
--- a/hw/ide/cmd646.c
+++ b/hw/ide/cmd646.c
@@ -368,8 +368,7 @@ static int pci_cmd646_ide_initfn(PCIDevice *dev)
bmdma_init(&d->bus[i], &d->bmdma[i], d);
d->bmdma[i].bus = &d->bus[i];
- qemu_add_vm_change_state_handler(d->bus[i].dma->ops->restart_cb,
- &d->bmdma[i].dma);
+ ide_register_restart_cb(&d->bus[i]);
}
vmstate_register(DEVICE(dev), 0, &vmstate_ide_pci, d);
diff --git a/hw/ide/core.c b/hw/ide/core.c
index ac3f015..5a42771 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -2330,6 +2330,11 @@ static const IDEDMAOps ide_dma_nop_ops = {
.restart_cb = ide_nop_restart,
};
+void ide_register_restart_cb(IDEBus *bus)
+{
+ qemu_add_vm_change_state_handler(bus->dma->ops->restart_cb, bus->dma);
+}
+
static IDEDMA ide_dma_nop = {
.ops = &ide_dma_nop_ops,
.aiocb = NULL,
diff --git a/hw/ide/internal.h b/hw/ide/internal.h
index 2566503..57ef5ca 100644
--- a/hw/ide/internal.h
+++ b/hw/ide/internal.h
@@ -551,6 +551,7 @@ int ide_init_drive(IDEState *s, BlockBackend *blk,
IDEDriveKind kind,
int chs_trans);
void ide_init2(IDEBus *bus, qemu_irq irq);
void ide_init_ioport(IDEBus *bus, ISADevice *isa, int iobase, int iobase2);
+void ide_register_restart_cb(IDEBus *bus);
void ide_exec_cmd(IDEBus *bus, uint32_t val);
void ide_dma_cb(void *opaque, int ret);
diff --git a/hw/ide/piix.c b/hw/ide/piix.c
index b0172fb..247dd4f 100644
--- a/hw/ide/piix.c
+++ b/hw/ide/piix.c
@@ -143,8 +143,7 @@ static void pci_piix_init_ports(PCIIDEState *d) {
bmdma_init(&d->bus[i], &d->bmdma[i], d);
d->bmdma[i].bus = &d->bus[i];
- qemu_add_vm_change_state_handler(d->bus[i].dma->ops->restart_cb,
- &d->bmdma[i].dma);
+ ide_register_restart_cb(&d->bus[i]);
}
}
diff --git a/hw/ide/via.c b/hw/ide/via.c
index 4d8089d..fb3d8a0 100644
--- a/hw/ide/via.c
+++ b/hw/ide/via.c
@@ -166,8 +166,7 @@ static void vt82c686b_init_ports(PCIIDEState *d) {
bmdma_init(&d->bus[i], &d->bmdma[i], d);
d->bmdma[i].bus = &d->bus[i];
- qemu_add_vm_change_state_handler(d->bus[i].dma->ops->restart_cb,
- &d->bmdma[i].dma);
+ ide_register_restart_cb(&d->bus[i]);
}
}
--
2.1.0
- [Qemu-devel] [PULL 28/69] qcow2: Allow creation with refcount order != 4, (continued)
- [Qemu-devel] [PULL 28/69] qcow2: Allow creation with refcount order != 4, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 29/69] iotests: Add test for different refcount widths, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 27/69] iotests: Prepare for refcount_bits option, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 31/69] block: add bdrv functions for geometry and blocksize, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 30/69] blkdebug: fix "once" rule, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 34/69] block-backend: Add wrappers for blocksizes and geometry probing, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 33/69] block: Add driver methods to probe blocksizes and geometry, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 39/69] ide: do not use BMDMA in restart callback, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 36/69] ide: start extracting ide_restart_dma out of bmdma_restart_dma, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 37/69] ide: prepare to move restart to common code, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 38/69] ide: introduce ide_register_restart_cb,
Stefan Hajnoczi <=
- [Qemu-devel] [PULL 40/69] ide: pass IDEBus to the restart_cb, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 42/69] ide: remove restart_cb callback, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 41/69] ide: move restart callback to common code, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 32/69] raw-posix: Factor block size detection out of raw_probe_alignment(), Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 43/69] ide: replace set_unit callback with more IDEBus state, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 44/69] ide: place initial state of the current request to IDEBus, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 35/69] BlockConf: Call backend functions to detect geometry and blocksizes, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 45/69] ide: migrate initial request state via IDEBus, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 46/69] ide: commonize io_buffer_index initialization, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 47/69] ide: make more functions static, Stefan Hajnoczi, 2015/02/27