mirror of https://github.com/OpenIPC/firmware.git
487 lines
19 KiB
Diff
487 lines
19 KiB
Diff
diff -drupN a/scripts/dtc/libfdt/libfdt.h b/scripts/dtc/libfdt/libfdt.h
|
|
--- a/scripts/dtc/libfdt/libfdt.h 2018-08-06 17:23:04.000000000 +0300
|
|
+++ b/scripts/dtc/libfdt/libfdt.h 2022-06-12 05:28:14.000000000 +0300
|
|
@@ -61,72 +61,99 @@
|
|
#define FDT_ERR_NOTFOUND 1
|
|
/* FDT_ERR_NOTFOUND: The requested node or property does not exist */
|
|
#define FDT_ERR_EXISTS 2
|
|
- /* FDT_ERR_EXISTS: Attemped to create a node or property which
|
|
- * already exists */
|
|
+ /* FDT_ERR_EXISTS: Attempted to create a node or property which
|
|
+ * already exists
|
|
+ */
|
|
#define FDT_ERR_NOSPACE 3
|
|
/* FDT_ERR_NOSPACE: Operation needed to expand the device
|
|
* tree, but its buffer did not have sufficient space to
|
|
* contain the expanded tree. Use fdt_open_into() to move the
|
|
- * device tree to a buffer with more space. */
|
|
+ * device tree to a buffer with more space.
|
|
+ */
|
|
|
|
/* Error codes: codes for bad parameters */
|
|
#define FDT_ERR_BADOFFSET 4
|
|
/* FDT_ERR_BADOFFSET: Function was passed a structure block
|
|
* offset which is out-of-bounds, or which points to an
|
|
- * unsuitable part of the structure for the operation. */
|
|
+ * unsuitable part of the structure for the operation.
|
|
+ */
|
|
#define FDT_ERR_BADPATH 5
|
|
/* FDT_ERR_BADPATH: Function was passed a badly formatted path
|
|
* (e.g. missing a leading / for a function which requires an
|
|
- * absolute path) */
|
|
+ * absolute path)
|
|
+ */
|
|
#define FDT_ERR_BADPHANDLE 6
|
|
- /* FDT_ERR_BADPHANDLE: Function was passed an invalid phandle
|
|
- * value. phandle values of 0 and -1 are not permitted. */
|
|
+ /* FDT_ERR_BADPHANDLE: Function was passed an invalid phandle.
|
|
+ * This can be caused either by an invalid phandle property
|
|
+ * length, or the phandle value was either 0 or -1, which are
|
|
+ * not permitted.
|
|
+ */
|
|
#define FDT_ERR_BADSTATE 7
|
|
/* FDT_ERR_BADSTATE: Function was passed an incomplete device
|
|
* tree created by the sequential-write functions, which is
|
|
- * not sufficiently complete for the requested operation. */
|
|
+ * not sufficiently complete for the requested operation.
|
|
+ */
|
|
|
|
/* Error codes: codes for bad device tree blobs */
|
|
#define FDT_ERR_TRUNCATED 8
|
|
/* FDT_ERR_TRUNCATED: Structure block of the given device tree
|
|
- * ends without an FDT_END tag. */
|
|
+ * ends without an FDT_END tag.
|
|
+ */
|
|
#define FDT_ERR_BADMAGIC 9
|
|
/* FDT_ERR_BADMAGIC: Given "device tree" appears not to be a
|
|
* device tree at all - it is missing the flattened device
|
|
- * tree magic number. */
|
|
+ * tree magic number.
|
|
+ */
|
|
#define FDT_ERR_BADVERSION 10
|
|
/* FDT_ERR_BADVERSION: Given device tree has a version which
|
|
* can't be handled by the requested operation. For
|
|
* read-write functions, this may mean that fdt_open_into() is
|
|
- * required to convert the tree to the expected version. */
|
|
+ * required to convert the tree to the expected version.
|
|
+ */
|
|
#define FDT_ERR_BADSTRUCTURE 11
|
|
/* FDT_ERR_BADSTRUCTURE: Given device tree has a corrupt
|
|
* structure block or other serious error (e.g. misnested
|
|
- * nodes, or subnodes preceding properties). */
|
|
+ * nodes, or subnodes preceding properties).
|
|
+ */
|
|
#define FDT_ERR_BADLAYOUT 12
|
|
/* FDT_ERR_BADLAYOUT: For read-write functions, the given
|
|
* device tree has it's sub-blocks in an order that the
|
|
* function can't handle (memory reserve map, then structure,
|
|
* then strings). Use fdt_open_into() to reorganize the tree
|
|
- * into a form suitable for the read-write operations. */
|
|
+ * into a form suitable for the read-write operations.
|
|
+ */
|
|
|
|
/* "Can't happen" error indicating a bug in libfdt */
|
|
#define FDT_ERR_INTERNAL 13
|
|
/* FDT_ERR_INTERNAL: libfdt has failed an internal assertion.
|
|
* Should never be returned, if it is, it indicates a bug in
|
|
- * libfdt itself. */
|
|
+ * libfdt itself.
|
|
+ */
|
|
|
|
/* Errors in device tree content */
|
|
#define FDT_ERR_BADNCELLS 14
|
|
/* FDT_ERR_BADNCELLS: Device tree has a #address-cells, #size-cells
|
|
- * or similar property with a bad format or value */
|
|
+ * or similar property with a bad format or value
|
|
+ */
|
|
|
|
#define FDT_ERR_BADVALUE 15
|
|
/* FDT_ERR_BADVALUE: Device tree has a property with an unexpected
|
|
* value. For example: a property expected to contain a string list
|
|
- * is not NUL-terminated within the length of its value. */
|
|
+ * is not NUL-terminated within the length of its value.
|
|
+ */
|
|
|
|
-#define FDT_ERR_MAX 15
|
|
+#define FDT_ERR_BADOVERLAY 16
|
|
+ /* FDT_ERR_BADOVERLAY: The device tree overlay, while
|
|
+ * correctly structured, cannot be applied due to some
|
|
+ * unexpected or missing value, property or node.
|
|
+ */
|
|
+
|
|
+#define FDT_ERR_NOPHANDLES 17
|
|
+ /* FDT_ERR_NOPHANDLES: The device tree doesn't have any
|
|
+ * phandle available anymore without causing an overflow
|
|
+ */
|
|
+
|
|
+#define FDT_ERR_MAX 17
|
|
|
|
/**********************************************************************/
|
|
/* Low-level functions (you probably don't need these) */
|
|
@@ -168,27 +195,55 @@ int fdt_first_subnode(const void *fdt, i
|
|
*/
|
|
int fdt_next_subnode(const void *fdt, int offset);
|
|
|
|
+/**
|
|
+ * fdt_for_each_subnode - iterate over all subnodes of a parent
|
|
+ *
|
|
+ * @node: child node (int, lvalue)
|
|
+ * @fdt: FDT blob (const void *)
|
|
+ * @parent: parent node (int)
|
|
+ *
|
|
+ * This is actually a wrapper around a for loop and would be used like so:
|
|
+ *
|
|
+ * fdt_for_each_subnode(node, fdt, parent) {
|
|
+ * Use node
|
|
+ * ...
|
|
+ * }
|
|
+ *
|
|
+ * if ((node < 0) && (node != -FDT_ERR_NOT_FOUND)) {
|
|
+ * Error handling
|
|
+ * }
|
|
+ *
|
|
+ * Note that this is implemented as a macro and @node is used as
|
|
+ * iterator in the loop. The parent variable be constant or even a
|
|
+ * literal.
|
|
+ *
|
|
+ */
|
|
+#define fdt_for_each_subnode(node, fdt, parent) \
|
|
+ for (node = fdt_first_subnode(fdt, parent); \
|
|
+ node >= 0; \
|
|
+ node = fdt_next_subnode(fdt, node))
|
|
+
|
|
/**********************************************************************/
|
|
/* General functions */
|
|
/**********************************************************************/
|
|
|
|
#define fdt_get_header(fdt, field) \
|
|
(fdt32_to_cpu(((const struct fdt_header *)(fdt))->field))
|
|
-#define fdt_magic(fdt) (fdt_get_header(fdt, magic))
|
|
+#define fdt_magic(fdt) (fdt_get_header(fdt, magic))
|
|
#define fdt_totalsize(fdt) (fdt_get_header(fdt, totalsize))
|
|
#define fdt_off_dt_struct(fdt) (fdt_get_header(fdt, off_dt_struct))
|
|
#define fdt_off_dt_strings(fdt) (fdt_get_header(fdt, off_dt_strings))
|
|
#define fdt_off_mem_rsvmap(fdt) (fdt_get_header(fdt, off_mem_rsvmap))
|
|
#define fdt_version(fdt) (fdt_get_header(fdt, version))
|
|
-#define fdt_last_comp_version(fdt) (fdt_get_header(fdt, last_comp_version))
|
|
-#define fdt_boot_cpuid_phys(fdt) (fdt_get_header(fdt, boot_cpuid_phys))
|
|
-#define fdt_size_dt_strings(fdt) (fdt_get_header(fdt, size_dt_strings))
|
|
+#define fdt_last_comp_version(fdt) (fdt_get_header(fdt, last_comp_version))
|
|
+#define fdt_boot_cpuid_phys(fdt) (fdt_get_header(fdt, boot_cpuid_phys))
|
|
+#define fdt_size_dt_strings(fdt) (fdt_get_header(fdt, size_dt_strings))
|
|
#define fdt_size_dt_struct(fdt) (fdt_get_header(fdt, size_dt_struct))
|
|
|
|
#define __fdt_set_hdr(name) \
|
|
static inline void fdt_set_##name(void *fdt, uint32_t val) \
|
|
{ \
|
|
- struct fdt_header *fdth = (struct fdt_header*)fdt; \
|
|
+ struct fdt_header *fdth = (struct fdt_header *)fdt; \
|
|
fdth->name = cpu_to_fdt32(val); \
|
|
}
|
|
__fdt_set_hdr(magic);
|
|
@@ -259,6 +314,21 @@ int fdt_move(const void *fdt, void *buf,
|
|
const char *fdt_string(const void *fdt, int stroffset);
|
|
|
|
/**
|
|
+ * fdt_get_max_phandle - retrieves the highest phandle in a tree
|
|
+ * @fdt: pointer to the device tree blob
|
|
+ *
|
|
+ * fdt_get_max_phandle retrieves the highest phandle in the given
|
|
+ * device tree. This will ignore badly formatted phandles, or phandles
|
|
+ * with a value of 0 or -1.
|
|
+ *
|
|
+ * returns:
|
|
+ * the highest phandle on success
|
|
+ * 0, if no phandle was found in the device tree
|
|
+ * -1, if an error occurred
|
|
+ */
|
|
+uint32_t fdt_get_max_phandle(const void *fdt);
|
|
+
|
|
+/**
|
|
* fdt_num_mem_rsv - retrieve the number of memory reserve map entries
|
|
* @fdt: pointer to the device tree blob
|
|
*
|
|
@@ -318,8 +388,9 @@ int fdt_subnode_offset_namelen(const voi
|
|
* returns:
|
|
* structure block offset of the requested subnode (>=0), on success
|
|
* -FDT_ERR_NOTFOUND, if the requested subnode does not exist
|
|
- * -FDT_ERR_BADOFFSET, if parentoffset did not point to an FDT_BEGIN_NODE tag
|
|
- * -FDT_ERR_BADMAGIC,
|
|
+ * -FDT_ERR_BADOFFSET, if parentoffset did not point to an FDT_BEGIN_NODE
|
|
+ * tag
|
|
+ * -FDT_ERR_BADMAGIC,
|
|
* -FDT_ERR_BADVERSION,
|
|
* -FDT_ERR_BADSTATE,
|
|
* -FDT_ERR_BADSTRUCTURE,
|
|
@@ -351,7 +422,8 @@ int fdt_path_offset_namelen(const void *
|
|
* address).
|
|
*
|
|
* returns:
|
|
- * structure block offset of the node with the requested path (>=0), on success
|
|
+ * structure block offset of the node with the requested path (>=0), on
|
|
+ * success
|
|
* -FDT_ERR_BADPATH, given path does not begin with '/' or is invalid
|
|
* -FDT_ERR_NOTFOUND, if the requested node does not exist
|
|
* -FDT_ERR_BADMAGIC,
|
|
@@ -375,10 +447,12 @@ int fdt_path_offset(const void *fdt, con
|
|
*
|
|
* returns:
|
|
* pointer to the node's name, on success
|
|
- * If lenp is non-NULL, *lenp contains the length of that name (>=0)
|
|
+ * If lenp is non-NULL, *lenp contains the length of that name
|
|
+ * (>=0)
|
|
* NULL, on error
|
|
* if lenp is non-NULL *lenp contains an error code (<0):
|
|
- * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
|
|
+ * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE
|
|
+ * tag
|
|
* -FDT_ERR_BADMAGIC,
|
|
* -FDT_ERR_BADVERSION,
|
|
* -FDT_ERR_BADSTATE, standard meanings
|
|
@@ -427,6 +501,33 @@ int fdt_first_property_offset(const void
|
|
int fdt_next_property_offset(const void *fdt, int offset);
|
|
|
|
/**
|
|
+ * fdt_for_each_property_offset - iterate over all properties of a node
|
|
+ *
|
|
+ * @property_offset: property offset (int, lvalue)
|
|
+ * @fdt: FDT blob (const void *)
|
|
+ * @node: node offset (int)
|
|
+ *
|
|
+ * This is actually a wrapper around a for loop and would be used like so:
|
|
+ *
|
|
+ * fdt_for_each_property_offset(property, fdt, node) {
|
|
+ * Use property
|
|
+ * ...
|
|
+ * }
|
|
+ *
|
|
+ * if ((property < 0) && (property != -FDT_ERR_NOT_FOUND)) {
|
|
+ * Error handling
|
|
+ * }
|
|
+ *
|
|
+ * Note that this is implemented as a macro and property is used as
|
|
+ * iterator in the loop. The node variable can be constant or even a
|
|
+ * literal.
|
|
+ */
|
|
+#define fdt_for_each_property_offset(property, fdt, node) \
|
|
+ for (property = fdt_first_property_offset(fdt, node); \
|
|
+ property >= 0; \
|
|
+ property = fdt_next_property_offset(fdt, property))
|
|
+
|
|
+/**
|
|
* fdt_get_property_by_offset - retrieve the property at a given offset
|
|
* @fdt: pointer to the device tree blob
|
|
* @offset: offset of the property to retrieve
|
|
@@ -490,7 +591,8 @@ const struct fdt_property *fdt_get_prope
|
|
* NULL, on error
|
|
* if lenp is non-NULL, *lenp contains an error code (<0):
|
|
* -FDT_ERR_NOTFOUND, node does not have named property
|
|
- * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
|
|
+ * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE
|
|
+ * tag
|
|
* -FDT_ERR_BADMAGIC,
|
|
* -FDT_ERR_BADVERSION,
|
|
* -FDT_ERR_BADSTATE,
|
|
@@ -554,6 +656,13 @@ const void *fdt_getprop_by_offset(const
|
|
*/
|
|
const void *fdt_getprop_namelen(const void *fdt, int nodeoffset,
|
|
const char *name, int namelen, int *lenp);
|
|
+static inline void *fdt_getprop_namelen_w(void *fdt, int nodeoffset,
|
|
+ const char *name, int namelen,
|
|
+ int *lenp)
|
|
+{
|
|
+ return (void *)(uintptr_t)fdt_getprop_namelen(fdt, nodeoffset, name,
|
|
+ namelen, lenp);
|
|
+}
|
|
|
|
/**
|
|
* fdt_getprop - retrieve the value of a given property
|
|
@@ -575,7 +684,8 @@ const void *fdt_getprop_namelen(const vo
|
|
* NULL, on error
|
|
* if lenp is non-NULL, *lenp contains an error code (<0):
|
|
* -FDT_ERR_NOTFOUND, node does not have named property
|
|
- * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
|
|
+ * -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE
|
|
+ * tag
|
|
* -FDT_ERR_BADMAGIC,
|
|
* -FDT_ERR_BADVERSION,
|
|
* -FDT_ERR_BADSTATE,
|
|
@@ -617,7 +727,7 @@ const char *fdt_get_alias_namelen(const
|
|
const char *name, int namelen);
|
|
|
|
/**
|
|
- * fdt_get_alias - retreive the path referenced by a given alias
|
|
+ * fdt_get_alias - retrieve the path referenced by a given alias
|
|
* @fdt: pointer to the device tree blob
|
|
* @name: name of the alias th look up
|
|
*
|
|
@@ -647,7 +757,7 @@ const char *fdt_get_alias(const void *fd
|
|
* 0, on success
|
|
* buf contains the absolute path of the node at
|
|
* nodeoffset, as a NUL-terminated string.
|
|
- * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
|
|
+ * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
|
|
* -FDT_ERR_NOSPACE, the path of the given node is longer than (bufsize-1)
|
|
* characters and will not fit in the given buffer.
|
|
* -FDT_ERR_BADMAGIC,
|
|
@@ -677,11 +787,11 @@ int fdt_get_path(const void *fdt, int no
|
|
* structure from the start to nodeoffset.
|
|
*
|
|
* returns:
|
|
-
|
|
* structure block offset of the node at node offset's ancestor
|
|
* of depth supernodedepth (>=0), on success
|
|
- * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
|
|
-* -FDT_ERR_NOTFOUND, supernodedepth was greater than the depth of nodeoffset
|
|
+ * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
|
|
+ * -FDT_ERR_NOTFOUND, supernodedepth was greater than the depth of
|
|
+ * nodeoffset
|
|
* -FDT_ERR_BADMAGIC,
|
|
* -FDT_ERR_BADVERSION,
|
|
* -FDT_ERR_BADSTATE,
|
|
@@ -703,7 +813,7 @@ int fdt_supernode_atdepth_offset(const v
|
|
*
|
|
* returns:
|
|
* depth of the node at nodeoffset (>=0), on success
|
|
- * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
|
|
+ * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
|
|
* -FDT_ERR_BADMAGIC,
|
|
* -FDT_ERR_BADVERSION,
|
|
* -FDT_ERR_BADSTATE,
|
|
@@ -726,7 +836,7 @@ int fdt_node_depth(const void *fdt, int
|
|
* returns:
|
|
* structure block offset of the parent of the node at nodeoffset
|
|
* (>=0), on success
|
|
- * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
|
|
+ * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
|
|
* -FDT_ERR_BADMAGIC,
|
|
* -FDT_ERR_BADVERSION,
|
|
* -FDT_ERR_BADSTATE,
|
|
@@ -766,7 +876,7 @@ int fdt_parent_offset(const void *fdt, i
|
|
* on success
|
|
* -FDT_ERR_NOTFOUND, no node matching the criterion exists in the
|
|
* tree after startoffset
|
|
- * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
|
|
+ * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
|
|
* -FDT_ERR_BADMAGIC,
|
|
* -FDT_ERR_BADVERSION,
|
|
* -FDT_ERR_BADSTATE,
|
|
@@ -813,7 +923,7 @@ int fdt_node_offset_by_phandle(const voi
|
|
* 1, if the node has a 'compatible' property, but it does not list
|
|
* the given string
|
|
* -FDT_ERR_NOTFOUND, if the given node has no 'compatible' property
|
|
- * -FDT_ERR_BADOFFSET, if nodeoffset does not refer to a BEGIN_NODE tag
|
|
+ * -FDT_ERR_BADOFFSET, if nodeoffset does not refer to a BEGIN_NODE tag
|
|
* -FDT_ERR_BADMAGIC,
|
|
* -FDT_ERR_BADVERSION,
|
|
* -FDT_ERR_BADSTATE,
|
|
@@ -850,7 +960,7 @@ int fdt_node_check_compatible(const void
|
|
* on success
|
|
* -FDT_ERR_NOTFOUND, no node matching the criterion exists in the
|
|
* tree after startoffset
|
|
- * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
|
|
+ * -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag
|
|
* -FDT_ERR_BADMAGIC,
|
|
* -FDT_ERR_BADVERSION,
|
|
* -FDT_ERR_BADSTATE,
|
|
@@ -960,7 +1070,8 @@ const char *fdt_stringlist_get(const voi
|
|
* returns:
|
|
* 0 <= n < FDT_MAX_NCELLS, on success
|
|
* 2, if the node has no #address-cells property
|
|
- * -FDT_ERR_BADNCELLS, if the node has a badly formatted or invalid #address-cells property
|
|
+ * -FDT_ERR_BADNCELLS, if the node has a badly formatted or invalid
|
|
+ * #address-cells property
|
|
* -FDT_ERR_BADMAGIC,
|
|
* -FDT_ERR_BADVERSION,
|
|
* -FDT_ERR_BADSTATE,
|
|
@@ -980,7 +1091,8 @@ int fdt_address_cells(const void *fdt, i
|
|
* returns:
|
|
* 0 <= n < FDT_MAX_NCELLS, on success
|
|
* 2, if the node has no #address-cells property
|
|
- * -FDT_ERR_BADNCELLS, if the node has a badly formatted or invalid #size-cells property
|
|
+ * -FDT_ERR_BADNCELLS, if the node has a badly formatted or invalid
|
|
+ * #size-cells property
|
|
* -FDT_ERR_BADMAGIC,
|
|
* -FDT_ERR_BADVERSION,
|
|
* -FDT_ERR_BADSTATE,
|
|
@@ -995,6 +1107,27 @@ int fdt_size_cells(const void *fdt, int
|
|
/**********************************************************************/
|
|
|
|
/**
|
|
+ * fdt_setprop_inplace_namelen_partial - change a property's value,
|
|
+ * but not its size
|
|
+ * @fdt: pointer to the device tree blob
|
|
+ * @nodeoffset: offset of the node whose property to change
|
|
+ * @name: name of the property to change
|
|
+ * @namelen: number of characters of name to consider
|
|
+ * @idx: index of the property to change in the array
|
|
+ * @val: pointer to data to replace the property value with
|
|
+ * @len: length of the property value
|
|
+ *
|
|
+ * Identical to fdt_setprop_inplace(), but modifies the given property
|
|
+ * starting from the given index, and using only the first characters
|
|
+ * of the name. It is useful when you want to manipulate only one value of
|
|
+ * an array and you have a string that doesn't end with \0.
|
|
+ */
|
|
+int fdt_setprop_inplace_namelen_partial(void *fdt, int nodeoffset,
|
|
+ const char *name, int namelen,
|
|
+ uint32_t idx, const void *val,
|
|
+ int len);
|
|
+
|
|
+/**
|
|
* fdt_setprop_inplace - change a property's value, but not its size
|
|
* @fdt: pointer to the device tree blob
|
|
* @nodeoffset: offset of the node whose property to change
|
|
@@ -1604,9 +1737,11 @@ int fdt_add_subnode_namelen(void *fdt, i
|
|
* change the offsets of some existing nodes.
|
|
|
|
* returns:
|
|
- * structure block offset of the created nodeequested subnode (>=0), on success
|
|
+ * structure block offset of the created nodeequested subnode (>=0), on
|
|
+ * success
|
|
* -FDT_ERR_NOTFOUND, if the requested subnode does not exist
|
|
- * -FDT_ERR_BADOFFSET, if parentoffset did not point to an FDT_BEGIN_NODE tag
|
|
+ * -FDT_ERR_BADOFFSET, if parentoffset did not point to an FDT_BEGIN_NODE
|
|
+ * tag
|
|
* -FDT_ERR_EXISTS, if the node at parentoffset already has a subnode of
|
|
* the given name
|
|
* -FDT_ERR_NOSPACE, if there is insufficient free space in the
|
|
@@ -1644,6 +1779,37 @@ int fdt_add_subnode(void *fdt, int paren
|
|
*/
|
|
int fdt_del_node(void *fdt, int nodeoffset);
|
|
|
|
+/**
|
|
+ * fdt_overlay_apply - Applies a DT overlay on a base DT
|
|
+ * @fdt: pointer to the base device tree blob
|
|
+ * @fdto: pointer to the device tree overlay blob
|
|
+ *
|
|
+ * fdt_overlay_apply() will apply the given device tree overlay on the
|
|
+ * given base device tree.
|
|
+ *
|
|
+ * Expect the base device tree to be modified, even if the function
|
|
+ * returns an error.
|
|
+ *
|
|
+ * returns:
|
|
+ * 0, on success
|
|
+ * -FDT_ERR_NOSPACE, there's not enough space in the base device tree
|
|
+ * -FDT_ERR_NOTFOUND, the overlay points to some inexistant nodes or
|
|
+ * properties in the base DT
|
|
+ * -FDT_ERR_BADPHANDLE,
|
|
+ * -FDT_ERR_BADOVERLAY,
|
|
+ * -FDT_ERR_NOPHANDLES,
|
|
+ * -FDT_ERR_INTERNAL,
|
|
+ * -FDT_ERR_BADLAYOUT,
|
|
+ * -FDT_ERR_BADMAGIC,
|
|
+ * -FDT_ERR_BADOFFSET,
|
|
+ * -FDT_ERR_BADPATH,
|
|
+ * -FDT_ERR_BADVERSION,
|
|
+ * -FDT_ERR_BADSTRUCTURE,
|
|
+ * -FDT_ERR_BADSTATE,
|
|
+ * -FDT_ERR_TRUNCATED, standard meanings
|
|
+ */
|
|
+int fdt_overlay_apply(void *fdt, void *fdto);
|
|
+
|
|
/**********************************************************************/
|
|
/* Debugging / informational functions */
|
|
/**********************************************************************/
|