170be1d93SEric Auger /* 270be1d93SEric Auger * libqos Generic PCI bindings and generic pci host bridge 370be1d93SEric Auger * 470be1d93SEric Auger * Copyright Red Hat Inc., 2022 570be1d93SEric Auger * 670be1d93SEric Auger * Authors: 770be1d93SEric Auger * Eric Auger <eric.auger@redhat.com> 870be1d93SEric Auger * 970be1d93SEric Auger * This work is licensed under the terms of the GNU GPL, version 2 or later. 1070be1d93SEric Auger * See the COPYING file in the top-level directory. 1170be1d93SEric Auger */ 1270be1d93SEric Auger 1370be1d93SEric Auger #ifndef LIBQOS_GENERIC_PCIHOST_H 1470be1d93SEric Auger #define LIBQOS_GENERIC_PCIHOST_H 1570be1d93SEric Auger 1670be1d93SEric Auger #include "pci.h" 17b243c73cSXuzhou Cheng #include "libqos-malloc.h" 1870be1d93SEric Auger #include "qgraph.h" 1970be1d93SEric Auger 2070be1d93SEric Auger typedef struct QGenericPCIBus { 2170be1d93SEric Auger QOSGraphObject obj; 2270be1d93SEric Auger QPCIBus bus; 2370be1d93SEric Auger uint64_t gpex_pio_base; 2470be1d93SEric Auger uint64_t ecam_alloc_ptr; 2570be1d93SEric Auger } QGenericPCIBus; 2670be1d93SEric Auger 2770be1d93SEric Auger /* 2870be1d93SEric Auger * qpci_init_generic(): 2970be1d93SEric Auger * @ret: A valid QGenericPCIBus * pointer 3070be1d93SEric Auger * @qts: The %QTestState 3170be1d93SEric Auger * @alloc: A previously initialized @alloc providing memory for @qts 3270be1d93SEric Auger * @bool: devices can be hotplugged on this bus 3370be1d93SEric Auger * 3470be1d93SEric Auger * This function initializes an already allocated 3570be1d93SEric Auger * QGenericPCIBus object. 3670be1d93SEric Auger */ 3770be1d93SEric Auger void qpci_init_generic(QGenericPCIBus *ret, QTestState *qts, 3870be1d93SEric Auger QGuestAllocator *alloc, bool hotpluggable); 3970be1d93SEric Auger 4070be1d93SEric Auger /* QGenericPCIHost */ 4170be1d93SEric Auger 4270be1d93SEric Auger typedef struct QGenericPCIHost QGenericPCIHost; 4370be1d93SEric Auger 4470be1d93SEric Auger struct QGenericPCIHost { 4570be1d93SEric Auger QOSGraphObject obj; 4670be1d93SEric Auger QGenericPCIBus pci; 4770be1d93SEric Auger }; 4870be1d93SEric Auger 4970be1d93SEric Auger QOSGraphObject *generic_pcihost_get_device(void *obj, const char *device); 5070be1d93SEric Auger void qos_create_generic_pcihost(QGenericPCIHost *host, 5170be1d93SEric Auger QTestState *qts, 5270be1d93SEric Auger QGuestAllocator *alloc); 5370be1d93SEric Auger 5470be1d93SEric Auger #endif 55