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
This commit is contained in:
parent
b01b11113c
commit
b0a7b120a3
@ -127,6 +127,7 @@ struct BlockDriverState {
|
|||||||
int type;
|
int type;
|
||||||
char device_name[32];
|
char device_name[32];
|
||||||
BlockDriverState *next;
|
BlockDriverState *next;
|
||||||
|
void *private;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct BlockDriverAIOCB {
|
struct BlockDriverAIOCB {
|
||||||
|
6
hw/ide.c
6
hw/ide.c
@ -28,6 +28,7 @@
|
|||||||
#include "scsi-disk.h"
|
#include "scsi-disk.h"
|
||||||
#include "pcmcia.h"
|
#include "pcmcia.h"
|
||||||
#include "block.h"
|
#include "block.h"
|
||||||
|
#include "block_int.h"
|
||||||
#include "qemu-timer.h"
|
#include "qemu-timer.h"
|
||||||
#include "sysemu.h"
|
#include "sysemu.h"
|
||||||
#include "ppc_mac.h"
|
#include "ppc_mac.h"
|
||||||
@ -3352,6 +3353,7 @@ void pci_piix3_ide_init(PCIBus *bus, BlockDriverState **hd_table, int devfn,
|
|||||||
{
|
{
|
||||||
PCIIDEState *d;
|
PCIIDEState *d;
|
||||||
uint8_t *pci_conf;
|
uint8_t *pci_conf;
|
||||||
|
int i;
|
||||||
|
|
||||||
/* register a function 1 of PIIX3 */
|
/* register a function 1 of PIIX3 */
|
||||||
d = (PCIIDEState *)pci_register_device(bus, "PIIX3 IDE",
|
d = (PCIIDEState *)pci_register_device(bus, "PIIX3 IDE",
|
||||||
@ -3378,6 +3380,10 @@ void pci_piix3_ide_init(PCIBus *bus, BlockDriverState **hd_table, int devfn,
|
|||||||
ide_init_ioport(&d->ide_if[0], 0x1f0, 0x3f6);
|
ide_init_ioport(&d->ide_if[0], 0x1f0, 0x3f6);
|
||||||
ide_init_ioport(&d->ide_if[2], 0x170, 0x376);
|
ide_init_ioport(&d->ide_if[2], 0x170, 0x376);
|
||||||
|
|
||||||
|
for (i = 0; i < 4; i++)
|
||||||
|
if (hd_table[i])
|
||||||
|
hd_table[i]->private = &d->dev;
|
||||||
|
|
||||||
register_savevm("ide", 0, 2, pci_ide_save, pci_ide_load, d);
|
register_savevm("ide", 0, 2, pci_ide_save, pci_ide_load, d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#include "hw.h"
|
#include "hw.h"
|
||||||
#include "pci.h"
|
#include "pci.h"
|
||||||
#include "scsi-disk.h"
|
#include "scsi-disk.h"
|
||||||
|
#include "block_int.h"
|
||||||
|
|
||||||
//#define DEBUG_LSI
|
//#define DEBUG_LSI
|
||||||
//#define DEBUG_LSI_REG
|
//#define DEBUG_LSI_REG
|
||||||
@ -1958,6 +1959,7 @@ void lsi_scsi_attach(void *opaque, BlockDriverState *bd, int id)
|
|||||||
s->scsi_dev[id] = scsi_generic_init(bd, 1, lsi_command_complete, s);
|
s->scsi_dev[id] = scsi_generic_init(bd, 1, lsi_command_complete, s);
|
||||||
if (s->scsi_dev[id] == NULL)
|
if (s->scsi_dev[id] == NULL)
|
||||||
s->scsi_dev[id] = scsi_disk_init(bd, 1, lsi_command_complete, s);
|
s->scsi_dev[id] = scsi_disk_init(bd, 1, lsi_command_complete, s);
|
||||||
|
bd->private = &s->pci_dev;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *lsi_scsi_init(PCIBus *bus, int devfn)
|
void *lsi_scsi_init(PCIBus *bus, int devfn)
|
||||||
|
@ -314,6 +314,7 @@ void *virtio_blk_init(PCIBus *bus, BlockDriverState *bs)
|
|||||||
s->vdev.reset = virtio_blk_reset;
|
s->vdev.reset = virtio_blk_reset;
|
||||||
s->bs = bs;
|
s->bs = bs;
|
||||||
s->rq = NULL;
|
s->rq = NULL;
|
||||||
|
bs->private = &s->vdev.pci_dev;
|
||||||
bdrv_guess_geometry(s->bs, &cylinders, &heads, &secs);
|
bdrv_guess_geometry(s->bs, &cylinders, &heads, &secs);
|
||||||
bdrv_set_geometry_hint(s->bs, cylinders, heads, secs);
|
bdrv_set_geometry_hint(s->bs, cylinders, heads, secs);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user