SyterKit 0.4.0.x
SyterKit is a bare-metal framework
Loading...
Searching...
No Matches
libfdt.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: (GPL-2.0-or-later OR BSD-2-Clause) */
2#ifndef LIBFDT_H
3#define LIBFDT_H
4/*
5 * libfdt - Flat Device Tree manipulation
6 * Copyright (C) 2006 David Gibson, IBM Corporation.
7 */
8
9#include "libfdt_env.h"
10#include "fdt.h"
11
12#ifdef __cplusplus
13extern "C" {
14#endif
15
16#define FDT_FIRST_SUPPORTED_VERSION 0x02
17#define FDT_LAST_COMPATIBLE_VERSION 0x10
18#define FDT_LAST_SUPPORTED_VERSION 0x11
19
20/* Error codes: informative error codes */
21#define FDT_ERR_NOTFOUND 1
22/* FDT_ERR_NOTFOUND: The requested node or property does not exist */
23#define FDT_ERR_EXISTS 2
24/* FDT_ERR_EXISTS: Attempted to create a node or property which
25 * already exists */
26#define FDT_ERR_NOSPACE 3
27/* FDT_ERR_NOSPACE: Operation needed to expand the device
28 * tree, but its buffer did not have sufficient space to
29 * contain the expanded tree. Use fdt_open_into() to move the
30 * device tree to a buffer with more space. */
31
32/* Error codes: codes for bad parameters */
33#define FDT_ERR_BADOFFSET 4
34/* FDT_ERR_BADOFFSET: Function was passed a structure block
35 * offset which is out-of-bounds, or which points to an
36 * unsuitable part of the structure for the operation. */
37#define FDT_ERR_BADPATH 5
38/* FDT_ERR_BADPATH: Function was passed a badly formatted path
39 * (e.g. missing a leading / for a function which requires an
40 * absolute path) */
41#define FDT_ERR_BADPHANDLE 6
42/* FDT_ERR_BADPHANDLE: Function was passed an invalid phandle.
43 * This can be caused either by an invalid phandle property
44 * length, or the phandle value was either 0 or -1, which are
45 * not permitted. */
46#define FDT_ERR_BADSTATE 7
47/* FDT_ERR_BADSTATE: Function was passed an incomplete device
48 * tree created by the sequential-write functions, which is
49 * not sufficiently complete for the requested operation. */
50
51/* Error codes: codes for bad device tree blobs */
52#define FDT_ERR_TRUNCATED 8
53/* FDT_ERR_TRUNCATED: FDT or a sub-block is improperly
54 * terminated (overflows, goes outside allowed bounds, or
55 * isn't properly terminated). */
56#define FDT_ERR_BADMAGIC 9
57/* FDT_ERR_BADMAGIC: Given "device tree" appears not to be a
58 * device tree at all - it is missing the flattened device
59 * tree magic number. */
60#define FDT_ERR_BADVERSION 10
61/* FDT_ERR_BADVERSION: Given device tree has a version which
62 * can't be handled by the requested operation. For
63 * read-write functions, this may mean that fdt_open_into() is
64 * required to convert the tree to the expected version. */
65#define FDT_ERR_BADSTRUCTURE 11
66/* FDT_ERR_BADSTRUCTURE: Given device tree has a corrupt
67 * structure block or other serious error (e.g. misnested
68 * nodes, or subnodes preceding properties). */
69#define FDT_ERR_BADLAYOUT 12
70/* FDT_ERR_BADLAYOUT: For read-write functions, the given
71 * device tree has it's sub-blocks in an order that the
72 * function can't handle (memory reserve map, then structure,
73 * then strings). Use fdt_open_into() to reorganize the tree
74 * into a form suitable for the read-write operations. */
75
76/* "Can't happen" error indicating a bug in libfdt */
77#define FDT_ERR_INTERNAL 13
78/* FDT_ERR_INTERNAL: libfdt has failed an internal assertion.
79 * Should never be returned, if it is, it indicates a bug in
80 * libfdt itself. */
81
82/* Errors in device tree content */
83#define FDT_ERR_BADNCELLS 14
84/* FDT_ERR_BADNCELLS: Device tree has a #address-cells, #size-cells
85 * or similar property with a bad format or value */
86
87#define FDT_ERR_BADVALUE 15
88/* FDT_ERR_BADVALUE: Device tree has a property with an unexpected
89 * value. For example: a property expected to contain a string list
90 * is not NUL-terminated within the length of its value. */
91
92#define FDT_ERR_BADOVERLAY 16
93/* FDT_ERR_BADOVERLAY: The device tree overlay, while
94 * correctly structured, cannot be applied due to some
95 * unexpected or missing value, property or node. */
96
97#define FDT_ERR_NOPHANDLES 17
98/* FDT_ERR_NOPHANDLES: The device tree doesn't have any
99 * phandle available anymore without causing an overflow */
100
101#define FDT_ERR_BADFLAGS 18
102/* FDT_ERR_BADFLAGS: The function was passed a flags field that
103 * contains invalid flags or an invalid combination of flags. */
104
105#define FDT_ERR_ALIGNMENT 19
106/* FDT_ERR_ALIGNMENT: The device tree base address is not 8-byte
107 * aligned. */
108
109#define FDT_ERR_MAX 19
110
111/* constants */
112#define FDT_MAX_PHANDLE 0xfffffffe
113/* Valid values for phandles range from 1 to 2^32-2. */
114
115
116/* Low-level functions (you probably don't need these) */
117
119#ifndef SWIG /* This function is not useful in Python */
120const void *fdt_offset_ptr(const void *fdt, int offset, unsigned int checklen);
121#endif
122static inline void *fdt_offset_ptr_w(void *fdt, int offset, int checklen) {
123 return (void *) (uintptr_t) fdt_offset_ptr(fdt, offset, checklen);
124}
125
126uint32_t fdt_next_tag(const void *fdt, int offset, int *nextoffset);
127
128/*
129 * External helpers to access words from a device tree blob. They're built
130 * to work even with unaligned pointers on platforms (such as ARMv5) that don't
131 * like unaligned loads and stores.
132 */
133static inline uint16_t fdt16_ld(const fdt16_t *p) {
134 const uint8_t *bp = (const uint8_t *) p;
135
136 return ((uint16_t) bp[0] << 8) | bp[1];
137}
138
139static inline uint32_t fdt32_ld(const fdt32_t *p) {
140 const uint8_t *bp = (const uint8_t *) p;
141
142 return ((uint32_t) bp[0] << 24) | ((uint32_t) bp[1] << 16) | ((uint32_t) bp[2] << 8) | bp[3];
143}
144
145static inline void fdt32_st(void *property, uint32_t value) {
146 uint8_t *bp = (uint8_t *) property;
147
148 bp[0] = value >> 24;
149 bp[1] = (value >> 16) & 0xff;
150 bp[2] = (value >> 8) & 0xff;
151 bp[3] = value & 0xff;
152}
153
154static inline uint64_t fdt64_ld(const fdt64_t *p) {
155 const uint8_t *bp = (const uint8_t *) p;
156
157 return ((uint64_t) bp[0] << 56) | ((uint64_t) bp[1] << 48) | ((uint64_t) bp[2] << 40) | ((uint64_t) bp[3] << 32) | ((uint64_t) bp[4] << 24) | ((uint64_t) bp[5] << 16) |
158 ((uint64_t) bp[6] << 8) | bp[7];
159}
160
161static inline void fdt64_st(void *property, uint64_t value) {
162 uint8_t *bp = (uint8_t *) property;
163
164 bp[0] = value >> 56;
165 bp[1] = (value >> 48) & 0xff;
166 bp[2] = (value >> 40) & 0xff;
167 bp[3] = (value >> 32) & 0xff;
168 bp[4] = (value >> 24) & 0xff;
169 bp[5] = (value >> 16) & 0xff;
170 bp[6] = (value >> 8) & 0xff;
171 bp[7] = value & 0xff;
172}
173
174
175/* Traversal functions */
176
178int fdt_next_node(const void *fdt, int offset, int *depth);
179
187int fdt_first_subnode(const void *fdt, int offset);
188
200int fdt_next_subnode(const void *fdt, int offset);
201
224#define fdt_for_each_subnode(node, fdt, parent) for (node = fdt_first_subnode(fdt, parent); node >= 0; node = fdt_next_subnode(fdt, node))
225
226
227/* General functions */
228
229#define fdt_get_header(fdt, field) (fdt32_ld(&((const struct fdt_header *) (fdt))->field))
230#define fdt_magic(fdt) (fdt_get_header(fdt, magic))
231#define fdt_totalsize(fdt) (fdt_get_header(fdt, totalsize))
232#define fdt_off_dt_struct(fdt) (fdt_get_header(fdt, off_dt_struct))
233#define fdt_off_dt_strings(fdt) (fdt_get_header(fdt, off_dt_strings))
234#define fdt_off_mem_rsvmap(fdt) (fdt_get_header(fdt, off_mem_rsvmap))
235#define fdt_version(fdt) (fdt_get_header(fdt, version))
236#define fdt_last_comp_version(fdt) (fdt_get_header(fdt, last_comp_version))
237#define fdt_boot_cpuid_phys(fdt) (fdt_get_header(fdt, boot_cpuid_phys))
238#define fdt_size_dt_strings(fdt) (fdt_get_header(fdt, size_dt_strings))
239#define fdt_size_dt_struct(fdt) (fdt_get_header(fdt, size_dt_struct))
240
241#define fdt_set_hdr_(name) \
242 static inline void fdt_set_##name(void *fdt, uint32_t val) { \
243 struct fdt_header *fdth = (struct fdt_header *) fdt; \
244 fdth->name = cpu_to_fdt32(val); \
245 }
247fdt_set_hdr_(totalsize);
248fdt_set_hdr_(off_dt_struct);
249fdt_set_hdr_(off_dt_strings);
250fdt_set_hdr_(off_mem_rsvmap);
252fdt_set_hdr_(last_comp_version);
253fdt_set_hdr_(boot_cpuid_phys);
254fdt_set_hdr_(size_dt_strings);
255fdt_set_hdr_(size_dt_struct);
256#undef fdt_set_hdr_
257
264size_t fdt_header_size(const void *fdt);
265
272size_t fdt_header_size_(uint32_t version);
273
290int fdt_check_header(const void *fdt);
291
311int fdt_move(const void *fdt, void *buf, int bufsize);
312
313
314/* Read-only functions */
315
317int fdt_check_full(const void *fdt, size_t bufsize);
318
333const char *fdt_get_string(const void *fdt, int stroffset, int *lenp);
334
347const char *fdt_string(const void *fdt, int stroffset);
348
361int fdt_find_max_phandle(const void *fdt, uint32_t *phandle);
362
378static inline uint32_t fdt_get_max_phandle(const void *fdt) {
379 uint32_t phandle;
380 int err;
381
382 err = fdt_find_max_phandle(fdt, &phandle);
383 if (err < 0)
384 return (uint32_t) -1;
385
386 return phandle;
387}
388
401int fdt_generate_phandle(const void *fdt, uint32_t *phandle);
402
414int fdt_num_mem_rsv(const void *fdt);
415
433int fdt_get_mem_rsv(const void *fdt, int n, uint64_t *address, uint64_t *size);
434
449#ifndef SWIG /* Not available in Python */
450int fdt_subnode_offset_namelen(const void *fdt, int parentoffset, const char *name, int namelen);
451#endif
476int fdt_subnode_offset(const void *fdt, int parentoffset, const char *name);
477
489#ifndef SWIG /* Not available in Python */
490int fdt_path_offset_namelen(const void *fdt, const char *path, int namelen);
491#endif
492
516int fdt_path_offset(const void *fdt, const char *path);
517
541const char *fdt_get_name(const void *fdt, int nodeoffset, int *lenp);
542
561int fdt_first_property_offset(const void *fdt, int nodeoffset);
562
582int fdt_next_property_offset(const void *fdt, int offset);
583
606#define fdt_for_each_property_offset(property, fdt, node) for (property = fdt_first_property_offset(fdt, node); property >= 0; property = fdt_next_property_offset(fdt, property))
607
635const struct fdt_property *fdt_get_property_by_offset(const void *fdt, int offset, int *lenp);
636
651#ifndef SWIG /* Not available in Python */
652const struct fdt_property *fdt_get_property_namelen(const void *fdt, int nodeoffset, const char *name, int namelen, int *lenp);
653#endif
654
683const struct fdt_property *fdt_get_property(const void *fdt, int nodeoffset, const char *name, int *lenp);
684static inline struct fdt_property *fdt_get_property_w(void *fdt, int nodeoffset, const char *name, int *lenp) {
685 return (struct fdt_property *) (uintptr_t) fdt_get_property(fdt, nodeoffset, name, lenp);
686}
687
719#ifndef SWIG /* This function is not useful in Python */
720const void *fdt_getprop_by_offset(const void *fdt, int offset, const char **namep, int *lenp);
721#endif
722
736#ifndef SWIG /* Not available in Python */
737const void *fdt_getprop_namelen(const void *fdt, int nodeoffset, const char *name, int namelen, int *lenp);
738static inline void *fdt_getprop_namelen_w(void *fdt, int nodeoffset, const char *name, int namelen, int *lenp) {
739 return (void *) (uintptr_t) fdt_getprop_namelen(fdt, nodeoffset, name, namelen, lenp);
740}
741#endif
742
771const void *fdt_getprop(const void *fdt, int nodeoffset, const char *name, int *lenp);
772static inline void *fdt_getprop_w(void *fdt, int nodeoffset, const char *name, int *lenp) {
773 return (void *) (uintptr_t) fdt_getprop(fdt, nodeoffset, name, lenp);
774}
775
788uint32_t fdt_get_phandle(const void *fdt, int nodeoffset);
789
802#ifndef SWIG /* Not available in Python */
803const char *fdt_get_alias_namelen(const void *fdt, const char *name, int namelen);
804#endif
805
818const char *fdt_get_alias(const void *fdt, const char *name);
819
845int fdt_get_path(const void *fdt, int nodeoffset, char *buf, int buflen);
846
877int fdt_supernode_atdepth_offset(const void *fdt, int nodeoffset, int supernodedepth, int *nodedepth);
878
898int fdt_node_depth(const void *fdt, int nodeoffset);
899
921int fdt_parent_offset(const void *fdt, int nodeoffset);
922
961int fdt_node_offset_by_prop_value(const void *fdt, int startoffset, const char *propname, const void *propval, int proplen);
962
982int fdt_node_offset_by_phandle(const void *fdt, uint32_t phandle);
983
1005int fdt_node_check_compatible(const void *fdt, int nodeoffset, const char *compatible);
1006
1041int fdt_node_offset_by_compatible(const void *fdt, int startoffset, const char *compatible);
1042
1055int fdt_stringlist_contains(const char *strlist, int listlen, const char *str);
1056
1068int fdt_stringlist_count(const void *fdt, int nodeoffset, const char *property);
1069
1089int fdt_stringlist_search(const void *fdt, int nodeoffset, const char *property, const char *string);
1090
1115const char *fdt_stringlist_get(const void *fdt, int nodeoffset, const char *property, int index, int *lenp);
1116
1117
1118/* Read-only functions (addressing related) */
1119
1130#define FDT_MAX_NCELLS 4
1131
1150int fdt_address_cells(const void *fdt, int nodeoffset);
1151
1171int fdt_size_cells(const void *fdt, int nodeoffset);
1172
1173
1174
1175/* Write-in-place functions */
1176
1196#ifndef SWIG /* Not available in Python */
1197int fdt_setprop_inplace_namelen_partial(void *fdt, int nodeoffset, const char *name, int namelen, uint32_t idx, const void *val, int len);
1198#endif
1199
1228#ifndef SWIG /* Not available in Python */
1229int fdt_setprop_inplace(void *fdt, int nodeoffset, const char *name, const void *val, int len);
1230#endif
1231
1260static inline int fdt_setprop_inplace_u32(void *fdt, int nodeoffset, const char *name, uint32_t val) {
1261 fdt32_t tmp = cpu_to_fdt32(val);
1262 return fdt_setprop_inplace(fdt, nodeoffset, name, &tmp, sizeof(tmp));
1263}
1264
1293static inline int fdt_setprop_inplace_u64(void *fdt, int nodeoffset, const char *name, uint64_t val) {
1294 fdt64_t tmp = cpu_to_fdt64(val);
1295 return fdt_setprop_inplace(fdt, nodeoffset, name, &tmp, sizeof(tmp));
1296}
1297
1308static inline int fdt_setprop_inplace_cell(void *fdt, int nodeoffset, const char *name, uint32_t val) {
1309 return fdt_setprop_inplace_u32(fdt, nodeoffset, name, val);
1310}
1311
1336int fdt_nop_property(void *fdt, int nodeoffset, const char *name);
1337
1360int fdt_nop_node(void *fdt, int nodeoffset);
1361
1362
1363/* Sequential write functions */
1364
1366/* fdt_create_with_flags flags */
1367#define FDT_CREATE_FLAG_NO_NAME_DEDUP 0x1
1368/* FDT_CREATE_FLAG_NO_NAME_DEDUP: Do not try to de-duplicate property
1369 * names in the fdt. This can result in faster creation times, but
1370 * a larger fdt. */
1371
1372#define FDT_CREATE_FLAGS_ALL (FDT_CREATE_FLAG_NO_NAME_DEDUP)
1373
1390int fdt_create_with_flags(void *buf, int bufsize, uint32_t flags);
1391
1403int fdt_create(void *buf, int bufsize);
1404
1405int fdt_resize(void *fdt, void *buf, int bufsize);
1406int fdt_add_reservemap_entry(void *fdt, uint64_t addr, uint64_t size);
1407int fdt_finish_reservemap(void *fdt);
1408int fdt_begin_node(void *fdt, const char *name);
1409int fdt_property(void *fdt, const char *name, const void *val, int len);
1410static inline int fdt_property_u32(void *fdt, const char *name, uint32_t val) {
1411 fdt32_t tmp = cpu_to_fdt32(val);
1412 return fdt_property(fdt, name, &tmp, sizeof(tmp));
1413}
1414static inline int fdt_property_u64(void *fdt, const char *name, uint64_t val) {
1415 fdt64_t tmp = cpu_to_fdt64(val);
1416 return fdt_property(fdt, name, &tmp, sizeof(tmp));
1417}
1418
1419#ifndef SWIG /* Not available in Python */
1420static inline int fdt_property_cell(void *fdt, const char *name, uint32_t val) {
1421 return fdt_property_u32(fdt, name, val);
1422}
1423#endif
1424
1438int fdt_property_placeholder(void *fdt, const char *name, int len, void **valp);
1439
1440#define fdt_property_string(fdt, name, str) fdt_property(fdt, name, str, strlen(str) + 1)
1441int fdt_end_node(void *fdt);
1442int fdt_finish(void *fdt);
1443
1444
1445/* Read-write functions */
1446
1448int fdt_create_empty_tree(void *buf, int bufsize);
1449int fdt_open_into(const void *fdt, void *buf, int bufsize);
1450int fdt_pack(void *fdt);
1451
1475int fdt_add_mem_rsv(void *fdt, uint64_t address, uint64_t size);
1476
1499int fdt_del_mem_rsv(void *fdt, int n);
1500
1525int fdt_set_name(void *fdt, int nodeoffset, const char *name);
1526
1555int fdt_setprop(void *fdt, int nodeoffset, const char *name, const void *val, int len);
1556
1585int fdt_setprop_placeholder(void *fdt, int nodeoffset, const char *name, int len, void **prop_data);
1586
1615static inline int fdt_setprop_u32(void *fdt, int nodeoffset, const char *name, uint32_t val) {
1616 fdt32_t tmp = cpu_to_fdt32(val);
1617 return fdt_setprop(fdt, nodeoffset, name, &tmp, sizeof(tmp));
1618}
1619
1648static inline int fdt_setprop_u64(void *fdt, int nodeoffset, const char *name, uint64_t val) {
1649 fdt64_t tmp = cpu_to_fdt64(val);
1650 return fdt_setprop(fdt, nodeoffset, name, &tmp, sizeof(tmp));
1651}
1652
1664static inline int fdt_setprop_cell(void *fdt, int nodeoffset, const char *name, uint32_t val) {
1665 return fdt_setprop_u32(fdt, nodeoffset, name, val);
1666}
1667
1696#define fdt_setprop_string(fdt, nodeoffset, name, str) fdt_setprop((fdt), (nodeoffset), (name), (str), strlen(str) + 1)
1697
1698
1725#define fdt_setprop_empty(fdt, nodeoffset, name) fdt_setprop((fdt), (nodeoffset), (name), NULL, 0)
1726
1754int fdt_appendprop(void *fdt, int nodeoffset, const char *name, const void *val, int len);
1755
1784static inline int fdt_appendprop_u32(void *fdt, int nodeoffset, const char *name, uint32_t val) {
1785 fdt32_t tmp = cpu_to_fdt32(val);
1786 return fdt_appendprop(fdt, nodeoffset, name, &tmp, sizeof(tmp));
1787}
1788
1817static inline int fdt_appendprop_u64(void *fdt, int nodeoffset, const char *name, uint64_t val) {
1818 fdt64_t tmp = cpu_to_fdt64(val);
1819 return fdt_appendprop(fdt, nodeoffset, name, &tmp, sizeof(tmp));
1820}
1821
1833static inline int fdt_appendprop_cell(void *fdt, int nodeoffset, const char *name, uint32_t val) {
1834 return fdt_appendprop_u32(fdt, nodeoffset, name, val);
1835}
1836
1864#define fdt_appendprop_string(fdt, nodeoffset, name, str) fdt_appendprop((fdt), (nodeoffset), (name), (str), strlen(str) + 1)
1865
1900int fdt_appendprop_addrrange(void *fdt, int parent, int nodeoffset, const char *name, uint64_t addr, uint64_t size);
1901
1924int fdt_delprop(void *fdt, int nodeoffset, const char *name);
1925
1941#ifndef SWIG /* Not available in Python */
1942int fdt_add_subnode_namelen(void *fdt, int parentoffset, const char *name, int namelen);
1943#endif
1944
1976int fdt_add_subnode(void *fdt, int parentoffset, const char *name);
1977
1999int fdt_del_node(void *fdt, int nodeoffset);
2000
2030int fdt_overlay_apply(void *fdt, void *fdto);
2031
2032
2033/* Debugging / informational functions */
2034
2036const char *fdt_strerror(int errval);
2037
2038#ifdef __cplusplus
2039}
2040#endif
2041
2042#endif /* LIBFDT_H */
ul val
Definition memtester.c:33
char name[ANDR_BOOT_NAME_SIZE]
Definition bimage.c:76
char magic[ANDR_BOOT_MAGIC_SIZE]
Definition bimage.c:54
u64_t uint64_t
Definition stdint.h:16
u32_t uint32_t
Definition stdint.h:13
u8_t uint8_t
Definition stdint.h:7
u16_t uint16_t
Definition stdint.h:10
unsigned long long uintptr_t
Definition types.h:21
static uint8_t value
Definition io.h:144
int fdt_add_subnode(void *fdt, int parentoffset, const char *name)
Definition fdt_rw.c:337
static uint16_t fdt16_ld(const fdt16_t *p)
Definition libfdt.h:133
int fdt_finish_reservemap(void *fdt)
Definition fdt_sw.c:195
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 @nodeoff...
Definition fdt_ro.c:445
int fdt_create_with_flags(void *buf, int bufsize, uint32_t flags)
fdt_create_with_flags - begin creation of a new fdt @buf: pointer to memory allocated where fdt will ...
Definition fdt_sw.c:102
int fdt_first_subnode(const void *fdt, int offset)
fdt_first_subnode() - get offset of first direct subnode @fdt: FDT blob @offset: Offset of node to ch...
Definition fdt.c:249
int fdt_stringlist_search(const void *fdt, int nodeoffset, const char *property, const char *string)
Definition fdt_ro.c:657
int fdt_move(const void *fdt, void *buf, int bufsize)
fdt_move - move a device tree around in memory @fdt: pointer to the device tree to move @buf: pointer...
Definition fdt.c:286
const char * fdt_stringlist_get(const void *fdt, int nodeoffset, const char *property, int index, int *lenp)
Definition fdt_ro.c:685
const char * fdt_get_alias_namelen(const void *fdt, const char *name, int namelen)
Definition fdt_ro.c:461
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...
Definition fdt_ro.c:272
int fdt_subnode_offset(const void *fdt, int parentoffset, const char *name)
Definition fdt_ro.c:224
int fdt_check_header(const void *fdt)
fdt_check_header - sanity check a device tree header @fdt: pointer to data which might be a flattened...
Definition fdt.c:81
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 l...
Definition fdt_ro.c:617
uint32_t fdt_next_tag(const void *fdt, int offset, int *nextoffset)
Definition fdt.c:143
int fdt_appendprop(void *fdt, int nodeoffset, const char *name, const void *val, int len)
Definition fdt_rw.c:258
static void * fdt_offset_ptr_w(void *fdt, int offset, int checklen)
Definition libfdt.h:122
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...
Definition fdt_ro.c:566
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: of...
Definition fdt_ro.c:556
const void * fdt_getprop_namelen(const void *fdt, int nodeoffset, const char *name, int namelen, int *lenp)
Definition fdt_ro.c:398
static int fdt_setprop_cell(void *fdt, int nodeoffset, const char *name, uint32_t val)
Definition libfdt.h:1664
static struct fdt_property * fdt_get_property_w(void *fdt, int nodeoffset, const char *name, int *lenp)
Definition libfdt.h:684
int fdt_size_cells(const void *fdt, int nodeoffset)
fdt_size_cells - retrieve address range size for a bus represented in the tree @fdt: pointer to the d...
Definition fdt_addresses.c:44
static int fdt_setprop_inplace_cell(void *fdt, int nodeoffset, const char *name, uint32_t val)
Definition libfdt.h:1308
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...
Definition fdt_rw.c:135
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...
Definition fdt_rw.c:151
static int fdt_appendprop_u32(void *fdt, int nodeoffset, const char *name, uint32_t val)
Definition libfdt.h:1784
static void fdt64_st(void *property, uint64_t value)
Definition libfdt.h:161
static int fdt_setprop_u32(void *fdt, int nodeoffset, const char *name, uint32_t val)
Definition libfdt.h:1615
static int fdt_property_u64(void *fdt, const char *name, uint64_t val)
Definition libfdt.h:1414
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 : inde...
Definition fdt_ro.c:163
int fdt_create(void *buf, int bufsize)
fdt_create - begin creation of a new fdt @buf: pointer to memory allocated where fdt will be created ...
Definition fdt_sw.c:134
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...
Definition fdt_ro.c:595
const char * fdt_get_alias(const void *fdt, const char *name)
Definition fdt_ro.c:471
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...
Definition fdt_ro.c:106
static int fdt_setprop_u64(void *fdt, int nodeoffset, const char *name, uint64_t val)
Definition libfdt.h:1648
int fdt_appendprop_addrrange(void *fdt, int parent, int nodeoffset, const char *name, uint64_t addr, uint64_t size)
Definition fdt_addresses.c:54
int fdt_delprop(void *fdt, int nodeoffset, const char *name)
Definition fdt_rw.c:281
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 devic...
Definition fdt_ro.c:31
int fdt_finish(void *fdt)
Definition fdt_sw.c:316
int fdt_next_node(const void *fdt, int offset, int *depth)
Definition fdt.c:211
int fdt_setprop_inplace(void *fdt, int nodeoffset, const char *name, const void *val, int len)
Definition fdt_wip.c:28
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 bl...
Definition fdt_ro.c:522
const void * fdt_offset_ptr(const void *fdt, int offset, unsigned int checklen)
Definition fdt.c:125
int fdt_begin_node(void *fdt, const char *name)
Definition fdt_sw.c:205
const struct fdt_property * fdt_get_property_namelen(const void *fdt, int nodeoffset, const char *name, int namelen, int *lenp)
Definition fdt_ro.c:381
int fdt_setprop_placeholder(void *fdt, int nodeoffset, const char *name, int len, void **prop_data)
Definition fdt_rw.c:229
static int fdt_appendprop_cell(void *fdt, int nodeoffset, const char *name, uint32_t val)
Definition libfdt.h:1833
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 ...
Definition fdt_ro.c:176
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 devic...
Definition fdt_ro.c:133
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: o...
Definition fdt_ro.c:475
const struct fdt_property * fdt_get_property(const void *fdt, int nodeoffset, const char *name, int *lenp)
Definition fdt_ro.c:394
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 devic...
Definition fdt_ro.c:738
int fdt_property_placeholder(void *fdt, const char *name, int len, void **valp)
Definition fdt_sw.c:274
const void * fdt_getprop(const void *fdt, int nodeoffset, const char *name, int *lenp)
Definition fdt_ro.c:441
int fdt_subnode_offset_namelen(const void *fdt, int parentoffset, const char *name, int namelen)
Definition fdt_ro.c:210
static uint64_t fdt64_ld(const fdt64_t *p)
Definition libfdt.h:154
int fdt_pack(void *fdt)
Definition fdt_rw.c:435
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 tr...
Definition fdt_ro.c:574
static void * fdt_getprop_namelen_w(void *fdt, int nodeoffset, const char *name, int namelen, int *lenp)
Definition libfdt.h:738
int fdt_stringlist_count(const void *fdt, int nodeoffset, const char *property)
Definition fdt_ro.c:633
int fdt_check_full(const void *fdt, size_t bufsize)
int fdt_add_subnode_namelen(void *fdt, int parentoffset, const char *name, int namelen)
Definition fdt_rw.c:295
static int fdt_setprop_inplace_u32(void *fdt, int nodeoffset, const char *name, uint32_t val)
Definition libfdt.h:1260
int fdt_add_reservemap_entry(void *fdt, uint64_t addr, uint64_t size)
Definition fdt_sw.c:176
int fdt_open_into(const void *fdt, void *buf, int bufsize)
Definition fdt_rw.c:372
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...
Definition fdt_ro.c:346
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 @pa...
Definition fdt_ro.c:228
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: s...
Definition fdt_ro.c:276
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 tr...
Definition fdt_ro.c:95
static int fdt_appendprop_u64(void *fdt, int nodeoffset, const char *name, uint64_t val)
Definition libfdt.h:1817
#define fdt_set_hdr_(name)
Definition libfdt.h:241
static void fdt32_st(void *property, uint32_t value)
Definition libfdt.h:145
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 tr...
Definition fdt_ro.c:312
static int fdt_setprop_inplace_u64(void *fdt, int nodeoffset, const char *name, uint64_t val)
Definition libfdt.h:1293
int fdt_address_cells(const void *fdt, int nodeoffset)
fdt_address_cells - retrieve address size for a bus represented in the tree @fdt: pointer to the devi...
Definition fdt_addresses.c:33
static uint32_t fdt32_ld(const fdt32_t *p)
Definition libfdt.h:139
int fdt_create_empty_tree(void *buf, int bufsize)
Definition fdt_empty_tree.c:13
int fdt_resize(void *fdt, void *buf, int bufsize)
Definition fdt_sw.c:138
size_t fdt_header_size_(uint32_t version)
fdt_header_size_ - internal function to get header size from a version number
Definition fdt.c:64
int fdt_nop_node(void *fdt, int nodeoffset)
fdt_nop_node - replace a node (subtree) with nop tags @fdt: pointer to the device tree blob @nodeoffs...
Definition fdt_wip.c:69
int fdt_end_node(void *fdt)
Definition fdt_sw.c:221
int fdt_next_subnode(const void *fdt, int offset)
fdt_next_subnode() - get offset of next direct subnode @fdt: FDT blob @offset: Offset of previous sub...
Definition fdt.c:259
int fdt_nop_property(void *fdt, int nodeoffset, const char *name)
Definition fdt_wip.c:48
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 @fdt...
Definition fdt_overlay.c:781
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 @of...
Definition fdt_ro.c:321
int fdt_setprop_inplace_namelen_partial(void *fdt, int nodeoffset, const char *name, int namelen, uint32_t idx, const void *val, int len)
Definition fdt_wip.c:13
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 devic...
Definition fdt_ro.c:412
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 t...
Definition fdt_rw.c:341
int fdt_set_name(void *fdt, int nodeoffset, const char *name)
Definition fdt_rw.c:208
const char * fdt_strerror(int errval)
Definition fdt_strerror.c:48
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 ...
Definition fdt_ro.c:727
static int fdt_property_cell(void *fdt, const char *name, uint32_t val)
Definition libfdt.h:1420
static int fdt_property_u32(void *fdt, const char *name, uint32_t val)
Definition libfdt.h:1410
int fdt_setprop(void *fdt, int nodeoffset, const char *name, const void *val, int len)
Definition fdt_rw.c:245
static uint32_t fdt_get_max_phandle(const void *fdt)
fdt_get_max_phandle - retrieves the highest phandle in a tree @fdt: pointer to the device tree blob
Definition libfdt.h:378
static void * fdt_getprop_w(void *fdt, int nodeoffset, const char *name, int *lenp)
Definition libfdt.h:772
size_t fdt_header_size(const void *fdt)
fdt_header_size - return the size of the tree's header @fdt: pointer to a flattened device tree
Definition fdt.c:77
static fdt32_t cpu_to_fdt32(uint32_t x)
Definition libfdt_env.h:50
static fdt64_t cpu_to_fdt64(uint64_t x)
Definition libfdt_env.h:57
uint32_t FDT_BITWISE fdt32_t
Definition libfdt_env.h:30
uint16_t FDT_BITWISE fdt16_t
Definition libfdt_env.h:29
uint64_t FDT_BITWISE fdt64_t
Definition libfdt_env.h:31
Definition fdt.h:45
fdt32_t len
Definition fdt.h:47
uint16_t index
Definition usb.h:3