mirror of
https://github.com/xemu-project/xemu.git
synced 2025-01-27 15:02:04 +00:00
ide: introduce ide_register_restart_cb
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 <pbonzini@redhat.com> Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1424708286-16483-4-git-send-email-jsnow@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
bd8892c4e6
commit
f878c91607
@ -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);
|
||||
|
@ -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,
|
||||
|
@ -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);
|
||||
|
@ -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]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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]);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user