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 |   25 ++++++++++++++++++++++---
 1 files changed, 22 insertions(+), 3 deletions(-)

diff -puN arch/ppc64/kernel/eeh.c~ppc64-log-eeh-errors arch/ppc64/kernel/eeh.c
--- 25/arch/ppc64/kernel/eeh.c~ppc64-log-eeh-errors	2004-02-21 20:58:16.000000000 -0800
+++ 25-akpm/arch/ppc64/kernel/eeh.c	2004-02-21 20:58:16.000000000 -0800
@@ -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 *to
 	 */
 	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 *to
 			 * 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++;

_