Merge branch 'linux-5.7' of git://github.com/skeggsb/linux into drm-fixes
[linux-2.6-microblaze.git] / include / linux / pci-epf.h
index 2d6f075..6644ff3 100644 (file)
 
 struct pci_epf;
 
+enum pci_notify_event {
+       CORE_INIT,
+       LINK_UP,
+};
+
 enum pci_barno {
        BAR_0,
        BAR_1,
@@ -55,13 +60,10 @@ struct pci_epf_header {
  * @bind: ops to perform when a EPC device has been bound to EPF device
  * @unbind: ops to perform when a binding has been lost between a EPC device
  *         and EPF device
- * @linkup: ops to perform when the EPC device has established a connection with
- *         a host system
  */
 struct pci_epf_ops {
        int     (*bind)(struct pci_epf *epf);
        void    (*unbind)(struct pci_epf *epf);
-       void    (*linkup)(struct pci_epf *epf);
 };
 
 /**
@@ -92,10 +94,12 @@ struct pci_epf_driver {
 /**
  * struct pci_epf_bar - represents the BAR of EPF device
  * @phys_addr: physical address that should be mapped to the BAR
+ * @addr: virtual address corresponding to the @phys_addr
  * @size: the size of the address space present in BAR
  */
 struct pci_epf_bar {
        dma_addr_t      phys_addr;
+       void            *addr;
        size_t          size;
        enum pci_barno  barno;
        int             flags;
@@ -112,6 +116,8 @@ struct pci_epf_bar {
  * @epc: the EPC device to which this EPF device is bound
  * @driver: the EPF driver to which this EPF device is bound
  * @list: to add pci_epf as a list of PCI endpoint functions to pci_epc
+ * @nb: notifier block to notify EPF of any EPC events (like linkup)
+ * @lock: mutex to protect pci_epf_ops
  */
 struct pci_epf {
        struct device           dev;
@@ -125,6 +131,22 @@ struct pci_epf {
        struct pci_epc          *epc;
        struct pci_epf_driver   *driver;
        struct list_head        list;
+       struct notifier_block   nb;
+       /* mutex to protect against concurrent access of pci_epf_ops */
+       struct mutex            lock;
+};
+
+/**
+ * struct pci_epf_msix_tbl - represents the MSIX table entry structure
+ * @msg_addr: Writes to this address will trigger MSIX interrupt in host
+ * @msg_data: Data that should be written to @msg_addr to trigger MSIX interrupt
+ * @vector_ctrl: Identifies if the function is prohibited from sending a message
+ * using this MSIX table entry
+ */
+struct pci_epf_msix_tbl {
+       u64 msg_addr;
+       u32 msg_data;
+       u32 vector_ctrl;
 };
 
 #define to_pci_epf(epf_dev) container_of((epf_dev), struct pci_epf, dev)
@@ -154,5 +176,4 @@ void *pci_epf_alloc_space(struct pci_epf *epf, size_t size, enum pci_barno bar,
 void pci_epf_free_space(struct pci_epf *epf, void *addr, enum pci_barno bar);
 int pci_epf_bind(struct pci_epf *epf);
 void pci_epf_unbind(struct pci_epf *epf);
-void pci_epf_linkup(struct pci_epf *epf);
 #endif /* __LINUX_PCI_EPF_H */