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
528 * first component is treated as an alias. That is, the property by
530 * property used in place of that first component.
554 * -FDT_ERR_BADPATH, given path does not begin with '/' and the first
556 * -FDT_ERR_NOTFOUND, if the requested node does not exist
557 * -FDT_ERR_BADMAGIC,
558 * -FDT_ERR_BADVERSION,
559 * -FDT_ERR_BADSTATE,
560 * -FDT_ERR_BADSTRUCTURE,
561 * -FDT_ERR_TRUNCATED, standard meanings.
563 int fdt_path_offset(const void *fdt, const char *path);
566 * fdt_get_name - retrieve the name of a given node
573 * non-NULL, the length of this name is also returned, in the integer
578 * If lenp is non-NULL, *lenp contains the length of that name
581 * if lenp is non-NULL *lenp contains an error code (<0):
582 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE
584 * -FDT_ERR_BADMAGIC,
585 * -FDT_ERR_BADVERSION,
586 * -FDT_ERR_BADSTATE, standard meanings
588 const char *fdt_get_name(const void *fdt, int nodeoffset, int *lenp);
591 * fdt_first_property_offset - find the offset of a node's first property
595 * fdt_first_property_offset() finds the first property of the node at
599 * structure block offset of the property (>=0), on success
600 * -FDT_ERR_NOTFOUND, if the requested node has no properties
601 * -FDT_ERR_BADOFFSET, if nodeoffset did not point to an FDT_BEGIN_NODE tag
602 * -FDT_ERR_BADMAGIC,
603 * -FDT_ERR_BADVERSION,
604 * -FDT_ERR_BADSTATE,
605 * -FDT_ERR_BADSTRUCTURE,
606 * -FDT_ERR_TRUNCATED, standard meanings.
608 int fdt_first_property_offset(const void *fdt, int nodeoffset);
611 * fdt_next_property_offset - step through a node's properties
613 * @offset: structure block offset of a property
615 * fdt_next_property_offset() finds the property immediately after the
616 * one at the given structure block offset. This will be a property
617 * of the same node as the given property.
620 * structure block offset of the next property (>=0), on success
621 * -FDT_ERR_NOTFOUND, if the given property is the last in its node
622 * -FDT_ERR_BADOFFSET, if nodeoffset did not point to an FDT_PROP tag
623 * -FDT_ERR_BADMAGIC,
624 * -FDT_ERR_BADVERSION,
625 * -FDT_ERR_BADSTATE,
626 * -FDT_ERR_BADSTRUCTURE,
627 * -FDT_ERR_TRUNCATED, standard meanings.
629 int fdt_next_property_offset(const void *fdt, int offset);
632 * fdt_for_each_property_offset - iterate over all properties of a node
634 * @property: property offset (int, lvalue)
636 * @node: node offset (int)
640 * fdt_for_each_property_offset(property, fdt, node) {
641 * Use property
645 * if ((property < 0) && (property != -FDT_ERR_NOTFOUND)) {
649 * Note that this is implemented as a macro and property is used as
653 #define fdt_for_each_property_offset(property, fdt, node) \ argument
654 for (property = fdt_first_property_offset(fdt, node); \
655 property >= 0; \
656 property = fdt_next_property_offset(fdt, property))
659 * fdt_get_property_by_offset - retrieve the property at a given offset
661 * @offset: offset of the property to retrieve
666 * offset. If lenp is non-NULL, the length of the property value is
673 * pointer to the structure representing the property
674 * if lenp is non-NULL, *lenp contains the length of the property
677 * if lenp is non-NULL, *lenp contains an error code (<0):
678 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_PROP tag
679 * -FDT_ERR_BADMAGIC,
680 * -FDT_ERR_BADVERSION,
681 * -FDT_ERR_BADSTATE,
682 * -FDT_ERR_BADSTRUCTURE,
683 * -FDT_ERR_TRUNCATED, standard meanings
686 int offset,
687 int *lenp);
689 int offset, in fdt_get_property_by_offset_w()
690 int *lenp) in fdt_get_property_by_offset_w()
697 * fdt_get_property_namelen - find a property based on substring
699 * @nodeoffset: offset of the node whose property to find
700 * @name: name of the property to find
705 * characters of name for matching the property name.
707 * Return: pointer to the structure representing the property, or NULL
712 int nodeoffset,
714 int namelen, int *lenp);
718 * fdt_get_property - find a given property in a given node
720 * @nodeoffset: offset of the node whose property to find
721 * @name: name of the property to find
725 * structure within the device tree blob corresponding to the property
727 * non-NULL, the length of the property value is also returned, in the
731 * pointer to the structure representing the property
732 * if lenp is non-NULL, *lenp contains the length of the property
735 * if lenp is non-NULL, *lenp contains an error code (<0):
736 * -FDT_ERR_NOTFOUND, node does not have named property
737 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE
739 * -FDT_ERR_BADMAGIC,
740 * -FDT_ERR_BADVERSION,
741 * -FDT_ERR_BADSTATE,
742 * -FDT_ERR_BADSTRUCTURE,
743 * -FDT_ERR_TRUNCATED, standard meanings
745 const struct fdt_property *fdt_get_property(const void *fdt, int nodeoffset,
746 const char *name, int *lenp);
747 static inline struct fdt_property *fdt_get_property_w(void *fdt, int nodeoffset, in fdt_get_property_w()
749 int *lenp) in fdt_get_property_w()
756 * fdt_getprop_by_offset - retrieve the value of a property at a given offset
758 * @offset: offset of the property to read
763 * property at structure block offset 'offset' (this will be a pointer
765 * lenp is non-NULL, the length of the property value is also
766 * returned, in the integer pointed to by lenp. If namep is non-NULL,
767 * the property's namne will also be returned in the char * pointed to
772 * pointer to the property's value
773 * if lenp is non-NULL, *lenp contains the length of the property
775 * if namep is non-NULL *namep contiains a pointer to the property
778 * if lenp is non-NULL, *lenp contains an error code (<0):
779 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_PROP tag
780 * -FDT_ERR_BADMAGIC,
781 * -FDT_ERR_BADVERSION,
782 * -FDT_ERR_BADSTATE,
783 * -FDT_ERR_BADSTRUCTURE,
784 * -FDT_ERR_TRUNCATED, standard meanings
787 const void *fdt_getprop_by_offset(const void *fdt, int offset,
788 const char **namep, int *lenp);
792 * fdt_getprop_namelen - get property value based on substring
794 * @nodeoffset: offset of the node whose property to find
795 * @name: name of the property to find
800 * characters of name for matching the property name.
802 * Return: pointer to the property's value or NULL on error
805 const void *fdt_getprop_namelen(const void *fdt, int nodeoffset,
806 const char *name, int namelen, int *lenp);
807 static inline void *fdt_getprop_namelen_w(void *fdt, int nodeoffset, in fdt_getprop_namelen_w()
808 const char *name, int namelen, in fdt_getprop_namelen_w()
809 int *lenp) in fdt_getprop_namelen_w()
817 * fdt_getprop - retrieve the value of a given property
819 * @nodeoffset: offset of the node whose property to find
820 * @name: name of the property to find
823 * fdt_getprop() retrieves a pointer to the value of the property
826 * If @lenp is non-NULL, the length of the property value is also
830 * pointer to the property's value
831 * if lenp is non-NULL, *lenp contains the length of the property
834 * if lenp is non-NULL, *lenp contains an error code (<0):
835 * -FDT_ERR_NOTFOUND, node does not have named property
836 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE
838 * -FDT_ERR_BADMAGIC,
839 * -FDT_ERR_BADVERSION,
840 * -FDT_ERR_BADSTATE,
841 * -FDT_ERR_BADSTRUCTURE,
842 * -FDT_ERR_TRUNCATED, standard meanings
844 const void *fdt_getprop(const void *fdt, int nodeoffset,
845 const char *name, int *lenp);
846 static inline void *fdt_getprop_w(void *fdt, int nodeoffset, in fdt_getprop_w()
847 const char *name, int *lenp) in fdt_getprop_w()
853 * fdt_get_phandle - retrieve the phandle of a given node
861 * the phandle of the node at nodeoffset, on success (!= 0, != -1)
864 uint32_t fdt_get_phandle(const void *fdt, int nodeoffset);
867 * fdt_get_alias_namelen - get alias based on substring
880 const char *name, int namelen);
884 * fdt_get_alias - retrieve the path referenced by a given alias
889 * value of the property named @name in the node /aliases.
898 * fdt_get_symbol_namelen - get symbol based on substring
911 const char *name, int namelen);
915 * fdt_get_symbol - retrieve the path referenced by a given symbol
920 * the value of the property named @name in the node
922 * has been compiled with the -@ dtc option. Each property corresponds
924 * the property being the label and the value being the full path of
934 * fdt_get_path - determine the full path of a node
949 * nodeoffset, as a NUL-terminated string.
950 * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
951 * -FDT_ERR_NOSPACE, the path of the given node is longer than (bufsize-1)
953 * -FDT_ERR_BADMAGIC,
954 * -FDT_ERR_BADVERSION,
955 * -FDT_ERR_BADSTATE,
956 * -FDT_ERR_BADSTRUCTURE, standard meanings
958 int fdt_get_path(const void *fdt, int nodeoffset, char *buf, int buflen);
961 * fdt_supernode_atdepth_offset - find a specific ancestor of a node
982 * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
983 * -FDT_ERR_NOTFOUND, supernodedepth was greater than the depth of
985 * -FDT_ERR_BADMAGIC,
986 * -FDT_ERR_BADVERSION,
987 * -FDT_ERR_BADSTATE,
988 * -FDT_ERR_BADSTRUCTURE, standard meanings
990 int fdt_supernode_atdepth_offset(const void *fdt, int nodeoffset,
991 int supernodedepth, int *nodedepth);
994 * fdt_node_depth - find the depth of a given node
1006 * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
1007 * -FDT_ERR_BADMAGIC,
1008 * -FDT_ERR_BADVERSION,
1009 * -FDT_ERR_BADSTATE,
1010 * -FDT_ERR_BADSTRUCTURE, standard meanings
1012 int fdt_node_depth(const void *fdt, int nodeoffset);
1015 * fdt_parent_offset - find the parent of a given node
1029 * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
1030 * -FDT_ERR_BADMAGIC,
1031 * -FDT_ERR_BADVERSION,
1032 * -FDT_ERR_BADSTATE,
1033 * -FDT_ERR_BADSTRUCTURE, standard meanings
1035 int fdt_parent_offset(const void *fdt, int nodeoffset);
1038 * fdt_node_offset_by_prop_value - find nodes with a given property value
1041 * @propname: property name to check
1042 * @propval: property value to search for
1046 * node after startoffset, which has a property named propname whose
1048 * startoffset is -1, the very first such node in the tree.
1052 * offset = fdt_node_offset_by_prop_value(fdt, -1, propname,
1054 * while (offset != -FDT_ERR_NOTFOUND) {
1060 * Note the -1 in the first call to the function, if 0 is used here
1067 * -FDT_ERR_NOTFOUND, no node matching the criterion exists in the
1069 * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
1070 * -FDT_ERR_BADMAGIC,
1071 * -FDT_ERR_BADVERSION,
1072 * -FDT_ERR_BADSTATE,
1073 * -FDT_ERR_BADSTRUCTURE, standard meanings
1075 int fdt_node_offset_by_prop_value(const void *fdt, int startoffset,
1077 const void *propval, int proplen);
1080 * fdt_node_offset_by_phandle - find the node with a given phandle
1091 * -FDT_ERR_NOTFOUND, no node with that phandle exists
1092 * -FDT_ERR_BADPHANDLE, given phandle value was invalid (0 or -1)
1093 * -FDT_ERR_BADMAGIC,
1094 * -FDT_ERR_BADVERSION,
1095 * -FDT_ERR_BADSTATE,
1096 * -FDT_ERR_BADSTRUCTURE, standard meanings
1098 int fdt_node_offset_by_phandle(const void *fdt, uint32_t phandle);
1101 * fdt_node_check_compatible - check a node's compatible property
1107 * @compatible property with the given string as one of its elements,
1108 * it returns non-zero otherwise, or on error.
1111 * 0, if the node has a 'compatible' property listing the given string
1112 * 1, if the node has a 'compatible' property, but it does not list
1114 * -FDT_ERR_NOTFOUND, if the given node has no 'compatible' property
1115 * -FDT_ERR_BADOFFSET, if nodeoffset does not refer to a BEGIN_NODE tag
1116 * -FDT_ERR_BADMAGIC,
1117 * -FDT_ERR_BADVERSION,
1118 * -FDT_ERR_BADSTATE,
1119 * -FDT_ERR_BADSTRUCTURE, standard meanings
1121 int fdt_node_check_compatible(const void *fdt, int nodeoffset,
1125 * fdt_node_offset_by_compatible - find nodes with a given 'compatible' value
1131 * node after startoffset, which has a 'compatible' property which
1132 * lists the given compatible string; or if startoffset is -1, the
1137 * offset = fdt_node_offset_by_compatible(fdt, -1, compatible);
1138 * while (offset != -FDT_ERR_NOTFOUND) {
1143 * Note the -1 in the first call to the function, if 0 is used here
1150 * -FDT_ERR_NOTFOUND, no node matching the criterion exists in the
1152 * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
1153 * -FDT_ERR_BADMAGIC,
1154 * -FDT_ERR_BADVERSION,
1155 * -FDT_ERR_BADSTATE,
1156 * -FDT_ERR_BADSTRUCTURE, standard meanings
1158 int fdt_node_offset_by_compatible(const void *fdt, int startoffset,
1162 * fdt_stringlist_contains - check a string list property for a string
1163 * @strlist: Property containing a list of strings to check
1164 * @listlen: Length of property
1169 * "compatible" property.
1173 int fdt_stringlist_contains(const char *strlist, int listlen, const char *str);
1176 * fdt_stringlist_count - count the number of strings in a string list
1179 * @property: name of the property containing the string list
1182 * the number of strings in the given property
1183 * -FDT_ERR_BADVALUE if the property value is not NUL-terminated
1184 * -FDT_ERR_NOTFOUND if the property does not exist
1186 int fdt_stringlist_count(const void *fdt, int nodeoffset, const char *property);
1189 * fdt_stringlist_search - find a string in a string list and return its index
1192 * @property: name of the property containing the string list
1195 * Note that it is possible for this function to succeed on property values
1196 * that are not NUL-terminated. That's because the function will stop after
1198 * small-valued cell properties, such as #address-cells, when searching for
1203 * -FDT_ERR_BADVALUE if the property value is not NUL-terminated
1204 * -FDT_ERR_NOTFOUND if the property does not exist or does not contain
1207 int fdt_stringlist_search(const void *fdt, int nodeoffset, const char *property,
1211 * fdt_stringlist_get() - obtain the string at a given index in a string list
1214 * @property: name of the property containing the string list
1219 * non-NUL-terminated values. For example on small-valued cell properties
1222 * If non-NULL, the length of the string (on success) or a negative error-code
1228 * location pointed to by the lenp parameter, if non-NULL. On failure one of
1230 * (if non-NULL):
1231 * -FDT_ERR_BADVALUE if the property value is not NUL-terminated
1232 * -FDT_ERR_NOTFOUND if the property does not exist
1234 const char *fdt_stringlist_get(const void *fdt, int nodeoffset,
1235 const char *property, int index,
1236 int *lenp);
1239 /* Read-only functions (addressing related) */
1243 * FDT_MAX_NCELLS - maximum value for #address-cells and #size-cells
1245 * This is the maximum value for #address-cells, #size-cells and
1254 * fdt_address_cells - retrieve address size for a bus represented in the tree
1258 * When the node has a valid #address-cells property, returns its value.
1262 * 2, if the node has no #address-cells property
1263 * -FDT_ERR_BADNCELLS, if the node has a badly formatted or invalid
1264 * #address-cells property
1265 * -FDT_ERR_BADMAGIC,
1266 * -FDT_ERR_BADVERSION,
1267 * -FDT_ERR_BADSTATE,
1268 * -FDT_ERR_BADSTRUCTURE,
1269 * -FDT_ERR_TRUNCATED, standard meanings
1271 int fdt_address_cells(const void *fdt, int nodeoffset);
1274 * fdt_size_cells - retrieve address range size for a bus represented in the
1279 * When the node has a valid #size-cells property, returns its value.
1283 * 1, if the node has no #size-cells property
1284 * -FDT_ERR_BADNCELLS, if the node has a badly formatted or invalid
1285 * #size-cells property
1286 * -FDT_ERR_BADMAGIC,
1287 * -FDT_ERR_BADVERSION,
1288 * -FDT_ERR_BADSTATE,
1289 * -FDT_ERR_BADSTRUCTURE,
1290 * -FDT_ERR_TRUNCATED, standard meanings
1292 int fdt_size_cells(const void *fdt, int nodeoffset);
1296 /* Write-in-place functions */
1300 * fdt_setprop_inplace_namelen_partial - change a property's value,
1303 * @nodeoffset: offset of the node whose property to change
1304 * @name: name of the property to change
1306 * @idx: index of the property to change in the array
1307 * @val: pointer to data to replace the property value with
1308 * @len: length of the property value
1310 * Identical to fdt_setprop_inplace(), but modifies the given property
1318 int fdt_setprop_inplace_namelen_partial(void *fdt, int nodeoffset,
1319 const char *name, int namelen,
1321 int len);
1325 * fdt_setprop_inplace - change a property's value, but not its size
1327 * @nodeoffset: offset of the node whose property to change
1328 * @name: name of the property to change
1329 * @val: pointer to data to replace the property value with
1330 * @len: length of the property value
1332 * fdt_setprop_inplace() replaces the value of a given property with
1334 * size of a property, and so will only work if len is equal to the
1335 * current length of the property.
1338 * the given property value, and will not alter or move any other part
1343 * -FDT_ERR_NOSPACE, if len is not equal to the property's current length
1344 * -FDT_ERR_NOTFOUND, node does not have the named property
1345 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1346 * -FDT_ERR_BADMAGIC,
1347 * -FDT_ERR_BADVERSION,
1348 * -FDT_ERR_BADSTATE,
1349 * -FDT_ERR_BADSTRUCTURE,
1350 * -FDT_ERR_TRUNCATED, standard meanings
1353 int fdt_setprop_inplace(void *fdt, int nodeoffset, const char *name,
1354 const void *val, int len);
1358 * fdt_setprop_inplace_u32 - change the value of a 32-bit integer property
1360 * @nodeoffset: offset of the node whose property to change
1361 * @name: name of the property to change
1362 * @val: 32-bit integer value to replace the property with
1364 * fdt_setprop_inplace_u32() replaces the value of a given property
1365 * with the 32-bit integer value in val, converting val to big-endian
1366 * if necessary. This function cannot change the size of a property,
1367 * and so will only work if the property already exists and has length
1371 * the given property value, and will not alter or move any other part
1376 * -FDT_ERR_NOSPACE, if the property's length is not equal to 4
1377 * -FDT_ERR_NOTFOUND, node does not have the named property
1378 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1379 * -FDT_ERR_BADMAGIC,
1380 * -FDT_ERR_BADVERSION,
1381 * -FDT_ERR_BADSTATE,
1382 * -FDT_ERR_BADSTRUCTURE,
1383 * -FDT_ERR_TRUNCATED, standard meanings
1385 static inline int fdt_setprop_inplace_u32(void *fdt, int nodeoffset, in fdt_setprop_inplace_u32()
1393 * fdt_setprop_inplace_u64 - change the value of a 64-bit integer property
1395 * @nodeoffset: offset of the node whose property to change
1396 * @name: name of the property to change
1397 * @val: 64-bit integer value to replace the property with
1399 * fdt_setprop_inplace_u64() replaces the value of a given property
1400 * with the 64-bit integer value in val, converting val to big-endian
1401 * if necessary. This function cannot change the size of a property,
1402 * and so will only work if the property already exists and has length
1406 * the given property value, and will not alter or move any other part
1411 * -FDT_ERR_NOSPACE, if the property's length is not equal to 8
1412 * -FDT_ERR_NOTFOUND, node does not have the named property
1413 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1414 * -FDT_ERR_BADMAGIC,
1415 * -FDT_ERR_BADVERSION,
1416 * -FDT_ERR_BADSTATE,
1417 * -FDT_ERR_BADSTRUCTURE,
1418 * -FDT_ERR_TRUNCATED, standard meanings
1420 static inline int fdt_setprop_inplace_u64(void *fdt, int nodeoffset, in fdt_setprop_inplace_u64()
1428 * fdt_setprop_inplace_cell - change the value of a single-cell property
1430 * @nodeoffset: offset of the node containing the property
1431 * @name: name of the property to change the value of
1432 * @val: new value of the 32-bit cell
1437 static inline int fdt_setprop_inplace_cell(void *fdt, int nodeoffset, in fdt_setprop_inplace_cell()
1444 * fdt_nop_property - replace a property with nop tags
1446 * @nodeoffset: offset of the node whose property to nop
1447 * @name: name of the property to nop
1449 * fdt_nop_property() will replace a given property's representation
1454 * the property, and will not alter or move any other part of the
1459 * -FDT_ERR_NOTFOUND, node does not have the named property
1460 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1461 * -FDT_ERR_BADMAGIC,
1462 * -FDT_ERR_BADVERSION,
1463 * -FDT_ERR_BADSTATE,
1464 * -FDT_ERR_BADSTRUCTURE,
1465 * -FDT_ERR_TRUNCATED, standard meanings
1467 int fdt_nop_property(void *fdt, int nodeoffset, const char *name);
1470 * fdt_nop_node - replace a node (subtree) with nop tags
1484 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1485 * -FDT_ERR_BADMAGIC,
1486 * -FDT_ERR_BADVERSION,
1487 * -FDT_ERR_BADSTATE,
1488 * -FDT_ERR_BADSTRUCTURE,
1489 * -FDT_ERR_TRUNCATED, standard meanings
1491 int fdt_nop_node(void *fdt, int nodeoffset);
1499 /* FDT_CREATE_FLAG_NO_NAME_DEDUP: Do not try to de-duplicate property
1506 * fdt_create_with_flags - begin creation of a new fdt
1518 * -FDT_ERR_NOSPACE, bufsize is insufficient for a minimal fdt
1519 * -FDT_ERR_BADFLAGS, flags is not valid
1521 int fdt_create_with_flags(void *buf, int bufsize, uint32_t flags);
1524 * fdt_create - begin creation of a new fdt
1532 * -FDT_ERR_NOSPACE, bufsize is insufficient for a minimal fdt
1534 int fdt_create(void *buf, int bufsize);
1536 int fdt_resize(void *fdt, void *buf, int bufsize);
1537 int fdt_add_reservemap_entry(void *fdt, uint64_t addr, uint64_t size);
1538 int fdt_finish_reservemap(void *fdt);
1539 int fdt_begin_node(void *fdt, const char *name);
1540 int fdt_property(void *fdt, const char *name, const void *val, int len);
1541 static inline int fdt_property_u32(void *fdt, const char *name, uint32_t val) in fdt_property_u32()
1546 static inline int fdt_property_u64(void *fdt, const char *name, uint64_t val) in fdt_property_u64()
1553 static inline int fdt_property_cell(void *fdt, const char *name, uint32_t val) in fdt_property_cell()
1560 * fdt_property_placeholder - add a new property and return a ptr to its value
1563 * @name: name of property to add
1564 * @len: length of property value in bytes
1569 * -FDT_ERR_BADMAGIC,
1570 * -FDT_ERR_NOSPACE, standard meanings
1572 int fdt_property_placeholder(void *fdt, const char *name, int len, void **valp);
1576 int fdt_end_node(void *fdt);
1577 int fdt_finish(void *fdt);
1580 /* Read-write functions */
1583 int fdt_create_empty_tree(void *buf, int bufsize);
1584 int fdt_open_into(const void *fdt, void *buf, int bufsize);
1585 int fdt_pack(void *fdt);
1588 * fdt_add_mem_rsv - add one memory reserve map entry
1590 * @address: 64-bit start address of the reserve map entry
1591 * @size: 64-bit size of the reserved region
1601 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
1603 * -FDT_ERR_BADMAGIC,
1604 * -FDT_ERR_BADVERSION,
1605 * -FDT_ERR_BADSTATE,
1606 * -FDT_ERR_BADSTRUCTURE,
1607 * -FDT_ERR_BADLAYOUT,
1608 * -FDT_ERR_TRUNCATED, standard meanings
1610 int fdt_add_mem_rsv(void *fdt, uint64_t address, uint64_t size);
1613 * fdt_del_mem_rsv - remove a memory reserve map entry
1617 * fdt_del_mem_rsv() removes the n-th memory reserve map entry from
1625 * -FDT_ERR_NOTFOUND, there is no entry of the given index (i.e. there
1627 * -FDT_ERR_BADMAGIC,
1628 * -FDT_ERR_BADVERSION,
1629 * -FDT_ERR_BADSTATE,
1630 * -FDT_ERR_BADSTRUCTURE,
1631 * -FDT_ERR_BADLAYOUT,
1632 * -FDT_ERR_TRUNCATED, standard meanings
1634 int fdt_del_mem_rsv(void *fdt, int n);
1637 * fdt_set_name - change the name of a given node
1653 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob
1655 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1656 * -FDT_ERR_BADMAGIC,
1657 * -FDT_ERR_BADVERSION,
1658 * -FDT_ERR_BADSTATE, standard meanings
1660 int fdt_set_name(void *fdt, int nodeoffset, const char *name);
1663 * fdt_setprop - create or change a property
1665 * @nodeoffset: offset of the node whose property to change
1666 * @name: name of the property to change
1667 * @val: pointer to data to set the property value to
1668 * @len: length of the property value
1670 * fdt_setprop() sets the value of the named property in the given
1671 * node to the given value and length, creating the property if it
1679 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
1680 * contain the new property value
1681 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1682 * -FDT_ERR_BADLAYOUT,
1683 * -FDT_ERR_BADMAGIC,
1684 * -FDT_ERR_BADVERSION,
1685 * -FDT_ERR_BADSTATE,
1686 * -FDT_ERR_BADSTRUCTURE,
1687 * -FDT_ERR_BADLAYOUT,
1688 * -FDT_ERR_TRUNCATED, standard meanings
1690 int fdt_setprop(void *fdt, int nodeoffset, const char *name,
1691 const void *val, int len);
1694 * fdt_setprop_placeholder - allocate space for a property
1696 * @nodeoffset: offset of the node whose property to change
1697 * @name: name of the property to change
1698 * @len: length of the property value
1699 * @prop_data: return pointer to property data
1701 * fdt_setprop_placeholer() allocates the named property in the given node.
1702 * If the property exists it is resized. In either case a pointer to the
1703 * property data is returned.
1710 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
1711 * contain the new property value
1712 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1713 * -FDT_ERR_BADLAYOUT,
1714 * -FDT_ERR_BADMAGIC,
1715 * -FDT_ERR_BADVERSION,
1716 * -FDT_ERR_BADSTATE,
1717 * -FDT_ERR_BADSTRUCTURE,
1718 * -FDT_ERR_BADLAYOUT,
1719 * -FDT_ERR_TRUNCATED, standard meanings
1721 int fdt_setprop_placeholder(void *fdt, int nodeoffset, const char *name,
1722 int len, void **prop_data);
1725 * fdt_setprop_u32 - set a property to a 32-bit integer
1727 * @nodeoffset: offset of the node whose property to change
1728 * @name: name of the property to change
1729 * @val: 32-bit integer value for the property (native endian)
1731 * fdt_setprop_u32() sets the value of the named property in the given
1732 * node to the given 32-bit integer value (converting to big-endian if
1733 * necessary), or creates a new property with that value if it does
1741 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
1742 * contain the new property value
1743 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1744 * -FDT_ERR_BADLAYOUT,
1745 * -FDT_ERR_BADMAGIC,
1746 * -FDT_ERR_BADVERSION,
1747 * -FDT_ERR_BADSTATE,
1748 * -FDT_ERR_BADSTRUCTURE,
1749 * -FDT_ERR_BADLAYOUT,
1750 * -FDT_ERR_TRUNCATED, standard meanings
1752 static inline int fdt_setprop_u32(void *fdt, int nodeoffset, const char *name, in fdt_setprop_u32()
1760 * fdt_setprop_u64 - set a property to a 64-bit integer
1762 * @nodeoffset: offset of the node whose property to change
1763 * @name: name of the property to change
1764 * @val: 64-bit integer value for the property (native endian)
1766 * fdt_setprop_u64() sets the value of the named property in the given
1767 * node to the given 64-bit integer value (converting to big-endian if
1768 * necessary), or creates a new property with that value if it does
1776 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
1777 * contain the new property value
1778 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1779 * -FDT_ERR_BADLAYOUT,
1780 * -FDT_ERR_BADMAGIC,
1781 * -FDT_ERR_BADVERSION,
1782 * -FDT_ERR_BADSTATE,
1783 * -FDT_ERR_BADSTRUCTURE,
1784 * -FDT_ERR_BADLAYOUT,
1785 * -FDT_ERR_TRUNCATED, standard meanings
1787 static inline int fdt_setprop_u64(void *fdt, int nodeoffset, const char *name, in fdt_setprop_u64()
1795 * fdt_setprop_cell - set a property to a single cell value
1797 * @nodeoffset: offset of the node whose property to change
1798 * @name: name of the property to change
1799 * @val: 32-bit integer value for the property (native endian)
1805 static inline int fdt_setprop_cell(void *fdt, int nodeoffset, const char *name, in fdt_setprop_cell()
1812 * fdt_setprop_string - set a property to a string value
1814 * @nodeoffset: offset of the node whose property to change
1815 * @name: name of the property to change
1816 * @str: string value for the property
1818 * fdt_setprop_string() sets the value of the named property in the
1820 * string to determine the new length of the property), or creates a
1821 * new property with that value if it does not already exist.
1828 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
1829 * contain the new property value
1830 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1831 * -FDT_ERR_BADLAYOUT,
1832 * -FDT_ERR_BADMAGIC,
1833 * -FDT_ERR_BADVERSION,
1834 * -FDT_ERR_BADSTATE,
1835 * -FDT_ERR_BADSTRUCTURE,
1836 * -FDT_ERR_BADLAYOUT,
1837 * -FDT_ERR_TRUNCATED, standard meanings
1844 * fdt_setprop_empty - set a property to an empty value
1846 * @nodeoffset: offset of the node whose property to change
1847 * @name: name of the property to change
1849 * fdt_setprop_empty() sets the value of the named property in the
1851 * property if it does not already exist.
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
1873 * fdt_appendprop - append to or create a property
1875 * @nodeoffset: offset of the node whose property to change
1876 * @name: name of the property to append to
1877 * @val: pointer to data to append to the property value
1878 * @len: length of the data to append to the property value
1880 * fdt_appendprop() appends the value to the named property in the
1881 * given node, creating the property if it does not already exist.
1888 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
1889 * contain the new property value
1890 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1891 * -FDT_ERR_BADLAYOUT,
1892 * -FDT_ERR_BADMAGIC,
1893 * -FDT_ERR_BADVERSION,
1894 * -FDT_ERR_BADSTATE,
1895 * -FDT_ERR_BADSTRUCTURE,
1896 * -FDT_ERR_BADLAYOUT,
1897 * -FDT_ERR_TRUNCATED, standard meanings
1899 int fdt_appendprop(void *fdt, int nodeoffset, const char *name,
1900 const void *val, int len);
1903 * fdt_appendprop_u32 - append a 32-bit integer value to a property
1905 * @nodeoffset: offset of the node whose property to change
1906 * @name: name of the property to change
1907 * @val: 32-bit integer value to append to the property (native endian)
1909 * fdt_appendprop_u32() appends the given 32-bit integer value
1910 * (converting to big-endian if necessary) to the value of the named
1911 * property in the given node, or creates a new property with that
1919 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
1920 * contain the new property value
1921 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
1922 * -FDT_ERR_BADLAYOUT,
1923 * -FDT_ERR_BADMAGIC,
1924 * -FDT_ERR_BADVERSION,
1925 * -FDT_ERR_BADSTATE,
1926 * -FDT_ERR_BADSTRUCTURE,
1927 * -FDT_ERR_BADLAYOUT,
1928 * -FDT_ERR_TRUNCATED, standard meanings
1930 static inline int fdt_appendprop_u32(void *fdt, int nodeoffset, in fdt_appendprop_u32()
1938 * fdt_appendprop_u64 - append a 64-bit integer value to a property
1940 * @nodeoffset: offset of the node whose property to change
1941 * @name: name of the property to change
1942 * @val: 64-bit integer value to append to the property (native endian)
1944 * fdt_appendprop_u64() appends the given 64-bit integer value
1945 * (converting to big-endian if necessary) to the value of the named
1946 * property in the given node, or creates a new property with that
1954 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
1955 * contain the new property value
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_BADLAYOUT,
1963 * -FDT_ERR_TRUNCATED, standard meanings
1965 static inline int fdt_appendprop_u64(void *fdt, int nodeoffset, in fdt_appendprop_u64()
1973 * fdt_appendprop_cell - append a single cell value to a property
1975 * @nodeoffset: offset of the node whose property to change
1976 * @name: name of the property to change
1977 * @val: 32-bit integer value to append to the property (native endian)
1983 static inline int fdt_appendprop_cell(void *fdt, int nodeoffset, in fdt_appendprop_cell()
1990 * fdt_appendprop_string - append a string to a property
1992 * @nodeoffset: offset of the node whose property to change
1993 * @name: name of the property to change
1994 * @str: string value to append to the property
1997 * the named property in the given node, or creates a new property
2005 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
2006 * contain the new property value
2007 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
2008 * -FDT_ERR_BADLAYOUT,
2009 * -FDT_ERR_BADMAGIC,
2010 * -FDT_ERR_BADVERSION,
2011 * -FDT_ERR_BADSTATE,
2012 * -FDT_ERR_BADSTRUCTURE,
2013 * -FDT_ERR_BADLAYOUT,
2014 * -FDT_ERR_TRUNCATED, standard meanings
2020 * fdt_appendprop_addrrange - append a address range property
2023 * @nodeoffset: offset of the node to add a property at
2024 * @name: name of property
2029 * address and size) to the value of the named property in the given
2030 * node, or creates a new property with that value if it does not
2033 * Cell sizes are determined by parent's #address-cells and #size-cells.
2040 * -FDT_ERR_BADLAYOUT,
2041 * -FDT_ERR_BADMAGIC,
2042 * -FDT_ERR_BADNCELLS, if the node has a badly formatted or invalid
2043 * #address-cells property
2044 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
2045 * -FDT_ERR_BADSTATE,
2046 * -FDT_ERR_BADSTRUCTURE,
2047 * -FDT_ERR_BADVERSION,
2048 * -FDT_ERR_BADVALUE, addr or size doesn't fit to respective cells size
2049 * -FDT_ERR_NOSPACE, there is insufficient free space in the blob to
2050 * contain a new property
2051 * -FDT_ERR_TRUNCATED, standard meanings
2053 int fdt_appendprop_addrrange(void *fdt, int parent, int nodeoffset,
2057 * fdt_delprop - delete a property
2059 * @nodeoffset: offset of the node whose property to nop
2060 * @name: name of the property to nop
2062 * fdt_del_property() will delete the given property.
2069 * -FDT_ERR_NOTFOUND, node does not have the named property
2070 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
2071 * -FDT_ERR_BADLAYOUT,
2072 * -FDT_ERR_BADMAGIC,
2073 * -FDT_ERR_BADVERSION,
2074 * -FDT_ERR_BADSTATE,
2075 * -FDT_ERR_BADSTRUCTURE,
2076 * -FDT_ERR_TRUNCATED, standard meanings
2078 int fdt_delprop(void *fdt, int nodeoffset, const char *name);
2081 * fdt_add_subnode_namelen - creates a new node based on substring
2096 int fdt_add_subnode_namelen(void *fdt, int parentoffset,
2097 const char *name, int namelen);
2101 * fdt_add_subnode - creates a new node
2116 * -FDT_ERR_NOTFOUND, if the requested subnode does not exist
2117 * -FDT_ERR_BADOFFSET, if parentoffset did not point to an FDT_BEGIN_NODE
2119 * -FDT_ERR_EXISTS, if the node at parentoffset already has a subnode of
2121 * -FDT_ERR_NOSPACE, if there is insufficient free space in the
2123 * -FDT_ERR_NOSPACE
2124 * -FDT_ERR_BADLAYOUT
2125 * -FDT_ERR_BADMAGIC,
2126 * -FDT_ERR_BADVERSION,
2127 * -FDT_ERR_BADSTATE,
2128 * -FDT_ERR_BADSTRUCTURE,
2129 * -FDT_ERR_TRUNCATED, standard meanings.
2131 int fdt_add_subnode(void *fdt, int parentoffset, const char *name);
2134 * fdt_del_node - delete a node (subtree)
2146 * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
2147 * -FDT_ERR_BADLAYOUT,
2148 * -FDT_ERR_BADMAGIC,
2149 * -FDT_ERR_BADVERSION,
2150 * -FDT_ERR_BADSTATE,
2151 * -FDT_ERR_BADSTRUCTURE,
2152 * -FDT_ERR_TRUNCATED, standard meanings
2154 int fdt_del_node(void *fdt, int nodeoffset);
2157 * fdt_overlay_apply - Applies a DT overlay on a base DT
2169 * -FDT_ERR_NOSPACE, there's not enough space in the base device tree
2170 * -FDT_ERR_NOTFOUND, the overlay points to some inexistant nodes or
2172 * -FDT_ERR_BADPHANDLE,
2173 * -FDT_ERR_BADOVERLAY,
2174 * -FDT_ERR_NOPHANDLES,
2175 * -FDT_ERR_INTERNAL,
2176 * -FDT_ERR_BADLAYOUT,
2177 * -FDT_ERR_BADMAGIC,
2178 * -FDT_ERR_BADOFFSET,
2179 * -FDT_ERR_BADPATH,
2180 * -FDT_ERR_BADVERSION,
2181 * -FDT_ERR_BADSTRUCTURE,
2182 * -FDT_ERR_BADSTATE,
2183 * -FDT_ERR_TRUNCATED, standard meanings
2185 int fdt_overlay_apply(void *fdt, void *fdto);
2188 * fdt_overlay_target_offset - retrieves the offset of a fragment's target
2202 int fdt_overlay_target_offset(const void *fdt, const void *fdto,
2203 int fragment_offset, char const **pathp);
2209 const char *fdt_strerror(int errval);