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-net.c | |
parent | d8ee7665bfc7846c7fc6bfb96434eca68e5bec1a (diff) | |
download | hqemu-53c25cea7d59525ca9aa3fb01cc6947bafbbfb61.zip hqemu-53c25cea7d59525ca9aa3fb01cc6947bafbbfb61.tar.gz |
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-net.c')
-rw-r--r-- | hw/virtio-net.c | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/hw/virtio-net.c b/hw/virtio-net.c index 3764170..60aa6da 100644 --- a/hw/virtio-net.c +++ b/hw/virtio-net.c @@ -585,18 +585,14 @@ static void virtio_net_cleanup(VLANClientState *vc) virtio_cleanup(&n->vdev); } -static void virtio_net_init(PCIDevice *pci_dev) +VirtIODevice *virtio_net_init(DeviceState *dev) { VirtIONet *n; static int virtio_net_id; - n = (VirtIONet *)virtio_init_pci(pci_dev, "virtio-net", - PCI_VENDOR_ID_REDHAT_QUMRANET, - PCI_DEVICE_ID_VIRTIO_NET, - PCI_VENDOR_ID_REDHAT_QUMRANET, - VIRTIO_ID_NET, - PCI_CLASS_NETWORK_ETHERNET, 0x00, - sizeof(struct virtio_net_config)); + n = (VirtIONet *)virtio_common_init("virtio-net", VIRTIO_ID_NET, + sizeof(struct virtio_net_config), + sizeof(VirtIONet)); n->vdev.get_config = virtio_net_get_config; n->vdev.set_config = virtio_net_set_config; @@ -607,9 +603,9 @@ static void virtio_net_init(PCIDevice *pci_dev) n->rx_vq = virtio_add_queue(&n->vdev, 256, virtio_net_handle_rx); n->tx_vq = virtio_add_queue(&n->vdev, 256, virtio_net_handle_tx); n->ctrl_vq = virtio_add_queue(&n->vdev, 16, virtio_net_handle_ctrl); - qdev_get_macaddr(&pci_dev->qdev, n->mac); + qdev_get_macaddr(dev, n->mac); n->status = VIRTIO_NET_S_LINK_UP; - n->vc = qdev_get_vlan_client(&pci_dev->qdev, + n->vc = qdev_get_vlan_client(dev, virtio_net_receive, virtio_net_can_receive, virtio_net_cleanup, n); @@ -628,11 +624,6 @@ static void virtio_net_init(PCIDevice *pci_dev) register_savevm("virtio-net", virtio_net_id++, VIRTIO_NET_VM_VERSION, virtio_net_save, virtio_net_load, n); -} -static void virtio_net_register_devices(void) -{ - pci_qdev_register("virtio_net", sizeof(VirtIONet), virtio_net_init); + return &n->vdev; } - -device_init(virtio_net_register_devices) |