-----BEGIN PGP SIGNATURE-----

iQIcBAABAgAGBQJYyeHZAAoJEH3vgQaq/DkOHQQQAKG2yjWKowQBmThYnRQ2F4Fb
 Fas73702vAZ0vrpMSVby+GvlvOIXbcXLgGDmCOaniAK9oJWKleMeY+cL4OrT8bPQ
 fBRAvMg811/4aiW4nrgrm4LMd9X46ZWpEj67pjUdquWPZmswTo2wKK1plAYAjAIL
 KfR8u9HbN1wdbrTcRf9ZYXZrNUtApvsql9c1C3nWn9vTlpyQBAJJwytRz5yjwf4K
 O81+NwZlU1miBA3tUq00sr46Met6UGkTC8du9anPigYaPhdCs1R+lveCxOL/AjPF
 cd5RNiQP+MsawNHdZpUYIUcB0psfebwvf+rTg7e4NUqXn558dwVimC1yVcRjPROA
 xxz848bA24Tli+Ts+DeqRwWpC/2xdOq29XncaveV5v7Q2yYDxhK9ysyqZojH9Z2O
 72gPWUJvwN6kuNn3UbdTu4Xjjm9yIYOjq92ES5GpQjsZzRLSWcHeEZSlJMa/rE6e
 hpFIomzgHd0cMxddMKBX4q1Vt6dQWd0wYQvgjkJk/ZPA4FCcyY6xk/U2v4LEVwEU
 v5vXePZM7W1aGk7EKwW78tox4x8yKNaQQxyjYUU6iNFsSPTZ6SQI9iEAldF99sfy
 BEW/oAKfUtx8PaDh5J/YG5mt3UrtiQlHLkXWfNOtdfWKdifkffpt1m2zGTElhrFo
 Hd8iI4jQtysx1wF1z8e7
 =C/29
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/jnsnow/tags/ide-pull-request' into staging

# gpg: Signature made Thu 16 Mar 2017 00:52:41 GMT
# gpg:                using RSA key 0x7DEF8106AAFC390E
# gpg: Good signature from "John Snow (John Huston) <jsnow@redhat.com>"
# Primary key fingerprint: FAEB 9711 A12C F475 812F  18F2 88A9 064D 1835 61EB
#      Subkey fingerprint: F9B7 ABDB BCAC DF95 BE76  CBD0 7DEF 8106 AAFC 390E

* remotes/jnsnow/tags/ide-pull-request:
  ide: ahci: call cleanup function in ahci unit
  ide: core: add cleanup function
  ide: qdev: register ide bus unrealize function

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2017-03-16 10:04:41 +00:00
commit 7c75638028
4 changed files with 27 additions and 6 deletions

View File

@ -1485,6 +1485,18 @@ void ahci_realize(AHCIState *s, DeviceState *qdev, AddressSpace *as, int ports)
void ahci_uninit(AHCIState *s)
{
int i, j;
for (i = 0; i < s->ports; i++) {
AHCIDevice *ad = &s->dev[i];
for (j = 0; j < 2; j++) {
IDEState *s = &ad->port.ifs[j];
ide_exit(s);
}
}
g_free(s->dev);
}

View File

@ -2603,6 +2603,14 @@ void ide_init2(IDEBus *bus, qemu_irq irq)
bus->dma = &ide_dma_nop;
}
void ide_exit(IDEState *s)
{
timer_del(s->sector_write_timer);
timer_free(s->sector_write_timer);
qemu_vfree(s->smart_selftest_data);
qemu_vfree(s->io_buffer);
}
static const MemoryRegionPortio ide_portio_list[] = {
{ 0, 8, 1, .read = ide_ioport_read, .write = ide_ioport_write },
{ 0, 1, 2, .read = ide_data_readw, .write = ide_data_writew },

View File

@ -31,7 +31,7 @@
/* --------------------------------- */
static char *idebus_get_fw_dev_path(DeviceState *dev);
static void idebus_unrealize(DeviceState *qdev, Error **errp);
static void idebus_unrealize(BusState *qdev, Error **errp);
static Property ide_props[] = {
DEFINE_PROP_UINT32("unit", IDEDevice, unit, -1),
@ -43,14 +43,15 @@ static void ide_bus_class_init(ObjectClass *klass, void *data)
BusClass *k = BUS_CLASS(klass);
k->get_fw_dev_path = idebus_get_fw_dev_path;
k->unrealize = idebus_unrealize;
}
static void idebus_unrealize(DeviceState *qdev, Error **errp)
static void idebus_unrealize(BusState *bus, Error **errp)
{
IDEBus *bus = DO_UPCAST(IDEBus, qbus, qdev->parent_bus);
IDEBus *ibus = IDE_BUS(bus);
if (bus->vmstate) {
qemu_del_vm_change_state_handler(bus->vmstate);
if (ibus->vmstate) {
qemu_del_vm_change_state_handler(ibus->vmstate);
}
}
@ -370,7 +371,6 @@ static void ide_device_class_init(ObjectClass *klass, void *data)
k->init = ide_qdev_init;
set_bit(DEVICE_CATEGORY_STORAGE, k->categories);
k->bus_type = TYPE_IDE_BUS;
k->unrealize = idebus_unrealize;
k->props = ide_props;
}

View File

@ -607,6 +607,7 @@ int ide_init_drive(IDEState *s, BlockBackend *blk, IDEDriveKind kind,
uint32_t cylinders, uint32_t heads, uint32_t secs,
int chs_trans);
void ide_init2(IDEBus *bus, qemu_irq irq);
void ide_exit(IDEState *s);
void ide_init_ioport(IDEBus *bus, ISADevice *isa, int iobase, int iobase2);
void ide_register_restart_cb(IDEBus *bus);