1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21#ifndef QEMU_PCIE_PORT_H
22#define QEMU_PCIE_PORT_H
23
24#include "hw/pci/pci_bridge.h"
25#include "hw/pci/pci_bus.h"
26
27#define TYPE_PCIE_PORT "pcie-port"
28#define PCIE_PORT(obj) OBJECT_CHECK(PCIEPort, (obj), TYPE_PCIE_PORT)
29
30struct PCIEPort {
31
32 PCIBridge parent_obj;
33
34
35
36 uint8_t port;
37};
38
39void pcie_port_init_reg(PCIDevice *d);
40
41#define TYPE_PCIE_SLOT "pcie-slot"
42#define PCIE_SLOT(obj) OBJECT_CHECK(PCIESlot, (obj), TYPE_PCIE_SLOT)
43
44struct PCIESlot {
45
46 PCIEPort parent_obj;
47
48
49
50 uint8_t chassis;
51 uint16_t slot;
52
53 PCIExpLinkSpeed speed;
54 PCIExpLinkWidth width;
55
56
57 bool disable_acs;
58 QLIST_ENTRY(PCIESlot) next;
59};
60
61void pcie_chassis_create(uint8_t chassis_number);
62PCIESlot *pcie_chassis_find_slot(uint8_t chassis, uint16_t slot);
63int pcie_chassis_add_slot(struct PCIESlot *slot);
64void pcie_chassis_del_slot(PCIESlot *s);
65
66#define TYPE_PCIE_ROOT_PORT "pcie-root-port-base"
67#define PCIE_ROOT_PORT_CLASS(klass) \
68 OBJECT_CLASS_CHECK(PCIERootPortClass, (klass), TYPE_PCIE_ROOT_PORT)
69#define PCIE_ROOT_PORT_GET_CLASS(obj) \
70 OBJECT_GET_CLASS(PCIERootPortClass, (obj), TYPE_PCIE_ROOT_PORT)
71
72typedef struct PCIERootPortClass {
73 PCIDeviceClass parent_class;
74 DeviceRealize parent_realize;
75
76 uint8_t (*aer_vector)(const PCIDevice *dev);
77 int (*interrupts_init)(PCIDevice *dev, Error **errp);
78 void (*interrupts_uninit)(PCIDevice *dev);
79
80 int exp_offset;
81 int aer_offset;
82 int ssvid_offset;
83 int acs_offset;
84 int ssid;
85} PCIERootPortClass;
86
87#endif
88