diff options
author | Gavin Shan <shangw@linux.vnet.ibm.com> | 2012-02-27 15:03:52 -0500 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2012-03-08 19:08:37 -0500 |
commit | cce4b2d243ddd9e8d5da159b893117afd7ccad5c (patch) | |
tree | f81cfaeebc8168f93f2aa46e1e41c6f3b6ae51c8 /arch/powerpc | |
parent | cb3bc9d0de1e247268622acd40e0d2f8120f299c (diff) |
powerpc/eeh: Cleanup function names in the EEH core
The EEH has been implemented on pSeries platform. The original
code looks a little bit nasty. The patch does cleanup on the
current EEH implementation so that it looks more clean.
* Try adding prefix "eeh" for functions.
* Some function names have been adjusted so that they looks
shorter and meaningful.
Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/include/asm/ppc-pci.h | 8 | ||||
-rw-r--r-- | arch/powerpc/platforms/pseries/eeh.c | 102 | ||||
-rw-r--r-- | arch/powerpc/platforms/pseries/eeh_driver.c | 10 | ||||
-rw-r--r-- | arch/powerpc/platforms/pseries/msi.c | 2 |
4 files changed, 59 insertions, 63 deletions
diff --git a/arch/powerpc/include/asm/ppc-pci.h b/arch/powerpc/include/asm/ppc-pci.h index 221d82fd8231..605a97000fcf 100644 --- a/arch/powerpc/include/asm/ppc-pci.h +++ b/arch/powerpc/include/asm/ppc-pci.h | |||
@@ -58,16 +58,16 @@ struct pci_dev *pci_get_device_by_addr(unsigned long addr); | |||
58 | void eeh_slot_error_detail (struct pci_dn *pdn, int severity); | 58 | void eeh_slot_error_detail (struct pci_dn *pdn, int severity); |
59 | #define EEH_THAW_MMIO 2 | 59 | #define EEH_THAW_MMIO 2 |
60 | #define EEH_THAW_DMA 3 | 60 | #define EEH_THAW_DMA 3 |
61 | int rtas_pci_enable(struct pci_dn *pdn, int function); | 61 | int eeh_pci_enable(struct pci_dn *pdn, int function); |
62 | int rtas_set_slot_reset (struct pci_dn *); | 62 | int eeh_reset_pe(struct pci_dn *); |
63 | int eeh_wait_for_slot_status(struct pci_dn *pdn, int max_wait_msecs); | 63 | int eeh_wait_for_slot_status(struct pci_dn *pdn, int max_wait_msecs); |
64 | void eeh_restore_bars(struct pci_dn *); | 64 | void eeh_restore_bars(struct pci_dn *); |
65 | void rtas_configure_bridge(struct pci_dn *); | 65 | void eeh_configure_bridge(struct pci_dn *); |
66 | int rtas_write_config(struct pci_dn *, int where, int size, u32 val); | 66 | int rtas_write_config(struct pci_dn *, int where, int size, u32 val); |
67 | int rtas_read_config(struct pci_dn *, int where, int size, u32 *val); | 67 | int rtas_read_config(struct pci_dn *, int where, int size, u32 *val); |
68 | void eeh_mark_slot(struct device_node *dn, int mode_flag); | 68 | void eeh_mark_slot(struct device_node *dn, int mode_flag); |
69 | void eeh_clear_slot(struct device_node *dn, int mode_flag); | 69 | void eeh_clear_slot(struct device_node *dn, int mode_flag); |
70 | struct device_node *find_device_pe(struct device_node *dn); | 70 | struct device_node *eeh_find_device_pe(struct device_node *dn); |
71 | 71 | ||
72 | void eeh_sysfs_add_device(struct pci_dev *pdev); | 72 | void eeh_sysfs_add_device(struct pci_dev *pdev); |
73 | void eeh_sysfs_remove_device(struct pci_dev *pdev); | 73 | void eeh_sysfs_remove_device(struct pci_dev *pdev); |
diff --git a/arch/powerpc/platforms/pseries/eeh.c b/arch/powerpc/platforms/pseries/eeh.c index 5f6d37bdd4f5..fa885891e1c3 100644 --- a/arch/powerpc/platforms/pseries/eeh.c +++ b/arch/powerpc/platforms/pseries/eeh.c | |||
@@ -130,7 +130,7 @@ static unsigned long slot_resets; | |||
130 | #define IS_BRIDGE(class_code) (((class_code)<<16) == PCI_BASE_CLASS_BRIDGE) | 130 | #define IS_BRIDGE(class_code) (((class_code)<<16) == PCI_BASE_CLASS_BRIDGE) |
131 | 131 | ||
132 | /** | 132 | /** |
133 | * rtas_slot_error_detail - Retrieve error log through RTAS call | 133 | * eeh_rtas_slot_error_detail - Retrieve error log through RTAS call |
134 | * @pdn: device node | 134 | * @pdn: device node |
135 | * @severity: temporary or permanent error log | 135 | * @severity: temporary or permanent error log |
136 | * @driver_log: driver log to be combined with the retrieved error log | 136 | * @driver_log: driver log to be combined with the retrieved error log |
@@ -139,7 +139,7 @@ static unsigned long slot_resets; | |||
139 | * This routine should be called to retrieve error log through the dedicated | 139 | * This routine should be called to retrieve error log through the dedicated |
140 | * RTAS call. | 140 | * RTAS call. |
141 | */ | 141 | */ |
142 | static void rtas_slot_error_detail(struct pci_dn *pdn, int severity, | 142 | static void eeh_rtas_slot_error_detail(struct pci_dn *pdn, int severity, |
143 | char *driver_log, size_t loglen) | 143 | char *driver_log, size_t loglen) |
144 | { | 144 | { |
145 | int config_addr; | 145 | int config_addr; |
@@ -170,7 +170,7 @@ static void rtas_slot_error_detail(struct pci_dn *pdn, int severity, | |||
170 | } | 170 | } |
171 | 171 | ||
172 | /** | 172 | /** |
173 | * gather_pci_data - Copy assorted PCI config space registers to buff | 173 | * eeh_gather_pci_data - Copy assorted PCI config space registers to buff |
174 | * @pdn: device to report data for | 174 | * @pdn: device to report data for |
175 | * @buf: point to buffer in which to log | 175 | * @buf: point to buffer in which to log |
176 | * @len: amount of room in buffer | 176 | * @len: amount of room in buffer |
@@ -178,7 +178,7 @@ static void rtas_slot_error_detail(struct pci_dn *pdn, int severity, | |||
178 | * This routine captures assorted PCI configuration space data, | 178 | * This routine captures assorted PCI configuration space data, |
179 | * and puts them into a buffer for RTAS error logging. | 179 | * and puts them into a buffer for RTAS error logging. |
180 | */ | 180 | */ |
181 | static size_t gather_pci_data(struct pci_dn *pdn, char * buf, size_t len) | 181 | static size_t eeh_gather_pci_data(struct pci_dn *pdn, char * buf, size_t len) |
182 | { | 182 | { |
183 | struct pci_dev *dev = pdn->pcidev; | 183 | struct pci_dev *dev = pdn->pcidev; |
184 | u32 cfg; | 184 | u32 cfg; |
@@ -258,7 +258,7 @@ static size_t gather_pci_data(struct pci_dn *pdn, char * buf, size_t len) | |||
258 | for_each_child_of_node(pdn->node, dn) { | 258 | for_each_child_of_node(pdn->node, dn) { |
259 | pdn = PCI_DN(dn); | 259 | pdn = PCI_DN(dn); |
260 | if (pdn) | 260 | if (pdn) |
261 | n += gather_pci_data(pdn, buf+n, len-n); | 261 | n += eeh_gather_pci_data(pdn, buf+n, len-n); |
262 | } | 262 | } |
263 | } | 263 | } |
264 | 264 | ||
@@ -280,23 +280,23 @@ void eeh_slot_error_detail(struct pci_dn *pdn, int severity) | |||
280 | size_t loglen = 0; | 280 | size_t loglen = 0; |
281 | pci_regs_buf[0] = 0; | 281 | pci_regs_buf[0] = 0; |
282 | 282 | ||
283 | rtas_pci_enable(pdn, EEH_THAW_MMIO); | 283 | eeh_pci_enable(pdn, EEH_THAW_MMIO); |
284 | rtas_configure_bridge(pdn); | 284 | eeh_configure_bridge(pdn); |
285 | eeh_restore_bars(pdn); | 285 | eeh_restore_bars(pdn); |
286 | loglen = gather_pci_data(pdn, pci_regs_buf, EEH_PCI_REGS_LOG_LEN); | 286 | loglen = eeh_gather_pci_data(pdn, pci_regs_buf, EEH_PCI_REGS_LOG_LEN); |
287 | 287 | ||
288 | rtas_slot_error_detail(pdn, severity, pci_regs_buf, loglen); | 288 | eeh_rtas_slot_error_detail(pdn, severity, pci_regs_buf, loglen); |
289 | } | 289 | } |
290 | 290 | ||
291 | /** | 291 | /** |
292 | * read_slot_reset_state - Read the reset state of a device node's slot | 292 | * eeh_read_slot_reset_state - Read the reset state of a device node's slot |
293 | * @dn: device node to read | 293 | * @dn: device node to read |
294 | * @rets: array to return results in | 294 | * @rets: array to return results in |
295 | * | 295 | * |
296 | * Read the reset state of a device node's slot through platform dependent | 296 | * Read the reset state of a device node's slot through platform dependent |
297 | * function call. | 297 | * function call. |
298 | */ | 298 | */ |
299 | static int read_slot_reset_state(struct pci_dn *pdn, int rets[]) | 299 | static int eeh_read_slot_reset_state(struct pci_dn *pdn, int rets[]) |
300 | { | 300 | { |
301 | int token, outputs; | 301 | int token, outputs; |
302 | int config_addr; | 302 | int config_addr; |
@@ -332,15 +332,14 @@ static int read_slot_reset_state(struct pci_dn *pdn, int rets[]) | |||
332 | * the max allowed wait time is exceeded, in which case | 332 | * the max allowed wait time is exceeded, in which case |
333 | * a -2 is returned. | 333 | * a -2 is returned. |
334 | */ | 334 | */ |
335 | int | 335 | int eeh_wait_for_slot_status(struct pci_dn *pdn, int max_wait_msecs) |
336 | eeh_wait_for_slot_status(struct pci_dn *pdn, int max_wait_msecs) | ||
337 | { | 336 | { |
338 | int rc; | 337 | int rc; |
339 | int rets[3]; | 338 | int rets[3]; |
340 | int mwait; | 339 | int mwait; |
341 | 340 | ||
342 | while (1) { | 341 | while (1) { |
343 | rc = read_slot_reset_state(pdn, rets); | 342 | rc = eeh_read_slot_reset_state(pdn, rets); |
344 | if (rc) return rc; | 343 | if (rc) return rc; |
345 | if (rets[1] == 0) return -1; /* EEH is not supported */ | 344 | if (rets[1] == 0) return -1; /* EEH is not supported */ |
346 | 345 | ||
@@ -389,12 +388,12 @@ static inline unsigned long eeh_token_to_phys(unsigned long token) | |||
389 | } | 388 | } |
390 | 389 | ||
391 | /** | 390 | /** |
392 | * find_device_pe - Retrieve the PE for the given device | 391 | * eeh_find_device_pe - Retrieve the PE for the given device |
393 | * @dn: device node | 392 | * @dn: device node |
394 | * | 393 | * |
395 | * Return the PE under which this device lies | 394 | * Return the PE under which this device lies |
396 | */ | 395 | */ |
397 | struct device_node * find_device_pe(struct device_node *dn) | 396 | struct device_node *eeh_find_device_pe(struct device_node *dn) |
398 | { | 397 | { |
399 | while ((dn->parent) && PCI_DN(dn->parent) && | 398 | while ((dn->parent) && PCI_DN(dn->parent) && |
400 | (PCI_DN(dn->parent)->eeh_mode & EEH_MODE_SUPPORTED)) { | 399 | (PCI_DN(dn->parent)->eeh_mode & EEH_MODE_SUPPORTED)) { |
@@ -445,7 +444,7 @@ static void __eeh_mark_slot(struct device_node *parent, int mode_flag) | |||
445 | void eeh_mark_slot(struct device_node *dn, int mode_flag) | 444 | void eeh_mark_slot(struct device_node *dn, int mode_flag) |
446 | { | 445 | { |
447 | struct pci_dev *dev; | 446 | struct pci_dev *dev; |
448 | dn = find_device_pe(dn); | 447 | dn = eeh_find_device_pe(dn); |
449 | 448 | ||
450 | /* Back up one, since config addrs might be shared */ | 449 | /* Back up one, since config addrs might be shared */ |
451 | if (!pcibios_find_pci_bus(dn) && PCI_DN(dn->parent)) | 450 | if (!pcibios_find_pci_bus(dn) && PCI_DN(dn->parent)) |
@@ -493,7 +492,7 @@ void eeh_clear_slot(struct device_node *dn, int mode_flag) | |||
493 | unsigned long flags; | 492 | unsigned long flags; |
494 | raw_spin_lock_irqsave(&confirm_error_lock, flags); | 493 | raw_spin_lock_irqsave(&confirm_error_lock, flags); |
495 | 494 | ||
496 | dn = find_device_pe(dn); | 495 | dn = eeh_find_device_pe(dn); |
497 | 496 | ||
498 | /* Back up one, since config addrs might be shared */ | 497 | /* Back up one, since config addrs might be shared */ |
499 | if (!pcibios_find_pci_bus(dn) && PCI_DN(dn->parent)) | 498 | if (!pcibios_find_pci_bus(dn) && PCI_DN(dn->parent)) |
@@ -538,7 +537,7 @@ int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev) | |||
538 | no_dn++; | 537 | no_dn++; |
539 | return 0; | 538 | return 0; |
540 | } | 539 | } |
541 | dn = find_device_pe(dn); | 540 | dn = eeh_find_device_pe(dn); |
542 | pdn = PCI_DN(dn); | 541 | pdn = PCI_DN(dn); |
543 | 542 | ||
544 | /* Access to IO BARs might get this far and still not want checking. */ | 543 | /* Access to IO BARs might get this far and still not want checking. */ |
@@ -585,11 +584,11 @@ int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev) | |||
585 | * function zero of a multi-function device. | 584 | * function zero of a multi-function device. |
586 | * In any case they must share a common PHB. | 585 | * In any case they must share a common PHB. |
587 | */ | 586 | */ |
588 | ret = read_slot_reset_state(pdn, rets); | 587 | ret = eeh_read_slot_reset_state(pdn, rets); |
589 | 588 | ||
590 | /* If the call to firmware failed, punt */ | 589 | /* If the call to firmware failed, punt */ |
591 | if (ret != 0) { | 590 | if (ret != 0) { |
592 | printk(KERN_WARNING "EEH: read_slot_reset_state() failed; rc=%d dn=%s\n", | 591 | printk(KERN_WARNING "EEH: eeh_read_slot_reset_state() failed; rc=%d dn=%s\n", |
593 | ret, dn->full_name); | 592 | ret, dn->full_name); |
594 | false_positives++; | 593 | false_positives++; |
595 | pdn->eeh_false_positives ++; | 594 | pdn->eeh_false_positives ++; |
@@ -687,15 +686,14 @@ EXPORT_SYMBOL(eeh_check_failure); | |||
687 | 686 | ||
688 | 687 | ||
689 | /** | 688 | /** |
690 | * rtas_pci_enable - Enable MMIO or DMA transfers for this slot | 689 | * eeh_pci_enable - Enable MMIO or DMA transfers for this slot |
691 | * @pdn pci device node | 690 | * @pdn pci device node |
692 | * | 691 | * |
693 | * This routine should be called to reenable frozen MMIO or DMA | 692 | * This routine should be called to reenable frozen MMIO or DMA |
694 | * so that it would work correctly again. It's useful while doing | 693 | * so that it would work correctly again. It's useful while doing |
695 | * recovery or log collection on the indicated device. | 694 | * recovery or log collection on the indicated device. |
696 | */ | 695 | */ |
697 | int | 696 | int eeh_pci_enable(struct pci_dn *pdn, int function) |
698 | rtas_pci_enable(struct pci_dn *pdn, int function) | ||
699 | { | 697 | { |
700 | int config_addr; | 698 | int config_addr; |
701 | int rc; | 699 | int rc; |
@@ -723,7 +721,7 @@ rtas_pci_enable(struct pci_dn *pdn, int function) | |||
723 | } | 721 | } |
724 | 722 | ||
725 | /** | 723 | /** |
726 | * rtas_pci_slot_reset - Raises/Lowers the pci #RST line | 724 | * eeh_slot_reset - Raises/Lowers the pci #RST line |
727 | * @pdn: pci device node | 725 | * @pdn: pci device node |
728 | * @state: 1/0 to raise/lower the #RST | 726 | * @state: 1/0 to raise/lower the #RST |
729 | * | 727 | * |
@@ -732,8 +730,7 @@ rtas_pci_enable(struct pci_dn *pdn, int function) | |||
732 | * and drops the #RST line if 'state is '0'. This routine is | 730 | * and drops the #RST line if 'state is '0'. This routine is |
733 | * safe to call in an interrupt context. | 731 | * safe to call in an interrupt context. |
734 | */ | 732 | */ |
735 | static void | 733 | static void eeh_slot_reset(struct pci_dn *pdn, int state) |
736 | rtas_pci_slot_reset(struct pci_dn *pdn, int state) | ||
737 | { | 734 | { |
738 | int config_addr; | 735 | int config_addr; |
739 | int rc; | 736 | int rc; |
@@ -786,13 +783,13 @@ int pcibios_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state stat | |||
786 | 783 | ||
787 | switch (state) { | 784 | switch (state) { |
788 | case pcie_deassert_reset: | 785 | case pcie_deassert_reset: |
789 | rtas_pci_slot_reset(pdn, 0); | 786 | eeh_slot_reset(pdn, 0); |
790 | break; | 787 | break; |
791 | case pcie_hot_reset: | 788 | case pcie_hot_reset: |
792 | rtas_pci_slot_reset(pdn, 1); | 789 | eeh_slot_reset(pdn, 1); |
793 | break; | 790 | break; |
794 | case pcie_warm_reset: | 791 | case pcie_warm_reset: |
795 | rtas_pci_slot_reset(pdn, 3); | 792 | eeh_slot_reset(pdn, 3); |
796 | break; | 793 | break; |
797 | default: | 794 | default: |
798 | return -EINVAL; | 795 | return -EINVAL; |
@@ -839,7 +836,7 @@ void __eeh_set_pe_freset(struct device_node *parent, unsigned int *freset) | |||
839 | void eeh_set_pe_freset(struct device_node *dn, unsigned int *freset) | 836 | void eeh_set_pe_freset(struct device_node *dn, unsigned int *freset) |
840 | { | 837 | { |
841 | struct pci_dev *dev; | 838 | struct pci_dev *dev; |
842 | dn = find_device_pe(dn); | 839 | dn = eeh_find_device_pe(dn); |
843 | 840 | ||
844 | /* Back up one, since config addrs might be shared */ | 841 | /* Back up one, since config addrs might be shared */ |
845 | if (!pcibios_find_pci_bus(dn) && PCI_DN(dn->parent)) | 842 | if (!pcibios_find_pci_bus(dn) && PCI_DN(dn->parent)) |
@@ -853,12 +850,12 @@ void eeh_set_pe_freset(struct device_node *dn, unsigned int *freset) | |||
853 | } | 850 | } |
854 | 851 | ||
855 | /** | 852 | /** |
856 | * __rtas_set_slot_reset - Assert the pci #RST line for 1/4 second | 853 | * eeh_reset_pe_once - Assert the pci #RST line for 1/4 second |
857 | * @pdn: pci device node to be reset. | 854 | * @pdn: pci device node to be reset. |
858 | * | 855 | * |
859 | * Assert the PCI #RST line for 1/4 second. | 856 | * Assert the PCI #RST line for 1/4 second. |
860 | */ | 857 | */ |
861 | static void __rtas_set_slot_reset(struct pci_dn *pdn) | 858 | static void eeh_reset_pe_once(struct pci_dn *pdn) |
862 | { | 859 | { |
863 | unsigned int freset = 0; | 860 | unsigned int freset = 0; |
864 | 861 | ||
@@ -871,9 +868,9 @@ static void __rtas_set_slot_reset(struct pci_dn *pdn) | |||
871 | eeh_set_pe_freset(pdn->node, &freset); | 868 | eeh_set_pe_freset(pdn->node, &freset); |
872 | 869 | ||
873 | if (freset) | 870 | if (freset) |
874 | rtas_pci_slot_reset(pdn, 3); | 871 | eeh_slot_reset(pdn, 3); |
875 | else | 872 | else |
876 | rtas_pci_slot_reset(pdn, 1); | 873 | eeh_slot_reset(pdn, 1); |
877 | 874 | ||
878 | /* The PCI bus requires that the reset be held high for at least | 875 | /* The PCI bus requires that the reset be held high for at least |
879 | * a 100 milliseconds. We wait a bit longer 'just in case'. | 876 | * a 100 milliseconds. We wait a bit longer 'just in case'. |
@@ -887,7 +884,7 @@ static void __rtas_set_slot_reset(struct pci_dn *pdn) | |||
887 | */ | 884 | */ |
888 | eeh_clear_slot(pdn->node, EEH_MODE_ISOLATED); | 885 | eeh_clear_slot(pdn->node, EEH_MODE_ISOLATED); |
889 | 886 | ||
890 | rtas_pci_slot_reset(pdn, 0); | 887 | eeh_slot_reset(pdn, 0); |
891 | 888 | ||
892 | /* After a PCI slot has been reset, the PCI Express spec requires | 889 | /* After a PCI slot has been reset, the PCI Express spec requires |
893 | * a 1.5 second idle time for the bus to stabilize, before starting | 890 | * a 1.5 second idle time for the bus to stabilize, before starting |
@@ -898,20 +895,20 @@ static void __rtas_set_slot_reset(struct pci_dn *pdn) | |||
898 | } | 895 | } |
899 | 896 | ||
900 | /** | 897 | /** |
901 | * rtas_set_slot_reset - Reset the indicated PE | 898 | * eeh_reset_pe - Reset the indicated PE |
902 | * @pdn: PCI device node | 899 | * @pdn: PCI device node |
903 | * | 900 | * |
904 | * This routine should be called to reset indicated device, including | 901 | * This routine should be called to reset indicated device, including |
905 | * PE. A PE might include multiple PCI devices and sometimes PCI bridges | 902 | * PE. A PE might include multiple PCI devices and sometimes PCI bridges |
906 | * might be involved as well. | 903 | * might be involved as well. |
907 | */ | 904 | */ |
908 | int rtas_set_slot_reset(struct pci_dn *pdn) | 905 | int eeh_reset_pe(struct pci_dn *pdn) |
909 | { | 906 | { |
910 | int i, rc; | 907 | int i, rc; |
911 | 908 | ||
912 | /* Take three shots at resetting the bus */ | 909 | /* Take three shots at resetting the bus */ |
913 | for (i=0; i<3; i++) { | 910 | for (i=0; i<3; i++) { |
914 | __rtas_set_slot_reset(pdn); | 911 | eeh_reset_pe_once(pdn); |
915 | 912 | ||
916 | rc = eeh_wait_for_slot_status(pdn, PCI_BUS_RESET_WAIT_MSEC); | 913 | rc = eeh_wait_for_slot_status(pdn, PCI_BUS_RESET_WAIT_MSEC); |
917 | if (rc == 0) | 914 | if (rc == 0) |
@@ -938,14 +935,14 @@ int rtas_set_slot_reset(struct pci_dn *pdn) | |||
938 | */ | 935 | */ |
939 | 936 | ||
940 | /** | 937 | /** |
941 | * __restore_bars - Restore the Base Address Registers | 938 | * eeh_restore_one_device_bars - Restore the Base Address Registers for one device |
942 | * @pdn: pci device node | 939 | * @pdn: pci device node |
943 | * | 940 | * |
944 | * Loads the PCI configuration space base address registers, | 941 | * Loads the PCI configuration space base address registers, |
945 | * the expansion ROM base address, the latency timer, and etc. | 942 | * the expansion ROM base address, the latency timer, and etc. |
946 | * from the saved values in the device node. | 943 | * from the saved values in the device node. |
947 | */ | 944 | */ |
948 | static inline void __restore_bars(struct pci_dn *pdn) | 945 | static inline void eeh_restore_one_device_bars(struct pci_dn *pdn) |
949 | { | 946 | { |
950 | int i; | 947 | int i; |
951 | u32 cmd; | 948 | u32 cmd; |
@@ -999,7 +996,7 @@ void eeh_restore_bars(struct pci_dn *pdn) | |||
999 | return; | 996 | return; |
1000 | 997 | ||
1001 | if ((pdn->eeh_mode & EEH_MODE_SUPPORTED) && !IS_BRIDGE(pdn->class_code)) | 998 | if ((pdn->eeh_mode & EEH_MODE_SUPPORTED) && !IS_BRIDGE(pdn->class_code)) |
1002 | __restore_bars(pdn); | 999 | eeh_restore_one_device_bars(pdn); |
1003 | 1000 | ||
1004 | for_each_child_of_node(pdn->node, dn) | 1001 | for_each_child_of_node(pdn->node, dn) |
1005 | eeh_restore_bars(PCI_DN(dn)); | 1002 | eeh_restore_bars(PCI_DN(dn)); |
@@ -1026,15 +1023,14 @@ static void eeh_save_bars(struct pci_dn *pdn) | |||
1026 | } | 1023 | } |
1027 | 1024 | ||
1028 | /** | 1025 | /** |
1029 | * rtas_configure_bridge - Configure PCI bridges for the indicated PE | 1026 | * eeh_configure_bridge - Configure PCI bridges for the indicated PE |
1030 | * @pdn: PCI device node | 1027 | * @pdn: PCI device node |
1031 | * | 1028 | * |
1032 | * PCI bridges might be included in PE. In order to make the PE work | 1029 | * PCI bridges might be included in PE. In order to make the PE work |
1033 | * again. The included PCI bridges should be recovered after the PE | 1030 | * again. The included PCI bridges should be recovered after the PE |
1034 | * encounters frozen state. | 1031 | * encounters frozen state. |
1035 | */ | 1032 | */ |
1036 | void | 1033 | void eeh_configure_bridge(struct pci_dn *pdn) |
1037 | rtas_configure_bridge(struct pci_dn *pdn) | ||
1038 | { | 1034 | { |
1039 | int config_addr; | 1035 | int config_addr; |
1040 | int rc; | 1036 | int rc; |
@@ -1069,7 +1065,7 @@ struct eeh_early_enable_info { | |||
1069 | }; | 1065 | }; |
1070 | 1066 | ||
1071 | /** | 1067 | /** |
1072 | * get_pe_addr - Retrieve PE address with given BDF address | 1068 | * eeh_get_pe_addr - Retrieve PE address with given BDF address |
1073 | * @config_addr: BDF address | 1069 | * @config_addr: BDF address |
1074 | * @info: BUID of the associated PHB | 1070 | * @info: BUID of the associated PHB |
1075 | * | 1071 | * |
@@ -1079,7 +1075,7 @@ struct eeh_early_enable_info { | |||
1079 | * the given BDF address. Further more, we prefer PE address on BDF | 1075 | * the given BDF address. Further more, we prefer PE address on BDF |
1080 | * address in EEH core components. | 1076 | * address in EEH core components. |
1081 | */ | 1077 | */ |
1082 | static int get_pe_addr(int config_addr, | 1078 | static int eeh_get_pe_addr(int config_addr, |
1083 | struct eeh_early_enable_info *info) | 1079 | struct eeh_early_enable_info *info) |
1084 | { | 1080 | { |
1085 | unsigned int rets[3]; | 1081 | unsigned int rets[3]; |
@@ -1112,7 +1108,7 @@ static int get_pe_addr(int config_addr, | |||
1112 | } | 1108 | } |
1113 | 1109 | ||
1114 | /** | 1110 | /** |
1115 | * early_enable_eeh - Early enable EEH on the indicated device | 1111 | * eeh_early_enable - Early enable EEH on the indicated device |
1116 | * @dn: device node | 1112 | * @dn: device node |
1117 | * @data: BUID | 1113 | * @data: BUID |
1118 | * | 1114 | * |
@@ -1120,7 +1116,7 @@ static int get_pe_addr(int config_addr, | |||
1120 | * is expected to be called before real PCI probing is done. However, | 1116 | * is expected to be called before real PCI probing is done. However, |
1121 | * the PHBs have been initialized at this point. | 1117 | * the PHBs have been initialized at this point. |
1122 | */ | 1118 | */ |
1123 | static void *early_enable_eeh(struct device_node *dn, void *data) | 1119 | static void *eeh_early_enable(struct device_node *dn, void *data) |
1124 | { | 1120 | { |
1125 | unsigned int rets[3]; | 1121 | unsigned int rets[3]; |
1126 | struct eeh_early_enable_info *info = data; | 1122 | struct eeh_early_enable_info *info = data; |
@@ -1170,14 +1166,14 @@ static void *early_enable_eeh(struct device_node *dn, void *data) | |||
1170 | /* If the newer, better, ibm,get-config-addr-info is supported, | 1166 | /* If the newer, better, ibm,get-config-addr-info is supported, |
1171 | * then use that instead. | 1167 | * then use that instead. |
1172 | */ | 1168 | */ |
1173 | pdn->eeh_pe_config_addr = get_pe_addr(pdn->eeh_config_addr, info); | 1169 | pdn->eeh_pe_config_addr = eeh_get_pe_addr(pdn->eeh_config_addr, info); |
1174 | 1170 | ||
1175 | /* Some older systems (Power4) allow the | 1171 | /* Some older systems (Power4) allow the |
1176 | * ibm,set-eeh-option call to succeed even on nodes | 1172 | * ibm,set-eeh-option call to succeed even on nodes |
1177 | * where EEH is not supported. Verify support | 1173 | * where EEH is not supported. Verify support |
1178 | * explicitly. | 1174 | * explicitly. |
1179 | */ | 1175 | */ |
1180 | ret = read_slot_reset_state(pdn, rets); | 1176 | ret = eeh_read_slot_reset_state(pdn, rets); |
1181 | if ((ret == 0) && (rets[1] == 1)) | 1177 | if ((ret == 0) && (rets[1] == 1)) |
1182 | enable = 1; | 1178 | enable = 1; |
1183 | } | 1179 | } |
@@ -1272,7 +1268,7 @@ void __init eeh_init(void) | |||
1272 | 1268 | ||
1273 | info.buid_lo = BUID_LO(buid); | 1269 | info.buid_lo = BUID_LO(buid); |
1274 | info.buid_hi = BUID_HI(buid); | 1270 | info.buid_hi = BUID_HI(buid); |
1275 | traverse_pci_devices(phb, early_enable_eeh, &info); | 1271 | traverse_pci_devices(phb, eeh_early_enable, &info); |
1276 | } | 1272 | } |
1277 | 1273 | ||
1278 | if (eeh_subsystem_enabled) | 1274 | if (eeh_subsystem_enabled) |
@@ -1308,7 +1304,7 @@ static void eeh_add_device_early(struct device_node *dn) | |||
1308 | 1304 | ||
1309 | info.buid_hi = BUID_HI(phb->buid); | 1305 | info.buid_hi = BUID_HI(phb->buid); |
1310 | info.buid_lo = BUID_LO(phb->buid); | 1306 | info.buid_lo = BUID_LO(phb->buid); |
1311 | early_enable_eeh(dn, &info); | 1307 | eeh_early_enable(dn, &info); |
1312 | } | 1308 | } |
1313 | 1309 | ||
1314 | /** | 1310 | /** |
diff --git a/arch/powerpc/platforms/pseries/eeh_driver.c b/arch/powerpc/platforms/pseries/eeh_driver.c index 1b6cb10589e0..5315350bf1a0 100644 --- a/arch/powerpc/platforms/pseries/eeh_driver.c +++ b/arch/powerpc/platforms/pseries/eeh_driver.c | |||
@@ -282,7 +282,7 @@ static int eeh_reset_device (struct pci_dn *pe_dn, struct pci_bus *bus) | |||
282 | /* Reset the pci controller. (Asserts RST#; resets config space). | 282 | /* Reset the pci controller. (Asserts RST#; resets config space). |
283 | * Reconfigure bridges and devices. Don't try to bring the system | 283 | * Reconfigure bridges and devices. Don't try to bring the system |
284 | * up if the reset failed for some reason. */ | 284 | * up if the reset failed for some reason. */ |
285 | rc = rtas_set_slot_reset(pe_dn); | 285 | rc = eeh_reset_pe(pe_dn); |
286 | if (rc) | 286 | if (rc) |
287 | return rc; | 287 | return rc; |
288 | 288 | ||
@@ -295,7 +295,7 @@ static int eeh_reset_device (struct pci_dn *pe_dn, struct pci_bus *bus) | |||
295 | struct pci_dn *ppe = PCI_DN(dn); | 295 | struct pci_dn *ppe = PCI_DN(dn); |
296 | /* On Power4, always true because eeh_pe_config_addr=0 */ | 296 | /* On Power4, always true because eeh_pe_config_addr=0 */ |
297 | if (pe_dn->eeh_pe_config_addr == ppe->eeh_pe_config_addr) { | 297 | if (pe_dn->eeh_pe_config_addr == ppe->eeh_pe_config_addr) { |
298 | rtas_configure_bridge(ppe); | 298 | eeh_configure_bridge(ppe); |
299 | eeh_restore_bars(ppe); | 299 | eeh_restore_bars(ppe); |
300 | } | 300 | } |
301 | dn = dn->sibling; | 301 | dn = dn->sibling; |
@@ -330,7 +330,7 @@ struct pci_dn * handle_eeh_events (struct eeh_event *event) | |||
330 | enum pci_ers_result result = PCI_ERS_RESULT_NONE; | 330 | enum pci_ers_result result = PCI_ERS_RESULT_NONE; |
331 | const char *location, *pci_str, *drv_str, *bus_pci_str, *bus_drv_str; | 331 | const char *location, *pci_str, *drv_str, *bus_pci_str, *bus_drv_str; |
332 | 332 | ||
333 | frozen_dn = find_device_pe(event->dn); | 333 | frozen_dn = eeh_find_device_pe(event->dn); |
334 | if (!frozen_dn) { | 334 | if (!frozen_dn) { |
335 | 335 | ||
336 | location = of_get_property(event->dn, "ibm,loc-code", NULL); | 336 | location = of_get_property(event->dn, "ibm,loc-code", NULL); |
@@ -422,7 +422,7 @@ struct pci_dn * handle_eeh_events (struct eeh_event *event) | |||
422 | 422 | ||
423 | /* If all devices reported they can proceed, then re-enable MMIO */ | 423 | /* If all devices reported they can proceed, then re-enable MMIO */ |
424 | if (result == PCI_ERS_RESULT_CAN_RECOVER) { | 424 | if (result == PCI_ERS_RESULT_CAN_RECOVER) { |
425 | rc = rtas_pci_enable(frozen_pdn, EEH_THAW_MMIO); | 425 | rc = eeh_pci_enable(frozen_pdn, EEH_THAW_MMIO); |
426 | 426 | ||
427 | if (rc < 0) | 427 | if (rc < 0) |
428 | goto hard_fail; | 428 | goto hard_fail; |
@@ -436,7 +436,7 @@ struct pci_dn * handle_eeh_events (struct eeh_event *event) | |||
436 | 436 | ||
437 | /* If all devices reported they can proceed, then re-enable DMA */ | 437 | /* If all devices reported they can proceed, then re-enable DMA */ |
438 | if (result == PCI_ERS_RESULT_CAN_RECOVER) { | 438 | if (result == PCI_ERS_RESULT_CAN_RECOVER) { |
439 | rc = rtas_pci_enable(frozen_pdn, EEH_THAW_DMA); | 439 | rc = eeh_pci_enable(frozen_pdn, EEH_THAW_DMA); |
440 | 440 | ||
441 | if (rc < 0) | 441 | if (rc < 0) |
442 | goto hard_fail; | 442 | goto hard_fail; |
diff --git a/arch/powerpc/platforms/pseries/msi.c b/arch/powerpc/platforms/pseries/msi.c index 38d24e7e7bb1..109fdb75578d 100644 --- a/arch/powerpc/platforms/pseries/msi.c +++ b/arch/powerpc/platforms/pseries/msi.c | |||
@@ -217,7 +217,7 @@ static struct device_node *find_pe_dn(struct pci_dev *dev, int *total) | |||
217 | if (!dn) | 217 | if (!dn) |
218 | return NULL; | 218 | return NULL; |
219 | 219 | ||
220 | dn = find_device_pe(dn); | 220 | dn = eeh_find_device_pe(dn); |
221 | if (!dn) | 221 | if (!dn) |
222 | return NULL; | 222 | return NULL; |
223 | 223 | ||