aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Donnellan <andrew.donnellan@au1.ibm.com>2016-07-13 17:17:12 -0400
committerMichael Ellerman <mpe@ellerman.id.au>2016-07-14 06:28:08 -0400
commit89379f165a1be13aa9b4731a9095171142ee1c7b (patch)
tree81daaed5e7b5e494ae497c2ddf09791658ceca05
parentf67a6722d650b864b020b19b3926e7152b55f1ff (diff)
PCI/hotplug: pnv_php: export symbols and move struct types needed by cxl
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>
-rw-r--r--arch/powerpc/include/asm/pnv-pci.h28
-rw-r--r--drivers/pci/hotplug/pnv_php.c32
2 files changed, 33 insertions, 27 deletions
diff --git a/arch/powerpc/include/asm/pnv-pci.h b/arch/powerpc/include/asm/pnv-pci.h
index c47097f7f6ab..0cbd8134ce81 100644
--- a/arch/powerpc/include/asm/pnv-pci.h
+++ b/arch/powerpc/include/asm/pnv-pci.h
@@ -11,6 +11,7 @@
11#define _ASM_PNV_PCI_H 11#define _ASM_PNV_PCI_H
12 12
13#include <linux/pci.h> 13#include <linux/pci.h>
14#include <linux/pci_hotplug.h>
14#include <misc/cxl-base.h> 15#include <misc/cxl-base.h>
15#include <asm/opal-api.h> 16#include <asm/opal-api.h>
16 17
@@ -47,4 +48,31 @@ void pnv_cxl_phb_set_peer_afu(struct pci_dev *dev, struct cxl_afu *afu);
47 48
48#endif 49#endif
49 50
51struct pnv_php_slot {
52 struct hotplug_slot slot;
53 struct hotplug_slot_info slot_info;
54 uint64_t id;
55 char *name;
56 int slot_no;
57 struct kref kref;
58#define PNV_PHP_STATE_INITIALIZED 0
59#define PNV_PHP_STATE_REGISTERED 1
60#define PNV_PHP_STATE_POPULATED 2
61#define PNV_PHP_STATE_OFFLINE 3
62 int state;
63 struct device_node *dn;
64 struct pci_dev *pdev;
65 struct pci_bus *bus;
66 bool power_state_check;
67 void *fdt;
68 void *dt;
69 struct of_changeset ocs;
70 struct pnv_php_slot *parent;
71 struct list_head children;
72 struct list_head link;
73};
74extern struct pnv_php_slot *pnv_php_find_slot(struct device_node *dn);
75extern int pnv_php_set_slot_power_state(struct hotplug_slot *slot,
76 uint8_t state);
77
50#endif 78#endif
diff --git a/drivers/pci/hotplug/pnv_php.c b/drivers/pci/hotplug/pnv_php.c
index 6086db6c0a48..2d2f704e1e97 100644
--- a/drivers/pci/hotplug/pnv_php.c
+++ b/drivers/pci/hotplug/pnv_php.c
@@ -22,30 +22,6 @@
22#define DRIVER_AUTHOR "Gavin Shan, IBM Corporation" 22#define DRIVER_AUTHOR "Gavin Shan, IBM Corporation"
23#define DRIVER_DESC "PowerPC PowerNV PCI Hotplug Driver" 23#define DRIVER_DESC "PowerPC PowerNV PCI Hotplug Driver"
24 24
25struct pnv_php_slot {
26 struct hotplug_slot slot;
27 struct hotplug_slot_info slot_info;
28 uint64_t id;
29 char *name;
30 int slot_no;
31 struct kref kref;
32#define PNV_PHP_STATE_INITIALIZED 0
33#define PNV_PHP_STATE_REGISTERED 1
34#define PNV_PHP_STATE_POPULATED 2
35#define PNV_PHP_STATE_OFFLINE 3
36 int state;
37 struct device_node *dn;
38 struct pci_dev *pdev;
39 struct pci_bus *bus;
40 bool power_state_check;
41 void *fdt;
42 void *dt;
43 struct of_changeset ocs;
44 struct pnv_php_slot *parent;
45 struct list_head children;
46 struct list_head link;
47};
48
49static LIST_HEAD(pnv_php_slot_list); 25static LIST_HEAD(pnv_php_slot_list);
50static DEFINE_SPINLOCK(pnv_php_lock); 26static DEFINE_SPINLOCK(pnv_php_lock);
51 27
@@ -91,7 +67,7 @@ static struct pnv_php_slot *pnv_php_match(struct device_node *dn,
91 return NULL; 67 return NULL;
92} 68}
93 69
94static struct pnv_php_slot *pnv_php_find_slot(struct device_node *dn) 70struct pnv_php_slot *pnv_php_find_slot(struct device_node *dn)
95{ 71{
96 struct pnv_php_slot *php_slot, *tmp; 72 struct pnv_php_slot *php_slot, *tmp;
97 unsigned long flags; 73 unsigned long flags;
@@ -108,6 +84,7 @@ static struct pnv_php_slot *pnv_php_find_slot(struct device_node *dn)
108 84
109 return NULL; 85 return NULL;
110} 86}
87EXPORT_SYMBOL_GPL(pnv_php_find_slot);
111 88
112/* 89/*
113 * Remove pdn for all children of the indicated device node. 90 * Remove pdn for all children of the indicated device node.
@@ -316,8 +293,8 @@ out:
316 return ret; 293 return ret;
317} 294}
318 295
319static int pnv_php_set_slot_power_state(struct hotplug_slot *slot, 296int pnv_php_set_slot_power_state(struct hotplug_slot *slot,
320 uint8_t state) 297 uint8_t state)
321{ 298{
322 struct pnv_php_slot *php_slot = slot->private; 299 struct pnv_php_slot *php_slot = slot->private;
323 struct opal_msg msg; 300 struct opal_msg msg;
@@ -347,6 +324,7 @@ static int pnv_php_set_slot_power_state(struct hotplug_slot *slot,
347 324
348 return ret; 325 return ret;
349} 326}
327EXPORT_SYMBOL_GPL(pnv_php_set_slot_power_state);
350 328
351static int pnv_php_get_power_state(struct hotplug_slot *slot, u8 *state) 329static int pnv_php_get_power_state(struct hotplug_slot *slot, u8 *state)
352{ 330{