Lines Matching refs:node
197 * read-only minor node if we don't have privileges to open the full
199 * node can't perform. (Setgid processes would fail an access() test,
208 * privileged node isn't available. Don't modify errno
317 di_parent_node(di_node_t node)
321 if (node == DI_NODE_NIL) {
326 DPRINTF((DI_TRACE, "Get parent of node %s\n", di_node_name(node)));
328 pa = (caddr_t)node - DI_NODE(node)->self;
330 if (DI_NODE(node)->parent) {
331 return (DI_NODE(pa + DI_NODE(node)->parent));
336 * If parent doesn't exist and node is not the root,
348 di_sibling_node(di_node_t node)
352 if (node == DI_NODE_NIL) {
357 DPRINTF((DI_TRACE, "Get sibling of node %s\n", di_node_name(node)));
359 pa = (caddr_t)node - DI_NODE(node)->self;
361 if (DI_NODE(node)->sibling) {
362 return (DI_NODE(pa + DI_NODE(node)->sibling));
380 di_child_node(di_node_t node)
384 DPRINTF((DI_TRACE, "Get child of node %s\n", di_node_name(node)));
386 if (node == DI_NODE_NIL) {
391 pa = (caddr_t)node - DI_NODE(node)->self;
393 if (DI_NODE(node)->child) {
394 return (DI_NODE(pa + DI_NODE(node)->child));
417 DPRINTF((DI_INFO, "Get first node of driver %s\n", drv_name));
450 di_drv_next_node(di_node_t node)
454 if (node == DI_NODE_NIL) {
459 DPRINTF((DI_TRACE, "next node on per driver list:"
461 di_node_name(node), di_driver_name(node)));
463 if (DI_NODE(node)->next == (di_off_t)-1) {
468 pa = (caddr_t)node - DI_NODE(node)->self;
470 if (DI_NODE(node)->next == NULL) {
475 return (DI_NODE(pa + DI_NODE(node)->next));
480 * node_list etc. for node walking
484 di_node_t node;
540 * returns 1 if node is a descendant of parent, 0 otherwise
543 is_descendant(di_node_t node, di_node_t parent)
554 node = di_parent_node(node);
555 } while ((node != DI_NODE_NIL) && (node != parent));
557 return (node != DI_NODE_NIL);
561 * Insert list before the first node which is NOT a descendent of parent.
579 if (!is_descendant(tmp->node, parent)) {
585 * Find first node which is not a descendant
587 while (tmp->next && is_descendant(tmp->next->node, parent)) {
600 get_children(di_node_t node)
605 DPRINTF((DI_TRACE1, "Get children of node %s\n", di_node_name(node)));
607 if ((child = di_child_node(node)) == DI_NODE_NIL) {
616 result->node = child;
619 while ((child = di_sibling_node(tmp->node)) != DI_NODE_NIL) {
626 tmp->node = child;
636 * Delete all siblings of the first node from the node_list, along with
637 * the first node itself.
646 * get handle to parent of first node
648 if ((parent = di_parent_node((*headp)->node)) == DI_NODE_NIL) {
666 * This happens for DI_WALK_SIBFIRST when the first node
670 * of nodes, and delete node is a match is found.
675 if (((curr_par = di_parent_node(curr->node)) != DI_NODE_NIL) &&
690 * delete the first node
699 * Update node list based on action (return code from callback)
706 di_node_t parent = di_parent_node((*headp)->node);
711 * free the node list and be done
721 children = get_children((*headp)->node);
727 * Set children to NULL and pop first node
738 * Get list of children and pop first node
740 children = get_children((*headp)->node);
768 * Invoke callback on one node and update the list of nodes to be walked
775 DPRINTF((DI_TRACE, "Walking node %s\n", di_node_name((*headp)->node)));
777 update_node_list(callback((*headp)->node, arg),
798 head->node = root;
800 DPRINTF((DI_INFO, "Start node walking from node %s\n",
811 * Invoke callback for each minor on the minor list of first node
812 * on node_list headp, and place children of first node on the list.
825 di_node_t node = (*headp)->node;
827 while ((minor = di_minor_next(node, minor)) != DI_MINOR_NIL) {
843 if ((action = callback(node, minor, arg)) ==
875 head->node = root;
877 DPRINTF((DI_INFO, "Start minor walking from node %s\n",
888 * generic node parameters
892 di_node_name(di_node_t node)
894 return ((caddr_t)node + DI_NODE(node)->node_name - DI_NODE(node)->self);
899 di_bus_addr(di_node_t node)
901 caddr_t pa = (caddr_t)node - DI_NODE(node)->self;
903 if (DI_NODE(node)->address == 0)
906 return ((char *)(pa + DI_NODE(node)->address));
910 di_binding_name(di_node_t node)
912 caddr_t pa = (caddr_t)node - DI_NODE(node)->self;
914 if (DI_NODE(node)->bind_name == 0)
917 return ((char *)(pa + DI_NODE(node)->bind_name));
921 di_compatible_names(di_node_t node, char **names)
926 if (DI_NODE(node)->compat_names == 0) {
931 *names = (caddr_t)node +
932 DI_NODE(node)->compat_names - DI_NODE(node)->self;
935 len = DI_NODE(node)->compat_length;
947 di_instance(di_node_t node)
949 return (DI_NODE(node)->instance);
957 di_nodeid(di_node_t node)
959 if (DI_NODE(node)->node_class == DDI_NC_PROM)
962 if (DI_NODE(node)->attributes & DDI_PERSISTENT)
969 di_state(di_node_t node)
973 if (di_node_state(node) < DS_ATTACHED)
975 if (DI_NODE(node)->state & DEVI_DEVICE_OFFLINE)
977 if (DI_NODE(node)->state & DEVI_DEVICE_DOWN)
979 if (DI_NODE(node)->state & DEVI_DEVICE_DEGRADED)
981 if (DI_NODE(node)->state & DEVI_DEVICE_REMOVED)
983 if (DI_NODE(node)->state & DEVI_BUS_QUIESCED)
985 if (DI_NODE(node)->state & DEVI_BUS_DOWN)
992 di_node_state(di_node_t node)
994 return (DI_NODE(node)->node_state);
998 di_flags(di_node_t node)
1000 return (DI_NODE(node)->flags);
1004 di_retired(di_node_t node)
1006 return (di_flags(node) & DEVI_RETIRED);
1010 di_devid(di_node_t node)
1012 if (DI_NODE(node)->devid == 0)
1015 return ((ddi_devid_t)((caddr_t)node +
1016 DI_NODE(node)->devid - DI_NODE(node)->self));
1020 di_driver_major(di_node_t node)
1024 major = DI_NODE(node)->drv_major;
1031 di_driver_name(di_node_t node)
1037 major = DI_NODE(node)->drv_major;
1041 pa = (caddr_t)node - DI_NODE(node)->self;
1051 di_driver_ops(di_node_t node)
1057 major = DI_NODE(node)->drv_major;
1061 pa = (caddr_t)node - DI_NODE(node)->self;
1071 di_devfs_path(di_node_t node)
1078 if (node == DI_NODE_NIL) {
1086 while ((parent = di_parent_node(node)) != DI_NODE_NIL) {
1087 name[depth] = di_node_name(node);
1090 if ((addr[depth] = di_bus_addr(node)) != NULL)
1093 node = parent;
1100 pa = (caddr_t)node - DI_NODE(node)->self;
1134 di_node_t node;
1144 node = di_minor_devinfo(minor);
1145 devfspath = di_devfs_path(node);
1149 /* make the full path to the device minor node */
1161 * Produce a string representation of path to di_path_t (pathinfo node). This
1164 * device unit-address of pathinfo node.
1185 /* base path to pHCI devinfo node */
1346 di_minor_next(di_node_t node, di_minor_t minor)
1353 if (node == DI_NODE_NIL) {
1372 * minor is NIL-->caller asks for first minor node
1374 if (DI_NODE(node)->minor_data != 0) {
1375 return (DI_MINOR((caddr_t)node - DI_NODE(node)->self +
1376 DI_NODE(node)->minor_data));
1383 pa = (caddr_t)node - DI_NODE(node)->self;
1402 DI_MINOR(minor)->node));
1447 di_prop_next(di_node_t node, di_prop_t prop)
1454 if (node == DI_NODE_NIL) {
1468 prop = di_prop_drv_next(node, prop);
1471 prop = di_prop_sys_next(node, prop);
1474 prop = di_prop_global_next(node, prop);
1477 prop = di_prop_hw_next(node, prop);
1659 di_prop_search(dev_t match_dev, di_node_t node, const char *name,
1668 if ((node == DI_NODE_NIL) || (name == NULL) || (strlen(name) == 0) ||
1674 while ((prop = di_prop_next(node, prop)) != DI_PROP_NIL) {
1686 di_prop_find(dev_t match_dev, di_node_t node, const char *name)
1690 if ((node == DI_NODE_NIL) || (name == NULL) || (strlen(name) == 0) ||
1696 while ((prop = di_prop_next(node, prop)) != DI_PROP_NIL) {
1711 di_prop_lookup_ints(dev_t dev, di_node_t node, const char *prop_name,
1716 if ((prop = di_prop_search(dev, node, prop_name,
1724 di_prop_lookup_int64(dev_t dev, di_node_t node, const char *prop_name,
1729 if ((prop = di_prop_search(dev, node, prop_name,
1737 di_prop_lookup_strings(dev_t dev, di_node_t node, const char *prop_name,
1742 if ((prop = di_prop_search(dev, node, prop_name,
1750 di_prop_lookup_bytes(dev_t dev, di_node_t node, const char *prop_name,
1755 if ((prop = di_prop_search(dev, node, prop_name,
1773 di_prop_next_common(di_node_t node, di_prop_t prop, int prop_type)
1791 pa = (caddr_t)node - DI_NODE(node)->self;
1794 prop_off = DI_NODE(node)->drv_prop;
1797 prop_off = DI_NODE(node)->sys_prop;
1800 prop_off = DI_NODE(node)->hw_prop;
1803 prop_off = DI_NODE(node)->glob_prop;
1807 } else if ((prop_off == 0) && (DI_NODE(node)->drv_major >= 0)) {
1810 DI_ALL(pa)->devnames + (DI_NODE(node)->drv_major *
1833 di_prop_drv_next(di_node_t node, di_prop_t prop)
1835 return (di_prop_next_common(node, prop, PROP_TYPE_DRV));
1839 di_prop_sys_next(di_node_t node, di_prop_t prop)
1841 return (di_prop_next_common(node, prop, PROP_TYPE_SYS));
1845 di_prop_global_next(di_node_t node, di_prop_t prop)
1847 return (di_prop_next_common(node, prop, PROP_TYPE_GLOB));
1851 di_prop_hw_next(di_node_t node, di_prop_t prop)
1853 return (di_prop_next_common(node, prop, PROP_TYPE_HW));
1891 di_path_phci_next_path(di_node_t node, di_path_t path)
1909 * Path is NIL; the caller is asking for the first path info node
1911 if (DI_NODE(node)->multipath_phci != 0) {
1913 ((caddr_t)node -
1914 DI_NODE(node)->self + DI_NODE(node)->multipath_phci)));
1915 return (DI_PATH((caddr_t)node - DI_NODE(node)->self +
1916 DI_NODE(node)->multipath_phci));
1923 pa = (caddr_t)node - DI_NODE(node)->self;
1933 di_path_client_next_path(di_node_t node, di_path_t path)
1951 * Path is NIL; the caller is asking for the first path info node
1953 if (DI_NODE(node)->multipath_client != 0) {
1955 ((caddr_t)node -
1956 DI_NODE(node)->self + DI_NODE(node)->multipath_client)));
1957 return (DI_PATH((caddr_t)node - DI_NODE(node)->self +
1958 DI_NODE(node)->multipath_client));
1965 pa = (caddr_t)node - DI_NODE(node)->self;
1991 di_path_next(di_node_t node, di_path_t path)
1993 if (node == DI_NODE_NIL) {
1998 if (DI_NODE(node)->multipath_client) {
1999 return (di_path_client_next_path(node, path));
2000 } else if (DI_NODE(node)->multipath_phci) {
2001 return (di_path_phci_next_path(node, path));
2004 * The node had multipathing data but didn't appear to be a
2012 di_path_next_phci(di_node_t node, di_path_t path)
2014 return (di_path_client_next_path(node, path));
2017 di_path_next_client(di_node_t node, di_path_t path)
2019 return (di_path_phci_next_path(node, path));
2075 DPRINTF((DI_TRACE, "Get client node for path %p\n", path));
2085 * If parent doesn't exist and node is not the root,
2106 DPRINTF((DI_TRACE, "Get phci node for path %p\n", path));
2116 * If parent doesn't exist and node is not the root,
2369 DPRINTF((DI_INFO, "Get first vhci node\n"));
2388 di_vhci_next_node(di_node_t node)
2392 if (node == DI_NODE_NIL) {
2397 DPRINTF((DI_TRACE, "next vhci node on the snap shot:"
2398 " current=%s\n", di_node_name(node)));
2400 if (DI_NODE(node)->next_vhci == NULL) {
2405 pa = (caddr_t)node - DI_NODE(node)->self;
2407 return (DI_NODE(pa + DI_NODE(node)->next_vhci));
2418 DPRINTF((DI_INFO, "Get first phci node:\n"
2437 di_phci_next_node(di_node_t node)
2441 if (node == DI_NODE_NIL) {
2446 DPRINTF((DI_TRACE, "next phci node on the snap shot:"
2447 " current=%s\n", di_node_name(node)));
2449 if (DI_NODE(node)->next_phci == NULL) {
2454 pa = (caddr_t)node - DI_NODE(node)->self;
2456 return (DI_NODE(pa + DI_NODE(node)->next_phci));
2463 di_parent_private_data(di_node_t node)
2467 if (DI_NODE(node)->parent_data == 0) {
2472 if (DI_NODE(node)->parent_data == (di_off_t)-1) {
2481 pa = (caddr_t)node - DI_NODE(node)->self;
2482 if (DI_NODE(node)->parent_data)
2483 return (pa + DI_NODE(node)->parent_data);
2494 di_driver_private_data(di_node_t node)
2498 if (DI_NODE(node)->driver_data == 0) {
2503 if (DI_NODE(node)->driver_data == (di_off_t)-1) {
2512 pa = (caddr_t)node - DI_NODE(node)->self;
2513 if (DI_NODE(node)->driver_data)
2514 return (pa + DI_NODE(node)->driver_data);
2536 di_walk_hp_callback(di_node_t node, void *argp)
2542 for (hp = DI_HP_NIL; (hp = di_hp_next(node, hp)) != DI_HP_NIL; ) {
2562 if (arg->hp_callback(node, hp, arg->arg) != DI_WALK_CONTINUE)
2570 di_walk_hp(di_node_t node, const char *type, uint_t flag, void *arg,
2571 int (*hp_callback)(di_node_t node, di_hp_t hp, void *arg))
2577 char *devfspath = di_devfs_path(node);
2584 if ((node == DI_NODE_NIL) || (hp_callback == NULL)) {
2590 pa = (caddr_t)node - DI_NODE(node)->self;
2600 return (di_walk_node(node, DI_WALK_CLDFIRST, &walk_arg,
2605 di_hp_next(di_node_t node, di_hp_t hp)
2612 if (node == DI_NODE_NIL) {
2618 * hotplug node is not NIL
2630 * hotplug node is NIL-->caller asks for first hotplug node
2632 if (DI_NODE(node)->hp_data != 0) {
2633 return (DI_HP((caddr_t)node - DI_NODE(node)->self +
2634 DI_NODE(node)->hp_data));
2641 pa = (caddr_t)node - DI_NODE(node)->self;
2974 di_prom_prop_next(di_prom_handle_t ph, di_node_t node, di_prom_prop_t prom_prop)
2978 DPRINTF((DI_TRACE1, "Search next prop for node 0x%p with ph 0x%p\n",
2979 node, p));
2984 if ((ph == DI_PROM_HANDLE_NIL) || (node == DI_NODE_NIL)) {
2989 if (di_nodeid(node) != DI_PROM_NODEID) {
3002 prom_prop = di_prom_prop_found(ph, DI_NODE(node)->nodeid, prom_prop);
3044 di_prom_prop_lookup_common(di_prom_handle_t ph, di_node_t node,
3054 if ((ph == DI_PROM_HANDLE_NIL) || (node == DI_NODE_NIL)) {
3059 if (di_nodeid(node) != DI_PROM_NODEID) {
3069 opp->oprom_node = DI_NODE(node)->nodeid;
3073 DI_NODE(node)->nodeid));
3144 di_prom_prop_lookup_ints(di_prom_handle_t ph, di_node_t node,
3150 prop = di_prom_prop_lookup_common(ph, node, prom_prop_name);
3170 di_prom_prop_lookup_strings(di_prom_handle_t ph, di_node_t node,
3176 prop = di_prom_prop_lookup_common(ph, node, prom_prop_name);
3201 "node=%s, prop=%s, val=%s\n",
3202 di_node_name(node), prom_prop_name, prop->data));
3213 di_prom_prop_lookup_bytes(di_prom_handle_t ph, di_node_t node,
3219 prop = di_prom_prop_lookup_common(ph, node, prom_prop_name);
3270 di_prop_lookup_slot_names(dev_t dev, di_node_t node,
3279 if ((prop = di_prop_find(dev, node, DI_PROP_SLOT_NAMES)) ==
3316 di_prom_prop_lookup_slot_names(di_prom_handle_t ph, di_node_t node,
3321 prom_prop = di_prom_prop_lookup_common(ph, node, DI_PROP_SLOT_NAMES);
3363 return (DI_NODE((caddr_t)di_all + DI_LNODE(lnode)->node));
3400 di_node_private_set(di_node_t node, void *data)
3402 DI_NODE(node)->user_private_data = (uintptr_t)data;
3406 di_node_private_get(di_node_t node)
3408 return ((void *)(uintptr_t)DI_NODE(node)->user_private_data);
3448 di_lnode_next(di_node_t node, di_lnode_t lnode)
3455 if (node == DI_NODE_NIL) {
3460 di_all = DI_ALL((caddr_t)node - DI_NODE(node)->self);
3463 if (DI_NODE(node)->lnodes != NULL)
3465 DI_NODE(node)->lnodes));
3481 di_link_next_by_node(di_node_t node, di_link_t link, uint_t endpoint)
3488 if ((node == DI_NODE_NIL) ||
3494 di_all = DI_ALL((caddr_t)node - DI_NODE(node)->self);
3498 if (DI_NODE(node)->src_links != NULL)
3500 DI_NODE(node)->src_links));
3508 if (DI_NODE(node)->tgt_links != NULL)
3510 DI_NODE(node)->tgt_links));
3572 * Invoke callback for each link data on the link list of first node
3573 * on node_list headp, and place children of first node on the list.
3584 di_node_t node = (*headp)->node;
3586 while ((link = di_link_next_by_node(node, link, ep)) != DI_LINK_NIL) {
3624 head->node = root;
3626 DPRINTF((DI_INFO, "Start link data walking from node %s\n",
3637 * Invoke callback for each link data on the link list of first node
3638 * on node_list headp, and place children of first node on the list.
3649 di_node_t node = (*headp)->node;
3651 while ((lnode = di_lnode_next(node, lnode)) != DI_LNODE_NIL) {
3687 head->node = root;
3689 DPRINTF((DI_INFO, "Start lnode data walking from node %s\n",
3704 di_node_t node;
3725 node = DI_NODE(pa + di_alias->curroff);
3726 assert(node != DI_NODE_NIL);
3728 *nodep = node;
3731 curr = di_devfs_path(node);
3748 di_node_t node;
3760 DPRINTF((DI_ERR, "root node is DI_NODE_NIL\n"));
3775 for (slash = copy, node = root; slash; ) {
3787 node = di_child_node(node);
3794 for (; node != DI_NODE_NIL; node = di_sibling_node(node)) {
3797 name = di_node_name(node);
3798 baddr = di_bus_addr(node);
3821 if (node == DI_NODE_NIL) {
3822 DPRINTF((DI_ERR, "%s@%s: no node\n", pname, paddr));
3828 assert(node != DI_NODE_NIL);
3830 return (node);
3836 di_node_t node;
3839 node = di_lookup_node_impl(root, devfspath);
3840 if (node != DI_NODE_NIL) {
3841 return (node);
3844 /* node is already set to DI_NODE_NIL */
3845 curr = alias_to_curr(root, devfspath, &node);
3847 /* node may or may node be DI_NODE_NIL */
3848 return (node);
3851 node = di_lookup_node_impl(root, curr);
3855 return (node);
3896 /* stop at pHCI and find the node for the phci */