Statistics
| Branch: | Revision:

root / include / hw / pci / pci_bus.h @ f487b677

History | View | Annotate | Download (2.2 kB)

1 20599463 Michael S. Tsirkin
#ifndef QEMU_PCI_BUS_H
2 20599463 Michael S. Tsirkin
#define QEMU_PCI_BUS_H
3 cfb0a50a Isaku Yamahata
4 cfb0a50a Isaku Yamahata
/*
5 952deab6 Michael S. Tsirkin
 * PCI Bus and Bridge datastructures.
6 68f79994 Isaku Yamahata
 *
7 952deab6 Michael S. Tsirkin
 * Do not access the following members directly;
8 952deab6 Michael S. Tsirkin
 * use accessor functions in pci.h, pci_bridge.h
9 cfb0a50a Isaku Yamahata
 */
10 cfb0a50a Isaku Yamahata
11 cfb0a50a Isaku Yamahata
struct PCIBus {
12 cfb0a50a Isaku Yamahata
    BusState qbus;
13 e00387d5 Avi Kivity
    PCIIOMMUFunc iommu_fn;
14 e00387d5 Avi Kivity
    void *iommu_opaque;
15 6f3279b5 Isaku Yamahata
    uint8_t devfn_min;
16 cfb0a50a Isaku Yamahata
    pci_set_irq_fn set_irq;
17 cfb0a50a Isaku Yamahata
    pci_map_irq_fn map_irq;
18 3afa9bb4 Michael S. Tsirkin
    pci_route_irq_fn route_intx_to_irq;
19 cfb0a50a Isaku Yamahata
    pci_hotplug_fn hotplug;
20 cfb0a50a Isaku Yamahata
    DeviceState *hotplug_qdev;
21 cfb0a50a Isaku Yamahata
    void *irq_opaque;
22 90a20dbb Isaku Yamahata
    PCIDevice *devices[PCI_SLOT_MAX * PCI_FUNC_MAX];
23 cfb0a50a Isaku Yamahata
    PCIDevice *parent_dev;
24 5968eca3 Avi Kivity
    MemoryRegion *address_space_mem;
25 5968eca3 Avi Kivity
    MemoryRegion *address_space_io;
26 cfb0a50a Isaku Yamahata
27 cfb0a50a Isaku Yamahata
    QLIST_HEAD(, PCIBus) child; /* this will be replaced by qdev later */
28 cfb0a50a Isaku Yamahata
    QLIST_ENTRY(PCIBus) sibling;/* this will be replaced by qdev later */
29 cfb0a50a Isaku Yamahata
30 cfb0a50a Isaku Yamahata
    /* The bus IRQ state is the logical OR of the connected devices.
31 cfb0a50a Isaku Yamahata
       Keep a count of the number of devices with raised IRQs.  */
32 cfb0a50a Isaku Yamahata
    int nirq;
33 cfb0a50a Isaku Yamahata
    int *irq_count;
34 cfb0a50a Isaku Yamahata
};
35 cfb0a50a Isaku Yamahata
36 b308c82c Avi Kivity
typedef struct PCIBridgeWindows PCIBridgeWindows;
37 b308c82c Avi Kivity
38 b308c82c Avi Kivity
/*
39 b308c82c Avi Kivity
 * Aliases for each of the address space windows that the bridge
40 b308c82c Avi Kivity
 * can forward. Mapped into the bridge's parent's address space,
41 b308c82c Avi Kivity
 * as subregions.
42 b308c82c Avi Kivity
 */
43 b308c82c Avi Kivity
struct PCIBridgeWindows {
44 b308c82c Avi Kivity
    MemoryRegion alias_pref_mem;
45 b308c82c Avi Kivity
    MemoryRegion alias_mem;
46 b308c82c Avi Kivity
    MemoryRegion alias_io;
47 ba7d8515 Alex Williamson
    /*
48 ba7d8515 Alex Williamson
     * When bridge control VGA forwarding is enabled, bridges will
49 ba7d8515 Alex Williamson
     * provide positive decode on the PCI VGA defined I/O port and
50 ba7d8515 Alex Williamson
     * MMIO ranges.  When enabled forwarding is only qualified on the
51 ba7d8515 Alex Williamson
     * I/O and memory enable bits in the bridge command register.
52 ba7d8515 Alex Williamson
     */
53 ba7d8515 Alex Williamson
    MemoryRegion alias_vga[QEMU_PCI_VGA_NUM_REGIONS];
54 b308c82c Avi Kivity
};
55 b308c82c Avi Kivity
56 68f79994 Isaku Yamahata
struct PCIBridge {
57 cfb0a50a Isaku Yamahata
    PCIDevice dev;
58 68f79994 Isaku Yamahata
59 68f79994 Isaku Yamahata
    /* private member */
60 7e98e3af Isaku Yamahata
    PCIBus sec_bus;
61 336411ca Michael S. Tsirkin
    /*
62 336411ca Michael S. Tsirkin
     * Memory regions for the bridge's address spaces.  These regions are not
63 336411ca Michael S. Tsirkin
     * directly added to system_memory/system_io or its descendants.
64 336411ca Michael S. Tsirkin
     * Bridge's secondary bus points to these, so that devices
65 336411ca Michael S. Tsirkin
     * under the bridge see these regions as its address spaces.
66 336411ca Michael S. Tsirkin
     * The regions are as large as the entire address space -
67 336411ca Michael S. Tsirkin
     * they don't take into account any windows.
68 336411ca Michael S. Tsirkin
     */
69 336411ca Michael S. Tsirkin
    MemoryRegion address_space_mem;
70 336411ca Michael S. Tsirkin
    MemoryRegion address_space_io;
71 b308c82c Avi Kivity
72 b308c82c Avi Kivity
    PCIBridgeWindows *windows;
73 b308c82c Avi Kivity
74 68f79994 Isaku Yamahata
    pci_map_irq_fn map_irq;
75 68f79994 Isaku Yamahata
    const char *bus_name;
76 68f79994 Isaku Yamahata
};
77 cfb0a50a Isaku Yamahata
78 20599463 Michael S. Tsirkin
#endif /* QEMU_PCI_BUS_H */