linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / arch / powerpc / platforms / pseries / eeh_driver.c
index aaad2c0..b811d5f 100644 (file)
@@ -23,8 +23,9 @@
  *
  */
 #include <linux/delay.h>
-#include <linux/interrupt.h>
 #include <linux/irq.h>
+#include <linux/interrupt.h>
+#include <linux/notifier.h>
 #include <linux/pci.h>
 #include <asm/eeh.h>
 #include <asm/eeh_event.h>
@@ -175,7 +176,7 @@ static void eeh_report_failure(struct pci_dev *dev, void *userdata)
  *
  * pSeries systems will isolate a PCI slot if the PCI-Host
  * bridge detects address or data parity errors, DMA's
- * occurring to wild addresses (which usually happen due to
+ * occuring to wild addresses (which usually happen due to
  * bugs in device drivers or in PCI adapter firmware).
  * Slot isolations also occur if #SERR, #PERR or other misc
  * PCI-related errors are detected.
@@ -201,11 +202,7 @@ static void eeh_report_failure(struct pci_dev *dev, void *userdata)
 
 static int eeh_reset_device (struct pci_dn *pe_dn, struct pci_bus *bus)
 {
-       int cnt, rc;
-
-       /* pcibios will clear the counter; save the value */
-       cnt = pe_dn->eeh_freeze_count;
-
+       int rc;
        if (bus)
                pcibios_remove_pci_devices(bus);
 
@@ -244,7 +241,6 @@ static int eeh_reset_device (struct pci_dn *pe_dn, struct pci_bus *bus)
                ssleep (5);
                pcibios_add_pci_devices(bus);
        }
-       pe_dn->eeh_freeze_count = cnt;
 
        return 0;
 }
@@ -254,29 +250,22 @@ static int eeh_reset_device (struct pci_dn *pe_dn, struct pci_bus *bus)
  */
 #define MAX_WAIT_FOR_RECOVERY 15
 
-struct pci_dn * handle_eeh_events (struct eeh_event *event)
+void handle_eeh_events (struct eeh_event *event)
 {
        struct device_node *frozen_dn;
        struct pci_dn *frozen_pdn;
        struct pci_bus *frozen_bus;
        int rc = 0;
        enum pci_ers_result result = PCI_ERS_RESULT_NONE;
-       const char *location, *pci_str, *drv_str;
 
        frozen_dn = find_device_pe(event->dn);
        frozen_bus = pcibios_find_pci_bus(frozen_dn);
 
        if (!frozen_dn) {
-
-               location = (char *) get_property(event->dn, "ibm,loc-code", NULL);
-               location = location ? location : "unknown";
-               printk(KERN_ERR "EEH: Error: Cannot find partition endpoint "
-                               "for location=%s pci addr=%s\n",
-                       location, pci_name(event->dev));
-               return NULL;
+               printk(KERN_ERR "EEH: Error: Cannot find partition endpoint for %s\n",
+                       pci_name(event->dev));
+               return;
        }
-       location = (char *) get_property(frozen_dn, "ibm,loc-code", NULL);
-       location = location ? location : "unknown";
 
        /* There are two different styles for coming up with the PE.
         * In the old style, it was the highest EEH-capable device
@@ -288,10 +277,9 @@ struct pci_dn * handle_eeh_events (struct eeh_event *event)
                frozen_bus = pcibios_find_pci_bus (frozen_dn->parent);
 
        if (!frozen_bus) {
-               printk(KERN_ERR "EEH: Cannot find PCI bus "
-                       "for location=%s dn=%s\n",
-                       location, frozen_dn->full_name);
-               return NULL;
+               printk(KERN_ERR "EEH: Cannot find PCI bus for %s\n",
+                       frozen_dn->full_name);
+               return;
        }
 
 #if 0
@@ -303,17 +291,9 @@ struct pci_dn * handle_eeh_events (struct eeh_event *event)
 
        frozen_pdn = PCI_DN(frozen_dn);
        frozen_pdn->eeh_freeze_count++;
-
-       if (frozen_pdn->pcidev) {
-               pci_str = pci_name (frozen_pdn->pcidev);
-               drv_str = pcid_name (frozen_pdn->pcidev);
-       } else {
-               pci_str = pci_name (event->dev);
-               drv_str = pcid_name (event->dev);
-       }
        
        if (frozen_pdn->eeh_freeze_count > EEH_MAX_ALLOWED_FREEZES)
-               goto excess_failures;
+               goto hard_fail;
 
        /* If the reset state is a '5' and the time to reset is 0 (infinity)
         * or is more then 15 seconds, then mark this as a permanent failure.
@@ -325,9 +305,10 @@ struct pci_dn * handle_eeh_events (struct eeh_event *event)
 
        eeh_slot_error_detail(frozen_pdn, 1 /* Temporary Error */);
        printk(KERN_WARNING
-          "EEH: This PCI device has failed %d times since last reboot: "
-               "location=%s driver=%s pci addr=%s\n",
-               frozen_pdn->eeh_freeze_count, location, drv_str, pci_str);
+          "EEH: This PCI device has failed %d times since last reboot: %s - %s\n",
+               frozen_pdn->eeh_freeze_count,
+               pci_name (frozen_pdn->pcidev), 
+               pcid_name(frozen_pdn->pcidev));
 
        /* Walk the various device drivers attached to this slot through
         * a reset sequence, giving each an opportunity to do what it needs
@@ -367,29 +348,22 @@ struct pci_dn * handle_eeh_events (struct eeh_event *event)
        /* Tell all device drivers that they can resume operations */
        pci_walk_bus(frozen_bus, eeh_report_resume, NULL);
 
-       return frozen_pdn;
+       return;
        
-excess_failures:
+hard_fail:
        /*
         * About 90% of all real-life EEH failures in the field
         * are due to poorly seated PCI cards. Only 10% or so are
         * due to actual, failed cards.
         */
        printk(KERN_ERR
-          "EEH: PCI device at location=%s driver=%s pci addr=%s \n"
-               "has failed %d times and has been permanently disabled. \n"
-               "Please try reseating this device or replacing it.\n",
-               location, drv_str, pci_str, frozen_pdn->eeh_freeze_count);
-       goto perm_error;
+          "EEH: PCI device %s - %s has failed %d times \n"
+          "and has been permanently disabled.  Please try reseating\n"
+          "this device or replacing it.\n",
+               pci_name (frozen_pdn->pcidev), 
+               pcid_name(frozen_pdn->pcidev), 
+               frozen_pdn->eeh_freeze_count);
 
-hard_fail:
-       printk(KERN_ERR
-          "EEH: Unable to recover from failure of PCI device "
-          "at location=%s driver=%s pci addr=%s \n"
-          "Please try reseating this device or replacing it.\n",
-               location, drv_str, pci_str);
-
-perm_error:
        eeh_slot_error_detail(frozen_pdn, 2 /* Permanent Error */);
 
        /* Notify all devices that they're about to go down. */
@@ -397,8 +371,6 @@ perm_error:
 
        /* Shut down the device drivers for good. */
        pcibios_remove_pci_devices(frozen_bus);
-
-       return NULL;
 }
 
 /* ---------- end of file ---------- */