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

Go to the source code of this file.

Functions

static int fdt_nodename_eq_ (const void *fdt, int offset, const char *s, int len)
 
const char * fdt_get_string (const void *fdt, int stroffset, int *lenp)
 
const char * fdt_string (const void *fdt, int stroffset)
 
static int fdt_string_eq_ (const void *fdt, int stroffset, const char *s, int len)
 
int fdt_find_max_phandle (const void *fdt, uint32_t *phandle)
 
int fdt_generate_phandle (const void *fdt, uint32_t *phandle)
 
static const struct fdt_reserve_entryfdt_mem_rsv (const void *fdt, int n)
 
int fdt_get_mem_rsv (const void *fdt, int n, uint64_t *address, uint64_t *size)
 
int fdt_num_mem_rsv (const void *fdt)
 
static int nextprop_ (const void *fdt, int offset)
 
int fdt_subnode_offset_namelen (const void *fdt, int offset, const char *name, int namelen)
 
int fdt_subnode_offset (const void *fdt, int parentoffset, const char *name)
 
int fdt_path_offset_namelen (const void *fdt, const char *path, int namelen)
 
int fdt_path_offset (const void *fdt, const char *path)
 
const char * fdt_get_name (const void *fdt, int nodeoffset, int *len)
 
int fdt_first_property_offset (const void *fdt, int nodeoffset)
 
int fdt_next_property_offset (const void *fdt, int offset)
 
static const struct fdt_propertyfdt_get_property_by_offset_ (const void *fdt, int offset, int *lenp)
 
const struct fdt_propertyfdt_get_property_by_offset (const void *fdt, int offset, int *lenp)
 
static const struct fdt_propertyfdt_get_property_namelen_ (const void *fdt, int offset, const char *name, int namelen, int *lenp, int *poffset)
 
const struct fdt_propertyfdt_get_property_namelen (const void *fdt, int offset, const char *name, int namelen, int *lenp)
 
const struct fdt_propertyfdt_get_property (const void *fdt, int nodeoffset, const char *name, int *lenp)
 
const voidfdt_getprop_namelen (const void *fdt, int nodeoffset, const char *name, int namelen, int *lenp)
 
const voidfdt_getprop_by_offset (const void *fdt, int offset, const char **namep, int *lenp)
 
const voidfdt_getprop (const void *fdt, int nodeoffset, const char *name, int *lenp)
 
uint32_t fdt_get_phandle (const void *fdt, int nodeoffset)
 
const char * fdt_get_alias_namelen (const void *fdt, const char *name, int namelen)
 
const char * fdt_get_alias (const void *fdt, const char *name)
 
int fdt_get_path (const void *fdt, int nodeoffset, char *buf, int buflen)
 
int fdt_supernode_atdepth_offset (const void *fdt, int nodeoffset, int supernodedepth, int *nodedepth)
 
int fdt_node_depth (const void *fdt, int nodeoffset)
 
int fdt_parent_offset (const void *fdt, int nodeoffset)
 
int fdt_node_offset_by_prop_value (const void *fdt, int startoffset, const char *propname, const void *propval, int proplen)
 
int fdt_node_offset_by_phandle (const void *fdt, uint32_t phandle)
 
int fdt_stringlist_contains (const char *strlist, int listlen, const char *str)
 
int fdt_stringlist_count (const void *fdt, int nodeoffset, const char *property)
 
int fdt_stringlist_search (const void *fdt, int nodeoffset, const char *property, const char *string)
 
const char * fdt_stringlist_get (const void *fdt, int nodeoffset, const char *property, int idx, int *lenp)
 
int fdt_node_check_compatible (const void *fdt, int nodeoffset, const char *compatible)
 
int fdt_node_offset_by_compatible (const void *fdt, int startoffset, const char *compatible)
 

Function Documentation

◆ fdt_nodename_eq_()

static int fdt_nodename_eq_ ( const void * fdt,
int offset,
const char * s,
int len )
static

Definition at line 13 of file fdt_ro.c.

Referenced by fdt_subnode_offset_namelen().

+ Here is the call graph for this function:

◆ fdt_get_string()

