Commit b0a7b120a357733d9c554a1a3b125991114a1135
1 parent
b01b1111
qemu: record devfn on block driver instance (Marcelo Tosatti)
Record PCIDev on the BlockDriverState structure to locate for release on hot-removal. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6597 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
4 changed files
with
10 additions
and
0 deletions
block_int.h
hw/ide.c
| ... | ... | @@ -28,6 +28,7 @@ |
| 28 | 28 | #include "scsi-disk.h" |
| 29 | 29 | #include "pcmcia.h" |
| 30 | 30 | #include "block.h" |
| 31 | +#include "block_int.h" | |
| 31 | 32 | #include "qemu-timer.h" |
| 32 | 33 | #include "sysemu.h" |
| 33 | 34 | #include "ppc_mac.h" |
| ... | ... | @@ -3352,6 +3353,7 @@ void pci_piix3_ide_init(PCIBus *bus, BlockDriverState **hd_table, int devfn, |
| 3352 | 3353 | { |
| 3353 | 3354 | PCIIDEState *d; |
| 3354 | 3355 | uint8_t *pci_conf; |
| 3356 | + int i; | |
| 3355 | 3357 | |
| 3356 | 3358 | /* register a function 1 of PIIX3 */ |
| 3357 | 3359 | d = (PCIIDEState *)pci_register_device(bus, "PIIX3 IDE", |
| ... | ... | @@ -3378,6 +3380,10 @@ void pci_piix3_ide_init(PCIBus *bus, BlockDriverState **hd_table, int devfn, |
| 3378 | 3380 | ide_init_ioport(&d->ide_if[0], 0x1f0, 0x3f6); |
| 3379 | 3381 | ide_init_ioport(&d->ide_if[2], 0x170, 0x376); |
| 3380 | 3382 | |
| 3383 | + for (i = 0; i < 4; i++) | |
| 3384 | + if (hd_table[i]) | |
| 3385 | + hd_table[i]->private = &d->dev; | |
| 3386 | + | |
| 3381 | 3387 | register_savevm("ide", 0, 2, pci_ide_save, pci_ide_load, d); |
| 3382 | 3388 | } |
| 3383 | 3389 | ... | ... |
hw/lsi53c895a.c
| ... | ... | @@ -13,6 +13,7 @@ |
| 13 | 13 | #include "hw.h" |
| 14 | 14 | #include "pci.h" |
| 15 | 15 | #include "scsi-disk.h" |
| 16 | +#include "block_int.h" | |
| 16 | 17 | |
| 17 | 18 | //#define DEBUG_LSI |
| 18 | 19 | //#define DEBUG_LSI_REG |
| ... | ... | @@ -1958,6 +1959,7 @@ void lsi_scsi_attach(void *opaque, BlockDriverState *bd, int id) |
| 1958 | 1959 | s->scsi_dev[id] = scsi_generic_init(bd, 1, lsi_command_complete, s); |
| 1959 | 1960 | if (s->scsi_dev[id] == NULL) |
| 1960 | 1961 | s->scsi_dev[id] = scsi_disk_init(bd, 1, lsi_command_complete, s); |
| 1962 | + bd->private = &s->pci_dev; | |
| 1961 | 1963 | } |
| 1962 | 1964 | |
| 1963 | 1965 | void *lsi_scsi_init(PCIBus *bus, int devfn) | ... | ... |
hw/virtio-blk.c
| ... | ... | @@ -314,6 +314,7 @@ void *virtio_blk_init(PCIBus *bus, BlockDriverState *bs) |
| 314 | 314 | s->vdev.reset = virtio_blk_reset; |
| 315 | 315 | s->bs = bs; |
| 316 | 316 | s->rq = NULL; |
| 317 | + bs->private = &s->vdev.pci_dev; | |
| 317 | 318 | bdrv_guess_geometry(s->bs, &cylinders, &heads, &secs); |
| 318 | 319 | bdrv_set_geometry_hint(s->bs, cylinders, heads, secs); |
| 319 | 320 | ... | ... |