]> git.sur5r.net Git - u-boot/blobdiff - include/libfdt.h
armv8: Kconfig: fsl-ppa: support load PPA from eMMC/SD and NAND Flash
[u-boot] / include / libfdt.h
index f3b61c94271ad57cd4d5395fa155ff7fa0cb4d70..e2bc2e00c184e6e163711b18e02aea340dd4b126 100644 (file)
         * (e.g. missing a leading / for a function which requires an
         * 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
         * value. For example: a property expected to contain a string list
         * is not NUL-terminated within the length of its value. */
 
-#define FDT_ERR_TOODEEP                16
+#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_TOODEEP        18
        /* FDT_ERR_TOODEEP: The depth of a node has exceeded the internal
         * libfdt limit. This can happen if you have more than
         * FDT_MAX_DEPTH nested nodes. */
 
-#define FDT_ERR_MAX            16
+#define FDT_ERR_MAX            18
 
 /**********************************************************************/
 /* Low-level functions (you probably don't need these)                */
@@ -176,24 +187,27 @@ 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(fdt, node, parent) {
- *             ...
- *             use node
+ *     fdt_for_each_subnode(node, fdt, parent) {
+ *             Use node
  *             ...
  *     }
  *
- * Note that this is implemented as a macro and node is used as iterator in
- * the loop. It should therefore be a locally allocated variable. The parent
- * variable on the other hand is never modified, so it can be constant or
- * even a literal.
+ *     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.
  *
- * @fdt:       FDT blob (const void *)
- * @node:      child node (int)
- * @parent:    parent node (int)
  */
-#define fdt_for_each_subnode(fdt, node, parent)                \
+#define fdt_for_each_subnode(node, fdt, parent)                \
        for (node = fdt_first_subnode(fdt, parent);     \
             node >= 0;                                 \
             node = fdt_next_subnode(fdt, node))
@@ -407,10 +421,7 @@ int fdt_path_offset_namelen(const void *fdt, const char *path, int namelen);
  *     -FDT_ERR_BADSTRUCTURE,
  *     -FDT_ERR_TRUNCATED, standard meanings.
  */
-static inline int fdt_path_offset(const void *fdt, const char *path)
-{
-       return fdt_path_offset_namelen(fdt, path, strlen(path));
-}
+int fdt_path_offset(const void *fdt, const char *path);
 
 /**
  * fdt_get_name - retrieve the name of a given node
@@ -1789,8 +1800,9 @@ int fdt_del_node(void *fdt, int nodeoffset);
  *     -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, the phandles in the overlay do not have the right
- *             magic
+ *     -FDT_ERR_BADPHANDLE,
+ *     -FDT_ERR_BADOVERLAY,
+ *     -FDT_ERR_NOPHANDLES,
  *     -FDT_ERR_INTERNAL,
  *     -FDT_ERR_BADLAYOUT,
  *     -FDT_ERR_BADMAGIC,