Lines Matching refs:fdt
12 #include <fdt.h>
50 /* FDT_ERR_TRUNCATED: FDT or a sub-block is improperly
113 const void *fdt_offset_ptr(const void *fdt, int offset, unsigned int checklen);
115 static inline void *fdt_offset_ptr_w(void *fdt, int offset, int checklen)
117 return (void *)(uintptr_t)fdt_offset_ptr(fdt, offset, checklen);
120 uint32_t fdt_next_tag(const void *fdt, int offset, int *nextoffset);
181 int fdt_next_node(const void *fdt, int offset, int *depth);
186 * @fdt: FDT blob
190 int fdt_first_subnode(const void *fdt, int offset);
198 * @fdt: FDT blob
203 int fdt_next_subnode(const void *fdt, int offset);
209 * @fdt: FDT blob (const void *)
214 * fdt_for_each_subnode(node, fdt, parent) {
228 #define fdt_for_each_subnode(node, fdt, parent) \
229 for (node = fdt_first_subnode(fdt, parent); \
231 node = fdt_next_subnode(fdt, node))
236 #define fdt_get_header(fdt, field) \
237 (fdt32_ld(&((const struct fdt_header *)(fdt))->field))
238 #define fdt_magic(fdt) (fdt_get_header(fdt, magic))
239 #define fdt_totalsize(fdt) (fdt_get_header(fdt, totalsize))
240 #define fdt_off_dt_struct(fdt) (fdt_get_header(fdt, off_dt_struct))
241 #define fdt_off_dt_strings(fdt) (fdt_get_header(fdt, off_dt_strings))
242 #define fdt_off_mem_rsvmap(fdt) (fdt_get_header(fdt, off_mem_rsvmap))
243 #define fdt_version(fdt) (fdt_get_header(fdt, version))
244 #define fdt_last_comp_version(fdt) (fdt_get_header(fdt, last_comp_version))
245 #define fdt_boot_cpuid_phys(fdt) (fdt_get_header(fdt, boot_cpuid_phys))
246 #define fdt_size_dt_strings(fdt) (fdt_get_header(fdt, size_dt_strings))
247 #define fdt_size_dt_struct(fdt) (fdt_get_header(fdt, size_dt_struct))
250 static inline void fdt_set_##name(void *fdt, uint32_t val) \
252 struct fdt_header *fdth = (struct fdt_header *)fdt; \
269 * @fdt: pointer to a flattened device tree
272 static inline size_t fdt_header_size(const void *fdt)
274 return fdt_header_size_(fdt_version(fdt));
280 * @fdt: pointer to data which might be a flattened device tree
294 int fdt_check_header(const void *fdt);
298 * @fdt: pointer to the device tree to move
303 * fdt to the buffer at buf of size bufsize. The buffer may overlap
304 * with the existing device tree blob at fdt. Therefore,
305 * fdt_move(fdt, fdt, fdt_totalsize(fdt))
315 int fdt_move(const void *fdt, void *buf, int bufsize);
321 int fdt_check_full(const void *fdt, size_t bufsize);
325 * @fdt: pointer to the device tree blob
330 * strings block of the device tree blob at fdt, and optionally also
337 const char *fdt_get_string(const void *fdt, int stroffset, int *lenp);
341 * @fdt: pointer to the device tree blob
345 * strings block of the device tree blob at fdt.
351 const char *fdt_string(const void *fdt, int stroffset);
355 * @fdt: pointer to the device tree blob
365 int fdt_find_max_phandle(const void *fdt, uint32_t *phandle);
369 * @fdt: pointer to the device tree blob
382 static inline uint32_t fdt_get_max_phandle(const void *fdt)
387 err = fdt_find_max_phandle(fdt, &phandle);
396 * @fdt: pointer to the device tree blob
407 int fdt_generate_phandle(const void *fdt, uint32_t *phandle);
411 * @fdt: pointer to the device tree blob
420 int fdt_num_mem_rsv(const void *fdt);
424 * @fdt: pointer to the device tree blob
437 int fdt_get_mem_rsv(const void *fdt, int n, uint64_t *address, uint64_t *size);
441 * @fdt: pointer to the device tree blob
452 int fdt_subnode_offset_namelen(const void *fdt, int parentoffset,
457 * @fdt: pointer to the device tree blob
479 int fdt_subnode_offset(const void *fdt, int parentoffset, const char *name);
483 * @fdt: pointer to the device tree blob
491 int fdt_path_offset_namelen(const void *fdt, const char *path, int namelen);
496 * @fdt: pointer to the device tree blob
517 int fdt_path_offset(const void *fdt, const char *path);
521 * @fdt: pointer to the device tree blob
542 const char *fdt_get_name(const void *fdt, int nodeoffset, int *lenp);
546 * @fdt: pointer to the device tree blob
562 int fdt_first_property_offset(const void *fdt, int nodeoffset);
566 * @fdt: pointer to the device tree blob
583 int fdt_next_property_offset(const void *fdt, int offset);
589 * @fdt: FDT blob (const void *)
594 * fdt_for_each_property_offset(property, fdt, node) {
607 #define fdt_for_each_property_offset(property, fdt, node) \
608 for (property = fdt_first_property_offset(fdt, node); \
610 property = fdt_next_property_offset(fdt, property))
614 * @fdt: pointer to the device tree blob
639 const struct fdt_property *fdt_get_property_by_offset(const void *fdt,
645 * @fdt: pointer to the device tree blob
655 const struct fdt_property *fdt_get_property_namelen(const void *fdt,
663 * @fdt: pointer to the device tree blob
689 const struct fdt_property *fdt_get_property(const void *fdt, int nodeoffset,
691 static inline struct fdt_property *fdt_get_property_w(void *fdt, int nodeoffset,
696 fdt_get_property(fdt, nodeoffset, name, lenp);
701 * @fdt: pointer to the device tree blob
731 const void *fdt_getprop_by_offset(const void *fdt, int offset,
737 * @fdt: pointer to the device tree blob
747 const void *fdt_getprop_namelen(const void *fdt, int nodeoffset,
749 static inline void *fdt_getprop_namelen_w(void *fdt, int nodeoffset,
753 return (void *)(uintptr_t)fdt_getprop_namelen(fdt, nodeoffset, name,
760 * @fdt: pointer to the device tree blob
786 const void *fdt_getprop(const void *fdt, int nodeoffset,
788 static inline void *fdt_getprop_w(void *fdt, int nodeoffset,
791 return (void *)(uintptr_t)fdt_getprop(fdt, nodeoffset, name, lenp);
796 * @fdt: pointer to the device tree blob
806 uint32_t fdt_get_phandle(const void *fdt, int nodeoffset);
810 * @fdt: pointer to the device tree blob
818 const char *fdt_get_alias_namelen(const void *fdt,
824 * @fdt: pointer to the device tree blob
834 const char *fdt_get_alias(const void *fdt, const char *name);
838 * @fdt: pointer to the device tree blob
861 int fdt_get_path(const void *fdt, int nodeoffset, char *buf, int buflen);
865 * @fdt: pointer to the device tree blob
873 * fdt_supernode_atdepth_offset(fdt, nodeoffset, 0, NULL);
876 * fdt_supernode_atdepth_offset(fdt, nodeoffset, D, NULL);
893 int fdt_supernode_atdepth_offset(const void *fdt, int nodeoffset,
898 * @fdt: pointer to the device tree blob
915 int fdt_node_depth(const void *fdt, int nodeoffset);
919 * @fdt: pointer to the device tree blob
938 int fdt_parent_offset(const void *fdt, int nodeoffset);
942 * @fdt: pointer to the device tree blob
955 * offset = fdt_node_offset_by_prop_value(fdt, -1, propname,
959 * offset = fdt_node_offset_by_prop_value(fdt, offset, propname,
978 int fdt_node_offset_by_prop_value(const void *fdt, int startoffset,
984 * @fdt: pointer to the device tree blob
1001 int fdt_node_offset_by_phandle(const void *fdt, uint32_t phandle);
1005 * @fdt: pointer to the device tree blob
1025 int fdt_node_check_compatible(const void *fdt, int nodeoffset,
1030 * @fdt: pointer to the device tree blob
1041 * offset = fdt_node_offset_by_compatible(fdt, -1, compatible);
1044 * offset = fdt_node_offset_by_compatible(fdt, offset, compatible);
1062 int fdt_node_offset_by_compatible(const void *fdt, int startoffset,
1081 * @fdt: pointer to the device tree blob
1089 int fdt_stringlist_count(const void *fdt, int nodeoffset, const char *property);
1093 * @fdt: pointer to the device tree blob
1110 int fdt_stringlist_search(const void *fdt, int nodeoffset, const char *property,
1115 * @fdt: pointer to the device tree blob
1137 const char *fdt_stringlist_get(const void *fdt, int nodeoffset,
1158 * @fdt: pointer to the device tree blob
1174 int fdt_address_cells(const void *fdt, int nodeoffset);
1179 * @fdt: pointer to the device tree blob
1195 int fdt_size_cells(const void *fdt, int nodeoffset);
1205 * @fdt: pointer to the device tree blob
1219 int fdt_setprop_inplace_namelen_partial(void *fdt, int nodeoffset,
1227 * @fdt: pointer to the device tree blob
1254 int fdt_setprop_inplace(void *fdt, int nodeoffset, const char *name,
1260 * @fdt: pointer to the device tree blob
1286 static inline int fdt_setprop_inplace_u32(void *fdt, int nodeoffset,
1290 return fdt_setprop_inplace(fdt, nodeoffset, name, &tmp, sizeof(tmp));
1295 * @fdt: pointer to the device tree blob
1321 static inline int fdt_setprop_inplace_u64(void *fdt, int nodeoffset,
1325 return fdt_setprop_inplace(fdt, nodeoffset, name, &tmp, sizeof(tmp));
1333 static inline int fdt_setprop_inplace_cell(void *fdt, int nodeoffset,
1336 return fdt_setprop_inplace_u32(fdt, nodeoffset, name, val);
1341 * @fdt: pointer to the device tree blob
1363 int fdt_nop_property(void *fdt, int nodeoffset, const char *name);
1367 * @fdt: pointer to the device tree blob
1387 int fdt_nop_node(void *fdt, int nodeoffset);
1396 * names in the fdt. This can result in faster creation times, but
1397 * a larger fdt. */
1402 * fdt_create_with_flags - begin creation of a new fdt
1403 * @fdt: pointer to memory allocated where fdt will be created
1404 * @bufsize: size of the memory space at fdt
1407 * fdt_create_with_flags() begins the process of creating a new fdt with
1410 * fdt creation process must end with fdt_finished() to produce a valid fdt.
1414 * -FDT_ERR_NOSPACE, bufsize is insufficient for a minimal fdt
1420 * fdt_create - begin creation of a new fdt
1421 * @fdt: pointer to memory allocated where fdt will be created
1422 * @bufsize: size of the memory space at fdt
1428 * -FDT_ERR_NOSPACE, bufsize is insufficient for a minimal fdt
1432 int fdt_resize(void *fdt, void *buf, int bufsize);
1433 int fdt_add_reservemap_entry(void *fdt, uint64_t addr, uint64_t size);
1434 int fdt_finish_reservemap(void *fdt);
1435 int fdt_begin_node(void *fdt, const char *name);
1436 int fdt_property(void *fdt, const char *name, const void *val, int len);
1437 static inline int fdt_property_u32(void *fdt, const char *name, uint32_t val)
1440 return fdt_property(fdt, name, &tmp, sizeof(tmp));
1442 static inline int fdt_property_u64(void *fdt, const char *name, uint64_t val)
1445 return fdt_property(fdt, name, &tmp, sizeof(tmp));
1449 static inline int fdt_property_cell(void *fdt, const char *name, uint32_t val)
1451 return fdt_property_u32(fdt, name, val);
1458 * @fdt: pointer to the device tree blob
1468 int fdt_property_placeholder(void *fdt, const char *name, int len, void **valp);
1470 #define fdt_property_string(fdt, name, str) \
1471 fdt_property(fdt, name, str, strlen(str)+1)
1472 int fdt_end_node(void *fdt);
1473 int fdt_finish(void *fdt);
1480 int fdt_open_into(const void *fdt, void *buf, int bufsize);
1481 int fdt_pack(void *fdt);
1485 * @fdt: pointer to the device tree blob
1505 int fdt_add_mem_rsv(void *fdt, uint64_t address, uint64_t size);
1509 * @fdt: pointer to the device tree blob
1529 int fdt_del_mem_rsv(void *fdt, int n);
1533 * @fdt: pointer to the device tree blob
1555 int fdt_set_name(void *fdt, int nodeoffset, const char *name);
1559 * @fdt: pointer to the device tree blob
1585 int fdt_setprop(void *fdt, int nodeoffset, const char *name,
1590 * @fdt: pointer to the device tree blob
1616 int fdt_setprop_placeholder(void *fdt, int nodeoffset, const char *name,
1621 * @fdt: pointer to the device tree blob
1647 static inline int fdt_setprop_u32(void *fdt, int nodeoffset, const char *name,
1651 return fdt_setprop(fdt, nodeoffset, name, &tmp, sizeof(tmp));
1656 * @fdt: pointer to the device tree blob
1682 static inline int fdt_setprop_u64(void *fdt, int nodeoffset, const char *name,
1686 return fdt_setprop(fdt, nodeoffset, name, &tmp, sizeof(tmp));
1694 static inline int fdt_setprop_cell(void *fdt, int nodeoffset, const char *name,
1697 return fdt_setprop_u32(fdt, nodeoffset, name, val);
1702 * @fdt: pointer to the device tree blob
1728 #define fdt_setprop_string(fdt, nodeoffset, name, str) \
1729 fdt_setprop((fdt), (nodeoffset), (name), (str), strlen(str)+1)
1734 * @fdt: pointer to the device tree blob
1758 #define fdt_setprop_empty(fdt, nodeoffset, name) \
1759 fdt_setprop((fdt), (nodeoffset), (name), NULL, 0)
1763 * @fdt: pointer to the device tree blob
1788 int fdt_appendprop(void *fdt, int nodeoffset, const char *name,
1793 * @fdt: pointer to the device tree blob
1819 static inline int fdt_appendprop_u32(void *fdt, int nodeoffset,
1823 return fdt_appendprop(fdt, nodeoffset, name, &tmp, sizeof(tmp));
1828 * @fdt: pointer to the device tree blob
1854 static inline int fdt_appendprop_u64(void *fdt, int nodeoffset,
1858 return fdt_appendprop(fdt, nodeoffset, name, &tmp, sizeof(tmp));
1866 static inline int fdt_appendprop_cell(void *fdt, int nodeoffset,
1869 return fdt_appendprop_u32(fdt, nodeoffset, name, val);
1874 * @fdt: pointer to the device tree blob
1899 #define fdt_appendprop_string(fdt, nodeoffset, name, str) \
1900 fdt_appendprop((fdt), (nodeoffset), (name), (str), strlen(str)+1)
1904 * @fdt: pointer to the device tree blob
1936 int fdt_appendprop_addrrange(void *fdt, int parent, int nodeoffset,
1941 * @fdt: pointer to the device tree blob
1961 int fdt_delprop(void *fdt, int nodeoffset, const char *name);
1965 * @fdt: pointer to the device tree blob
1976 int fdt_add_subnode_namelen(void *fdt, int parentoffset,
1982 * @fdt: pointer to the device tree blob
2011 int fdt_add_subnode(void *fdt, int parentoffset, const char *name);
2015 * @fdt: pointer to the device tree blob
2034 int fdt_del_node(void *fdt, int nodeoffset);
2038 * @fdt: pointer to the base device tree blob
2065 int fdt_overlay_apply(void *fdt, void *fdto);