aboutsummaryrefslogtreecommitdiff
path: root/hw/virtio-console.c
diff options
context:
space:
mode:
authorPaul Brook <paul@codesourcery.com>2009-05-18 14:51:59 +0100
committerPaul Brook <paul@codesourcery.com>2009-05-18 18:26:33 +0100
commit53c25cea7d59525ca9aa3fb01cc6947bafbbfb61 (patch)
tree3556ba85599852e60d9570d41b01897d5a61aafc /hw/virtio-console.c
parentd8ee7665bfc7846c7fc6bfb96434eca68e5bec1a (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-console.c')
-rw-r--r--hw/virtio-console.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/hw/virtio-console.c b/hw/virtio-console.c
index 7f3efa0129..04f8873b3b 100644
--- a/hw/virtio-console.c
+++ b/hw/virtio-console.c
@@ -123,31 +123,21 @@ static int virtio_console_load(QEMUFile *f, void *opaque, int version_id)
return 0;
}
-static void virtio_console_init(PCIDevice *pci_dev)
+VirtIODevice *virtio_console_init(DeviceState *dev)
{
VirtIOConsole *s;
- s = (VirtIOConsole *)virtio_init_pci(pci_dev, "virtio-console",
- PCI_VENDOR_ID_REDHAT_QUMRANET,
- PCI_DEVICE_ID_VIRTIO_CONSOLE,
- PCI_VENDOR_ID_REDHAT_QUMRANET,
- VIRTIO_ID_CONSOLE,
- PCI_CLASS_DISPLAY_OTHER, 0x00,
- 0);
+ s = (VirtIOConsole *)virtio_common_init("virtio-console",
+ VIRTIO_ID_CONSOLE,
+ 0, sizeof(VirtIOConsole));
s->vdev.get_features = virtio_console_get_features;
s->ivq = virtio_add_queue(&s->vdev, 128, virtio_console_handle_input);
s->dvq = virtio_add_queue(&s->vdev, 128, virtio_console_handle_output);
- s->chr = qdev_init_chardev(&pci_dev->qdev);
+ s->chr = qdev_init_chardev(dev);
qemu_chr_add_handlers(s->chr, vcon_can_read, vcon_read, vcon_event, s);
register_savevm("virtio-console", -1, 1, virtio_console_save, virtio_console_load, s);
-}
-static void virtio_console_register_devices(void)
-{
- pci_qdev_register("virtio-console", sizeof(VirtIOConsole),
- virtio_console_init);
+ return &s->vdev;
}
-
-device_init(virtio_console_register_devices)