Revision 428c149b hw/virtio-pci.c
b/hw/virtio-pci.c | ||
---|---|---|
22 | 22 |
#include "sysemu.h" |
23 | 23 |
#include "msix.h" |
24 | 24 |
#include "net.h" |
25 |
#include "block_int.h" |
|
25 | 26 |
#include "loader.h" |
26 | 27 |
|
27 | 28 |
/* from Linux's linux/virtio_pci.h */ |
... | ... | |
92 | 93 |
uint32_t addr; |
93 | 94 |
uint32_t class_code; |
94 | 95 |
uint32_t nvectors; |
95 |
DriveInfo *dinfo;
|
|
96 |
BlockConf block;
|
|
96 | 97 |
NICConf nic; |
97 | 98 |
uint32_t host_features; |
98 | 99 |
/* Max. number of ports we can have for a the virtio-serial device */ |
... | ... | |
457 | 458 |
proxy->class_code != PCI_CLASS_STORAGE_OTHER) |
458 | 459 |
proxy->class_code = PCI_CLASS_STORAGE_SCSI; |
459 | 460 |
|
460 |
if (!proxy->dinfo) { |
|
461 |
if (!proxy->block.dinfo) {
|
|
461 | 462 |
qemu_error("virtio-blk-pci: drive property not set\n"); |
462 | 463 |
return -1; |
463 | 464 |
} |
464 |
vdev = virtio_blk_init(&pci_dev->qdev, proxy->dinfo);
|
|
465 |
vdev = virtio_blk_init(&pci_dev->qdev, &proxy->block);
|
|
465 | 466 |
vdev->nvectors = proxy->nvectors; |
466 | 467 |
virtio_init_pci(proxy, vdev, |
467 | 468 |
PCI_VENDOR_ID_REDHAT_QUMRANET, |
... | ... | |
481 | 482 |
{ |
482 | 483 |
VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev); |
483 | 484 |
|
484 |
drive_uninit(proxy->dinfo); |
|
485 |
drive_uninit(proxy->block.dinfo);
|
|
485 | 486 |
return virtio_exit_pci(pci_dev); |
486 | 487 |
} |
487 | 488 |
|
... | ... | |
558 | 559 |
.exit = virtio_blk_exit_pci, |
559 | 560 |
.qdev.props = (Property[]) { |
560 | 561 |
DEFINE_PROP_HEX32("class", VirtIOPCIProxy, class_code, 0), |
561 |
DEFINE_PROP_DRIVE("drive", VirtIOPCIProxy, dinfo),
|
|
562 |
DEFINE_BLOCK_PROPERTIES(VirtIOPCIProxy, block),
|
|
562 | 563 |
DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 2), |
563 | 564 |
DEFINE_VIRTIO_BLK_FEATURES(VirtIOPCIProxy, host_features), |
564 | 565 |
DEFINE_PROP_END_OF_LIST(), |
Also available in: Unified diff