eeh_driver.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664
  1. /*
  2. * PCI Error Recovery Driver for RPA-compliant PPC64 platform.
  3. * Copyright IBM Corp. 2004 2005
  4. * Copyright Linas Vepstas <linas@linas.org> 2004, 2005
  5. *
  6. * All rights reserved.
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or (at
  11. * your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful, but
  14. * WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  16. * NON INFRINGEMENT. See the GNU General Public License for more
  17. * details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  22. *
  23. * Send comments and feedback to Linas Vepstas <linas@austin.ibm.com>
  24. */
  25. #include <linux/delay.h>
  26. #include <linux/interrupt.h>
  27. #include <linux/irq.h>
  28. #include <linux/module.h>
  29. #include <linux/pci.h>
  30. #include <asm/eeh.h>
  31. #include <asm/eeh_event.h>
  32. #include <asm/ppc-pci.h>
  33. #include <asm/pci-bridge.h>
  34. #include <asm/prom.h>
  35. #include <asm/rtas.h>
  36. /**
  37. * eeh_pcid_name - Retrieve name of PCI device driver
  38. * @pdev: PCI device
  39. *
  40. * This routine is used to retrieve the name of PCI device driver
  41. * if that's valid.
  42. */
  43. static inline const char *eeh_pcid_name(struct pci_dev *pdev)
  44. {
  45. if (pdev && pdev->dev.driver)
  46. return pdev->dev.driver->name;
  47. return "";
  48. }
  49. /**
  50. * eeh_pcid_get - Get the PCI device driver
  51. * @pdev: PCI device
  52. *
  53. * The function is used to retrieve the PCI device driver for
  54. * the indicated PCI device. Besides, we will increase the reference
  55. * of the PCI device driver to prevent that being unloaded on
  56. * the fly. Otherwise, kernel crash would be seen.
  57. */
  58. static inline struct pci_driver *eeh_pcid_get(struct pci_dev *pdev)
  59. {
  60. if (!pdev || !pdev->driver)
  61. return NULL;
  62. if (!try_module_get(pdev->driver->driver.owner))
  63. return NULL;
  64. return pdev->driver;
  65. }
  66. /**
  67. * eeh_pcid_put - Dereference on the PCI device driver
  68. * @pdev: PCI device
  69. *
  70. * The function is called to do dereference on the PCI device
  71. * driver of the indicated PCI device.
  72. */
  73. static inline void eeh_pcid_put(struct pci_dev *pdev)
  74. {
  75. if (!pdev || !pdev->driver)
  76. return;
  77. module_put(pdev->driver->driver.owner);
  78. }
  79. #if 0
  80. static void print_device_node_tree(struct pci_dn *pdn, int dent)
  81. {
  82. int i;
  83. struct device_node *pc;
  84. if (!pdn)
  85. return;
  86. for (i = 0; i < dent; i++)
  87. printk(" ");
  88. printk("dn=%s mode=%x \tcfg_addr=%x pe_addr=%x \tfull=%s\n",
  89. pdn->node->name, pdn->eeh_mode, pdn->eeh_config_addr,
  90. pdn->eeh_pe_config_addr, pdn->node->full_name);
  91. dent += 3;
  92. pc = pdn->node->child;
  93. while (pc) {
  94. print_device_node_tree(PCI_DN(pc), dent);
  95. pc = pc->sibling;
  96. }
  97. }
  98. #endif
  99. /**
  100. * eeh_disable_irq - Disable interrupt for the recovering device
  101. * @dev: PCI device
  102. *
  103. * This routine must be called when reporting temporary or permanent
  104. * error to the particular PCI device to disable interrupt of that
  105. * device. If the device has enabled MSI or MSI-X interrupt, we needn't
  106. * do real work because EEH should freeze DMA transfers for those PCI
  107. * devices encountering EEH errors, which includes MSI or MSI-X.
  108. */
  109. static void eeh_disable_irq(struct pci_dev *dev)
  110. {
  111. struct eeh_dev *edev = pci_dev_to_eeh_dev(dev);
  112. /* Don't disable MSI and MSI-X interrupts. They are
  113. * effectively disabled by the DMA Stopped state
  114. * when an EEH error occurs.
  115. */
  116. if (dev->msi_enabled || dev->msix_enabled)
  117. return;
  118. if (!irq_has_action(dev->irq))
  119. return;
  120. edev->mode |= EEH_DEV_IRQ_DISABLED;
  121. disable_irq_nosync(dev->irq);
  122. }
  123. /**
  124. * eeh_enable_irq - Enable interrupt for the recovering device
  125. * @dev: PCI device
  126. *
  127. * This routine must be called to enable interrupt while failed
  128. * device could be resumed.
  129. */
  130. static void eeh_enable_irq(struct pci_dev *dev)
  131. {
  132. struct eeh_dev *edev = pci_dev_to_eeh_dev(dev);
  133. if ((edev->mode) & EEH_DEV_IRQ_DISABLED) {
  134. edev->mode &= ~EEH_DEV_IRQ_DISABLED;
  135. enable_irq(dev->irq);
  136. }
  137. }
  138. /**
  139. * eeh_report_error - Report pci error to each device driver
  140. * @data: eeh device
  141. * @userdata: return value
  142. *
  143. * Report an EEH error to each device driver, collect up and
  144. * merge the device driver responses. Cumulative response
  145. * passed back in "userdata".
  146. */
  147. static void *eeh_report_error(void *data, void *userdata)
  148. {
  149. struct eeh_dev *edev = (struct eeh_dev *)data;
  150. struct pci_dev *dev = eeh_dev_to_pci_dev(edev);
  151. enum pci_ers_result rc, *res = userdata;
  152. struct pci_driver *driver;
  153. /* We might not have the associated PCI device,
  154. * then we should continue for next one.
  155. */
  156. if (!dev) return NULL;
  157. dev->error_state = pci_channel_io_frozen;
  158. driver = eeh_pcid_get(dev);
  159. if (!driver) return NULL;
  160. eeh_disable_irq(dev);
  161. if (!driver->err_handler ||
  162. !driver->err_handler->error_detected) {
  163. eeh_pcid_put(dev);
  164. return NULL;
  165. }
  166. rc = driver->err_handler->error_detected(dev, pci_channel_io_frozen);
  167. /* A driver that needs a reset trumps all others */
  168. if (rc == PCI_ERS_RESULT_NEED_RESET) *res = rc;
  169. if (*res == PCI_ERS_RESULT_NONE) *res = rc;
  170. eeh_pcid_put(dev);
  171. return NULL;
  172. }
  173. /**
  174. * eeh_report_mmio_enabled - Tell drivers that MMIO has been enabled
  175. * @data: eeh device
  176. * @userdata: return value
  177. *
  178. * Tells each device driver that IO ports, MMIO and config space I/O
  179. * are now enabled. Collects up and merges the device driver responses.
  180. * Cumulative response passed back in "userdata".
  181. */
  182. static void *eeh_report_mmio_enabled(void *data, void *userdata)
  183. {
  184. struct eeh_dev *edev = (struct eeh_dev *)data;
  185. struct pci_dev *dev = eeh_dev_to_pci_dev(edev);
  186. enum pci_ers_result rc, *res = userdata;
  187. struct pci_driver *driver;
  188. driver = eeh_pcid_get(dev);
  189. if (!driver) return NULL;
  190. if (!driver->err_handler ||
  191. !driver->err_handler->mmio_enabled) {
  192. eeh_pcid_put(dev);
  193. return NULL;
  194. }
  195. rc = driver->err_handler->mmio_enabled(dev);
  196. /* A driver that needs a reset trumps all others */
  197. if (rc == PCI_ERS_RESULT_NEED_RESET) *res = rc;
  198. if (*res == PCI_ERS_RESULT_NONE) *res = rc;
  199. eeh_pcid_put(dev);
  200. return NULL;
  201. }
  202. /**
  203. * eeh_report_reset - Tell device that slot has been reset
  204. * @data: eeh device
  205. * @userdata: return value
  206. *
  207. * This routine must be called while EEH tries to reset particular
  208. * PCI device so that the associated PCI device driver could take
  209. * some actions, usually to save data the driver needs so that the
  210. * driver can work again while the device is recovered.
  211. */
  212. static void *eeh_report_reset(void *data, void *userdata)
  213. {
  214. struct eeh_dev *edev = (struct eeh_dev *)data;
  215. struct pci_dev *dev = eeh_dev_to_pci_dev(edev);
  216. enum pci_ers_result rc, *res = userdata;
  217. struct pci_driver *driver;
  218. if (!dev) return NULL;
  219. dev->error_state = pci_channel_io_normal;
  220. driver = eeh_pcid_get(dev);
  221. if (!driver) return NULL;
  222. eeh_enable_irq(dev);
  223. if (!driver->err_handler ||
  224. !driver->err_handler->slot_reset) {
  225. eeh_pcid_put(dev);
  226. return NULL;
  227. }
  228. rc = driver->err_handler->slot_reset(dev);
  229. if ((*res == PCI_ERS_RESULT_NONE) ||
  230. (*res == PCI_ERS_RESULT_RECOVERED)) *res = rc;
  231. if (*res == PCI_ERS_RESULT_DISCONNECT &&
  232. rc == PCI_ERS_RESULT_NEED_RESET) *res = rc;
  233. eeh_pcid_put(dev);
  234. return NULL;
  235. }
  236. /**
  237. * eeh_report_resume - Tell device to resume normal operations
  238. * @data: eeh device
  239. * @userdata: return value
  240. *
  241. * This routine must be called to notify the device driver that it
  242. * could resume so that the device driver can do some initialization
  243. * to make the recovered device work again.
  244. */
  245. static void *eeh_report_resume(void *data, void *userdata)
  246. {
  247. struct eeh_dev *edev = (struct eeh_dev *)data;
  248. struct pci_dev *dev = eeh_dev_to_pci_dev(edev);
  249. struct pci_driver *driver;
  250. if (!dev) return NULL;
  251. dev->error_state = pci_channel_io_normal;
  252. driver = eeh_pcid_get(dev);
  253. if (!driver) return NULL;
  254. eeh_enable_irq(dev);
  255. if (!driver->err_handler ||
  256. !driver->err_handler->resume) {
  257. eeh_pcid_put(dev);
  258. return NULL;
  259. }
  260. driver->err_handler->resume(dev);
  261. eeh_pcid_put(dev);
  262. return NULL;
  263. }
  264. /**
  265. * eeh_report_failure - Tell device driver that device is dead.
  266. * @data: eeh device
  267. * @userdata: return value
  268. *
  269. * This informs the device driver that the device is permanently
  270. * dead, and that no further recovery attempts will be made on it.
  271. */
  272. static void *eeh_report_failure(void *data, void *userdata)
  273. {
  274. struct eeh_dev *edev = (struct eeh_dev *)data;
  275. struct pci_dev *dev = eeh_dev_to_pci_dev(edev);
  276. struct pci_driver *driver;
  277. if (!dev) return NULL;
  278. dev->error_state = pci_channel_io_perm_failure;
  279. driver = eeh_pcid_get(dev);
  280. if (!driver) return NULL;
  281. eeh_disable_irq(dev);
  282. if (!driver->err_handler ||
  283. !driver->err_handler->error_detected) {
  284. eeh_pcid_put(dev);
  285. return NULL;
  286. }
  287. driver->err_handler->error_detected(dev, pci_channel_io_perm_failure);
  288. eeh_pcid_put(dev);
  289. return NULL;
  290. }
  291. /**
  292. * eeh_reset_device - Perform actual reset of a pci slot
  293. * @pe: EEH PE
  294. * @bus: PCI bus corresponding to the isolcated slot
  295. *
  296. * This routine must be called to do reset on the indicated PE.
  297. * During the reset, udev might be invoked because those affected
  298. * PCI devices will be removed and then added.
  299. */
  300. static int eeh_reset_device(struct eeh_pe *pe, struct pci_bus *bus)
  301. {
  302. struct timeval tstamp;
  303. int cnt, rc;
  304. /* pcibios will clear the counter; save the value */
  305. cnt = pe->freeze_count;
  306. tstamp = pe->tstamp;
  307. /*
  308. * We don't remove the corresponding PE instances because
  309. * we need the information afterwords. The attached EEH
  310. * devices are expected to be attached soon when calling
  311. * into pcibios_add_pci_devices().
  312. */
  313. if (bus) {
  314. eeh_pe_state_mark(pe, EEH_PE_KEEP);
  315. pcibios_remove_pci_devices(bus);
  316. }
  317. /* Reset the pci controller. (Asserts RST#; resets config space).
  318. * Reconfigure bridges and devices. Don't try to bring the system
  319. * up if the reset failed for some reason.
  320. */
  321. rc = eeh_reset_pe(pe);
  322. if (rc)
  323. return rc;
  324. /* Restore PE */
  325. eeh_ops->configure_bridge(pe);
  326. eeh_pe_restore_bars(pe);
  327. /* Give the system 5 seconds to finish running the user-space
  328. * hotplug shutdown scripts, e.g. ifdown for ethernet. Yes,
  329. * this is a hack, but if we don't do this, and try to bring
  330. * the device up before the scripts have taken it down,
  331. * potentially weird things happen.
  332. */
  333. if (bus) {
  334. ssleep(5);
  335. pcibios_add_pci_devices(bus);
  336. eeh_pe_state_clear(pe, EEH_PE_KEEP);
  337. }
  338. pe->tstamp = tstamp;
  339. pe->freeze_count = cnt;
  340. return 0;
  341. }
  342. /* The longest amount of time to wait for a pci device
  343. * to come back on line, in seconds.
  344. */
  345. #define MAX_WAIT_FOR_RECOVERY 150
  346. static void eeh_handle_normal_event(struct eeh_pe *pe)
  347. {
  348. struct pci_bus *frozen_bus;
  349. int rc = 0;
  350. enum pci_ers_result result = PCI_ERS_RESULT_NONE;
  351. frozen_bus = eeh_pe_bus_get(pe);
  352. if (!frozen_bus) {
  353. pr_err("%s: Cannot find PCI bus for PHB#%d-PE#%x\n",
  354. __func__, pe->phb->global_number, pe->addr);
  355. return;
  356. }
  357. eeh_pe_update_time_stamp(pe);
  358. pe->freeze_count++;
  359. if (pe->freeze_count > EEH_MAX_ALLOWED_FREEZES)
  360. goto excess_failures;
  361. pr_warning("EEH: This PCI device has failed %d times in the last hour\n",
  362. pe->freeze_count);
  363. /* Walk the various device drivers attached to this slot through
  364. * a reset sequence, giving each an opportunity to do what it needs
  365. * to accomplish the reset. Each child gets a report of the
  366. * status ... if any child can't handle the reset, then the entire
  367. * slot is dlpar removed and added.
  368. */
  369. pr_info("EEH: Notify device drivers to shutdown\n");
  370. eeh_pe_dev_traverse(pe, eeh_report_error, &result);
  371. /* Get the current PCI slot state. This can take a long time,
  372. * sometimes over 3 seconds for certain systems.
  373. */
  374. rc = eeh_ops->wait_state(pe, MAX_WAIT_FOR_RECOVERY*1000);
  375. if (rc < 0 || rc == EEH_STATE_NOT_SUPPORT) {
  376. pr_warning("EEH: Permanent failure\n");
  377. goto hard_fail;
  378. }
  379. /* Since rtas may enable MMIO when posting the error log,
  380. * don't post the error log until after all dev drivers
  381. * have been informed.
  382. */
  383. pr_info("EEH: Collect temporary log\n");
  384. eeh_slot_error_detail(pe, EEH_LOG_TEMP);
  385. /* If all device drivers were EEH-unaware, then shut
  386. * down all of the device drivers, and hope they
  387. * go down willingly, without panicing the system.
  388. */
  389. if (result == PCI_ERS_RESULT_NONE) {
  390. pr_info("EEH: Reset with hotplug activity\n");
  391. rc = eeh_reset_device(pe, frozen_bus);
  392. if (rc) {
  393. pr_warning("%s: Unable to reset, err=%d\n",
  394. __func__, rc);
  395. goto hard_fail;
  396. }
  397. }
  398. /* If all devices reported they can proceed, then re-enable MMIO */
  399. if (result == PCI_ERS_RESULT_CAN_RECOVER) {
  400. pr_info("EEH: Enable I/O for affected devices\n");
  401. rc = eeh_pci_enable(pe, EEH_OPT_THAW_MMIO);
  402. if (rc < 0)
  403. goto hard_fail;
  404. if (rc) {
  405. result = PCI_ERS_RESULT_NEED_RESET;
  406. } else {
  407. pr_info("EEH: Notify device drivers to resume I/O\n");
  408. result = PCI_ERS_RESULT_NONE;
  409. eeh_pe_dev_traverse(pe, eeh_report_mmio_enabled, &result);
  410. }
  411. }
  412. /* If all devices reported they can proceed, then re-enable DMA */
  413. if (result == PCI_ERS_RESULT_CAN_RECOVER) {
  414. pr_info("EEH: Enabled DMA for affected devices\n");
  415. rc = eeh_pci_enable(pe, EEH_OPT_THAW_DMA);
  416. if (rc < 0)
  417. goto hard_fail;
  418. if (rc)
  419. result = PCI_ERS_RESULT_NEED_RESET;
  420. else
  421. result = PCI_ERS_RESULT_RECOVERED;
  422. }
  423. /* If any device has a hard failure, then shut off everything. */
  424. if (result == PCI_ERS_RESULT_DISCONNECT) {
  425. pr_warning("EEH: Device driver gave up\n");
  426. goto hard_fail;
  427. }
  428. /* If any device called out for a reset, then reset the slot */
  429. if (result == PCI_ERS_RESULT_NEED_RESET) {
  430. pr_info("EEH: Reset without hotplug activity\n");
  431. rc = eeh_reset_device(pe, NULL);
  432. if (rc) {
  433. pr_warning("%s: Cannot reset, err=%d\n",
  434. __func__, rc);
  435. goto hard_fail;
  436. }
  437. pr_info("EEH: Notify device drivers "
  438. "the completion of reset\n");
  439. result = PCI_ERS_RESULT_NONE;
  440. eeh_pe_dev_traverse(pe, eeh_report_reset, &result);
  441. }
  442. /* All devices should claim they have recovered by now. */
  443. if ((result != PCI_ERS_RESULT_RECOVERED) &&
  444. (result != PCI_ERS_RESULT_NONE)) {
  445. pr_warning("EEH: Not recovered\n");
  446. goto hard_fail;
  447. }
  448. /* Tell all device drivers that they can resume operations */
  449. pr_info("EEH: Notify device driver to resume\n");
  450. eeh_pe_dev_traverse(pe, eeh_report_resume, NULL);
  451. return;
  452. excess_failures:
  453. /*
  454. * About 90% of all real-life EEH failures in the field
  455. * are due to poorly seated PCI cards. Only 10% or so are
  456. * due to actual, failed cards.
  457. */
  458. pr_err("EEH: PHB#%d-PE#%x has failed %d times in the\n"
  459. "last hour and has been permanently disabled.\n"
  460. "Please try reseating or replacing it.\n",
  461. pe->phb->global_number, pe->addr,
  462. pe->freeze_count);
  463. goto perm_error;
  464. hard_fail:
  465. pr_err("EEH: Unable to recover from failure from PHB#%d-PE#%x.\n"
  466. "Please try reseating or replacing it\n",
  467. pe->phb->global_number, pe->addr);
  468. perm_error:
  469. eeh_slot_error_detail(pe, EEH_LOG_PERM);
  470. /* Notify all devices that they're about to go down. */
  471. eeh_pe_dev_traverse(pe, eeh_report_failure, NULL);
  472. /* Shut down the device drivers for good. */
  473. if (frozen_bus)
  474. pcibios_remove_pci_devices(frozen_bus);
  475. }
  476. static void eeh_handle_special_event(void)
  477. {
  478. struct eeh_pe *pe, *phb_pe;
  479. struct pci_bus *bus;
  480. struct pci_controller *hose, *tmp;
  481. unsigned long flags;
  482. int rc = 0;
  483. /*
  484. * The return value from next_error() has been classified as follows.
  485. * It might be good to enumerate them. However, next_error() is only
  486. * supported by PowerNV platform for now. So it would be fine to use
  487. * integer directly:
  488. *
  489. * 4 - Dead IOC 3 - Dead PHB
  490. * 2 - Fenced PHB 1 - Frozen PE
  491. * 0 - No error found
  492. *
  493. */
  494. rc = eeh_ops->next_error(&pe);
  495. if (rc <= 0)
  496. return;
  497. switch (rc) {
  498. case 4:
  499. /* Mark all PHBs in dead state */
  500. eeh_serialize_lock(&flags);
  501. list_for_each_entry_safe(hose, tmp,
  502. &hose_list, list_node) {
  503. phb_pe = eeh_phb_pe_get(hose);
  504. if (!phb_pe) continue;
  505. eeh_pe_state_mark(phb_pe,
  506. EEH_PE_ISOLATED | EEH_PE_PHB_DEAD);
  507. }
  508. eeh_serialize_unlock(flags);
  509. /* Purge all events */
  510. eeh_remove_event(NULL);
  511. break;
  512. case 3:
  513. case 2:
  514. case 1:
  515. /* Mark the PE in fenced state */
  516. eeh_serialize_lock(&flags);
  517. if (rc == 3)
  518. eeh_pe_state_mark(pe,
  519. EEH_PE_ISOLATED | EEH_PE_PHB_DEAD);
  520. else
  521. eeh_pe_state_mark(pe,
  522. EEH_PE_ISOLATED | EEH_PE_RECOVERING);
  523. eeh_serialize_unlock(flags);
  524. /* Purge all events of the PHB */
  525. eeh_remove_event(pe);
  526. break;
  527. default:
  528. pr_err("%s: Invalid value %d from next_error()\n",
  529. __func__, rc);
  530. return;
  531. }
  532. /*
  533. * For fenced PHB and frozen PE, it's handled as normal
  534. * event. We have to remove the affected PHBs for dead
  535. * PHB and IOC
  536. */
  537. if (rc == 2 || rc == 1)
  538. eeh_handle_normal_event(pe);
  539. else {
  540. list_for_each_entry_safe(hose, tmp,
  541. &hose_list, list_node) {
  542. phb_pe = eeh_phb_pe_get(hose);
  543. if (!phb_pe || !(phb_pe->state & EEH_PE_PHB_DEAD))
  544. continue;
  545. bus = eeh_pe_bus_get(phb_pe);
  546. /* Notify all devices that they're about to go down. */
  547. eeh_pe_dev_traverse(pe, eeh_report_failure, NULL);
  548. pcibios_remove_pci_devices(bus);
  549. }
  550. }
  551. }
  552. /**
  553. * eeh_handle_event - Reset a PCI device after hard lockup.
  554. * @pe: EEH PE
  555. *
  556. * While PHB detects address or data parity errors on particular PCI
  557. * slot, the associated PE will be frozen. Besides, DMA's occurring
  558. * to wild addresses (which usually happen due to bugs in device
  559. * drivers or in PCI adapter firmware) can cause EEH error. #SERR,
  560. * #PERR or other misc PCI-related errors also can trigger EEH errors.
  561. *
  562. * Recovery process consists of unplugging the device driver (which
  563. * generated hotplug events to userspace), then issuing a PCI #RST to
  564. * the device, then reconfiguring the PCI config space for all bridges
  565. * & devices under this slot, and then finally restarting the device
  566. * drivers (which cause a second set of hotplug events to go out to
  567. * userspace).
  568. */
  569. void eeh_handle_event(struct eeh_pe *pe)
  570. {
  571. if (pe)
  572. eeh_handle_normal_event(pe);
  573. else
  574. eeh_handle_special_event();
  575. }