]>
Commit | Line | Data |
---|---|---|
311e666a MM |
1 | /* |
2 | * libqos virtio PCI definitions | |
3 | * | |
4 | * Copyright (c) 2014 Marc Marí | |
5 | * | |
6 | * This work is licensed under the terms of the GNU GPL, version 2 or later. | |
7 | * See the COPYING file in the top-level directory. | |
8 | */ | |
9 | ||
10 | #ifndef LIBQOS_VIRTIO_PCI_H | |
11 | #define LIBQOS_VIRTIO_PCI_H | |
12 | ||
13 | #include "libqos/virtio.h" | |
14 | #include "libqos/pci.h" | |
1ce66ece | 15 | #include "libqos/qgraph.h" |
58368113 | 16 | |
311e666a | 17 | typedef struct QVirtioPCIDevice { |
1ce66ece | 18 | QOSGraphObject obj; |
311e666a MM |
19 | QVirtioDevice vdev; |
20 | QPCIDevice *pdev; | |
b4ba67d9 | 21 | QPCIBar bar; |
58368113 MM |
22 | uint16_t config_msix_entry; |
23 | uint64_t config_msix_addr; | |
24 | uint32_t config_msix_data; | |
311e666a MM |
25 | } QVirtioPCIDevice; |
26 | ||
58368113 MM |
27 | typedef struct QVirtQueuePCI { |
28 | QVirtQueue vq; | |
29 | uint16_t msix_entry; | |
30 | uint64_t msix_addr; | |
31 | uint32_t msix_data; | |
32 | } QVirtQueuePCI; | |
33 | ||
46e0cf76 MM |
34 | extern const QVirtioBus qvirtio_pci; |
35 | ||
1ce66ece EGE |
36 | void virtio_pci_init(QVirtioPCIDevice *dev, QPCIBus *bus, QPCIAddress * addr); |
37 | QVirtioPCIDevice *virtio_pci_new(QPCIBus *bus, QPCIAddress * addr); | |
0c0eb302 | 38 | |
1ce66ece EGE |
39 | /* virtio-pci object functions available for subclasses that |
40 | * override the original start_hw and destroy | |
41 | * function. All virtio-xxx-pci subclass that override must | |
42 | * take care of calling these two functions in the respective | |
43 | * places | |
44 | */ | |
45 | void qvirtio_pci_destructor(QOSGraphObject *obj); | |
46 | void qvirtio_pci_start_hw(QOSGraphObject *obj); | |
47 | ||
48 | ||
46e0cf76 MM |
49 | void qvirtio_pci_device_enable(QVirtioPCIDevice *d); |
50 | void qvirtio_pci_device_disable(QVirtioPCIDevice *d); | |
58368113 MM |
51 | |
52 | void qvirtio_pci_set_msix_configuration_vector(QVirtioPCIDevice *d, | |
53 | QGuestAllocator *alloc, uint16_t entry); | |
54 | void qvirtqueue_pci_msix_setup(QVirtioPCIDevice *d, QVirtQueuePCI *vqpci, | |
55 | QGuestAllocator *alloc, uint16_t entry); | |
311e666a | 56 | #endif |