const char * fdt_get_string ( const void * fdt,
int stroffset,
int * lenp )

fdt_get_string - retrieve a string from the strings block of a device tree @fdt: pointer to the device tree blob @stroffset: offset of the string within the strings block (native endian) @lenp: optional pointer to return the string's length

fdt_get_string() retrieves a pointer to a single string from the strings block of the device tree blob at fdt, and optionally also returns the string's length in *lenp.

returns: a pointer to the string, on success NULL, if stroffset is out of bounds, or doesn't point to a valid string

Definition at line 34 of file fdt_ro.c.

Referenced by fdt_getprop_by_offset(), fdt_string(), and fdt_string_eq_().

+ Here is the call graph for this function:

◆ fdt_string()

const char * fdt_string ( const void * fdt,
int stroffset )

fdt_string - retrieve a string from the strings block of a device tree @fdt: pointer to the device tree blob @stroffset: offset of the string within the strings block (native endian)

fdt_string() retrieves a pointer to a single string from the strings block of the device tree blob at fdt.

returns: a pointer to the string, on success NULL, if stroffset is out of bounds, or doesn't point to a valid string

Definition at line 100 of file fdt_ro.c.

Referenced by fdt_getprop_by_offset().

+ Here is the call graph for this function:

◆ fdt_string_eq_()

static int fdt_string_eq_ ( const void * fdt,
int stroffset,
const char * s,
int len )
static

Definition at line 105 of file fdt_ro.c.

Referenced by fdt_get_property_namelen_().

+ Here is the call graph for this function:

◆ fdt_find_max_phandle()

int fdt_find_max_phandle ( const void * fdt,
uint32_t * phandle )

fdt_find_max_phandle - find and return the highest phandle in a tree @fdt: pointer to the device tree blob @phandle: return location for the highest phandle value found in the tree

fdt_find_max_phandle() finds the highest phandle value in the given device tree. The value returned in @phandle is only valid if the function returns success.

returns: 0 on success or a negative error code on failure

Definition at line 114 of file fdt_ro.c.

Referenced by fdt_generate_phandle(), fdt_get_max_phandle(), and fdt_overlay_apply().

+ Here is the call graph for this function:

◆ fdt_generate_phandle()

int fdt_generate_phandle ( const void * fdt,
uint32_t * phandle )

fdt_generate_phandle - return a new, unused phandle for a device tree blob @fdt: pointer to the device tree blob @phandle: return location for the new phandle

Walks the device tree blob and looks for the highest phandle value. On success, the new, unused phandle value (one higher than the previously highest phandle value in the device tree blob) will be returned in the @phandle parameter.

Return: 0 on success or a negative error-code on failure

Definition at line 142 of file fdt_ro.c.

+ Here is the call graph for this function:

◆ fdt_mem_rsv()

static const struct fdt_reserve_entry * fdt_mem_rsv ( const void * fdt,
int n )
static

Definition at line 160 of file fdt_ro.c.

Referenced by fdt_get_mem_rsv(), and fdt_num_mem_rsv().

+ Here is the call graph for this function:

◆ fdt_get_mem_rsv()

int fdt_get_mem_rsv ( const void * fdt,
int n,
uint64_t * address,
uint64_t * size )

fdt_get_mem_rsv - retrieve one memory reserve map entry @fdt: pointer to the device tree blob
: index of reserve map entry @address: pointer to 64-bit variable to hold the start address @size: pointer to 64-bit variable to hold the size of the entry

On success, @address and @size will contain the address and size of the n-th reserve map entry from the device tree blob, in native-endian format.

returns: 0, on success -FDT_ERR_BADMAGIC, -FDT_ERR_BADVERSION, -FDT_ERR_BADSTATE, standard meanings

Definition at line 175 of file fdt_ro.c.

+ Here is the call graph for this function:

◆ fdt_num_mem_rsv()

int fdt_num_mem_rsv ( const void * fdt)

fdt_num_mem_rsv - retrieve the number of memory reserve map entries @fdt: pointer to the device tree blob

Returns the number of entries in the device tree blob's memory reservation map. This does not include the terminating 0,0 entry or any other (0,0) entries reserved for expansion.

