diff options
-rw-r--r-- | arch/powerpc/platforms/pseries/eeh_cache.c | 27 |
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, | |||
175 | static void __pci_addr_cache_insert_device(struct pci_dev *dev) | 175 | static 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) | |||
281 | void __init pci_addr_cache_build(void) | 287 | void __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 | } |