diff options
-rw-r--r-- | arch/powerpc/include/asm/eeh.h | 3 | ||||
-rw-r--r-- | arch/powerpc/kernel/of_platform.c | 3 | ||||
-rw-r--r-- | arch/powerpc/kernel/pci-common.c | 7 | ||||
-rw-r--r-- | arch/powerpc/platforms/pseries/eeh.c | 24 |
4 files changed, 34 insertions, 3 deletions
diff --git a/arch/powerpc/include/asm/eeh.h b/arch/powerpc/include/asm/eeh.h index a8fb03e22770..a80e32b46c11 100644 --- a/arch/powerpc/include/asm/eeh.h +++ b/arch/powerpc/include/asm/eeh.h | |||
@@ -201,6 +201,7 @@ int eeh_dev_check_failure(struct eeh_dev *edev); | |||
201 | void __init eeh_addr_cache_build(void); | 201 | void __init eeh_addr_cache_build(void); |
202 | void eeh_add_device_tree_early(struct device_node *); | 202 | void eeh_add_device_tree_early(struct device_node *); |
203 | void eeh_add_device_tree_late(struct pci_bus *); | 203 | void eeh_add_device_tree_late(struct pci_bus *); |
204 | void eeh_add_sysfs_files(struct pci_bus *); | ||
204 | void eeh_remove_bus_device(struct pci_dev *, int); | 205 | void eeh_remove_bus_device(struct pci_dev *, int); |
205 | 206 | ||
206 | /** | 207 | /** |
@@ -240,6 +241,8 @@ static inline void eeh_add_device_tree_early(struct device_node *dn) { } | |||
240 | 241 | ||
241 | static inline void eeh_add_device_tree_late(struct pci_bus *bus) { } | 242 | static inline void eeh_add_device_tree_late(struct pci_bus *bus) { } |
242 | 243 | ||
244 | static inline void eeh_add_sysfs_files(struct pci_bus *bus) { } | ||
245 | |||
243 | static inline void eeh_remove_bus_device(struct pci_dev *dev, int purge_pe) { } | 246 | static inline void eeh_remove_bus_device(struct pci_dev *dev, int purge_pe) { } |
244 | 247 | ||
245 | static inline void eeh_lock(void) { } | 248 | static inline void eeh_lock(void) { } |
diff --git a/arch/powerpc/kernel/of_platform.c b/arch/powerpc/kernel/of_platform.c index 71c0469ab7fc..a7b743076720 100644 --- a/arch/powerpc/kernel/of_platform.c +++ b/arch/powerpc/kernel/of_platform.c | |||
@@ -91,6 +91,9 @@ static int of_pci_phb_probe(struct platform_device *dev) | |||
91 | /* Add probed PCI devices to the device model */ | 91 | /* Add probed PCI devices to the device model */ |
92 | pci_bus_add_devices(phb->bus); | 92 | pci_bus_add_devices(phb->bus); |
93 | 93 | ||
94 | /* sysfs files should only be added after devices are added */ | ||
95 | eeh_add_sysfs_files(phb->bus); | ||
96 | |||
94 | return 0; | 97 | return 0; |
95 | } | 98 | } |
96 | 99 | ||
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c index 7c37379ea9b1..fa12ae42d98c 100644 --- a/arch/powerpc/kernel/pci-common.c +++ b/arch/powerpc/kernel/pci-common.c | |||
@@ -1477,11 +1477,14 @@ void pcibios_finish_adding_to_bus(struct pci_bus *bus) | |||
1477 | pcibios_allocate_bus_resources(bus); | 1477 | pcibios_allocate_bus_resources(bus); |
1478 | pcibios_claim_one_bus(bus); | 1478 | pcibios_claim_one_bus(bus); |
1479 | 1479 | ||
1480 | /* Fixup EEH */ | ||
1481 | eeh_add_device_tree_late(bus); | ||
1482 | |||
1480 | /* Add new devices to global lists. Register in proc, sysfs. */ | 1483 | /* Add new devices to global lists. Register in proc, sysfs. */ |
1481 | pci_bus_add_devices(bus); | 1484 | pci_bus_add_devices(bus); |
1482 | 1485 | ||
1483 | /* Fixup EEH */ | 1486 | /* sysfs files should only be added after devices are added */ |
1484 | eeh_add_device_tree_late(bus); | 1487 | eeh_add_sysfs_files(bus); |
1485 | } | 1488 | } |
1486 | EXPORT_SYMBOL_GPL(pcibios_finish_adding_to_bus); | 1489 | EXPORT_SYMBOL_GPL(pcibios_finish_adding_to_bus); |
1487 | 1490 | ||
diff --git a/arch/powerpc/platforms/pseries/eeh.c b/arch/powerpc/platforms/pseries/eeh.c index 9a04322b1736..6b73d6c44f51 100644 --- a/arch/powerpc/platforms/pseries/eeh.c +++ b/arch/powerpc/platforms/pseries/eeh.c | |||
@@ -788,7 +788,6 @@ static void eeh_add_device_late(struct pci_dev *dev) | |||
788 | dev->dev.archdata.edev = edev; | 788 | dev->dev.archdata.edev = edev; |
789 | 789 | ||
790 | eeh_addr_cache_insert_dev(dev); | 790 | eeh_addr_cache_insert_dev(dev); |
791 | eeh_sysfs_add_device(dev); | ||
792 | } | 791 | } |
793 | 792 | ||
794 | /** | 793 | /** |
@@ -815,6 +814,29 @@ void eeh_add_device_tree_late(struct pci_bus *bus) | |||
815 | EXPORT_SYMBOL_GPL(eeh_add_device_tree_late); | 814 | EXPORT_SYMBOL_GPL(eeh_add_device_tree_late); |
816 | 815 | ||
817 | /** | 816 | /** |
817 | * eeh_add_sysfs_files - Add EEH sysfs files for the indicated PCI bus | ||
818 | * @bus: PCI bus | ||
819 | * | ||
820 | * This routine must be used to add EEH sysfs files for PCI | ||
821 | * devices which are attached to the indicated PCI bus. The PCI bus | ||
822 | * is added after system boot through hotplug or dlpar. | ||
823 | */ | ||
824 | void eeh_add_sysfs_files(struct pci_bus *bus) | ||
825 | { | ||
826 | struct pci_dev *dev; | ||
827 | |||
828 | list_for_each_entry(dev, &bus->devices, bus_list) { | ||
829 | eeh_sysfs_add_device(dev); | ||
830 | if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) { | ||
831 | struct pci_bus *subbus = dev->subordinate; | ||
832 | if (subbus) | ||
833 | eeh_add_sysfs_files(subbus); | ||
834 | } | ||
835 | } | ||
836 | } | ||
837 | EXPORT_SYMBOL_GPL(eeh_add_sysfs_files); | ||
838 | |||
839 | /** | ||
818 | * eeh_remove_device - Undo EEH setup for the indicated pci device | 840 | * eeh_remove_device - Undo EEH setup for the indicated pci device |
819 | * @dev: pci device to be removed | 841 | * @dev: pci device to be removed |
820 | * @purge_pe: remove the PE or not | 842 | * @purge_pe: remove the PE or not |