Statistics
| Branch: | Revision:

root / hw / pci_internals.h @ 2558e0a6

History | View | Annotate | Download (2 kB)

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