Ultibo API
C/C++ API for Ultibo Core
Loading...
Searching...
No Matches
devicetree.h File Reference

Go to the source code of this file.

Data Structures

struct  _DTB_HEADER
struct  _DTB_RESERVATION
struct  _DTB_NODE
struct  _DTB_PROPERTY
struct  _DTB_PROPERTY_CHAR
struct  _DTB_PROPERTY_LONGWORD
struct  _DTB_PROPERTY_QUADWORD

Macros

#define DTB_MAGIC   0xD00DFEED
#define DTB_VERSION_17   17
#define DTB_VERSION_16   16
#define DTB_VERSION_CURRENT   DTB_VERSION_17
#define DTB_VERSION_COMPATIBLE   DTB_VERSION_16
#define DTB_BEGIN_NODE   0x00000001
 The FDT_BEGIN_NODE token marks the beginning of a node’s representation, followed by the node’s unit name as extra data.
#define DTB_END_NODE   0x00000002
 The FDT_END_NODE token marks the end of a node’s representation.
#define DTB_PROP   0x00000003
 The FDT_PROP token marks the beginning of the representation of one property, followed by extra data describing the property.
#define DTB_NOP   0x00000004
 The FDT_NOP token will be ignored by any program parsing the device tree.
#define DTB_END   0x00000009
 The FDT_END token marks the end of the structure block.
#define DTB_NODE_OFFSET   4
 Token.
#define DTB_PROPERTY_OFFSET   12
 Token + Value Length + Name Offset.
#define DTB_STRUCTURE_ALIGNMENT   4
#define DTB_RESERVATION_ALIGNMENT   8
#define DTB_NODE_ROOT   "/"
#define DTB_NODE_CPUS   "cpus"
#define DTB_NODE_MEMORY   "memory"
#define DTB_NODE_CHOSEN   "chosen"
#define DTB_NODE_ALIASES   "aliases"
#define DTB_NODE_SYMBOLS   "__symbols__"
#define DTB_NODE_OVERRIDES   "__overrides__"
#define DTB_PATH_SEPARATOR   "/"
#define DTB_TYPE_UNKNOWN   0
#define DTB_TYPE_EMPTY   1
 Value is empty. Used for conveying true-false information.
#define DTB_TYPE_U32   2
 A 32-bit integer in big-endian format.
#define DTB_TYPE_U64   3
 Represents a 64-bit integer in big-endian format.
#define DTB_TYPE_STRING   4
 Strings are printable and null-terminated.
#define DTB_TYPE_ENCODED_ARRAY   5
 Format is specific to the property. See the property definition.
#define DTB_TYPE_PHANDLE   6
 A <u32> value. A phandle value is a way to reference another node in the devicetree.
#define DTB_TYPE_STRINGLIST   7
 A list of <string> values concatenated together.
#define DTB_PROPERTY_COMPATIBLE   "compatible"
 The compatible property value consists of one or more strings that define the specific programming model for the device (Type: <stringlist>).
#define DTB_PROPERTY_MODEL   "model"
 The model property value specifies the manufacturer’s model number of the device (Type: <string>).
#define DTB_PROPERTY_PHANDLE   "phandle"
 The phandle property specifies a numerical identifier for a node that is unique within the devicetree (Type: <u32>).
#define DTB_PROPERTY_STATUS   "status"
 The status property indicates the operational status of a device (Type: <string>).
#define DTB_PROPERTY_ADDRESS_CELLS   "#address-cells"
 Specifies the number of <u32> cells to represent the address in the reg property (Type: <u32>).
#define DTB_PROPERTY_SIZE_CELLS   "#size-cells"
 Specifies the number of <u32> cells to represent the size in the reg property (Type: <u32>).
#define DTB_PROPERTY_REG   "reg"
 The reg property describes the address of the device’s resources within the address space defined by its parent bus (Type: <prop-encoded-array>).
#define DTB_PROPERTY_VIRTUAL_REG   "virtual-reg"
 The virtual-reg property specifies an effective address that maps to the first physical address specified in the reg property of the device node (Type: <u32>).
#define DTB_PROPERTY_RANGES   "ranges"
 The ranges property provides a means of defining a mapping or translation between address spaces (Type: <empty> or <prop-encoded-array>).
#define DTB_PROPERTY_DMA_RANGES   "dma-ranges"
 The dma-ranges property is used to describe the direct memory access (DMA) structure of a memory-mapped bus (Type: <empty> or <prop-encoded-array>).
#define DTB_PROPERTY_NAME   "name"
 The name property is a string specifying the name of the node (Type: <string>).
#define DTB_PROPERTY_DEVICE_TYPE   "device_type"
 The device_type property was used in IEEE 1275 to describe the device (Type: <string>).
#define DTB_PROPERTY_INTERRUPTS   "interrupts"
 The interrupts property defines the interrupt or interrupts that are generated by the device (Type: <prop-encoded-array>).
#define DTB_PROPERTY_INTERRUPT_PARENT   "interrupt-parent"
 The interrupt-parent property provides an explicit definition of an interrupt parent (Type: <phandle>).
#define DTB_PROPERTY_INTERRUPTS_EXTENDED   "interrupts-extended"
 The interrupts-extended property lists the interrupt(s) generated by a device (Type: <phandle> <prop-encoded-array>).
#define DTB_PROPERTY_INTERRUPT_CELLS   "#interrupt-cells"
 The #interrupt-cells property defines the number of cells required to encode an interrupt specifier for an interrupt domain (Type: <u32>).
#define DTB_PROPERTY_INTERRUPT_CONTROLLER   "interrupt-controller"
 The presence of an interrupt-controller property defines a node as an interrupt controller node (Type: <empty>).
