aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorGavin Shan <shangw@linux.vnet.ibm.com>2012-02-27 15:04:06 -0500
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2012-03-08 19:39:42 -0500
commitd50a7d4c6fc2a2055fdcb5d7af9605ae80385206 (patch)
treef43042a403130a256972d77a1968c3a0a74715b5 /arch
parent44da8edc6ade0fe53354bc6a4fd8ef9760fd7f2b (diff)
powerpc/eeh: Replace pci_dn with eeh_dev for EEH address cache
With original EEH implementation, struct pci_dn is used while building PCI I/O address cache, which helps on searching the corresponding PCI device according to the given physical I/O address. Besides, pci_dn is associated with the corresponding PCI device while building its I/O cache. The patch replaces struct pci_dn with struct eeh_dev so that EEH address cache won't depend on struct pci_dn. That will help EEH to become an independent module in future. Besides, the binding of eeh_dev and PCI device is done while building PCI device I/O cache. Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/platforms/pseries/eeh_cache.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/arch/powerpc/platforms/pseries/eeh_cache.c b/arch/powerpc/platforms/pseries/eeh_cache.c
index 7c36a9cc78c6..e5ae1c687c66 100644
--- a/arch/powerpc/platforms/pseries/eeh_cache.c
+++ b/arch/powerpc/platforms/pseries/eeh_cache.c
@@ -175,7 +175,7 @@ pci_addr_cache_insert(struct pci_dev *dev, unsigned long alo,
175static void __pci_addr_cache_insert_device(struct pci_dev *dev) 175static void __pci_addr_cache_insert_device(struct pci_dev *dev)
176{ 176{
177 struct device_node *dn; 177 struct device_node *dn;
178 struct pci_dn *pdn; 178 struct eeh_dev *edev;
179 int i; 179 int i;
180 180
181 dn = pci_device_to_OF_node(dev); 181 dn = pci_device_to_OF_node(dev);
@@ -184,13 +184,19 @@ static void __pci_addr_cache_insert_device(struct pci_dev *dev)
184 return; 184 return;
185 } 185 }
186 186
187 edev = of_node_to_eeh_dev(dn);
188 if (!edev) {
189 pr_warning("PCI: no EEH dev found for dn=%s\n",
190 dn->full_name);
191 return;
192 }
193
187 /* Skip any devices for which EEH is not enabled. */ 194 /* Skip any devices for which EEH is not enabled. */
188 pdn = PCI_DN(dn); 195 if (!(edev->mode & EEH_MODE_SUPPORTED) ||
189 if (!(pdn->eeh_mode & EEH_MODE_SUPPORTED) || 196 edev->mode & EEH_MODE_NOCHECK) {
190 pdn->eeh_mode & EEH_MODE_NOCHECK) {
191#ifdef DEBUG 197#ifdef DEBUG
192 printk(KERN_INFO "PCI: skip building address cache for=%s - %s\n", 198 pr_info("PCI: skip building address cache for=%s - %s\n",
193 pci_name(dev), pdn->node->full_name); 199 pci_name(dev), dn->full_name);
194#endif 200#endif
195 return; 201 return;
196 } 202 }
@@ -281,6 +287,7 @@ void pci_addr_cache_remove_device(struct pci_dev *dev)
281void __init pci_addr_cache_build(void) 287void __init pci_addr_cache_build(void)
282{ 288{
283 struct device_node *dn; 289 struct device_node *dn;
290 struct eeh_dev *edev;
284 struct pci_dev *dev = NULL; 291 struct pci_dev *dev = NULL;
285 292
286 spin_lock_init(&pci_io_addr_cache_root.piar_lock); 293 spin_lock_init(&pci_io_addr_cache_root.piar_lock);
@@ -291,8 +298,14 @@ void __init pci_addr_cache_build(void)
291 dn = pci_device_to_OF_node(dev); 298 dn = pci_device_to_OF_node(dev);
292 if (!dn) 299 if (!dn)
293 continue; 300 continue;
301
302 edev = of_node_to_eeh_dev(dn);
303 if (!edev)
304 continue;
305
294 pci_dev_get(dev); /* matching put is in eeh_remove_device() */ 306 pci_dev_get(dev); /* matching put is in eeh_remove_device() */
295 PCI_DN(dn)->pcidev = dev; 307 dev->dev.archdata.edev = edev;
308 edev->pdev = dev;
296 309
297 eeh_sysfs_add_device(dev); 310 eeh_sysfs_add_device(dev);
298 } 311 }