4018 mpt_sas: allow physical topology enumeration in libtopo
[illumos-gate.git] / usr / src / lib / fm / topo / libtopo / common / topo_snap.c
blob53d91cd8388d8894cd8ada58cb407ec337a6ca37
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
22 * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
26 * Snapshot Library Interfaces
28 * Consumers of topology data may use the interfaces in this file to open,
29 * snapshot and close a topology exported by FMRI scheme (hc, mem and cpu)
30 * builtin plugins and their helper modules. A topology handle is obtained
31 * by calling topo_open(). Upon a successful return, the caller may use this
32 * handle to open a new snapshot. Each snapshot is assigned a Universally
33 * Unique Identifier that in a future enchancement to the libtopo API will be
34 * used as the file locator in /var/fm/topo to persist new snapshots or lookup
35 * a previously captured snapshot. topo_snap_hold() will capture the current
36 * system topology. All consumers of the topo_hdl_t argument will be
37 * blocked from accessing the topology trees until the snapshot completes.
39 * A snapshot may be cleared by calling topo_snap_rele(). As with
40 * topo_snap_hold(), all topology accesses are blocked until the topology
41 * trees have been released and deallocated.
43 * Walker Library Interfaces
45 * Once a snapshot has been taken with topo_snap_hold(), topo_hdl_t holders
46 * may initiate topology tree walks on a scheme-tree basis. topo_walk_init()
47 * will initiate the data structures required to walk any one one of the
48 * FMRI scheme trees. The walker data structure, topo_walk_t, is an opaque
49 * handle passed to topo_walk_step to begin the walk. At each node in the
50 * topology tree, a callback function is called with access to the node at
51 * which our current walk falls. The callback function is passed in during
52 * calls to topo_walk_init() and used throughout the walk_step of the
53 * scheme tree. At any time, the callback may terminate the walk by returning
54 * TOPO_WALK_TERMINATE or TOPO_WALK_ERR. TOPO_WALK_NEXT will continue the walk.
56 * The type of walk through the tree may be sibling first or child first by
57 * respectively passing in TOPO_WALK_SIBLING or TOPO_WALK_CHILD to
58 * the topo_walk_step() function. Topology nodes
59 * associated with an outstanding walk are held in place and will not be
60 * deallocated until the walk through that node completes.
62 * Once the walk has terminated, the walking process should call
63 * topo_walk_fini() to clean-up resources created in topo_walk_init()
64 * and release nodes that may be still held.
67 #include <alloca.h>
68 #include <ctype.h>
69 #include <pthread.h>
70 #include <limits.h>
71 #include <assert.h>
72 #include <fcntl.h>
73 #include <smbios.h>
74 #include <sys/param.h>
75 #include <sys/types.h>
76 #include <sys/stat.h>
77 #include <sys/systeminfo.h>
78 #include <sys/utsname.h>
79 #include <uuid/uuid.h>
80 #include <zone.h>
82 #include <fm/libtopo.h>
83 #include <sys/fm/protocol.h>
85 #include <topo_alloc.h>
86 #include <topo_builtin.h>
87 #include <topo_string.h>
88 #include <topo_error.h>
89 #include <topo_subr.h>
91 static void topo_snap_destroy(topo_hdl_t *);
93 static topo_hdl_t *
94 set_open_errno(topo_hdl_t *thp, int *errp, int err)
96 if (thp != NULL) {
97 topo_close(thp);
99 if (errp != NULL)
100 *errp = err;
101 return (NULL);
104 topo_hdl_t *
105 topo_open(int version, const char *rootdir, int *errp)
107 topo_hdl_t *thp = NULL;
108 topo_alloc_t *tap;
110 char platform[MAXNAMELEN];
111 char isa[MAXNAMELEN];
112 struct utsname uts;
113 struct stat st;
115 smbios_hdl_t *shp;
116 smbios_system_t s1;
117 smbios_info_t s2;
118 id_t id;
120 char *dbflags, *dbout;
122 if (version != TOPO_VERSION)
123 return (set_open_errno(thp, errp, ETOPO_HDL_ABIVER));
125 if (rootdir != NULL && stat(rootdir, &st) < 0)
126 return (set_open_errno(thp, errp, ETOPO_HDL_INVAL));
128 if ((thp = topo_zalloc(sizeof (topo_hdl_t), 0)) == NULL)
129 return (set_open_errno(thp, errp, ETOPO_NOMEM));
131 (void) pthread_mutex_init(&thp->th_lock, NULL);
133 if ((tap = topo_zalloc(sizeof (topo_alloc_t), 0)) == NULL)
134 return (set_open_errno(thp, errp, ETOPO_NOMEM));
137 * Install default allocators
139 tap->ta_flags = 0;
140 tap->ta_alloc = topo_alloc;
141 tap->ta_zalloc = topo_zalloc;
142 tap->ta_free = topo_free;
143 tap->ta_nvops.nv_ao_alloc = topo_nv_alloc;
144 tap->ta_nvops.nv_ao_free = topo_nv_free;
145 (void) nv_alloc_init(&tap->ta_nva, &tap->ta_nvops);
146 thp->th_alloc = tap;
148 if ((thp->th_modhash = topo_modhash_create(thp)) == NULL)
149 return (set_open_errno(thp, errp, ETOPO_NOMEM));
152 * Set-up system information and search paths for modules
153 * and topology map files
155 if (rootdir == NULL) {
156 rootdir = topo_hdl_strdup(thp, "/");
157 thp->th_rootdir = (char *)rootdir;
158 } else {
159 int len;
160 char *rpath;
162 len = strlen(rootdir);
163 if (len >= PATH_MAX)
164 return (set_open_errno(thp, errp, EINVAL));
166 if (rootdir[len - 1] != '/') {
167 rpath = alloca(len + 2);
168 (void) snprintf(rpath, len + 2, "%s/", rootdir);
169 } else {
170 rpath = (char *)rootdir;
172 thp->th_rootdir = topo_hdl_strdup(thp, rpath);
175 platform[0] = '\0';
176 isa[0] = '\0';
177 (void) sysinfo(SI_PLATFORM, platform, sizeof (platform));
178 (void) sysinfo(SI_ARCHITECTURE, isa, sizeof (isa));
179 (void) uname(&uts);
180 thp->th_platform = topo_hdl_strdup(thp, platform);
181 thp->th_isa = topo_hdl_strdup(thp, isa);
182 thp->th_machine = topo_hdl_strdup(thp, uts.machine);
183 if ((shp = smbios_open(NULL, SMB_VERSION, 0, NULL)) != NULL) {
184 if ((id = smbios_info_system(shp, &s1)) != SMB_ERR &&
185 smbios_info_common(shp, id, &s2) != SMB_ERR) {
187 if (strcmp(s2.smbi_product, SMB_DEFAULT1) != 0 &&
188 strcmp(s2.smbi_product, SMB_DEFAULT2) != 0) {
189 thp->th_product = topo_cleanup_auth_str(thp,
190 (char *)s2.smbi_product);
193 smbios_close(shp);
194 } else {
195 thp->th_product = topo_hdl_strdup(thp, thp->th_platform);
198 if (thp->th_rootdir == NULL || thp->th_platform == NULL ||
199 thp->th_machine == NULL)
200 return (set_open_errno(thp, errp, ETOPO_NOMEM));
202 dbflags = getenv("TOPO_DEBUG");
203 dbout = getenv("TOPO_DEBUG_OUT");
204 if (dbflags != NULL)
205 topo_debug_set(thp, dbflags, dbout);
207 if (topo_builtin_create(thp, thp->th_rootdir) != 0) {
208 topo_dprintf(thp, TOPO_DBG_ERR,
209 "failed to load builtin modules: %s\n",
210 topo_hdl_errmsg(thp));
211 return (set_open_errno(thp, errp, topo_hdl_errno(thp)));
214 return (thp);
217 void
218 topo_close(topo_hdl_t *thp)
220 ttree_t *tp;
222 topo_hdl_lock(thp);
223 if (thp->th_platform != NULL)
224 topo_hdl_strfree(thp, thp->th_platform);
225 if (thp->th_isa != NULL)
226 topo_hdl_strfree(thp, thp->th_isa);
227 if (thp->th_machine != NULL)
228 topo_hdl_strfree(thp, thp->th_machine);
229 if (thp->th_product != NULL)
230 topo_hdl_strfree(thp, thp->th_product);
231 if (thp->th_rootdir != NULL)
232 topo_hdl_strfree(thp, thp->th_rootdir);
233 if (thp->th_ipmi != NULL)
234 ipmi_close(thp->th_ipmi);
235 if (thp->th_smbios != NULL)
236 smbios_close(thp->th_smbios);
239 * Clean-up snapshot
241 topo_snap_destroy(thp);
244 * Clean-up trees
246 while ((tp = topo_list_next(&thp->th_trees)) != NULL) {
247 topo_list_delete(&thp->th_trees, tp);
248 topo_tree_destroy(tp);
252 * Unload all plugins
254 topo_modhash_unload_all(thp);
256 if (thp->th_modhash != NULL)
257 topo_modhash_destroy(thp);
258 if (thp->th_alloc != NULL)
259 topo_free(thp->th_alloc, sizeof (topo_alloc_t));
261 topo_hdl_unlock(thp);
263 topo_free(thp, sizeof (topo_hdl_t));
266 static char *
267 topo_snap_create(topo_hdl_t *thp, int *errp, boolean_t need_force)
269 uuid_t uuid;
270 char *ustr = NULL;
272 topo_hdl_lock(thp);
273 if (thp->th_uuid != NULL) {
274 *errp = ETOPO_HDL_UUID;
275 topo_hdl_unlock(thp);
276 return (NULL);
279 if ((thp->th_uuid = topo_hdl_zalloc(thp, TOPO_UUID_SIZE)) == NULL) {
280 *errp = ETOPO_NOMEM;
281 topo_dprintf(thp, TOPO_DBG_ERR, "unable to allocate uuid: %s\n",
282 topo_strerror(*errp));
283 topo_hdl_unlock(thp);
284 return (NULL);
287 uuid_generate(uuid);
288 uuid_unparse(uuid, thp->th_uuid);
289 if ((ustr = topo_hdl_strdup(thp, thp->th_uuid)) == NULL) {
290 *errp = ETOPO_NOMEM;
291 topo_hdl_unlock(thp);
292 return (NULL);
295 if (need_force) {
296 topo_dprintf(thp, TOPO_DBG_FORCE,
297 "taking a DINFOFORCE snapshot\n");
298 thp->th_di = di_init("/", DINFOFORCE |
299 DINFOSUBTREE | DINFOMINOR | DINFOPROP | DINFOPATH);
300 } else {
301 thp->th_di = di_init("/", DINFOCACHE);
303 thp->th_pi = di_prom_init();
305 if (topo_tree_enum_all(thp) < 0) {
306 topo_dprintf(thp, TOPO_DBG_ERR, "enumeration failure: %s\n",
307 topo_hdl_errmsg(thp));
308 if (topo_hdl_errno(thp) == ETOPO_ENUM_FATAL) {
309 *errp = thp->th_errno;
311 if (thp->th_di != DI_NODE_NIL) {
312 di_fini(thp->th_di);
313 thp->th_di = DI_NODE_NIL;
315 if (thp->th_pi != DI_PROM_HANDLE_NIL) {
316 di_prom_fini(thp->th_pi);
317 thp->th_pi = DI_PROM_HANDLE_NIL;
320 topo_hdl_strfree(thp, ustr);
321 topo_hdl_unlock(thp);
322 return (NULL);
326 if (thp->th_ipmi != NULL &&
327 ipmi_sdr_changed(thp->th_ipmi) &&
328 ipmi_sdr_refresh(thp->th_ipmi) != 0) {
329 topo_dprintf(thp, TOPO_DBG_ERR,
330 "failed to refresh IPMI sdr repository: %s\n",
331 ipmi_errmsg(thp->th_ipmi));
334 topo_hdl_unlock(thp);
336 return (ustr);
339 /*ARGSUSED*/
340 static char *
341 topo_snap_log_create(topo_hdl_t *thp, const char *uuid, int *errp)
343 return ((char *)uuid);
346 /*ARGSUSED*/
347 static int
348 fac_walker(topo_hdl_t *thp, tnode_t *node, void *arg)
350 int err;
351 nvlist_t *out;
353 if (topo_method_supported(node, TOPO_METH_FAC_ENUM, 0)) {
355 * If the facility enumeration method fails, note the failure,
356 * but continue on with the walk.
358 if (topo_method_invoke(node, TOPO_METH_FAC_ENUM, 0, NULL, &out,
359 &err) != 0) {
360 topo_dprintf(thp, TOPO_DBG_ERR,
361 "facility enumeration method failed on node %s=%d "
362 "(%s)\n", topo_node_name(node),
363 topo_node_instance(node), topo_strerror(err));
366 return (TOPO_WALK_NEXT);
370 * Return snapshot id
372 char *
373 topo_snap_hold(topo_hdl_t *thp, const char *uuid, int *errp)
375 topo_walk_t *twp;
377 if (thp == NULL)
378 return (NULL);
380 if (uuid == NULL) {
381 char *ret;
383 if (thp->th_debug & TOPO_DBG_FORCE) {
384 ret = topo_snap_create(thp, errp, B_TRUE);
385 } else {
386 ret = topo_snap_create(thp, errp, B_FALSE);
390 * Now walk the tree and invoke any facility enumeration methods
392 if (ret != NULL && getzoneid() == 0) {
393 if ((twp = topo_walk_init(thp, FM_FMRI_SCHEME_HC,
394 fac_walker, (void *)0, errp)) == NULL) {
395 return (ret);
397 (void) topo_walk_step(twp, TOPO_WALK_CHILD);
398 topo_walk_fini(twp);
400 return (ret);
402 return (topo_snap_log_create(thp, uuid, errp));
405 /*ARGSUSED*/
406 static int
407 topo_walk_destroy(topo_hdl_t *thp, tnode_t *node, void *notused)
409 tnode_t *cnode;
411 cnode = topo_child_first(node);
413 if (cnode != NULL)
414 return (TOPO_WALK_NEXT);
416 topo_node_unbind(node);
418 return (TOPO_WALK_NEXT);
421 static void
422 topo_snap_destroy(topo_hdl_t *thp)
424 int i;
425 ttree_t *tp;
426 topo_walk_t *twp;
427 tnode_t *root;
428 topo_nodehash_t *nhp;
429 topo_mod_t *mod;
431 for (tp = topo_list_next(&thp->th_trees); tp != NULL;
432 tp = topo_list_next(tp)) {
434 root = tp->tt_root;
435 twp = tp->tt_walk;
437 * Clean-up tree nodes from the bottom-up
439 if ((twp->tw_node = topo_child_first(root)) != NULL) {
440 twp->tw_cb = topo_walk_destroy;
441 topo_node_hold(root);
442 topo_node_hold(twp->tw_node); /* released at walk end */
443 (void) topo_walk_bottomup(twp, TOPO_WALK_CHILD);
444 topo_node_rele(root);
448 * Tidy-up the root node
450 while ((nhp = topo_list_next(&root->tn_children)) != NULL) {
451 for (i = 0; i < nhp->th_arrlen; i++) {
452 assert(nhp->th_nodearr[i] == NULL);
454 mod = nhp->th_enum;
455 topo_mod_strfree(mod, nhp->th_name);
456 topo_mod_free(mod, nhp->th_nodearr,
457 nhp->th_arrlen * sizeof (tnode_t *));
458 topo_list_delete(&root->tn_children, nhp);
459 topo_mod_free(mod, nhp, sizeof (topo_nodehash_t));
460 topo_mod_rele(mod);
466 * Clean-up our cached devinfo and prom tree handles.
468 if (thp->th_di != DI_NODE_NIL) {
469 di_fini(thp->th_di);
470 thp->th_di = DI_NODE_NIL;
472 if (thp->th_pi != DI_PROM_HANDLE_NIL) {
473 di_prom_fini(thp->th_pi);
474 thp->th_pi = DI_PROM_HANDLE_NIL;
478 if (thp->th_uuid != NULL) {
479 topo_hdl_free(thp, thp->th_uuid, TOPO_UUID_SIZE);
480 thp->th_uuid = NULL;
484 void
485 topo_snap_release(topo_hdl_t *thp)
487 if (thp == NULL)
488 return;
490 topo_hdl_lock(thp);
491 topo_snap_destroy(thp);
492 topo_hdl_unlock(thp);
495 topo_walk_t *
496 topo_walk_init(topo_hdl_t *thp, const char *scheme, topo_walk_cb_t cb_f,
497 void *pdata, int *errp)
499 ttree_t *tp;
500 topo_walk_t *wp;
502 for (tp = topo_list_next(&thp->th_trees); tp != NULL;
503 tp = topo_list_next(tp)) {
504 if (strcmp(scheme, tp->tt_scheme) == 0) {
507 * Hold the root node and start walk at the first
508 * child node
510 assert(tp->tt_root != NULL);
512 if ((wp = topo_node_walk_init(thp, NULL, tp->tt_root,
513 cb_f, pdata, errp)) == NULL) /* errp set */
514 return (NULL);
516 return (wp);
520 *errp = ETOPO_WALK_NOTFOUND;
521 return (NULL);
524 static int
525 step_child(tnode_t *cnp, topo_walk_t *wp, int flag, int bottomup)
527 int status;
528 tnode_t *nnp;
530 nnp = topo_child_first(cnp);
532 if (nnp == NULL) {
533 topo_dprintf(wp->tw_thp, TOPO_DBG_WALK,
534 "step_child: TOPO_WALK_TERMINATE for %s=%d\n",
535 cnp->tn_name, cnp->tn_instance);
536 return (TOPO_WALK_TERMINATE);
539 topo_dprintf(wp->tw_thp, TOPO_DBG_WALK,
540 "step_child: walk through node %s=%d to %s=%d\n",
541 cnp->tn_name, cnp->tn_instance, nnp->tn_name, nnp->tn_instance);
543 topo_node_hold(nnp); /* released on return from walk_step */
544 wp->tw_node = nnp;
545 if (bottomup == 1)
546 status = topo_walk_bottomup(wp, flag);
547 else
548 status = topo_walk_step(wp, flag);
550 return (status);
553 static int
554 step_sibling(tnode_t *cnp, topo_walk_t *wp, int flag, int bottomup)
556 int status;
557 tnode_t *nnp;
559 nnp = topo_child_next(cnp->tn_parent, cnp);
561 if (nnp == NULL) {
562 topo_dprintf(wp->tw_thp, TOPO_DBG_WALK,
563 "step_sibling: TOPO_WALK_TERMINATE for %s=%d\n",
564 cnp->tn_name, cnp->tn_instance);
565 return (TOPO_WALK_TERMINATE);
568 topo_dprintf(wp->tw_thp, TOPO_DBG_WALK,
569 "step_sibling: through sibling node %s=%d to %s=%d\n",
570 cnp->tn_name, cnp->tn_instance, nnp->tn_name, nnp->tn_instance);
572 topo_node_hold(nnp); /* released on return from walk_step */
573 wp->tw_node = nnp;
574 if (bottomup == 1)
575 status = topo_walk_bottomup(wp, flag);
576 else
577 status = topo_walk_step(wp, flag);
579 return (status);
583 topo_walk_byid(topo_walk_t *wp, const char *name, topo_instance_t inst)
585 int status;
586 tnode_t *nnp, *cnp;
588 cnp = wp->tw_node;
589 nnp = topo_node_lookup(cnp, name, inst);
590 if (nnp == NULL)
591 return (TOPO_WALK_TERMINATE);
593 topo_node_hold(nnp);
594 wp->tw_node = nnp;
595 if (wp->tw_mod != NULL)
596 status = wp->tw_cb(wp->tw_mod, nnp, wp->tw_pdata);
597 else
598 status = wp->tw_cb(wp->tw_thp, nnp, wp->tw_pdata);
599 topo_node_rele(nnp);
600 wp->tw_node = cnp;
602 return (status);
606 topo_walk_bysibling(topo_walk_t *wp, const char *name, topo_instance_t inst)
608 int status;
609 tnode_t *cnp, *pnp;
611 cnp = wp->tw_node;
612 pnp = topo_node_parent(cnp);
613 assert(pnp != NULL);
615 topo_node_hold(pnp);
616 wp->tw_node = pnp;
617 status = topo_walk_byid(wp, name, inst);
618 topo_node_rele(pnp);
619 wp->tw_node = cnp;
621 return (status);
625 topo_walk_step(topo_walk_t *wp, int flag)
627 int status;
628 tnode_t *cnp = wp->tw_node;
630 if (flag != TOPO_WALK_CHILD && flag != TOPO_WALK_SIBLING) {
631 topo_node_rele(cnp);
632 return (TOPO_WALK_ERR);
636 * No more nodes to walk
638 if (cnp == NULL) {
639 topo_dprintf(wp->tw_thp, TOPO_DBG_WALK,
640 "walk_step terminated\n");
641 topo_node_rele(cnp);
642 return (TOPO_WALK_TERMINATE);
646 if (wp->tw_mod != NULL)
647 status = wp->tw_cb(wp->tw_mod, cnp, wp->tw_pdata);
648 else
649 status = wp->tw_cb(wp->tw_thp, cnp, wp->tw_pdata);
652 * Walker callback says we're done
654 if (status != TOPO_WALK_NEXT) {
655 topo_node_rele(cnp);
656 return (status);
659 if (flag == TOPO_WALK_CHILD)
660 status = step_child(cnp, wp, flag, 0);
661 else
662 status = step_sibling(cnp, wp, flag, 0);
665 * No more nodes in this hash, skip to next node hash by stepping
666 * to next sibling (child-first walk) or next child (sibling-first
667 * walk).
669 if (status == TOPO_WALK_TERMINATE) {
670 if (flag == TOPO_WALK_CHILD)
671 status = step_sibling(cnp, wp, flag, 0);
672 else
673 status = step_child(cnp, wp, flag, 0);
676 topo_node_rele(cnp); /* done with current node */
678 return (status);
681 void
682 topo_walk_fini(topo_walk_t *wp)
684 if (wp == NULL)
685 return;
687 topo_node_rele(wp->tw_root);
689 topo_hdl_free(wp->tw_thp, wp, sizeof (topo_walk_t));
693 topo_walk_bottomup(topo_walk_t *wp, int flag)
695 int status;
696 tnode_t *cnp;
698 if (wp == NULL)
699 return (TOPO_WALK_ERR);
701 cnp = wp->tw_node;
702 if (flag != TOPO_WALK_CHILD && flag != TOPO_WALK_SIBLING) {
703 topo_node_rele(cnp);
704 return (TOPO_WALK_ERR);
708 * End of the line
710 if (cnp == NULL) {
711 topo_dprintf(wp->tw_thp, TOPO_DBG_WALK,
712 "walk_bottomup terminated\n");
713 topo_node_rele(cnp);
714 return (TOPO_WALK_TERMINATE);
717 topo_dprintf(wp->tw_thp, TOPO_DBG_WALK,
718 "%s walk_bottomup through node %s=%d\n",
719 (flag == TOPO_WALK_CHILD ? "TOPO_WALK_CHILD" : "TOPO_WALK_SIBLING"),
720 cnp->tn_name, cnp->tn_instance);
722 if (flag == TOPO_WALK_CHILD)
723 status = step_child(cnp, wp, flag, 1);
724 else
725 status = step_sibling(cnp, wp, flag, 1);
728 * At a leaf, run the callback
730 if (status == TOPO_WALK_TERMINATE) {
731 if ((status = wp->tw_cb(wp->tw_thp, cnp, wp->tw_pdata))
732 != TOPO_WALK_NEXT) {
733 topo_node_rele(cnp);
734 return (status);
739 * Try next child or sibling
741 if (status == TOPO_WALK_NEXT) {
742 if (flag == TOPO_WALK_CHILD)
743 status = step_sibling(cnp, wp, flag, 1);
744 else
745 status = step_child(cnp, wp, flag, 1);
748 topo_node_rele(cnp); /* done with current node */
750 return (status);
753 di_node_t
754 topo_hdl_devinfo(topo_hdl_t *thp)
756 return (thp == NULL ? DI_NODE_NIL : thp->th_di);
759 di_prom_handle_t
760 topo_hdl_prominfo(topo_hdl_t *thp)
762 return (thp == NULL ? DI_PROM_HANDLE_NIL : thp->th_pi);