returns: the number of entries

Definition at line 189 of file fdt_ro.c.

Referenced by fdt_add_mem_rsv(), fdt_del_mem_rsv(), fdt_open_into(), and fdt_pack().

+ Here is the call graph for this function:

◆ nextprop_()

static int nextprop_ ( const void * fdt,
int offset )
static

Definition at line 201 of file fdt_ro.c.

Referenced by fdt_first_property_offset(), and fdt_next_property_offset().

+ Here is the call graph for this function:

◆ fdt_subnode_offset_namelen()

int fdt_subnode_offset_namelen ( const void * fdt,
int offset,
const char * name,
int namelen )

Definition at line 225 of file fdt_ro.c.

Referenced by fdt_add_subnode_namelen(), fdt_path_offset_namelen(), fdt_subnode_offset(), and overlay_symbol_update().

+ Here is the call graph for this function:

◆ fdt_subnode_offset()

int fdt_subnode_offset ( const void * fdt,
int parentoffset,
const char * name )

Definition at line 244 of file fdt_ro.c.

Referenced by overlay_apply_node(), overlay_merge(), overlay_symbol_update(), and overlay_update_local_node_references().

+ Here is the call graph for this function:

◆ fdt_path_offset_namelen()

int fdt_path_offset_namelen ( const void * fdt,
const char * path,
int namelen )

fdt_path_offset_namelen - find a tree node by its full path @fdt: pointer to the device tree blob @path: full path of the node to locate @namelen: number of characters of path to consider

Identical to fdt_path_offset(), but only consider the first namelen characters of path as the path name.

Return: offset of the node or negative libfdt error value otherwise

Definition at line 250 of file fdt_ro.c.

Referenced by fdt_path_offset(), and overlay_fixup_one_phandle().

+ Here is the call graph for this function:

◆ fdt_path_offset()

int fdt_path_offset ( const void * fdt,
const char * path )

fdt_path_offset - find a tree node by its full path @fdt: pointer to the device tree blob @path: full path of the node to locate

fdt_path_offset() finds a node of a given path in the device tree. Each path component may omit the unit address portion, but the results of this are undefined if any such path component is ambiguous (that is if there are multiple nodes at the relevant level matching the given component, differentiated only by unit address).

returns: 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, -FDT_ERR_BADVERSION, -FDT_ERR_BADSTATE, -FDT_ERR_BADSTRUCTURE, -FDT_ERR_TRUNCATED, standard meanings.

Definition at line 295 of file fdt_ro.c.

Referenced by dt_node::dt_node(), fdt_get_alias_namelen(), fdt_overlay_target_offset(), fdt_path_offset_namelen(), overlay_fixup_one_phandle(), overlay_fixup_phandles(), and overlay_update_local_references().

+ Here is the call graph for this function:

◆ fdt_get_name()

const char * fdt_get_name ( const void * fdt,
int nodeoffset,
int * lenp )

fdt_get_name - retrieve the name of a given node @fdt: pointer to the device tree blob @nodeoffset: structure block offset of the starting node @lenp: pointer to an integer variable (will be overwritten) or NULL

fdt_get_name() retrieves the name (including unit address) of the device tree node at structure block offset nodeoffset. If lenp is non-NULL, the length of this name is also returned, in the integer pointed to by lenp.

returns: pointer to the node's name, on success 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_BADMAGIC, -FDT_ERR_BADVERSION, -FDT_ERR_BADSTATE, standard meanings

Definition at line 300 of file fdt_ro.c.

Referenced by fdt_get_path(), fdt_nodename_eq_(), fdt_set_name(), dt_node::get_name(), get_path_len(), overlay_apply_node(), and overlay_update_local_node_references().

+ Here is the call graph for this function:

◆ fdt_first_property_offset()

int fdt_first_property_offset ( const void * fdt,
int nodeoffset )

fdt_first_property_offset - find the offset of a node's first property @fdt: pointer to the device tree blob @nodeoffset: structure block offset of a node

fdt_first_property_offset() finds the first property of the node at the given structure block offset.

returns: structure block offset of the property (>=0), on success -FDT_ERR_NOTFOUND, if the requested node has no properties -FDT_ERR_BADOFFSET, if nodeoffset did not point to an FDT_BEGIN_NODE tag -FDT_ERR_BADMAGIC, -FDT_ERR_BADVERSION, -FDT_ERR_BADSTATE, -FDT_ERR_BADSTRUCTURE, -FDT_ERR_TRUNCATED, standard meanings.

Definition at line 338 of file fdt_ro.c.

Referenced by dt_node::node_property_list::begin(), and fdt_get_property_namelen_().

+ Here is the call graph for this function:

◆ fdt_next_property_offset()

int fdt_next_property_offset ( const void * fdt,
int offset )

fdt_next_property_offset - step through a node's properties @fdt: pointer to the device tree blob @offset: structure block offset of a property

fdt_next_property_offset() finds the property immediately after the one at the given structure block offset. This will be a property of the same node as the given property.

returns: structure block offset of the next property (>=0), on success -FDT_ERR_NOTFOUND, if the given property is the last in its node -FDT_ERR_BADOFFSET, if nodeoffset did not point to an FDT_PROP tag -FDT_ERR_BADMAGIC, -FDT_ERR_BADVERSION, -FDT_ERR_BADSTATE, -FDT_ERR_BADSTRUCTURE, -FDT_ERR_TRUNCATED, standard meanings.

Definition at line 348 of file fdt_ro.c.

Referenced by fdt_get_property_namelen_(), and dt_node::node_property_list::iterator::operator++().

+ Here is the call graph for this function:

◆ fdt_get_property_by_offset_()

static const struct fdt_property * fdt_get_property_by_offset_ ( const void * fdt,
int offset,
int * lenp )
static

Definition at line 356 of file fdt_ro.c.

Referenced by fdt_get_property_by_offset(), fdt_get_property_namelen_(), and fdt_getprop_by_offset().

+ Here is the call graph for this function:

◆ fdt_get_property_by_offset()

const struct fdt_property * fdt_get_property_by_offset ( const void * fdt,
int offset,
int * lenp )

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 @lenp: pointer to an integer variable (will be overwritten) or NULL

fdt_get_property_by_offset() retrieves a pointer to the fdt_property structure within the device tree blob at the given offset. If lenp is non-NULL, the length of the property value is also returned, in the integer pointed to by lenp.

Note that this code only works on device tree versions >= 16. fdt_getprop() works on all versions.

returns: pointer to the structure representing the property if lenp is non-NULL, *lenp contains the length of the property value (>=0) NULL, on error if lenp is non-NULL, *lenp contains an error code (<0): -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_PROP tag -FDT_ERR_BADMAGIC, -FDT_ERR_BADVERSION, -FDT_ERR_BADSTATE, -FDT_ERR_BADSTRUCTURE, -FDT_ERR_TRUNCATED, standard meanings

Definition at line 378 of file fdt_ro.c.

Referenced by fdt_get_property_by_offset_w().

+ Here is the call graph for this function:

◆ fdt_get_property_namelen_()

static const struct fdt_property * fdt_get_property_namelen_ ( const void * fdt,
int offset,
const char * name,
int namelen,
int * lenp,
int * poffset )
static

Definition at line 394 of file fdt_ro.c.

Referenced by fdt_get_property_namelen(), and fdt_getprop_namelen().

+ Here is the call graph for this function:

◆ fdt_get_property_namelen()

const struct fdt_property * fdt_get_property_namelen ( const void * fdt,
int offset,
const char * name,
int namelen,
int * lenp )

Definition at line 425 of file fdt_ro.c.

Referenced by fdt_get_property().

+ Here is the call graph for this function:

◆ fdt_get_property()

const struct fdt_property * fdt_get_property ( const void * fdt,
int nodeoffset,
const char * name,
int * lenp )

Definition at line 443 of file fdt_ro.c.

Referenced by fdt_get_property_w(), and dt_node::has_property().

+ Here is the call graph for this function:

◆ fdt_getprop_namelen()

const void * fdt_getprop_namelen ( const void * fdt,
int nodeoffset,
const char * name,
int namelen,
int * lenp )

Definition at line 451 of file fdt_ro.c.

