PCI/hotplug: pnv_php: export symbols and move struct types needed by cxl
authorAndrew Donnellan <andrew.donnellan@au1.ibm.com>
Wed, 13 Jul 2016 21:17:12 +0000 (07:17 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 14 Jul 2016 10:28:08 +0000 (20:28 +1000)
The cxl driver will use infrastructure from pnv_php to handle device tree
updates when switching bi-modal CAPI cards into CAPI mode.

To enable this, export pnv_php_find_slot() and
pnv_php_set_slot_power_state(), and add corresponding declarations, as well
as the definition of struct pnv_php_slot, to asm/pnv-pci.h.

Cc: Gavin Shan <gwshan@linux.vnet.ibm.com>
Cc: linux-pci@vger.kernel.org
Cc: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Signed-off-by: Ian Munsie <imunsie@au1.ibm.com>
Acked-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/include/asm/pnv-pci.h
drivers/pci/hotplug/pnv_php.c

index c47097f7f6ab6b616bb5b615e233caa78d8212e7..0cbd8134ce81949f8bf079181a7180aa55ee9abb 100644 (file)
@@ -11,6 +11,7 @@
 #define _ASM_PNV_PCI_H
 
 #include <linux/pci.h>
+#include <linux/pci_hotplug.h>
 #include <misc/cxl-base.h>
 #include <asm/opal-api.h>
 
@@ -47,4 +48,31 @@ void pnv_cxl_phb_set_peer_afu(struct pci_dev *dev, struct cxl_afu *afu);
 
 #endif
 
+struct pnv_php_slot {
+       struct hotplug_slot             slot;
+       struct hotplug_slot_info        slot_info;
+       uint64_t                        id;
+       char                            *name;
+       int                             slot_no;
+       struct kref                     kref;
+#define PNV_PHP_STATE_INITIALIZED      0
+#define PNV_PHP_STATE_REGISTERED       1
+#define PNV_PHP_STATE_POPULATED                2
+#define PNV_PHP_STATE_OFFLINE          3
+       int                             state;
+       struct device_node              *dn;
+       struct pci_dev                  *pdev;
+       struct pci_bus                  *bus;
+       bool                            power_state_check;
+       void                            *fdt;
+       void                            *dt;
+       struct of_changeset             ocs;
+       struct pnv_php_slot             *parent;
+       struct list_head                children;
+       struct list_head                link;
+};
+extern struct pnv_php_slot *pnv_php_find_slot(struct device_node *dn);
+extern int pnv_php_set_slot_power_state(struct hotplug_slot *slot,
+                                       uint8_t state);
+
 #endif
index 6086db6c0a489471c7a54cab47ed799e060424cc..2d2f704e1e97784a8088345ccd3dd9c4662a7eb1 100644 (file)
 #define DRIVER_AUTHOR  "Gavin Shan, IBM Corporation"
 #define DRIVER_DESC    "PowerPC PowerNV PCI Hotplug Driver"
 
-struct pnv_php_slot {
-       struct hotplug_slot             slot;
-       struct hotplug_slot_info        slot_info;
-       uint64_t                        id;
-       char                            *name;
-       int                             slot_no;
-       struct kref                     kref;
-#define PNV_PHP_STATE_INITIALIZED      0
-#define PNV_PHP_STATE_REGISTERED       1
-#define PNV_PHP_STATE_POPULATED                2
-#define PNV_PHP_STATE_OFFLINE          3
-       int                             state;
-       struct device_node              *dn;
-       struct pci_dev                  *pdev;
-       struct pci_bus                  *bus;
-       bool                            power_state_check;
-       void                            *fdt;
-       void                            *dt;
-       struct of_changeset             ocs;
-       struct pnv_php_slot             *parent;
-       struct list_head                children;
-       struct list_head                link;
-};
-
 static LIST_HEAD(pnv_php_slot_list);
 static DEFINE_SPINLOCK(pnv_php_lock);
 
@@ -91,7 +67,7 @@ static struct pnv_php_slot *pnv_php_match(struct device_node *dn,
        return NULL;
 }
 
-static struct pnv_php_slot *pnv_php_find_slot(struct device_node *dn)
+struct pnv_php_slot *pnv_php_find_slot(struct device_node *dn)
 {
        struct pnv_php_slot *php_slot, *tmp;
        unsigned long flags;
@@ -108,6 +84,7 @@ static struct pnv_php_slot *pnv_php_find_slot(struct device_node *dn)
 
        return NULL;
 }
+EXPORT_SYMBOL_GPL(pnv_php_find_slot);
 
 /*
  * Remove pdn for all children of the indicated device node.
@@ -316,8 +293,8 @@ out:
        return ret;
 }
 
-static int pnv_php_set_slot_power_state(struct hotplug_slot *slot,
-                                       uint8_t state)
+int pnv_php_set_slot_power_state(struct hotplug_slot *slot,
+                                uint8_t state)
 {
        struct pnv_php_slot *php_slot = slot->private;
        struct opal_msg msg;
@@ -347,6 +324,7 @@ static int pnv_php_set_slot_power_state(struct hotplug_slot *slot,
 
        return ret;
 }
+EXPORT_SYMBOL_GPL(pnv_php_set_slot_power_state);
 
 static int pnv_php_get_power_state(struct hotplug_slot *slot, u8 *state)
 {