#define DTB_PROPERTY_INTERRUPT_MAP   "interrupt-map"
 An interrupt-map is a property on a nexus node that bridges an interrupt domain to a parent domain (Type: <prop-encoded-array>).
#define DTB_PROPERTY_INTERRUPT_MAP_MASK   "interrupt-map-mask"
 An interrupt-map-mask property is specified for a nexus node in the interrupt tree (Type: <prop-encoded-array>).
#define DTB_PROPERTY_INITIAL_MAPPED_AREA   "initial-mapped-area"
 Specifies the address and size of the Initial Mapped Area (Type: <prop-encoded-array>).
#define DTB_PROPERTY_BOOTARGS   "bootargs"
 A string that specifies the boot arguments for the client program (Type: <string>>).
#define DTB_PROPERTY_STDOUT_PATH   "stdout-path"
 A string that specifies the full path to the node representing the device to be used for boot console output (Type: <string>>).
#define DTB_PROPERTY_STDIN_PATH   "stdin-path"
 A string that specifies the full path to the node representing the device to be used for boot console input (Type: <string>>).
#define DTB_PROPERTY_INITRD_START   "initrd-start"
 The starting address of the initial ram disk (Type: <u32>).
#define DTB_PROPERTY_INITRD_END   "initrd-end"
 The ending address of the initial ram disk (Type: <u32>).
#define DTB_PROPERTY_CLOCK_FREQUENCY   "clock-frequency"
 Specifies the current clock speed of the CPU in Hertz (Type: <prop-encoded-array>).
#define DTB_PROPERTY_TIMEBASE_FREQUENCY   "timebase-frequency"
 Specifies the current frequency at which the timebase and decrementer registers are updated (Type: <propencoded-array>).
#define DTB_PROPERTY_ENABLE_METHOD   "enable-method"
 Describes the method by which a CPU in a disabled state is enabled (Type: <stringlist>).
#define DTB_PROPERTY_CPU_RELEASE_ADDR   "cpu-release-addr"
 The cpu-release-addr property is required for cpu nodes that have an enable-method property value of "spin-table" (Type: <u64>).
#define DTB_PROPERTY_POWER_ISA_VERSION   "power-isa-version"
 A string that specifies the numerical portion of the Power ISA version string (Type: <string>).
#define DTB_PROPERTY_CACHE_OP_BLOCK_SIZE   "cache-op-block-size"
 The block size in bytes upon which cache block instructions operate (Type: <u32>).
#define DTB_PROPERTY_RESERVATION_GRANULE_SIZE   "reservation-granule-size"
 The reservation granule size supported by this processor in bytes (Type: <u32>).
#define DTB_PROPERTY_MMU_TYPE   "mmu-type"
 Specifies the CPU’s MMU type (Type: <string>).
#define DTB_PROPERTY_TLB_SPLIT   "tlb-split"
 Specifies that the TLB has a split configuration (Type: <empty>).
#define DTB_PROPERTY_TLB_SIZE   "tlb-size"
 Specifies the number of entries in the TLB (Type: <u32>).
#define DTB_PROPERTY_TLB_SETS   "tlb-sets"
 Specifies the number of associativity sets inthe TLB. (Type: <u32>).
#define DTB_PROPERTY_D_TLB_SIZE   "d-tlb-size"
 Specifies the number of entries in the data TLB (Type: <u32>).
#define DTB_PROPERTY_D_TLB_SETS   "d-tlb-sets"
 Specifies the number of associativity sets in the data TLB. (Type: <u32>).
#define DTB_PROPERTY_I_TLB_SIZE   "i-tlb-size"
 Specifies the number of entries in the instruction TLB (Type: <u32>).
#define DTB_PROPERTY_I_TLB_SETS   "i-tlb-sets"
 Specifies the number of associativity sets in the instruction TLB (Type: <u32>).
#define DTB_PROPERTY_CACHE_UNIFIED   "cache-unified"
 Specifies the cache has a unified organization (Type: <empty>).
#define DTB_PROPERTY_CACHE_SIZE   "cache-size"
 Specifies the size in bytes of a unified cache (Type: <u32>).
#define DTB_PROPERTY_CACHE_SETS   "cache-sets"
 Specifies the number of associativity sets in a unified cache (Type: <u32>).
#define DTB_PROPERTY_CACHE_BLOCK_SIZE   "cache-block-size"
 Specifies the block size in bytes of a unified cache (Type: <u32>).
#define DTB_PROPERTY_CACHE_LINE_SIZE   "cache-line-size"
 Specifies the line size in bytes of a unified cache (Type: <u32>).
#define DTB_PROPERTY_I_CACHE_SIZE   "i-cache-size"
 Specifies the size in bytes of the instruction cache (Type: <u32>).
#define DTB_PROPERTY_I_CACHE_SETS   "i-cache-sets"
 Specifies the number of associativity sets in the instruction cache (Type: <u32>).
#define DTB_PROPERTY_I_CACHE_BLOCK_SIZE   "i-cache-block-size"
 Specifies the block size in bytes of the instruction cache (Type: <u32>).
#define DTB_PROPERTY_I_CACHE_LINE_SIZE   "i-cache-line-size"
 Specifies the line size in bytes of the instruction cache (Type: <u32>).
#define DTB_PROPERTY_D_CACHE_SIZE   "d-cache-size"
 Specifies the size in bytes of the data cache (Type: <u32>).
#define DTB_PROPERTY_D_CACHE_SETS   "d-cache-sets"
 Specifies the number of associativity sets in the data cache. (Type: <u32>).
#define DTB_PROPERTY_D_CACHE_BLOCK_SIZE   "d-cache-block-size"
 Specifies the block size in bytes of the data cache. (Type: <u32>).
