Lines Matching defs:node

254 	 * read-only minor node if we don't have privileges to open the full
256 * node can't perform. (Setgid processes would fail an access() test,
265 * privileged node isn't available. Don't modify errno
375 di_cna_dev(di_node_t node)
379 pa = (caddr_t)node - DI_NODE(node)->self;
385 di_parent_node(di_node_t node)
389 if (node == DI_NODE_NIL) {
394 DPRINTF((DI_TRACE, "Get parent of node %s\n", di_node_name(node)));
396 pa = (caddr_t)node - DI_NODE(node)->self;
398 if (DI_NODE(node)->parent) {
399 return (DI_NODE(pa + DI_NODE(node)->parent));
404 * If parent doesn't exist and node is not the root,
416 di_sibling_node(di_node_t node)
420 if (node == DI_NODE_NIL) {
425 DPRINTF((DI_TRACE, "Get sibling of node %s\n", di_node_name(node)));
427 pa = (caddr_t)node - DI_NODE(node)->self;
429 if (DI_NODE(node)->sibling) {
430 return (DI_NODE(pa + DI_NODE(node)->sibling));
448 di_child_node(di_node_t node)
452 DPRINTF((DI_TRACE, "Get child of node %s\n", di_node_name(node)));
454 if (node == DI_NODE_NIL) {
459 pa = (caddr_t)node - DI_NODE(node)->self;
461 if (DI_NODE(node)->child) {
462 return (DI_NODE(pa + DI_NODE(node)->child));
485 DPRINTF((DI_INFO, "Get first node of driver %s\n", drv_name));
518 di_drv_next_node(di_node_t node)
522 if (node == DI_NODE_NIL) {
527 DPRINTF((DI_TRACE, "next node on per driver list:"
529 di_node_name(node), di_driver_name(node)));
531 if (DI_NODE(node)->next == (di_off_t)-1) {
536 pa = (caddr_t)node - DI_NODE(node)->self;
538 if (DI_NODE(node)->next == NULL) {
543 return (DI_NODE(pa + DI_NODE(node)->next));
548 * node_list etc. for node walking
552 di_node_t node;
608 * returns 1 if node is a descendant of parent, 0 otherwise
611 is_descendant(di_node_t node, di_node_t parent)
622 node = di_parent_node(node);
623 } while ((node != DI_NODE_NIL) && (node != parent));
625 return (node != DI_NODE_NIL);
629 * Insert list before the first node which is NOT a descendent of parent.
647 if (!is_descendant(tmp->node, parent)) {
653 * Find first node which is not a descendant
655 while (tmp->next && is_descendant(tmp->next->node, parent)) {
668 get_children(di_node_t node)
673 DPRINTF((DI_TRACE1, "Get children of node %s\n", di_node_name(node)));
675 if ((child = di_child_node(node)) == DI_NODE_NIL) {
684 result->node = child;
687 while ((child = di_sibling_node(tmp->node)) != DI_NODE_NIL) {
694 tmp->node = child;
704 * Delete all siblings of the first node from the node_list, along with
705 * the first node itself.
714 * get handle to parent of first node
716 if ((parent = di_parent_node((*headp)->node)) == DI_NODE_NIL) {
734 * This happens for DI_WALK_SIBFIRST when the first node
738 * of nodes, and delete node is a match is found.
743 if (((curr_par = di_parent_node(curr->node)) != DI_NODE_NIL) &&
758 * delete the first node
767 * Update node list based on action (return code from callback)
774 di_node_t parent = di_parent_node((*headp)->node);
779 * free the node list and be done
789 children = get_children((*headp)->node);
795 * Set children to NULL and pop first node
806 * Get list of children and pop first node
808 children = get_children((*headp)->node);
836 * Invoke callback on one node and update the list of nodes to be walked
843 DPRINTF((DI_TRACE, "Walking node %s\n", di_node_name((*headp)->node)));
845 update_node_list(callback((*headp)->node, arg),
866 head->node = root;
868 DPRINTF((DI_INFO, "Start node walking from node %s\n",
879 * Invoke callback for each minor on the minor list of first node
880 * on node_list headp, and place children of first node on the list.
893 di_node_t node = (*headp)->node;
895 while ((minor = di_minor_next(node, minor)) != DI_MINOR_NIL) {
911 if ((action = callback(node, minor, arg)) ==
943 head->node = root;
945 DPRINTF((DI_INFO, "Start minor walking from node %s\n",
956 * generic node parameters
960 di_node_name(di_node_t node)
962 return ((caddr_t)node + DI_NODE(node)->node_name - DI_NODE(node)->self);
967 di_bus_addr(di_node_t node)
969 caddr_t pa = (caddr_t)node - DI_NODE(node)->self;
971 if (DI_NODE(node)->address == 0)
974 return ((char *)(pa + DI_NODE(node)->address));
978 di_binding_name(di_node_t node)
980 caddr_t pa = (caddr_t)node - DI_NODE(node)->self;
982 if (DI_NODE(node)->bind_name == 0)
985 return ((char *)(pa + DI_NODE(node)->bind_name));
989 di_compatible_names(di_node_t node, char **names)
994 if (DI_NODE(node)->compat_names == 0) {
999 *names = (caddr_t)node +
1000 DI_NODE(node)->compat_names - DI_NODE(node)->self;
1003 len = DI_NODE(node)->compat_length;
1015 di_instance(di_node_t node)
1017 return (DI_NODE(node)->instance);
1025 di_nodeid(di_node_t node)
1027 if (DI_NODE(node)->node_class == DDI_NC_PROM)
1030 if (DI_NODE(node)->attributes & DDI_PERSISTENT)
1037 di_state(di_node_t node)
1041 if (di_node_state(node) < DS_ATTACHED)
1043 if (DI_NODE(node)->state & DEVI_DEVICE_OFFLINE)
1045 if (DI_NODE(node)->state & DEVI_DEVICE_DOWN)
1047 if (DI_NODE(node)->state & DEVI_DEVICE_DEGRADED)
1049 if (DI_NODE(node)->state & DEVI_DEVICE_REMOVED)
1051 if (DI_NODE(node)->state & DEVI_BUS_QUIESCED)
1053 if (DI_NODE(node)->state & DEVI_BUS_DOWN)
1060 di_node_state(di_node_t node)
1062 return (DI_NODE(node)->node_state);
1066 di_flags(di_node_t node)
1068 return (DI_NODE(node)->flags);
1072 di_retired(di_node_t node)
1074 return (di_flags(node) & DEVI_RETIRED);
1078 di_devid(di_node_t node)
1080 if (DI_NODE(node)->devid == 0)
1083 return ((ddi_devid_t)((caddr_t)node +
1084 DI_NODE(node)->devid - DI_NODE(node)->self));
1088 di_driver_major(di_node_t node)
1092 major = DI_NODE(node)->drv_major;
1099 di_driver_name(di_node_t node)
1105 major = DI_NODE(node)->drv_major;
1109 pa = (caddr_t)node - DI_NODE(node)->self;
1119 di_driver_ops(di_node_t node)
1125 major = DI_NODE(node)->drv_major;
1129 pa = (caddr_t)node - DI_NODE(node)->self;
1135 /* Return the Configuration Numeric Association of the node. */
1137 di_node_cna_dev(di_node_t node)
1139 return (DI_NODE(node)->node_cna_dev);
1147 di_devfs_path(di_node_t node)
1154 if (node == DI_NODE_NIL) {
1162 while ((parent = di_parent_node(node)) != DI_NODE_NIL) {
1163 name[depth] = di_node_name(node);
1166 if ((addr[depth] = di_bus_addr(node)) != NULL)
1169 node = parent;
1176 pa = (caddr_t)node - DI_NODE(node)->self;
1210 di_node_t node;
1220 node = di_minor_devinfo(minor);
1221 devfspath = di_devfs_path(node);
1225 /* make the full path to the device minor node */
1237 * Produce a string representation of path to di_path_t (pathinfo node). This
1240 * device unit-address of pathinfo node.
1261 /* base path to pHCI devinfo node */
1451 di_minor_next(di_node_t node, di_minor_t minor)
1458 if (node == DI_NODE_NIL) {
1477 * minor is NIL-->caller asks for first minor node
1479 if (DI_NODE(node)->minor_data != 0) {
1480 return (DI_MINOR((caddr_t)node - DI_NODE(node)->self +
1481 DI_NODE(node)->minor_data));
1488 pa = (caddr_t)node - DI_NODE(node)->self;
1507 DI_MINOR(minor)->node));
1552 di_prop_next(di_node_t node, di_prop_t prop)
1559 if (node == DI_NODE_NIL) {
1573 prop = di_prop_drv_next(node, prop);
1576 prop = di_prop_sys_next(node, prop);
1579 prop = di_prop_global_next(node, prop);
1582 prop = di_prop_vendor_global_next(node, prop);
1585 prop = di_prop_admin_global_next(node, prop);
1588 prop = di_prop_hw_next(node, prop);
1591 prop = di_prop_vendor_next(node, prop);
1594 prop = di_prop_admin_next(node, prop);
1776 di_prop_search(dev_t match_dev, di_node_t node, const char *name,
1785 if ((node == DI_NODE_NIL) || (name == NULL) || (strlen(name) == 0) ||
1791 while ((prop = di_prop_next(node, prop)) != DI_PROP_NIL) {
1803 di_prop_find(dev_t match_dev, di_node_t node, const char *name)
1807 if ((node == DI_NODE_NIL) || (name == NULL) || (strlen(name) == 0) ||
1813 while ((prop = di_prop_next(node, prop)) != DI_PROP_NIL) {
1828 di_prop_exists(dev_t dev, di_node_t node, const char *prop_name)
1830 return ((di_prop_search(dev, node, prop_name, DI_PROP_TYPE_BOOLEAN) ==
1835 di_prop_lookup_ints(dev_t dev, di_node_t node, const char *prop_name,
1839 if ((prop = di_prop_search(dev, node, prop_name,
1847 di_prop_lookup_int64(dev_t dev, di_node_t node, const char *prop_name,
1852 if ((prop = di_prop_search(dev, node, prop_name,
1860 di_prop_lookup_strings(dev_t dev, di_node_t node, const char *prop_name,
1865 if ((prop = di_prop_search(dev, node, prop_name,
1873 di_prop_lookup_bytes(dev_t dev, di_node_t node, const char *prop_name,
1878 if ((prop = di_prop_search(dev, node, prop_name,
1900 di_prop_next_common(di_node_t node, di_prop_t prop, int prop_type)
1924 pa = (caddr_t)node - DI_NODE(node)->self;
1927 prop_off = DI_NODE(node)->drv_prop;
1930 prop_off = DI_NODE(node)->sys_prop;
1933 prop_off = DI_NODE(node)->glob_prop;
1936 } else if ((prop_off == 0) && (DI_NODE(node)->drv_major >= 0)) {
1939 DI_ALL(pa)->devnames + (DI_NODE(node)->drv_major *
1945 prop_off = DI_NODE(node)->hw_prop;
1948 prop_off = DI_NODE(node)->vendor_global_prop;
1951 } else if ((prop_off == 0) && (DI_NODE(node)->drv_major >= 0)) {
1953 DI_ALL(pa)->devnames + (DI_NODE(node)->drv_major *
1959 prop_off = DI_NODE(node)->admin_global_prop;
1962 } else if ((prop_off == 0) && (DI_NODE(node)->drv_major >= 0)) {
1964 DI_ALL(pa)->devnames + (DI_NODE(node)->drv_major *
1970 prop_off = DI_NODE(node)->vendor_prop;
1973 prop_off = DI_NODE(node)->admin_prop;
1993 di_prop_drv_next(di_node_t node, di_prop_t prop)
1995 return (di_prop_next_common(node, prop, PROP_TYPE_DRV));
1999 di_prop_sys_next(di_node_t node, di_prop_t prop)
2001 return (di_prop_next_common(node, prop, PROP_TYPE_SYS));
2005 di_prop_global_next(di_node_t node, di_prop_t prop)
2007 return (di_prop_next_common(node, prop, PROP_TYPE_GLOB));
2011 di_prop_vendor_global_next(di_node_t node, di_prop_t prop)
2013 return (di_prop_next_common(node, prop, PROP_TYPE_VENDOR_GLOBAL));
2017 di_prop_admin_global_next(di_node_t node, di_prop_t prop)
2019 return (di_prop_next_common(node, prop, PROP_TYPE_ADMIN_GLOBAL));
2023 di_prop_hw_next(di_node_t node, di_prop_t prop)
2025 return (di_prop_next_common(node, prop, PROP_TYPE_HW));
2029 di_prop_vendor_next(di_node_t node, di_prop_t prop)
2031 return (di_prop_next_common(node, prop, PROP_TYPE_VENDOR));
2035 di_prop_admin_next(di_node_t node, di_prop_t prop)
2037 return (di_prop_next_common(node, prop, PROP_TYPE_ADMIN));
2075 di_path_phci_next_path(di_node_t node, di_path_t path)
2093 * Path is NIL; the caller is asking for the first path info node
2095 if (DI_NODE(node)->multipath_phci != 0) {
2097 ((caddr_t)node -
2098 DI_NODE(node)->self + DI_NODE(node)->multipath_phci)));
2099 return (DI_PATH((caddr_t)node - DI_NODE(node)->self +
2100 DI_NODE(node)->multipath_phci));
2107 pa = (caddr_t)node - DI_NODE(node)->self;
2117 di_path_client_next_path(di_node_t node, di_path_t path)
2135 * Path is NIL; the caller is asking for the first path info node
2137 if (DI_NODE(node)->multipath_client != 0) {
2139 ((caddr_t)node -
2140 DI_NODE(node)->self + DI_NODE(node)->multipath_client)));
2141 return (DI_PATH((caddr_t)node - DI_NODE(node)->self +
2142 DI_NODE(node)->multipath_client));
2149 pa = (caddr_t)node - DI_NODE(node)->self;
2175 di_path_next(di_node_t node, di_path_t path)
2177 if (node == DI_NODE_NIL) {
2182 if (DI_NODE(node)->multipath_client) {
2183 return (di_path_client_next_path(node, path));
2184 } else if (DI_NODE(node)->multipath_phci) {
2185 return (di_path_phci_next_path(node, path));
2188 * The node had multipathing data but didn't appear to be a
2196 di_path_next_phci(di_node_t node, di_path_t path)
2198 return (di_path_client_next_path(node, path));
2201 di_path_next_client(di_node_t node, di_path_t path)
2203 return (di_path_phci_next_path(node, path));
2259 DPRINTF((DI_TRACE, "Get client node for path %p\n", path));
2269 * If parent doesn't exist and node is not the root,
2290 DPRINTF((DI_TRACE, "Get phci node for path %p\n", path));
2300 * If parent doesn't exist and node is not the root,
2553 DPRINTF((DI_INFO, "Get first vhci node\n"));
2572 di_vhci_next_node(di_node_t node)
2576 if (node == DI_NODE_NIL) {
2581 DPRINTF((DI_TRACE, "next vhci node on the snap shot:"
2582 " current=%s\n", di_node_name(node)));
2584 if (DI_NODE(node)->next_vhci == NULL) {
2589 pa = (caddr_t)node - DI_NODE(node)->self;
2591 return (DI_NODE(pa + DI_NODE(node)->next_vhci));
2602 DPRINTF((DI_INFO, "Get first phci node:\n"
2621 di_phci_next_node(di_node_t node)
2625 if (node == DI_NODE_NIL) {
2630 DPRINTF((DI_TRACE, "next phci node on the snap shot:"
2631 " current=%s\n", di_node_name(node)));
2633 if (DI_NODE(node)->next_phci == NULL) {
2638 pa = (caddr_t)node - DI_NODE(node)->self;
2640 return (DI_NODE(pa + DI_NODE(node)->next_phci));
2647 di_parent_private_data(di_node_t node)
2651 if (DI_NODE(node)->parent_data == 0) {
2656 if (DI_NODE(node)->parent_data == (di_off_t)-1) {
2665 pa = (caddr_t)node - DI_NODE(node)->self;
2666 if (DI_NODE(node)->parent_data)
2667 return (pa + DI_NODE(node)->parent_data);
2678 di_driver_private_data(di_node_t node)
2682 if (DI_NODE(node)->driver_data == 0) {
2687 if (DI_NODE(node)->driver_data == (di_off_t)-1) {
2696 pa = (caddr_t)node - DI_NODE(node)->self;
2697 if (DI_NODE(node)->driver_data)
2698 return (pa + DI_NODE(node)->driver_data);
2720 di_walk_hp_callback(di_node_t node, void *argp)
2726 for (hp = DI_HP_NIL; (hp = di_hp_next(node, hp)) != DI_HP_NIL; ) {
2746 if (arg->hp_callback(node, hp, arg->arg) != DI_WALK_CONTINUE)
2754 di_walk_hp(di_node_t node, const char *type, uint_t flag, void *arg,
2755 int (*hp_callback)(di_node_t node, di_hp_t hp, void *arg))
2761 char *devfspath = di_devfs_path(node);
2768 if ((node == DI_NODE_NIL) || (hp_callback == NULL)) {
2774 pa = (caddr_t)node - DI_NODE(node)->self;
2784 return (di_walk_node(node, DI_WALK_CLDFIRST, &walk_arg,
2789 di_hp_next(di_node_t node, di_hp_t hp)
2796 if (node == DI_NODE_NIL) {
2802 * hotplug node is not NIL
2814 * hotplug node is NIL-->caller asks for first hotplug node
2816 if (DI_NODE(node)->hp_data != 0) {
2817 return (DI_HP((caddr_t)node - DI_NODE(node)->self +
2818 DI_NODE(node)->hp_data));
2825 pa = (caddr_t)node - DI_NODE(node)->self;
3209 di_prom_prop_next(di_prom_handle_t ph, di_node_t node, di_prom_prop_t prom_prop)
3213 DPRINTF((DI_TRACE1, "Search next prop for node 0x%p with ph 0x%p\n",
3214 node, p));
3219 if ((ph == DI_PROM_HANDLE_NIL) || (node == DI_NODE_NIL)) {
3224 if (di_nodeid(node) != DI_PROM_NODEID) {
3237 prom_prop = di_prom_prop_found(ph, DI_NODE(node)->nodeid, prom_prop);
3279 di_prom_prop_lookup_common(di_prom_handle_t ph, di_node_t node,
3289 if ((ph == DI_PROM_HANDLE_NIL) || (node == DI_NODE_NIL)) {
3294 if (di_nodeid(node) != DI_PROM_NODEID) {
3304 opp->oprom_node = DI_NODE(node)->nodeid;
3308 DI_NODE(node)->nodeid));
3379 di_prom_prop_lookup_ints(di_prom_handle_t ph, di_node_t node,
3385 prop = di_prom_prop_lookup_common(ph, node, prom_prop_name);
3405 di_prom_prop_lookup_strings(di_prom_handle_t ph, di_node_t node,
3411 prop = di_prom_prop_lookup_common(ph, node, prom_prop_name);
3436 "node=%s, prop=%s, val=%s\n",
3437 di_node_name(node), prom_prop_name, prop->data));
3448 di_prom_prop_lookup_bytes(di_prom_handle_t ph, di_node_t node,
3454 prop = di_prom_prop_lookup_common(ph, node, prom_prop_name);
3505 di_prop_lookup_slot_names(dev_t dev, di_node_t node,
3514 if ((prop = di_prop_find(dev, node, DI_PROP_SLOT_NAMES)) ==
3551 di_prom_prop_lookup_slot_names(di_prom_handle_t ph, di_node_t node,
3556 prom_prop = di_prom_prop_lookup_common(ph, node, DI_PROP_SLOT_NAMES);
3598 return (DI_NODE((caddr_t)di_all + DI_LNODE(lnode)->node));
3635 di_node_private_set(di_node_t node, void *data)
3637 DI_NODE(node)->user_private_data = (uintptr_t)data;
3641 di_node_private_get(di_node_t node)
3643 return ((void *)(uintptr_t)DI_NODE(node)->user_private_data);
3683 di_lnode_next(di_node_t node, di_lnode_t lnode)
3690 if (node == DI_NODE_NIL) {
3695 di_all = DI_ALL((caddr_t)node - DI_NODE(node)->self);
3698 if (DI_NODE(node)->lnodes != NULL)
3700 DI_NODE(node)->lnodes));
3716 di_link_next_by_node(di_node_t node, di_link_t link, uint_t endpoint)
3723 if ((node == DI_NODE_NIL) ||
3729 di_all = DI_ALL((caddr_t)node - DI_NODE(node)->self);
3733 if (DI_NODE(node)->src_links != NULL)
3735 DI_NODE(node)->src_links));
3743 if (DI_NODE(node)->tgt_links != NULL)
3745 DI_NODE(node)->tgt_links));
3807 * Invoke callback for each link data on the link list of first node
3808 * on node_list headp, and place children of first node on the list.
3819 di_node_t node = (*headp)->node;
3821 while ((link = di_link_next_by_node(node, link, ep)) != DI_LINK_NIL) {
3859 head->node = root;
3861 DPRINTF((DI_INFO, "Start link data walking from node %s\n",
3872 * Invoke callback for each link data on the link list of first node
3873 * on node_list headp, and place children of first node on the list.
3884 di_node_t node = (*headp)->node;
3886 while ((lnode = di_lnode_next(node, lnode)) != DI_LNODE_NIL) {
3922 head->node = root;
3924 DPRINTF((DI_INFO, "Start lnode data walking from node %s\n",
3939 di_node_t node;
3960 node = DI_NODE(pa + di_alias->curroff);
3961 assert(node != DI_NODE_NIL);
3963 *nodep = node;
3966 curr = di_devfs_path(node);
3983 di_node_t node;
3995 DPRINTF((DI_ERR, "root node is DI_NODE_NIL\n"));
4010 for (slash = copy, node = root; slash; ) {
4022 node = di_child_node(node);
4029 for (; node != DI_NODE_NIL; node = di_sibling_node(node)) {
4032 name = di_node_name(node);
4033 baddr = di_bus_addr(node);
4056 if (node == DI_NODE_NIL) {
4057 DPRINTF((DI_ERR, "%s@%s: no node\n", pname, paddr));
4063 assert(node != DI_NODE_NIL);
4065 return (node);
4071 di_node_t node;
4074 node = di_lookup_node_impl(root, devfspath);
4075 if (node != DI_NODE_NIL) {
4076 return (node);
4079 /* node is already set to DI_NODE_NIL */
4080 curr = alias_to_curr(root, devfspath, &node);
4082 /* node may or may node be DI_NODE_NIL */
4083 return (node);
4086 node = di_lookup_node_impl(root, curr);
4090 return (node);
4131 /* stop at pHCI and find the node for the phci */