aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/hotplug/pnv_php.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/hotplug/pnv_php.c')
-rw-r--r--drivers/pci/hotplug/pnv_php.c34
1 files changed, 6 insertions, 28 deletions
diff --git a/drivers/pci/hotplug/pnv_php.c b/drivers/pci/hotplug/pnv_php.c
index 6086db6c0a48..e6245b03f0a1 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;
@@ -340,13 +317,14 @@ static int pnv_php_set_slot_power_state(struct hotplug_slot *slot,
340 return ret; 317 return ret;
341 } 318 }
342 319
343 if (state == OPAL_PCI_SLOT_POWER_OFF) 320 if (state == OPAL_PCI_SLOT_POWER_OFF || state == OPAL_PCI_SLOT_OFFLINE)
344 pnv_php_rmv_devtree(php_slot); 321 pnv_php_rmv_devtree(php_slot);
345 else 322 else
346 ret = pnv_php_add_devtree(php_slot); 323 ret = pnv_php_add_devtree(php_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{