#define DTB_PROPERTY_D_CACHE_LINE_SIZE   "d-cache-line-size"
 Specifies the line size in bytes of the data cache, (Type: <u32>).
#define DTB_PROPERTY_NEXT_LEVEL_CACHE   "next-level-cache"
 If present, indicates that another level of cache exists. (Type: <phandle>).
#define DTB_PROPERTY_CACHE_LEVEL   "cache-level"
 Specifies the level in the cache hierarchy (Type: <u32>).
#define DTB_PROPERTY_SERIAL_NUMBER   "serial-number"
 Serial Number (Type: <string>).
#define DTB_PROPERTY_ALLOC_RANGES   "alloc-ranges"
 Allocated Ranges (Type: <prop-encoded-array>).
#define DTB_PROPERTY_RESETS   "resets"
 Resets (Type: <prop-encoded-array>).
#define DTB_PROPERTY_CLOCK_CELLS   "#clock-cells"
 Number of clock cells (Type: <u32>).
#define DTB_PROPERTY_LINUX_INITRD_START   "linux,initrd-start"
 The starting address of the initial ram disk (Type: <u32>).
#define DTB_PROPERTY_LINUX_INITRD_END   "linux,initrd-end"
 The ending address of the initial ram disk (Type: <u32>).
#define DTB_MAX_PROPERTY_TYPE   60

Typedefs

typedef struct _DTB_HEADER DTB_HEADER
typedef struct _DTB_RESERVATION DTB_RESERVATION
typedef struct _DTB_NODE DTB_NODE
typedef struct _DTB_PROPERTY DTB_PROPERTY
typedef struct _DTB_PROPERTY_CHAR DTB_PROPERTY_CHAR
typedef struct _DTB_PROPERTY_LONGWORD DTB_PROPERTY_LONGWORD
typedef struct _DTB_PROPERTY_QUADWORD DTB_PROPERTY_QUADWORD
typedef void STDCALL(* dtb_log_output_cb) (const char *text, void *data)
typedef char *STDCALL(* dtb_decode_value_cb) (HANDLE node, HANDLE handle, void *value, uint32_t size, void *data)

Functions

BOOL STDCALL device_tree_validate (size_t address, uint32_t *size)
 Check the data at the supplied address to determine if it is a valid Device Tree Blob.
HANDLE STDCALL device_tree_next_node (HANDLE parent, HANDLE previous)
 Find the next DTB node within the Device Tree.
HANDLE STDCALL device_tree_next_property (HANDLE node, HANDLE previous)
 Find the next DTB property within the specified node of the Device Tree.
HANDLE STDCALL device_tree_get_node (const char *path, HANDLE parent)
 Get the handle of the node matching the specified path, optionally within a specified parent.
HANDLE STDCALL device_tree_get_property (HANDLE node, const char *name)
 Get the handle of the property matching the specified name.
uint32_t STDCALL device_tree_get_node_name (HANDLE handle, char *name, uint32_t len)
 Get the name of the specified node.
uint32_t STDCALL device_tree_split_node_name (HANDLE handle, char *nodename, uint32_t namelen, char *unitaddress, uint32_t addresslen)
 Split the name of a node into node name and unit address.
HANDLE STDCALL device_tree_get_node_parent (HANDLE handle)
 Get the parent node of the specified node.
BOOL STDCALL device_tree_get_node_reg_cells (HANDLE handle, uint32_t *address, uint32_t *size)
 Get the #address-cells and #size-cells values that apply to reg properties of the specified node.
BOOL STDCALL device_tree_get_node_range_cells (HANDLE handle, uint32_t *parentaddress, uint32_t *nodeaddress, uint32_t *nodesize)
 Get the #address-cells and #size-cells values that apply to range properties of the specified node.
uint32_t STDCALL device_tree_get_property_name (HANDLE handle, char *name, uint32_t len)
 Get the name of the specified property.
uint32_t STDCALL device_tree_split_property_name (HANDLE handle, char *uniqueprefix, uint32_t prefixlen, char *propertyname, uint32_t namelen)
 Split the name of a property into property name and unique prefix.
void *STDCALL device_tree_get_property_value (HANDLE handle)
 Get a pointer to the raw value of the specified property.
uint32_t STDCALL device_tree_get_property_length (HANDLE handle)
 Get the length of the raw value of the specified property.
uint32_t STDCALL device_tree_get_property_string (HANDLE handle, char *string, uint32_t len)
 Get the value of the specified property as a string.
uint32_t STDCALL device_tree_get_property_longword (HANDLE handle)
 Get the value of the specified property as a longword.
uint64_t STDCALL device_tree_get_property_quadword (HANDLE handle)
 Get the value of the specified property as a quadword.
char *STDCALL device_tree_get_boot_args (void)
 Return a character pointer to the location of the command line in the device tree blob.
BOOL STDCALL device_tree_get_ramdisk (size_t *address, uint64_t *size)
 Return the address and size of the initial ram disk specified in the device tree blob.
BOOL STDCALL device_tree_get_memory (uint32_t index, size_t *address, uint64_t *size)
 Return the address and size of a memory block specified in the device tree blob.
BOOL STDCALL device_tree_get_reservation (uint32_t index, size_t *address, uint64_t *size)
 Return the address and size of a memory reservation specified in the device tree blob.
uint32_t STDCALL device_tree_log_tree (void)
 Print information about all nodes and properties in the device tree.
uint32_t STDCALL device_tree_log_tree_ex (HANDLE node, dtb_log_output_cb output, dtb_decode_value_cb decode, void *data)
 Print information about one or all nodes and properties in the device tree with custom value decode callback.

Variables

struct _DTB_HEADER PACKED

Macro Definition Documentation

◆ DTB_MAGIC

#define DTB_MAGIC   0xD00DFEED

Device Tree specific constants DTB Signature

◆ DTB_VERSION_17

#define DTB_VERSION_17   17

DTB Versions

◆ DTB_VERSION_16

#define DTB_VERSION_16   16

◆ DTB_VERSION_CURRENT

#define DTB_VERSION_CURRENT   DTB_VERSION_17

◆ DTB_VERSION_COMPATIBLE

#define DTB_VERSION_COMPATIBLE   DTB_VERSION_16

◆ DTB_BEGIN_NODE

#define DTB_BEGIN_NODE   0x00000001

The FDT_BEGIN_NODE token marks the beginning of a node’s representation, followed by the node’s unit name as extra data.

DTB Tokens

◆ DTB_END_NODE

#define DTB_END_NODE   0x00000002

The FDT_END_NODE token marks the end of a node’s representation.

◆ DTB_PROP

#define DTB_PROP   0x00000003

The FDT_PROP token marks the beginning of the representation of one property, followed by extra data describing the property.

◆ DTB_NOP

#define DTB_NOP   0x00000004

The FDT_NOP token will be ignored by any program parsing the device tree.

◆ DTB_END

#define DTB_END   0x00000009

The FDT_END token marks the end of the structure block.

◆ DTB_NODE_OFFSET

#define DTB_NODE_OFFSET   4

Token.

DTB Offsets

◆ DTB_PROPERTY_OFFSET

#define DTB_PROPERTY_OFFSET   12

Token + Value Length + Name Offset.

◆ DTB_STRUCTURE_ALIGNMENT

#define DTB_STRUCTURE_ALIGNMENT   4

DTB Alignment

◆ DTB_RESERVATION_ALIGNMENT

#define DTB_RESERVATION_ALIGNMENT   8

◆ DTB_NODE_ROOT

#define DTB_NODE_ROOT   "/"

DTB Nodes Standard Nodes

◆ DTB_NODE_CPUS

#define DTB_NODE_CPUS   "cpus"

◆ DTB_NODE_MEMORY

#define DTB_NODE_MEMORY   "memory"

◆ DTB_NODE_CHOSEN

#define DTB_NODE_CHOSEN   "chosen"

◆ DTB_NODE_ALIASES

#define DTB_NODE_ALIASES   "aliases"

◆ DTB_NODE_SYMBOLS

#define DTB_NODE_SYMBOLS   "__symbols__"

Other Nodes

◆ DTB_NODE_OVERRIDES

#define DTB_NODE_OVERRIDES   "__overrides__"

◆ DTB_PATH_SEPARATOR

#define DTB_PATH_SEPARATOR   "/"

DTB Paths

◆ DTB_TYPE_UNKNOWN

#define DTB_TYPE_UNKNOWN   0

DTB Types

◆ DTB_TYPE_EMPTY

#define DTB_TYPE_EMPTY   1

Value is empty. Used for conveying true-false information.

◆ DTB_TYPE_U32

#define DTB_TYPE_U32   2

A 32-bit integer in big-endian format.

◆ DTB_TYPE_U64

#define DTB_TYPE_U64   3

Represents a 64-bit integer in big-endian format.

◆ DTB_TYPE_STRING

#define DTB_TYPE_STRING   4

Strings are printable and null-terminated.

◆ DTB_TYPE_ENCODED_ARRAY

#define DTB_TYPE_ENCODED_ARRAY   5

Format is specific to the property. See the property definition.

◆ DTB_TYPE_PHANDLE

#define DTB_TYPE_PHANDLE   6

A <u32> value. A phandle value is a way to reference another node in the devicetree.

◆ DTB_TYPE_STRINGLIST

#define DTB_TYPE_STRINGLIST   7

A list of <string> values concatenated together.

◆ DTB_PROPERTY_COMPATIBLE

#define DTB_PROPERTY_COMPATIBLE   "compatible"

The compatible property value consists of one or more strings that define the specific programming model for the device (Type: <stringlist>).

DTB Properties Standard Properties

◆ DTB_PROPERTY_MODEL

#define DTB_PROPERTY_MODEL   "model"

The model property value specifies the manufacturer’s model number of the device (Type: <string>).

◆ DTB_PROPERTY_PHANDLE

#define DTB_PROPERTY_PHANDLE   "phandle"

The phandle property specifies a numerical identifier for a node that is unique within the devicetree (Type: <u32>).

◆ DTB_PROPERTY_STATUS

#define DTB_PROPERTY_STATUS   "status"

The status property indicates the operational status of a device (Type: <string>).

◆ DTB_PROPERTY_ADDRESS_CELLS

#define DTB_PROPERTY_ADDRESS_CELLS   "#address-cells"

Specifies the number of <u32> cells to represent the address in the reg property (Type: <u32>).

◆ DTB_PROPERTY_SIZE_CELLS

#define DTB_PROPERTY_SIZE_CELLS   "#size-cells"

Specifies the number of <u32> cells to represent the size in the reg property (Type: <u32>).

◆ DTB_PROPERTY_REG

#define DTB_PROPERTY_REG   "reg"

The reg property describes the address of the device’s resources within the address space defined by its parent bus (Type: <prop-encoded-array>).

◆ DTB_PROPERTY_VIRTUAL_REG

#define DTB_PROPERTY_VIRTUAL_REG   "virtual-reg"

The virtual-reg property specifies an effective address that maps to the first physical address specified in the reg property of the device node (Type: <u32>).

◆ DTB_PROPERTY_RANGES

#define DTB_PROPERTY_RANGES   "ranges"

The ranges property provides a means of defining a mapping or translation between address spaces (Type: <empty> or <prop-encoded-array>).

◆ DTB_PROPERTY_DMA_RANGES

#define DTB_PROPERTY_DMA_RANGES   "dma-ranges"

The dma-ranges property is used to describe the direct memory access (DMA) structure of a memory-mapped bus (Type: <empty> or <prop-encoded-array>).

◆ DTB_PROPERTY_NAME

#define DTB_PROPERTY_NAME   "name"

The name property is a string specifying the name of the node (Type: <string>).

◆ DTB_PROPERTY_DEVICE_TYPE

#define DTB_PROPERTY_DEVICE_TYPE   "device_type"

The device_type property was used in IEEE 1275 to describe the device (Type: <string>).

◆ DTB_PROPERTY_INTERRUPTS

#define DTB_PROPERTY_INTERRUPTS   "interrupts"

The interrupts property defines the interrupt or interrupts that are generated by the device (Type: <prop-encoded-array>).

Additional Properties for Interrupt Generating Devices

◆ DTB_PROPERTY_INTERRUPT_PARENT

#define DTB_PROPERTY_INTERRUPT_PARENT   "interrupt-parent"

The interrupt-parent property provides an explicit definition of an interrupt parent (Type: <phandle>).

◆ DTB_PROPERTY_INTERRUPTS_EXTENDED

#define DTB_PROPERTY_INTERRUPTS_EXTENDED   "interrupts-extended"

The interrupts-extended property lists the interrupt(s) generated by a device (Type: <phandle> <prop-encoded-array>).

◆ DTB_PROPERTY_INTERRUPT_CELLS

#define DTB_PROPERTY_INTERRUPT_CELLS   "#interrupt-cells"

The #interrupt-cells property defines the number of cells required to encode an interrupt specifier for an interrupt domain (Type: <u32>).

Additional Properties for Interrupt Controllers

◆ DTB_PROPERTY_INTERRUPT_CONTROLLER

#define DTB_PROPERTY_INTERRUPT_CONTROLLER   "interrupt-controller"

The presence of an interrupt-controller property defines a node as an interrupt controller node (Type: <empty>).

◆ DTB_PROPERTY_INTERRUPT_MAP

#define DTB_PROPERTY_INTERRUPT_MAP   "interrupt-map"

An interrupt-map is a property on a nexus node that bridges an interrupt domain to a parent domain (Type: <prop-encoded-array>).

Additional Interrupt Nexus Properties

◆ DTB_PROPERTY_INTERRUPT_MAP_MASK

#define DTB_PROPERTY_INTERRUPT_MAP_MASK   "interrupt-map-mask"

An interrupt-map-mask property is specified for a nexus node in the interrupt tree (Type: <prop-encoded-array>).

◆ DTB_PROPERTY_INITIAL_MAPPED_AREA

#define DTB_PROPERTY_INITIAL_MAPPED_AREA   "initial-mapped-area"

Specifies the address and size of the Initial Mapped Area (Type: <prop-encoded-array>).

Additional Memory Node Properties

◆ DTB_PROPERTY_BOOTARGS

#define DTB_PROPERTY_BOOTARGS   "bootargs"

A string that specifies the boot arguments for the client program (Type: <string>>).

Additional Chosen Node Properties

◆ DTB_PROPERTY_STDOUT_PATH

#define DTB_PROPERTY_STDOUT_PATH   "stdout-path"

A string that specifies the full path to the node representing the device to be used for boot console output (Type: <string>>).

◆ DTB_PROPERTY_STDIN_PATH

#define DTB_PROPERTY_STDIN_PATH   "stdin-path"

A string that specifies the full path to the node representing the device to be used for boot console input (Type: <string>>).

◆ DTB_PROPERTY_INITRD_START

#define DTB_PROPERTY_INITRD_START   "initrd-start"

The starting address of the initial ram disk (Type: <u32>).

◆ DTB_PROPERTY_INITRD_END

#define DTB_PROPERTY_INITRD_END   "initrd-end"

The ending address of the initial ram disk (Type: <u32>).

◆ DTB_PROPERTY_CLOCK_FREQUENCY

#define DTB_PROPERTY_CLOCK_FREQUENCY   "clock-frequency"

Specifies the current clock speed of the CPU in Hertz (Type: <prop-encoded-array>).

Additional CPUs Node Properties

◆ DTB_PROPERTY_TIMEBASE_FREQUENCY

#define DTB_PROPERTY_TIMEBASE_FREQUENCY   "timebase-frequency"

Specifies the current frequency at which the timebase and decrementer registers are updated (Type: <propencoded-array>).

◆ DTB_PROPERTY_ENABLE_METHOD

#define DTB_PROPERTY_ENABLE_METHOD   "enable-method"

Describes the method by which a CPU in a disabled state is enabled (Type: <stringlist>).

◆ DTB_PROPERTY_CPU_RELEASE_ADDR

#define DTB_PROPERTY_CPU_RELEASE_ADDR   "cpu-release-addr"

The cpu-release-addr property is required for cpu nodes that have an enable-method property value of "spin-table" (Type: <u64>).

◆ DTB_PROPERTY_POWER_ISA_VERSION

#define DTB_PROPERTY_POWER_ISA_VERSION   "power-isa-version"

A string that specifies the numerical portion of the Power ISA version string (Type: <string>).

◆ DTB_PROPERTY_CACHE_OP_BLOCK_SIZE

#define DTB_PROPERTY_CACHE_OP_BLOCK_SIZE   "cache-op-block-size"

The block size in bytes upon which cache block instructions operate (Type: <u32>).

◆ DTB_PROPERTY_RESERVATION_GRANULE_SIZE

#define DTB_PROPERTY_RESERVATION_GRANULE_SIZE   "reservation-granule-size"

The reservation granule size supported by this processor in bytes (Type: <u32>).

◆ DTB_PROPERTY_MMU_TYPE

#define DTB_PROPERTY_MMU_TYPE   "mmu-type"

Specifies the CPU’s MMU type (Type: <string>).

◆ DTB_PROPERTY_TLB_SPLIT

#define DTB_PROPERTY_TLB_SPLIT   "tlb-split"

Specifies that the TLB has a split configuration (Type: <empty>).

◆ DTB_PROPERTY_TLB_SIZE

#define DTB_PROPERTY_TLB_SIZE   "tlb-size"

Specifies the number of entries in the TLB (Type: <u32>).

◆ DTB_PROPERTY_TLB_SETS

#define DTB_PROPERTY_TLB_SETS   "tlb-sets"

Specifies the number of associativity sets inthe TLB. (Type: <u32>).

◆ DTB_PROPERTY_D_TLB_SIZE

#define DTB_PROPERTY_D_TLB_SIZE   "d-tlb-size"

Specifies the number of entries in the data TLB (Type: <u32>).

◆ DTB_PROPERTY_D_TLB_SETS

#define DTB_PROPERTY_D_TLB_SETS   "d-tlb-sets"

Specifies the number of associativity sets in the data TLB. (Type: <u32>).

◆ DTB_PROPERTY_I_TLB_SIZE

#define DTB_PROPERTY_I_TLB_SIZE   "i-tlb-size"

Specifies the number of entries in the instruction TLB (Type: <u32>).

◆ DTB_PROPERTY_I_TLB_SETS

#define DTB_PROPERTY_I_TLB_SETS   "i-tlb-sets"

Specifies the number of associativity sets in the instruction TLB (Type: <u32>).

◆ DTB_PROPERTY_CACHE_UNIFIED

#define DTB_PROPERTY_CACHE_UNIFIED   "cache-unified"

Specifies the cache has a unified organization (Type: <empty>).

◆ DTB_PROPERTY_CACHE_SIZE

#define DTB_PROPERTY_CACHE_SIZE   "cache-size"

Specifies the size in bytes of a unified cache (Type: <u32>).

◆ DTB_PROPERTY_CACHE_SETS

#define DTB_PROPERTY_CACHE_SETS   "cache-sets"

Specifies the number of associativity sets in a unified cache (Type: <u32>).

◆ DTB_PROPERTY_CACHE_BLOCK_SIZE

#define DTB_PROPERTY_CACHE_BLOCK_SIZE   "cache-block-size"

Specifies the block size in bytes of a unified cache (Type: <u32>).

◆ DTB_PROPERTY_CACHE_LINE_SIZE

#define DTB_PROPERTY_CACHE_LINE_SIZE   "cache-line-size"

Specifies the line size in bytes of a unified cache (Type: <u32>).

◆ DTB_PROPERTY_I_CACHE_SIZE

#define DTB_PROPERTY_I_CACHE_SIZE   "i-cache-size"

Specifies the size in bytes of the instruction cache (Type: <u32>).

◆ DTB_PROPERTY_I_CACHE_SETS

#define DTB_PROPERTY_I_CACHE_SETS   "i-cache-sets"

Specifies the number of associativity sets in the instruction cache (Type: <u32>).

◆ DTB_PROPERTY_I_CACHE_BLOCK_SIZE

#define DTB_PROPERTY_I_CACHE_BLOCK_SIZE   "i-cache-block-size"

Specifies the block size in bytes of the instruction cache (Type: <u32>).

◆ DTB_PROPERTY_I_CACHE_LINE_SIZE

#define DTB_PROPERTY_I_CACHE_LINE_SIZE   "i-cache-line-size"

Specifies the line size in bytes of the instruction cache (Type: <u32>).

◆ DTB_PROPERTY_D_CACHE_SIZE

#define DTB_PROPERTY_D_CACHE_SIZE   "d-cache-size"

Specifies the size in bytes of the data cache (Type: <u32>).

◆ DTB_PROPERTY_D_CACHE_SETS

#define DTB_PROPERTY_D_CACHE_SETS   "d-cache-sets"

Specifies the number of associativity sets in the data cache. (Type: <u32>).

◆ DTB_PROPERTY_D_CACHE_BLOCK_SIZE

#define DTB_PROPERTY_D_CACHE_BLOCK_SIZE   "d-cache-block-size"

Specifies the block size in bytes of the data cache. (Type: <u32>).

◆ DTB_PROPERTY_D_CACHE_LINE_SIZE

#define DTB_PROPERTY_D_CACHE_LINE_SIZE   "d-cache-line-size"

Specifies the line size in bytes of the data cache, (Type: <u32>).

◆ DTB_PROPERTY_NEXT_LEVEL_CACHE

#define DTB_PROPERTY_NEXT_LEVEL_CACHE   "next-level-cache"

If present, indicates that another level of cache exists. (Type: <phandle>).

◆ DTB_PROPERTY_CACHE_LEVEL

#define DTB_PROPERTY_CACHE_LEVEL   "cache-level"

Specifies the level in the cache hierarchy (Type: <u32>).

◆ DTB_PROPERTY_SERIAL_NUMBER

#define DTB_PROPERTY_SERIAL_NUMBER   "serial-number"

Serial Number (Type: <string>).

Other Additional Properties

◆ DTB_PROPERTY_ALLOC_RANGES

#define DTB_PROPERTY_ALLOC_RANGES   "alloc-ranges"

Allocated Ranges (Type: <prop-encoded-array>).

◆ DTB_PROPERTY_RESETS

#define DTB_PROPERTY_RESETS   "resets"

Resets (Type: <prop-encoded-array>).

