]> git.proxmox.com Git - qemu.git/blob - hw/pci_internals.h
Merge remote-tracking branch 'mjt/mjt-iov2' into staging
[qemu.git] / hw / pci_internals.h
1 #ifndef QEMU_PCI_INTERNALS_H
2 #define QEMU_PCI_INTERNALS_H
3
4 /*
5 * This header files is private to pci.c and pci_bridge.c
6 * So following structures are opaque to others and shouldn't be
7 * accessed.
8 *
9 * For pci-to-pci bridge needs to include this header file to embed
10 * PCIBridge in its structure or to get sizeof(PCIBridge),
11 * However, they shouldn't access those following members directly.
12 * Use accessor function in pci.h, pci_bridge.h
13 */
14
15 #define TYPE_PCI_BUS "PCI"
16 #define PCI_BUS(obj) OBJECT_CHECK(PCIBus, (obj), TYPE_PCI_BUS)
17
18 struct PCIBus {
19 BusState qbus;
20 PCIDMAContextFunc dma_context_fn;
21 void *dma_context_opaque;
22 uint8_t devfn_min;
23 pci_set_irq_fn set_irq;
24 pci_map_irq_fn map_irq;
25 pci_hotplug_fn hotplug;
26 DeviceState *hotplug_qdev;
27 void *irq_opaque;
28 PCIDevice *devices[PCI_SLOT_MAX * PCI_FUNC_MAX];
29 PCIDevice *parent_dev;
30 MemoryRegion *address_space_mem;
31 MemoryRegion *address_space_io;
32
33 QLIST_HEAD(, PCIBus) child; /* this will be replaced by qdev later */
34 QLIST_ENTRY(PCIBus) sibling;/* this will be replaced by qdev later */
35
36 /* The bus IRQ state is the logical OR of the connected devices.
37 Keep a count of the number of devices with raised IRQs. */
38 int nirq;
39 int *irq_count;
40 };
41
42 struct PCIBridge {
43 PCIDevice dev;
44
45 /* private member */
46 PCIBus sec_bus;
47 /*
48 * Memory regions for the bridge's address spaces. These regions are not
49 * directly added to system_memory/system_io or its descendants.
50 * Bridge's secondary bus points to these, so that devices
51 * under the bridge see these regions as its address spaces.
52 * The regions are as large as the entire address space -
53 * they don't take into account any windows.
54 */
55 MemoryRegion address_space_mem;
56 MemoryRegion address_space_io;
57 /*
58 * Aliases for each of the address space windows that the bridge
59 * can forward. Mapped into the bridge's parent's address space,
60 * as subregions.
61 */
62 MemoryRegion alias_pref_mem;
63 MemoryRegion alias_mem;
64 MemoryRegion alias_io;
65 pci_map_irq_fn map_irq;
66 const char *bus_name;
67 };
68
69 #endif /* QEMU_PCI_INTERNALS_H */