diff options
| author | Michael Bergknoff <Michael.Bergknoff@Sun.COM> | 2008-08-29 07:40:27 -0700 |
|---|---|---|
| committer | Michael Bergknoff <Michael.Bergknoff@Sun.COM> | 2008-08-29 07:40:27 -0700 |
| commit | bdee4892f0e148e31beeecb5bdc80cf57d868f38 (patch) | |
| tree | d583f5e9307668a760cc6264a976561387e8a5fd /usr/src/cmd/picl/plugins/common/devtree/picldevtree.c | |
| parent | 924c13106950186f75f1ee9d0bc5e24a2d404d8c (diff) | |
| download | illumos-gate-bdee4892f0e148e31beeecb5bdc80cf57d868f38.tar.gz | |
6702135 prtdiag -v intermittantly reporting "Getting lane width failed.." error messages on M8000 domain
Diffstat (limited to 'usr/src/cmd/picl/plugins/common/devtree/picldevtree.c')
| -rw-r--r-- | usr/src/cmd/picl/plugins/common/devtree/picldevtree.c | 49 |
1 files changed, 46 insertions, 3 deletions
diff --git a/usr/src/cmd/picl/plugins/common/devtree/picldevtree.c b/usr/src/cmd/picl/plugins/common/devtree/picldevtree.c index 6ae36fed36..f825a88930 100644 --- a/usr/src/cmd/picl/plugins/common/devtree/picldevtree.c +++ b/usr/src/cmd/picl/plugins/common/devtree/picldevtree.c @@ -19,12 +19,10 @@ * 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. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * PICL plug-in that creates device tree nodes for all platforms */ @@ -234,6 +232,7 @@ static builtin_map_t *builtin_map_ptr = NULL; static int builtin_map_size = 0; static char mach_name[SYS_NMLN]; static di_prom_handle_t ph = DI_PROM_HANDLE_NIL; +static int snapshot_stale; /* * UnitAddress mapping table @@ -1506,6 +1505,35 @@ update_subtree(picl_nodehdl_t nodeh, di_node_t dinode) } /* + * Check for a stale OBP node. EINVAL is returned from the openprom(7D) driver + * if the nodeid stored in the snapshot is not valid. + */ +static int +check_stale_node(di_node_t node, void *arg) +{ + di_prom_prop_t promp; + + errno = 0; + promp = di_prom_prop_next(ph, node, DI_PROM_PROP_NIL); + if (promp == DI_PROM_PROP_NIL && errno == EINVAL) { + snapshot_stale = 1; + return (DI_WALK_TERMINATE); + } + return (DI_WALK_CONTINUE); +} + +/* + * Walk the snapshot and check the OBP properties of each node. + */ +static int +is_snapshot_stale(di_node_t root) +{ + snapshot_stale = 0; + di_walk_node(root, DI_WALK_CLDFIRST, NULL, check_stale_node); + return (snapshot_stale); +} + +/* * This function processes the data from libdevinfo and creates nodes * in the PICL tree. */ @@ -1529,6 +1557,21 @@ libdevinfo_init(picl_nodehdl_t rooth) if ((ph = di_prom_init()) == NULL) return (PICL_FAILURE); + + /* + * Check if the snapshot cache contains stale OBP nodeid references. + * If it does release the snapshot and obtain a live snapshot from the + * kernel. + */ + if (is_snapshot_stale(di_root)) { + syslog(LOG_INFO, "picld detected stale snapshot cache"); + di_fini(di_root); + if ((di_root = di_init("/", DINFOCPYALL | DINFOFORCE)) == + DI_NODE_NIL) { + return (PICL_FAILURE); + } + } + /* * create platform PICL node using di_root node */ |
