6935779 Fabric xlate should look for correct RP from both BDF and Address
authorCheng Sean Ye <Sean.Ye@Sun.COM>
Tue, 13 Apr 2010 00:40:59 +0800
changeset 12132 11fecf096087
parent 12131 eef56db764ab
child 12133 f74e162859bd
6935779 Fabric xlate should look for correct RP from both BDF and Address 6937136 TRU errors (568-572) resulting in 2 diagnosis'.
usr/src/cmd/fm/eversholt/files/common/pciexrc.esc
usr/src/cmd/fm/modules/common/fabric-xlate/fabric-xlate.h
usr/src/cmd/fm/modules/common/fabric-xlate/fx_epkt.c
usr/src/cmd/fm/modules/common/fabric-xlate/fx_subr.c
--- a/usr/src/cmd/fm/eversholt/files/common/pciexrc.esc	Mon Apr 12 11:54:14 2010 -0400
+++ b/usr/src/cmd/fm/eversholt/files/common/pciexrc.esc	Tue Apr 13 00:40:59 2010 +0800
@@ -19,8 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
  */
 
 #pragma dictionary "PCIEX"
@@ -51,11 +50,27 @@
 
 #define IS_CE (EPKT_C_BIT != 0 && setserdsuffix(EPKT_DESC))
 #define IS_UE (EPKT_C_BIT == 0)
+
+/*
+ * BLOCK bit set means the error may cause a pipe stall and thus a CTO
+ * in the fabric
+ */
 #define IS_BLOCKED (EPKT_B_BIT != 0)
 
 #define EPKT(b, o, p, c, d) \
     ereport.io.pciex.rc.epkt@hostbridge { MATCHES_DESC(b, o, p, c, d) }
 
+/* Errors that will be diagnosed by the fabric DE (pciex.esc) */
+#define	DIAG_BY_FAB \
+	(MATCHES_DESC(BLOCK_INTR,OP_MSI32,PH_DATA,CND_ILL,DIR_IRR) ||	\
+	MATCHES_DESC(BLOCK_PORT,OP_LINK,PH_FC,CND_TO,DIR_IRR) ||	\
+	MATCHES_DESC(BLOCK_PORT,OP_PIO,PH_IRR,CND_INV,DIR_RDWR) ||	\
+	MATCHES_DESC(BLOCK_PORT,OP_PIO,PH_IRR,CND_RCA,DIR_WRITE) ||	\
+	MATCHES_DESC(BLOCK_PORT,OP_PIO,PH_IRR,CND_RUR,DIR_WRITE) ||	\
+	MATCHES_DESC(BLOCK_PORT,OP_PIO,PH_IRR,CND_TO,DIR_READ) ||	\
+	MATCHES_DESC(BLOCK_PORT,OP_PIO,PH_IRR,CND_TO,DIR_WRITE) ||	\
+	MATCHES_DESC(BLOCK_PORT,OP_PIO,PH_IRR,CND_UC,DIR_IRR))
+
 /* Ereport Events */
 event ereport.io.pciex.rc.epkt@hostbridge {within(5s)};
 
@@ -70,6 +85,7 @@
 event error.io.pciex.degraded-d@hostbridge/pciexrc/PCIEXFN;
 
 /* Upset event */
+event upset.io.pciex.rc.stall@hostbridge;
 event upset.io.pciex.rc.discard@hostbridge;
 
 /*
@@ -152,9 +168,8 @@
 /* Errors that will cause a pipe stall and thus a CTO in the fabric */
 prop error.io.pciex.rc.stall@hostbridge (0) -> 
     error.io.pciex.nr-d@hostbridge/pciexrc<>/PCIEXFNHZ;
-
 prop error.io.pciex.rc.stall@hostbridge { IS_UE && IS_BLOCKED } -> 
-    ereport.io.pciex.rc.epkt@hostbridge;
+    ereport.io.pciex.rc.epkt@hostbridge { !DIAG_BY_FAB };
 
 /*
  * Errors that will send a poisoned data to the fabric
@@ -179,17 +194,18 @@
 	MATCHES_DESC(BLOCK_MMU,OP_XLAT,PH_DATA,CND_PROT,DIR_RDWR)
     };
 
-prop upset.io.pciex.rc.discard@hostbridge -> 
-    ereport.io.pciex.rc.epkt@hostbridge {
-	MATCHES_DESC(BLOCK_INTR,OP_MSI32,PH_DATA,CND_ILL,DIR_IRR) ||
-	MATCHES_DESC(BLOCK_PORT,OP_LINK,PH_FC,CND_TO,DIR_IRR) ||
-	MATCHES_DESC(BLOCK_PORT,OP_PIO,PH_IRR,CND_INV,DIR_RDWR) ||
-	MATCHES_DESC(BLOCK_PORT,OP_PIO,PH_IRR,CND_RCA,DIR_WRITE) ||
-	MATCHES_DESC(BLOCK_PORT,OP_PIO,PH_IRR,CND_RUR,DIR_WRITE) ||
-	MATCHES_DESC(BLOCK_PORT,OP_PIO,PH_IRR,CND_TO,DIR_READ) ||
-	MATCHES_DESC(BLOCK_PORT,OP_PIO,PH_IRR,CND_TO,DIR_WRITE) ||
-	MATCHES_DESC(BLOCK_PORT,OP_PIO,PH_IRR,CND_UC,DIR_IRR)
-    };
+/*
+ * The errors will be diagnosed by pciex.esc but may also cause a CTO
+ * in the fabric.
+ */
+prop upset.io.pciex.rc.stall@hostbridge ->
+    ereport.io.pciex.rc.epkt@hostbridge { IS_BLOCKED && DIAG_BY_FAB };
+prop upset.io.pciex.rc.stall@hostbridge (0) ->
+    error.io.pciex.nr-d@hostbridge/pciexrc<>/PCIEXFNHZ;
+
+/* The errors will be discarded here and diagnosed by pciex.esc. */
+prop upset.io.pciex.rc.discard@hostbridge ->
+    ereport.io.pciex.rc.epkt@hostbridge { !IS_BLOCKED && DIAG_BY_FAB };
 
 /* Event queue overflow */
 #define PROP_PLAT_FRU "FRU"
--- a/usr/src/cmd/fm/modules/common/fabric-xlate/fabric-xlate.h	Mon Apr 12 11:54:14 2010 -0400
+++ b/usr/src/cmd/fm/modules/common/fabric-xlate/fabric-xlate.h	Tue Apr 13 00:40:59 2010 +0800
@@ -19,8 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
  */
 
 #ifndef _FABRIC_XLATE_H
@@ -165,6 +164,7 @@
 extern boolean_t fab_get_rcpath(fmd_hdl_t *, nvlist_t *, char *);
 extern char *fab_find_rppath_by_df(fmd_hdl_t *, nvlist_t *, uint8_t);
 extern char *fab_find_rppath_by_devbdf(fmd_hdl_t *, nvlist_t *, pcie_req_id_t);
+extern char *fab_find_rppath_by_devpath(fmd_hdl_t *, const char *);
 extern char *fab_find_addr(fmd_hdl_t *hdl, nvlist_t *nvl, uint64_t addr);
 extern char *fab_find_bdf(fmd_hdl_t *hdl, nvlist_t *nvl, pcie_req_id_t bdf);
 extern boolean_t fab_hc2dev(fmd_hdl_t *, const char *, char **);
--- a/usr/src/cmd/fm/modules/common/fabric-xlate/fx_epkt.c	Mon Apr 12 11:54:14 2010 -0400
+++ b/usr/src/cmd/fm/modules/common/fabric-xlate/fx_epkt.c	Tue Apr 13 00:40:59 2010 +0800
@@ -20,8 +20,7 @@
  */
 
 /*
- * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
  */
 #include <sys/types.h>
 #include <px_err.h>
@@ -151,7 +150,7 @@
 	void *ptr;
 	uint8_t ver;
 	int err;
-	char *rppath = NULL;
+	char *devpath, *rppath = NULL;
 	nvlist_t *detector;
 
 	fmd_hdl_debug(hdl, "epkt ereport received: %s\n", class);
@@ -236,11 +235,20 @@
 		    (uint64_t)data.pcie_ue_tgt_addr);
 
 		/* find the root port to which this error is related */
-		if (data.pcie_ue_tgt_bdf)
+		if (rppath == NULL && data.pcie_ue_tgt_bdf)
 			rppath = fab_find_rppath_by_devbdf(hdl, nvl,
 			    data.pcie_ue_tgt_bdf);
 	}
 
+	/* find the root port by address */
+	if (rppath == NULL && epkt.rc_descr.M != 0) {
+		devpath = fab_find_addr(hdl, nvl, epkt.addr);
+		if (devpath) {
+			rppath = fab_find_rppath_by_devpath(hdl, devpath);
+			fmd_hdl_strfree(hdl, devpath);
+		}
+	}
+
 	/*
 	 * reset the detector in the original ereport to the root port
 	 */
--- a/usr/src/cmd/fm/modules/common/fabric-xlate/fx_subr.c	Mon Apr 12 11:54:14 2010 -0400
+++ b/usr/src/cmd/fm/modules/common/fabric-xlate/fx_subr.c	Tue Apr 13 00:40:59 2010 +0800
@@ -20,8 +20,7 @@
  */
 
 /*
- * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
  */
 #include <strings.h>
 #include <fm/topo_hc.h>
@@ -505,6 +504,28 @@
 	return (NULL);
 }
 
+char *
+fab_find_rppath_by_devpath(fmd_hdl_t *hdl, const char *devpath)
+{
+	char	query[500];
+
+	/*
+	 * Explanation of the XSL XPATH Query
+	 * Line 1: Look at all nodes with the node name "propval"
+	 * Line 2: See if the node is pciexrc
+	 * Line 3: Go up to the io pgroup
+	 * Line 4: See if the "dev" prop is parent of devpath
+	 * Line 5: Get the 'dev' prop
+	 */
+	(void) snprintf(query, sizeof (query), "//propval"
+	    "[@name='extended-capabilities' and @value='%s']"
+	    "/parent::*/parent::*/propgroup[@name='io']"
+	    "/propval[@name='dev' and starts-with('%s', concat(@value, '/'))]"
+	    "/@value", PCIEX_ROOT, devpath);
+
+	return (fab_xpath_query(hdl, query));
+}
+
 /* ARGSUSED */
 boolean_t
 fab_get_rcpath(fmd_hdl_t *hdl, nvlist_t *nvl, char *rcpath)