Lines Matching +full:a +full:- +full:child +full:- +full:node +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
30 * device tree to a buffer with more space. */
34 /* FDT_ERR_BADOFFSET: Function was passed a structure block
35 * offset which is out-of-bounds, or which points to an
38 /* FDT_ERR_BADPATH: Function was passed a badly formatted path
39 * (e.g. missing a leading / for a function which requires 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
57 /* FDT_ERR_BADMAGIC: Given "device tree" appears not to be a
58 * device tree at all - it is missing the flattened device
61 /* FDT_ERR_BADVERSION: Given device tree has a version which
63 * read-write functions, this may mean that fdt_open_into() is
66 /* FDT_ERR_BADSTRUCTURE: Given device tree has a corrupt
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. */
76 /* "Can't happen" error indicating a bug in libfdt */
79 * Should never be returned, if it is, it indicates a bug in
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. */
102 /* FDT_ERR_BADFLAGS: The function was passed a flags field that
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) */
130 * External helpers to access words from a device tree blob. They're built
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()
189 * fdt_first_subnode() - get offset of first direct subnode
191 * @offset: Offset of node to check
193 * Return: offset of first subnode, or -FDT_ERR_NOTFOUND if there is none
198 * fdt_next_subnode() - get offset of next direct subnode
203 * get direct subnodes of a parent node.
205 * Return: offset of next subnode, or -FDT_ERR_NOTFOUND if there are no more
211 * fdt_for_each_subnode - iterate over all subnodes of a parent
213 * @node: child node (int, lvalue)
215 * @parent: parent node (int)
217 * This is actually a wrapper around a for loop and would be used like so:
219 * fdt_for_each_subnode(node, fdt, parent) {
220 * Use node
224 * if ((node < 0) && (node != -FDT_ERR_NOTFOUND)) {
228 * Note that this is implemented as a macro and @node is used as
229 * iterator in the loop. The parent variable be constant or even a
232 #define fdt_for_each_subnode(node, fdt, parent) \ argument
233 for (node = fdt_first_subnode(fdt, parent); \
234 node >= 0; \
235 node = fdt_next_subnode(fdt, node))
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
273 * @fdt: pointer to a flattened device tree
280 * fdt_header_size_ - internal function to get header size from a version number
288 * fdt_check_header - sanity check a device tree header
289 * @fdt: pointer to data which might be a flattened device tree
292 * appears to be a flattened device tree, and that the header contains
297 * 0, if the buffer appears to contain a valid device tree
298 * -FDT_ERR_BADMAGIC,
299 * -FDT_ERR_BADVERSION,
300 * -FDT_ERR_BADSTATE,
301 * -FDT_ERR_TRUNCATED, standard meanings, as above
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
327 /* Read-only functions */
333 * fdt_get_string - retrieve a string from the strings block of a device tree
338 * fdt_get_string() retrieves a pointer to a single string from the
343 * a pointer to the string, on success
344 * NULL, if stroffset is out of bounds, or doesn't point to a valid string
349 * fdt_string - retrieve a string from the strings block of a device tree
353 * fdt_string() retrieves a pointer to a single string from the
357 * a pointer to the string, on success
358 * NULL, if stroffset is out of bounds, or doesn't point to a valid string
363 * fdt_find_max_phandle - find and return the highest phandle in a tree
372 * 0 on success or a negative error code on failure
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
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
418 * fdt_num_mem_rsv - retrieve the number of memory reserve map entries
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
450 * fdt_subnode_offset_namelen - find a subnode based on substring
452 * @parentoffset: structure block offset of a node
458 * useful for finding subnodes based on a portion of a larger string,
459 * such as a full path.
461 * Return: offset of the subnode or -FDT_ERR_NOTFOUND if name not found.
468 * fdt_subnode_offset - find a subnode of a given node
470 * @parentoffset: structure block offset of a node
473 * fdt_subnode_offset() finds a subnode of the node at structure block
474 * offset parentoffset with the given name. name may include a unit
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.
494 * fdt_path_offset_namelen - find a tree node by its full path
496 * @path: full path of the node to locate
502 * Return: offset of the node or negative libfdt error value otherwise
509 * fdt_path_offset - find a tree node by its full path
511 * @path: full path of the node to locate
513 * fdt_path_offset() finds a node of a given path in the device tree.
521 * structure block offset of the node with the requested path (>=0), on
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.
534 * fdt_get_name - retrieve the name of a given node
536 * @nodeoffset: structure block offset of the starting node
540 * device tree node at structure block offset nodeoffset. If lenp is
541 * non-NULL, the length of this name is also returned, in the integer
545 * pointer to the node's name, on success
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
559 * fdt_first_property_offset - find the offset of a node's first property
561 * @nodeoffset: structure block offset of a node
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.
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.
600 * fdt_for_each_property_offset - iterate over all properties of a node
602 * @property: property offset (int, lvalue)
604 * @node: node offset (int)
606 * This is actually a wrapper around a for loop and would be used like so:
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
618 * iterator in the loop. The node variable can be constant or even a
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
632 * fdt_get_property_by_offset() retrieves a pointer to the
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
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
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
685 * fdt_get_property() retrieves a pointer to the fdt_property
686 * structure within the device tree blob corresponding to the property
687 * named 'name' of the node at offset nodeoffset. If lenp is
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
717 * fdt_getprop_by_offset - retrieve the value of a property at a given offset
719 * @offset: offset of the property to read
720 * @namep: pointer to a string variable (will be overwritten) or NULL
723 * fdt_getprop_by_offset() retrieves a pointer to the value of the
724 * property at structure block offset 'offset' (this will be a pointer
725 * to within the device blob itself, not a copy of the value). If
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
729 * by namep (this will be a pointer to within the device tree's string
730 * block, not a new copy of the name).
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
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
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
785 * named @name of the node at offset @nodeoffset (this will be a
786 * pointer to within the device blob itself, not a copy of the value).
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
814 * fdt_get_phandle - retrieve the phandle of a given node
816 * @nodeoffset: structure block offset of the node
818 * fdt_get_phandle() retrieves the phandle of the device tree node at
822 * the phandle of the node at nodeoffset, on success (!= 0, != -1)
823 * 0, if the node has no phandle, or another error occurs
828 * fdt_get_alias_namelen - get alias based on substring
836 * Return: a pointer to the expansion of the alias named @name, if it exists,
845 * fdt_get_alias - retrieve the path referenced by a given alias
849 * fdt_get_alias() retrieves the value of a given alias. That is, the
850 * value of the property named @name in the node /aliases.
853 * a pointer to the expansion of the alias named 'name', if it exists
854 * NULL, if the given alias or the /aliases node does not exist
859 * fdt_get_path - determine the full path of a node
861 * @nodeoffset: offset of the node whose path to find
865 * fdt_get_path() computes the full path of the node at offset
873 * buf contains the absolute path of the node at
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
886 * fdt_supernode_atdepth_offset - find a specific ancestor of a node
888 * @nodeoffset: offset of the node whose parent to find
892 * fdt_supernode_atdepth_offset() finds an ancestor of the given node
893 * at a specific depth from the root (where the root itself has depth
896 * will always return 0, the offset of the root node. If the node at
905 * structure block offset of the node at node offset's ancestor
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
919 * fdt_node_depth - find the depth of a given node
921 * @nodeoffset: offset of the node whose parent to find
923 * fdt_node_depth() finds the depth of a given node. The root node
930 * depth of the node at nodeoffset (>=0), on success
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
940 * fdt_parent_offset - find the parent of a given node
942 * @nodeoffset: offset of the node whose parent to find
944 * fdt_parent_offset() locates the parent node of a given node (that
945 * is, it finds the offset of the node which contains the node at
946 * nodeoffset as a subnode).
952 * structure block offset of the parent of the node at nodeoffset
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
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
986 * instead, the function will never locate the root node, even if it
990 * structure block offset of the located node (>= 0, >startoffset),
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
1005 * fdt_node_offset_by_phandle - find the node with a given phandle
1009 * fdt_node_offset_by_phandle() returns the offset of the node
1010 * which has the given phandle value. If there is more than one node
1015 * structure block offset of the located node (>= 0), on success
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
1026 * fdt_node_check_compatible - check a node's compatible property
1028 * @nodeoffset: offset of a tree node
1031 * fdt_node_check_compatible() returns 0 if the given node contains a
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
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
1058 * very first such node in the tree.
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
1069 * instead, the function will never locate the root node, even if it
1073 * structure block offset of the located node (>= 0, >startoffset),
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
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
1092 * This is a utility function provided for convenience. The list contains
1093 * one or more strings, each terminated by \0, as is found in a device tree
1094 * "compatible" property.
1101 * fdt_stringlist_count - count the number of strings in a string list
1103 * @nodeoffset: offset of a tree node
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
1116 * @nodeoffset: offset of a tree node
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
1138 * @nodeoffset: offset of a tree node
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
1151 * A pointer to the string at the given index in the string list or NULL on
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
1160 const char *property, int index,
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
1181 * @nodeoffset: offset of the node to find the address size for
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
1199 * fdt_size_cells - retrieve address range size for a bus represented in the
1202 * @nodeoffset: offset of the node to find the address range size for
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
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
1238 * an array and you have a string that doesn't end with \0.
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
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
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
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
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
1395 * fdt_nop_node - replace a node (subtree) with nop tags
1397 * @nodeoffset: offset of the node to nop
1399 * fdt_nop_node() will replace a given node's representation in the
1404 * the node and its properties and subnodes, and will not alter or
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
1424 /* FDT_CREATE_FLAG_NO_NAME_DEDUP: Do not try to de-duplicate property
1426 * a larger fdt. */
1431 * fdt_create_with_flags - begin creation of a new fdt
1434 * @flags: a valid combination of FDT_CREATE_FLAG_ flags, or 0.
1436 * fdt_create_with_flags() begins the process of creating a new fdt with
1439 * fdt creation process must end with fdt_finished() to produce a valid fdt.
1443 * -FDT_ERR_NOSPACE, bufsize is insufficient for a minimal fdt
1444 * -FDT_ERR_BADFLAGS, flags is not valid
1449 * fdt_create - begin creation of a new fdt
1457 * -FDT_ERR_NOSPACE, bufsize is insufficient for a minimal fdt
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
1490 * @valp: returns a pointer to where where the value should be placed
1494 * -FDT_ERR_BADMAGIC,
1495 * -FDT_ERR_NOSPACE, standard meanings
1505 /* Read-write functions */
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
1518 * Adds a reserve map entry to the given blob reserving a region at
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
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
1562 * fdt_set_name - change the name of a given node
1564 * @nodeoffset: structure block offset of a node
1565 * @name: name to give the node
1568 * of the given node with the given string. NOTE: this function can't
1570 * node's siblings; results are undefined if this function is invoked
1571 * with a name equal to one of the given node's siblings.
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
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
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
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
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
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)
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
1744 * given node to the given string value (using the length of 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
1775 * given node to an empty (zero length) value, or creates a new empty
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
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
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
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)
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
1947 * @parent: offset of the parent node
1948 * @nodeoffset: offset of the node to add a property at
1949 * @name: name of property
1950 * @addr: start address of a given range
1951 * @size: size of a given range
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
1957 * If "name" is not specified, a default "reg" is used.
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
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
2006 * fdt_add_subnode_namelen - creates a new node based on substring
2008 * @parentoffset: structure block offset of a node
2013 * characters of @name as the name of the new node. This is useful for
2014 * creating subnodes based on a portion of a larger string, such as a
2026 * fdt_add_subnode - creates a new node
2028 * @parentoffset: structure block offset of a node
2031 * fdt_add_subnode() creates a new node as a subnode of the node at
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
2047 * blob to contain the new node
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.
2059 * fdt_del_node - delete a node (subtree)
2061 * @nodeoffset: offset of the node to nop
2063 * fdt_del_node() will remove the given node, including all its
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
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