SyterKit 0.4.0.x
SyterKit is a bare-metal framework
Loading...
Searching...
No Matches
Functions
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:

Functions

static uint32_t overlay_get_target_phandle (const void *fdto, int fragment)
 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
 
static int overlay_get_target (const void *fdt, const void *fdto, int fragment, char const **pathp)
 overlay_get_target - retrieves the offset of a fragment's target @fdt: Base device tree blob @fdto: Device tree overlay blob @fragment: node offset of the fragment in the overlay @pathp: pointer which receives the path of the target (or NULL)
 
: 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)
 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
 
static int overlay_adjust_local_phandles (void *fdto, uint32_t delta)
 overlay_adjust_local_phandles - Adjust the phandles of a whole overlay @fdto: Device tree overlay blob @delta: Offset to shift the phandles of
 
static int overlay_update_local_node_references (void *fdto, int tree_node, int fixup_node, uint32_t delta)
 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
 
static int overlay_update_local_references (void *fdto, uint32_t delta)
 overlay_update_local_references - Adjust the overlay references @fdto: Device tree overlay blob @delta: Offset to shift the phandles of
 
: 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)
 overlay_fixup_phandles - Resolve the overlay phandles to the base device tree @fdt: Base Device Tree blob @fdto: Device tree overlay blob
 
static int overlay_apply_node (void *fdt, int target, void *fdto, int node)
 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
 
static int overlay_merge (void *fdt, void *fdto)
 overlay_merge - Merge an overlay into its base device tree @fdt: Base Device Tree blob @fdto: Device tree overlay blob
 
static int get_path_len (const void *fdt, int nodeoffset)
 
static int overlay_symbol_update (void *fdt, void *fdto)
 overlay_symbol_update - Update the symbols of base tree after a merge @fdt: Base Device Tree blob @fdto: Device tree overlay blob
 
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
 

Function Documentation

◆ 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

◆ get_path_len()

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

◆ 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

◆ 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

◆ 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

◆ 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

◆ overlay_fixup_phandle()

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

◆ 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

◆ overlay_get_target()

static int overlay_get_target ( const void *  fdt,
const void *  fdto,
int  fragment,
char const **  pathp 
)
static

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

overlay_get_target() 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

◆ 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

◆ 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

◆ overlay_phandle_add_offset()

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

◆ 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

◆ 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

◆ 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