Lines Matching +full:int +full:- +full:property
1 /* SPDX-License-Identifier: (GPL-2.0-or-later OR BSD-2-Clause) */
5 * libfdt - Flat Device Tree manipulation
21 /* FDT_ERR_NOTFOUND: The requested node or property does not exist */
23 /* FDT_ERR_EXISTS: Attempted to create a node or property which
34 * offset which is out-of-bounds, or which points to an
42 * This can be caused either by an invalid phandle property
43 * length, or the phandle value was either 0 or -1, which are
47 * tree created by the sequential-write functions, which is
52 /* FDT_ERR_TRUNCATED: FDT or a sub-block is improperly
57 * device tree at all - it is missing the flattened device
62 * read-write functions, this may mean that fdt_open_into() is
69 /* FDT_ERR_BADLAYOUT: For read-write functions, the given
70 * device tree has it's sub-blocks in an order that the
73 * into a form suitable for the read-write operations. */
83 /* FDT_ERR_BADNCELLS: Device tree has a #address-cells, #size-cells
84 * or similar property with a bad format or value */
87 /* FDT_ERR_BADVALUE: Device tree has a property with an unexpected
88 * value. For example: a property expected to contain a string list
89 * is not NUL-terminated within the length of its value. */
94 * unexpected or missing value, property or node. */
108 /* Valid values for phandles range from 1 to 2^32-2. */
111 /* Low-level functions (you probably don't need these) */
115 const void *fdt_offset_ptr(const void *fdt, int offset, unsigned int checklen);
117 static inline void *fdt_offset_ptr_w(void *fdt, int offset, int checklen) in fdt_offset_ptr_w()
122 uint32_t fdt_next_tag(const void *fdt, int offset, int *nextoffset);
141 static inline void fdt32_st(void *property, uint32_t value) in fdt32_st() argument
143 uint8_t *bp = (uint8_t *)property; in fdt32_st()
165 static inline void fdt64_st(void *property, uint64_t value) in fdt64_st() argument
167 uint8_t *bp = (uint8_t *)property; in fdt64_st()
183 int fdt_next_node(const void *fdt, int offset, int *depth);
186 * fdt_first_subnode() - get offset of first direct subnode
190 * @return offset of first subnode, or -FDT_ERR_NOTFOUND if there is none
192 int fdt_first_subnode(const void *fdt, int offset);
195 * fdt_next_subnode() - get offset of next direct subnode
202 * @return offset of next subnode, or -FDT_ERR_NOTFOUND if there are no more
205 int fdt_next_subnode(const void *fdt, int offset);
208 * fdt_for_each_subnode - iterate over all subnodes of a parent
210 * @node: child node (int, lvalue)
212 * @parent: parent node (int)
221 * if ((node < 0) && (node != -FDT_ERR_NOTFOUND)) {
239 (fdt32_ld(&((const struct fdt_header *)(fdt))->field))
255 fdth->name = cpu_to_fdt32(val); \
270 * fdt_header_size - return the size of the tree's header
276 * fdt_header_size_ - internal function which takes a version number
281 * fdt_check_header - sanity check a device tree header
292 * -FDT_ERR_BADMAGIC,
293 * -FDT_ERR_BADVERSION,
294 * -FDT_ERR_BADSTATE,
295 * -FDT_ERR_TRUNCATED, standard meanings, as above
297 int fdt_check_header(const void *fdt);
300 * fdt_move - move a device tree around in memory
313 * -FDT_ERR_NOSPACE, bufsize is insufficient to contain the device tree
314 * -FDT_ERR_BADMAGIC,
315 * -FDT_ERR_BADVERSION,
316 * -FDT_ERR_BADSTATE, standard meanings
318 int fdt_move(const void *fdt, void *buf, int bufsize);
321 /* Read-only functions */
324 int fdt_check_full(const void *fdt, size_t bufsize);
327 * fdt_get_string - retrieve a string from the strings block of a device tree
340 const char *fdt_get_string(const void *fdt, int stroffset, int *lenp);
343 * fdt_string - retrieve a string from the strings block of a device tree
354 const char *fdt_string(const void *fdt, int stroffset);
357 * fdt_find_max_phandle - find and return the highest phandle in a tree
368 int fdt_find_max_phandle(const void *fdt, uint32_t *phandle);
371 * fdt_get_max_phandle - retrieves the highest phandle in a tree
376 * with a value of 0 or -1.
383 * -1, if an error occurred
388 int err; in fdt_get_max_phandle()
392 return (uint32_t)-1; in fdt_get_max_phandle()
398 * fdt_generate_phandle - return a new, unused phandle for a device tree blob
408 * 0 on success or a negative error-code on failure
410 int fdt_generate_phandle(const void *fdt, uint32_t *phandle);
413 * fdt_num_mem_rsv - retrieve the number of memory reserve map entries
423 int fdt_num_mem_rsv(const void *fdt);
426 * fdt_get_mem_rsv - retrieve one memory reserve map entry
428 * @address, @size: pointers to 64-bit variables
431 * the n-th reserve map entry from the device tree blob, in
432 * native-endian format.
436 * -FDT_ERR_BADMAGIC,
437 * -FDT_ERR_BADVERSION,
438 * -FDT_ERR_BADSTATE, standard meanings
440 int fdt_get_mem_rsv(const void *fdt, int n, uint64_t *address, uint64_t *size);
443 * fdt_subnode_offset_namelen - find a subnode based on substring
455 int fdt_subnode_offset_namelen(const void *fdt, int parentoffset,
456 const char *name, int namelen);
459 * fdt_subnode_offset - find a subnode of a given node
473 * -FDT_ERR_NOTFOUND, if the requested subnode does not exist
474 * -FDT_ERR_BADOFFSET, if parentoffset did not point to an FDT_BEGIN_NODE
476 * -FDT_ERR_BADMAGIC,
477 * -FDT_ERR_BADVERSION,
478 * -FDT_ERR_BADSTATE,
479 * -FDT_ERR_BADSTRUCTURE,
480 * -FDT_ERR_TRUNCATED, standard meanings.
482 int fdt_subnode_offset(const void *fdt, int parentoffset, const char *name);
485 * fdt_path_offset_namelen - find a tree node by its full path
494 int fdt_path_offset_namelen(const void *fdt, const char *path, int namelen);
498 * fdt_path_offset - find a tree node by its full path
512 * -FDT_ERR_BADPATH, given path does not begin with '/' or is invalid
513 * -FDT_ERR_NOTFOUND, if the requested node does not exist
514 * -FDT_ERR_BADMAGIC,
515 * -FDT_ERR_BADVERSION,
516 * -FDT_ERR_BADSTATE,
517 * -FDT_ERR_BADSTRUCTURE,
518 * -FDT_ERR_TRUNCATED, standard meanings.
520 int fdt_path_offset(const void *fdt, const char *path);
523 * fdt_get_name - retrieve the name of a given node
530 * non-NULL, the length of this name is also returned, in the integer
535 * If lenp is non-NULL, *lenp contains the length of that name
538 * if lenp is non-NULL *lenp contains an error code (<0):
539 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE
541 * -FDT_ERR_BADMAGIC,
542 * -FDT_ERR_BADVERSION,
543 * -FDT_ERR_BADSTATE, standard meanings
545 const char *fdt_get_name(const void *fdt, int nodeoffset, int *lenp);
548 * fdt_first_property_offset - find the offset of a node's first property
552 * fdt_first_property_offset() finds the first property of the node at
556 * structure block offset of the property (>=0), on success
557 * -FDT_ERR_NOTFOUND, if the requested node has no properties
558 * -FDT_ERR_BADOFFSET, if nodeoffset did not point to an FDT_BEGIN_NODE tag
559 * -FDT_ERR_BADMAGIC,
560 * -FDT_ERR_BADVERSION,
561 * -FDT_ERR_BADSTATE,
562 * -FDT_ERR_BADSTRUCTURE,
563 * -FDT_ERR_TRUNCATED, standard meanings.
565 int fdt_first_property_offset(const void *fdt, int nodeoffset);
568 * fdt_next_property_offset - step through a node's properties
570 * @offset: structure block offset of a property
572 * fdt_next_property_offset() finds the property immediately after the
573 * one at the given structure block offset. This will be a property
574 * of the same node as the given property.
577 * structure block offset of the next property (>=0), on success
578 * -FDT_ERR_NOTFOUND, if the given property is the last in its node
579 * -FDT_ERR_BADOFFSET, if nodeoffset did not point to an FDT_PROP tag
580 * -FDT_ERR_BADMAGIC,
581 * -FDT_ERR_BADVERSION,
582 * -FDT_ERR_BADSTATE,
583 * -FDT_ERR_BADSTRUCTURE,
584 * -FDT_ERR_TRUNCATED, standard meanings.
586 int fdt_next_property_offset(const void *fdt, int offset);
589 * fdt_for_each_property_offset - iterate over all properties of a node
591 * @property_offset: property offset (int, lvalue)
593 * @node: node offset (int)
597 * fdt_for_each_property_offset(property, fdt, node) {
598 * Use property
602 * if ((property < 0) && (property != -FDT_ERR_NOTFOUND)) {
606 * Note that this is implemented as a macro and property is used as
610 #define fdt_for_each_property_offset(property, fdt, node) \ argument
611 for (property = fdt_first_property_offset(fdt, node); \
612 property >= 0; \
613 property = fdt_next_property_offset(fdt, property))
616 * fdt_get_property_by_offset - retrieve the property at a given offset
618 * @offset: offset of the property to retrieve
623 * offset. If lenp is non-NULL, the length of the property value is
630 * pointer to the structure representing the property
631 * if lenp is non-NULL, *lenp contains the length of the property
634 * if lenp is non-NULL, *lenp contains an error code (<0):
635 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_PROP tag
636 * -FDT_ERR_BADMAGIC,
637 * -FDT_ERR_BADVERSION,
638 * -FDT_ERR_BADSTATE,
639 * -FDT_ERR_BADSTRUCTURE,
640 * -FDT_ERR_TRUNCATED, standard meanings
643 int offset,
644 int *lenp);
647 * fdt_get_property_namelen - find a property based on substring
649 * @nodeoffset: offset of the node whose property to find
650 * @name: name of the property to find
655 * characters of name for matching the property name.
659 int nodeoffset,
661 int namelen, int *lenp);
665 * fdt_get_property - find a given property in a given node
667 * @nodeoffset: offset of the node whose property to find
668 * @name: name of the property to find
672 * structure within the device tree blob corresponding to the property
674 * non-NULL, the length of the property value is also returned, in the
678 * pointer to the structure representing the property
679 * if lenp is non-NULL, *lenp contains the length of the property
682 * if lenp is non-NULL, *lenp contains an error code (<0):
683 * -FDT_ERR_NOTFOUND, node does not have named property
684 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE
686 * -FDT_ERR_BADMAGIC,
687 * -FDT_ERR_BADVERSION,
688 * -FDT_ERR_BADSTATE,
689 * -FDT_ERR_BADSTRUCTURE,
690 * -FDT_ERR_TRUNCATED, standard meanings
692 const struct fdt_property *fdt_get_property(const void *fdt, int nodeoffset,
693 const char *name, int *lenp);
694 static inline struct fdt_property *fdt_get_property_w(void *fdt, int nodeoffset, in fdt_get_property_w()
696 int *lenp) in fdt_get_property_w()
703 * fdt_getprop_by_offset - retrieve the value of a property at a given offset
705 * @offset: offset of the property to read
710 * property at structure block offset 'offset' (this will be a pointer
712 * lenp is non-NULL, the length of the property value is also
713 * returned, in the integer pointed to by lenp. If namep is non-NULL,
714 * the property's namne will also be returned in the char * pointed to
719 * pointer to the property's value
720 * if lenp is non-NULL, *lenp contains the length of the property
722 * if namep is non-NULL *namep contiains a pointer to the property
725 * if lenp is non-NULL, *lenp contains an error code (<0):
726 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_PROP tag
727 * -FDT_ERR_BADMAGIC,
728 * -FDT_ERR_BADVERSION,
729 * -FDT_ERR_BADSTATE,
730 * -FDT_ERR_BADSTRUCTURE,
731 * -FDT_ERR_TRUNCATED, standard meanings
734 const void *fdt_getprop_by_offset(const void *fdt, int offset,
735 const char **namep, int *lenp);
739 * fdt_getprop_namelen - get property value based on substring
741 * @nodeoffset: offset of the node whose property to find
742 * @name: name of the property to find
747 * characters of name for matching the property name.
750 const void *fdt_getprop_namelen(const void *fdt, int nodeoffset,
751 const char *name, int namelen, int *lenp);
752 static inline void *fdt_getprop_namelen_w(void *fdt, int nodeoffset, in fdt_getprop_namelen_w()
753 const char *name, int namelen, in fdt_getprop_namelen_w()
754 int *lenp) in fdt_getprop_namelen_w()
762 * fdt_getprop - retrieve the value of a given property
764 * @nodeoffset: offset of the node whose property to find
765 * @name: name of the property to find
768 * fdt_getprop() retrieves a pointer to the value of the property
771 * If lenp is non-NULL, the length of the property value is also
775 * pointer to the property's value
776 * if lenp is non-NULL, *lenp contains the length of the property
779 * if lenp is non-NULL, *lenp contains an error code (<0):
780 * -FDT_ERR_NOTFOUND, node does not have named property
781 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE
783 * -FDT_ERR_BADMAGIC,
784 * -FDT_ERR_BADVERSION,
785 * -FDT_ERR_BADSTATE,
786 * -FDT_ERR_BADSTRUCTURE,
787 * -FDT_ERR_TRUNCATED, standard meanings
789 const void *fdt_getprop(const void *fdt, int nodeoffset,
790 const char *name, int *lenp);
791 static inline void *fdt_getprop_w(void *fdt, int nodeoffset, in fdt_getprop_w()
792 const char *name, int *lenp) in fdt_getprop_w()
798 * fdt_get_phandle - retrieve the phandle of a given node
806 * the phandle of the node at nodeoffset, on success (!= 0, != -1)
809 uint32_t fdt_get_phandle(const void *fdt, int nodeoffset);
812 * fdt_get_alias_namelen - get alias based on substring
822 const char *name, int namelen);
826 * fdt_get_alias - retrieve the path referenced by a given alias
831 * value of the property named 'name' in the node /aliases.
840 * fdt_get_path - determine the full path of a node
855 * nodeoffset, as a NUL-terminated string.
856 * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
857 * -FDT_ERR_NOSPACE, the path of the given node is longer than (bufsize-1)
859 * -FDT_ERR_BADMAGIC,
860 * -FDT_ERR_BADVERSION,
861 * -FDT_ERR_BADSTATE,
862 * -FDT_ERR_BADSTRUCTURE, standard meanings
864 int fdt_get_path(const void *fdt, int nodeoffset, char *buf, int buflen);
867 * fdt_supernode_atdepth_offset - find a specific ancestor of a node
888 * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
889 * -FDT_ERR_NOTFOUND, supernodedepth was greater than the depth of
891 * -FDT_ERR_BADMAGIC,
892 * -FDT_ERR_BADVERSION,
893 * -FDT_ERR_BADSTATE,
894 * -FDT_ERR_BADSTRUCTURE, standard meanings
896 int fdt_supernode_atdepth_offset(const void *fdt, int nodeoffset,
897 int supernodedepth, int *nodedepth);
900 * fdt_node_depth - find the depth of a given node
912 * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
913 * -FDT_ERR_BADMAGIC,
914 * -FDT_ERR_BADVERSION,
915 * -FDT_ERR_BADSTATE,
916 * -FDT_ERR_BADSTRUCTURE, standard meanings
918 int fdt_node_depth(const void *fdt, int nodeoffset);
921 * fdt_parent_offset - find the parent of a given node
935 * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
936 * -FDT_ERR_BADMAGIC,
937 * -FDT_ERR_BADVERSION,
938 * -FDT_ERR_BADSTATE,
939 * -FDT_ERR_BADSTRUCTURE, standard meanings
941 int fdt_parent_offset(const void *fdt, int nodeoffset);
944 * fdt_node_offset_by_prop_value - find nodes with a given property value
947 * @propname: property name to check
948 * @propval: property value to search for
952 * node after startoffset, which has a property named propname whose
954 * startoffset is -1, the very first such node in the tree.
958 * offset = fdt_node_offset_by_prop_value(fdt, -1, propname,
960 * while (offset != -FDT_ERR_NOTFOUND) {
966 * Note the -1 in the first call to the function, if 0 is used here
973 * -FDT_ERR_NOTFOUND, no node matching the criterion exists in the
975 * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
976 * -FDT_ERR_BADMAGIC,
977 * -FDT_ERR_BADVERSION,
978 * -FDT_ERR_BADSTATE,
979 * -FDT_ERR_BADSTRUCTURE, standard meanings
981 int fdt_node_offset_by_prop_value(const void *fdt, int startoffset,
983 const void *propval, int proplen);
986 * fdt_node_offset_by_phandle - find the node with a given phandle
997 * -FDT_ERR_NOTFOUND, no node with that phandle exists
998 * -FDT_ERR_BADPHANDLE, given phandle value was invalid (0 or -1)
999 * -FDT_ERR_BADMAGIC,
1000 * -FDT_ERR_BADVERSION,
1001 * -FDT_ERR_BADSTATE,
1002 * -FDT_ERR_BADSTRUCTURE, standard meanings
1004 int fdt_node_offset_by_phandle(const void *fdt, uint32_t phandle);
1007 * fdt_node_check_compatible: check a node's compatible property
1014 * 'compatible' property with the given string as one of its elements,
1015 * it returns non-zero otherwise, or on error.
1018 * 0, if the node has a 'compatible' property listing the given string
1019 * 1, if the node has a 'compatible' property, but it does not list
1021 * -FDT_ERR_NOTFOUND, if the given node has no 'compatible' property
1022 * -FDT_ERR_BADOFFSET, if nodeoffset does not refer to a BEGIN_NODE tag
1023 * -FDT_ERR_BADMAGIC,
1024 * -FDT_ERR_BADVERSION,
1025 * -FDT_ERR_BADSTATE,
1026 * -FDT_ERR_BADSTRUCTURE, standard meanings
1028 int fdt_node_check_compatible(const void *fdt, int nodeoffset,
1032 * fdt_node_offset_by_compatible - find nodes with a given 'compatible' value
1038 * node after startoffset, which has a 'compatible' property which
1039 * lists the given compatible string; or if startoffset is -1, the
1044 * offset = fdt_node_offset_by_compatible(fdt, -1, compatible);
1045 * while (offset != -FDT_ERR_NOTFOUND) {
1050 * Note the -1 in the first call to the function, if 0 is used here
1057 * -FDT_ERR_NOTFOUND, no node matching the criterion exists in the
1059 * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
1060 * -FDT_ERR_BADMAGIC,
1061 * -FDT_ERR_BADVERSION,
1062 * -FDT_ERR_BADSTATE,
1063 * -FDT_ERR_BADSTRUCTURE, standard meanings
1065 int fdt_node_offset_by_compatible(const void *fdt, int startoffset,
1069 * fdt_stringlist_contains - check a string list property for a string
1070 * @strlist: Property containing a list of strings to check
1071 * @listlen: Length of property
1076 * "compatible" property.
1080 int fdt_stringlist_contains(const char *strlist, int listlen, const char *str);
1083 * fdt_stringlist_count - count the number of strings in a string list
1086 * @property: name of the property containing the string list
1088 * the number of strings in the given property
1089 * -FDT_ERR_BADVALUE if the property value is not NUL-terminated
1090 * -FDT_ERR_NOTFOUND if the property does not exist
1092 int fdt_stringlist_count(const void *fdt, int nodeoffset, const char *property);
1095 * fdt_stringlist_search - find a string in a string list and return its index
1098 * @property: name of the property containing the string list
1101 * Note that it is possible for this function to succeed on property values
1102 * that are not NUL-terminated. That's because the function will stop after
1104 * small-valued cell properties, such as #address-cells, when searching for
1109 * -FDT_ERR_BADVALUE if the property value is not NUL-terminated
1110 * -FDT_ERR_NOTFOUND if the property does not exist or does not contain
1113 int fdt_stringlist_search(const void *fdt, int nodeoffset, const char *property,
1117 * fdt_stringlist_get() - obtain the string at a given index in a string list
1120 * @property: name of the property containing the string list
1125 * non-NUL-terminated values. For example on small-valued cell properties
1128 * If non-NULL, the length of the string (on success) or a negative error-code
1134 * location pointed to by the lenp parameter, if non-NULL. On failure one of
1136 * (if non-NULL):
1137 * -FDT_ERR_BADVALUE if the property value is not NUL-terminated
1138 * -FDT_ERR_NOTFOUND if the property does not exist
1140 const char *fdt_stringlist_get(const void *fdt, int nodeoffset,
1141 const char *property, int index,
1142 int *lenp);
1145 /* Read-only functions (addressing related) */
1149 * FDT_MAX_NCELLS - maximum value for #address-cells and #size-cells
1151 * This is the maximum value for #address-cells, #size-cells and
1160 * fdt_address_cells - retrieve address size for a bus represented in the tree
1164 * When the node has a valid #address-cells property, returns its value.
1168 * 2, if the node has no #address-cells property
1169 * -FDT_ERR_BADNCELLS, if the node has a badly formatted or invalid
1170 * #address-cells property
1171 * -FDT_ERR_BADMAGIC,
1172 * -FDT_ERR_BADVERSION,
1173 * -FDT_ERR_BADSTATE,
1174 * -FDT_ERR_BADSTRUCTURE,
1175 * -FDT_ERR_TRUNCATED, standard meanings
1177 int fdt_address_cells(const void *fdt, int nodeoffset);
1180 * fdt_size_cells - retrieve address range size for a bus represented in the
1185 * When the node has a valid #size-cells property, returns its value.
1189 * 1, if the node has no #size-cells property
1190 * -FDT_ERR_BADNCELLS, if the node has a badly formatted or invalid
1191 * #size-cells property
1192 * -FDT_ERR_BADMAGIC,
1193 * -FDT_ERR_BADVERSION,
1194 * -FDT_ERR_BADSTATE,
1195 * -FDT_ERR_BADSTRUCTURE,
1196 * -FDT_ERR_TRUNCATED, standard meanings
1198 int fdt_size_cells(const void *fdt, int nodeoffset);
1202 /* Write-in-place functions */
1206 * fdt_setprop_inplace_namelen_partial - change a property's value,
1209 * @nodeoffset: offset of the node whose property to change
1210 * @name: name of the property to change
1212 * @idx: index of the property to change in the array
1213 * @val: pointer to data to replace the property value with
1214 * @len: length of the property value
1216 * Identical to fdt_setprop_inplace(), but modifies the given property
1222 int fdt_setprop_inplace_namelen_partial(void *fdt, int nodeoffset,
1223 const char *name, int namelen,
1225 int len);
1229 * fdt_setprop_inplace - change a property's value, but not its size
1231 * @nodeoffset: offset of the node whose property to change
1232 * @name: name of the property to change
1233 * @val: pointer to data to replace the property value with
1234 * @len: length of the property value
1236 * fdt_setprop_inplace() replaces the value of a given property with
1238 * size of a property, and so will only work if len is equal to the
1239 * current length of the property.
1242 * the given property value, and will not alter or move any other part
1247 * -FDT_ERR_NOSPACE, if len is not equal to the property's current length
1248 * -FDT_ERR_NOTFOUND, node does not have the named property
1249 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1250 * -FDT_ERR_BADMAGIC,
1251 * -FDT_ERR_BADVERSION,
1252 * -FDT_ERR_BADSTATE,
1253 * -FDT_ERR_BADSTRUCTURE,
1254 * -FDT_ERR_TRUNCATED, standard meanings
1257 int fdt_setprop_inplace(void *fdt, int nodeoffset, const char *name,
1258 const void *val, int len);
1262 * fdt_setprop_inplace_u32 - change the value of a 32-bit integer property
1264 * @nodeoffset: offset of the node whose property to change
1265 * @name: name of the property to change
1266 * @val: 32-bit integer value to replace the property with
1268 * fdt_setprop_inplace_u32() replaces the value of a given property
1269 * with the 32-bit integer value in val, converting val to big-endian
1270 * if necessary. This function cannot change the size of a property,
1271 * and so will only work if the property already exists and has length
1275 * the given property value, and will not alter or move any other part
1280 * -FDT_ERR_NOSPACE, if the property's length is not equal to 4
1281 * -FDT_ERR_NOTFOUND, node does not have the named property
1282 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1283 * -FDT_ERR_BADMAGIC,
1284 * -FDT_ERR_BADVERSION,
1285 * -FDT_ERR_BADSTATE,
1286 * -FDT_ERR_BADSTRUCTURE,
1287 * -FDT_ERR_TRUNCATED, standard meanings
1289 static inline int fdt_setprop_inplace_u32(void *fdt, int nodeoffset, in fdt_setprop_inplace_u32()
1297 * fdt_setprop_inplace_u64 - change the value of a 64-bit integer property
1299 * @nodeoffset: offset of the node whose property to change
1300 * @name: name of the property to change
1301 * @val: 64-bit integer value to replace the property with
1303 * fdt_setprop_inplace_u64() replaces the value of a given property
1304 * with the 64-bit integer value in val, converting val to big-endian
1305 * if necessary. This function cannot change the size of a property,
1306 * and so will only work if the property already exists and has length
1310 * the given property value, and will not alter or move any other part
1315 * -FDT_ERR_NOSPACE, if the property's length is not equal to 8
1316 * -FDT_ERR_NOTFOUND, node does not have the named property
1317 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1318 * -FDT_ERR_BADMAGIC,
1319 * -FDT_ERR_BADVERSION,
1320 * -FDT_ERR_BADSTATE,
1321 * -FDT_ERR_BADSTRUCTURE,
1322 * -FDT_ERR_TRUNCATED, standard meanings
1324 static inline int fdt_setprop_inplace_u64(void *fdt, int nodeoffset, in fdt_setprop_inplace_u64()
1332 * fdt_setprop_inplace_cell - change the value of a single-cell property
1336 static inline int fdt_setprop_inplace_cell(void *fdt, int nodeoffset, in fdt_setprop_inplace_cell()
1343 * fdt_nop_property - replace a property with nop tags
1345 * @nodeoffset: offset of the node whose property to nop
1346 * @name: name of the property to nop
1348 * fdt_nop_property() will replace a given property's representation
1353 * the property, and will not alter or move any other part of the
1358 * -FDT_ERR_NOTFOUND, node does not have the named property
1359 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1360 * -FDT_ERR_BADMAGIC,
1361 * -FDT_ERR_BADVERSION,
1362 * -FDT_ERR_BADSTATE,
1363 * -FDT_ERR_BADSTRUCTURE,
1364 * -FDT_ERR_TRUNCATED, standard meanings
1366 int fdt_nop_property(void *fdt, int nodeoffset, const char *name);
1369 * fdt_nop_node - replace a node (subtree) with nop tags
1383 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1384 * -FDT_ERR_BADMAGIC,
1385 * -FDT_ERR_BADVERSION,
1386 * -FDT_ERR_BADSTATE,
1387 * -FDT_ERR_BADSTRUCTURE,
1388 * -FDT_ERR_TRUNCATED, standard meanings
1390 int fdt_nop_node(void *fdt, int nodeoffset);
1398 /* FDT_CREATE_FLAG_NO_NAME_DEDUP: Do not try to de-duplicate property
1405 * fdt_create_with_flags - begin creation of a new fdt
1417 * -FDT_ERR_NOSPACE, bufsize is insufficient for a minimal fdt
1418 * -FDT_ERR_BADFLAGS, flags is not valid
1420 int fdt_create_with_flags(void *buf, int bufsize, uint32_t flags);
1423 * fdt_create - begin creation of a new fdt
1431 * -FDT_ERR_NOSPACE, bufsize is insufficient for a minimal fdt
1433 int fdt_create(void *buf, int bufsize);
1435 int fdt_resize(void *fdt, void *buf, int bufsize);
1436 int fdt_add_reservemap_entry(void *fdt, uint64_t addr, uint64_t size);
1437 int fdt_finish_reservemap(void *fdt);
1438 int fdt_begin_node(void *fdt, const char *name);
1439 int fdt_property(void *fdt, const char *name, const void *val, int len);
1440 static inline int fdt_property_u32(void *fdt, const char *name, uint32_t val) in fdt_property_u32()
1445 static inline int fdt_property_u64(void *fdt, const char *name, uint64_t val) in fdt_property_u64()
1452 static inline int fdt_property_cell(void *fdt, const char *name, uint32_t val) in fdt_property_cell()
1459 * fdt_property_placeholder - add a new property and return a ptr to its value
1462 * @name: name of property to add
1463 * @len: length of property value in bytes
1468 * -FDT_ERR_BADMAGIC,
1469 * -FDT_ERR_NOSPACE, standard meanings
1471 int fdt_property_placeholder(void *fdt, const char *name, int len, void **valp);
1475 int fdt_end_node(void *fdt);
1476 int fdt_finish(void *fdt);
1479 /* Read-write functions */
1482 int fdt_create_empty_tree(void *buf, int bufsize);
1483 int fdt_open_into(const void *fdt, void *buf, int bufsize);
1484 int fdt_pack(void *fdt);
1487 * fdt_add_mem_rsv - add one memory reserve map entry
1489 * @address, @size: 64-bit values (native endian)
1499 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
1501 * -FDT_ERR_BADMAGIC,
1502 * -FDT_ERR_BADVERSION,
1503 * -FDT_ERR_BADSTATE,
1504 * -FDT_ERR_BADSTRUCTURE,
1505 * -FDT_ERR_BADLAYOUT,
1506 * -FDT_ERR_TRUNCATED, standard meanings
1508 int fdt_add_mem_rsv(void *fdt, uint64_t address, uint64_t size);
1511 * fdt_del_mem_rsv - remove a memory reserve map entry
1515 * fdt_del_mem_rsv() removes the n-th memory reserve map entry from
1523 * -FDT_ERR_NOTFOUND, there is no entry of the given index (i.e. there
1525 * -FDT_ERR_BADMAGIC,
1526 * -FDT_ERR_BADVERSION,
1527 * -FDT_ERR_BADSTATE,
1528 * -FDT_ERR_BADSTRUCTURE,
1529 * -FDT_ERR_BADLAYOUT,
1530 * -FDT_ERR_TRUNCATED, standard meanings
1532 int fdt_del_mem_rsv(void *fdt, int n);
1535 * fdt_set_name - change the name of a given node
1551 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob
1553 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1554 * -FDT_ERR_BADMAGIC,
1555 * -FDT_ERR_BADVERSION,
1556 * -FDT_ERR_BADSTATE, standard meanings
1558 int fdt_set_name(void *fdt, int nodeoffset, const char *name);
1561 * fdt_setprop - create or change a property
1563 * @nodeoffset: offset of the node whose property to change
1564 * @name: name of the property to change
1565 * @val: pointer to data to set the property value to
1566 * @len: length of the property value
1568 * fdt_setprop() sets the value of the named property in the given
1569 * node to the given value and length, creating the property if it
1577 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
1578 * contain the new property value
1579 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1580 * -FDT_ERR_BADLAYOUT,
1581 * -FDT_ERR_BADMAGIC,
1582 * -FDT_ERR_BADVERSION,
1583 * -FDT_ERR_BADSTATE,
1584 * -FDT_ERR_BADSTRUCTURE,
1585 * -FDT_ERR_BADLAYOUT,
1586 * -FDT_ERR_TRUNCATED, standard meanings
1588 int fdt_setprop(void *fdt, int nodeoffset, const char *name,
1589 const void *val, int len);
1592 * fdt_setprop_placeholder - allocate space for a property
1594 * @nodeoffset: offset of the node whose property to change
1595 * @name: name of the property to change
1596 * @len: length of the property value
1597 * @prop_data: return pointer to property data
1599 * fdt_setprop_placeholer() allocates the named property in the given node.
1600 * If the property exists it is resized. In either case a pointer to the
1601 * property data is returned.
1608 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
1609 * contain the new property value
1610 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1611 * -FDT_ERR_BADLAYOUT,
1612 * -FDT_ERR_BADMAGIC,
1613 * -FDT_ERR_BADVERSION,
1614 * -FDT_ERR_BADSTATE,
1615 * -FDT_ERR_BADSTRUCTURE,
1616 * -FDT_ERR_BADLAYOUT,
1617 * -FDT_ERR_TRUNCATED, standard meanings
1619 int fdt_setprop_placeholder(void *fdt, int nodeoffset, const char *name,
1620 int len, void **prop_data);
1623 * fdt_setprop_u32 - set a property to a 32-bit integer
1625 * @nodeoffset: offset of the node whose property to change
1626 * @name: name of the property to change
1627 * @val: 32-bit integer value for the property (native endian)
1629 * fdt_setprop_u32() sets the value of the named property in the given
1630 * node to the given 32-bit integer value (converting to big-endian if
1631 * necessary), or creates a new property with that value if it does
1639 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
1640 * contain the new property value
1641 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1642 * -FDT_ERR_BADLAYOUT,
1643 * -FDT_ERR_BADMAGIC,
1644 * -FDT_ERR_BADVERSION,
1645 * -FDT_ERR_BADSTATE,
1646 * -FDT_ERR_BADSTRUCTURE,
1647 * -FDT_ERR_BADLAYOUT,
1648 * -FDT_ERR_TRUNCATED, standard meanings
1650 static inline int fdt_setprop_u32(void *fdt, int nodeoffset, const char *name, in fdt_setprop_u32()
1658 * fdt_setprop_u64 - set a property to a 64-bit integer
1660 * @nodeoffset: offset of the node whose property to change
1661 * @name: name of the property to change
1662 * @val: 64-bit integer value for the property (native endian)
1664 * fdt_setprop_u64() sets the value of the named property in the given
1665 * node to the given 64-bit integer value (converting to big-endian if
1666 * necessary), or creates a new property with that value if it does
1674 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
1675 * contain the new property value
1676 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1677 * -FDT_ERR_BADLAYOUT,
1678 * -FDT_ERR_BADMAGIC,
1679 * -FDT_ERR_BADVERSION,
1680 * -FDT_ERR_BADSTATE,
1681 * -FDT_ERR_BADSTRUCTURE,
1682 * -FDT_ERR_BADLAYOUT,
1683 * -FDT_ERR_TRUNCATED, standard meanings
1685 static inline int fdt_setprop_u64(void *fdt, int nodeoffset, const char *name, in fdt_setprop_u64()
1693 * fdt_setprop_cell - set a property to a single cell value
1697 static inline int fdt_setprop_cell(void *fdt, int nodeoffset, const char *name, in fdt_setprop_cell()
1704 * fdt_setprop_string - set a property to a string value
1706 * @nodeoffset: offset of the node whose property to change
1707 * @name: name of the property to change
1708 * @str: string value for the property
1710 * fdt_setprop_string() sets the value of the named property in the
1712 * string to determine the new length of the property), or creates a
1713 * new property with that value if it does not already exist.
1720 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
1721 * contain the new property value
1722 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1723 * -FDT_ERR_BADLAYOUT,
1724 * -FDT_ERR_BADMAGIC,
1725 * -FDT_ERR_BADVERSION,
1726 * -FDT_ERR_BADSTATE,
1727 * -FDT_ERR_BADSTRUCTURE,
1728 * -FDT_ERR_BADLAYOUT,
1729 * -FDT_ERR_TRUNCATED, standard meanings
1736 * fdt_setprop_empty - set a property to an empty value
1738 * @nodeoffset: offset of the node whose property to change
1739 * @name: name of the property to change
1741 * fdt_setprop_empty() sets the value of the named property in the
1743 * property if it does not already exist.
1750 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
1751 * contain the new property value
1752 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1753 * -FDT_ERR_BADLAYOUT,
1754 * -FDT_ERR_BADMAGIC,
1755 * -FDT_ERR_BADVERSION,
1756 * -FDT_ERR_BADSTATE,
1757 * -FDT_ERR_BADSTRUCTURE,
1758 * -FDT_ERR_BADLAYOUT,
1759 * -FDT_ERR_TRUNCATED, standard meanings
1765 * fdt_appendprop - append to or create a property
1767 * @nodeoffset: offset of the node whose property to change
1768 * @name: name of the property to append to
1769 * @val: pointer to data to append to the property value
1770 * @len: length of the data to append to the property value
1772 * fdt_appendprop() appends the value to the named property in the
1773 * given node, creating the property if it does not already exist.
1780 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
1781 * contain the new property value
1782 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1783 * -FDT_ERR_BADLAYOUT,
1784 * -FDT_ERR_BADMAGIC,
1785 * -FDT_ERR_BADVERSION,
1786 * -FDT_ERR_BADSTATE,
1787 * -FDT_ERR_BADSTRUCTURE,
1788 * -FDT_ERR_BADLAYOUT,
1789 * -FDT_ERR_TRUNCATED, standard meanings
1791 int fdt_appendprop(void *fdt, int nodeoffset, const char *name,
1792 const void *val, int len);
1795 * fdt_appendprop_u32 - append a 32-bit integer value to a property
1797 * @nodeoffset: offset of the node whose property to change
1798 * @name: name of the property to change
1799 * @val: 32-bit integer value to append to the property (native endian)
1801 * fdt_appendprop_u32() appends the given 32-bit integer value
1802 * (converting to big-endian if necessary) to the value of the named
1803 * property in the given node, or creates a new property with that
1811 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
1812 * contain the new property value
1813 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1814 * -FDT_ERR_BADLAYOUT,
1815 * -FDT_ERR_BADMAGIC,
1816 * -FDT_ERR_BADVERSION,
1817 * -FDT_ERR_BADSTATE,
1818 * -FDT_ERR_BADSTRUCTURE,
1819 * -FDT_ERR_BADLAYOUT,
1820 * -FDT_ERR_TRUNCATED, standard meanings
1822 static inline int fdt_appendprop_u32(void *fdt, int nodeoffset, in fdt_appendprop_u32()
1830 * fdt_appendprop_u64 - append a 64-bit integer value to a property
1832 * @nodeoffset: offset of the node whose property to change
1833 * @name: name of the property to change
1834 * @val: 64-bit integer value to append to the property (native endian)
1836 * fdt_appendprop_u64() appends the given 64-bit integer value
1837 * (converting to big-endian if necessary) to the value of the named
1838 * property in the given node, or creates a new property with that
1846 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
1847 * contain the new property value
1848 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1849 * -FDT_ERR_BADLAYOUT,
1850 * -FDT_ERR_BADMAGIC,
1851 * -FDT_ERR_BADVERSION,
1852 * -FDT_ERR_BADSTATE,
1853 * -FDT_ERR_BADSTRUCTURE,
1854 * -FDT_ERR_BADLAYOUT,
1855 * -FDT_ERR_TRUNCATED, standard meanings
1857 static inline int fdt_appendprop_u64(void *fdt, int nodeoffset, in fdt_appendprop_u64()
1865 * fdt_appendprop_cell - append a single cell value to a property
1869 static inline int fdt_appendprop_cell(void *fdt, int nodeoffset, in fdt_appendprop_cell()
1876 * fdt_appendprop_string - append a string to a property
1878 * @nodeoffset: offset of the node whose property to change
1879 * @name: name of the property to change
1880 * @str: string value to append to the property
1883 * the named property in the given node, or creates a new property
1891 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
1892 * contain the new property value
1893 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1894 * -FDT_ERR_BADLAYOUT,
1895 * -FDT_ERR_BADMAGIC,
1896 * -FDT_ERR_BADVERSION,
1897 * -FDT_ERR_BADSTATE,
1898 * -FDT_ERR_BADSTRUCTURE,
1899 * -FDT_ERR_BADLAYOUT,
1900 * -FDT_ERR_TRUNCATED, standard meanings
1906 * fdt_appendprop_addrrange - append a address range property
1909 * @nodeoffset: offset of the node to add a property at
1910 * @name: name of property
1915 * address and size) to the value of the named property in the given
1916 * node, or creates a new property with that value if it does not
1919 * Cell sizes are determined by parent's #address-cells and #size-cells.
1926 * -FDT_ERR_BADLAYOUT,
1927 * -FDT_ERR_BADMAGIC,
1928 * -FDT_ERR_BADNCELLS, if the node has a badly formatted or invalid
1929 * #address-cells property
1930 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1931 * -FDT_ERR_BADSTATE,
1932 * -FDT_ERR_BADSTRUCTURE,
1933 * -FDT_ERR_BADVERSION,
1934 * -FDT_ERR_BADVALUE, addr or size doesn't fit to respective cells size
1935 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
1936 * contain a new property
1937 * -FDT_ERR_TRUNCATED, standard meanings
1939 int fdt_appendprop_addrrange(void *fdt, int parent, int nodeoffset,
1943 * fdt_delprop - delete a property
1945 * @nodeoffset: offset of the node whose property to nop
1946 * @name: name of the property to nop
1948 * fdt_del_property() will delete the given property.
1955 * -FDT_ERR_NOTFOUND, node does not have the named property
1956 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1957 * -FDT_ERR_BADLAYOUT,
1958 * -FDT_ERR_BADMAGIC,
1959 * -FDT_ERR_BADVERSION,
1960 * -FDT_ERR_BADSTATE,
1961 * -FDT_ERR_BADSTRUCTURE,
1962 * -FDT_ERR_TRUNCATED, standard meanings
1964 int fdt_delprop(void *fdt, int nodeoffset, const char *name);
1967 * fdt_add_subnode_namelen - creates a new node based on substring
1979 int fdt_add_subnode_namelen(void *fdt, int parentoffset,
1980 const char *name, int namelen);
1984 * fdt_add_subnode - creates a new node
1999 * -FDT_ERR_NOTFOUND, if the requested subnode does not exist
2000 * -FDT_ERR_BADOFFSET, if parentoffset did not point to an FDT_BEGIN_NODE
2002 * -FDT_ERR_EXISTS, if the node at parentoffset already has a subnode of
2004 * -FDT_ERR_NOSPACE, if there is insufficient free space in the
2006 * -FDT_ERR_NOSPACE
2007 * -FDT_ERR_BADLAYOUT
2008 * -FDT_ERR_BADMAGIC,
2009 * -FDT_ERR_BADVERSION,
2010 * -FDT_ERR_BADSTATE,
2011 * -FDT_ERR_BADSTRUCTURE,
2012 * -FDT_ERR_TRUNCATED, standard meanings.
2014 int fdt_add_subnode(void *fdt, int parentoffset, const char *name);
2017 * fdt_del_node - delete a node (subtree)
2029 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
2030 * -FDT_ERR_BADLAYOUT,
2031 * -FDT_ERR_BADMAGIC,
2032 * -FDT_ERR_BADVERSION,
2033 * -FDT_ERR_BADSTATE,
2034 * -FDT_ERR_BADSTRUCTURE,
2035 * -FDT_ERR_TRUNCATED, standard meanings
2037 int fdt_del_node(void *fdt, int nodeoffset);
2040 * fdt_overlay_apply - Applies a DT overlay on a base DT
2052 * -FDT_ERR_NOSPACE, there's not enough space in the base device tree
2053 * -FDT_ERR_NOTFOUND, the overlay points to some inexistant nodes or
2055 * -FDT_ERR_BADPHANDLE,
2056 * -FDT_ERR_BADOVERLAY,
2057 * -FDT_ERR_NOPHANDLES,
2058 * -FDT_ERR_INTERNAL,
2059 * -FDT_ERR_BADLAYOUT,
2060 * -FDT_ERR_BADMAGIC,
2061 * -FDT_ERR_BADOFFSET,
2062 * -FDT_ERR_BADPATH,
2063 * -FDT_ERR_BADVERSION,
2064 * -FDT_ERR_BADSTRUCTURE,
2065 * -FDT_ERR_BADSTATE,
2066 * -FDT_ERR_TRUNCATED, standard meanings
2068 int fdt_overlay_apply(void *fdt, void *fdto);
2074 const char *fdt_strerror(int errval);