MOS Source Code
Loading...
Searching...
No Matches
fdt_overlay.c File Reference
#include "libfdt_env.h"
#include <fdt.h>
#include <libfdt.h>
#include "libfdt_internal.h"
+ Include dependency graph for fdt_overlay.c:

Go to the source code of this file.

Functions

static uint32_t overlay_get_target_phandle (const void *fdto, int fragment)
 
int fdt_overlay_target_offset (const void *fdt, const void *fdto, int fragment_offset, char const **pathp)
 
: Name of the property to modify (phandle or linux,phandle)

overlay_phandle_add_offset - Increases a phandle by an offset @fdt: Base device tree blob @node: Device tree overlay blob

@delta: offset to apply

overlay_phandle_add_offset() increments a node phandle by a given offset.

returns: 0 on success. Negative error code on error

static int overlay_phandle_add_offset (void *fdt, int node, const char *name, uint32_t delta)
 
static int overlay_adjust_node_phandles (void *fdto, int node, uint32_t delta)
 
static int overlay_adjust_local_phandles (void *fdto, uint32_t delta)
 
static int overlay_update_local_node_references (void *fdto, int tree_node, int fixup_node, uint32_t delta)
 
static int overlay_update_local_references (void *fdto, uint32_t delta)
 
: Name of the property holding the phandle reference in the overlay

overlay_fixup_one_phandle - Set an overlay phandle to the base one @fdt: Base Device Tree blob @fdto: Device tree overlay blob @symbols_off: Node offset of the symbols node in the base device tree @path: Path to a node holding a phandle in the overlay @path_len: number of path characters to consider

@name_len: number of name characters to consider @poffset: Offset within the overlay property where the phandle is stored @label: Label of the node referenced by the phandle

overlay_fixup_one_phandle() resolves an overlay phandle pointing to a node in the base device tree.

This is part of the device tree overlay application process, when you want all the phandles in the overlay to point to the actual base dt nodes.

returns: 0 on success Negative error code on failure

static int overlay_fixup_one_phandle (void *fdt, void *fdto, int symbols_off, const char *path, uint32_t path_len, const char *name, uint32_t name_len, int poffset, const char *label)
 
static int overlay_fixup_phandle (void *fdt, void *fdto, int symbols_off, int property)
 
static int overlay_fixup_phandles (void *fdt, void *fdto)
 
static int overlay_apply_node (void *fdt, int target, void *fdto, int node)
 
static int overlay_merge (void *fdt, void *fdto)
 
static int get_path_len (const void *fdt, int nodeoffset)
 
static int overlay_symbol_update (void *fdt, void *fdto)
 
int fdt_overlay_apply (void *fdt, void *fdto)
 

Function Documentation

◆ overlay_get_target_phandle()

static uint32_t overlay_get_target_phandle ( const void * fdto,
int fragment )
static

overlay_get_target_phandle - retrieves the target phandle of a fragment @fdto: pointer to the device tree overlay blob @fragment: node offset of the fragment in the overlay

overlay_get_target_phandle() retrieves the target phandle of an overlay fragment when that fragment uses a phandle (target property) instead of a path (target-path property).

returns: the phandle pointed by the target property 0, if the phandle was not found -1, if the phandle was malformed

Definition at line 28 of file fdt_overlay.c.

Referenced by fdt_overlay_target_offset().

+ Here is the call graph for this function:

◆ fdt_overlay_target_offset()

int fdt_overlay_target_offset ( const void * fdt,
const void * fdto,
int fragment_offset,
char const ** pathp )

fdt_overlay_target_offset - retrieves the offset of a fragment's target @fdt: Base device tree blob @fdto: Device tree overlay blob @fragment_offset: node offset of the fragment in the overlay @pathp: pointer which receives the path of the target (or NULL)

fdt_overlay_target_offset() retrieves the target offset in the base device tree of a fragment, no matter how the actual targeting is done (through a phandle or a path)

returns: the targeted node offset in the base device tree Negative error code on error

Definition at line 43 of file fdt_overlay.c.

Referenced by overlay_merge(), and overlay_symbol_update().

+ Here is the call graph for this function:

◆ overlay_phandle_add_offset()

static int overlay_phandle_add_offset ( void * fdt,
int node,
const char * name,
uint32_t delta )
static

Definition at line 101 of file fdt_overlay.c.

Referenced by overlay_adjust_node_phandles().

+ Here is the call graph for this function:

◆ overlay_adjust_node_phandles()

static int overlay_adjust_node_phandles ( void * fdto,
int node,
uint32_t delta )
static

overlay_adjust_node_phandles - Offsets the phandles of a node @fdto: Device tree overlay blob @node: Offset of the node we want to adjust @delta: Offset to shift the phandles of

overlay_adjust_node_phandles() adds a constant to all the phandles of a given node. This is mainly use as part of the overlay application process, when we want to update all the overlay phandles to not conflict with the overlays of the base device tree.

returns: 0 on success Negative error code on failure

Definition at line 141 of file fdt_overlay.c.

Referenced by overlay_adjust_local_phandles(), and overlay_adjust_node_phandles().

+ Here is the call graph for this function:

◆ overlay_adjust_local_phandles()

static int overlay_adjust_local_phandles ( void * fdto,
uint32_t delta )
static

overlay_adjust_local_phandles - Adjust the phandles of a whole overlay @fdto: Device tree overlay blob @delta: Offset to shift the phandles of

overlay_adjust_local_phandles() adds a constant to all the phandles of an overlay. This is mainly use as part of the overlay application process, when we want to update all the overlay phandles to not conflict with the overlays of the base device tree.

returns: 0 on success Negative error code on failure

Definition at line 178 of file fdt_overlay.c.

Referenced by fdt_overlay_apply().

+ Here is the call graph for this function:

◆ overlay_update_local_node_references()

static int overlay_update_local_node_references ( void * fdto,
int tree_node,
int fixup_node,
uint32_t delta )
static

overlay_update_local_node_references - Adjust the overlay references @fdto: Device tree overlay blob @tree_node: Node offset of the node to operate on @fixup_node: Node offset of the matching local fixups node @delta: Offset to shift the phandles of

overlay_update_local_nodes_references() update the phandles pointing to a node within the device tree overlay by adding a constant delta.

This is mainly used as part of a device tree application process, where you want the device tree overlays phandles to not conflict with the ones from the base device tree before merging them.

returns: 0 on success Negative error code on failure

Definition at line 205 of file fdt_overlay.c.

Referenced by overlay_update_local_node_references(), and overlay_update_local_references().

+ Here is the call graph for this function:

◆ overlay_update_local_references()

static int overlay_update_local_references ( void * fdto,
uint32_t delta )
static

overlay_update_local_references - Adjust the overlay references @fdto: Device tree overlay blob @delta: Offset to shift the phandles of

overlay_update_local_references() update all the phandles pointing to a node within the device tree overlay by adding a constant delta to not conflict with the base overlay.

This is mainly used as part of a device tree application process, where you want the device tree overlays phandles to not conflict with the ones from the base device tree before merging them.

returns: 0 on success Negative error code on failure

Definition at line 310 of file fdt_overlay.c.

Referenced by fdt_overlay_apply().

+ Here is the call graph for this function:

◆ overlay_fixup_one_phandle()

static int overlay_fixup_one_phandle ( void * fdt,
void * fdto,
int symbols_off,
const char * path,
uint32_t path_len,
const char * name,
uint32_t name_len,
int poffset,
const char * label )
static

Definition at line 353 of file fdt_overlay.c.

Referenced by overlay_fixup_phandle().

+ Here is the call graph for this function:

◆ overlay_fixup_phandle()

static int overlay_fixup_phandle ( void * fdt,
void * fdto,
int symbols_off,
int property )
static

Definition at line 413 of file fdt_overlay.c.

Referenced by overlay_fixup_phandles().

+ Here is the call graph for this function:

◆ overlay_fixup_phandles()

static int overlay_fixup_phandles ( void * fdt,
void * fdto )
static

overlay_fixup_phandles - Resolve the overlay phandles to the base device tree @fdt: Base Device Tree blob @fdto: Device tree overlay blob

overlay_fixup_phandles() resolves all the overlay phandles pointing to nodes in the base device tree.

This is one of the steps of the device tree overlay application process, when you want all the phandles in the overlay to point to the actual base dt nodes.

returns: 0 on success Negative error code on failure

Definition at line 495 of file fdt_overlay.c.

Referenced by fdt_overlay_apply().

+ Here is the call graph for this function:

◆ overlay_apply_node()

static int overlay_apply_node ( void * fdt,
int target,
void * fdto,
int node )
static

overlay_apply_node - Merges a node into the base device tree @fdt: Base Device Tree blob @target: Node offset in the base device tree to apply the fragment to @fdto: Device tree overlay blob @node: Node offset in the overlay holding the changes to merge

overlay_apply_node() merges a node into a target base device tree node pointed.

This is part of the final step in the device tree overlay application process, when all the phandles have been adjusted and resolved and you just have to merge overlay into the base device tree.

returns: 0 on success Negative error code on failure

Definition at line 542 of file fdt_overlay.c.

Referenced by overlay_apply_node(), and overlay_merge().

+ Here is the call graph for this function:

◆ overlay_merge()

static int overlay_merge ( void * fdt,
void * fdto )
static

overlay_merge - Merge an overlay into its base device tree @fdt: Base Device Tree blob @fdto: Device tree overlay blob

overlay_merge() merges an overlay into its base device tree.

This is the next to last step in the device tree overlay application process, when all the phandles have been adjusted and resolved and you just have to merge overlay into the base device tree.

returns: 0 on success Negative error code on failure

Definition at line 604 of file fdt_overlay.c.

Referenced by fdt_overlay_apply().

+ Here is the call graph for this function:

◆ get_path_len()

static int get_path_len ( const void * fdt,
int nodeoffset )
static

Definition at line 636 of file fdt_overlay.c.

Referenced by overlay_symbol_update().

+ Here is the call graph for this function:

◆ overlay_symbol_update()

static int overlay_symbol_update ( void * fdt,
void * fdto )
static

overlay_symbol_update - Update the symbols of base tree after a merge @fdt: Base Device Tree blob @fdto: Device tree overlay blob

overlay_symbol_update() updates the symbols of the base tree with the symbols of the applied overlay

This is the last step in the device tree overlay application process, allowing the reference of overlay symbols by subsequent overlay operations.

returns: 0 on success Negative error code on failure

Definition at line 680 of file fdt_overlay.c.

Referenced by fdt_overlay_apply().

+ Here is the call graph for this function:

◆ fdt_overlay_apply()

int fdt_overlay_apply ( void * fdt,
void * fdto )

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

Definition at line 815 of file fdt_overlay.c.

+ Here is the call graph for this function: