1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28#ifndef PCI_HOST_H
29#define PCI_HOST_H
30
31#include "hw/sysbus.h"
32
33#define TYPE_PCI_HOST_BRIDGE "pci-host-bridge"
34#define PCI_HOST_BRIDGE(obj) \
35 OBJECT_CHECK(PCIHostState, (obj), TYPE_PCI_HOST_BRIDGE)
36#define PCI_HOST_BRIDGE_CLASS(klass) \
37 OBJECT_CLASS_CHECK(PCIHostBridgeClass, (klass), TYPE_PCI_HOST_BRIDGE)
38#define PCI_HOST_BRIDGE_GET_CLASS(obj) \
39 OBJECT_GET_CLASS(PCIHostBridgeClass, (obj), TYPE_PCI_HOST_BRIDGE)
40
41struct PCIHostState {
42 SysBusDevice busdev;
43
44 MemoryRegion conf_mem;
45 MemoryRegion data_mem;
46 MemoryRegion mmcfg;
47 uint32_t config_reg;
48 PCIBus *bus;
49
50 QLIST_ENTRY(PCIHostState) next;
51};
52
53typedef struct PCIHostBridgeClass {
54 SysBusDeviceClass parent_class;
55
56 const char *(*root_bus_path)(PCIHostState *, PCIBus *);
57} PCIHostBridgeClass;
58
59
60void pci_host_config_write_common(PCIDevice *pci_dev, uint32_t addr,
61 uint32_t limit, uint32_t val, uint32_t len);
62uint32_t pci_host_config_read_common(PCIDevice *pci_dev, uint32_t addr,
63 uint32_t limit, uint32_t len);
64
65void pci_data_write(PCIBus *s, uint32_t addr, uint32_t val, int len);
66uint32_t pci_data_read(PCIBus *s, uint32_t addr, int len);
67
68extern const MemoryRegionOps pci_host_conf_le_ops;
69extern const MemoryRegionOps pci_host_conf_be_ops;
70extern const MemoryRegionOps pci_host_data_le_ops;
71extern const MemoryRegionOps pci_host_data_be_ops;
72
73#endif
74