diff options
author | Maxime Ripard <maxime.ripard@free-electrons.com> | 2016-09-30 15:57:16 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-07-19 07:01:09 +0200 |
commit | e879a98ddeb5c738d598d6a91e4b4f2da6933cde (patch) | |
tree | 676c355973f31eb75bff720f2f7383ab0c73a640 /cpukit | |
parent | libfdt: Extend the reach of FDT_ERR_BADPHANDLE (diff) | |
download | rtems-e879a98ddeb5c738d598d6a91e4b4f2da6933cde.tar.bz2 |
libfdt: Add overlay application function
The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).
Add a new function to merge overlays with a base device tree.
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to '')
-rw-r--r-- | cpukit/include/libfdt.h | 31 | ||||
-rw-r--r-- | cpukit/include/libfdt_env.h | 1 |
2 files changed, 32 insertions, 0 deletions
diff --git a/cpukit/include/libfdt.h b/cpukit/include/libfdt.h index d2e5e031fb..c69e918899 100644 --- a/cpukit/include/libfdt.h +++ b/cpukit/include/libfdt.h @@ -1763,6 +1763,37 @@ int fdt_add_subnode(void *fdt, int parentoffset, const char *name); */ 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 */ /**********************************************************************/ diff --git a/cpukit/include/libfdt_env.h b/cpukit/include/libfdt_env.h index 9dea97dfff..99f936dacc 100644 --- a/cpukit/include/libfdt_env.h +++ b/cpukit/include/libfdt_env.h @@ -54,6 +54,7 @@ #include <stddef.h> #include <stdint.h> +#include <stdlib.h> #include <string.h> #ifdef __CHECKER__ |