diff options
Diffstat (limited to 'drivers/serial/jsm/jsm_driver.c')
-rw-r--r-- | drivers/serial/jsm/jsm_driver.c | 46 |
1 files changed, 46 insertions, 0 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; |