mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 01:03:55 -06:00
ahci: Clean up reset functions
Properly register reset functions via the device class. CC: Alexander Graf <agraf@suse.de> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
8e729e3b52
commit
8ab60a0703
3 changed files with 20 additions and 17 deletions
10
hw/ide/ich.c
10
hw/ide/ich.c
|
@ -84,12 +84,12 @@ static const VMStateDescription vmstate_ahci = {
|
|||
.unmigratable = 1,
|
||||
};
|
||||
|
||||
static void pci_ich9_reset(void *opaque)
|
||||
static void pci_ich9_reset(DeviceState *dev)
|
||||
{
|
||||
struct AHCIPCIState *d = opaque;
|
||||
struct AHCIPCIState *d = DO_UPCAST(struct AHCIPCIState, card.qdev, dev);
|
||||
|
||||
msi_reset(&d->card);
|
||||
ahci_reset(opaque);
|
||||
ahci_reset(&d->ahci);
|
||||
}
|
||||
|
||||
static int pci_ich9_ahci_init(PCIDevice *dev)
|
||||
|
@ -110,8 +110,6 @@ static int pci_ich9_ahci_init(PCIDevice *dev)
|
|||
/* XXX Software should program this register */
|
||||
d->card.config[0x90] = 1 << 6; /* Address Map Register - AHCI mode */
|
||||
|
||||
qemu_register_reset(pci_ich9_reset, d);
|
||||
|
||||
msi_init(dev, 0x50, 1, true, false);
|
||||
d->ahci.irq = d->card.irq[0];
|
||||
|
||||
|
@ -141,7 +139,6 @@ static int pci_ich9_uninit(PCIDevice *dev)
|
|||
d = DO_UPCAST(struct AHCIPCIState, card, dev);
|
||||
|
||||
msi_uninit(dev);
|
||||
qemu_unregister_reset(pci_ich9_reset, d);
|
||||
ahci_uninit(&d->ahci);
|
||||
|
||||
return 0;
|
||||
|
@ -167,6 +164,7 @@ static void ich_ahci_class_init(ObjectClass *klass, void *data)
|
|||
k->revision = 0x02;
|
||||
k->class_id = PCI_CLASS_STORAGE_SATA;
|
||||
dc->vmsd = &vmstate_ahci;
|
||||
dc->reset = pci_ich9_reset;
|
||||
}
|
||||
|
||||
static TypeInfo ich_ahci_info = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue