]> git.hungrycats.org Git - linux/commitdiff
[PATCH] ppc64: add rtas slot-error-detail information
authorAndrew Morton <akpm@osdl.org>
Mon, 23 Feb 2004 12:41:41 +0000 (04:41 -0800)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Mon, 23 Feb 2004 12:41:41 +0000 (04:41 -0800)
From: Nathan Fontenot <nfont@austin.ibm.com>

Add call to rtas to retrieve slot-error-detail information and
log this data to nvram in an EEH event.

arch/ppc64/kernel/eeh.c

index 19d61e6471850c695612aa859343baa3d7c9b46f..c338f57a206d7639166707d8d1b8403ed173c735 100644 (file)
@@ -31,6 +31,7 @@
 #include <asm/processor.h>
 #include <asm/naca.h>
 #include <asm/io.h>
+#include <asm/machdep.h>
 #include "pci.h"
 
 #define BUID_HI(buid) ((buid) >> 32)
@@ -49,6 +50,8 @@ static int eeh_implemented;
 static char *eeh_opts;
 static int eeh_opts_last;
 
+unsigned char  slot_err_buf[RTAS_ERROR_LOG_MAX];
+
 pte_t *find_linux_pte(pgd_t *pgdir, unsigned long va); /* from htab.c */
 static int eeh_check_opts_config(struct device_node *dn,
                                 int class_code, int vendor_id, int device_id,
@@ -113,8 +116,22 @@ unsigned long eeh_check_failure(void *token, unsigned long val)
         */
        if (dn->eeh_config_addr) {
                ret = rtas_call(ibm_read_slot_reset_state, 3, 3, rets,
-                               dn->eeh_config_addr, BUID_HI(dn->phb->buid), BUID_LO(dn->phb->buid));
+                               dn->eeh_config_addr, BUID_HI(dn->phb->buid),
+                               BUID_LO(dn->phb->buid));
                if (ret == 0 && rets[1] == 1 && rets[0] >= 2) {
+                       unsigned long   slot_err_ret;
+
+                       memset(slot_err_buf, 0, RTAS_ERROR_LOG_MAX);
+                       slot_err_ret = rtas_call(rtas_token("ibm,slot-error-detail"),
+                                                8, 1, NULL, dn->eeh_config_addr,
+                                                BUID_HI(dn->phb->buid),
+                                                BUID_LO(dn->phb->buid), NULL, 0,
+                                                __pa(slot_err_buf), RTAS_ERROR_LOG_MAX,
+                                                2 /* Permanent Error */);
+
+                       if (slot_err_ret == 0)
+                               log_error(slot_err_buf, ERR_TYPE_RTAS_LOG, 1 /* Fatal */);
+
                        /*
                         * XXX We should create a separate sysctl for this.
                         *
@@ -123,9 +140,11 @@ unsigned long eeh_check_failure(void *token, unsigned long val)
                         * can use it here.
                         */
                        if (panic_on_oops)
-                               panic("EEH: MMIO failure (%ld) on device:\n%s\n", rets[0], pci_name(dev));
+                               panic("EEH: MMIO failure (%ld) on device:\n%s\n",
+                                     rets[0], pci_name(dev));
                        else
-                               printk("EEH: MMIO failure (%ld) on device:\n%s\n", rets[0], pci_name(dev));
+                               printk("EEH: MMIO failure (%ld) on device:\n%s\n",
+                                      rets[0], pci_name(dev));
                }
        }
        eeh_false_positives++;