aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/include/asm
diff options
context:
space:
mode:
authorGavin Shan <gwshan@linux.vnet.ibm.com>2015-03-17 01:15:05 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2015-03-23 22:15:51 -0400
commite8e9b34cef237d4d6fdc0d350cd8a95d1adb9ee9 (patch)
treeaa6d7d2300e27e621af79b4a252ee9aa93a4a893 /arch/powerpc/include/asm
parentc035ff1d2eaa03ab40839041e955a86a8e412eb4 (diff)
powerpc/eeh: Create eeh_dev from pci_dn instead of device_node
The patch adds function traverse_pci_dn(), which is similar to traverse_pci_devices() except it takes pci_dn, not device_node as parameter. The pci_dev.c has been reworked to create eeh_dev from pci_dn, instead of device_node. Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/include/asm')
-rw-r--r--arch/powerpc/include/asm/eeh.h11
-rw-r--r--arch/powerpc/include/asm/pci-bridge.h8
-rw-r--r--arch/powerpc/include/asm/ppc-pci.h5
3 files changed, 21 insertions, 3 deletions
diff --git a/arch/powerpc/include/asm/eeh.h b/arch/powerpc/include/asm/eeh.h
index 55abfd09e47f..2106f83da2d5 100644
--- a/arch/powerpc/include/asm/eeh.h
+++ b/arch/powerpc/include/asm/eeh.h
@@ -30,6 +30,7 @@
30struct pci_dev; 30struct pci_dev;
31struct pci_bus; 31struct pci_bus;
32struct device_node; 32struct device_node;
33struct pci_dn;
33 34
34#ifdef CONFIG_EEH 35#ifdef CONFIG_EEH
35 36
@@ -137,6 +138,7 @@ struct eeh_dev {
137 struct list_head list; /* Form link list in the PE */ 138 struct list_head list; /* Form link list in the PE */
138 struct pci_controller *phb; /* Associated PHB */ 139 struct pci_controller *phb; /* Associated PHB */
139 struct device_node *dn; /* Associated device node */ 140 struct device_node *dn; /* Associated device node */
141 struct pci_dn *pdn; /* Associated PCI device node */
140 struct pci_dev *pdev; /* Associated PCI device */ 142 struct pci_dev *pdev; /* Associated PCI device */
141 struct pci_bus *bus; /* PCI bus for partial hotplug */ 143 struct pci_bus *bus; /* PCI bus for partial hotplug */
142}; 144};
@@ -146,6 +148,11 @@ static inline struct device_node *eeh_dev_to_of_node(struct eeh_dev *edev)
146 return edev ? edev->dn : NULL; 148 return edev ? edev->dn : NULL;
147} 149}
148 150
151static inline struct pci_dn *eeh_dev_to_pdn(struct eeh_dev *edev)
152{
153 return edev ? edev->pdn : NULL;
154}
155
149static inline struct pci_dev *eeh_dev_to_pci_dev(struct eeh_dev *edev) 156static inline struct pci_dev *eeh_dev_to_pci_dev(struct eeh_dev *edev)
150{ 157{
151 return edev ? edev->pdev : NULL; 158 return edev ? edev->pdev : NULL;
@@ -272,7 +279,7 @@ void eeh_pe_restore_bars(struct eeh_pe *pe);
272const char *eeh_pe_loc_get(struct eeh_pe *pe); 279const char *eeh_pe_loc_get(struct eeh_pe *pe);
273struct pci_bus *eeh_pe_bus_get(struct eeh_pe *pe); 280struct pci_bus *eeh_pe_bus_get(struct eeh_pe *pe);
274 281
275void *eeh_dev_init(struct device_node *dn, void *data); 282void *eeh_dev_init(struct pci_dn *pdn, void *data);
276void eeh_dev_phb_init_dynamic(struct pci_controller *phb); 283void eeh_dev_phb_init_dynamic(struct pci_controller *phb);
277int eeh_init(void); 284int eeh_init(void);
278int __init eeh_ops_register(struct eeh_ops *ops); 285int __init eeh_ops_register(struct eeh_ops *ops);
@@ -323,7 +330,7 @@ static inline int eeh_init(void)
323 return 0; 330 return 0;
324} 331}
325 332
326static inline void *eeh_dev_init(struct device_node *dn, void *data) 333static inline void *eeh_dev_init(struct pci_dn *pdn, void *data)
327{ 334{
328 return NULL; 335 return NULL;
329} 336}
diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
index 01b730a8a5a3..7b74499b728c 100644
--- a/arch/powerpc/include/asm/pci-bridge.h
+++ b/arch/powerpc/include/asm/pci-bridge.h
@@ -213,8 +213,14 @@ static inline struct eeh_dev *of_node_to_eeh_dev(struct device_node *dn)
213 213
214 return PCI_DN(dn)->edev; 214 return PCI_DN(dn)->edev;
215} 215}
216
217static inline struct eeh_dev *pdn_to_eeh_dev(struct pci_dn *pdn)
218{
219 return pdn ? pdn->edev : NULL;
220}
216#else 221#else
217#define of_node_to_eeh_dev(x) (NULL) 222#define of_node_to_eeh_dev(x) (NULL)
223#define pdn_to_eeh_dev(x) (NULL)
218#endif 224#endif
219 225
220/** Find the bus corresponding to the indicated device node */ 226/** Find the bus corresponding to the indicated device node */
diff --git a/arch/powerpc/include/asm/ppc-pci.h b/arch/powerpc/include/asm/ppc-pci.h
index db1e2b8eff3c..ade75238ceb5 100644
--- a/arch/powerpc/include/asm/ppc-pci.h
+++ b/arch/powerpc/include/asm/ppc-pci.h
@@ -33,9 +33,14 @@ extern struct pci_dev *isa_bridge_pcidev; /* may be NULL if no ISA bus */
33 33
34/* PCI device_node operations */ 34/* PCI device_node operations */
35struct device_node; 35struct device_node;
36struct pci_dn;
37
36typedef void *(*traverse_func)(struct device_node *me, void *data); 38typedef void *(*traverse_func)(struct device_node *me, void *data);
37void *traverse_pci_devices(struct device_node *start, traverse_func pre, 39void *traverse_pci_devices(struct device_node *start, traverse_func pre,
38 void *data); 40 void *data);
41void *traverse_pci_dn(struct pci_dn *root,
42 void *(*fn)(struct pci_dn *, void *),
43 void *data);
39 44
40extern void pci_devs_phb_init(void); 45extern void pci_devs_phb_init(void);
41extern void pci_devs_phb_init_dynamic(struct pci_controller *phb); 46extern void pci_devs_phb_init_dynamic(struct pci_controller *phb);