hc
2024-05-10 37f49e37ab4cb5d0bc4c60eb5c6d4dd57db767bb
kernel/include/linux/pci-epf.h
....@@ -15,7 +15,13 @@
1515
1616 struct pci_epf;
1717
18
+enum pci_notify_event {
19
+ CORE_INIT,
20
+ LINK_UP,
21
+};
22
+
1823 enum pci_barno {
24
+ NO_BAR = -1,
1925 BAR_0,
2026 BAR_1,
2127 BAR_2,
....@@ -55,13 +61,10 @@
5561 * @bind: ops to perform when a EPC device has been bound to EPF device
5662 * @unbind: ops to perform when a binding has been lost between a EPC device
5763 * and EPF device
58
- * @linkup: ops to perform when the EPC device has established a connection with
59
- * a host system
6064 */
6165 struct pci_epf_ops {
6266 int (*bind)(struct pci_epf *epf);
6367 void (*unbind)(struct pci_epf *epf);
64
- void (*linkup)(struct pci_epf *epf);
6568 };
6669
6770 /**
....@@ -92,10 +95,12 @@
9295 /**
9396 * struct pci_epf_bar - represents the BAR of EPF device
9497 * @phys_addr: physical address that should be mapped to the BAR
98
+ * @addr: virtual address corresponding to the @phys_addr
9599 * @size: the size of the address space present in BAR
96100 */
97101 struct pci_epf_bar {
98102 dma_addr_t phys_addr;
103
+ void *addr;
99104 size_t size;
100105 enum pci_barno barno;
101106 int flags;
....@@ -112,6 +117,8 @@
112117 * @epc: the EPC device to which this EPF device is bound
113118 * @driver: the EPF driver to which this EPF device is bound
114119 * @list: to add pci_epf as a list of PCI endpoint functions to pci_epc
120
+ * @nb: notifier block to notify EPF of any EPC events (like linkup)
121
+ * @lock: mutex to protect pci_epf_ops
115122 */
116123 struct pci_epf {
117124 struct device dev;
....@@ -125,6 +132,22 @@
125132 struct pci_epc *epc;
126133 struct pci_epf_driver *driver;
127134 struct list_head list;
135
+ struct notifier_block nb;
136
+ /* mutex to protect against concurrent access of pci_epf_ops */
137
+ struct mutex lock;
138
+};
139
+
140
+/**
141
+ * struct pci_epf_msix_tbl - represents the MSIX table entry structure
142
+ * @msg_addr: Writes to this address will trigger MSIX interrupt in host
143
+ * @msg_data: Data that should be written to @msg_addr to trigger MSIX interrupt
144
+ * @vector_ctrl: Identifies if the function is prohibited from sending a message
145
+ * using this MSIX table entry
146
+ */
147
+struct pci_epf_msix_tbl {
148
+ u64 msg_addr;
149
+ u32 msg_data;
150
+ u32 vector_ctrl;
128151 };
129152
130153 #define to_pci_epf(epf_dev) container_of((epf_dev), struct pci_epf, dev)
....@@ -149,9 +172,9 @@
149172 int __pci_epf_register_driver(struct pci_epf_driver *driver,
150173 struct module *owner);
151174 void pci_epf_unregister_driver(struct pci_epf_driver *driver);
152
-void *pci_epf_alloc_space(struct pci_epf *epf, size_t size, enum pci_barno bar);
175
+void *pci_epf_alloc_space(struct pci_epf *epf, size_t size, enum pci_barno bar,
176
+ size_t align);
153177 void pci_epf_free_space(struct pci_epf *epf, void *addr, enum pci_barno bar);
154178 int pci_epf_bind(struct pci_epf *epf);
155179 void pci_epf_unbind(struct pci_epf *epf);
156
-void pci_epf_linkup(struct pci_epf *epf);
157180 #endif /* __LINUX_PCI_EPF_H */