Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20160614' into staging
[qemu/kevin.git] / tests / libqos / virtio-pci.h
blob8f0e52ad474956757ef590140efc46b371eaa7d7
1 /*
2 * libqos virtio PCI definitions
4 * Copyright (c) 2014 Marc MarĂ­
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 */
10 #ifndef LIBQOS_VIRTIO_PCI_H
11 #define LIBQOS_VIRTIO_PCI_H
13 #include "libqos/virtio.h"
14 #include "libqos/pci.h"
16 #define QVIRTIO_PCI_DEVICE_FEATURES 0x00
17 #define QVIRTIO_PCI_GUEST_FEATURES 0x04
18 #define QVIRTIO_PCI_QUEUE_ADDRESS 0x08
19 #define QVIRTIO_PCI_QUEUE_SIZE 0x0C
20 #define QVIRTIO_PCI_QUEUE_SELECT 0x0E
21 #define QVIRTIO_PCI_QUEUE_NOTIFY 0x10
22 #define QVIRTIO_PCI_DEVICE_STATUS 0x12
23 #define QVIRTIO_PCI_ISR_STATUS 0x13
24 #define QVIRTIO_PCI_MSIX_CONF_VECTOR 0x14
25 #define QVIRTIO_PCI_MSIX_QUEUE_VECTOR 0x16
26 #define QVIRTIO_PCI_DEVICE_SPECIFIC_MSIX 0x18
27 #define QVIRTIO_PCI_DEVICE_SPECIFIC_NO_MSIX 0x14
29 #define QVIRTIO_PCI_ALIGN 4096
31 #define QVIRTIO_MSI_NO_VECTOR 0xFFFF
33 typedef struct QVirtioPCIDevice {
34 QVirtioDevice vdev;
35 QPCIDevice *pdev;
36 void *addr;
37 uint16_t config_msix_entry;
38 uint64_t config_msix_addr;
39 uint32_t config_msix_data;
40 } QVirtioPCIDevice;
42 typedef struct QVirtQueuePCI {
43 QVirtQueue vq;
44 uint16_t msix_entry;
45 uint64_t msix_addr;
46 uint32_t msix_data;
47 } QVirtQueuePCI;
49 extern const QVirtioBus qvirtio_pci;
51 void qvirtio_pci_foreach(QPCIBus *bus, uint16_t device_type,
52 void (*func)(QVirtioDevice *d, void *data), void *data);
53 QVirtioPCIDevice *qvirtio_pci_device_find(QPCIBus *bus, uint16_t device_type);
54 void qvirtio_pci_device_enable(QVirtioPCIDevice *d);
55 void qvirtio_pci_device_disable(QVirtioPCIDevice *d);
57 void qvirtio_pci_set_msix_configuration_vector(QVirtioPCIDevice *d,
58 QGuestAllocator *alloc, uint16_t entry);
59 void qvirtqueue_pci_msix_setup(QVirtioPCIDevice *d, QVirtQueuePCI *vqpci,
60 QGuestAllocator *alloc, uint16_t entry);
61 #endif