Referenced by fdt_get_alias_namelen(), fdt_getprop(), and fdt_getprop_namelen_w().

+ Here is the call graph for this function:

◆ fdt_getprop_by_offset()

const void * fdt_getprop_by_offset ( const void * fdt,
int offset,
const char ** namep,
int * lenp )

fdt_getprop_by_offset - retrieve the value of a property at a given offset @fdt: pointer to the device tree blob @offset: offset of the property to read @namep: pointer to a string variable (will be overwritten) or NULL @lenp: pointer to an integer variable (will be overwritten) or NULL

fdt_getprop_by_offset() retrieves a pointer to the value of the property at structure block offset 'offset' (this will be a pointer to within the device blob itself, not a copy of the value). If lenp is non-NULL, the length of the property value is also returned, in the integer pointed to by lenp. If namep is non-NULL, the property's namne will also be returned in the char * pointed to by namep (this will be a pointer to within the device tree's string block, not a new copy of the name).

returns: pointer to the property's value if lenp is non-NULL, *lenp contains the length of the property value (>=0) if namep is non-NULL *namep contiains a pointer to the property name. NULL, on error if lenp is non-NULL, *lenp contains an error code (<0): -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_PROP tag -FDT_ERR_BADMAGIC, -FDT_ERR_BADVERSION, -FDT_ERR_BADSTATE, -FDT_ERR_BADSTRUCTURE, -FDT_ERR_TRUNCATED, standard meanings

Definition at line 469 of file fdt_ro.c.

Referenced by dt_property::dt_property(), overlay_apply_node(), overlay_fixup_phandle(), overlay_symbol_update(), and overlay_update_local_node_references().

+ Here is the call graph for this function:

◆ fdt_getprop()

◆ fdt_get_phandle()

uint32_t fdt_get_phandle ( const void * fdt,
int nodeoffset )

fdt_get_phandle - retrieve the phandle of a given node @fdt: pointer to the device tree blob @nodeoffset: structure block offset of the node

fdt_get_phandle() retrieves the phandle of the device tree node at structure block offset nodeoffset.

returns: the phandle of the node at nodeoffset, on success (!= 0, != -1) 0, if the node has no phandle, or another error occurs

Definition at line 508 of file fdt_ro.c.

Referenced by fdt_find_max_phandle(), fdt_node_offset_by_phandle(), and overlay_fixup_one_phandle().

+ Here is the call graph for this function:

◆ fdt_get_alias_namelen()

const char * fdt_get_alias_namelen ( const void * fdt,
const char * name,
int namelen )

Definition at line 525 of file fdt_ro.c.

Referenced by fdt_get_alias(), and fdt_path_offset_namelen().

+ Here is the call graph for this function:

◆ fdt_get_alias()

const char * fdt_get_alias ( const void * fdt,
const char * name )

Definition at line 537 of file fdt_ro.c.

+ Here is the call graph for this function:

◆ fdt_get_path()

int fdt_get_path ( const void * fdt,
int nodeoffset,
char * buf,
int buflen )

fdt_get_path - determine the full path of a node @fdt: pointer to the device tree blob @nodeoffset: offset of the node whose path to find @buf: character buffer to contain the returned path (will be overwritten) @buflen: size of the character buffer at buf

fdt_get_path() computes the full path of the node at offset nodeoffset, and records that path in the buffer at buf.

NOTE: This function is expensive, as it must scan the device tree structure from the start to nodeoffset.

returns: 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_NOSPACE, the path of the given node is longer than (bufsize-1) characters and will not fit in the given buffer. -FDT_ERR_BADMAGIC, -FDT_ERR_BADVERSION, -FDT_ERR_BADSTATE, -FDT_ERR_BADSTRUCTURE, standard meanings

Definition at line 542 of file fdt_ro.c.

Referenced by overlay_symbol_update().

+ Here is the call graph for this function:

◆ fdt_supernode_atdepth_offset()

int fdt_supernode_atdepth_offset ( const void * fdt,
int nodeoffset,
int supernodedepth,
int * nodedepth )

