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

Go to the source code of this file.

Macros

#define FDT_RW_PROBE(fdt)
 

Functions

static int fdt_blocks_misordered_ (const void *fdt, int mem_rsv_size, int struct_size)
 
static int fdt_rw_probe_ (void *fdt)
 
static unsigned int fdt_data_size_ (void *fdt)
 
static int fdt_splice_ (void *fdt, void *splicepoint, int oldlen, int newlen)
 
static int fdt_splice_mem_rsv_ (void *fdt, struct fdt_reserve_entry *p, int oldn, int newn)
 
static int fdt_splice_struct_ (void *fdt, void *p, int oldlen, int newlen)
 
static void fdt_del_last_string_ (void *fdt, const char *s)
 
static int fdt_splice_string_ (void *fdt, int newlen)
 
static int fdt_find_add_string_ (void *fdt, const char *s, int *allocated)
 
int fdt_add_mem_rsv (void *fdt, uint64_t address, uint64_t size)
 
int fdt_del_mem_rsv (void *fdt, int n)
 
static int fdt_resize_property_ (void *fdt, int nodeoffset, const char *name, int len, struct fdt_property **prop)
 
static int fdt_add_property_ (void *fdt, int nodeoffset, const char *name, int len, struct fdt_property **prop)
 
int fdt_set_name (void *fdt, int nodeoffset, const char *name)
 
int fdt_setprop_placeholder (void *fdt, int nodeoffset, const char *name, int len, void **prop_data)
 
int fdt_setprop (void *fdt, int nodeoffset, const char *name, const void *val, int len)
 
int fdt_appendprop (void *fdt, int nodeoffset, const char *name, const void *val, int len)
 
int fdt_delprop (void *fdt, int nodeoffset, const char *name)
 
int fdt_add_subnode_namelen (void *fdt, int parentoffset, const char *name, int namelen)
 
int fdt_add_subnode (void *fdt, int parentoffset, const char *name)
 
int fdt_del_node (void *fdt, int nodeoffset)
 
static void fdt_packblocks_ (const char *old, char *new, int mem_rsv_size, int struct_size, int strings_size)
 
int fdt_open_into (const void *fdt, void *buf, int bufsize)
 
int fdt_pack (void *fdt)
 

Macro Definition Documentation

◆ FDT_RW_PROBE

#define FDT_RW_PROBE ( fdt)
Value:
{ \
int err_; \
if ((err_ = fdt_rw_probe_(fdt)) != 0) \
return err_; \
}
static int fdt_rw_probe_(void *fdt)
Definition fdt_rw.c:25

Definition at line 42 of file fdt_rw.c.

Referenced by fdt_add_mem_rsv(), fdt_add_subnode_namelen(), fdt_appendprop(), fdt_del_mem_rsv(), fdt_del_node(), fdt_delprop(), fdt_pack(), fdt_set_name(), and fdt_setprop_placeholder().

Function Documentation

◆ fdt_blocks_misordered_()

static int fdt_blocks_misordered_ ( const void * fdt,
int mem_rsv_size,
int struct_size )
static

Definition at line 13 of file fdt_rw.c.

Referenced by fdt_open_into(), and fdt_rw_probe_().

◆ fdt_rw_probe_()

static int fdt_rw_probe_ ( void * fdt)
static

Definition at line 25 of file fdt_rw.c.

+ Here is the call graph for this function:

◆ fdt_data_size_()

static unsigned int fdt_data_size_ ( void * fdt)
inlinestatic

Definition at line 49 of file fdt_rw.c.

Referenced by fdt_pack(), and fdt_splice_().

◆ fdt_splice_()

static int fdt_splice_ ( void * fdt,
void * splicepoint,
int oldlen,
int newlen )
static

Definition at line 54 of file fdt_rw.c.

Referenced by fdt_splice_mem_rsv_(), fdt_splice_string_(), and fdt_splice_struct_().

+ Here is the call graph for this function:

◆ fdt_splice_mem_rsv_()

static int fdt_splice_mem_rsv_ ( void * fdt,
struct fdt_reserve_entry * p,
int oldn,
int newn )
static

Definition at line 70 of file fdt_rw.c.

Referenced by fdt_add_mem_rsv(), and fdt_del_mem_rsv().

+ Here is the call graph for this function:

◆ fdt_splice_struct_()

static int fdt_splice_struct_ ( void * fdt,
void * p,
int oldlen,
int newlen )
static

Definition at line 83 of file fdt_rw.c.

Referenced by fdt_add_property_(), fdt_add_subnode_namelen(), fdt_appendprop(), fdt_del_node(), fdt_delprop(), fdt_resize_property_(), and fdt_set_name().

+ Here is the call graph for this function:

◆ fdt_del_last_string_()

static void fdt_del_last_string_ ( void * fdt,
const char * s )
static

Definition at line 98 of file fdt_rw.c.

Referenced by fdt_add_property_().

+ Here is the call graph for this function:

◆ fdt_splice_string_()

static int fdt_splice_string_ ( void * fdt,
int newlen )
static

Definition at line 105 of file fdt_rw.c.

Referenced by fdt_find_add_string_().

+ Here is the call graph for this function:

◆ fdt_find_add_string_()

static int fdt_find_add_string_ ( void * fdt,
const char * s,
int * allocated )
static

fdt_find_add_string_() - Find or allocate a string

@fdt: pointer to the device tree to check/adjust @s: string to find/add @allocated: Set to 0 if the string was found, 1 if not found and so allocated. Ignored if can_assume(NO_ROLLBACK)

Returns
offset of string in the string table (whether found or added)

Definition at line 127 of file fdt_rw.c.

Referenced by fdt_add_property_().

+ Here is the call graph for this function:

◆ fdt_add_mem_rsv()

