Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
dtc.h File Reference
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdarg.h>
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <unistd.h>
#include <libfdt_env.h>
#include <fdt.h>
#include "util.h"

Go to the source code of this file.

Data Structures

struct  marker
 
struct  data
 
struct  label
 
struct  property
 
struct  node
 
struct  reserve_info
 
struct  boot_info
 

Macros

#define debug(fmt, args...)
 
#define DEFAULT_FDT_VERSION   17
 
#define PHANDLE_LEGACY   0x1
 
#define PHANDLE_EPAPR   0x2
 
#define PHANDLE_BOTH   0x3
 
#define streq(a, b)   (strcmp((a), (b)) == 0)
 
#define strneq(a, b, n)   (strncmp((a), (b), (n)) == 0)
 
#define ALIGN(x, a)   (((x) + (a) - 1) & ~((a) - 1))
 
#define ARRAY_SIZE(x)   (sizeof(x) / sizeof((x)[0]))
 
#define empty_data   ((struct data){ /* all .members = 0 or NULL */ })
 
#define for_each_marker(m)   for (; (m); (m) = (m)->next)
 
#define for_each_marker_of_type(m, t)
 
#define MAX_PROPNAME_LEN   31
 
#define MAX_NODENAME_LEN   31
 
#define for_each_label_withdel(l0, l)   for ((l) = (l0); (l); (l) = (l)->next)
 
#define for_each_label(l0, l)
 
#define for_each_property_withdel(n, p)   for ((p) = (n)->proplist; (p); (p) = (p)->next)
 
#define for_each_property(n, p)
 
#define for_each_child_withdel(n, c)   for ((c) = (n)->children; (c); (c) = (c)->next_sibling)
 
#define for_each_child(n, c)
 

Typedefs

typedef uint32_t cell_t
 

Enumerations

enum  markertype { REF_PHANDLE, REF_PATH, LABEL }
 

Functions

void data_free (struct data d)
 
struct data data_grow_for (struct data d, int xlen)
 
struct data data_copy_mem (const char *mem, int len)
 
struct data data_copy_escape_string (const char *s, int len)
 
struct data data_copy_file (FILE *f, size_t len)
 
struct data data_append_data (struct data d, const void *p, int len)
 
struct data data_insert_at_marker (struct data d, struct marker *m, const void *p, int len)
 
struct data data_merge (struct data d1, struct data d2)
 
struct data data_append_cell (struct data d, cell_t word)
 
struct data data_append_integer (struct data d, uint64_t word, int bits)
 
struct data data_append_re (struct data d, const struct fdt_reserve_entry *re)
 
struct data data_append_addr (struct data d, uint64_t addr)
 
struct data data_append_byte (struct data d, uint8_t byte)
 
struct data data_append_zeroes (struct data d, int len)
 
struct data data_append_align (struct data d, int align)
 
struct data data_add_marker (struct data d, enum markertype type, char *ref)
 
int data_is_one_string (struct data d)
 
void add_label (struct label **labels, char *label)
 
void delete_labels (struct label **labels)
 
struct propertybuild_property (char *name, struct data val)
 
struct propertybuild_property_delete (char *name)
 
struct propertychain_property (struct property *first, struct property *list)
 
struct propertyreverse_properties (struct property *first)
 
struct nodebuild_node (struct property *proplist, struct node *children)
 
struct nodebuild_node_delete (void)
 
struct nodename_node (struct node *node, char *name)
 
struct nodechain_node (struct node *first, struct node *list)
 
struct nodemerge_nodes (struct node *old_node, struct node *new_node)
 
void add_property (struct node *node, struct property *prop)
 
void delete_property_by_name (struct node *node, char *name)
 
void delete_property (struct property *prop)
 
void add_child (struct node *parent, struct node *child)
 
void delete_node_by_name (struct node *parent, char *name)
 
void delete_node (struct node *node)
 
const charget_unitname (struct node *node)
 
struct propertyget_property (struct node *node, const char *propname)
 
cell_t propval_cell (struct property *prop)
 
struct propertyget_property_by_label (struct node *tree, const char *label, struct node **node)
 
struct markerget_marker_label (struct node *tree, const char *label, struct node **node, struct property **prop)
 
struct nodeget_subnode (struct node *node, const char *nodename)
 
struct nodeget_node_by_path (struct node *tree, const char *path)
 
struct nodeget_node_by_label (struct node *tree, const char *label)
 
struct nodeget_node_by_phandle (struct node *tree, cell_t phandle)
 
struct nodeget_node_by_ref (struct node *tree, const char *ref)
 
cell_t get_node_phandle (struct node *root, struct node *node)
 
uint32_t guess_boot_cpuid (struct node *tree)
 
struct reserve_infobuild_reserve_entry (uint64_t start, uint64_t len)
 
struct reserve_infochain_reserve_entry (struct reserve_info *first, struct reserve_info *list)
 
struct reserve_infoadd_reserve_entry (struct reserve_info *list, struct reserve_info *new)
 
struct boot_infobuild_boot_info (struct reserve_info *reservelist, struct node *tree, uint32_t boot_cpuid_phys)
 
void sort_tree (struct boot_info *bi)
 
void parse_checks_option (bool warn, bool error, const char *optarg)
 
void process_checks (int force, struct boot_info *bi)
 
void dt_to_blob (FILE *f, struct boot_info *bi, int version)
 
void dt_to_asm (FILE *f, struct boot_info *bi, int version)
 
struct boot_infodt_from_blob (const char *fname)
 
void dt_to_source (FILE *f, struct boot_info *bi)
 
struct boot_infodt_from_source (const char *f)
 
struct boot_infodt_from_fs (const char *dirname)
 

Variables

int quiet
 
int reservenum
 
int minsize
 
int padsize
 
int phandle_format
 

Macro Definition Documentation

#define ALIGN (   x,
  a 
)    (((x) + (a) - 1) & ~((a) - 1))

Definition at line 68 of file dtc.h.

#define ARRAY_SIZE (   x)    (sizeof(x) / sizeof((x)[0]))

Definition at line 69 of file dtc.h.

#define debug (   fmt,
  args... 
)

Definition at line 43 of file dtc.h.

#define DEFAULT_FDT_VERSION   17

Definition at line 47 of file dtc.h.

#define empty_data   ((struct data){ /* all .members = 0 or NULL */ })

Definition at line 92 of file dtc.h.

#define for_each_child (   n,
  c 
)
Value:
if (!(c)->deleted)

Definition at line 181 of file dtc.h.

#define for_each_child_withdel (   n,
  c 
)    for ((c) = (n)->children; (c); (c) = (c)->next_sibling)

Definition at line 178 of file dtc.h.

#define for_each_label (   l0,
  l 
)
Value:
if (!(l)->deleted)

Definition at line 167 of file dtc.h.

#define for_each_label_withdel (   l0,
  l 
)    for ((l) = (l0); (l); (l) = (l)->next)

Definition at line 164 of file dtc.h.

#define for_each_marker (   m)    for (; (m); (m) = (m)->next)

Definition at line 94 of file dtc.h.

#define for_each_marker_of_type (   m,
  t 
)
Value:
if ((m)->type == (t))

Definition at line 96 of file dtc.h.

#define for_each_property (   n,
  p 
)
Value:
if (!(p)->deleted)

Definition at line 174 of file dtc.h.

#define for_each_property_withdel (   n,
  p 
)    for ((p) = (n)->proplist; (p); (p) = (p)->next)

Definition at line 171 of file dtc.h.

#define MAX_NODENAME_LEN   31

Definition at line 127 of file dtc.h.

#define MAX_PROPNAME_LEN   31

Definition at line 126 of file dtc.h.

#define PHANDLE_BOTH   0x3

Definition at line 60 of file dtc.h.

#define PHANDLE_EPAPR   0x2

Definition at line 59 of file dtc.h.

#define PHANDLE_LEGACY   0x1

Definition at line 58 of file dtc.h.

#define streq (   a,
  b 
)    (strcmp((a), (b)) == 0)

Definition at line 65 of file dtc.h.

#define strneq (   a,
  b,
  n 
)    (strncmp((a), (b), (n)) == 0)

Definition at line 66 of file dtc.h.

Typedef Documentation

typedef uint32_t cell_t

Definition at line 62 of file dtc.h.

Enumeration Type Documentation

enum markertype
Enumerator:
REF_PHANDLE 
REF_PATH 
LABEL 

Definition at line 72 of file dtc.h.

Function Documentation

void add_child ( struct node parent,
struct node child 
)

Definition at line 259 of file livetree.c.

void add_label ( struct label **  labels,
char label 
)

Definition at line 27 of file livetree.c.

void add_property ( struct node node,
struct property prop 
)

Definition at line 227 of file livetree.c.

struct reserve_info* add_reserve_entry ( struct reserve_info list,
struct reserve_info new 
)
read

Definition at line 320 of file livetree.c.

struct boot_info* build_boot_info ( struct reserve_info reservelist,
struct node tree,
uint32_t  boot_cpuid_phys 
)
read

Definition at line 338 of file livetree.c.

struct node* build_node ( struct property proplist,
struct node children 
)
read

Definition at line 100 of file livetree.c.

struct node* build_node_delete ( void  )
read

Definition at line 117 of file livetree.c.

struct property* build_property ( char name,
struct data  val 
)
read

Definition at line 53 of file livetree.c.

struct property* build_property_delete ( char name)
read

Definition at line 65 of file livetree.c.

struct reserve_info* build_reserve_entry ( uint64_t  start,
uint64_t  len 
)
read

Definition at line 299 of file livetree.c.

struct node* chain_node ( struct node first,
struct node list 
)
read

Definition at line 219 of file livetree.c.

struct property* chain_property ( struct property first,
struct property list 
)
read

Definition at line 77 of file livetree.c.

struct reserve_info* chain_reserve_entry ( struct reserve_info first,
struct reserve_info list 
)
read

Definition at line 311 of file livetree.c.

struct data data_add_marker ( struct data  d,
enum markertype  type,
char ref 
)
read

Definition at line 240 of file data.c.

struct data data_append_addr ( struct data  d,
uint64_t  addr 
)
read

