2014-09-01 18:07:54 +08:00
|
|
|
/*
|
|
|
|
* libqos virtio PCI definitions
|
|
|
|
*
|
|
|
|
* Copyright (c) 2014 Marc Marí
|
|
|
|
*
|
|
|
|
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
|
|
|
* See the COPYING file in the top-level directory.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef LIBQOS_VIRTIO_PCI_H
|
|
|
|
#define LIBQOS_VIRTIO_PCI_H
|
|
|
|
|
|
|
|
#include "libqos/virtio.h"
|
|
|
|
#include "libqos/pci.h"
|
2014-09-01 18:07:59 +08:00
|
|
|
|
2014-09-01 18:07:54 +08:00
|
|
|
typedef struct QVirtioPCIDevice {
|
|
|
|
QVirtioDevice vdev;
|
|
|
|
QPCIDevice *pdev;
|
2016-10-24 12:52:06 +08:00
|
|
|
QPCIBar bar;
|
2014-09-01 18:07:59 +08:00
|
|
|
uint16_t config_msix_entry;
|
|
|
|
uint64_t config_msix_addr;
|
|
|
|
uint32_t config_msix_data;
|
2014-09-01 18:07:54 +08:00
|
|
|
} QVirtioPCIDevice;
|
|
|
|
|
2014-09-01 18:07:59 +08:00
|
|
|
typedef struct QVirtQueuePCI {
|
|
|
|
QVirtQueue vq;
|
|
|
|
uint16_t msix_entry;
|
|
|
|
uint64_t msix_addr;
|
|
|
|
uint32_t msix_data;
|
|
|
|
} QVirtQueuePCI;
|
|
|
|
|
2014-09-01 18:07:55 +08:00
|
|
|
extern const QVirtioBus qvirtio_pci;
|
|
|
|
|
2014-09-01 18:07:54 +08:00
|
|
|
QVirtioPCIDevice *qvirtio_pci_device_find(QPCIBus *bus, uint16_t device_type);
|
2017-02-07 20:53:11 +08:00
|
|
|
QVirtioPCIDevice *qvirtio_pci_device_find_slot(QPCIBus *bus,
|
|
|
|
uint16_t device_type, int slot);
|
2017-02-03 20:06:12 +08:00
|
|
|
void qvirtio_pci_device_free(QVirtioPCIDevice *dev);
|
|
|
|
|
2014-09-01 18:07:55 +08:00
|
|
|
void qvirtio_pci_device_enable(QVirtioPCIDevice *d);
|
|
|
|
void qvirtio_pci_device_disable(QVirtioPCIDevice *d);
|
2014-09-01 18:07:59 +08:00
|
|
|
|
|
|
|
void qvirtio_pci_set_msix_configuration_vector(QVirtioPCIDevice *d,
|
|
|
|
QGuestAllocator *alloc, uint16_t entry);
|
|
|
|
void qvirtqueue_pci_msix_setup(QVirtioPCIDevice *d, QVirtQueuePCI *vqpci,
|
|
|
|
QGuestAllocator *alloc, uint16_t entry);
|
2014-09-01 18:07:54 +08:00
|
|
|
#endif
|