fdt_supernode_atdepth_offset - find a specific ancestor of a node @fdt: pointer to the device tree blob @nodeoffset: offset of the node whose parent to find @supernodedepth: depth of the ancestor to find @nodedepth: pointer to an integer variable (will be overwritten) or NULL

fdt_supernode_atdepth_offset() finds an ancestor of the given node at a specific depth from the root (where the root itself has depth 0, its immediate subnodes depth 1 and so forth). So fdt_supernode_atdepth_offset(fdt, nodeoffset, 0, NULL); will always return 0, the offset of the root node. If the node at nodeoffset has depth D, then: fdt_supernode_atdepth_offset(fdt, nodeoffset, D, NULL); will return nodeoffset itself.

NOTE: This function is expensive, as it must scan the device tree 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_BADMAGIC, -FDT_ERR_BADVERSION, -FDT_ERR_BADSTATE, -FDT_ERR_BADSTRUCTURE, standard meanings

Definition at line 594 of file fdt_ro.c.

Referenced by fdt_node_depth(), and fdt_parent_offset().

+ Here is the call graph for this function:

◆ fdt_node_depth()

int fdt_node_depth ( const void * fdt,
int nodeoffset )

fdt_node_depth - find the depth of a given node @fdt: pointer to the device tree blob @nodeoffset: offset of the node whose parent to find

fdt_node_depth() finds the depth of a given node. The root node has depth 0, its immediate subnodes depth 1 and so forth.

NOTE: This function is expensive, as it must scan the device tree structure from the start to nodeoffset.

returns: depth of the node at nodeoffset (>=0), on success -FDT_ERR_BADOFFSET, nodeoffset does not refer to a BEGIN_NODE tag -FDT_ERR_BADMAGIC, -FDT_ERR_BADVERSION, -FDT_ERR_BADSTATE, -FDT_ERR_BADSTRUCTURE, standard meanings

Definition at line 632 of file fdt_ro.c.

Referenced by fdt_parent_offset().

+ Here is the call graph for this function:

◆ fdt_parent_offset()

int fdt_parent_offset ( const void * fdt,
int nodeoffset )

fdt_parent_offset - find the parent of a given node @fdt: pointer to the device tree blob @nodeoffset: offset of the node whose parent to find

fdt_parent_offset() locates the parent node of a given node (that is, it finds the offset of the node which contains the node at nodeoffset as a subnode).

NOTE: This function is expensive, as it must scan the device tree structure from the start to nodeoffset, twice.

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_BADMAGIC, -FDT_ERR_BADVERSION, -FDT_ERR_BADSTATE, -FDT_ERR_BADSTRUCTURE, standard meanings

Definition at line 644 of file fdt_ro.c.

Referenced by get_path_len().

+ Here is the call graph for this function:

◆ fdt_node_offset_by_prop_value()

int fdt_node_offset_by_prop_value ( const void * fdt,
int startoffset,
const char * propname,
const void * propval,
int proplen )

fdt_node_offset_by_prop_value - find nodes with a given property value @fdt: pointer to the device tree blob @startoffset: only find nodes after this offset @propname: property name to check @propval: property value to search for @proplen: length of the value in propval

fdt_node_offset_by_prop_value() returns the offset of the first node after startoffset, which has a property named propname whose value is of length proplen and has value equal to propval; or if startoffset is -1, the very first such node in the tree.

