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);
144 static inline void fdt32_st(void *property, uint32_t value) in fdt32_st() argument
146 uint8_t *bp = (uint8_t *)property; in fdt32_st()
168 static inline void fdt64_st(void *property, uint64_t value) in fdt64_st() argument
170 uint8_t *bp = (uint8_t *)property; in fdt64_st()
186 int fdt_next_node(const void *fdt, int offset, int *depth);
189 * fdt_first_subnode() - get offset of first direct subnode
193 * Return: offset of first subnode, or -FDT_ERR_NOTFOUND if there is none
195 int fdt_first_subnode(const void *fdt, int offset);
198 * fdt_next_subnode() - get offset of next direct subnode
205 * Return: offset of next subnode, or -FDT_ERR_NOTFOUND if there are no more
208 int fdt_next_subnode(const void *fdt, int offset);
211 * fdt_for_each_subnode - iterate over all subnodes of a parent
213 * @node: child node (int, lvalue)
215 * @parent: parent node (int)
224 * if ((node < 0) && (node != -FDT_ERR_NOTFOUND)) {
241 (fdt32_ld(&((const struct fdt_header *)(fdt))->field))
257 fdth->name = cpu_to_fdt32(val); \
272 * fdt_header_size - return the size of the tree's header
280 * fdt_header_size_ - internal function to get header size from a version number
288 * fdt_check_header - sanity check a device tree header
298 * -FDT_ERR_BADMAGIC,
299 * -FDT_ERR_BADVERSION,
300 * -FDT_ERR_BADSTATE,
301 * -FDT_ERR_TRUNCATED, standard meanings, as above
303 int fdt_check_header(const void *fdt);
306 * fdt_move - move a device tree around in memory
319 * -FDT_ERR_NOSPACE, bufsize is insufficient to contain the device tree
320 * -FDT_ERR_BADMAGIC,
321 * -FDT_ERR_BADVERSION,
322 * -FDT_ERR_BADSTATE, standard meanings
324 int fdt_move(const void *fdt, void *buf, int bufsize);
327 /* Read-only functions */
330 int fdt_check_full(const void *fdt, size_t bufsize);
333 * fdt_get_string - retrieve a string from the strings block of a device tree
346 const char *fdt_get_string(const void *fdt, int stroffset, int *lenp);
349 * fdt_string - retrieve a string from the strings block of a device tree
360 const char *fdt_string(const void *fdt, int stroffset);
363 * fdt_find_max_phandle - find and return the highest phandle in a tree
374 int fdt_find_max_phandle(const void *fdt, uint32_t *phandle);
377 * fdt_get_max_phandle - retrieves the highest phandle in a tree
382 * with a value of 0 or -1.
389 * -1, if an error occurred
394 int err; in fdt_get_max_phandle()
398 return (uint32_t)-1; in fdt_get_max_phandle()
404 * fdt_generate_phandle - return a new, unused phandle for a device tree blob
413 * Return: 0 on success or a negative error-code on failure
415 int fdt_generate_phandle(const void *fdt, uint32_t *phandle);
418 * fdt_num_mem_rsv - retrieve the number of memory reserve map entries
428 int fdt_num_mem_rsv(const void *fdt);
431 * fdt_get_mem_rsv - retrieve one memory reserve map entry
434 * @address: pointer to 64-bit variable to hold the start address
435 * @size: pointer to 64-bit variable to hold the size of the entry
438 * the n-th reserve map entry from the device tree blob, in
439 * native-endian format.
443 * -FDT_ERR_BADMAGIC,
444 * -FDT_ERR_BADVERSION,
445 * -FDT_ERR_BADSTATE, standard meanings
447 int fdt_get_mem_rsv(const void *fdt, int n, uint64_t *address, uint64_t *size);
450 * fdt_subnode_offset_namelen - find a subnode based on substring
461 * Return: offset of the subnode or -FDT_ERR_NOTFOUND if name not found.
464 int fdt_subnode_offset_namelen(const void *fdt, int parentoffset,
465 const char *name, int namelen);
468 * fdt_subnode_offset - find a subnode of a given node
482 * -FDT_ERR_NOTFOUND, if the requested subnode does not exist
483 * -FDT_ERR_BADOFFSET, if parentoffset did not point to an FDT_BEGIN_NODE
485 * -FDT_ERR_BADMAGIC,
486 * -FDT_ERR_BADVERSION,
487 * -FDT_ERR_BADSTATE,
488 * -FDT_ERR_BADSTRUCTURE,
489 * -FDT_ERR_TRUNCATED, standard meanings.
491 int fdt_subnode_offset(const void *fdt, int parentoffset, const char *name);
494 * fdt_path_offset_namelen - find a tree node by its full path
505 int fdt_path_offset_namelen(const void *fdt, const char *path, int namelen);
509 * fdt_path_offset - find a tree node by its full path
523 * -FDT_ERR_BADPATH, given path does not begin with '/' or is invalid
524 * -FDT_ERR_NOTFOUND, if the requested node does not exist
525 * -FDT_ERR_BADMAGIC,
526 * -FDT_ERR_BADVERSION,
527 * -FDT_ERR_BADSTATE,
528 * -FDT_ERR_BADSTRUCTURE,
529 * -FDT_ERR_TRUNCATED, standard meanings.
531 int fdt_path_offset(const void *fdt, const char *path);
534 * fdt_get_name - retrieve the name of a given node
541 * non-NULL, the length of this name is also returned, in the integer
546 * If lenp is non-NULL, *lenp contains the length of that name
549 * if lenp is non-NULL *lenp contains an error code (<0):
550 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE
552 * -FDT_ERR_BADMAGIC,
553 * -FDT_ERR_BADVERSION,
554 * -FDT_ERR_BADSTATE, standard meanings
556 const char *fdt_get_name(const void *fdt, int nodeoffset, int *lenp);
559 * fdt_first_property_offset - find the offset of a node's first property
563 * fdt_first_property_offset() finds the first property of the node at
567 * structure block offset of the property (>=0), on success
568 * -FDT_ERR_NOTFOUND, if the requested node has no properties
569 * -FDT_ERR_BADOFFSET, if nodeoffset did not point to an FDT_BEGIN_NODE tag
570 * -FDT_ERR_BADMAGIC,
571 * -FDT_ERR_BADVERSION,
572 * -FDT_ERR_BADSTATE,
573 * -FDT_ERR_BADSTRUCTURE,
574 * -FDT_ERR_TRUNCATED, standard meanings.
576 int fdt_first_property_offset(const void *fdt, int nodeoffset);
579 * fdt_next_property_offset - step through a node's properties
581 * @offset: structure block offset of a property
583 * fdt_next_property_offset() finds the property immediately after the
584 * one at the given structure block offset. This will be a property
585 * of the same node as the given property.
588 * structure block offset of the next property (>=0), on success
589 * -FDT_ERR_NOTFOUND, if the given property is the last in its node
590 * -FDT_ERR_BADOFFSET, if nodeoffset did not point to an FDT_PROP tag
591 * -FDT_ERR_BADMAGIC,
592 * -FDT_ERR_BADVERSION,
593 * -FDT_ERR_BADSTATE,
594 * -FDT_ERR_BADSTRUCTURE,
595 * -FDT_ERR_TRUNCATED, standard meanings.
597 int fdt_next_property_offset(const void *fdt, int offset);
600 * fdt_for_each_property_offset - iterate over all properties of a node
602 * @property: property offset (int, lvalue)
604 * @node: node offset (int)
608 * fdt_for_each_property_offset(property, fdt, node) {
609 * Use property
613 * if ((property < 0) && (property != -FDT_ERR_NOTFOUND)) {
617 * Note that this is implemented as a macro and property is used as
621 #define fdt_for_each_property_offset(property, fdt, node) \ argument
622 for (property = fdt_first_property_offset(fdt, node); \
623 property >= 0; \
624 property = fdt_next_property_offset(fdt, property))
627 * fdt_get_property_by_offset - retrieve the property at a given offset
629 * @offset: offset of the property to retrieve
634 * offset. If lenp is non-NULL, the length of the property value is
641 * pointer to the structure representing the property
642 * if lenp is non-NULL, *lenp contains the length of the property
645 * if lenp is non-NULL, *lenp contains an error code (<0):
646 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_PROP tag
647 * -FDT_ERR_BADMAGIC,
648 * -FDT_ERR_BADVERSION,
649 * -FDT_ERR_BADSTATE,
650 * -FDT_ERR_BADSTRUCTURE,
651 * -FDT_ERR_TRUNCATED, standard meanings
654 int offset,
655 int *lenp);
658 * fdt_get_property_namelen - find a property based on substring
660 * @nodeoffset: offset of the node whose property to find
661 * @name: name of the property to find
666 * characters of name for matching the property name.
668 * Return: pointer to the structure representing the property, or NULL
673 int nodeoffset,
675 int namelen, int *lenp);
679 * fdt_get_property - find a given property in a given node
681 * @nodeoffset: offset of the node whose property to find
682 * @name: name of the property to find
686 * structure within the device tree blob corresponding to the property
688 * non-NULL, the length of the property value is also returned, in the
692 * pointer to the structure representing the property
693 * if lenp is non-NULL, *lenp contains the length of the property
696 * if lenp is non-NULL, *lenp contains an error code (<0):
697 * -FDT_ERR_NOTFOUND, node does not have named property
698 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE
700 * -FDT_ERR_BADMAGIC,
701 * -FDT_ERR_BADVERSION,
702 * -FDT_ERR_BADSTATE,
703 * -FDT_ERR_BADSTRUCTURE,
704 * -FDT_ERR_TRUNCATED, standard meanings
706 const struct fdt_property *fdt_get_property(const void *fdt, int nodeoffset,
707 const char *name, int *lenp);
708 static inline struct fdt_property *fdt_get_property_w(void *fdt, int nodeoffset, in fdt_get_property_w()
710 int *lenp) in fdt_get_property_w()
717 * fdt_getprop_by_offset - retrieve the value of a property at a given offset
719 * @offset: offset of the property to read
724 * property at structure block offset 'offset' (this will be a pointer
726 * lenp is non-NULL, the length of the property value is also
727 * returned, in the integer pointed to by lenp. If namep is non-NULL,
728 * the property's namne will also be returned in the char * pointed to
733 * pointer to the property's value
734 * if lenp is non-NULL, *lenp contains the length of the property
736 * if namep is non-NULL *namep contiains a pointer to the property
739 * if lenp is non-NULL, *lenp contains an error code (<0):
740 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_PROP tag
741 * -FDT_ERR_BADMAGIC,
742 * -FDT_ERR_BADVERSION,
743 * -FDT_ERR_BADSTATE,
744 * -FDT_ERR_BADSTRUCTURE,
745 * -FDT_ERR_TRUNCATED, standard meanings
748 const void *fdt_getprop_by_offset(const void *fdt, int offset,
749 const char **namep, int *lenp);
753 * fdt_getprop_namelen - get property value based on substring
755 * @nodeoffset: offset of the node whose property to find
756 * @name: name of the property to find
761 * characters of name for matching the property name.
763 * Return: pointer to the property's value or NULL on error
766 const void *fdt_getprop_namelen(const void *fdt, int nodeoffset,
767 const char *name, int namelen, int *lenp);
768 static inline void *fdt_getprop_namelen_w(void *fdt, int nodeoffset, in fdt_getprop_namelen_w()
769 const char *name, int namelen, in fdt_getprop_namelen_w()
770 int *lenp) in fdt_getprop_namelen_w()
778 * fdt_getprop - retrieve the value of a given property
780 * @nodeoffset: offset of the node whose property to find
781 * @name: name of the property to find
784 * fdt_getprop() retrieves a pointer to the value of the property
787 * If @lenp is non-NULL, the length of the property value is also
791 * pointer to the property's value
792 * if lenp is non-NULL, *lenp contains the length of the property
795 * if lenp is non-NULL, *lenp contains an error code (<0):
796 * -FDT_ERR_NOTFOUND, node does not have named property
797 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE
799 * -FDT_ERR_BADMAGIC,
800 * -FDT_ERR_BADVERSION,
801 * -FDT_ERR_BADSTATE,
802 * -FDT_ERR_BADSTRUCTURE,
803 * -FDT_ERR_TRUNCATED, standard meanings
805 const void *fdt_getprop(const void *fdt, int nodeoffset,
806 const char *name, int *lenp);
807 static inline void *fdt_getprop_w(void *fdt, int nodeoffset, in fdt_getprop_w()
808 const char *name, int *lenp) in fdt_getprop_w()
814 * fdt_get_phandle - retrieve the phandle of a given node
822 * the phandle of the node at nodeoffset, on success (!= 0, != -1)
825 uint32_t fdt_get_phandle(const void *fdt, int nodeoffset);
828 * fdt_get_alias_namelen - get alias based on substring
841 const char *name, int namelen);
845 * fdt_get_alias - retrieve the path referenced by a given alias
850 * value of the property named @name in the node /aliases.
859 * fdt_get_path - determine the full path of a node
874 * nodeoffset, as a NUL-terminated string.
875 * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
876 * -FDT_ERR_NOSPACE, the path of the given node is longer than (bufsize-1)
878 * -FDT_ERR_BADMAGIC,
879 * -FDT_ERR_BADVERSION,
880 * -FDT_ERR_BADSTATE,
881 * -FDT_ERR_BADSTRUCTURE, standard meanings
883 int fdt_get_path(const void *fdt, int nodeoffset, char *buf, int buflen);
886 * fdt_supernode_atdepth_offset - find a specific ancestor of a node
907 * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
908 * -FDT_ERR_NOTFOUND, supernodedepth was greater than the depth of
910 * -FDT_ERR_BADMAGIC,
911 * -FDT_ERR_BADVERSION,
912 * -FDT_ERR_BADSTATE,
913 * -FDT_ERR_BADSTRUCTURE, standard meanings
915 int fdt_supernode_atdepth_offset(const void *fdt, int nodeoffset,
916 int supernodedepth, int *nodedepth);
919 * fdt_node_depth - find the depth of a given node
931 * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
932 * -FDT_ERR_BADMAGIC,
933 * -FDT_ERR_BADVERSION,
934 * -FDT_ERR_BADSTATE,
935 * -FDT_ERR_BADSTRUCTURE, standard meanings
937 int fdt_node_depth(const void *fdt, int nodeoffset);
940 * fdt_parent_offset - find the parent of a given node
954 * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
955 * -FDT_ERR_BADMAGIC,
956 * -FDT_ERR_BADVERSION,
957 * -FDT_ERR_BADSTATE,
958 * -FDT_ERR_BADSTRUCTURE, standard meanings
960 int fdt_parent_offset(const void *fdt, int nodeoffset);
963 * fdt_node_offset_by_prop_value - find nodes with a given property value
966 * @propname: property name to check
967 * @propval: property value to search for
971 * node after startoffset, which has a property named propname whose
973 * startoffset is -1, the very first such node in the tree.
977 * offset = fdt_node_offset_by_prop_value(fdt, -1, propname,
979 * while (offset != -FDT_ERR_NOTFOUND) {
985 * Note the -1 in the first call to the function, if 0 is used here
992 * -FDT_ERR_NOTFOUND, no node matching the criterion exists in the
994 * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
995 * -FDT_ERR_BADMAGIC,
996 * -FDT_ERR_BADVERSION,
997 * -FDT_ERR_BADSTATE,
998 * -FDT_ERR_BADSTRUCTURE, standard meanings
1000 int fdt_node_offset_by_prop_value(const void *fdt, int startoffset,
1002 const void *propval, int proplen);
1005 * fdt_node_offset_by_phandle - find the node with a given phandle
1016 * -FDT_ERR_NOTFOUND, no node with that phandle exists
1017 * -FDT_ERR_BADPHANDLE, given phandle value was invalid (0 or -1)
1018 * -FDT_ERR_BADMAGIC,
1019 * -FDT_ERR_BADVERSION,
1020 * -FDT_ERR_BADSTATE,
1021 * -FDT_ERR_BADSTRUCTURE, standard meanings
1023 int fdt_node_offset_by_phandle(const void *fdt, uint32_t phandle);
1026 * fdt_node_check_compatible - check a node's compatible property
1032 * @compatible property with the given string as one of its elements,
1033 * it returns non-zero otherwise, or on error.
1036 * 0, if the node has a 'compatible' property listing the given string
1037 * 1, if the node has a 'compatible' property, but it does not list
1039 * -FDT_ERR_NOTFOUND, if the given node has no 'compatible' property
1040 * -FDT_ERR_BADOFFSET, if nodeoffset does not refer to a BEGIN_NODE tag
1041 * -FDT_ERR_BADMAGIC,
1042 * -FDT_ERR_BADVERSION,
1043 * -FDT_ERR_BADSTATE,
1044 * -FDT_ERR_BADSTRUCTURE, standard meanings
1046 int fdt_node_check_compatible(const void *fdt, int nodeoffset,
1050 * fdt_node_offset_by_compatible - find nodes with a given 'compatible' value
1056 * node after startoffset, which has a 'compatible' property which
1057 * lists the given compatible string; or if startoffset is -1, the
1062 * offset = fdt_node_offset_by_compatible(fdt, -1, compatible);
1063 * while (offset != -FDT_ERR_NOTFOUND) {
1068 * Note the -1 in the first call to the function, if 0 is used here
1075 * -FDT_ERR_NOTFOUND, no node matching the criterion exists in the
1077 * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
1078 * -FDT_ERR_BADMAGIC,
1079 * -FDT_ERR_BADVERSION,
1080 * -FDT_ERR_BADSTATE,
1081 * -FDT_ERR_BADSTRUCTURE, standard meanings
1083 int fdt_node_offset_by_compatible(const void *fdt, int startoffset,
1087 * fdt_stringlist_contains - check a string list property for a string
1088 * @strlist: Property containing a list of strings to check
1089 * @listlen: Length of property
1094 * "compatible" property.
1098 int fdt_stringlist_contains(const char *strlist, int listlen, const char *str);
1101 * fdt_stringlist_count - count the number of strings in a string list
1104 * @property: name of the property containing the string list
1107 * the number of strings in the given property
1108 * -FDT_ERR_BADVALUE if the property value is not NUL-terminated
1109 * -FDT_ERR_NOTFOUND if the property does not exist
1111 int fdt_stringlist_count(const void *fdt, int nodeoffset, const char *property);
1114 * fdt_stringlist_search - find a string in a string list and return its index
1117 * @property: name of the property containing the string list
1120 * Note that it is possible for this function to succeed on property values
1121 * that are not NUL-terminated. That's because the function will stop after
1123 * small-valued cell properties, such as #address-cells, when searching for
1128 * -FDT_ERR_BADVALUE if the property value is not NUL-terminated
1129 * -FDT_ERR_NOTFOUND if the property does not exist or does not contain
1132 int fdt_stringlist_search(const void *fdt, int nodeoffset, const char *property,
1136 * fdt_stringlist_get() - obtain the string at a given index in a string list
1139 * @property: name of the property containing the string list
1144 * non-NUL-terminated values. For example on small-valued cell properties
1147 * If non-NULL, the length of the string (on success) or a negative error-code
1153 * location pointed to by the lenp parameter, if non-NULL. On failure one of
1155 * (if non-NULL):
1156 * -FDT_ERR_BADVALUE if the property value is not NUL-terminated
1157 * -FDT_ERR_NOTFOUND if the property does not exist
1159 const char *fdt_stringlist_get(const void *fdt, int nodeoffset,
1160 const char *property, int index,
1161 int *lenp);
1164 /* Read-only functions (addressing related) */
1168 * FDT_MAX_NCELLS - maximum value for #address-cells and #size-cells
1170 * This is the maximum value for #address-cells, #size-cells and
1179 * fdt_address_cells - retrieve address size for a bus represented in the tree
1183 * When the node has a valid #address-cells property, returns its value.
1187 * 2, if the node has no #address-cells property
1188 * -FDT_ERR_BADNCELLS, if the node has a badly formatted or invalid
1189 * #address-cells property
1190 * -FDT_ERR_BADMAGIC,
1191 * -FDT_ERR_BADVERSION,
1192 * -FDT_ERR_BADSTATE,
1193 * -FDT_ERR_BADSTRUCTURE,
1194 * -FDT_ERR_TRUNCATED, standard meanings
1196 int fdt_address_cells(const void *fdt, int nodeoffset);
1199 * fdt_size_cells - retrieve address range size for a bus represented in the
1204 * When the node has a valid #size-cells property, returns its value.
1208 * 1, if the node has no #size-cells property
1209 * -FDT_ERR_BADNCELLS, if the node has a badly formatted or invalid
1210 * #size-cells property
1211 * -FDT_ERR_BADMAGIC,
1212 * -FDT_ERR_BADVERSION,
1213 * -FDT_ERR_BADSTATE,
1214 * -FDT_ERR_BADSTRUCTURE,
1215 * -FDT_ERR_TRUNCATED, standard meanings
1217 int fdt_size_cells(const void *fdt, int nodeoffset);
1221 /* Write-in-place functions */
1225 * fdt_setprop_inplace_namelen_partial - change a property's value,
1228 * @nodeoffset: offset of the node whose property to change
1229 * @name: name of the property to change
1231 * @idx: index of the property to change in the array
1232 * @val: pointer to data to replace the property value with
1233 * @len: length of the property value
1235 * Identical to fdt_setprop_inplace(), but modifies the given property
1243 int fdt_setprop_inplace_namelen_partial(void *fdt, int nodeoffset,
1244 const char *name, int namelen,
1246 int len);
1250 * fdt_setprop_inplace - change a property's value, but not its size
1252 * @nodeoffset: offset of the node whose property to change
1253 * @name: name of the property to change
1254 * @val: pointer to data to replace the property value with
1255 * @len: length of the property value
1257 * fdt_setprop_inplace() replaces the value of a given property with
1259 * size of a property, and so will only work if len is equal to the
1260 * current length of the property.
1263 * the given property value, and will not alter or move any other part
1268 * -FDT_ERR_NOSPACE, if len is not equal to the property's current length
1269 * -FDT_ERR_NOTFOUND, node does not have the named property
1270 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1271 * -FDT_ERR_BADMAGIC,
1272 * -FDT_ERR_BADVERSION,
1273 * -FDT_ERR_BADSTATE,
1274 * -FDT_ERR_BADSTRUCTURE,
1275 * -FDT_ERR_TRUNCATED, standard meanings
1278 int fdt_setprop_inplace(void *fdt, int nodeoffset, const char *name,
1279 const void *val, int len);
1283 * fdt_setprop_inplace_u32 - change the value of a 32-bit integer property
1285 * @nodeoffset: offset of the node whose property to change
1286 * @name: name of the property to change
1287 * @val: 32-bit integer value to replace the property with
1289 * fdt_setprop_inplace_u32() replaces the value of a given property
1290 * with the 32-bit integer value in val, converting val to big-endian
1291 * if necessary. This function cannot change the size of a property,
1292 * and so will only work if the property already exists and has length
1296 * the given property value, and will not alter or move any other part
1301 * -FDT_ERR_NOSPACE, if the property's length is not equal to 4
1302 * -FDT_ERR_NOTFOUND, node does not have the named property
1303 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1304 * -FDT_ERR_BADMAGIC,
1305 * -FDT_ERR_BADVERSION,
1306 * -FDT_ERR_BADSTATE,
1307 * -FDT_ERR_BADSTRUCTURE,
1308 * -FDT_ERR_TRUNCATED, standard meanings
1310 static inline int fdt_setprop_inplace_u32(void *fdt, int nodeoffset, in fdt_setprop_inplace_u32()
1318 * fdt_setprop_inplace_u64 - change the value of a 64-bit integer property
1320 * @nodeoffset: offset of the node whose property to change
1321 * @name: name of the property to change
1322 * @val: 64-bit integer value to replace the property with
1324 * fdt_setprop_inplace_u64() replaces the value of a given property
1325 * with the 64-bit integer value in val, converting val to big-endian
1326 * if necessary. This function cannot change the size of a property,
1327 * and so will only work if the property already exists and has length
1331 * the given property value, and will not alter or move any other part
1336 * -FDT_ERR_NOSPACE, if the property's length is not equal to 8
1337 * -FDT_ERR_NOTFOUND, node does not have the named property
1338 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1339 * -FDT_ERR_BADMAGIC,
1340 * -FDT_ERR_BADVERSION,
1341 * -FDT_ERR_BADSTATE,
1342 * -FDT_ERR_BADSTRUCTURE,
1343 * -FDT_ERR_TRUNCATED, standard meanings
1345 static inline int fdt_setprop_inplace_u64(void *fdt, int nodeoffset, in fdt_setprop_inplace_u64()
1353 * fdt_setprop_inplace_cell - change the value of a single-cell property
1355 * @nodeoffset: offset of the node containing the property
1356 * @name: name of the property to change the value of
1357 * @val: new value of the 32-bit cell
1362 static inline int fdt_setprop_inplace_cell(void *fdt, int nodeoffset, in fdt_setprop_inplace_cell()
1369 * fdt_nop_property - replace a property with nop tags
1371 * @nodeoffset: offset of the node whose property to nop
1372 * @name: name of the property to nop
1374 * fdt_nop_property() will replace a given property's representation
1379 * the property, and will not alter or move any other part of the
1384 * -FDT_ERR_NOTFOUND, node does not have the named property
1385 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1386 * -FDT_ERR_BADMAGIC,
1387 * -FDT_ERR_BADVERSION,
1388 * -FDT_ERR_BADSTATE,
1389 * -FDT_ERR_BADSTRUCTURE,
1390 * -FDT_ERR_TRUNCATED, standard meanings
1392 int fdt_nop_property(void *fdt, int nodeoffset, const char *name);
1395 * fdt_nop_node - replace a node (subtree) with nop tags
1409 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1410 * -FDT_ERR_BADMAGIC,
1411 * -FDT_ERR_BADVERSION,
1412 * -FDT_ERR_BADSTATE,
1413 * -FDT_ERR_BADSTRUCTURE,
1414 * -FDT_ERR_TRUNCATED, standard meanings
1416 int fdt_nop_node(void *fdt, int nodeoffset);
1424 /* FDT_CREATE_FLAG_NO_NAME_DEDUP: Do not try to de-duplicate property
1431 * fdt_create_with_flags - begin creation of a new fdt
1443 * -FDT_ERR_NOSPACE, bufsize is insufficient for a minimal fdt
1444 * -FDT_ERR_BADFLAGS, flags is not valid
1446 int fdt_create_with_flags(void *buf, int bufsize, uint32_t flags);
1449 * fdt_create - begin creation of a new fdt
1457 * -FDT_ERR_NOSPACE, bufsize is insufficient for a minimal fdt
1459 int fdt_create(void *buf, int bufsize);
1461 int fdt_resize(void *fdt, void *buf, int bufsize);
1462 int fdt_add_reservemap_entry(void *fdt, uint64_t addr, uint64_t size);
1463 int fdt_finish_reservemap(void *fdt);
1464 int fdt_begin_node(void *fdt, const char *name);
1465 int fdt_property(void *fdt, const char *name, const void *val, int len);
1466 static inline int fdt_property_u32(void *fdt, const char *name, uint32_t val) in fdt_property_u32()
1471 static inline int fdt_property_u64(void *fdt, const char *name, uint64_t val) in fdt_property_u64()
1478 static inline int fdt_property_cell(void *fdt, const char *name, uint32_t val) in fdt_property_cell()
1485 * fdt_property_placeholder - add a new property and return a ptr to its value
1488 * @name: name of property to add
1489 * @len: length of property value in bytes
1494 * -FDT_ERR_BADMAGIC,
1495 * -FDT_ERR_NOSPACE, standard meanings
1497 int fdt_property_placeholder(void *fdt, const char *name, int len, void **valp);
1501 int fdt_end_node(void *fdt);
1502 int fdt_finish(void *fdt);
1505 /* Read-write functions */
1508 int fdt_create_empty_tree(void *buf, int bufsize);
1509 int fdt_open_into(const void *fdt, void *buf, int bufsize);
1510 int fdt_pack(void *fdt);
1513 * fdt_add_mem_rsv - add one memory reserve map entry
1515 * @address: 64-bit start address of the reserve map entry
1516 * @size: 64-bit size of the reserved region
1526 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
1528 * -FDT_ERR_BADMAGIC,
1529 * -FDT_ERR_BADVERSION,
1530 * -FDT_ERR_BADSTATE,
1531 * -FDT_ERR_BADSTRUCTURE,
1532 * -FDT_ERR_BADLAYOUT,
1533 * -FDT_ERR_TRUNCATED, standard meanings
1535 int fdt_add_mem_rsv(void *fdt, uint64_t address, uint64_t size);
1538 * fdt_del_mem_rsv - remove a memory reserve map entry
1542 * fdt_del_mem_rsv() removes the n-th memory reserve map entry from
1550 * -FDT_ERR_NOTFOUND, there is no entry of the given index (i.e. there
1552 * -FDT_ERR_BADMAGIC,
1553 * -FDT_ERR_BADVERSION,
1554 * -FDT_ERR_BADSTATE,
1555 * -FDT_ERR_BADSTRUCTURE,
1556 * -FDT_ERR_BADLAYOUT,
1557 * -FDT_ERR_TRUNCATED, standard meanings
1559 int fdt_del_mem_rsv(void *fdt, int n);
1562 * fdt_set_name - change the name of a given node
1578 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob
1580 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1581 * -FDT_ERR_BADMAGIC,
1582 * -FDT_ERR_BADVERSION,
1583 * -FDT_ERR_BADSTATE, standard meanings
1585 int fdt_set_name(void *fdt, int nodeoffset, const char *name);
1588 * fdt_setprop - create or change a property
1590 * @nodeoffset: offset of the node whose property to change
1591 * @name: name of the property to change
1592 * @val: pointer to data to set the property value to
1593 * @len: length of the property value
1595 * fdt_setprop() sets the value of the named property in the given
1596 * node to the given value and length, creating the property if it
1604 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
1605 * contain the new property value
1606 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1607 * -FDT_ERR_BADLAYOUT,
1608 * -FDT_ERR_BADMAGIC,
1609 * -FDT_ERR_BADVERSION,
1610 * -FDT_ERR_BADSTATE,
1611 * -FDT_ERR_BADSTRUCTURE,
1612 * -FDT_ERR_BADLAYOUT,
1613 * -FDT_ERR_TRUNCATED, standard meanings
1615 int fdt_setprop(void *fdt, int nodeoffset, const char *name,
1616 const void *val, int len);
1619 * fdt_setprop_placeholder - allocate space for a property
1621 * @nodeoffset: offset of the node whose property to change
1622 * @name: name of the property to change
1623 * @len: length of the property value
1624 * @prop_data: return pointer to property data
1626 * fdt_setprop_placeholer() allocates the named property in the given node.
1627 * If the property exists it is resized. In either case a pointer to the
1628 * property data is returned.
1635 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
1636 * contain the new property value
1637 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1638 * -FDT_ERR_BADLAYOUT,
1639 * -FDT_ERR_BADMAGIC,
1640 * -FDT_ERR_BADVERSION,
1641 * -FDT_ERR_BADSTATE,
1642 * -FDT_ERR_BADSTRUCTURE,
1643 * -FDT_ERR_BADLAYOUT,
1644 * -FDT_ERR_TRUNCATED, standard meanings
1646 int fdt_setprop_placeholder(void *fdt, int nodeoffset, const char *name,
1647 int len, void **prop_data);
1650 * fdt_setprop_u32 - set a property to a 32-bit integer
1652 * @nodeoffset: offset of the node whose property to change
1653 * @name: name of the property to change
1654 * @val: 32-bit integer value for the property (native endian)
1656 * fdt_setprop_u32() sets the value of the named property in the given
1657 * node to the given 32-bit integer value (converting to big-endian if
1658 * necessary), or creates a new property with that value if it does
1666 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
1667 * contain the new property value
1668 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1669 * -FDT_ERR_BADLAYOUT,
1670 * -FDT_ERR_BADMAGIC,
1671 * -FDT_ERR_BADVERSION,
1672 * -FDT_ERR_BADSTATE,
1673 * -FDT_ERR_BADSTRUCTURE,
1674 * -FDT_ERR_BADLAYOUT,
1675 * -FDT_ERR_TRUNCATED, standard meanings
1677 static inline int fdt_setprop_u32(void *fdt, int nodeoffset, const char *name, in fdt_setprop_u32()
1685 * fdt_setprop_u64 - set a property to a 64-bit integer
1687 * @nodeoffset: offset of the node whose property to change
1688 * @name: name of the property to change
1689 * @val: 64-bit integer value for the property (native endian)
1691 * fdt_setprop_u64() sets the value of the named property in the given
1692 * node to the given 64-bit integer value (converting to big-endian if
1693 * necessary), or creates a new property with that value if it does
1701 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
1702 * contain the new property value
1703 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1704 * -FDT_ERR_BADLAYOUT,
1705 * -FDT_ERR_BADMAGIC,
1706 * -FDT_ERR_BADVERSION,
1707 * -FDT_ERR_BADSTATE,
1708 * -FDT_ERR_BADSTRUCTURE,
1709 * -FDT_ERR_BADLAYOUT,
1710 * -FDT_ERR_TRUNCATED, standard meanings
1712 static inline int fdt_setprop_u64(void *fdt, int nodeoffset, const char *name, in fdt_setprop_u64()
1720 * fdt_setprop_cell - set a property to a single cell value
1722 * @nodeoffset: offset of the node whose property to change
1723 * @name: name of the property to change
1724 * @val: 32-bit integer value for the property (native endian)
1730 static inline int fdt_setprop_cell(void *fdt, int nodeoffset, const char *name, in fdt_setprop_cell()
1737 * fdt_setprop_string - set a property to a string value
1739 * @nodeoffset: offset of the node whose property to change
1740 * @name: name of the property to change
1741 * @str: string value for the property
1743 * fdt_setprop_string() sets the value of the named property in the
1745 * string to determine the new length of the property), or creates a
1746 * new property with that value if it does not already exist.
1753 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
1754 * contain the new property value
1755 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1756 * -FDT_ERR_BADLAYOUT,
1757 * -FDT_ERR_BADMAGIC,
1758 * -FDT_ERR_BADVERSION,
1759 * -FDT_ERR_BADSTATE,
1760 * -FDT_ERR_BADSTRUCTURE,
1761 * -FDT_ERR_BADLAYOUT,
1762 * -FDT_ERR_TRUNCATED, standard meanings
1769 * fdt_setprop_empty - set a property to an empty value
1771 * @nodeoffset: offset of the node whose property to change
1772 * @name: name of the property to change
1774 * fdt_setprop_empty() sets the value of the named property in the
1776 * property if it does not already exist.
1783 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
1784 * contain the new property value
1785 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1786 * -FDT_ERR_BADLAYOUT,
1787 * -FDT_ERR_BADMAGIC,
1788 * -FDT_ERR_BADVERSION,
1789 * -FDT_ERR_BADSTATE,
1790 * -FDT_ERR_BADSTRUCTURE,
1791 * -FDT_ERR_BADLAYOUT,
1792 * -FDT_ERR_TRUNCATED, standard meanings
1798 * fdt_appendprop - append to or create a property
1800 * @nodeoffset: offset of the node whose property to change
1801 * @name: name of the property to append to
1802 * @val: pointer to data to append to the property value
1803 * @len: length of the data to append to the property value
1805 * fdt_appendprop() appends the value to the named property in the
1806 * given node, creating the property if it does not already exist.
1813 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
1814 * contain the new property value
1815 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1816 * -FDT_ERR_BADLAYOUT,
1817 * -FDT_ERR_BADMAGIC,
1818 * -FDT_ERR_BADVERSION,
1819 * -FDT_ERR_BADSTATE,
1820 * -FDT_ERR_BADSTRUCTURE,
1821 * -FDT_ERR_BADLAYOUT,
1822 * -FDT_ERR_TRUNCATED, standard meanings
1824 int fdt_appendprop(void *fdt, int nodeoffset, const char *name,
1825 const void *val, int len);
1828 * fdt_appendprop_u32 - append a 32-bit integer value to a property
1830 * @nodeoffset: offset of the node whose property to change
1831 * @name: name of the property to change
1832 * @val: 32-bit integer value to append to the property (native endian)
1834 * fdt_appendprop_u32() appends the given 32-bit integer value
1835 * (converting to big-endian if necessary) to the value of the named
1836 * property in the given node, or creates a new property with that
1844 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
1845 * contain the new property value
1846 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1847 * -FDT_ERR_BADLAYOUT,
1848 * -FDT_ERR_BADMAGIC,
1849 * -FDT_ERR_BADVERSION,
1850 * -FDT_ERR_BADSTATE,
1851 * -FDT_ERR_BADSTRUCTURE,
1852 * -FDT_ERR_BADLAYOUT,
1853 * -FDT_ERR_TRUNCATED, standard meanings
1855 static inline int fdt_appendprop_u32(void *fdt, int nodeoffset, in fdt_appendprop_u32()
1863 * fdt_appendprop_u64 - append a 64-bit integer value to a property
1865 * @nodeoffset: offset of the node whose property to change
1866 * @name: name of the property to change
1867 * @val: 64-bit integer value to append to the property (native endian)
1869 * fdt_appendprop_u64() appends the given 64-bit integer value
1870 * (converting to big-endian if necessary) to the value of the named
1871 * property in the given node, or creates a new property with that
1879 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
1880 * contain the new property value
1881 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1882 * -FDT_ERR_BADLAYOUT,
1883 * -FDT_ERR_BADMAGIC,
1884 * -FDT_ERR_BADVERSION,
1885 * -FDT_ERR_BADSTATE,
1886 * -FDT_ERR_BADSTRUCTURE,
1887 * -FDT_ERR_BADLAYOUT,
1888 * -FDT_ERR_TRUNCATED, standard meanings
1890 static inline int fdt_appendprop_u64(void *fdt, int nodeoffset, in fdt_appendprop_u64()
1898 * fdt_appendprop_cell - append a single cell value to a property
1900 * @nodeoffset: offset of the node whose property to change
1901 * @name: name of the property to change
1902 * @val: 32-bit integer value to append to the property (native endian)
1908 static inline int fdt_appendprop_cell(void *fdt, int nodeoffset, in fdt_appendprop_cell()
1915 * fdt_appendprop_string - append a string to a property
1917 * @nodeoffset: offset of the node whose property to change
1918 * @name: name of the property to change
1919 * @str: string value to append to the property
1922 * the named property in the given node, or creates a new property
1930 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
1931 * contain the new property value
1932 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1933 * -FDT_ERR_BADLAYOUT,
1934 * -FDT_ERR_BADMAGIC,
1935 * -FDT_ERR_BADVERSION,
1936 * -FDT_ERR_BADSTATE,
1937 * -FDT_ERR_BADSTRUCTURE,
1938 * -FDT_ERR_BADLAYOUT,
1939 * -FDT_ERR_TRUNCATED, standard meanings
1945 * fdt_appendprop_addrrange - append a address range property
1948 * @nodeoffset: offset of the node to add a property at
1949 * @name: name of property
1954 * address and size) to the value of the named property in the given
1955 * node, or creates a new property with that value if it does not
1958 * Cell sizes are determined by parent's #address-cells and #size-cells.
1965 * -FDT_ERR_BADLAYOUT,
1966 * -FDT_ERR_BADMAGIC,
1967 * -FDT_ERR_BADNCELLS, if the node has a badly formatted or invalid
1968 * #address-cells property
1969 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1970 * -FDT_ERR_BADSTATE,
1971 * -FDT_ERR_BADSTRUCTURE,
1972 * -FDT_ERR_BADVERSION,
1973 * -FDT_ERR_BADVALUE, addr or size doesn't fit to respective cells size
1974 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
1975 * contain a new property
1976 * -FDT_ERR_TRUNCATED, standard meanings
1978 int fdt_appendprop_addrrange(void *fdt, int parent, int nodeoffset,
1982 * fdt_delprop - delete a property
1984 * @nodeoffset: offset of the node whose property to nop
1985 * @name: name of the property to nop
1987 * fdt_del_property() will delete the given property.
1994 * -FDT_ERR_NOTFOUND, node does not have the named property
1995 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1996 * -FDT_ERR_BADLAYOUT,
1997 * -FDT_ERR_BADMAGIC,
1998 * -FDT_ERR_BADVERSION,
1999 * -FDT_ERR_BADSTATE,
2000 * -FDT_ERR_BADSTRUCTURE,
2001 * -FDT_ERR_TRUNCATED, standard meanings
2003 int fdt_delprop(void *fdt, int nodeoffset, const char *name);
2006 * fdt_add_subnode_namelen - creates a new node based on substring
2021 int fdt_add_subnode_namelen(void *fdt, int parentoffset,
2022 const char *name, int namelen);
2026 * fdt_add_subnode - creates a new node
2041 * -FDT_ERR_NOTFOUND, if the requested subnode does not exist
2042 * -FDT_ERR_BADOFFSET, if parentoffset did not point to an FDT_BEGIN_NODE
2044 * -FDT_ERR_EXISTS, if the node at parentoffset already has a subnode of
2046 * -FDT_ERR_NOSPACE, if there is insufficient free space in the
2048 * -FDT_ERR_NOSPACE
2049 * -FDT_ERR_BADLAYOUT
2050 * -FDT_ERR_BADMAGIC,
2051 * -FDT_ERR_BADVERSION,
2052 * -FDT_ERR_BADSTATE,
2053 * -FDT_ERR_BADSTRUCTURE,
2054 * -FDT_ERR_TRUNCATED, standard meanings.
2056 int fdt_add_subnode(void *fdt, int parentoffset, const char *name);
2059 * fdt_del_node - delete a node (subtree)
2071 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
2072 * -FDT_ERR_BADLAYOUT,
2073 * -FDT_ERR_BADMAGIC,
2074 * -FDT_ERR_BADVERSION,
2075 * -FDT_ERR_BADSTATE,
2076 * -FDT_ERR_BADSTRUCTURE,
2077 * -FDT_ERR_TRUNCATED, standard meanings
2079 int fdt_del_node(void *fdt, int nodeoffset);
2082 * fdt_overlay_apply - Applies a DT overlay on a base DT
2094 * -FDT_ERR_NOSPACE, there's not enough space in the base device tree
2095 * -FDT_ERR_NOTFOUND, the overlay points to some inexistant nodes or
2097 * -FDT_ERR_BADPHANDLE,
2098 * -FDT_ERR_BADOVERLAY,
2099 * -FDT_ERR_NOPHANDLES,
2100 * -FDT_ERR_INTERNAL,
2101 * -FDT_ERR_BADLAYOUT,
2102 * -FDT_ERR_BADMAGIC,
2103 * -FDT_ERR_BADOFFSET,
2104 * -FDT_ERR_BADPATH,
2105 * -FDT_ERR_BADVERSION,
2106 * -FDT_ERR_BADSTRUCTURE,
2107 * -FDT_ERR_BADSTATE,
2108 * -FDT_ERR_TRUNCATED, standard meanings
2110 int fdt_overlay_apply(void *fdt, void *fdto);
2116 const char *fdt_strerror(int errval);