◆ DTB_PROPERTY_CLOCK_CELLS

#define DTB_PROPERTY_CLOCK_CELLS   "#clock-cells"

Number of clock cells (Type: <u32>).

◆ DTB_PROPERTY_LINUX_INITRD_START

#define DTB_PROPERTY_LINUX_INITRD_START   "linux,initrd-start"

The starting address of the initial ram disk (Type: <u32>).

◆ DTB_PROPERTY_LINUX_INITRD_END

#define DTB_PROPERTY_LINUX_INITRD_END   "linux,initrd-end"

The ending address of the initial ram disk (Type: <u32>).

◆ DTB_MAX_PROPERTY_TYPE

#define DTB_MAX_PROPERTY_TYPE   60

DTB Property Types

Typedef Documentation

◆ DTB_HEADER

typedef struct _DTB_HEADER DTB_HEADER

Device Tree specific types DTB Header

◆ DTB_RESERVATION

DTB Reservation

◆ DTB_NODE

typedef struct _DTB_NODE DTB_NODE

DTB Node

◆ DTB_PROPERTY

typedef struct _DTB_PROPERTY DTB_PROPERTY

DTB Property

◆ DTB_PROPERTY_CHAR

DTB Property Char

◆ DTB_PROPERTY_LONGWORD

DTB Property LongWord

◆ DTB_PROPERTY_QUADWORD

DTB Property QuadWord

◆ dtb_log_output_cb

typedef void STDCALL(* dtb_log_output_cb) (const char *text, void *data)

Device Tree Logging specific types

◆ dtb_decode_value_cb

typedef char *STDCALL(* dtb_decode_value_cb) (HANDLE node, HANDLE handle, void *value, uint32_t size, void *data)

Function Documentation

◆ device_tree_validate()

BOOL STDCALL device_tree_validate ( size_t address,
uint32_t * size )

Check the data at the supplied address to determine if it is a valid Device Tree Blob.

Device Tree Functions

Parameters
AddressThe address to be validated
SizeOn return contains the total size of the Device Tree Blob if valid
Returns
True if the address points to a valid Device Tree Blob, False if not
Note
Does not overwrite passed Size unless the DTB is valid

◆ device_tree_next_node()

HANDLE STDCALL device_tree_next_node ( HANDLE parent,
HANDLE previous )

Find the next DTB node within the Device Tree.

Parameters
ParentHandle of the parent node to search in, INVALID_HANDLE_VALUE to search the entire tree
PreviousHandle of the node to start from, INVALID_HANDLE_VALUE to start from the root node
Returns
The handle of the next node in the tree or INVALID_HANDLE_VALUE if no node was found

◆ device_tree_next_property()

HANDLE STDCALL device_tree_next_property ( HANDLE node,
HANDLE previous )

Find the next DTB property within the specified node of the Device Tree.

Parameters
NodeHandle of the node to search in
PreviousHandle of the property to start from, INVALID_HANDLE_VALUE to start from the first property
Returns
The handle of the next property in the node or INVALID_HANDLE_VALUE if no property was found

◆ device_tree_get_node()

HANDLE STDCALL device_tree_get_node ( const char * path,
HANDLE parent )

Get the handle of the node matching the specified path, optionally within a specified parent.

Parameters
PathThe path of the node to find, relative to parent node or fully qualified if parent not specified (eg /chosen or /cpus/cpu0)
ParentHandle of the parent node to search in, INVALID_HANDLE_VALUE to search the entire tree
Returns
The handle of the node which matches the path or INVALID_HANDLE_VALUE if no node was found

◆ device_tree_get_property()

HANDLE STDCALL device_tree_get_property ( HANDLE node,
const char * name )

Get the handle of the property matching the specified name.

Parameters
NodeHandle of the node to search in
NameThe name of the node to find (eg compatible)
Returns
The handle of the property which matches the name or INVALID_HANDLE_VALUE if no property was found

◆ device_tree_get_node_name()

uint32_t STDCALL device_tree_get_node_name ( HANDLE handle,
char * name,
uint32_t len )

Get the name of the specified node.

Parameters
HandleThe handle of the node to get the name of
Returns
The name of the specified node or an empty string if the node was not valid

◆ device_tree_split_node_name()

uint32_t STDCALL device_tree_split_node_name ( HANDLE handle,
char * nodename,
uint32_t namelen,
char * unitaddress,
uint32_t addresslen )

Split the name of a node into node name and unit address.

Parameters
HandleThe handle of the node to split the name of
NodeNameThe node name on return or an empty string if the node was not valid
UnitAddressThe unit address on return (If applicable)

◆ device_tree_get_node_parent()

HANDLE STDCALL device_tree_get_node_parent ( HANDLE handle)

Get the parent node of the specified node.

Parameters
HandleThe handle of the node to get the parent of
Returns
The handle of the parent node or INVALID_HANDLE_VALUE if the node was not valid

◆ device_tree_get_node_reg_cells()

BOOL STDCALL device_tree_get_node_reg_cells ( HANDLE handle,
uint32_t * address,
uint32_t * size )

Get the #address-cells and #size-cells values that apply to reg properties of the specified node.

Parameters
HandleThe handle of the node to get the cell sizes for
AddressThe #address-cells value on return (or the default value if not found)
SizeThe #size-cells value on return (or the default value if not found)
Returns
True if the cell sizes were found or False if the node was not valid
Note
The address and size values applicable to a given node will be those from a parent node, not those found in the node itself (if present)
Used by early stage boot stage processing which must limit the use of strings and other memory allocations. This function uses a memory compare for names

◆ device_tree_get_node_range_cells()

BOOL STDCALL device_tree_get_node_range_cells ( HANDLE handle,
uint32_t * parentaddress,
uint32_t * nodeaddress,
uint32_t * nodesize )

