Lines Matching refs:fdt

55 #include "fdt.h"
148 const void *fdt_offset_ptr(const void *fdt, int offset, unsigned int checklen);
150 static inline void *fdt_offset_ptr_w(void *fdt, int offset, int checklen)
152 return (void *)(uintptr_t)fdt_offset_ptr(fdt, offset, checklen);
155 uint32_t fdt_next_tag(const void *fdt, int offset, int *nextoffset);
184 int fdt_next_node(const void *fdt, int offset, int *depth);
189 * @fdt: FDT blob
193 int fdt_first_subnode(const void *fdt, int offset);
201 * @fdt: FDT blob
206 int fdt_next_subnode(const void *fdt, int offset);
212 * @fdt: FDT blob (const void *)
217 * fdt_for_each_subnode(node, fdt, parent) {
231 #define fdt_for_each_subnode(node, fdt, parent) \
232 for (node = fdt_first_subnode(fdt, parent); \
234 node = fdt_next_subnode(fdt, node))
239 #define fdt_get_header(fdt, field) \
240 (fdt32_ld(&((const struct fdt_header *)(fdt))->field))
241 #define fdt_magic(fdt) (fdt_get_header(fdt, magic))
242 #define fdt_totalsize(fdt) (fdt_get_header(fdt, totalsize))
243 #define fdt_off_dt_struct(fdt) (fdt_get_header(fdt, off_dt_struct))
244 #define fdt_off_dt_strings(fdt) (fdt_get_header(fdt, off_dt_strings))
245 #define fdt_off_mem_rsvmap(fdt) (fdt_get_header(fdt, off_mem_rsvmap))
246 #define fdt_version(fdt) (fdt_get_header(fdt, version))
247 #define fdt_last_comp_version(fdt) (fdt_get_header(fdt, last_comp_version))
248 #define fdt_boot_cpuid_phys(fdt) (fdt_get_header(fdt, boot_cpuid_phys))
249 #define fdt_size_dt_strings(fdt) (fdt_get_header(fdt, size_dt_strings))
250 #define fdt_size_dt_struct(fdt) (fdt_get_header(fdt, size_dt_struct))
253 static inline void fdt_set_##name(void *fdt, uint32_t val) \
255 struct fdt_header *fdth = (struct fdt_header *)fdt; \
285 * @fdt: pointer to a flattened device tree
288 static inline size_t fdt_header_size(const void *fdt)
290 return fdt_header_size_(fdt_version(fdt));
296 * @fdt: pointer to data which might be a flattened device tree
310 int fdt_check_header(const void *fdt);
314 * @fdt: pointer to the device tree to move
319 * fdt to the buffer at buf of size bufsize. The buffer may overlap
320 * with the existing device tree blob at fdt. Therefore,
321 * fdt_move(fdt, fdt, fdt_totalsize(fdt))
331 int fdt_move(const void *fdt, void *buf, int bufsize);
337 int fdt_check_full(const void *fdt, size_t bufsize);
341 * @fdt: pointer to the device tree blob
346 * strings block of the device tree blob at fdt, and optionally also
353 const char *fdt_get_string(const void *fdt, int stroffset, int *lenp);
357 * @fdt: pointer to the device tree blob
361 * strings block of the device tree blob at fdt.
367 const char *fdt_string(const void *fdt, int stroffset);
371 * @fdt: pointer to the device tree blob
382 uint32_t fdt_get_max_phandle(const void *fdt);
386 * @fdt: pointer to the device tree blob
395 int fdt_num_mem_rsv(const void *fdt);
399 * @fdt: pointer to the device tree blob
412 int fdt_get_mem_rsv(const void *fdt, int n, uint64_t *address, uint64_t *size);
416 * @fdt: pointer to the device tree blob
427 int fdt_subnode_offset_namelen(const void *fdt, int parentoffset,
432 * @fdt: pointer to the device tree blob
454 int fdt_subnode_offset(const void *fdt, int parentoffset, const char *name);
458 * @fdt: pointer to the device tree blob
466 int fdt_path_offset_namelen(const void *fdt, const char *path, int namelen);
471 * @fdt: pointer to the device tree blob
492 int fdt_path_offset(const void *fdt, const char *path);
496 * @fdt: pointer to the device tree blob
517 const char *fdt_get_name(const void *fdt, int nodeoffset, int *lenp);
521 * @fdt: pointer to the device tree blob
537 int fdt_first_property_offset(const void *fdt, int nodeoffset);
541 * @fdt: pointer to the device tree blob
558 int fdt_next_property_offset(const void *fdt, int offset);
564 * @fdt: FDT blob (const void *)
569 * fdt_for_each_property_offset(property, fdt, node) {
582 #define fdt_for_each_property_offset(property, fdt, node) \
583 for (property = fdt_first_property_offset(fdt, node); \
585 property = fdt_next_property_offset(fdt, property))
589 * @fdt: pointer to the device tree blob
614 const struct fdt_property *fdt_get_property_by_offset(const void *fdt,
620 * @fdt: pointer to the device tree blob
630 const struct fdt_property *fdt_get_property_namelen(const void *fdt,
638 * @fdt: pointer to the device tree blob
664 const struct fdt_property *fdt_get_property(const void *fdt, int nodeoffset,
666 static inline struct fdt_property *fdt_get_property_w(void *fdt, int nodeoffset,
671 fdt_get_property(fdt, nodeoffset, name, lenp);
676 * @fdt: pointer to the device tree blob
706 const void *fdt_getprop_by_offset(const void *fdt, int offset,
712 * @fdt: pointer to the device tree blob
722 const void *fdt_getprop_namelen(const void *fdt, int nodeoffset,
724 static inline void *fdt_getprop_namelen_w(void *fdt, int nodeoffset,
728 return (void *)(uintptr_t)fdt_getprop_namelen(fdt, nodeoffset, name,
735 * @fdt: pointer to the device tree blob
761 const void *fdt_getprop(const void *fdt, int nodeoffset,
763 static inline void *fdt_getprop_w(void *fdt, int nodeoffset,
766 return (void *)(uintptr_t)fdt_getprop(fdt, nodeoffset, name, lenp);
771 * @fdt: pointer to the device tree blob
781 uint32_t fdt_get_phandle(const void *fdt, int nodeoffset);
785 * @fdt: pointer to the device tree blob
793 const char *fdt_get_alias_namelen(const void *fdt,
799 * @fdt: pointer to the device tree blob
809 const char *fdt_get_alias(const void *fdt, const char *name);
813 * @fdt: pointer to the device tree blob
836 int fdt_get_path(const void *fdt, int nodeoffset, char *buf, int buflen);
840 * @fdt: pointer to the device tree blob
848 * fdt_supernode_atdepth_offset(fdt, nodeoffset, 0, NULL);
851 * fdt_supernode_atdepth_offset(fdt, nodeoffset, D, NULL);
868 int fdt_supernode_atdepth_offset(const void *fdt, int nodeoffset,
873 * @fdt: pointer to the device tree blob
890 int fdt_node_depth(const void *fdt, int nodeoffset);
894 * @fdt: pointer to the device tree blob
913 int fdt_parent_offset(const void *fdt, int nodeoffset);
917 * @fdt: pointer to the device tree blob
930 * offset = fdt_node_offset_by_prop_value(fdt, -1, propname,
934 * offset = fdt_node_offset_by_prop_value(fdt, offset, propname,
953 int fdt_node_offset_by_prop_value(const void *fdt, int startoffset,
959 * @fdt: pointer to the device tree blob
976 int fdt_node_offset_by_phandle(const void *fdt, uint32_t phandle);
980 * @fdt: pointer to the device tree blob
1000 int fdt_node_check_compatible(const void *fdt, int nodeoffset,
1005 * @fdt: pointer to the device tree blob
1016 * offset = fdt_node_offset_by_compatible(fdt, -1, compatible);
1019 * offset = fdt_node_offset_by_compatible(fdt, offset, compatible);
1037 int fdt_node_offset_by_compatible(const void *fdt, int startoffset,
1056 * @fdt: pointer to the device tree blob
1064 int fdt_stringlist_count(const void *fdt, int nodeoffset, const char *property);
1068 * @fdt: pointer to the device tree blob
1085 int fdt_stringlist_search(const void *fdt, int nodeoffset, const char *property,
1090 * @fdt: pointer to the device tree blob
1112 const char *fdt_stringlist_get(const void *fdt, int nodeoffset,
1133 * @fdt: pointer to the device tree blob
1149 int fdt_address_cells(const void *fdt, int nodeoffset);
1154 * @fdt: pointer to the device tree blob
1170 int fdt_size_cells(const void *fdt, int nodeoffset);
1180 * @fdt: pointer to the device tree blob
1194 int fdt_setprop_inplace_namelen_partial(void *fdt, int nodeoffset,
1202 * @fdt: pointer to the device tree blob
1229 int fdt_setprop_inplace(void *fdt, int nodeoffset, const char *name,
1235 * @fdt: pointer to the device tree blob
1261 static inline int fdt_setprop_inplace_u32(void *fdt, int nodeoffset,
1265 return fdt_setprop_inplace(fdt, nodeoffset, name, &tmp, sizeof(tmp));
1270 * @fdt: pointer to the device tree blob
1296 static inline int fdt_setprop_inplace_u64(void *fdt, int nodeoffset,
1300 return fdt_setprop_inplace(fdt, nodeoffset, name, &tmp, sizeof(tmp));
1308 static inline int fdt_setprop_inplace_cell(void *fdt, int nodeoffset,
1311 return fdt_setprop_inplace_u32(fdt, nodeoffset, name, val);
1316 * @fdt: pointer to the device tree blob
1338 int fdt_nop_property(void *fdt, int nodeoffset, const char *name);
1342 * @fdt: pointer to the device tree blob
1362 int fdt_nop_node(void *fdt, int nodeoffset);
1369 int fdt_resize(void *fdt, void *buf, int bufsize);
1370 int fdt_add_reservemap_entry(void *fdt, uint64_t addr, uint64_t size);
1371 int fdt_finish_reservemap(void *fdt);
1372 int fdt_begin_node(void *fdt, const char *name);
1373 int fdt_property(void *fdt, const char *name, const void *val, int len);
1374 static inline int fdt_property_u32(void *fdt, const char *name, uint32_t val)
1377 return fdt_property(fdt, name, &tmp, sizeof(tmp));
1379 static inline int fdt_property_u64(void *fdt, const char *name, uint64_t val)
1382 return fdt_property(fdt, name, &tmp, sizeof(tmp));
1386 static inline int fdt_property_cell(void *fdt, const char *name, uint32_t val)
1388 return fdt_property_u32(fdt, name, val);
1395 * @fdt: pointer to the device tree blob
1405 int fdt_property_placeholder(void *fdt, const char *name, int len, void **valp);
1407 #define fdt_property_string(fdt, name, str) \
1408 fdt_property(fdt, name, str, strlen(str)+1)
1409 int fdt_end_node(void *fdt);
1410 int fdt_finish(void *fdt);
1417 int fdt_open_into(const void *fdt, void *buf, int bufsize);
1418 int fdt_pack(void *fdt);
1422 * @fdt: pointer to the device tree blob
1442 int fdt_add_mem_rsv(void *fdt, uint64_t address, uint64_t size);
1446 * @fdt: pointer to the device tree blob
1466 int fdt_del_mem_rsv(void *fdt, int n);
1470 * @fdt: pointer to the device tree blob
1492 int fdt_set_name(void *fdt, int nodeoffset, const char *name);
1496 * @fdt: pointer to the device tree blob
1522 int fdt_setprop(void *fdt, int nodeoffset, const char *name,
1527 * @fdt: pointer to the device tree blob
1553 int fdt_setprop_placeholder(void *fdt, int nodeoffset, const char *name,
1558 * @fdt: pointer to the device tree blob
1584 static inline int fdt_setprop_u32(void *fdt, int nodeoffset, const char *name,
1588 return fdt_setprop(fdt, nodeoffset, name, &tmp, sizeof(tmp));
1593 * @fdt: pointer to the device tree blob
1619 static inline int fdt_setprop_u64(void *fdt, int nodeoffset, const char *name,
1623 return fdt_setprop(fdt, nodeoffset, name, &tmp, sizeof(tmp));
1631 static inline int fdt_setprop_cell(void *fdt, int nodeoffset, const char *name,
1634 return fdt_setprop_u32(fdt, nodeoffset, name, val);
1639 * @fdt: pointer to the device tree blob
1665 #define fdt_setprop_string(fdt, nodeoffset, name, str) \
1666 fdt_setprop((fdt), (nodeoffset), (name), (str), strlen(str)+1)
1671 * @fdt: pointer to the device tree blob
1695 #define fdt_setprop_empty(fdt, nodeoffset, name) \
1696 fdt_setprop((fdt), (nodeoffset), (name), NULL, 0)
1700 * @fdt: pointer to the device tree blob
1725 int fdt_appendprop(void *fdt, int nodeoffset, const char *name,
1730 * @fdt: pointer to the device tree blob
1756 static inline int fdt_appendprop_u32(void *fdt, int nodeoffset,
1760 return fdt_appendprop(fdt, nodeoffset, name, &tmp, sizeof(tmp));
1765 * @fdt: pointer to the device tree blob
1791 static inline int fdt_appendprop_u64(void *fdt, int nodeoffset,
1795 return fdt_appendprop(fdt, nodeoffset, name, &tmp, sizeof(tmp));
1803 static inline int fdt_appendprop_cell(void *fdt, int nodeoffset,
1806 return fdt_appendprop_u32(fdt, nodeoffset, name, val);
1811 * @fdt: pointer to the device tree blob
1836 #define fdt_appendprop_string(fdt, nodeoffset, name, str) \
1837 fdt_appendprop((fdt), (nodeoffset), (name), (str), strlen(str)+1)
1841 * @fdt: pointer to the device tree blob
1861 int fdt_delprop(void *fdt, int nodeoffset, const char *name);
1865 * @fdt: pointer to the device tree blob
1876 int fdt_add_subnode_namelen(void *fdt, int parentoffset,
1882 * @fdt: pointer to the device tree blob
1911 int fdt_add_subnode(void *fdt, int parentoffset, const char *name);
1915 * @fdt: pointer to the device tree blob
1934 int fdt_del_node(void *fdt, int nodeoffset);
1938 * @fdt: pointer to the base device tree blob
1965 int fdt_overlay_apply(void *fdt, void *fdto);