diff options
author | Paul Brook <paul@codesourcery.com> | 2009-05-18 14:51:59 +0100 |
---|---|---|
committer | Paul Brook <paul@codesourcery.com> | 2009-05-18 18:26:33 +0100 |
commit | 53c25cea7d59525ca9aa3fb01cc6947bafbbfb61 (patch) | |
tree | 3556ba85599852e60d9570d41b01897d5a61aafc /hw/virtio-blk.c | |
parent | d8ee7665bfc7846c7fc6bfb96434eca68e5bec1a (diff) |
Separate virtio PCI code
Split the PCI host bindings from the VRing transport implementation.
Signed-off-by: Paul Brook <paul@codesourcery.com>
Diffstat (limited to 'hw/virtio-blk.c')
-rw-r--r-- | hw/virtio-blk.c | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c index ef091131b8..8dd3c7ac52 100644 --- a/hw/virtio-blk.c +++ b/hw/virtio-blk.c @@ -348,28 +348,24 @@ static int virtio_blk_load(QEMUFile *f, void *opaque, int version_id) return 0; } -static void virtio_blk_init(PCIDevice *pci_dev) +VirtIODevice *virtio_blk_init(DeviceState *dev) { VirtIOBlock *s; int cylinders, heads, secs; static int virtio_blk_id; BlockDriverState *bs; - s = (VirtIOBlock *)virtio_init_pci(pci_dev, "virtio-blk", - PCI_VENDOR_ID_REDHAT_QUMRANET, - PCI_DEVICE_ID_VIRTIO_BLOCK, - PCI_VENDOR_ID_REDHAT_QUMRANET, - VIRTIO_ID_BLOCK, - PCI_CLASS_STORAGE_OTHER, 0x00, - sizeof(struct virtio_blk_config)); + s = (VirtIOBlock *)virtio_common_init("virtio-blk", VIRTIO_ID_BLOCK, + sizeof(struct virtio_blk_config), + sizeof(VirtIOBlock)); - bs = qdev_init_bdrv(&pci_dev->qdev, IF_VIRTIO); + bs = qdev_init_bdrv(dev, IF_VIRTIO); s->vdev.get_config = virtio_blk_update_config; s->vdev.get_features = virtio_blk_get_features; s->vdev.reset = virtio_blk_reset; s->bs = bs; s->rq = NULL; - bs->private = &s->vdev.pci_dev; + bs->private = dev; bdrv_guess_geometry(s->bs, &cylinders, &heads, &secs); bdrv_set_geometry_hint(s->bs, cylinders, heads, secs); @@ -378,11 +374,6 @@ static void virtio_blk_init(PCIDevice *pci_dev) qemu_add_vm_change_state_handler(virtio_blk_dma_restart_cb, s); register_savevm("virtio-blk", virtio_blk_id++, 2, virtio_blk_save, virtio_blk_load, s); -} -static void virtio_blk_register_devices(void) -{ - pci_qdev_register("virtio-blk", sizeof(VirtIOBlock), virtio_blk_init); + return &s->vdev; } - -device_init(virtio_blk_register_devices) |