Lines Matching +full:msi +full:- +full:specifier

1 // SPDX-License-Identifier: GPL-2.0+
6 * Copyright (C) 1996-2005 Paul Mackerras.
66 node_name = kbasename(np->full_name); in of_node_name_eq()
67 len = strchrnul(node_name, '@') - node_name; in of_node_name_eq()
78 return strncmp(kbasename(np->full_name), prefix, strlen(prefix)) == 0; in of_node_name_prefix()
93 for (; np; np = np->parent) in of_bus_n_addr_cells()
94 if (!of_property_read_u32(np, "#address-cells", &cells)) in of_bus_n_addr_cells()
97 /* No #address-cells property for the root node */ in of_bus_n_addr_cells()
103 if (np->parent) in of_n_addr_cells()
104 np = np->parent; in of_n_addr_cells()
114 for (; np; np = np->parent) in of_bus_n_size_cells()
115 if (!of_property_read_u32(np, "#size-cells", &cells)) in of_bus_n_size_cells()
118 /* No #size-cells property for the root node */ in of_bus_n_size_cells()
124 if (np->parent) in of_n_size_cells()
125 np = np->parent; in of_n_size_cells()
162 if (np && handle == np->phandle) in __of_phandle_cache_inv_entry()
181 if (np->phandle && !phandle_cache[of_phandle_cache_hash(np->phandle)]) in of_core_init()
182 phandle_cache[of_phandle_cache_hash(np->phandle)] = np; in of_core_init()
188 proc_symlink("device-tree", NULL, "/sys/firmware/devicetree/base"); in of_core_init()
199 for (pp = np->properties; pp; pp = pp->next) { in __of_find_property()
200 if (of_prop_cmp(pp->name, name) == 0) { in __of_find_property()
202 *lenp = pp->length; in __of_find_property()
230 } else if (prev->child) { in __of_find_all_nodes()
231 np = prev->child; in __of_find_all_nodes()
235 while (np->parent && !np->sibling) in __of_find_all_nodes()
236 np = np->parent; in __of_find_all_nodes()
237 np = np->sibling; /* Might be null at the end of the tree */ in __of_find_all_nodes()
243 * of_find_all_nodes - Get next node in global list
273 return pp ? pp->value : NULL; in __of_get_property()
285 return pp ? pp->value : NULL; in of_get_property()
290 * of_get_cpu_hwid - Get the hardware ID from a CPU device node
312 * arch_match_cpu_phys_id - Match the given logical CPU and physical id
362 * arch_find_n_match_cpu_physical_id - See if the given device node is
364 * else false. If 'thread' is non-NULL, the local thread number within the
370 /* Check for non-standard "ibm,ppc-interrupt-server#s" property in arch_find_n_match_cpu_physical_id()
376 "ibm,ppc-interrupt-server#s", in arch_find_n_match_cpu_physical_id()
384 * of_get_cpu_node - Get device node associated with the given logical CPU
419 * Return: The logical CPU number of the given CPU device_node or -ENODEV if the
436 return -ENODEV; in of_cpu_node_to_id()
441 * of_get_cpu_state_node - Get CPU's idle state node at the given index
447 * a flattened description through the "cpu-idle-states" binding or via the
448 * hierarchical layout, using the "power-domains" and the "domain-idle-states"
461 err = of_parse_phandle_with_args(cpu_node, "power-domains", in of_get_cpu_state_node()
462 "#power-domain-cells", 0, &args); in of_get_cpu_state_node()
465 of_parse_phandle(args.np, "domain-idle-states", index); in of_get_cpu_state_node()
472 return of_parse_phandle(cpu_node, "cpu-idle-states", index); in of_get_cpu_state_node()
477 * __of_device_is_compatible() - Check if the node matches given constraints
519 score = INT_MAX/2 - (index << 2); in __of_device_is_compatible()
584 * of_machine_is_compatible - Test root of device tree for a given compatible value
605 * __of_device_is_available - check if a device is available for use
633 * of_device_is_available - check if a device is available for use
654 * __of_device_is_fail - check if a device has status "fail" or "fail-..."
658 * Return: True if the status property is set to "fail" or "fail-..." (for any
672 return !strcmp(status, "fail") || !strncmp(status, "fail-", 5); in __of_device_is_fail()
676 * of_device_is_big_endian - check if a device has BE registers
680 * Return: True if the device has a "big-endian" property, or if the kernel
681 * was compiled for BE *and* the device has a "native-endian" property.
689 if (of_property_read_bool(device, "big-endian")) in of_device_is_big_endian()
692 of_property_read_bool(device, "native-endian")) in of_device_is_big_endian()
699 * of_get_parent - Get a node's parent if any
714 np = of_node_get(node->parent); in of_get_parent()
721 * of_get_next_parent - Iterate to a node's parent
740 parent = of_node_get(node->parent); in of_get_next_parent()
755 next = prev ? prev->sibling : node->child; in __of_get_next_child()
765 * of_get_next_child - Iterate a node childs
787 * of_get_next_available_child - Find the next available child node
804 next = prev ? prev->sibling : node->child; in of_get_next_available_child()
805 for (; next; next = next->sibling) { in of_get_next_available_child()
818 * of_get_next_cpu_node - Iterate on cpu nodes
821 * Unusable CPUs (those with the status property set to "fail" or "fail-...")
839 next = prev->sibling; in of_get_next_cpu_node()
841 next = node->child; in of_get_next_cpu_node()
844 for (; next; next = next->sibling) { in of_get_next_cpu_node()
860 * of_get_compatible_child - Find compatible child node
885 * of_get_child_by_name - Find the child node by name for a given parent
918 const char *name = kbasename(child->full_name); in __of_find_node_by_path()
944 * of_find_node_opts_by_path - Find a node matching a full OF path
981 len = p - path; in of_find_node_opts_by_path()
988 if (strlen(pp->name) == len && !strncmp(pp->name, path, len)) { in of_find_node_opts_by_path()
989 np = of_find_node_by_path(pp->value); in of_find_node_opts_by_path()
1009 * of_find_node_by_name - Find a node by its "name" property
1036 * of_find_node_by_type - Find a node by its "device_type" property
1064 * of_find_compatible_node - Find a node based on type and one of the
1095 * of_find_node_with_property - Find a node which has a property with
1115 for (pp = np->properties; pp; pp = pp->next) { in of_find_node_with_property()
1116 if (of_prop_cmp(pp->name, prop_name) == 0) { in of_find_node_with_property()
1139 for (; matches->name[0] || matches->type[0] || matches->compatible[0]; matches++) { in __of_match_node()
1140 score = __of_device_is_compatible(node, matches->compatible, in __of_match_node()
1141 matches->type, matches->name); in __of_match_node()
1152 * of_match_node - Tell if a device_node has a matching of_match structure
1172 * of_find_matching_node_and_match - Find a node based on an of_device_id
1211 * of_modalias_node - Lookup appropriate modalias for a device node
1230 return -ENODEV; in of_modalias_node()
1238 * of_find_node_by_phandle - Find a node given a phandle
1258 handle == phandle_cache[handle_hash]->phandle) in of_find_node_by_phandle()
1263 if (np->phandle == handle && in of_find_node_by_phandle()
1279 printk("%s %pOF", msg, args->np); in of_print_phandle_args()
1280 for (i = 0; i < args->args_count; i++) { in of_print_phandle_args()
1283 pr_cont("%c%08x", delim, args->args[i]); in of_print_phandle_args()
1304 return -EINVAL; in of_phandle_iterator_init()
1308 return -ENOENT; in of_phandle_iterator_init()
1310 it->cells_name = cells_name; in of_phandle_iterator_init()
1311 it->cell_count = cell_count; in of_phandle_iterator_init()
1312 it->parent = np; in of_phandle_iterator_init()
1313 it->list_end = list + size / sizeof(*list); in of_phandle_iterator_init()
1314 it->phandle_end = list; in of_phandle_iterator_init()
1315 it->cur = list; in of_phandle_iterator_init()
1325 if (it->node) { in of_phandle_iterator_next()
1326 of_node_put(it->node); in of_phandle_iterator_next()
1327 it->node = NULL; in of_phandle_iterator_next()
1330 if (!it->cur || it->phandle_end >= it->list_end) in of_phandle_iterator_next()
1331 return -ENOENT; in of_phandle_iterator_next()
1333 it->cur = it->phandle_end; in of_phandle_iterator_next()
1336 it->phandle = be32_to_cpup(it->cur++); in of_phandle_iterator_next()
1338 if (it->phandle) { in of_phandle_iterator_next()
1341 * Find the provider node and parse the #*-cells property to in of_phandle_iterator_next()
1344 it->node = of_find_node_by_phandle(it->phandle); in of_phandle_iterator_next()
1346 if (it->cells_name) { in of_phandle_iterator_next()
1347 if (!it->node) { in of_phandle_iterator_next()
1349 it->parent, it->phandle); in of_phandle_iterator_next()
1353 if (of_property_read_u32(it->node, it->cells_name, in of_phandle_iterator_next()
1360 if (it->cell_count >= 0) { in of_phandle_iterator_next()
1361 count = it->cell_count; in of_phandle_iterator_next()
1364 it->parent, in of_phandle_iterator_next()
1365 it->cells_name, in of_phandle_iterator_next()
1366 it->node); in of_phandle_iterator_next()
1371 count = it->cell_count; in of_phandle_iterator_next()
1378 if (it->cur + count > it->list_end) { in of_phandle_iterator_next()
1379 if (it->cells_name) in of_phandle_iterator_next()
1381 it->parent, it->cells_name, in of_phandle_iterator_next()
1382 count, it->list_end - it->cur); in of_phandle_iterator_next()
1385 it->parent, of_node_full_name(it->node), in of_phandle_iterator_next()
1386 count, it->list_end - it->cur); in of_phandle_iterator_next()
1391 it->phandle_end = it->cur + count; in of_phandle_iterator_next()
1392 it->cur_count = count; in of_phandle_iterator_next()
1397 if (it->node) { in of_phandle_iterator_next()
1398 of_node_put(it->node); in of_phandle_iterator_next()
1399 it->node = NULL; in of_phandle_iterator_next()
1402 return -EINVAL; in of_phandle_iterator_next()
1412 count = it->cur_count; in of_phandle_iterator_args()
1418 args[i] = be32_to_cpup(it->cur++); in of_phandle_iterator_args()
1433 return -EINVAL; in __of_parse_phandle_with_args()
1441 * or return -ENOENT for an empty entry. in __of_parse_phandle_with_args()
1443 rc = -ENOENT; in __of_parse_phandle_with_args()
1452 out_args->args, in __of_parse_phandle_with_args()
1454 out_args->np = it.node; in __of_parse_phandle_with_args()
1455 out_args->args_count = c; in __of_parse_phandle_with_args()
1469 * -ENOENT : index is for empty phandle in __of_parse_phandle_with_args()
1470 * -EINVAL : parsing error on data in __of_parse_phandle_with_args()
1480 * of_parse_phandle_with_args_map() - Find a node pointed by phandle in a list and remap it
1491 * a <@stem_name>-map property.
1493 * Caller is responsible to call of_node_put() on the returned out_args->np
1499 * #list-cells = <2>;
1503 * #list-cells = <1>;
1507 * #list-cells = <1>;
1508 * list-map = <0 &phandle2 3>,
1511 * list-map-mask = <0x3>;
1538 return -EINVAL; in of_parse_phandle_with_args_map()
1540 cells_name = kasprintf(GFP_KERNEL, "#%s-cells", stem_name); in of_parse_phandle_with_args_map()
1542 return -ENOMEM; in of_parse_phandle_with_args_map()
1544 ret = -ENOMEM; in of_parse_phandle_with_args_map()
1545 map_name = kasprintf(GFP_KERNEL, "%s-map", stem_name); in of_parse_phandle_with_args_map()
1549 mask_name = kasprintf(GFP_KERNEL, "%s-map-mask", stem_name); in of_parse_phandle_with_args_map()
1553 pass_name = kasprintf(GFP_KERNEL, "%s-map-pass-thru", stem_name); in of_parse_phandle_with_args_map()
1557 ret = __of_parse_phandle_with_args(np, list_name, cells_name, -1, index, in of_parse_phandle_with_args_map()
1562 /* Get the #<list>-cells property */ in of_parse_phandle_with_args_map()
1563 cur = out_args->np; in of_parse_phandle_with_args_map()
1568 /* Precalculate the match array - this simplifies match loop */ in of_parse_phandle_with_args_map()
1570 initial_match_array[i] = cpu_to_be32(out_args->args[i]); in of_parse_phandle_with_args_map()
1572 ret = -EINVAL; in of_parse_phandle_with_args_map()
1574 /* Get the <list>-map property */ in of_parse_phandle_with_args_map()
1582 /* Get the <list>-map-mask property (optional) */ in of_parse_phandle_with_args_map()
1586 /* Iterate through <list>-map property */ in of_parse_phandle_with_args_map()
1591 for (i = 0; i < list_size; i++, map_len--) in of_parse_phandle_with_args_map()
1597 map_len--; in of_parse_phandle_with_args_map()
1616 /* Move forward by new node's #<list>-cells amount */ in of_parse_phandle_with_args_map()
1618 map_len -= new_size; in of_parse_phandle_with_args_map()
1623 /* Get the <list>-map-pass-thru property (optional) */ in of_parse_phandle_with_args_map()
1629 * Successfully parsed a <list>-map translation; copy new in of_parse_phandle_with_args_map()
1630 * specifier into the out_args structure, keeping the in of_parse_phandle_with_args_map()
1631 * bits specified in <list>-map-pass-thru. in of_parse_phandle_with_args_map()
1633 match_array = map - new_size; in of_parse_phandle_with_args_map()
1635 __be32 val = *(map - new_size + i); in of_parse_phandle_with_args_map()
1639 val |= cpu_to_be32(out_args->args[i]) & pass[i]; in of_parse_phandle_with_args_map()
1642 out_args->args[i] = be32_to_cpu(val); in of_parse_phandle_with_args_map()
1644 out_args->args_count = list_size = new_size; in of_parse_phandle_with_args_map()
1646 out_args->np = new; in of_parse_phandle_with_args_map()
1664 * of_count_phandle_with_args() - Find the number of phandles references in a property
1672 * by a property in the phandle-target node. For example, a gpios
1675 * determined by the #gpio-cells property in the node pointed to by the
1696 return -ENOENT; in of_count_phandle_with_args()
1701 rc = of_phandle_iterator_init(&it, np, list_name, cells_name, -1); in of_count_phandle_with_args()
1708 if (rc != -ENOENT) in of_count_phandle_with_args()
1716 * __of_add_property - Add a property to a node without lock operations
1724 prop->next = NULL; in __of_add_property()
1725 next = &np->properties; in __of_add_property()
1727 if (strcmp(prop->name, (*next)->name) == 0) in __of_add_property()
1729 return -EEXIST; in __of_add_property()
1731 next = &(*next)->next; in __of_add_property()
1739 * of_add_property - Add a property to a node
1770 for (next = &np->properties; *next; next = &(*next)->next) { in __of_remove_property()
1775 return -ENODEV; in __of_remove_property()
1778 *next = prop->next; in __of_remove_property()
1779 prop->next = np->deadprops; in __of_remove_property()
1780 np->deadprops = prop; in __of_remove_property()
1786 * of_remove_property - Remove a property from a node.
1791 * who-knows-how-many pointers to the data using get-property.
1801 return -ENODEV; in of_remove_property()
1826 for (next = &np->properties; *next; next = &(*next)->next) { in __of_update_property()
1827 if (of_prop_cmp((*next)->name, newprop->name) == 0) in __of_update_property()
1834 newprop->next = oldprop->next; in __of_update_property()
1836 oldprop->next = np->deadprops; in __of_update_property()
1837 np->deadprops = oldprop; in __of_update_property()
1840 newprop->next = NULL; in __of_update_property()
1848 * of_update_property - Update a property in a node, if the property does
1852 * who-knows-how-many pointers to the data using get-property.
1862 if (!newprop->name) in of_update_property()
1863 return -EINVAL; in of_update_property()
1885 ap->np = np; in of_alias_add()
1886 ap->id = id; in of_alias_add()
1887 strncpy(ap->stem, stem, stem_len); in of_alias_add()
1888 ap->stem[stem_len] = 0; in of_alias_add()
1889 list_add_tail(&ap->link, &aliases_lookup); in of_alias_add()
1891 ap->alias, ap->stem, ap->id, np); in of_alias_add()
1895 * of_alias_scan - Scan all properties of the 'aliases' node
1913 /* linux,stdout-path and /aliases/stdout are for legacy compatibility */ in of_alias_scan()
1916 if (of_property_read_string(of_chosen, "stdout-path", &name)) in of_alias_scan()
1917 of_property_read_string(of_chosen, "linux,stdout-path", in of_alias_scan()
1924 of_stdout->fwnode.flags |= FWNODE_FLAG_BEST_EFFORT; in of_alias_scan()
1931 const char *start = pp->name; in of_alias_scan()
1938 if (!strcmp(pp->name, "name") || in of_alias_scan()
1939 !strcmp(pp->name, "phandle") || in of_alias_scan()
1940 !strcmp(pp->name, "linux,phandle")) in of_alias_scan()
1943 np = of_find_node_by_path(pp->value); in of_alias_scan()
1949 while (isdigit(*(end-1)) && end > start) in of_alias_scan()
1950 end--; in of_alias_scan()
1951 len = end - start; in of_alias_scan()
1961 ap->alias = start; in of_alias_scan()
1967 * of_alias_get_id - Get alias id for the given device_node
1979 int id = -ENODEV; in of_alias_get_id()
1983 if (strcmp(app->stem, stem) != 0) in of_alias_get_id()
1986 if (np == app->np) { in of_alias_get_id()
1987 id = app->id; in of_alias_get_id()
1998 * of_alias_get_highest_id - Get highest alias id for the given stem
2007 int id = -ENODEV; in of_alias_get_highest_id()
2011 if (strcmp(app->stem, stem) != 0) in of_alias_get_highest_id()
2014 if (app->id > id) in of_alias_get_highest_id()
2015 id = app->id; in of_alias_get_highest_id()
2024 * of_console_check() - Test and setup console for DT setup
2029 * Check if the given device node matches the stdout-path property in the
2048 * of_find_next_cache_node - Find a node's subsidiary cache
2059 cache_node = of_parse_phandle(np, "l2-cache", 0); in of_find_next_cache_node()
2061 cache_node = of_parse_phandle(np, "next-level-cache", 0); in of_find_next_cache_node()
2066 /* OF on pmac has nodes instead of properties named "l2-cache" in of_find_next_cache_node()
2078 * of_find_last_cache_level - Find the level at which the last cache is
2097 of_property_read_u32(prev, "cache-level", &cache_level); in of_find_last_cache_level()
2104 * of_map_id - Translate an ID through a downstream mapping.
2112 * Given a device ID, look up the appropriate implementation-defined
2114 * ID, as per the "iommu-map" and "msi-map" bindings. Either of @target or
2116 * a non-NULL device node pointer, only entries targeting that node will be
2131 return -EINVAL; in of_map_id()
2136 return -ENODEV; in of_map_id()
2145 return -EINVAL; in of_map_id()
2152 * Can be overridden by "{iommu,msi}-map-mask" property. in of_map_id()
2159 for ( ; map_len > 0; map_len -= 4 * sizeof(*map), map += 4) { in of_map_id()
2167 pr_err("%pOF: Invalid %s translation - %s-mask (0x%x) ignores id-base (0x%x)\n", in of_map_id()
2170 return -EFAULT; in of_map_id()
2178 return -ENODEV; in of_map_id()
2191 *id_out = masked_id - id_base + out_base; in of_map_id()
2193 …pr_debug("%pOF: %s, using mask %08x, id-base: %08x, out-base: %08x, length: %08x, id: %08x -> %08x… in of_map_id()
2195 id_len, id, masked_id - id_base + out_base); in of_map_id()