| 1 | /* |
| 2 | * Virtio video device |
| 3 | * |
| 4 | * Copyright Red Hat |
| 5 | * |
| 6 | * Authors: |
| 7 | * Dave Airlie |
| 8 | * |
| 9 | * This work is licensed under the terms of the GNU GPL, version 2 or later. |
| 10 | * See the COPYING file in the top-level directory. |
| 11 | * |
| 12 | */ |
| 13 | |
| 14 | #include "qemu/osdep.h" |
| 15 | #include "qapi/error.h" |
| 16 | #include "qemu/module.h" |
| 17 | #include "hw/pci/pci.h" |
| 18 | #include "hw/core/qdev-properties.h" |
| 19 | #include "hw/virtio/virtio.h" |
| 20 | #include "hw/virtio/virtio-bus.h" |
| 21 | #include "hw/virtio/virtio-gpu-pci.h" |
| 22 | #include "qom/object.h" |
| 23 | |
| 24 | #define TYPE_VIRTIO_GPU_GL_PCI "virtio-gpu-gl-pci" |
| 25 | typedef struct VirtIOGPUGLPCI VirtIOGPUGLPCI; |
| 26 | DECLARE_INSTANCE_CHECKER(VirtIOGPUGLPCI, VIRTIO_GPU_GL_PCI, |
| 27 | TYPE_VIRTIO_GPU_GL_PCI) |
| 28 | |
| 29 | struct VirtIOGPUGLPCI { |
| 30 | VirtIOGPUPCIBase parent_obj; |
| 31 | VirtIOGPUGL vdev; |
| 32 | }; |
| 33 | |
| 34 | static void virtio_gpu_gl_initfn(Object *obj) |
| 35 | { |
| 36 | VirtIOGPUGLPCI *dev = VIRTIO_GPU_GL_PCI(obj); |
| 37 | |
| 38 | virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), |
| 39 | TYPE_VIRTIO_GPU_GL); |
| 40 | VIRTIO_GPU_PCI_BASE(obj)->vgpu = VIRTIO_GPU_BASE(&dev->vdev); |
| 41 | } |
| 42 | |
| 43 | static const VirtioPCIDeviceTypeInfo virtio_gpu_gl_pci_info = { |
| 44 | .generic_name = TYPE_VIRTIO_GPU_GL_PCI, |
| 45 | .parent = TYPE_VIRTIO_GPU_PCI_BASE, |
| 46 | .instance_size = sizeof(VirtIOGPUGLPCI), |
| 47 | .instance_init = virtio_gpu_gl_initfn, |
| 48 | }; |
| 49 | module_obj(TYPE_VIRTIO_GPU_GL_PCI); |
| 50 | module_kconfig(VIRTIO_PCI); |
| 51 | |
| 52 | static void virtio_gpu_gl_pci_register_types(void) |
| 53 | { |
| 54 | virtio_pci_types_register(&virtio_gpu_gl_pci_info); |
| 55 | } |
| 56 | |
| 57 | type_init(virtio_gpu_gl_pci_register_types) |
| 58 | |
| 59 | module_dep("hw-display-virtio-gpu-pci"); |