summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorgongtian zhao - Sun Microsystems - Beijing China <Gongtian.Zhao@Sun.COM>2010-01-15 10:42:30 +0800
committergongtian zhao - Sun Microsystems - Beijing China <Gongtian.Zhao@Sun.COM>2010-01-15 10:42:30 +0800
commitb344f6b3aaff135e766e22b3d18489fe22a74198 (patch)
tree0fb4826193f89dfca72192acaeb40bfbcd38f27e /usr/src
parentac7f5757903d7806e03e59f71c10eec36e0deade (diff)
downloadillumos-joyent-b344f6b3aaff135e766e22b3d18489fe22a74198.tar.gz
6911993 Fabric Xlate should not send rc.xx-msgs on systems with a real PCIe RP.
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/cmd/fm/modules/common/fabric-xlate/fabric-xlate.c4
-rw-r--r--usr/src/cmd/fm/modules/common/fabric-xlate/fabric-xlate.h4
-rw-r--r--usr/src/cmd/fm/modules/common/fabric-xlate/fx_fabric.c44
-rw-r--r--usr/src/cmd/fm/modules/common/fabric-xlate/fx_subr.c22
4 files changed, 61 insertions, 13 deletions
diff --git a/usr/src/cmd/fm/modules/common/fabric-xlate/fabric-xlate.c b/usr/src/cmd/fm/modules/common/fabric-xlate/fabric-xlate.c
index 80f37075de..9000137719 100644
--- a/usr/src/cmd/fm/modules/common/fabric-xlate/fabric-xlate.c
+++ b/usr/src/cmd/fm/modules/common/fabric-xlate/fabric-xlate.c
@@ -20,7 +20,7 @@
*/
/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <fm/libtopo.h>
@@ -72,6 +72,8 @@ fab_update_topo(fmd_hdl_t *hdl)
/* Init xpath */
fab_xpathCtx = xmlXPathNewContext(fab_doc);
+ fab_set_fake_rp(hdl);
+
fab_valid_topo = 1;
}
diff --git a/usr/src/cmd/fm/modules/common/fabric-xlate/fabric-xlate.h b/usr/src/cmd/fm/modules/common/fabric-xlate/fabric-xlate.h
index e03f310bfa..3405848590 100644
--- a/usr/src/cmd/fm/modules/common/fabric-xlate/fabric-xlate.h
+++ b/usr/src/cmd/fm/modules/common/fabric-xlate/fabric-xlate.h
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -165,6 +165,8 @@ 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 **);
extern boolean_t fab_hc2dev_nvl(fmd_hdl_t *, nvlist_t *, char **);
+extern char *fab_get_rpdev(fmd_hdl_t *hdl);
+extern void fab_set_fake_rp(fmd_hdl_t *hdl);
#ifdef __cplusplus
}
diff --git a/usr/src/cmd/fm/modules/common/fabric-xlate/fx_fabric.c b/usr/src/cmd/fm/modules/common/fabric-xlate/fx_fabric.c
index 3a9b1e4f77..5766d86f7d 100644
--- a/usr/src/cmd/fm/modules/common/fabric-xlate/fx_fabric.c
+++ b/usr/src/cmd/fm/modules/common/fabric-xlate/fx_fabric.c
@@ -20,7 +20,7 @@
*/
/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <stddef.h>
@@ -271,15 +271,6 @@ fab_pci_fabric_to_data(fmd_hdl_t *hdl, nvlist_t *nvl, fab_data_t *data)
FAB_LOOKUP(32, "pcie_adv_rp_command", &data->pcie_rp_err_cmd);
FAB_LOOKUP(16, "pcie_adv_rp_ce_src_id", &data->pcie_rp_ce_src_id);
FAB_LOOKUP(16, "pcie_adv_rp_ue_src_id", &data->pcie_rp_ue_src_id);
-
- /*
- * If the system has a PCIe complaint RP with AER, turn off translating
- * fake RP ereports.
- */
- if (fab_xlate_fake_rp &&
- (data->dev_type == PCIE_PCIECAP_DEV_TYPE_ROOT) &&
- data->aer_off)
- fab_xlate_fake_rp = B_FALSE;
}
static int
@@ -806,6 +797,39 @@ fab_xlate_fabric_erpts(fmd_hdl_t *hdl, nvlist_t *nvl, const char *class)
fab_xlate_pcie_erpts(hdl, &data);
}
+void
+fab_set_fake_rp(fmd_hdl_t *hdl)
+{
+ char *rppath = fab_get_rpdev(hdl), *str = NULL;
+ int count = 0;
+
+ if (!rppath) {
+ fmd_hdl_debug(hdl, "Can't find root port dev path");
+ return;
+ }
+
+ /*
+ * For the path '/pci@xxx' is fake root port,
+ * and '/pci@xxx/pci@y' is real root port.
+ */
+ str = rppath;
+ while (*str) {
+ if (*str == '/')
+ count++;
+ str++;
+ }
+
+ if (count == 1)
+ fab_xlate_fake_rp = B_TRUE;
+ else
+ /*
+ * If count is 0, then it should still be B_FALSE
+ */
+ fab_xlate_fake_rp = B_FALSE;
+
+ fmd_hdl_strfree(hdl, rppath);
+}
+
#define SET_TBL(n, err, reg, sz) \
fab_master_err_tbl[n].erpt_tbl = fab_ ## err ## _erpt_tbl; \
fab_master_err_tbl[n].reg_offset = offsetof(fab_data_t, reg); \
diff --git a/usr/src/cmd/fm/modules/common/fabric-xlate/fx_subr.c b/usr/src/cmd/fm/modules/common/fabric-xlate/fx_subr.c
index c88afe982f..bbfefcd8fd 100644
--- a/usr/src/cmd/fm/modules/common/fabric-xlate/fx_subr.c
+++ b/usr/src/cmd/fm/modules/common/fabric-xlate/fx_subr.c
@@ -20,7 +20,7 @@
*/
/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <strings.h>
@@ -835,3 +835,23 @@ fab_pr(fmd_hdl_t *hdl, fmd_event_t *ep, nvlist_t *nvl)
}
}
}
+
+char *
+fab_get_rpdev(fmd_hdl_t *hdl)
+{
+ char *retval;
+ char query[500];
+
+ (void) snprintf(query, sizeof (query), "//propval["
+ "@name='extended-capabilities' and contains(@value, '%s')]"
+ "/parent::*/parent::*/propgroup[@name='io']"
+ "/propval[@name='dev']/@value", PCIEX_ROOT);
+
+ retval = fab_xpath_query(hdl, query);
+ if (retval) {
+ fmd_hdl_debug(hdl, "Root port path is %s\n", retval);
+ return (retval);
+ }
+
+ return (NULL);
+}