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
22 /* FDT_ERR_NOTFOUND: The requested node or property does not exist */
24 /* FDT_ERR_EXISTS: Attempted to create a node or property which
35 * offset which is out-of-bounds, or which points to an
43 * This can be caused either by an invalid phandle property
44 * length, or the phandle value was either 0 or -1, which are
48 * tree created by the sequential-write functions, which is
53 /* FDT_ERR_TRUNCATED: FDT or a sub-block is improperly
58 * device tree at all - it is missing the flattened device
63 * read-write functions, this may mean that fdt_open_into() is
70 /* FDT_ERR_BADLAYOUT: For read-write functions, the given
71 * device tree has it's sub-blocks in an order that the
74 * into a form suitable for the read-write operations. */
84 /* FDT_ERR_BADNCELLS: Device tree has a #address-cells, #size-cells
85 * or similar property with a bad format or value */
88 /* FDT_ERR_BADVALUE: Device tree has a property with an unexpected
89 * value. For example: a property expected to contain a string list
90 * is not NUL-terminated within the length of its value. */
95 * unexpected or missing value, property or node. */
106 /* FDT_ERR_ALIGNMENT: The device tree base address is not 8-byte
113 /* Valid values for phandles range from 1 to 2^32-2. */
116 /* Low-level functions (you probably don't need these) */
120 const void *fdt_offset_ptr(const void *fdt, int offset, unsigned int checklen);
122 static inline void *fdt_offset_ptr_w(void *fdt, int offset, int checklen) in fdt_offset_ptr_w()
127 uint32_t fdt_next_tag(const void *fdt, int offset, int *nextoffset);
151 static inline void fdt32_st(void *property, uint32_t value) in fdt32_st() argument
153 uint8_t *bp = (uint8_t *)property; in fdt32_st()
175 static inline void fdt64_st(void *property, uint64_t value) in fdt64_st() argument
177 uint8_t *bp = (uint8_t *)property; in fdt64_st()
193 int fdt_next_node(const void *fdt, int offset, int *depth);
196 * fdt_first_subnode() - get offset of first direct subnode
200 * Return: offset of first subnode, or -FDT_ERR_NOTFOUND if there is none
202 int fdt_first_subnode(const void *fdt, int offset);
205 * fdt_next_subnode() - get offset of next direct subnode
212 * Return: offset of next subnode, or -FDT_ERR_NOTFOUND if there are no more
215 int fdt_next_subnode(const void *fdt, int offset);
218 * fdt_for_each_subnode - iterate over all subnodes of a parent
220 * @node: child node (int, lvalue)
222 * @parent: parent node (int)
231 * if ((node < 0) && (node != -FDT_ERR_NOTFOUND)) {
248 (fdt32_ld(&((const struct fdt_header *)(fdt))->field))
264 fdth->name = cpu_to_fdt32(val); \
279 * fdt_header_size - return the size of the tree's header
287 * fdt_header_size_ - internal function to get header size from a version number
295 * fdt_check_header - sanity check a device tree header
305 * -FDT_ERR_BADMAGIC,
306 * -FDT_ERR_BADVERSION,
307 * -FDT_ERR_BADSTATE,
308 * -FDT_ERR_TRUNCATED, standard meanings, as above
310 int fdt_check_header(const void *fdt);
313 * fdt_move - move a device tree around in memory
326 * -FDT_ERR_NOSPACE, bufsize is insufficient to contain the device tree
327 * -FDT_ERR_BADMAGIC,
328 * -FDT_ERR_BADVERSION,
329 * -FDT_ERR_BADSTATE, standard meanings
331 int fdt_move(const void *fdt, void *buf, int bufsize);
334 /* Read-only functions */
337 int fdt_check_full(const void *fdt, size_t bufsize);
340 * fdt_get_string - retrieve a string from the strings block of a device tree
353 const char *fdt_get_string(const void *fdt, int stroffset, int *lenp);
356 * fdt_string - retrieve a string from the strings block of a device tree
367 const char *fdt_string(const void *fdt, int stroffset);
370 * fdt_find_max_phandle - find and return the highest phandle in a tree
381 int fdt_find_max_phandle(const void *fdt, uint32_t *phandle);
384 * fdt_get_max_phandle - retrieves the highest phandle in a tree
389 * with a value of 0 or -1.
396 * -1, if an error occurred
401 int err; in fdt_get_max_phandle()
405 return (uint32_t)-1; in fdt_get_max_phandle()
411 * fdt_generate_phandle - return a new, unused phandle for a device tree blob
420 * Return: 0 on success or a negative error-code on failure
422 int fdt_generate_phandle(const void *fdt, uint32_t *phandle);
425 * fdt_num_mem_rsv - retrieve the number of memory reserve map entries
435 int fdt_num_mem_rsv(const void *fdt);
438 * fdt_get_mem_rsv - retrieve one memory reserve map entry
441 * @address: pointer to 64-bit variable to hold the start address
442 * @size: pointer to 64-bit variable to hold the size of the entry
445 * the n-th reserve map entry from the device tree blob, in
446 * native-endian format.
450 * -FDT_ERR_BADMAGIC,
451 * -FDT_ERR_BADVERSION,
452 * -FDT_ERR_BADSTATE, standard meanings
454 int fdt_get_mem_rsv(const void *fdt, int n, uint64_t *address, uint64_t *size);
457 * fdt_subnode_offset_namelen - find a subnode based on substring
468 * Return: offset of the subnode or -FDT_ERR_NOTFOUND if name not found.
471 int fdt_subnode_offset_namelen(const void *fdt, int parentoffset,
472 const char *name, int namelen);
475 * fdt_subnode_offset - find a subnode of a given node
489 * -FDT_ERR_NOTFOUND, if the requested subnode does not exist
490 * -FDT_ERR_BADOFFSET, if parentoffset did not point to an FDT_BEGIN_NODE
492 * -FDT_ERR_BADMAGIC,
493 * -FDT_ERR_BADVERSION,
494 * -FDT_ERR_BADSTATE,
495 * -FDT_ERR_BADSTRUCTURE,
496 * -FDT_ERR_TRUNCATED, standard meanings.
498 int fdt_subnode_offset(const void *fdt, int parentoffset, const char *name);
501 * fdt_path_offset_namelen - find a tree node by its full path
512 int fdt_path_offset_namelen(const void *fdt, const char *path, int namelen);
516 * fdt_path_offset - find a tree node by its full path
530 * -FDT_ERR_BADPATH, given path does not begin with '/' or is invalid
531 * -FDT_ERR_NOTFOUND, if the requested node does not exist
532 * -FDT_ERR_BADMAGIC,
533 * -FDT_ERR_BADVERSION,
534 * -FDT_ERR_BADSTATE,
535 * -FDT_ERR_BADSTRUCTURE,
536 * -FDT_ERR_TRUNCATED, standard meanings.
538 int fdt_path_offset(const void *fdt, const char *path);
541 * fdt_get_name - retrieve the name of a given node
548 * non-NULL, the length of this name is also returned, in the integer
553 * If lenp is non-NULL, *lenp contains the length of that name
556 * if lenp is non-NULL *lenp contains an error code (<0):
557 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE
559 * -FDT_ERR_BADMAGIC,
560 * -FDT_ERR_BADVERSION,
561 * -FDT_ERR_BADSTATE, standard meanings
563 const char *fdt_get_name(const void *fdt, int nodeoffset, int *lenp);
566 * fdt_first_property_offset - find the offset of a node's first property
570 * fdt_first_property_offset() finds the first property of the node at
574 * structure block offset of the property (>=0), on success
575 * -FDT_ERR_NOTFOUND, if the requested node has no properties
576 * -FDT_ERR_BADOFFSET, if nodeoffset did not point to an FDT_BEGIN_NODE tag
577 * -FDT_ERR_BADMAGIC,
578 * -FDT_ERR_BADVERSION,
579 * -FDT_ERR_BADSTATE,
580 * -FDT_ERR_BADSTRUCTURE,
581 * -FDT_ERR_TRUNCATED, standard meanings.
583 int fdt_first_property_offset(const void *fdt, int nodeoffset);
586 * fdt_next_property_offset - step through a node's properties
588 * @offset: structure block offset of a property
590 * fdt_next_property_offset() finds the property immediately after the
591 * one at the given structure block offset. This will be a property
592 * of the same node as the given property.
595 * structure block offset of the next property (>=0), on success
596 * -FDT_ERR_NOTFOUND, if the given property is the last in its node
597 * -FDT_ERR_BADOFFSET, if nodeoffset did not point to an FDT_PROP tag
598 * -FDT_ERR_BADMAGIC,
599 * -FDT_ERR_BADVERSION,
600 * -FDT_ERR_BADSTATE,
601 * -FDT_ERR_BADSTRUCTURE,
602 * -FDT_ERR_TRUNCATED, standard meanings.
604 int fdt_next_property_offset(const void *fdt, int offset);
607 * fdt_for_each_property_offset - iterate over all properties of a node
609 * @property: property offset (int, lvalue)
611 * @node: node offset (int)
615 * fdt_for_each_property_offset(property, fdt, node) {
616 * Use property
620 * if ((property < 0) && (property != -FDT_ERR_NOTFOUND)) {
624 * Note that this is implemented as a macro and property is used as
628 #define fdt_for_each_property_offset(property, fdt, node) \ argument
629 for (property = fdt_first_property_offset(fdt, node); \
630 property >= 0; \
631 property = fdt_next_property_offset(fdt, property))
634 * fdt_get_property_by_offset - retrieve the property at a given offset
636 * @offset: offset of the property to retrieve
641 * offset. If lenp is non-NULL, the length of the property value is
648 * pointer to the structure representing the property
649 * if lenp is non-NULL, *lenp contains the length of the property
652 * if lenp is non-NULL, *lenp contains an error code (<0):
653 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_PROP tag
654 * -FDT_ERR_BADMAGIC,
655 * -FDT_ERR_BADVERSION,
656 * -FDT_ERR_BADSTATE,
657 * -FDT_ERR_BADSTRUCTURE,
658 * -FDT_ERR_TRUNCATED, standard meanings
661 int offset,
662 int *lenp);
664 int offset, in fdt_get_property_by_offset_w()
665 int *lenp) in fdt_get_property_by_offset_w()
672 * fdt_get_property_namelen - find a property based on substring
674 * @nodeoffset: offset of the node whose property to find
675 * @name: name of the property to find
680 * characters of name for matching the property name.
682 * Return: pointer to the structure representing the property, or NULL
687 int nodeoffset,
689 int namelen, int *lenp);
693 * fdt_get_property - find a given property in a given node
695 * @nodeoffset: offset of the node whose property to find
696 * @name: name of the property to find
700 * structure within the device tree blob corresponding to the property
702 * non-NULL, the length of the property value is also returned, in the
706 * pointer to the structure representing the property
707 * if lenp is non-NULL, *lenp contains the length of the property
710 * if lenp is non-NULL, *lenp contains an error code (<0):
711 * -FDT_ERR_NOTFOUND, node does not have named property
712 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE
714 * -FDT_ERR_BADMAGIC,
715 * -FDT_ERR_BADVERSION,
716 * -FDT_ERR_BADSTATE,
717 * -FDT_ERR_BADSTRUCTURE,
718 * -FDT_ERR_TRUNCATED, standard meanings
720 const struct fdt_property *fdt_get_property(const void *fdt, int nodeoffset,
721 const char *name, int *lenp);
722 static inline struct fdt_property *fdt_get_property_w(void *fdt, int nodeoffset, in fdt_get_property_w()
724 int *lenp) in fdt_get_property_w()
731 * fdt_getprop_by_offset - retrieve the value of a property at a given offset
733 * @offset: offset of the property to read
738 * property at structure block offset 'offset' (this will be a pointer
740 * lenp is non-NULL, the length of the property value is also
741 * returned, in the integer pointed to by lenp. If namep is non-NULL,
742 * the property's namne will also be returned in the char * pointed to
747 * pointer to the property's value
748 * if lenp is non-NULL, *lenp contains the length of the property
750 * if namep is non-NULL *namep contiains a pointer to the property
753 * if lenp is non-NULL, *lenp contains an error code (<0):
754 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_PROP tag
755 * -FDT_ERR_BADMAGIC,
756 * -FDT_ERR_BADVERSION,
757 * -FDT_ERR_BADSTATE,
758 * -FDT_ERR_BADSTRUCTURE,
759 * -FDT_ERR_TRUNCATED, standard meanings
762 const void *fdt_getprop_by_offset(const void *fdt, int offset,
763 const char **namep, int *lenp);
767 * fdt_getprop_namelen - get property value based on substring
769 * @nodeoffset: offset of the node whose property to find
770 * @name: name of the property to find
775 * characters of name for matching the property name.
777 * Return: pointer to the property's value or NULL on error
780 const void *fdt_getprop_namelen(const void *fdt, int nodeoffset,
781 const char *name, int namelen, int *lenp);
782 static inline void *fdt_getprop_namelen_w(void *fdt, int nodeoffset, in fdt_getprop_namelen_w()
783 const char *name, int namelen, in fdt_getprop_namelen_w()
784 int *lenp) in fdt_getprop_namelen_w()
792 * fdt_getprop - retrieve the value of a given property
794 * @nodeoffset: offset of the node whose property to find
795 * @name: name of the property to find
798 * fdt_getprop() retrieves a pointer to the value of the property
801 * If @lenp is non-NULL, the length of the property value is also
805 * pointer to the property's value
806 * if lenp is non-NULL, *lenp contains the length of the property
809 * if lenp is non-NULL, *lenp contains an error code (<0):
810 * -FDT_ERR_NOTFOUND, node does not have named property
811 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE
813 * -FDT_ERR_BADMAGIC,
814 * -FDT_ERR_BADVERSION,
815 * -FDT_ERR_BADSTATE,
816 * -FDT_ERR_BADSTRUCTURE,
817 * -FDT_ERR_TRUNCATED, standard meanings
819 const void *fdt_getprop(const void *fdt, int nodeoffset,
820 const char *name, int *lenp);
821 static inline void *fdt_getprop_w(void *fdt, int nodeoffset, in fdt_getprop_w()
822 const char *name, int *lenp) in fdt_getprop_w()
828 * fdt_get_phandle - retrieve the phandle of a given node
836 * the phandle of the node at nodeoffset, on success (!= 0, != -1)
839 uint32_t fdt_get_phandle(const void *fdt, int nodeoffset);
842 * fdt_get_alias_namelen - get alias based on substring
855 const char *name, int namelen);
859 * fdt_get_alias - retrieve the path referenced by a given alias
864 * value of the property named @name in the node /aliases.
873 * fdt_get_path - determine the full path of a node
888 * nodeoffset, as a NUL-terminated string.
889 * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
890 * -FDT_ERR_NOSPACE, the path of the given node is longer than (bufsize-1)
892 * -FDT_ERR_BADMAGIC,
893 * -FDT_ERR_BADVERSION,
894 * -FDT_ERR_BADSTATE,
895 * -FDT_ERR_BADSTRUCTURE, standard meanings
897 int fdt_get_path(const void *fdt, int nodeoffset, char *buf, int buflen);
900 * fdt_supernode_atdepth_offset - find a specific ancestor of a node
921 * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
922 * -FDT_ERR_NOTFOUND, supernodedepth was greater than the depth of
924 * -FDT_ERR_BADMAGIC,
925 * -FDT_ERR_BADVERSION,
926 * -FDT_ERR_BADSTATE,
927 * -FDT_ERR_BADSTRUCTURE, standard meanings
929 int fdt_supernode_atdepth_offset(const void *fdt, int nodeoffset,
930 int supernodedepth, int *nodedepth);
933 * fdt_node_depth - find the depth of a given node
945 * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
946 * -FDT_ERR_BADMAGIC,
947 * -FDT_ERR_BADVERSION,
948 * -FDT_ERR_BADSTATE,
949 * -FDT_ERR_BADSTRUCTURE, standard meanings
951 int fdt_node_depth(const void *fdt, int nodeoffset);
954 * fdt_parent_offset - find the parent of a given node
968 * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
969 * -FDT_ERR_BADMAGIC,
970 * -FDT_ERR_BADVERSION,
971 * -FDT_ERR_BADSTATE,
972 * -FDT_ERR_BADSTRUCTURE, standard meanings
974 int fdt_parent_offset(const void *fdt, int nodeoffset);
977 * fdt_node_offset_by_prop_value - find nodes with a given property value
980 * @propname: property name to check
981 * @propval: property value to search for
985 * node after startoffset, which has a property named propname whose
987 * startoffset is -1, the very first such node in the tree.
991 * offset = fdt_node_offset_by_prop_value(fdt, -1, propname,
993 * while (offset != -FDT_ERR_NOTFOUND) {
999 * Note the -1 in the first call to the function, if 0 is used here
1006 * -FDT_ERR_NOTFOUND, no node matching the criterion exists in the
1008 * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
1009 * -FDT_ERR_BADMAGIC,
1010 * -FDT_ERR_BADVERSION,
1011 * -FDT_ERR_BADSTATE,
1012 * -FDT_ERR_BADSTRUCTURE, standard meanings
1014 int fdt_node_offset_by_prop_value(const void *fdt, int startoffset,
1016 const void *propval, int proplen);
1019 * fdt_node_offset_by_phandle - find the node with a given phandle
1030 * -FDT_ERR_NOTFOUND, no node with that phandle exists
1031 * -FDT_ERR_BADPHANDLE, given phandle value was invalid (0 or -1)
1032 * -FDT_ERR_BADMAGIC,
1033 * -FDT_ERR_BADVERSION,
1034 * -FDT_ERR_BADSTATE,
1035 * -FDT_ERR_BADSTRUCTURE, standard meanings
1037 int fdt_node_offset_by_phandle(const void *fdt, uint32_t phandle);
1040 * fdt_node_check_compatible - check a node's compatible property
1046 * @compatible property with the given string as one of its elements,
1047 * it returns non-zero otherwise, or on error.
1050 * 0, if the node has a 'compatible' property listing the given string
1051 * 1, if the node has a 'compatible' property, but it does not list
1053 * -FDT_ERR_NOTFOUND, if the given node has no 'compatible' property
1054 * -FDT_ERR_BADOFFSET, if nodeoffset does not refer to a BEGIN_NODE tag
1055 * -FDT_ERR_BADMAGIC,
1056 * -FDT_ERR_BADVERSION,
1057 * -FDT_ERR_BADSTATE,
1058 * -FDT_ERR_BADSTRUCTURE, standard meanings
1060 int fdt_node_check_compatible(const void *fdt, int nodeoffset,
1064 * fdt_node_offset_by_compatible - find nodes with a given 'compatible' value
1070 * node after startoffset, which has a 'compatible' property which
1071 * lists the given compatible string; or if startoffset is -1, the
1076 * offset = fdt_node_offset_by_compatible(fdt, -1, compatible);
1077 * while (offset != -FDT_ERR_NOTFOUND) {
1082 * Note the -1 in the first call to the function, if 0 is used here
1089 * -FDT_ERR_NOTFOUND, no node matching the criterion exists in the
1091 * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
1092 * -FDT_ERR_BADMAGIC,
1093 * -FDT_ERR_BADVERSION,
1094 * -FDT_ERR_BADSTATE,
1095 * -FDT_ERR_BADSTRUCTURE, standard meanings
1097 int fdt_node_offset_by_compatible(const void *fdt, int startoffset,
1101 * fdt_stringlist_contains - check a string list property for a string
1102 * @strlist: Property containing a list of strings to check
1103 * @listlen: Length of property
1108 * "compatible" property.
1112 int fdt_stringlist_contains(const char *strlist, int listlen, const char *str);
1115 * fdt_stringlist_count - count the number of strings in a string list
1118 * @property: name of the property containing the string list
1121 * the number of strings in the given property
1122 * -FDT_ERR_BADVALUE if the property value is not NUL-terminated
1123 * -FDT_ERR_NOTFOUND if the property does not exist
1125 int fdt_stringlist_count(const void *fdt, int nodeoffset, const char *property);
1128 * fdt_stringlist_search - find a string in a string list and return its index
1131 * @property: name of the property containing the string list
1134 * Note that it is possible for this function to succeed on property values
1135 * that are not NUL-terminated. That's because the function will stop after
1137 * small-valued cell properties, such as #address-cells, when searching for
1142 * -FDT_ERR_BADVALUE if the property value is not NUL-terminated
1143 * -FDT_ERR_NOTFOUND if the property does not exist or does not contain
1146 int fdt_stringlist_search(const void *fdt, int nodeoffset, const char *property,
1150 * fdt_stringlist_get() - obtain the string at a given index in a string list
1153 * @property: name of the property containing the string list
1158 * non-NUL-terminated values. For example on small-valued cell properties
1161 * If non-NULL, the length of the string (on success) or a negative error-code
1167 * location pointed to by the lenp parameter, if non-NULL. On failure one of
1169 * (if non-NULL):
1170 * -FDT_ERR_BADVALUE if the property value is not NUL-terminated
1171 * -FDT_ERR_NOTFOUND if the property does not exist
1173 const char *fdt_stringlist_get(const void *fdt, int nodeoffset,
1174 const char *property, int index,
1175 int *lenp);
1178 /* Read-only functions (addressing related) */
1182 * FDT_MAX_NCELLS - maximum value for #address-cells and #size-cells
1184 * This is the maximum value for #address-cells, #size-cells and
1193 * fdt_address_cells - retrieve address size for a bus represented in the tree
1197 * When the node has a valid #address-cells property, returns its value.
1201 * 2, if the node has no #address-cells property
1202 * -FDT_ERR_BADNCELLS, if the node has a badly formatted or invalid
1203 * #address-cells property
1204 * -FDT_ERR_BADMAGIC,
1205 * -FDT_ERR_BADVERSION,
1206 * -FDT_ERR_BADSTATE,
1207 * -FDT_ERR_BADSTRUCTURE,
1208 * -FDT_ERR_TRUNCATED, standard meanings
1210 int fdt_address_cells(const void *fdt, int nodeoffset);
1213 * fdt_size_cells - retrieve address range size for a bus represented in the
1218 * When the node has a valid #size-cells property, returns its value.
1222 * 1, if the node has no #size-cells property
1223 * -FDT_ERR_BADNCELLS, if the node has a badly formatted or invalid
1224 * #size-cells property
1225 * -FDT_ERR_BADMAGIC,
1226 * -FDT_ERR_BADVERSION,
1227 * -FDT_ERR_BADSTATE,
1228 * -FDT_ERR_BADSTRUCTURE,
1229 * -FDT_ERR_TRUNCATED, standard meanings
1231 int fdt_size_cells(const void *fdt, int nodeoffset);
1235 /* Write-in-place functions */
1239 * fdt_setprop_inplace_namelen_partial - change a property's value,
1242 * @nodeoffset: offset of the node whose property to change
1243 * @name: name of the property to change
1245 * @idx: index of the property to change in the array
1246 * @val: pointer to data to replace the property value with
1247 * @len: length of the property value
1249 * Identical to fdt_setprop_inplace(), but modifies the given property
1257 int fdt_setprop_inplace_namelen_partial(void *fdt, int nodeoffset,
1258 const char *name, int namelen,
1260 int len);
1264 * fdt_setprop_inplace - change a property's value, but not its size
1266 * @nodeoffset: offset of the node whose property to change
1267 * @name: name of the property to change
1268 * @val: pointer to data to replace the property value with
1269 * @len: length of the property value
1271 * fdt_setprop_inplace() replaces the value of a given property with
1273 * size of a property, and so will only work if len is equal to the
1274 * current length of the property.
1277 * the given property value, and will not alter or move any other part
1282 * -FDT_ERR_NOSPACE, if len is not equal to the property's current length
1283 * -FDT_ERR_NOTFOUND, node does not have the named property
1284 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1285 * -FDT_ERR_BADMAGIC,
1286 * -FDT_ERR_BADVERSION,
1287 * -FDT_ERR_BADSTATE,
1288 * -FDT_ERR_BADSTRUCTURE,
1289 * -FDT_ERR_TRUNCATED, standard meanings
1292 int fdt_setprop_inplace(void *fdt, int nodeoffset, const char *name,
1293 const void *val, int len);
1297 * fdt_setprop_inplace_u32 - change the value of a 32-bit integer property
1299 * @nodeoffset: offset of the node whose property to change
1300 * @name: name of the property to change
1301 * @val: 32-bit integer value to replace the property with
1303 * fdt_setprop_inplace_u32() replaces the value of a given property
1304 * with the 32-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 4
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_u32(void *fdt, int nodeoffset, in fdt_setprop_inplace_u32()
1332 * fdt_setprop_inplace_u64 - change the value of a 64-bit integer property
1334 * @nodeoffset: offset of the node whose property to change
1335 * @name: name of the property to change
1336 * @val: 64-bit integer value to replace the property with
1338 * fdt_setprop_inplace_u64() replaces the value of a given property
1339 * with the 64-bit integer value in val, converting val to big-endian
1340 * if necessary. This function cannot change the size of a property,
1341 * and so will only work if the property already exists and has length
1345 * the given property value, and will not alter or move any other part
1350 * -FDT_ERR_NOSPACE, if the property's length is not equal to 8
1351 * -FDT_ERR_NOTFOUND, node does not have the named property
1352 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1353 * -FDT_ERR_BADMAGIC,
1354 * -FDT_ERR_BADVERSION,
1355 * -FDT_ERR_BADSTATE,
1356 * -FDT_ERR_BADSTRUCTURE,
1357 * -FDT_ERR_TRUNCATED, standard meanings
1359 static inline int fdt_setprop_inplace_u64(void *fdt, int nodeoffset, in fdt_setprop_inplace_u64()
1367 * fdt_setprop_inplace_cell - change the value of a single-cell property
1369 * @nodeoffset: offset of the node containing the property
1370 * @name: name of the property to change the value of
1371 * @val: new value of the 32-bit cell
1376 static inline int fdt_setprop_inplace_cell(void *fdt, int nodeoffset, in fdt_setprop_inplace_cell()
1383 * fdt_nop_property - replace a property with nop tags
1385 * @nodeoffset: offset of the node whose property to nop
1386 * @name: name of the property to nop
1388 * fdt_nop_property() will replace a given property's representation
1393 * the property, and will not alter or move any other part of the
1398 * -FDT_ERR_NOTFOUND, node does not have the named property
1399 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1400 * -FDT_ERR_BADMAGIC,
1401 * -FDT_ERR_BADVERSION,
1402 * -FDT_ERR_BADSTATE,
1403 * -FDT_ERR_BADSTRUCTURE,
1404 * -FDT_ERR_TRUNCATED, standard meanings
1406 int fdt_nop_property(void *fdt, int nodeoffset, const char *name);
1409 * fdt_nop_node - replace a node (subtree) with nop tags
1423 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1424 * -FDT_ERR_BADMAGIC,
1425 * -FDT_ERR_BADVERSION,
1426 * -FDT_ERR_BADSTATE,
1427 * -FDT_ERR_BADSTRUCTURE,
1428 * -FDT_ERR_TRUNCATED, standard meanings
1430 int fdt_nop_node(void *fdt, int nodeoffset);
1438 /* FDT_CREATE_FLAG_NO_NAME_DEDUP: Do not try to de-duplicate property
1445 * fdt_create_with_flags - begin creation of a new fdt
1457 * -FDT_ERR_NOSPACE, bufsize is insufficient for a minimal fdt
1458 * -FDT_ERR_BADFLAGS, flags is not valid
1460 int fdt_create_with_flags(void *buf, int bufsize, uint32_t flags);
1463 * fdt_create - begin creation of a new fdt
1471 * -FDT_ERR_NOSPACE, bufsize is insufficient for a minimal fdt
1473 int fdt_create(void *buf, int bufsize);
1475 int fdt_resize(void *fdt, void *buf, int bufsize);
1476 int fdt_add_reservemap_entry(void *fdt, uint64_t addr, uint64_t size);
1477 int fdt_finish_reservemap(void *fdt);
1478 int fdt_begin_node(void *fdt, const char *name);
1479 int fdt_property(void *fdt, const char *name, const void *val, int len);
1480 static inline int fdt_property_u32(void *fdt, const char *name, uint32_t val) in fdt_property_u32()
1485 static inline int fdt_property_u64(void *fdt, const char *name, uint64_t val) in fdt_property_u64()
1492 static inline int fdt_property_cell(void *fdt, const char *name, uint32_t val) in fdt_property_cell()
1499 * fdt_property_placeholder - add a new property and return a ptr to its value
1502 * @name: name of property to add
1503 * @len: length of property value in bytes
1508 * -FDT_ERR_BADMAGIC,
1509 * -FDT_ERR_NOSPACE, standard meanings
1511 int fdt_property_placeholder(void *fdt, const char *name, int len, void **valp);
1515 int fdt_end_node(void *fdt);
1516 int fdt_finish(void *fdt);
1519 /* Read-write functions */
1522 int fdt_create_empty_tree(void *buf, int bufsize);
1523 int fdt_open_into(const void *fdt, void *buf, int bufsize);
1524 int fdt_pack(void *fdt);
1527 * fdt_add_mem_rsv - add one memory reserve map entry
1529 * @address: 64-bit start address of the reserve map entry
1530 * @size: 64-bit size of the reserved region
1540 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
1542 * -FDT_ERR_BADMAGIC,
1543 * -FDT_ERR_BADVERSION,
1544 * -FDT_ERR_BADSTATE,
1545 * -FDT_ERR_BADSTRUCTURE,
1546 * -FDT_ERR_BADLAYOUT,
1547 * -FDT_ERR_TRUNCATED, standard meanings
1549 int fdt_add_mem_rsv(void *fdt, uint64_t address, uint64_t size);
1552 * fdt_del_mem_rsv - remove a memory reserve map entry
1556 * fdt_del_mem_rsv() removes the n-th memory reserve map entry from
1564 * -FDT_ERR_NOTFOUND, there is no entry of the given index (i.e. there
1566 * -FDT_ERR_BADMAGIC,
1567 * -FDT_ERR_BADVERSION,
1568 * -FDT_ERR_BADSTATE,
1569 * -FDT_ERR_BADSTRUCTURE,
1570 * -FDT_ERR_BADLAYOUT,
1571 * -FDT_ERR_TRUNCATED, standard meanings
1573 int fdt_del_mem_rsv(void *fdt, int n);
1576 * fdt_set_name - change the name of a given node
1592 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob
1594 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1595 * -FDT_ERR_BADMAGIC,
1596 * -FDT_ERR_BADVERSION,
1597 * -FDT_ERR_BADSTATE, standard meanings
1599 int fdt_set_name(void *fdt, int nodeoffset, const char *name);
1602 * fdt_setprop - create or change a property
1604 * @nodeoffset: offset of the node whose property to change
1605 * @name: name of the property to change
1606 * @val: pointer to data to set the property value to
1607 * @len: length of the property value
1609 * fdt_setprop() sets the value of the named property in the given
1610 * node to the given value and length, creating the property if it
1618 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
1619 * contain the new property value
1620 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1621 * -FDT_ERR_BADLAYOUT,
1622 * -FDT_ERR_BADMAGIC,
1623 * -FDT_ERR_BADVERSION,
1624 * -FDT_ERR_BADSTATE,
1625 * -FDT_ERR_BADSTRUCTURE,
1626 * -FDT_ERR_BADLAYOUT,
1627 * -FDT_ERR_TRUNCATED, standard meanings
1629 int fdt_setprop(void *fdt, int nodeoffset, const char *name,
1630 const void *val, int len);
1633 * fdt_setprop_placeholder - allocate space for a property
1635 * @nodeoffset: offset of the node whose property to change
1636 * @name: name of the property to change
1637 * @len: length of the property value
1638 * @prop_data: return pointer to property data
1640 * fdt_setprop_placeholer() allocates the named property in the given node.
1641 * If the property exists it is resized. In either case a pointer to the
1642 * property data is returned.
1649 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
1650 * contain the new property value
1651 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1652 * -FDT_ERR_BADLAYOUT,
1653 * -FDT_ERR_BADMAGIC,
1654 * -FDT_ERR_BADVERSION,
1655 * -FDT_ERR_BADSTATE,
1656 * -FDT_ERR_BADSTRUCTURE,
1657 * -FDT_ERR_BADLAYOUT,
1658 * -FDT_ERR_TRUNCATED, standard meanings
1660 int fdt_setprop_placeholder(void *fdt, int nodeoffset, const char *name,
1661 int len, void **prop_data);
1664 * fdt_setprop_u32 - set a property to a 32-bit integer
1666 * @nodeoffset: offset of the node whose property to change
1667 * @name: name of the property to change
1668 * @val: 32-bit integer value for the property (native endian)
1670 * fdt_setprop_u32() sets the value of the named property in the given
1671 * node to the given 32-bit integer value (converting to big-endian if
1672 * necessary), or creates a new property with that value if it does
1680 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
1681 * contain the new property value
1682 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1683 * -FDT_ERR_BADLAYOUT,
1684 * -FDT_ERR_BADMAGIC,
1685 * -FDT_ERR_BADVERSION,
1686 * -FDT_ERR_BADSTATE,
1687 * -FDT_ERR_BADSTRUCTURE,
1688 * -FDT_ERR_BADLAYOUT,
1689 * -FDT_ERR_TRUNCATED, standard meanings
1691 static inline int fdt_setprop_u32(void *fdt, int nodeoffset, const char *name, in fdt_setprop_u32()
1699 * fdt_setprop_u64 - set a property to a 64-bit integer
1701 * @nodeoffset: offset of the node whose property to change
1702 * @name: name of the property to change
1703 * @val: 64-bit integer value for the property (native endian)
1705 * fdt_setprop_u64() sets the value of the named property in the given
1706 * node to the given 64-bit integer value (converting to big-endian if
1707 * necessary), or creates a new property with that value if it does
1715 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
1716 * contain the new property value
1717 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1718 * -FDT_ERR_BADLAYOUT,
1719 * -FDT_ERR_BADMAGIC,
1720 * -FDT_ERR_BADVERSION,
1721 * -FDT_ERR_BADSTATE,
1722 * -FDT_ERR_BADSTRUCTURE,
1723 * -FDT_ERR_BADLAYOUT,
1724 * -FDT_ERR_TRUNCATED, standard meanings
1726 static inline int fdt_setprop_u64(void *fdt, int nodeoffset, const char *name, in fdt_setprop_u64()
1734 * fdt_setprop_cell - set a property to a single cell value
1736 * @nodeoffset: offset of the node whose property to change
1737 * @name: name of the property to change
1738 * @val: 32-bit integer value for the property (native endian)
1744 static inline int fdt_setprop_cell(void *fdt, int nodeoffset, const char *name, in fdt_setprop_cell()
1751 * fdt_setprop_string - set a property to a string value
1753 * @nodeoffset: offset of the node whose property to change
1754 * @name: name of the property to change
1755 * @str: string value for the property
1757 * fdt_setprop_string() sets the value of the named property in the
1759 * string to determine the new length of the property), or creates a
1760 * new property with that value if it does not already exist.
1767 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
1768 * contain the new property value
1769 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1770 * -FDT_ERR_BADLAYOUT,
1771 * -FDT_ERR_BADMAGIC,
1772 * -FDT_ERR_BADVERSION,
1773 * -FDT_ERR_BADSTATE,
1774 * -FDT_ERR_BADSTRUCTURE,
1775 * -FDT_ERR_BADLAYOUT,
1776 * -FDT_ERR_TRUNCATED, standard meanings
1783 * fdt_setprop_empty - set a property to an empty value
1785 * @nodeoffset: offset of the node whose property to change
1786 * @name: name of the property to change
1788 * fdt_setprop_empty() sets the value of the named property in the
1790 * property if it does not already exist.
1797 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
1798 * contain the new property value
1799 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1800 * -FDT_ERR_BADLAYOUT,
1801 * -FDT_ERR_BADMAGIC,
1802 * -FDT_ERR_BADVERSION,
1803 * -FDT_ERR_BADSTATE,
1804 * -FDT_ERR_BADSTRUCTURE,
1805 * -FDT_ERR_BADLAYOUT,
1806 * -FDT_ERR_TRUNCATED, standard meanings
1812 * fdt_appendprop - append to or create a property
1814 * @nodeoffset: offset of the node whose property to change
1815 * @name: name of the property to append to
1816 * @val: pointer to data to append to the property value
1817 * @len: length of the data to append to the property value
1819 * fdt_appendprop() appends the value to the named property in the
1820 * given node, creating the property if it does not already exist.
1827 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
1828 * contain the new property value
1829 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1830 * -FDT_ERR_BADLAYOUT,
1831 * -FDT_ERR_BADMAGIC,
1832 * -FDT_ERR_BADVERSION,
1833 * -FDT_ERR_BADSTATE,
1834 * -FDT_ERR_BADSTRUCTURE,
1835 * -FDT_ERR_BADLAYOUT,
1836 * -FDT_ERR_TRUNCATED, standard meanings
1838 int fdt_appendprop(void *fdt, int nodeoffset, const char *name,
1839 const void *val, int len);
1842 * fdt_appendprop_u32 - append a 32-bit integer value to a property
1844 * @nodeoffset: offset of the node whose property to change
1845 * @name: name of the property to change
1846 * @val: 32-bit integer value to append to the property (native endian)
1848 * fdt_appendprop_u32() appends the given 32-bit integer value
1849 * (converting to big-endian if necessary) to the value of the named
1850 * property in the given node, or creates a new property with that
1858 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
1859 * contain the new property value
1860 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1861 * -FDT_ERR_BADLAYOUT,
1862 * -FDT_ERR_BADMAGIC,
1863 * -FDT_ERR_BADVERSION,
1864 * -FDT_ERR_BADSTATE,
1865 * -FDT_ERR_BADSTRUCTURE,
1866 * -FDT_ERR_BADLAYOUT,
1867 * -FDT_ERR_TRUNCATED, standard meanings
1869 static inline int fdt_appendprop_u32(void *fdt, int nodeoffset, in fdt_appendprop_u32()
1877 * fdt_appendprop_u64 - append a 64-bit integer value to a property
1879 * @nodeoffset: offset of the node whose property to change
1880 * @name: name of the property to change
1881 * @val: 64-bit integer value to append to the property (native endian)
1883 * fdt_appendprop_u64() appends the given 64-bit integer value
1884 * (converting to big-endian if necessary) to the value of the named
1885 * property in the given node, or creates a new property with that
1893 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
1894 * contain the new property value
1895 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1896 * -FDT_ERR_BADLAYOUT,
1897 * -FDT_ERR_BADMAGIC,
1898 * -FDT_ERR_BADVERSION,
1899 * -FDT_ERR_BADSTATE,
1900 * -FDT_ERR_BADSTRUCTURE,
1901 * -FDT_ERR_BADLAYOUT,
1902 * -FDT_ERR_TRUNCATED, standard meanings
1904 static inline int fdt_appendprop_u64(void *fdt, int nodeoffset, in fdt_appendprop_u64()
1912 * fdt_appendprop_cell - append a single cell value to a property
1914 * @nodeoffset: offset of the node whose property to change
1915 * @name: name of the property to change
1916 * @val: 32-bit integer value to append to the property (native endian)
1922 static inline int fdt_appendprop_cell(void *fdt, int nodeoffset, in fdt_appendprop_cell()
1929 * fdt_appendprop_string - append a string to a property
1931 * @nodeoffset: offset of the node whose property to change
1932 * @name: name of the property to change
1933 * @str: string value to append to the property
1936 * the named property in the given node, or creates a new property
1944 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
1945 * contain the new property value
1946 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1947 * -FDT_ERR_BADLAYOUT,
1948 * -FDT_ERR_BADMAGIC,
1949 * -FDT_ERR_BADVERSION,
1950 * -FDT_ERR_BADSTATE,
1951 * -FDT_ERR_BADSTRUCTURE,
1952 * -FDT_ERR_BADLAYOUT,
1953 * -FDT_ERR_TRUNCATED, standard meanings
1959 * fdt_appendprop_addrrange - append a address range property
1962 * @nodeoffset: offset of the node to add a property at
1963 * @name: name of property
1968 * address and size) to the value of the named property in the given
1969 * node, or creates a new property with that value if it does not
1972 * Cell sizes are determined by parent's #address-cells and #size-cells.
1979 * -FDT_ERR_BADLAYOUT,
1980 * -FDT_ERR_BADMAGIC,
1981 * -FDT_ERR_BADNCELLS, if the node has a badly formatted or invalid
1982 * #address-cells property
1983 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1984 * -FDT_ERR_BADSTATE,
1985 * -FDT_ERR_BADSTRUCTURE,
1986 * -FDT_ERR_BADVERSION,
1987 * -FDT_ERR_BADVALUE, addr or size doesn't fit to respective cells size
1988 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
1989 * contain a new property
1990 * -FDT_ERR_TRUNCATED, standard meanings
1992 int fdt_appendprop_addrrange(void *fdt, int parent, int nodeoffset,
1996 * fdt_delprop - delete a property
1998 * @nodeoffset: offset of the node whose property to nop
1999 * @name: name of the property to nop
2001 * fdt_del_property() will delete the given property.
2008 * -FDT_ERR_NOTFOUND, node does not have the named property
2009 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
2010 * -FDT_ERR_BADLAYOUT,
2011 * -FDT_ERR_BADMAGIC,
2012 * -FDT_ERR_BADVERSION,
2013 * -FDT_ERR_BADSTATE,
2014 * -FDT_ERR_BADSTRUCTURE,
2015 * -FDT_ERR_TRUNCATED, standard meanings
2017 int fdt_delprop(void *fdt, int nodeoffset, const char *name);
2020 * fdt_add_subnode_namelen - creates a new node based on substring
2035 int fdt_add_subnode_namelen(void *fdt, int parentoffset,
2036 const char *name, int namelen);
2040 * fdt_add_subnode - creates a new node
2055 * -FDT_ERR_NOTFOUND, if the requested subnode does not exist
2056 * -FDT_ERR_BADOFFSET, if parentoffset did not point to an FDT_BEGIN_NODE
2058 * -FDT_ERR_EXISTS, if the node at parentoffset already has a subnode of
2060 * -FDT_ERR_NOSPACE, if there is insufficient free space in the
2062 * -FDT_ERR_NOSPACE
2063 * -FDT_ERR_BADLAYOUT
2064 * -FDT_ERR_BADMAGIC,
2065 * -FDT_ERR_BADVERSION,
2066 * -FDT_ERR_BADSTATE,
2067 * -FDT_ERR_BADSTRUCTURE,
2068 * -FDT_ERR_TRUNCATED, standard meanings.
2070 int fdt_add_subnode(void *fdt, int parentoffset, const char *name);
2073 * fdt_del_node - delete a node (subtree)
2085 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
2086 * -FDT_ERR_BADLAYOUT,
2087 * -FDT_ERR_BADMAGIC,
2088 * -FDT_ERR_BADVERSION,
2089 * -FDT_ERR_BADSTATE,
2090 * -FDT_ERR_BADSTRUCTURE,
2091 * -FDT_ERR_TRUNCATED, standard meanings
2093 int fdt_del_node(void *fdt, int nodeoffset);
2096 * fdt_overlay_apply - Applies a DT overlay on a base DT
2108 * -FDT_ERR_NOSPACE, there's not enough space in the base device tree
2109 * -FDT_ERR_NOTFOUND, the overlay points to some inexistant nodes or
2111 * -FDT_ERR_BADPHANDLE,
2112 * -FDT_ERR_BADOVERLAY,
2113 * -FDT_ERR_NOPHANDLES,
2114 * -FDT_ERR_INTERNAL,
2115 * -FDT_ERR_BADLAYOUT,
2116 * -FDT_ERR_BADMAGIC,
2117 * -FDT_ERR_BADOFFSET,
2118 * -FDT_ERR_BADPATH,
2119 * -FDT_ERR_BADVERSION,
2120 * -FDT_ERR_BADSTRUCTURE,
2121 * -FDT_ERR_BADSTATE,
2122 * -FDT_ERR_TRUNCATED, standard meanings
2124 int fdt_overlay_apply(void *fdt, void *fdto);
2127 * fdt_overlay_target_offset - retrieves the offset of a fragment's target
2141 int fdt_overlay_target_offset(const void *fdt, const void *fdto,
2142 int fragment_offset, char const **pathp);
2148 const char *fdt_strerror(int errval);