tests/libqos: virtio-pci driver and interface nodes

Add QOSGraphObject to QVirtioPCIDevice structure, with a basic
constructor. virtio-pci is not present in qgraph, since it
will be used as starting point by its subclasses (virtio-*-pci)

Signed-off-by: Emanuele Giuseppe Esposito <e.emanuelegiuseppe@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Emanuele Giuseppe Esposito 2018-07-18 16:02:41 +02:00 committed by Paolo Bonzini
parent b026393c34
commit 1ce66ecec0
4 changed files with 99 additions and 28 deletions

View file

@ -12,8 +12,10 @@
#include "libqos/virtio.h"
#include "libqos/pci.h"
#include "libqos/qgraph.h"
typedef struct QVirtioPCIDevice {
QOSGraphObject obj;
QVirtioDevice vdev;
QPCIDevice *pdev;
QPCIBar bar;
@ -31,11 +33,23 @@ typedef struct QVirtQueuePCI {
extern const QVirtioBus qvirtio_pci;
void virtio_pci_init(QVirtioPCIDevice *dev, QPCIBus *bus, QPCIAddress * addr);
QVirtioPCIDevice *virtio_pci_new(QPCIBus *bus, QPCIAddress * addr);
QVirtioPCIDevice *qvirtio_pci_device_find(QPCIBus *bus, uint16_t device_type);
QVirtioPCIDevice *qvirtio_pci_device_find_slot(QPCIBus *bus,
uint16_t device_type, int slot);
void qvirtio_pci_device_free(QVirtioPCIDevice *dev);
/* virtio-pci object functions available for subclasses that
* override the original start_hw and destroy
* function. All virtio-xxx-pci subclass that override must
* take care of calling these two functions in the respective
* places
*/
void qvirtio_pci_destructor(QOSGraphObject *obj);
void qvirtio_pci_start_hw(QOSGraphObject *obj);
void qvirtio_pci_device_enable(QVirtioPCIDevice *d);
void qvirtio_pci_device_disable(QVirtioPCIDevice *d);