scripts/dtc/libfdt/libfdt.h
Source file repositories/reference/linux-study-clean/scripts/dtc/libfdt/libfdt.h
File Facts
- System
- Linux kernel
- Corpus path
scripts/dtc/libfdt/libfdt.h- Extension
.h- Size
- 89788 bytes
- Lines
- 2541
- Domain
- Support Tooling And Documentation
- Bucket
- scripts
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
libfdt_env.hfdt.h
Detected Declarations
function platformsfunction fdt32_ldfunction fdt32_stfunction fdt64_ldfunction fdt64_stfunction fdt_for_each_subnodefunction fdt_find_max_phandlefunction fdt_for_each_property_offsetfunction fdt_get_property_namelen_wfunction fdt_setprop_inplace_u32function fdt_setprop_inplace_u64function fdt_setprop_inplace_u32function fdt_property_u32function fdt_property_u64function fdt_property_cellfunction fdt_setpropfunction fdt_setprop_placeholderfunction fdt_setprop_u32function fdt_setprop_u64function fdt_setprop_u32function fdt_appendprop_u32function fdt_appendprop_u64function fdt_appendprop_u32
Annotated Snippet
* fdt_for_each_subnode(node, fdt, parent) {
* Use node
* ...
* }
*
* if ((node < 0) && (node != -FDT_ERR_NOTFOUND)) {
* Error handling
* }
*
* Note that this is implemented as a macro and @node is used as
* iterator in the loop. The parent variable be constant or even a
* literal.
*/
#define fdt_for_each_subnode(node, fdt, parent) \
for (node = fdt_first_subnode(fdt, parent); \
node >= 0; \
node = fdt_next_subnode(fdt, node))
/**********************************************************************/
/* General functions */
/**********************************************************************/
#define fdt_get_header(fdt, field) \
(fdt32_ld(&((const struct fdt_header *)(fdt))->field))
#define fdt_magic(fdt) (fdt_get_header(fdt, magic))
#define fdt_totalsize(fdt) (fdt_get_header(fdt, totalsize))
#define fdt_off_dt_struct(fdt) (fdt_get_header(fdt, off_dt_struct))
#define fdt_off_dt_strings(fdt) (fdt_get_header(fdt, off_dt_strings))
#define fdt_off_mem_rsvmap(fdt) (fdt_get_header(fdt, off_mem_rsvmap))
#define fdt_version(fdt) (fdt_get_header(fdt, version))
#define fdt_last_comp_version(fdt) (fdt_get_header(fdt, last_comp_version))
#define fdt_boot_cpuid_phys(fdt) (fdt_get_header(fdt, boot_cpuid_phys))
#define fdt_size_dt_strings(fdt) (fdt_get_header(fdt, size_dt_strings))
#define fdt_size_dt_struct(fdt) (fdt_get_header(fdt, size_dt_struct))
#define fdt_set_hdr_(name) \
static inline void fdt_set_##name(void *fdt, uint32_t val) \
{ \
struct fdt_header *fdth = (struct fdt_header *)fdt; \
fdth->name = cpu_to_fdt32(val); \
}
fdt_set_hdr_(magic)
fdt_set_hdr_(totalsize)
fdt_set_hdr_(off_dt_struct)
fdt_set_hdr_(off_dt_strings)
fdt_set_hdr_(off_mem_rsvmap)
fdt_set_hdr_(version)
fdt_set_hdr_(last_comp_version)
fdt_set_hdr_(boot_cpuid_phys)
fdt_set_hdr_(size_dt_strings)
fdt_set_hdr_(size_dt_struct)
#undef fdt_set_hdr_
/**
* fdt_header_size - return the size of the tree's header
* @fdt: pointer to a flattened device tree
*
* Return: size of DTB header in bytes
*/
size_t fdt_header_size(const void *fdt);
/**
* fdt_header_size_ - internal function to get header size from a version number
* @version: device tree version number
*
* Return: size of DTB header in bytes
*/
size_t fdt_header_size_(uint32_t version);
/**
* fdt_check_header - sanity check a device tree header
* @fdt: pointer to data which might be a flattened device tree
*
* fdt_check_header() checks that the given buffer contains what
* appears to be a flattened device tree, and that the header contains
* valid information (to the extent that can be determined from the
* header alone).
*
* returns:
* 0, if the buffer appears to contain a valid device tree
* -FDT_ERR_BADMAGIC,
* -FDT_ERR_BADVERSION,
* -FDT_ERR_BADSTATE,
* -FDT_ERR_TRUNCATED, standard meanings, as above
*/
int fdt_check_header(const void *fdt);
/**
* fdt_move - move a device tree around in memory
* @fdt: pointer to the device tree to move
* @buf: pointer to memory where the device is to be moved
Annotation
- Immediate include surface: `libfdt_env.h`, `fdt.h`.
- Detected declarations: `function platforms`, `function fdt32_ld`, `function fdt32_st`, `function fdt64_ld`, `function fdt64_st`, `function fdt_for_each_subnode`, `function fdt_find_max_phandle`, `function fdt_for_each_property_offset`, `function fdt_get_property_namelen_w`, `function fdt_setprop_inplace_u32`.
- Atlas domain: Support Tooling And Documentation / scripts.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.