Definition at line 215 of file data.c.

struct data data_append_align ( struct data  d,
int  align 
)
read

Definition at line 234 of file data.c.

struct data data_append_byte ( struct data  d,
uint8_t  byte 
)
read

Definition at line 220 of file data.c.

struct data data_append_cell ( struct data  d,
cell_t  word 
)
read

Definition at line 210 of file data.c.

struct data data_append_data ( struct data  d,
const void p,
int  len 
)
read

Definition at line 120 of file data.c.

struct data data_append_integer ( struct data  d,
uint64_t  word,
int  bits 
)
read

Definition at line 171 of file data.c.

struct data data_append_re ( struct data  d,
const struct fdt_reserve_entry re 
)
read

Definition at line 200 of file data.c.

struct data data_append_zeroes ( struct data  d,
int  len 
)
read

Definition at line 225 of file data.c.

struct data data_copy_escape_string ( const char s,
int  len 
)
read

Definition at line 71 of file data.c.

struct data data_copy_file ( FILE *  f,
size_t  len 
)
read

Definition at line 93 of file data.c.

struct data data_copy_mem ( const char mem,
int  len 
)
read

Definition at line 59 of file data.c.

void data_free ( struct data  d)

Definition at line 23 of file data.c.

struct data data_grow_for ( struct data  d,
int  xlen 
)
read

Definition at line 39 of file data.c.

struct data data_insert_at_marker ( struct data  d,
struct marker m,
const void p,
int  len 
)
read

Definition at line 128 of file data.c.

int data_is_one_string ( struct data  d)

Definition at line 253 of file data.c.

struct data data_merge ( struct data  d1,
struct data  d2 
)
read

Definition at line 154 of file data.c.

void delete_labels ( struct label **  labels)

Definition at line 45 of file livetree.c.

void delete_node ( struct node node)

Definition at line 286 of file livetree.c.

void delete_node_by_name ( struct node parent,
char name 
)

Definition at line 273 of file livetree.c.

void delete_property ( struct property prop)

Definition at line 253 of file livetree.c.

void delete_property_by_name ( struct node node,
char name 
)

Definition at line 240 of file livetree.c.

struct boot_info* dt_from_blob ( const char fname)
read

Definition at line 804 of file flattree.c.

struct boot_info* dt_from_fs ( const char dirname)
read

Definition at line 82 of file fstree.c.

struct boot_info* dt_from_source ( const char f)
read

Definition at line 31 of file treesource.c.

void dt_to_asm ( FILE *  f,
struct boot_info bi,
int  version 
)

Definition at line 463 of file flattree.c.

void dt_to_blob ( FILE *  f,
struct boot_info bi,
int  version 
)

Definition at line 369 of file flattree.c.

void dt_to_source ( FILE *  f,
struct boot_info bi 
)

Definition at line 266 of file treesource.c.

struct marker* get_marker_label ( struct node tree,
const char label,
struct node **  node,
struct property **  prop 
)
read

Definition at line 406 of file livetree.c.

struct node* get_node_by_label ( struct node tree,
const char label 
)
read

Definition at line 471 of file livetree.c.

struct node* get_node_by_path ( struct node tree,
const char path 
)
read

Definition at line 445 of file livetree.c.

struct node* get_node_by_phandle ( struct node tree,
cell_t  phandle 
)
read

Definition at line 491 of file livetree.c.

struct node* get_node_by_ref ( struct node tree,
const char ref 
)
read

Definition at line 512 of file livetree.c.

cell_t get_node_phandle ( struct node root,
struct node node 
)

Definition at line 520 of file livetree.c.

struct property* get_property ( struct node node,
const char propname 
)
read

Definition at line 363 of file livetree.c.

struct property* get_property_by_label ( struct node tree,
const char label,
struct node **  node 
)
read

Definition at line 380 of file livetree.c.

struct node* get_subnode ( struct node node,
const char nodename 
)
read

Definition at line 434 of file livetree.c.

const char* get_unitname ( struct node node)

Definition at line 355 of file livetree.c.

uint32_t guess_boot_cpuid ( struct node tree)

Definition at line 551 of file livetree.c.

struct node* merge_nodes ( struct node old_node,
struct node new_node 
)
read

Definition at line 137 of file livetree.c.

struct node* name_node ( struct node node,
char name 
)
read

Definition at line 128 of file livetree.c.

void parse_checks_option ( bool  warn,
bool  error,
const char optarg 
)

Definition at line 709 of file checks.c.

void process_checks ( int  force,
struct boot_info bi 
)

Definition at line 736 of file checks.c.

cell_t propval_cell ( struct property prop)

Definition at line 374 of file livetree.c.

struct property* reverse_properties ( struct property first)
read

Definition at line 85 of file livetree.c.

void sort_tree ( struct boot_info bi)

Definition at line 705 of file livetree.c.

Variable Documentation

int minsize

Definition at line 31 of file dtc.c.

int padsize

Definition at line 32 of file dtc.c.

int phandle_format

Definition at line 33 of file dtc.c.

int quiet

Definition at line 29 of file dtc.c.

int reservenum

Definition at line 30 of file dtc.c.