1 /*
2  * libqos Generic PCI bindings and generic pci host bridge
3  *
4  * Copyright Red Hat Inc., 2022
5  *
6  * Authors:
7  *  Eric Auger <eric.auger@redhat.com>
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 #ifndef LIBQOS_GENERIC_PCIHOST_H
14 #define LIBQOS_GENERIC_PCIHOST_H
15 
16 #include "pci.h"
17 #include "libqos-malloc.h"
18 #include "qgraph.h"
19 
20 typedef struct QGenericPCIBus {
21     QOSGraphObject obj;
22     QPCIBus bus;
23     uint64_t gpex_pio_base;
24     uint64_t ecam_alloc_ptr;
25 } QGenericPCIBus;
26 
27 /*
28  * qpci_init_generic():
29  * @ret: A valid QGenericPCIBus * pointer
30  * @qts: The %QTestState
31  * @alloc: A previously initialized @alloc providing memory for @qts
32  * @bool: devices can be hotplugged on this bus
33  *
34  * This function initializes an already allocated
35  * QGenericPCIBus object.
36  */
37 void qpci_init_generic(QGenericPCIBus *ret, QTestState *qts,
38                        QGuestAllocator *alloc, bool hotpluggable);
39 
40 /* QGenericPCIHost */
41 
42 typedef struct QGenericPCIHost QGenericPCIHost;
43 
44 struct QGenericPCIHost {
45     QOSGraphObject obj;
46     QGenericPCIBus pci;
47 };
48 
49 QOSGraphObject *generic_pcihost_get_device(void *obj, const char *device);
50 void qos_create_generic_pcihost(QGenericPCIHost *host,
51                                 QTestState *qts,
52                                 QGuestAllocator *alloc);
53 
54 #endif
55