120599463SMichael S. Tsirkin #ifndef QEMU_PCI_BUS_H 220599463SMichael S. Tsirkin #define QEMU_PCI_BUS_H 3cfb0a50aSIsaku Yamahata 4cfb0a50aSIsaku Yamahata /* 5*791bf3c8SDavid Gibson * PCI Bus datastructures. 668f79994SIsaku Yamahata * 7952deab6SMichael S. Tsirkin * Do not access the following members directly; 8*791bf3c8SDavid Gibson * use accessor functions in pci.h 9cfb0a50aSIsaku Yamahata */ 10cfb0a50aSIsaku Yamahata 11ce6a28eeSMarcel Apfelbaum typedef struct PCIBusClass { 12ce6a28eeSMarcel Apfelbaum /*< private >*/ 13ce6a28eeSMarcel Apfelbaum BusClass parent_class; 14ce6a28eeSMarcel Apfelbaum /*< public >*/ 15ce6a28eeSMarcel Apfelbaum 16ce6a28eeSMarcel Apfelbaum bool (*is_root)(PCIBus *bus); 17602141d9SMarcel Apfelbaum int (*bus_num)(PCIBus *bus); 186a3042b2SMarcel Apfelbaum uint16_t (*numa_node)(PCIBus *bus); 19ce6a28eeSMarcel Apfelbaum } PCIBusClass; 20ce6a28eeSMarcel Apfelbaum 21cfb0a50aSIsaku Yamahata struct PCIBus { 22cfb0a50aSIsaku Yamahata BusState qbus; 23e00387d5SAvi Kivity PCIIOMMUFunc iommu_fn; 24e00387d5SAvi Kivity void *iommu_opaque; 256f3279b5SIsaku Yamahata uint8_t devfn_min; 268b884984SMark Cave-Ayland uint32_t slot_reserved_mask; 27cfb0a50aSIsaku Yamahata pci_set_irq_fn set_irq; 28cfb0a50aSIsaku Yamahata pci_map_irq_fn map_irq; 293afa9bb4SMichael S. Tsirkin pci_route_irq_fn route_intx_to_irq; 30cfb0a50aSIsaku Yamahata void *irq_opaque; 3190a20dbbSIsaku Yamahata PCIDevice *devices[PCI_SLOT_MAX * PCI_FUNC_MAX]; 32cfb0a50aSIsaku Yamahata PCIDevice *parent_dev; 335968eca3SAvi Kivity MemoryRegion *address_space_mem; 345968eca3SAvi Kivity MemoryRegion *address_space_io; 35cfb0a50aSIsaku Yamahata 36cfb0a50aSIsaku Yamahata QLIST_HEAD(, PCIBus) child; /* this will be replaced by qdev later */ 37cfb0a50aSIsaku Yamahata QLIST_ENTRY(PCIBus) sibling;/* this will be replaced by qdev later */ 38cfb0a50aSIsaku Yamahata 39cfb0a50aSIsaku Yamahata /* The bus IRQ state is the logical OR of the connected devices. 40cfb0a50aSIsaku Yamahata Keep a count of the number of devices with raised IRQs. */ 41cfb0a50aSIsaku Yamahata int nirq; 42cfb0a50aSIsaku Yamahata int *irq_count; 43b86eacb8SMarcel Apfelbaum 44b86eacb8SMarcel Apfelbaum Notifier machine_done; 45cfb0a50aSIsaku Yamahata }; 46cfb0a50aSIsaku Yamahata 4720599463SMichael S. Tsirkin #endif /* QEMU_PCI_BUS_H */ 48