diff options
author | Breno Leitao <leitao@linux.vnet.ibm.com> | 2009-10-14 13:57:51 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-12-11 18:18:03 -0500 |
commit | e6bdf24cf2992e1775fc095ed021f6b886707c41 (patch) | |
tree | 54a43dece085e8a0601599dcb423ba26255a1d05 | |
parent | f9d1dff276c40157638415cdddf6a051869e8d92 (diff) |
jsm: adding EEH handlers
Adding EEH handlers for the serial jsm driver. This patch adds
the PCI error handlers and also register them to be called when
a error is detected.
Signed-off-by: Breno Leitao <leitao@linux.vnet.ibm.com>
Acked-by: Scott Kilau <scottk@digi.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/serial/jsm/jsm_driver.c | 46 | ||||
-rw-r--r-- | drivers/serial/jsm/jsm_tty.c | 2 |
2 files changed, 47 insertions, 1 deletions
diff --git a/drivers/serial/jsm/jsm_driver.c b/drivers/serial/jsm/jsm_driver.c index 48326f75a81e..108c3e0471fd 100644 --- a/drivers/serial/jsm/jsm_driver.c +++ b/drivers/serial/jsm/jsm_driver.c | |||
@@ -48,6 +48,17 @@ struct uart_driver jsm_uart_driver = { | |||
48 | .nr = NR_PORTS, | 48 | .nr = NR_PORTS, |
49 | }; | 49 | }; |
50 | 50 | ||
51 | static pci_ers_result_t jsm_io_error_detected(struct pci_dev *pdev, | ||
52 | pci_channel_state_t state); | ||
53 | static pci_ers_result_t jsm_io_slot_reset(struct pci_dev *pdev); | ||
54 | static void jsm_io_resume(struct pci_dev *pdev); | ||
55 | |||
56 | static struct pci_error_handlers jsm_err_handler = { | ||
57 | .error_detected = jsm_io_error_detected, | ||
58 | .slot_reset = jsm_io_slot_reset, | ||
59 | .resume = jsm_io_resume, | ||
60 | }; | ||
61 | |||
51 | int jsm_debug; | 62 | int jsm_debug; |
52 | module_param(jsm_debug, int, 0); | 63 | module_param(jsm_debug, int, 0); |
53 | MODULE_PARM_DESC(jsm_debug, "Driver debugging level"); | 64 | MODULE_PARM_DESC(jsm_debug, "Driver debugging level"); |
@@ -164,6 +175,7 @@ static int __devinit jsm_probe_one(struct pci_dev *pdev, const struct pci_device | |||
164 | } | 175 | } |
165 | 176 | ||
166 | pci_set_drvdata(pdev, brd); | 177 | pci_set_drvdata(pdev, brd); |
178 | pci_save_state(pdev); | ||
167 | 179 | ||
168 | return 0; | 180 | return 0; |
169 | out_free_irq: | 181 | out_free_irq: |
@@ -222,8 +234,42 @@ static struct pci_driver jsm_driver = { | |||
222 | .id_table = jsm_pci_tbl, | 234 | .id_table = jsm_pci_tbl, |
223 | .probe = jsm_probe_one, | 235 | .probe = jsm_probe_one, |
224 | .remove = __devexit_p(jsm_remove_one), | 236 | .remove = __devexit_p(jsm_remove_one), |
237 | .err_handler = &jsm_err_handler, | ||
225 | }; | 238 | }; |
226 | 239 | ||
240 | static pci_ers_result_t jsm_io_error_detected(struct pci_dev *pdev, | ||
241 | pci_channel_state_t state) | ||
242 | { | ||
243 | struct jsm_board *brd = pci_get_drvdata(pdev); | ||
244 | |||
245 | jsm_remove_uart_port(brd); | ||
246 | |||
247 | return PCI_ERS_RESULT_NEED_RESET; | ||
248 | } | ||
249 | |||
250 | static pci_ers_result_t jsm_io_slot_reset(struct pci_dev *pdev) | ||
251 | { | ||
252 | int rc; | ||
253 | |||
254 | rc = pci_enable_device(pdev); | ||
255 | |||
256 | if (rc) | ||
257 | return PCI_ERS_RESULT_DISCONNECT; | ||
258 | |||
259 | pci_set_master(pdev); | ||
260 | |||
261 | return PCI_ERS_RESULT_RECOVERED; | ||
262 | } | ||
263 | |||
264 | static void jsm_io_resume(struct pci_dev *pdev) | ||
265 | { | ||
266 | struct jsm_board *brd = pci_get_drvdata(pdev); | ||
267 | |||
268 | pci_restore_state(pdev); | ||
269 | |||
270 | jsm_uart_port_init(brd); | ||
271 | } | ||
272 | |||
227 | static int __init jsm_init_module(void) | 273 | static int __init jsm_init_module(void) |
228 | { | 274 | { |
229 | int rc; | 275 | int rc; |
diff --git a/drivers/serial/jsm/jsm_tty.c b/drivers/serial/jsm/jsm_tty.c index 1bcad596f3d6..cd95e215550d 100644 --- a/drivers/serial/jsm/jsm_tty.c +++ b/drivers/serial/jsm/jsm_tty.c | |||
@@ -430,7 +430,7 @@ int __devinit jsm_tty_init(struct jsm_board *brd) | |||
430 | return 0; | 430 | return 0; |
431 | } | 431 | } |
432 | 432 | ||
433 | int __devinit jsm_uart_port_init(struct jsm_board *brd) | 433 | int jsm_uart_port_init(struct jsm_board *brd) |
434 | { | 434 | { |
435 | int i; | 435 | int i; |
436 | unsigned int line; | 436 | unsigned int line; |