summaryrefslogtreecommitdiff
path: root/usr/src/lib
diff options
context:
space:
mode:
authorCheng Sean Ye <Sean.Ye@Sun.COM>2009-02-09 21:39:23 -0800
committerCheng Sean Ye <Sean.Ye@Sun.COM>2009-02-09 21:39:23 -0800
commitc93c462eec9d46f84d567abf52eb29a27c2e134b (patch)
tree317adf43f33929e2e4b9452a05379c8925629eb7 /usr/src/lib
parent47b4653e9ff2a8aebb64f9e357713fd04108674b (diff)
downloadillumos-joyent-c93c462eec9d46f84d567abf52eb29a27c2e134b.tar.gz
6783755 chip: mc_nb_create: node range create failed
6769643 ndi_fmc_entry_error only fails one handle even if multiple handles from same driver map same address 6394503 fmdump should show contents of rotated logs without specifying them explicitly 6741189 need topo interface to export devinfo snapshot to topo snapshot consumers 6741191 libtopo should refresh the devinfo snapshot 6797068 In cpumem-retire, fmd_case_uuclose() is not called under x86
Diffstat (limited to 'usr/src/lib')
-rw-r--r--usr/src/lib/fm/topo/libtopo/common/libtopo.h3
-rw-r--r--usr/src/lib/fm/topo/libtopo/common/mapfile-vers2
-rw-r--r--usr/src/lib/fm/topo/libtopo/common/topo_mod.c26
-rw-r--r--usr/src/lib/fm/topo/libtopo/common/topo_snap.c50
-rw-r--r--usr/src/lib/fm/topo/libtopo/common/topo_tree.c18
-rw-r--r--usr/src/lib/fm/topo/modules/i86pc/chip/chip.c19
6 files changed, 70 insertions, 48 deletions
diff --git a/usr/src/lib/fm/topo/libtopo/common/libtopo.h b/usr/src/lib/fm/topo/libtopo/common/libtopo.h
index 035510dc31..5ff7839b13 100644
--- a/usr/src/lib/fm/topo/libtopo/common/libtopo.h
+++ b/usr/src/lib/fm/topo/libtopo/common/libtopo.h
@@ -29,6 +29,7 @@
#include <sys/nvpair.h>
#include <stdio.h>
+#include <libdevinfo.h>
#ifdef __cplusplus
extern "C" {
@@ -70,6 +71,8 @@ extern topo_walk_t *topo_walk_init(topo_hdl_t *, const char *, topo_walk_cb_t,
void *, int *);
extern int topo_walk_step(topo_walk_t *, int);
extern void topo_walk_fini(topo_walk_t *);
+extern di_node_t topo_hdl_devinfo(topo_hdl_t *);
+extern di_prom_handle_t topo_hdl_prominfo(topo_hdl_t *);
/*
* Walk status returned from walker
diff --git a/usr/src/lib/fm/topo/libtopo/common/mapfile-vers b/usr/src/lib/fm/topo/libtopo/common/mapfile-vers
index c633a2646f..91f96bc860 100644
--- a/usr/src/lib/fm/topo/libtopo/common/mapfile-vers
+++ b/usr/src/lib/fm/topo/libtopo/common/mapfile-vers
@@ -50,11 +50,13 @@ SUNWprivate {
topo_fmri_unretire;
topo_fmri_unusable;
topo_hdl_alloc;
+ topo_hdl_devinfo;
topo_hdl_errmsg;
topo_hdl_errno;
topo_hdl_free;
topo_hdl_nvalloc;
topo_hdl_nvdup;
+ topo_hdl_prominfo;
topo_hdl_strdup;
topo_hdl_strfree;
topo_hdl_zalloc;
diff --git a/usr/src/lib/fm/topo/libtopo/common/topo_mod.c b/usr/src/lib/fm/topo/libtopo/common/topo_mod.c
index 5876f6e0f8..61331c0b50 100644
--- a/usr/src/lib/fm/topo/libtopo/common/topo_mod.c
+++ b/usr/src/lib/fm/topo/libtopo/common/topo_mod.c
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -615,17 +615,6 @@ topo_mod_setdebug(topo_mod_t *mod)
mod->tm_debug = 1;
}
-di_node_t
-topo_mod_devinfo(topo_mod_t *mod)
-{
- topo_hdl_t *thp = mod->tm_hdl;
-
- if (thp->th_di == DI_NODE_NIL)
- thp->th_di = di_init("/", DINFOCPYALL);
-
- return (thp->th_di);
-}
-
ipmi_handle_t *
topo_mod_ipmi_hold(topo_mod_t *mod)
{
@@ -655,15 +644,16 @@ topo_mod_ipmi_rele(topo_mod_t *mod)
(void) pthread_mutex_unlock(&thp->th_ipmi_lock);
}
+di_node_t
+topo_mod_devinfo(topo_mod_t *mod)
+{
+ return (topo_hdl_devinfo(mod->tm_hdl));
+}
+
di_prom_handle_t
topo_mod_prominfo(topo_mod_t *mod)
{
- topo_hdl_t *thp = mod->tm_hdl;
-
- if (thp->th_pi == DI_PROM_HANDLE_NIL)
- thp->th_pi = di_prom_init();
-
- return (thp->th_pi);
+ return (topo_hdl_prominfo(mod->tm_hdl));
}
void
diff --git a/usr/src/lib/fm/topo/libtopo/common/topo_snap.c b/usr/src/lib/fm/topo/libtopo/common/topo_snap.c
index db44b12262..66db84a5a4 100644
--- a/usr/src/lib/fm/topo/libtopo/common/topo_snap.c
+++ b/usr/src/lib/fm/topo/libtopo/common/topo_snap.c
@@ -285,12 +285,31 @@ topo_snap_create(topo_hdl_t *thp, int *errp)
uuid_generate(uuid);
uuid_unparse(uuid, thp->th_uuid);
+ if ((ustr = topo_hdl_strdup(thp, thp->th_uuid)) == NULL) {
+ *errp = ETOPO_NOMEM;
+ topo_hdl_unlock(thp);
+ return (NULL);
+ }
+
+ thp->th_di = di_init("/", DI_CACHE_SNAPSHOT_FLAGS | DINFOCLEANUP);
+ thp->th_pi = di_prom_init();
if (topo_tree_enum_all(thp) < 0) {
topo_dprintf(thp, TOPO_DBG_ERR, "enumeration failure: %s\n",
topo_hdl_errmsg(thp));
if (topo_hdl_errno(thp) == ETOPO_ENUM_FATAL) {
*errp = thp->th_errno;
+
+ if (thp->th_di != DI_NODE_NIL) {
+ di_fini(thp->th_di);
+ thp->th_di = DI_NODE_NIL;
+ }
+ if (thp->th_pi != DI_PROM_HANDLE_NIL) {
+ di_prom_fini(thp->th_pi);
+ thp->th_pi = DI_PROM_HANDLE_NIL;
+ }
+
+ topo_hdl_strfree(thp, ustr);
topo_hdl_unlock(thp);
return (NULL);
}
@@ -304,12 +323,6 @@ topo_snap_create(topo_hdl_t *thp, int *errp)
ipmi_errmsg(thp->th_ipmi));
}
- if ((ustr = topo_hdl_strdup(thp, thp->th_uuid)) == NULL)
- *errp = ETOPO_NOMEM;
-
- thp->th_di = DI_NODE_NIL;
- thp->th_pi = DI_PROM_HANDLE_NIL;
-
topo_hdl_unlock(thp);
return (ustr);
@@ -437,6 +450,19 @@ topo_snap_destroy(topo_hdl_t *thp)
}
+ /*
+ * Clean-up our cached devinfo and prom tree handles.
+ */
+ if (thp->th_di != DI_NODE_NIL) {
+ di_fini(thp->th_di);
+ thp->th_di = DI_NODE_NIL;
+ }
+ if (thp->th_pi != DI_PROM_HANDLE_NIL) {
+ di_prom_fini(thp->th_pi);
+ thp->th_pi = DI_PROM_HANDLE_NIL;
+ }
+
+
if (thp->th_uuid != NULL) {
topo_hdl_free(thp, thp->th_uuid, TOPO_UUID_SIZE);
thp->th_uuid = NULL;
@@ -711,3 +737,15 @@ topo_walk_bottomup(topo_walk_t *wp, int flag)
return (status);
}
+
+di_node_t
+topo_hdl_devinfo(topo_hdl_t *thp)
+{
+ return (thp == NULL ? DI_NODE_NIL : thp->th_di);
+}
+
+di_prom_handle_t
+topo_hdl_prominfo(topo_hdl_t *thp)
+{
+ return (thp == NULL ? DI_PROM_HANDLE_NIL : thp->th_pi);
+}
diff --git a/usr/src/lib/fm/topo/libtopo/common/topo_tree.c b/usr/src/lib/fm/topo/libtopo/common/topo_tree.c
index 515fb3551c..5ecb564ebf 100644
--- a/usr/src/lib/fm/topo/libtopo/common/topo_tree.c
+++ b/usr/src/lib/fm/topo/libtopo/common/topo_tree.c
@@ -19,12 +19,10 @@
* CDDL HEADER END
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* Topology Trees
*
@@ -195,20 +193,6 @@ topo_tree_enum(topo_hdl_t *thp, ttree_t *tp)
}
}
- /*
- * It would be nice to leave the devinfo and prominfo trees
- * active but the interfaces consume copious amounts of memory
- * while searching for property information
- */
- if (thp->th_di != DI_NODE_NIL) {
- di_fini(thp->th_di);
- thp->th_di = DI_NODE_NIL;
- }
- if (thp->th_pi != DI_PROM_HANDLE_NIL) {
- di_prom_fini(thp->th_pi);
- thp->th_pi = DI_PROM_HANDLE_NIL;
- }
-
if (rv != 0)
return (topo_hdl_seterrno(thp, ETOPO_ENUM_NOMAP));
diff --git a/usr/src/lib/fm/topo/modules/i86pc/chip/chip.c b/usr/src/lib/fm/topo/modules/i86pc/chip/chip.c
index 1244f5d603..347c70e9c0 100644
--- a/usr/src/lib/fm/topo/modules/i86pc/chip/chip.c
+++ b/usr/src/lib/fm/topo/modules/i86pc/chip/chip.c
@@ -20,7 +20,7 @@
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -309,7 +309,8 @@ create_chip(topo_mod_t *mod, tnode_t *pnode, topo_instance_t min,
nvlist_t *fmri = NULL;
int err, nerr = 0;
int32_t fms[3];
- const char *vendor = NULL;
+ const char *vendor;
+ boolean_t create_mc = B_FALSE;
if ((err = nvlist_lookup_int32(cpu, FM_PHYSCPU_INFO_CHIP_ID, &chipid))
!= 0) {
@@ -351,6 +352,8 @@ create_chip(topo_mod_t *mod, tnode_t *pnode, topo_instance_t min,
if (topo_node_range_create(mod, chip, CORE_NODE_NAME,
0, 255) != 0)
return (-1);
+
+ create_mc = B_TRUE;
}
err = create_core(mod, chip, cpu, auth);
@@ -359,11 +362,13 @@ create_chip(topo_mod_t *mod, tnode_t *pnode, topo_instance_t min,
* Create memory-controller node under a chip for architectures
* that may have on-chip memory-controller(s).
*/
- if (vendor != NULL && strcmp(vendor, "AuthenticAMD") == 0)
- amd_mc_create(mod, chip, MCT_NODE_NAME, auth,
- fms[0], fms[1], fms[2], &nerr);
- else if (!mc_offchip)
- onchip_mc_create(mod, chip, MCT_NODE_NAME, auth);
+ if (create_mc) {
+ if (strcmp(vendor, "AuthenticAMD") == 0)
+ amd_mc_create(mod, chip, MCT_NODE_NAME, auth,
+ fms[0], fms[1], fms[2], &nerr);
+ else if (!mc_offchip)
+ onchip_mc_create(mod, chip, MCT_NODE_NAME, auth);
+ }
return (err == 0 && nerr == 0 ? 0 : -1);
}