To iterate through all nodes matching the criterion, the following idiom can be used: offset = fdt_node_offset_by_prop_value(fdt, -1, propname, propval, proplen); while (offset != -FDT_ERR_NOTFOUND) { // other code here offset = fdt_node_offset_by_prop_value(fdt, offset, propname, propval, proplen); }

Note the -1 in the first call to the function, if 0 is used here instead, the function will never locate the root node, even if it matches the criterion.

returns: structure block offset of the located node (>= 0, >startoffset), 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_BADMAGIC, -FDT_ERR_BADVERSION, -FDT_ERR_BADSTATE, -FDT_ERR_BADSTRUCTURE, standard meanings

Definition at line 654 of file fdt_ro.c.

+ Here is the call graph for this function:

◆ fdt_node_offset_by_phandle()

int fdt_node_offset_by_phandle ( const void * fdt,
uint32_t phandle )

fdt_node_offset_by_phandle - find the node with a given phandle @fdt: pointer to the device tree blob @phandle: phandle value

fdt_node_offset_by_phandle() returns the offset of the node which has the given phandle value. If there is more than one node in the tree with the given phandle (an invalid tree), results are undefined.

returns: structure block offset of the located node (>= 0), on success -FDT_ERR_NOTFOUND, no node with that phandle exists -FDT_ERR_BADPHANDLE, given phandle value was invalid (0 or -1) -FDT_ERR_BADMAGIC, -FDT_ERR_BADVERSION, -FDT_ERR_BADSTATE, -FDT_ERR_BADSTRUCTURE, standard meanings

Definition at line 681 of file fdt_ro.c.

Referenced by fdt_overlay_target_offset().

+ Here is the call graph for this function:

◆ fdt_stringlist_contains()

int fdt_stringlist_contains ( const char * strlist,
int listlen,
const char * str )

fdt_stringlist_contains - check a string list property for a string @strlist: Property containing a list of strings to check @listlen: Length of property @str: String to search for

This is a utility function provided for convenience. The list contains one or more strings, each terminated by \0, as is found in a device tree "compatible" property.

Return: 1 if the string is found in the list, 0 not found, or invalid list

Definition at line 706 of file fdt_ro.c.

Referenced by fdt_node_check_compatible().

+ Here is the call graph for this function:

◆ fdt_stringlist_count()

int fdt_stringlist_count ( const void * fdt,
int nodeoffset,
const char * property )

Definition at line 723 of file fdt_ro.c.

+ Here is the call graph for this function:

◆ fdt_stringlist_search()

int fdt_stringlist_search ( const void * fdt,
int nodeoffset,
const char * property,
const char * string )

Definition at line 748 of file fdt_ro.c.

+ Here is the call graph for this function:

◆ fdt_stringlist_get()

const char * fdt_stringlist_get ( const void * fdt,
int nodeoffset,
const char * property,
int idx,
int * lenp )

Definition at line 778 of file fdt_ro.c.

+ Here is the call graph for this function:

◆ fdt_node_check_compatible()

int fdt_node_check_compatible ( const void * fdt,
int nodeoffset,
const char * compatible )

fdt_node_check_compatible - check a node's compatible property @fdt: pointer to the device tree blob @nodeoffset: offset of a tree node @compatible: string to match against

fdt_node_check_compatible() returns 0 if the given node contains a @compatible property with the given string as one of its elements, it returns non-zero otherwise, or on error.

returns: 0, if the node has a 'compatible' property listing the given string 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_BADMAGIC, -FDT_ERR_BADVERSION, -FDT_ERR_BADSTATE, -FDT_ERR_BADSTRUCTURE, standard meanings

Definition at line 823 of file fdt_ro.c.

Referenced by fdt_node_offset_by_compatible().

+ Here is the call graph for this function:

◆ fdt_node_offset_by_compatible()

int fdt_node_offset_by_compatible ( const void * fdt,
int startoffset,
const char * compatible )

fdt_node_offset_by_compatible - find nodes with a given 'compatible' value @fdt: pointer to the device tree blob @startoffset: only find nodes after this offset @compatible: 'compatible' string to match against

fdt_node_offset_by_compatible() returns the offset of the first node after startoffset, which has a 'compatible' property which lists the given compatible string; or if startoffset is -1, the very first such node in the tree.

To iterate through all nodes matching the criterion, the following idiom can be used: offset = fdt_node_offset_by_compatible(fdt, -1, compatible); while (offset != -FDT_ERR_NOTFOUND) { // other code here offset = fdt_node_offset_by_compatible(fdt, offset, compatible); }

Note the -1 in the first call to the function, if 0 is used here instead, the function will never locate the root node, even if it matches the criterion.

returns: structure block offset of the located node (>= 0, >startoffset), 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_BADMAGIC, -FDT_ERR_BADVERSION, -FDT_ERR_BADSTATE, -FDT_ERR_BADSTRUCTURE, standard meanings

Definition at line 836 of file fdt_ro.c.

+ Here is the call graph for this function: