changeset 6002:470eddf7e261

6660427 Inconsistant labels on pciexbus faults 6660642 updated fmadm faulty should display DIMM location for memory faults
author stephh
date Wed, 13 Feb 2008 03:58:20 -0800
parents d9154b30d5cf
children 7572223fa718
files usr/src/cmd/fm/fmadm/common/faulty.c usr/src/cmd/fm/fmd/common/fmd_api.c usr/src/lib/fm/topo/modules/common/pcibus/did_props.c usr/src/lib/fm/topo/modules/common/pcibus/pcibus_labels.c
diffstat 4 files changed, 51 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/cmd/fm/fmadm/common/faulty.c	Tue Feb 12 18:05:24 2008 -0800
+++ b/usr/src/cmd/fm/fmadm/common/faulty.c	Wed Feb 13 03:58:20 2008 -0800
@@ -19,7 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -169,6 +169,7 @@
 	uint8_t max_pct;
 	ushort_t count;
 	int status;
+	char *label;
 } name_list_t;
 
 typedef struct ari_list {
@@ -619,6 +620,8 @@
 				lp->pct = np->pct;
 			}
 			max_pct = np->max_pct;
+			if (np->label)
+				free(np->label);
 			free(np->name);
 			free(np);
 			np = NULL;
@@ -720,6 +723,7 @@
 	nlp->next = nlp;
 	nlp->prev = nlp;
 	nlp->status = 0;
+	nlp->label = NULL;
 	return (nlp);
 }
 
@@ -733,6 +737,8 @@
 		do {
 			lp = next;
 			next = lp->next;
+			if (lp->label)
+				free(lp->label);
 			free(lp->name);
 			free(lp);
 		} while (next != list);
@@ -1045,6 +1051,7 @@
 	char *name;
 	uint8_t lpct = 0;
 	char *lclass = NULL;
+	char *label;
 
 	(void) nvlist_lookup_uint8(nvl, FM_FAULT_CERTAINTY, &lpct);
 	if (nvlist_lookup_string(nvl, FM_CLASS, &lclass) == 0) {
@@ -1056,6 +1063,9 @@
 		if (name != NULL) {
 			nlp = alloc_name_list(name, lpct);
 			free(name);
+			if (nvlist_lookup_string(nvl, FM_FAULT_LOCATION,
+			    &label) == 0)
+				nlp->label = strdup(label);
 			(void) merge_name_list(fru_p, nlp, 1);
 		}
 		get_serial_no(lfru, serial_p, lpct);
@@ -1336,13 +1346,17 @@
 	padding[l] = 0;
 	(void) printf("%s", label);
 	name = list->name;
-	if (func)
+	if (func == NULL)
+		(void) printf(" %s", name);
+	else if (list->label)
+		(void) printf(" \"%s\" (%s)", list->label, name);
+	else {
 		fru = func(list->name);
-	if (fru) {
-		(void) printf(" \"%s\" (%s)", fru, name);
-		free(fru);
-	} else {
-		(void) printf(" %s", name);
+		if (fru) {
+			(void) printf(" \"%s\" (%s)", fru, name);
+			free(fru);
+		} else
+			(void) printf(" %s", name);
 	}
 	if (list->pct && pct > 0 && pct < 100) {
 		if (list->count > 1) {
@@ -1645,14 +1659,28 @@
 				(void) printf("-----------------------------"
 				    "---------------------------------------"
 				    "----------\n");
-			fru_label = get_fmri_label(tp->resource);
-			if (fru_label) {
-				(void) printf("\"%s\" (%s)\n", fru_label,
-				    tp->resource);
-				free(fru_label);
-			} else {
-				(void) printf("%s\n", tp->resource);
-			}
+			slp = tp->status_rec_list;
+			end = slp;
+			do {
+				srp = slp->status_record;
+				fru = find_fru(srp, tp->resource);
+				if (fru) {
+					if (fru->label)
+						(void) printf("\"%s\" (%s)\n",
+						    fru->label, fru->name);
+					else if (fru_label =
+					    get_fmri_label(fru->name)) {
+						(void) printf("\"%s\" (%s)\n",
+						    fru_label, fru->name);
+						free(fru_label);
+					} else
+						(void) printf("%s\n",
+						    fru->name);
+					break;
+				}
+				slp = slp->next;
+			} while (slp != end);
+
 			slp = tp->status_rec_list;
 			end = slp;
 			do {
--- a/usr/src/cmd/fm/fmd/common/fmd_api.c	Tue Feb 12 18:05:24 2008 -0800
+++ b/usr/src/cmd/fm/fmd/common/fmd_api.c	Wed Feb 13 03:58:20 2008 -0800
@@ -20,7 +20,7 @@
  */
 
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -1696,9 +1696,7 @@
 	/*
 	 * Try to find the location label for this resource
 	 */
-	(void) topo_fmri_label(thp, rsrc, &loc, &err);
-	if (loc == NULL)
-		(void) topo_fmri_label(thp, fru, &loc, &err);
+	(void) topo_fmri_label(thp, fru, &loc, &err);
 
 	nvl = fmd_protocol_fault(class, certainty, asru, fru, rsrc, loc);
 
--- a/usr/src/lib/fm/topo/modules/common/pcibus/did_props.c	Tue Feb 12 18:05:24 2008 -0800
+++ b/usr/src/lib/fm/topo/modules/common/pcibus/did_props.c	Wed Feb 13 03:58:20 2008 -0800
@@ -20,7 +20,7 @@
  */
 
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -527,7 +527,7 @@
 	 * the label.
 	 */
 	if (strcmp(nm, IOBOARD) != 0 && strcmp(nm, PCI_DEVICE) != 0 &&
-	    strcmp(nm, PCIEX_DEVICE) != 0) {
+	    strcmp(nm, PCIEX_DEVICE) != 0 && strcmp(nm, PCIEX_BUS) != 0) {
 		(void) topo_node_fru_set(tn, NULL, 0, &e);
 		return (0);
 	}
@@ -539,7 +539,7 @@
 		e = FRU_fmri_set(mp, tn);
 		return (e);
 	} else if (strcmp(nm, PCI_DEVICE) == 0 ||
-	    strcmp(nm, PCIEX_DEVICE) == 0) {
+	    strcmp(nm, PCIEX_DEVICE) == 0 || strcmp(nm, PCIEX_BUS) == 0) {
 		nvlist_t *in, *out;
 
 		mp = did_mod(pd);
--- a/usr/src/lib/fm/topo/modules/common/pcibus/pcibus_labels.c	Tue Feb 12 18:05:24 2008 -0800
+++ b/usr/src/lib/fm/topo/modules/common/pcibus/pcibus_labels.c	Wed Feb 13 03:58:20 2008 -0800
@@ -20,7 +20,7 @@
  */
 
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -230,7 +230,8 @@
 
 	*out = NULL;
 	nm = topo_node_name(node);
-	if (strcmp(nm, PCI_DEVICE) != 0 && strcmp(nm, PCIEX_DEVICE) != 0)
+	if (strcmp(nm, PCI_DEVICE) != 0 && strcmp(nm, PCIEX_DEVICE) != 0 &&
+	    strcmp(nm, PCIEX_BUS) != 0)
 		return (0);
 
 	if (nvlist_lookup_uint64(in, "nv1", &ptr) != 0) {