Statistics
| Branch: | Revision:

root / hw / pci_internals.h @ a9605e03

History | View | Annotate | Download (2.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 0d936928 Anthony Liguori
#define TYPE_PCI_BUS "PCI"
16 0d936928 Anthony Liguori
#define PCI_BUS(obj) OBJECT_CHECK(PCIBus, (obj), TYPE_PCI_BUS)
17 cfb0a50a Isaku Yamahata
18 cfb0a50a Isaku Yamahata
struct PCIBus {
19 cfb0a50a Isaku Yamahata
    BusState qbus;
20 5fa45de5 David Gibson
    PCIDMAContextFunc dma_context_fn;
21 5fa45de5 David Gibson
    void *dma_context_opaque;
22 6f3279b5 Isaku Yamahata
    uint8_t devfn_min;
23 cfb0a50a Isaku Yamahata
    pci_set_irq_fn set_irq;
24 cfb0a50a Isaku Yamahata
    pci_map_irq_fn map_irq;
25 3afa9bb4 Michael S. Tsirkin
    pci_route_irq_fn route_intx_to_irq;
26 cfb0a50a Isaku Yamahata
    pci_hotplug_fn hotplug;
27 cfb0a50a Isaku Yamahata
    DeviceState *hotplug_qdev;
28 cfb0a50a Isaku Yamahata
    void *irq_opaque;
29 90a20dbb Isaku Yamahata
    PCIDevice *devices[PCI_SLOT_MAX * PCI_FUNC_MAX];
30 cfb0a50a Isaku Yamahata
    PCIDevice *parent_dev;
31 5968eca3 Avi Kivity
    MemoryRegion *address_space_mem;
32 5968eca3 Avi Kivity
    MemoryRegion *address_space_io;
33 cfb0a50a Isaku Yamahata
34 cfb0a50a Isaku Yamahata
    QLIST_HEAD(, PCIBus) child; /* this will be replaced by qdev later */
35 cfb0a50a Isaku Yamahata
    QLIST_ENTRY(PCIBus) sibling;/* this will be replaced by qdev later */
36 cfb0a50a Isaku Yamahata
37 cfb0a50a Isaku Yamahata
    /* The bus IRQ state is the logical OR of the connected devices.
38 cfb0a50a Isaku Yamahata
       Keep a count of the number of devices with raised IRQs.  */
39 cfb0a50a Isaku Yamahata
    int nirq;
40 cfb0a50a Isaku Yamahata
    int *irq_count;
41 cfb0a50a Isaku Yamahata
};
42 cfb0a50a Isaku Yamahata
43 68f79994 Isaku Yamahata
struct PCIBridge {
44 cfb0a50a Isaku Yamahata
    PCIDevice dev;
45 68f79994 Isaku Yamahata
46 68f79994 Isaku Yamahata
    /* private member */
47 7e98e3af Isaku Yamahata
    PCIBus sec_bus;
48 336411ca Michael S. Tsirkin
    /*
49 336411ca Michael S. Tsirkin
     * Memory regions for the bridge's address spaces.  These regions are not
50 336411ca Michael S. Tsirkin
     * directly added to system_memory/system_io or its descendants.
51 336411ca Michael S. Tsirkin
     * Bridge's secondary bus points to these, so that devices
52 336411ca Michael S. Tsirkin
     * under the bridge see these regions as its address spaces.
53 336411ca Michael S. Tsirkin
     * The regions are as large as the entire address space -
54 336411ca Michael S. Tsirkin
     * they don't take into account any windows.
55 336411ca Michael S. Tsirkin
     */
56 336411ca Michael S. Tsirkin
    MemoryRegion address_space_mem;
57 336411ca Michael S. Tsirkin
    MemoryRegion address_space_io;
58 336411ca Michael S. Tsirkin
    /*
59 336411ca Michael S. Tsirkin
     * Aliases for each of the address space windows that the bridge
60 336411ca Michael S. Tsirkin
     * can forward. Mapped into the bridge's parent's address space,
61 336411ca Michael S. Tsirkin
     * as subregions.
62 336411ca Michael S. Tsirkin
     */
63 7df32ca0 Michael S. Tsirkin
    MemoryRegion alias_pref_mem;
64 7df32ca0 Michael S. Tsirkin
    MemoryRegion alias_mem;
65 7df32ca0 Michael S. Tsirkin
    MemoryRegion alias_io;
66 68f79994 Isaku Yamahata
    pci_map_irq_fn map_irq;
67 68f79994 Isaku Yamahata
    const char *bus_name;
68 68f79994 Isaku Yamahata
};
69 cfb0a50a Isaku Yamahata
70 cfb0a50a Isaku Yamahata
#endif /* QEMU_PCI_INTERNALS_H */