diff options
author | Gavin Shan <gwshan@linux.vnet.ibm.com> | 2015-03-17 01:15:05 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2015-03-23 22:15:51 -0400 |
commit | e8e9b34cef237d4d6fdc0d350cd8a95d1adb9ee9 (patch) | |
tree | aa6d7d2300e27e621af79b4a252ee9aa93a4a893 /arch/powerpc/include/asm | |
parent | c035ff1d2eaa03ab40839041e955a86a8e412eb4 (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.h | 11 | ||||
-rw-r--r-- | arch/powerpc/include/asm/pci-bridge.h | 8 | ||||
-rw-r--r-- | arch/powerpc/include/asm/ppc-pci.h | 5 |
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 @@ | |||
30 | struct pci_dev; | 30 | struct pci_dev; |
31 | struct pci_bus; | 31 | struct pci_bus; |
32 | struct device_node; | 32 | struct device_node; |
33 | struct 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 | ||
151 | static inline struct pci_dn *eeh_dev_to_pdn(struct eeh_dev *edev) | ||
152 | { | ||
153 | return edev ? edev->pdn : NULL; | ||
154 | } | ||
155 | |||
149 | static inline struct pci_dev *eeh_dev_to_pci_dev(struct eeh_dev *edev) | 156 | static 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); | |||
272 | const char *eeh_pe_loc_get(struct eeh_pe *pe); | 279 | const char *eeh_pe_loc_get(struct eeh_pe *pe); |
273 | struct pci_bus *eeh_pe_bus_get(struct eeh_pe *pe); | 280 | struct pci_bus *eeh_pe_bus_get(struct eeh_pe *pe); |
274 | 281 | ||
275 | void *eeh_dev_init(struct device_node *dn, void *data); | 282 | void *eeh_dev_init(struct pci_dn *pdn, void *data); |
276 | void eeh_dev_phb_init_dynamic(struct pci_controller *phb); | 283 | void eeh_dev_phb_init_dynamic(struct pci_controller *phb); |
277 | int eeh_init(void); | 284 | int eeh_init(void); |
278 | int __init eeh_ops_register(struct eeh_ops *ops); | 285 | int __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 | ||
326 | static inline void *eeh_dev_init(struct device_node *dn, void *data) | 333 | static 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 | |||
217 | static 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 */ |
35 | struct device_node; | 35 | struct device_node; |
36 | struct pci_dn; | ||
37 | |||
36 | typedef void *(*traverse_func)(struct device_node *me, void *data); | 38 | typedef void *(*traverse_func)(struct device_node *me, void *data); |
37 | void *traverse_pci_devices(struct device_node *start, traverse_func pre, | 39 | void *traverse_pci_devices(struct device_node *start, traverse_func pre, |
38 | void *data); | 40 | void *data); |
41 | void *traverse_pci_dn(struct pci_dn *root, | ||
42 | void *(*fn)(struct pci_dn *, void *), | ||
43 | void *data); | ||
39 | 44 | ||
40 | extern void pci_devs_phb_init(void); | 45 | extern void pci_devs_phb_init(void); |
41 | extern void pci_devs_phb_init_dynamic(struct pci_controller *phb); | 46 | extern void pci_devs_phb_init_dynamic(struct pci_controller *phb); |