monitor/qmp: Update comment for commit 4eaca8de268
[qemu/armbru.git] / hw / virtio / virtio-9p-pci.c
blob22a183cca7e5292f2c90e7938e4d9326c6993105
1 /*
2 * Virtio 9p PCI Bindings
4 * Copyright IBM, Corp. 2010
6 * Authors:
7 * Anthony Liguori <aliguori@us.ibm.com>
9 * This work is licensed under the terms of the GNU GPL, version 2. See
10 * the COPYING file in the top-level directory.
12 * Contributions after 2012-01-13 are licensed under the terms of the
13 * GNU GPL, version 2 or (at your option) any later version.
16 #include "qemu/osdep.h"
18 #include "virtio-pci.h"
19 #include "hw/9pfs/virtio-9p.h"
20 #include "hw/qdev-properties.h"
21 #include "qemu/module.h"
24 * virtio-9p-pci: This extends VirtioPCIProxy.
27 #define TYPE_VIRTIO_9P_PCI "virtio-9p-pci-base"
28 #define VIRTIO_9P_PCI(obj) \
29 OBJECT_CHECK(V9fsPCIState, (obj), TYPE_VIRTIO_9P_PCI)
31 typedef struct V9fsPCIState {
32 VirtIOPCIProxy parent_obj;
33 V9fsVirtioState vdev;
34 } V9fsPCIState;
36 static void virtio_9p_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
38 V9fsPCIState *dev = VIRTIO_9P_PCI(vpci_dev);
39 DeviceState *vdev = DEVICE(&dev->vdev);
41 qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus));
42 object_property_set_bool(OBJECT(vdev), true, "realized", errp);
45 static Property virtio_9p_pci_properties[] = {
46 DEFINE_PROP_BIT("ioeventfd", VirtIOPCIProxy, flags,
47 VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT, true),
48 DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 2),
49 DEFINE_PROP_END_OF_LIST(),
52 static void virtio_9p_pci_class_init(ObjectClass *klass, void *data)
54 DeviceClass *dc = DEVICE_CLASS(klass);
55 PCIDeviceClass *pcidev_k = PCI_DEVICE_CLASS(klass);
56 VirtioPCIClass *k = VIRTIO_PCI_CLASS(klass);
58 k->realize = virtio_9p_pci_realize;
59 pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
60 pcidev_k->device_id = PCI_DEVICE_ID_VIRTIO_9P;
61 pcidev_k->revision = VIRTIO_PCI_ABI_VERSION;
62 pcidev_k->class_id = 0x2;
63 set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
64 dc->props = virtio_9p_pci_properties;
67 static void virtio_9p_pci_instance_init(Object *obj)
69 V9fsPCIState *dev = VIRTIO_9P_PCI(obj);
71 virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
72 TYPE_VIRTIO_9P);
75 static const VirtioPCIDeviceTypeInfo virtio_9p_pci_info = {
76 .base_name = TYPE_VIRTIO_9P_PCI,
77 .generic_name = "virtio-9p-pci",
78 .transitional_name = "virtio-9p-pci-transitional",
79 .non_transitional_name = "virtio-9p-pci-non-transitional",
80 .instance_size = sizeof(V9fsPCIState),
81 .instance_init = virtio_9p_pci_instance_init,
82 .class_init = virtio_9p_pci_class_init,
85 static void virtio_9p_pci_register(void)
87 virtio_pci_types_register(&virtio_9p_pci_info);
90 type_init(virtio_9p_pci_register)