Get the #address-cells and #size-cells values that apply to range properties of the specified node.

Parameters
HandleThe handle of the node to get the cell sizes for
ParentAddressThe #address-cells value from the parent on return (or the default value if not found)
NodeAddressThe #address-cells value from this node on return (or the default value if not found)
NodeSizeThe #size-cells value from this node on return (or the default value if not found)
Returns
True if the cell sizes were found or False if the node was not valid
Note
Range properties use the address value from the parent node and the address and size values from the node itself to determine the size of each range
Used by early stage boot stage processing which must limit the use of strings and other memory allocations. This function uses a memory compare for names

◆ device_tree_get_property_name()

uint32_t STDCALL device_tree_get_property_name ( HANDLE handle,
char * name,
uint32_t len )

Get the name of the specified property.

Parameters
HandleThe handle of the property to get the name of
Returns
The name of the specified property or an empty string if the property was not valid

◆ device_tree_split_property_name()

uint32_t STDCALL device_tree_split_property_name ( HANDLE handle,
char * uniqueprefix,
uint32_t prefixlen,
char * propertyname,
uint32_t namelen )

Split the name of a property into property name and unique prefix.

Parameters
HandleThe handle of the property to split the name of
UniquePrefixThe unique prefix on return (If applicable)
PropertyNameThe property name on return or an empty string if the property was not valid

◆ device_tree_get_property_value()

void *STDCALL device_tree_get_property_value ( HANDLE handle)

Get a pointer to the raw value of the specified property.

Parameters
HandleThe handle of the property to get the value of
Returns
A pointer to the specified property value or nil if the property was not valid
Note
The returned value points to the memory block where device tree is stored and should not be modified or freed

◆ device_tree_get_property_length()

uint32_t STDCALL device_tree_get_property_length ( HANDLE handle)

Get the length of the raw value of the specified property.

Parameters
HandleThe handle of the property to get the value length of
Returns
The length of the specified property value in bytes or -1 if the property was not valid

◆ device_tree_get_property_string()

uint32_t STDCALL device_tree_get_property_string ( HANDLE handle,
char * string,
uint32_t len )

Get the value of the specified property as a string.

Parameters
HandleThe handle of the property to get the value of
Returns
A string representation of the value or an empty string if the property was not valid

◆ device_tree_get_property_longword()

uint32_t STDCALL device_tree_get_property_longword ( HANDLE handle)

Get the value of the specified property as a longword.

Parameters
HandleThe handle of the property to get the value of
Returns
A longword representation of the value or 0 if the property was not valid

◆ device_tree_get_property_quadword()

uint64_t STDCALL device_tree_get_property_quadword ( HANDLE handle)

Get the value of the specified property as a quadword.

Parameters
HandleThe handle of the property to get the value of
Returns
A quadword representation of the value or 0 if the property was not valid

◆ device_tree_get_boot_args()

char *STDCALL device_tree_get_boot_args ( void )

Return a character pointer to the location of the command line in the device tree blob.

Device Tree Helper Functions

Note
Intended primarily for use by early boot stage processing which must limit the use of strings and other memory allocations. For normal use see DeviceTreeGetNode and DeviceTreeGetProperty

◆ device_tree_get_ramdisk()

BOOL STDCALL device_tree_get_ramdisk ( size_t * address,
uint64_t * size )

Return the address and size of the initial ram disk specified in the device tree blob.

Parameters
AddressUsed to return the address value
SizeUsed to return the size value
Returns
True if an initial ram disk was specified in the device tree, False if not
Note
Intended primarily for use by early boot stage processing which must limit the use of strings and other memory allocations. For normal use see DeviceTreeGetNode and DeviceTreeGetProperty

◆ device_tree_get_memory()

BOOL STDCALL device_tree_get_memory ( uint32_t index,
size_t * address,
uint64_t * size )

Return the address and size of a memory block specified in the device tree blob.

Parameters
IndexThe index of the memory block to return (The first block is 0)
RangeUsed to return the page range value (If applicable)
AddressUsed to return the address value
SizeUsed to return the size value
Returns
True if the memory block requested was found in the device tree, False if not
Note
Intended primarily for use by early boot stage processing which must limit the use of strings and other memory allocations. For normal use see DeviceTreeGetNode and DeviceTreeGetProperty

◆ device_tree_get_reservation()

BOOL STDCALL device_tree_get_reservation ( uint32_t index,
size_t * address,
uint64_t * size )

Return the address and size of a memory reservation specified in the device tree blob.

Parameters
IndexThe index of the memory reservation to return (The first reservation is 0)
AddressUsed to return the address value
SizeUsed to return the size value
Returns
True if the memory reservation requested was found in the device tree, False if not

◆ device_tree_log_tree()

uint32_t STDCALL device_tree_log_tree ( void )

Print information about all nodes and properties in the device tree.

Returns
ERROR_SUCCESS if completed or another error code on failure

◆ device_tree_log_tree_ex()

uint32_t STDCALL device_tree_log_tree_ex ( HANDLE node,
dtb_log_output_cb output,
dtb_decode_value_cb decode,
void * data )

Print information about one or all nodes and properties in the device tree with custom value decode callback.

Parameters
NodeThe node to print information about (INVALID_HANDLE_VALUE for all nodes)
OutputThe log output callback to print information to (nil to use the default output)
DecodeThe callback to decode a value into a string (nil to use the default decode)
DataA pointer to caller specific data which should be passed to the callbacks (Optional)
Returns
ERROR_SUCCESS if completed or another error code on failure

Variable Documentation

◆ PACKED

struct _DTB_PROPERTY_QUADWORD PACKED