Lines Matching +full:int +full:- +full:property
2 * libfdt - Flat Device Tree manipulation
22 * MA 02110-1301 USA
60 * overlay_get_target_phandle - retrieves the target phandle of a fragment
66 * property) instead of a path (target-path property).
69 * the phandle pointed by the target property
71 * -1, if the phandle was malformed
73 static uint32_t overlay_get_target_phandle(const void *fdto, int fragment) in overlay_get_target_phandle()
76 int len; in overlay_get_target_phandle()
82 if ((len != sizeof(*val)) || (fdt32_to_cpu(*val) == (uint32_t)-1)) in overlay_get_target_phandle()
83 return (uint32_t)-1; in overlay_get_target_phandle()
89 * overlay_get_target - retrieves the offset of a fragment's target
103 static int overlay_get_target(const void *fdt, const void *fdto, in overlay_get_target()
104 int fragment, char const **pathp) in overlay_get_target()
108 int path_len = 0, ret; in overlay_get_target()
112 if (phandle == (uint32_t)-1) in overlay_get_target()
113 return -FDT_ERR_BADPHANDLE; in overlay_get_target()
118 path = fdt_getprop(fdto, fragment, "target-path", &path_len); in overlay_get_target()
128 * target-path property in a node that contains a in overlay_get_target()
133 if (ret < 0 && path_len == -FDT_ERR_NOTFOUND) in overlay_get_target()
134 ret = -FDT_ERR_BADOVERLAY; in overlay_get_target()
148 * overlay_phandle_add_offset - Increases a phandle by an offset
151 * @name: Name of the property to modify (phandle or linux,phandle)
161 static int overlay_phandle_add_offset(void *fdt, int node, in overlay_phandle_add_offset()
166 int len; in overlay_phandle_add_offset()
173 return -FDT_ERR_BADPHANDLE; in overlay_phandle_add_offset()
177 return -FDT_ERR_NOPHANDLES; in overlay_phandle_add_offset()
180 if (adj_val == (uint32_t)-1) in overlay_phandle_add_offset()
181 return -FDT_ERR_NOPHANDLES; in overlay_phandle_add_offset()
187 * overlay_adjust_node_phandles - Offsets the phandles of a node
201 static int overlay_adjust_node_phandles(void *fdto, int node, in overlay_adjust_node_phandles()
204 int child; in overlay_adjust_node_phandles()
205 int ret; in overlay_adjust_node_phandles()
208 if (ret && ret != -FDT_ERR_NOTFOUND) in overlay_adjust_node_phandles()
212 if (ret && ret != -FDT_ERR_NOTFOUND) in overlay_adjust_node_phandles()
225 * overlay_adjust_local_phandles - Adjust the phandles of a whole overlay
238 static int overlay_adjust_local_phandles(void *fdto, uint32_t delta) in overlay_adjust_local_phandles()
247 * overlay_update_local_node_references - Adjust the overlay references
265 static int overlay_update_local_node_references(void *fdto, in overlay_update_local_node_references()
266 int tree_node, in overlay_update_local_node_references()
267 int fixup_node, in overlay_update_local_node_references()
270 int fixup_prop; in overlay_update_local_node_references()
271 int fixup_child; in overlay_update_local_node_references()
272 int ret; in overlay_update_local_node_references()
278 int fixup_len; in overlay_update_local_node_references()
279 int tree_len; in overlay_update_local_node_references()
280 int i; in overlay_update_local_node_references()
288 return -FDT_ERR_BADOVERLAY; in overlay_update_local_node_references()
292 if (tree_len == -FDT_ERR_NOTFOUND) in overlay_update_local_node_references()
293 return -FDT_ERR_BADOVERLAY; in overlay_update_local_node_references()
321 if (ret == -FDT_ERR_NOSPACE) in overlay_update_local_node_references()
322 return -FDT_ERR_BADOVERLAY; in overlay_update_local_node_references()
332 int tree_child; in overlay_update_local_node_references()
336 if (tree_child == -FDT_ERR_NOTFOUND) in overlay_update_local_node_references()
337 return -FDT_ERR_BADOVERLAY; in overlay_update_local_node_references()
353 * overlay_update_local_references - Adjust the overlay references
369 static int overlay_update_local_references(void *fdto, uint32_t delta) in overlay_update_local_references()
371 int fixups; in overlay_update_local_references()
376 if (fixups == -FDT_ERR_NOTFOUND) in overlay_update_local_references()
390 * overlay_fixup_one_phandle - Set an overlay phandle to the base one
396 * @name: Name of the property holding the phandle reference in the overlay
398 * @poffset: Offset within the overlay property where the phandle is stored
412 static int overlay_fixup_one_phandle(void *fdt, void *fdto, in overlay_fixup_one_phandle()
413 int symbols_off, in overlay_fixup_one_phandle()
416 int poffset, const char *label) in overlay_fixup_one_phandle()
421 int symbol_off, fixup_off; in overlay_fixup_one_phandle()
422 int prop_len; in overlay_fixup_one_phandle()
438 return -FDT_ERR_NOTFOUND; in overlay_fixup_one_phandle()
441 if (fixup_off == -FDT_ERR_NOTFOUND) in overlay_fixup_one_phandle()
442 return -FDT_ERR_BADOVERLAY; in overlay_fixup_one_phandle()
454 * overlay_fixup_phandle - Set an overlay phandle to the base one
458 * @property: Property offset in the overlay holding the list of fixups
461 * to in a __fixups__ property, and updates them to match the phandles
472 static int overlay_fixup_phandle(void *fdt, void *fdto, int symbols_off, in overlay_fixup_phandle()
473 int property) in overlay_fixup_phandle() argument
477 int len; in overlay_fixup_phandle()
479 value = fdt_getprop_by_offset(fdto, property, in overlay_fixup_phandle()
482 if (len == -FDT_ERR_NOTFOUND) in overlay_fixup_phandle()
483 return -FDT_ERR_INTERNAL; in overlay_fixup_phandle()
494 int poffset, ret; in overlay_fixup_phandle()
498 return -FDT_ERR_BADOVERLAY; in overlay_fixup_phandle()
499 fixup_len = fixup_end - fixup_str; in overlay_fixup_phandle()
501 len -= fixup_len + 1; in overlay_fixup_phandle()
507 return -FDT_ERR_BADOVERLAY; in overlay_fixup_phandle()
509 path_len = sep - path; in overlay_fixup_phandle()
510 if (path_len == (fixup_len - 1)) in overlay_fixup_phandle()
511 return -FDT_ERR_BADOVERLAY; in overlay_fixup_phandle()
513 fixup_len -= path_len + 1; in overlay_fixup_phandle()
517 return -FDT_ERR_BADOVERLAY; in overlay_fixup_phandle()
519 name_len = sep - name; in overlay_fixup_phandle()
521 return -FDT_ERR_BADOVERLAY; in overlay_fixup_phandle()
525 return -FDT_ERR_BADOVERLAY; in overlay_fixup_phandle()
538 * overlay_fixup_phandles - Resolve the overlay phandles to the base
554 static int overlay_fixup_phandles(void *fdt, void *fdto) in overlay_fixup_phandles()
556 int fixups_off, symbols_off; in overlay_fixup_phandles()
557 int property; in overlay_fixup_phandles() local
561 if (fixups_off == -FDT_ERR_NOTFOUND) in overlay_fixup_phandles()
568 if ((symbols_off < 0 && (symbols_off != -FDT_ERR_NOTFOUND))) in overlay_fixup_phandles()
571 fdt_for_each_property_offset(property, fdto, fixups_off) { in overlay_fixup_phandles()
572 int ret; in overlay_fixup_phandles()
574 ret = overlay_fixup_phandle(fdt, fdto, symbols_off, property); in overlay_fixup_phandles()
583 * overlay_apply_node - Merges a node into the base device tree
601 static int overlay_apply_node(void *fdt, int target, in overlay_apply_node()
602 void *fdto, int node) in overlay_apply_node()
604 int property; in overlay_apply_node() local
605 int subnode; in overlay_apply_node()
607 fdt_for_each_property_offset(property, fdto, node) { in overlay_apply_node()
610 int prop_len; in overlay_apply_node()
611 int ret; in overlay_apply_node()
613 prop = fdt_getprop_by_offset(fdto, property, &name, in overlay_apply_node()
615 if (prop_len == -FDT_ERR_NOTFOUND) in overlay_apply_node()
616 return -FDT_ERR_INTERNAL; in overlay_apply_node()
627 int nnode; in overlay_apply_node()
628 int ret; in overlay_apply_node()
631 if (nnode == -FDT_ERR_EXISTS) { in overlay_apply_node()
633 if (nnode == -FDT_ERR_NOTFOUND) in overlay_apply_node()
634 return -FDT_ERR_INTERNAL; in overlay_apply_node()
649 * overlay_merge - Merge an overlay into its base device tree
663 static int overlay_merge(void *fdt, void *fdto) in overlay_merge()
665 int fragment; in overlay_merge()
668 int overlay; in overlay_merge()
669 int target; in overlay_merge()
670 int ret; in overlay_merge()
677 if (overlay == -FDT_ERR_NOTFOUND) in overlay_merge()
695 static int get_path_len(const void *fdt, int nodeoffset) in get_path_len()
697 int len = 0, namelen; in get_path_len()
724 * overlay_symbol_update - Update the symbols of base tree after a merge
739 static int overlay_symbol_update(void *fdt, void *fdto) in overlay_symbol_update()
741 int root_sym, ov_sym, prop, path_len, fragment, target; in overlay_symbol_update()
742 int len, frag_name_len, ret, rel_path_len; in overlay_symbol_update()
761 if (root_sym == -FDT_ERR_NOTFOUND) in overlay_symbol_update()
774 /* verify it's a string property (terminated by a single \0) */ in overlay_symbol_update()
775 if (path_len < 1 || memchr(path, '\0', path_len) != &path[path_len - 1]) in overlay_symbol_update()
776 return -FDT_ERR_BADVALUE; in overlay_symbol_update()
781 /* format: /<fragment-name>/__overlay__/<relative-subnode-path> */ in overlay_symbol_update()
784 return -FDT_ERR_BADVALUE; in overlay_symbol_update()
789 return -FDT_ERR_BADOVERLAY; in overlay_symbol_update()
792 frag_name_len = s - path - 1; in overlay_symbol_update()
795 len = sizeof("/__overlay__/") - 1; in overlay_symbol_update()
796 if ((e - s) < len || memcmp(s, "/__overlay__/", len)) in overlay_symbol_update()
797 return -FDT_ERR_BADOVERLAY; in overlay_symbol_update()
800 rel_path_len = e - rel_path; in overlay_symbol_update()
807 return -FDT_ERR_BADOVERLAY; in overlay_symbol_update()
813 return -FDT_ERR_BADOVERLAY; in overlay_symbol_update()
854 len--; in overlay_symbol_update()
864 int fdt_overlay_apply(void *fdt, void *fdto) in fdt_overlay_apply()
867 int ret; in fdt_overlay_apply()