Device Tree API#

Public API#

group Libboot_dt

Internals#

group Dt_internal

Defines

FDT_MAGIC#

FDT magic number.

FDT_OFF_MAGIC#

Offset to magic number.

FDT_OFF_TOTAL_SIZE#

Offset to total size.

FDT_OFF_OFF_DT_STRUCT#

Offset to structure block offset.

FDT_OFF_OFF_DT_STRINGS#

Offset to strings block offset.

FDT_OFF_OFF_MEM_RSVMAP#

Offset to memory reservation map offset.

FDT_OFF_VERSION#

Offset to version.

FDT_OFF_LAST_COMP_VERSION#

Offset to last compatible version.

FDT_OFF_BOOT_CPUID_PHYS#

Offset to boot CPU physical ID.

FDT_OFF_SIZE_DT_STRINGS#

Offset to strings block size.

FDT_OFF_SIZE_DT_STRUCT#

Offset to structure block size.

FDT_COMPATIBLE_VERSION#

Minimum compatible FDT version.

Enums

enum fdt_token_t#

FDT token values.

Values:

enumerator FDT_BEGIN_NODE#

Begin node token.

enumerator FDT_END_NODE#

End node token.

enumerator FDT_PROP#

Property token.

enumerator FDT_NOP#

Nop token.

enumerator FDT_END#

End of structure block token.

Functions

error_t dt_skip_node_name(const fdt_t *fdt, dt_node_t node, u32 *offsetOUT)#

Skip node’s tag and name and output first aligned offset after them.

Parameters:
  • fdt – Pointer to the flattened device tree.

  • node – The device tree node.

  • offsetOUT[out] First aligned offset after the node.

Return values:
  • ERR_NONE – on success

  • ERR_BAD_ARG – on nullptr args or misaligned node

  • ERR_NOT_VALID – if the FDT is invalid

error_t dt_skip_node_properties(const fdt_t *fdt, u32 offset, u32 *offsetOUT)#

Skip node’s properties starting at offset (if they exist) and output first aligned offset after them.

Parameters:
  • fdt – Pointer to the flattened device tree.

  • offset – The offset to start skipping properties from.

  • offsetOUT[out] First aligned offset after properties at offset.

Return values:
  • ERR_NONE – on success

  • ERR_BAD_ARG – on nullptr args

  • ERR_NOT_VALID – if the FDT is invalid

error_t dt_skip_node_header(const fdt_t *fdt, dt_node_t node, u32 *offsetOUT)#

Skip node’s tag, name and properties and output first aligned offset after them.

Parameters:
  • fdt – Pointer to the flattened device tree.

  • node – The device tree node.

  • offsetOUT[out] First aligned offset after the node.

Return values:
  • ERR_NONE – on success

  • ERR_BAD_ARG – on nullptr args or misaligned node

  • ERR_NOT_VALID – if the FDT is invalid

error_t dt_skip_nested_nodes(const fdt_t *fdt, dt_node_t nested_node, dt_node_t *nodeOUT)#

Skip an overarching node’s nested nodes starting at the start of the first nested node.

Parameters:
  • fdt – Pointer to the flattened device tree.

  • nested_node – The first nested node to start skipping from.

  • nodeOUT[out] First non-nested node after the nested_node.

Return values:
  • ERR_NONE – on success

  • ERR_BAD_ARG – on nullptr args or misaligned nested_node

  • ERR_NOT_VALID – if the FDT is invalid