| .. | .. |
|---|
| 15 | 15 | |
|---|
| 16 | 16 | struct pci_epf; |
|---|
| 17 | 17 | |
|---|
| 18 | +enum pci_notify_event { |
|---|
| 19 | + CORE_INIT, |
|---|
| 20 | + LINK_UP, |
|---|
| 21 | +}; |
|---|
| 22 | + |
|---|
| 18 | 23 | enum pci_barno { |
|---|
| 24 | + NO_BAR = -1, |
|---|
| 19 | 25 | BAR_0, |
|---|
| 20 | 26 | BAR_1, |
|---|
| 21 | 27 | BAR_2, |
|---|
| .. | .. |
|---|
| 55 | 61 | * @bind: ops to perform when a EPC device has been bound to EPF device |
|---|
| 56 | 62 | * @unbind: ops to perform when a binding has been lost between a EPC device |
|---|
| 57 | 63 | * and EPF device |
|---|
| 58 | | - * @linkup: ops to perform when the EPC device has established a connection with |
|---|
| 59 | | - * a host system |
|---|
| 60 | 64 | */ |
|---|
| 61 | 65 | struct pci_epf_ops { |
|---|
| 62 | 66 | int (*bind)(struct pci_epf *epf); |
|---|
| 63 | 67 | void (*unbind)(struct pci_epf *epf); |
|---|
| 64 | | - void (*linkup)(struct pci_epf *epf); |
|---|
| 65 | 68 | }; |
|---|
| 66 | 69 | |
|---|
| 67 | 70 | /** |
|---|
| .. | .. |
|---|
| 92 | 95 | /** |
|---|
| 93 | 96 | * struct pci_epf_bar - represents the BAR of EPF device |
|---|
| 94 | 97 | * @phys_addr: physical address that should be mapped to the BAR |
|---|
| 98 | + * @addr: virtual address corresponding to the @phys_addr |
|---|
| 95 | 99 | * @size: the size of the address space present in BAR |
|---|
| 96 | 100 | */ |
|---|
| 97 | 101 | struct pci_epf_bar { |
|---|
| 98 | 102 | dma_addr_t phys_addr; |
|---|
| 103 | + void *addr; |
|---|
| 99 | 104 | size_t size; |
|---|
| 100 | 105 | enum pci_barno barno; |
|---|
| 101 | 106 | int flags; |
|---|
| .. | .. |
|---|
| 112 | 117 | * @epc: the EPC device to which this EPF device is bound |
|---|
| 113 | 118 | * @driver: the EPF driver to which this EPF device is bound |
|---|
| 114 | 119 | * @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 |
|---|
| 115 | 122 | */ |
|---|
| 116 | 123 | struct pci_epf { |
|---|
| 117 | 124 | struct device dev; |
|---|
| .. | .. |
|---|
| 125 | 132 | struct pci_epc *epc; |
|---|
| 126 | 133 | struct pci_epf_driver *driver; |
|---|
| 127 | 134 | 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; |
|---|
| 128 | 151 | }; |
|---|
| 129 | 152 | |
|---|
| 130 | 153 | #define to_pci_epf(epf_dev) container_of((epf_dev), struct pci_epf, dev) |
|---|
| .. | .. |
|---|
| 149 | 172 | int __pci_epf_register_driver(struct pci_epf_driver *driver, |
|---|
| 150 | 173 | struct module *owner); |
|---|
| 151 | 174 | 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); |
|---|
| 153 | 177 | void pci_epf_free_space(struct pci_epf *epf, void *addr, enum pci_barno bar); |
|---|
| 154 | 178 | int pci_epf_bind(struct pci_epf *epf); |
|---|
| 155 | 179 | void pci_epf_unbind(struct pci_epf *epf); |
|---|
| 156 | | -void pci_epf_linkup(struct pci_epf *epf); |
|---|
| 157 | 180 | #endif /* __LINUX_PCI_EPF_H */ |
|---|