diff options
author | Linas Vepstas <linas@austin.ibm.com> | 2007-05-09 12:38:11 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-05-10 07:28:13 -0400 |
commit | 17213c3bf67bd532d4d04c286663f9bbf92b9c18 (patch) | |
tree | 835c3bd828ef427749b36a68665513fa0b1b475a | |
parent | 979ee32f7f8e9582a0cadd4ed9a158ddc3036ad1 (diff) |
[POWERPC] Assorted janitorial EEH cleanups
Assorted minor cleanups to EEH code; -- use literals, use
kerneldoc format.
Signed-off-by: Linas Vepstas <linas@austin.ibm.com>
----
arch/powerpc/platforms/pseries/eeh.c | 13 ++++++++++---
arch/powerpc/platforms/pseries/eeh_driver.c | 7 ++++---
include/asm-powerpc/ppc-pci.h | 18 +++++++++++++++---
3 files changed, 29 insertions(+), 9 deletions(-)
Signed-off-by: Paul Mackerras <paulus@samba.org>
-rw-r--r-- | arch/powerpc/platforms/pseries/eeh.c | 13 | ||||
-rw-r--r-- | arch/powerpc/platforms/pseries/eeh_driver.c | 7 | ||||
-rw-r--r-- | include/asm-powerpc/ppc-pci.h | 18 |
3 files changed, 29 insertions, 9 deletions
diff --git a/arch/powerpc/platforms/pseries/eeh.c b/arch/powerpc/platforms/pseries/eeh.c index 093438b93bd9..5f3e6d8659fe 100644 --- a/arch/powerpc/platforms/pseries/eeh.c +++ b/arch/powerpc/platforms/pseries/eeh.c | |||
@@ -76,7 +76,7 @@ | |||
76 | */ | 76 | */ |
77 | #define EEH_MAX_FAILS 2100000 | 77 | #define EEH_MAX_FAILS 2100000 |
78 | 78 | ||
79 | /* Time to wait for a PCI slot to retport status, in milliseconds */ | 79 | /* Time to wait for a PCI slot to report status, in milliseconds */ |
80 | #define PCI_BUS_RESET_WAIT_MSEC (60*1000) | 80 | #define PCI_BUS_RESET_WAIT_MSEC (60*1000) |
81 | 81 | ||
82 | /* RTAS tokens */ | 82 | /* RTAS tokens */ |
@@ -95,11 +95,18 @@ EXPORT_SYMBOL(eeh_subsystem_enabled); | |||
95 | /* Lock to avoid races due to multiple reports of an error */ | 95 | /* Lock to avoid races due to multiple reports of an error */ |
96 | static DEFINE_SPINLOCK(confirm_error_lock); | 96 | static DEFINE_SPINLOCK(confirm_error_lock); |
97 | 97 | ||
98 | /* Buffer for reporting slot-error-detail rtas calls */ | 98 | /* Buffer for reporting slot-error-detail rtas calls. Its here |
99 | * in BSS, and not dynamically alloced, so that it ends up in | ||
100 | * RMO where RTAS can access it. | ||
101 | */ | ||
99 | static unsigned char slot_errbuf[RTAS_ERROR_LOG_MAX]; | 102 | static unsigned char slot_errbuf[RTAS_ERROR_LOG_MAX]; |
100 | static DEFINE_SPINLOCK(slot_errbuf_lock); | 103 | static DEFINE_SPINLOCK(slot_errbuf_lock); |
101 | static int eeh_error_buf_size; | 104 | static int eeh_error_buf_size; |
102 | 105 | ||
106 | /* Buffer for reporting pci register dumps. Its here in BSS, and | ||
107 | * not dynamically alloced, so that it ends up in RMO where RTAS | ||
108 | * can access it. | ||
109 | */ | ||
103 | #define EEH_PCI_REGS_LOG_LEN 4096 | 110 | #define EEH_PCI_REGS_LOG_LEN 4096 |
104 | static unsigned char pci_regs_buf[EEH_PCI_REGS_LOG_LEN]; | 111 | static unsigned char pci_regs_buf[EEH_PCI_REGS_LOG_LEN]; |
105 | 112 | ||
@@ -218,7 +225,7 @@ static size_t gather_pci_data(struct pci_dn *pdn, char * buf, size_t len) | |||
218 | void eeh_slot_error_detail(struct pci_dn *pdn, int severity) | 225 | void eeh_slot_error_detail(struct pci_dn *pdn, int severity) |
219 | { | 226 | { |
220 | size_t loglen = 0; | 227 | size_t loglen = 0; |
221 | memset(pci_regs_buf, 0, EEH_PCI_REGS_LOG_LEN); | 228 | pci_regs_buf[0] = 0; |
222 | 229 | ||
223 | rtas_pci_enable(pdn, EEH_THAW_MMIO); | 230 | rtas_pci_enable(pdn, EEH_THAW_MMIO); |
224 | loglen = gather_pci_data(pdn, pci_regs_buf, EEH_PCI_REGS_LOG_LEN); | 231 | loglen = gather_pci_data(pdn, pci_regs_buf, EEH_PCI_REGS_LOG_LEN); |
diff --git a/arch/powerpc/platforms/pseries/eeh_driver.c b/arch/powerpc/platforms/pseries/eeh_driver.c index f07d849cfc84..161a5844ab6c 100644 --- a/arch/powerpc/platforms/pseries/eeh_driver.c +++ b/arch/powerpc/platforms/pseries/eeh_driver.c | |||
@@ -378,8 +378,9 @@ struct pci_dn * handle_eeh_events (struct eeh_event *event) | |||
378 | 378 | ||
379 | /* Since rtas may enable MMIO when posting the error log, | 379 | /* Since rtas may enable MMIO when posting the error log, |
380 | * don't post the error log until after all dev drivers | 380 | * don't post the error log until after all dev drivers |
381 | * have been informed. */ | 381 | * have been informed. |
382 | eeh_slot_error_detail(frozen_pdn, 1 /* Temporary Error */); | 382 | */ |
383 | eeh_slot_error_detail(frozen_pdn, EEH_LOG_TEMP_FAILURE); | ||
383 | 384 | ||
384 | /* If all device drivers were EEH-unaware, then shut | 385 | /* If all device drivers were EEH-unaware, then shut |
385 | * down all of the device drivers, and hope they | 386 | * down all of the device drivers, and hope they |
@@ -470,7 +471,7 @@ hard_fail: | |||
470 | location, drv_str, pci_str); | 471 | location, drv_str, pci_str); |
471 | 472 | ||
472 | perm_error: | 473 | perm_error: |
473 | eeh_slot_error_detail(frozen_pdn, 2 /* Permanent Error */); | 474 | eeh_slot_error_detail(frozen_pdn, EEH_LOG_PERM_FAILURE); |
474 | 475 | ||
475 | /* Notify all devices that they're about to go down. */ | 476 | /* Notify all devices that they're about to go down. */ |
476 | pci_walk_bus(frozen_bus, eeh_report_failure, NULL); | 477 | pci_walk_bus(frozen_bus, eeh_report_failure, NULL); |
diff --git a/include/asm-powerpc/ppc-pci.h b/include/asm-powerpc/ppc-pci.h index 6dcd7a811fe1..8e2005159ffd 100644 --- a/include/asm-powerpc/ppc-pci.h +++ b/include/asm-powerpc/ppc-pci.h | |||
@@ -62,11 +62,14 @@ struct pci_dev *pci_get_device_by_addr(unsigned long addr); | |||
62 | 62 | ||
63 | /** | 63 | /** |
64 | * eeh_slot_error_detail -- record and EEH error condition to the log | 64 | * eeh_slot_error_detail -- record and EEH error condition to the log |
65 | * @severity: 1 if temporary, 2 if permanent failure. | 65 | * @pdn: pci device node |
66 | * @severity: EEH_LOG_TEMP_FAILURE or EEH_LOG_PERM_FAILURE | ||
66 | * | 67 | * |
67 | * Obtains the EEH error details from the RTAS subsystem, | 68 | * Obtains the EEH error details from the RTAS subsystem, |
68 | * and then logs these details with the RTAS error log system. | 69 | * and then logs these details with the RTAS error log system. |
69 | */ | 70 | */ |
71 | #define EEH_LOG_TEMP_FAILURE 1 | ||
72 | #define EEH_LOG_PERM_FAILURE 2 | ||
70 | void eeh_slot_error_detail (struct pci_dn *pdn, int severity); | 73 | void eeh_slot_error_detail (struct pci_dn *pdn, int severity); |
71 | 74 | ||
72 | /** | 75 | /** |
@@ -82,6 +85,7 @@ int rtas_pci_enable(struct pci_dn *pdn, int function); | |||
82 | 85 | ||
83 | /** | 86 | /** |
84 | * rtas_set_slot_reset -- unfreeze a frozen slot | 87 | * rtas_set_slot_reset -- unfreeze a frozen slot |
88 | * @pdn: pci device node | ||
85 | * | 89 | * |
86 | * Clear the EEH-frozen condition on a slot. This routine | 90 | * Clear the EEH-frozen condition on a slot. This routine |
87 | * does this by asserting the PCI #RST line for 1/8th of | 91 | * does this by asserting the PCI #RST line for 1/8th of |
@@ -95,6 +99,7 @@ int eeh_wait_for_slot_status(struct pci_dn *pdn, int max_wait_msecs); | |||
95 | 99 | ||
96 | /** | 100 | /** |
97 | * eeh_restore_bars - Restore device configuration info. | 101 | * eeh_restore_bars - Restore device configuration info. |
102 | * @pdn: pci device node | ||
98 | * | 103 | * |
99 | * A reset of a PCI device will clear out its config space. | 104 | * A reset of a PCI device will clear out its config space. |
100 | * This routines will restore the config space for this | 105 | * This routines will restore the config space for this |
@@ -105,6 +110,7 @@ void eeh_restore_bars(struct pci_dn *); | |||
105 | 110 | ||
106 | /** | 111 | /** |
107 | * rtas_configure_bridge -- firmware initialization of pci bridge | 112 | * rtas_configure_bridge -- firmware initialization of pci bridge |
113 | * @pdn: pci device node | ||
108 | * | 114 | * |
109 | * Ask the firmware to configure all PCI bridges devices | 115 | * Ask the firmware to configure all PCI bridges devices |
110 | * located behind the indicated node. Required after a | 116 | * located behind the indicated node. Required after a |
@@ -118,16 +124,22 @@ int rtas_write_config(struct pci_dn *, int where, int size, u32 val); | |||
118 | int rtas_read_config(struct pci_dn *, int where, int size, u32 *val); | 124 | int rtas_read_config(struct pci_dn *, int where, int size, u32 *val); |
119 | 125 | ||
120 | /** | 126 | /** |
127 | * eeh_mark_slot -- set mode flags for pertition endpoint | ||
128 | * @pdn: pci device node | ||
129 | * | ||
121 | * mark and clear slots: find "partition endpoint" PE and set or | 130 | * mark and clear slots: find "partition endpoint" PE and set or |
122 | * clear the flags for each subnode of the PE. | 131 | * clear the flags for each subnode of the PE. |
123 | */ | 132 | */ |
124 | void eeh_mark_slot (struct device_node *dn, int mode_flag); | 133 | void eeh_mark_slot (struct device_node *dn, int mode_flag); |
125 | void eeh_clear_slot (struct device_node *dn, int mode_flag); | 134 | void eeh_clear_slot (struct device_node *dn, int mode_flag); |
126 | 135 | ||
127 | /* Find the associated "Partiationable Endpoint" PE */ | 136 | /** |
137 | * find_device_pe -- Find the associated "Partiationable Endpoint" PE | ||
138 | * @pdn: pci device node | ||
139 | */ | ||
128 | struct device_node * find_device_pe(struct device_node *dn); | 140 | struct device_node * find_device_pe(struct device_node *dn); |
129 | 141 | ||
130 | #endif | 142 | #endif /* CONFIG_EEH */ |
131 | 143 | ||
132 | #else /* CONFIG_PCI */ | 144 | #else /* CONFIG_PCI */ |
133 | static inline void find_and_init_phbs(void) { } | 145 | static inline void find_and_init_phbs(void) { } |