int fdt_add_mem_rsv ( void * fdt,
uint64_t address,
uint64_t size )

fdt_add_mem_rsv - add one memory reserve map entry @fdt: pointer to the device tree blob @address: 64-bit start address of the reserve map entry @size: 64-bit size of the reserved region

Adds a reserve map entry to the given blob reserving a region at address address of length size.

This function will insert data into the reserve map and will therefore change the indexes of some entries in the table.

returns: 0, on success -FDT_ERR_NOSPACE, there is insufficient free space in the blob to contain the new reservation entry -FDT_ERR_BADMAGIC, -FDT_ERR_BADVERSION, -FDT_ERR_BADSTATE, -FDT_ERR_BADSTRUCTURE, -FDT_ERR_BADLAYOUT, -FDT_ERR_TRUNCATED, standard meanings

Definition at line 155 of file fdt_rw.c.

+ Here is the call graph for this function:

◆ fdt_del_mem_rsv()

int fdt_del_mem_rsv ( void * fdt,
int n )

fdt_del_mem_rsv - remove a memory reserve map entry @fdt: pointer to the device tree blob
: entry to remove

fdt_del_mem_rsv() removes the n-th memory reserve map entry from the blob.

This function will delete data from the reservation table and will therefore change the indexes of some entries in the table.

returns: 0, on success -FDT_ERR_NOTFOUND, there is no entry of the given index (i.e. there are less than n+1 reserve map entries) -FDT_ERR_BADMAGIC, -FDT_ERR_BADVERSION, -FDT_ERR_BADSTATE, -FDT_ERR_BADSTRUCTURE, -FDT_ERR_BADLAYOUT, -FDT_ERR_TRUNCATED, standard meanings

Definition at line 172 of file fdt_rw.c.

+ Here is the call graph for this function:

◆ fdt_resize_property_()

static int fdt_resize_property_ ( void * fdt,
int nodeoffset,
const char * name,
int len,
struct fdt_property ** prop )
static

Definition at line 184 of file fdt_rw.c.

Referenced by fdt_setprop_placeholder().

+ Here is the call graph for this function:

◆ fdt_add_property_()

static int fdt_add_property_ ( void * fdt,
int nodeoffset,
const char * name,
int len,
struct fdt_property ** prop )
static

Definition at line 202 of file fdt_rw.c.

Referenced by fdt_appendprop(), and fdt_setprop_placeholder().

+ Here is the call graph for this function:

◆ fdt_set_name()

int fdt_set_name ( void * fdt,
int nodeoffset,
const char * name )

Definition at line 235 of file fdt_rw.c.

+ Here is the call graph for this function:

◆ fdt_setprop_placeholder()

int fdt_setprop_placeholder ( void * fdt,
int nodeoffset,
const char * name,
int len,
void ** prop_data )

Definition at line 258 of file fdt_rw.c.

Referenced by fdt_setprop(), and overlay_symbol_update().

+ Here is the call graph for this function:

◆ fdt_setprop()

int fdt_setprop ( void * fdt,
int nodeoffset,
const char * name,
const void * val,
int len )

Definition at line 276 of file fdt_rw.c.

Referenced by fdt_setprop_u32(), fdt_setprop_u64(), and overlay_apply_node().

+ Here is the call graph for this function:

◆ fdt_appendprop()

int fdt_appendprop ( void * fdt,
int nodeoffset,
const char * name,
const void * val,
int len )

Definition at line 291 of file fdt_rw.c.

Referenced by fdt_appendprop_addrrange(), fdt_appendprop_u32(), and fdt_appendprop_u64().

+ Here is the call graph for this function:

◆ fdt_delprop()

int fdt_delprop ( void * fdt,
int nodeoffset,
const char * name )

Definition at line 318 of file fdt_rw.c.

+ Here is the call graph for this function:

◆ fdt_add_subnode_namelen()

int fdt_add_subnode_namelen ( void * fdt,
int parentoffset,
const char * name,
int namelen )

Definition at line 333 of file fdt_rw.c.

Referenced by fdt_add_subnode().

+ Here is the call graph for this function:

◆ fdt_add_subnode()

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

Definition at line 377 of file fdt_rw.c.

Referenced by overlay_apply_node(), and overlay_symbol_update().

+ Here is the call graph for this function:

◆ fdt_del_node()

int fdt_del_node ( void * fdt,
int nodeoffset )

fdt_del_node - delete a node (subtree) @fdt: pointer to the device tree blob @nodeoffset: offset of the node to nop

fdt_del_node() will remove the given node, including all its subnodes if any, from the blob.

This function will delete data from the blob, and will therefore change the offsets of some existing nodes.

returns: 0, on success -FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag -FDT_ERR_BADLAYOUT, -FDT_ERR_BADMAGIC, -FDT_ERR_BADVERSION, -FDT_ERR_BADSTATE, -FDT_ERR_BADSTRUCTURE, -FDT_ERR_TRUNCATED, standard meanings

Definition at line 382 of file fdt_rw.c.

+ Here is the call graph for this function:

◆ fdt_packblocks_()

static void fdt_packblocks_ ( const char * old,
char * new,
int mem_rsv_size,
int struct_size,
int strings_size )
static

Definition at line 396 of file fdt_rw.c.

Referenced by fdt_open_into(), and fdt_pack().

+ Here is the call graph for this function:

◆ fdt_open_into()

int fdt_open_into ( const void * fdt,
void * buf,
int bufsize )

Definition at line 419 of file fdt_rw.c.

Referenced by fdt_create_empty_tree().

+ Here is the call graph for this function:

◆ fdt_pack()

int fdt_pack ( void * fdt)

Definition at line 487 of file fdt_rw.c.

+ Here is the call graph for this function: