#include <pexpert/device_tree.h>

pexpert/device_tree.h Kernel.framework

18 functions · 14 typedefs · 6 structs · 4 enums · 1 macro

enum(anonymous)

------------------------------------------------------------------------------- Foundation Types -------------------------------------------------------------------------------
underlying type unsigned int
kDTPathNameSeparator470x2F

enum(anonymous)

Property Name Definitions (Property Names are C-Strings)
underlying type unsigned int
kDTMaxPropertyNameLength31Max length of Property Name (terminator not included)

typedefDTPropertyNameBuf

typedef char DTPropertyNameBuf[32]

enum(anonymous)

Entry Name Definitions (Entry Names are C-Strings)
underlying type unsigned int
kDTMaxEntryNameLength63Max length of a C-String Entry Name (terminator not included)

typedefDTEntryNameBuf

length of DTEntryNameBuf = kDTMaxEntryNameLength +1
typedef char DTEntryNameBuf[kDTMaxEntryNameLength + 1]

macrokPropNameLength

#define kPropNameLength 32

structDeviceTreeNodeProperty

size 36, align 4
char[32]nameNUL terminated property name
uint32_tlengthLength (bytes) of folloing prop value

typedefDeviceTreeNodeProperty

typedef struct DeviceTreeNodeProperty DeviceTreeNodeProperty;

structOpaqueDTEntry

size 8, align 4
uint32_tnPropertiesNumber of props[] elements (0 => end)
uint32_tnChildrenNumber of children[] elements

typedefDeviceTreeNode

typedef struct OpaqueDTEntry DeviceTreeNode;

typedefRealDTEntry

typedef const DeviceTreeNode *RealDTEntry

structDTSavedScope

size 32, align 8
struct DTSavedScope *nextScope
RealDTEntryscope
RealDTEntryentry
unsigned longindex

typedefDTSavedScopePtr

typedef struct DTSavedScope * DTSavedScopePtr;

structOpaqueDTEntryIterator

Entry Iterator
size 40, align 8
RealDTEntryouterScope
RealDTEntrycurrentScope
RealDTEntrycurrentEntry
DTSavedScopePtrsavedScope
unsigned longcurrentIndex

typedefOpaqueDTEntryIterator

typedef struct OpaqueDTEntryIterator OpaqueDTEntryIterator;

typedefDTEntryIterator

typedef struct OpaqueDTEntryIterator * DTEntryIterator;

structOpaqueDTPropertyIterator

Property Iterator
size 24, align 8
RealDTEntryentry
const DeviceTreeNodeProperty *currentProperty
unsigned longcurrentIndex

typedefOpaqueDTPropertyIterator

typedef struct OpaqueDTPropertyIterator OpaqueDTPropertyIterator;

typedefDTPropertyIterator

typedef struct OpaqueDTPropertyIterator * DTPropertyIterator;

typedefDTEntry

Entry
typedef const struct OpaqueDTEntry* DTEntry

typedefDTEntryIterator

Entry Iterator
typedef struct OpaqueDTEntryIterator* DTEntryIterator

typedefDTPropertyIterator

Property Iterator
typedef struct OpaqueDTPropertyIterator* DTPropertyIterator

enum(anonymous)

status values
underlying type int
kError-1
kIterationDone0
kSuccess1

functionSecureDTInit

extern void SecureDTInit(void const *base, size_t size)
Used to initalize the device tree functions. base is the base address of the flatened device tree

functionSecureDTIsLockedDown

extern bool SecureDTIsLockedDown(void)
Whether the device tree is locked down after machine lockdown. Returns false if there is no meaningful distinction, in contrast to SecureDTFindEntry.

functionSecureDTEntryIsEqual

extern int SecureDTEntryIsEqual(const DTEntry ref1, const DTEntry ref2)
------------------------------------------------------------------------------- Entry Handling ------------------------------------------------------------------------------- Compare two Entry's for equality.

functionSecureDTFindEntry

extern int SecureDTFindEntry(const char *propName, const char *propValue, DTEntry *entryH)
------------------------------------------------------------------------------- LookUp Entry by Name ------------------------------------------------------------------------------- Find Entry Find the device tree entry that contains propName=propValue. It currently searches the entire tree. This function should eventually go in DeviceTree.c. This only works for string properties where `propValue` is null-terminated. Returns: kSuccess = entry was found. Entry is in entryH. kError = entry was not found

functionSecureDTFindNodeWithPropertyEqualToValue

extern int SecureDTFindNodeWithPropertyEqualToValue(
	const char *const propertyName,
	const void *const propertyValue,
	const size_t propertyValueSize,
	const DeviceTreeNode **const devicetreeNode
)
@brief Finds the devicetree node that has the specified property equal to the specified value. This function works with properties of any type; it just checks that the size and bytes of the value are what the caller wants. @note This function also works with properties that don't have a value—just specify NULL for `propertyValue` and 0 for `propertyValueSize`. @param [in] propertyName The name of the property. @param [in] propertyValue A pointer to some bytes that make up the value. @param [in] propertyValueSize The number of bytes that make up the value. @param [out] devicetreeNode A pointer to the target devicetree node, if found. @return kSuccess if the node was found and kError otherwise.

functionSecureDTFindNodeWithPhandle

extern int SecureDTFindNodeWithPhandle(
	const uint32_t phandle,
	const DeviceTreeNode **const devicetreeNode
)
@brief Finds the devicetree node with the specified phandle. This is a convenience wrapper around `SecureDTFindNodeWithPropertyEqualToValue()`. @param [in] phandle The phandle of interest. @param [out] devicetreeNode A pointer to the target devicetree node, if found. @return kSuccess if the node was found and kError otherwise.

functionSecureDTFindNodeWithStringProperty

extern int SecureDTFindNodeWithStringProperty(
	const char *const propertyName,
	const char *const propertyValue,
	const DeviceTreeNode **const devicetreeNode
)
@brief Finds the devicetree node with the specified string property. This is a convenience wrapper around `SecureDTFindNodeWithPropertyEqualToValue()`. @param [in] propertyName The name of the string property. @param [in] propertyValue The value of the string property. @param [out] devicetreeNode A pointer to the target devicetree node, if found. @return kSuccess if the node was found and kError otherwise.

functionSecureDTLookupEntry

extern int SecureDTLookupEntry(
	const DTEntry searchPoint,
	const char *pathName,
	DTEntry *foundEntry
)
Lookup Entry Locates an entry given a specified subroot (searchPoint) and path name. If the searchPoint pointer is NULL, the path name is assumed to be an absolute path name rooted to the root of the device tree. Returns: kSuccess = entry was found. Entry is in foundEntry. kError = entry was not found

functionSecureDTInitEntryIterator

extern int SecureDTInitEntryIterator(const DTEntry startEntry, DTEntryIterator iter)
------------------------------------------------------------------------------- Entry Iteration ------------------------------------------------------------------------------- An Entry Iterator maintains three variables that are of interest to clients. First is an "OutermostScope" which defines the outer boundry of the iteration. This is defined by the starting entry and includes that entry plus all of it's embedded entries. Second is a "currentScope" which is the entry the iterator is currently in. And third is a "currentPosition" which is the last entry returned during an iteration. Initialize Entry Iterator Fill out the iterator structure. The outermostScope and currentScope of the iterator are set to "startEntry". If "startEntry" = NULL, the outermostScope and currentScope are set to the root entry. The currentPosition for the iterator is set to "nil".

functionSecureDTEnterEntry

extern int SecureDTEnterEntry(DTEntryIterator iterator, DTEntry childEntry)
Enter Child Entry Move an Entry Iterator into the scope of a specified child entry. The currentScope of the iterator is set to the entry specified in "childEntry". If "childEntry" is nil, the currentScope is set to the entry specified by the currentPosition of the iterator.

functionSecureDTExitEntry

extern int SecureDTExitEntry(DTEntryIterator iterator, DTEntry *currentPosition)
Exit to Parent Entry Move an Entry Iterator out of the current entry back into the scope of it's parent entry. The currentPosition of the iterator is reset to the current entry (the previous currentScope), so the next iteration call will continue where it left off. This position is returned in parameter "currentPosition".

functionSecureDTIterateEntries

extern int SecureDTIterateEntries(DTEntryIterator iterator, DTEntry *nextEntry)
Iterate Entries Iterate and return entries contained within the entry defined by the current scope of the iterator. Entries are returned one at a time. When int == kIterationDone, all entries have been exhausted, and the value of nextEntry will be Nil.

functionSecureDTRestartEntryIteration

extern int SecureDTRestartEntryIteration(DTEntryIterator iterator)
Restart Entry Iteration Restart an iteration within the current scope. The iterator is reset such that iteration of the contents of the currentScope entry can be restarted. The outermostScope and currentScope of the iterator are unchanged. The currentPosition for the iterator is set to "nil".

functionSecureDTGetProperty

extern int SecureDTGetProperty(
	const DTEntry entry,
	const char *propertyName,
	void const **propertyValue,
	unsigned int *propertySize
)
------------------------------------------------------------------------------- Get Property Values ------------------------------------------------------------------------------- Get the value of the specified property for the specified entry. Get Property

functionSecureDTGetPropertyRegion

extern int SecureDTGetPropertyRegion(
	const DTEntry entry,
	const char *propertyName,
	void const **propertyValue,
	unsigned int *propertySize,
	vm_offset_t const region_start,
	vm_size_t region_size
)
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu pexpert/gen/device_tree.c, pexpert/pexpert/device_tree.h
Returns the value of the named property of a device tree entry, in the manner of SecureDTGetProperty, but validates the entry and its property list against the caller-supplied flattened device tree region [region_start, region_start + region_size) instead of the registered kernel device tree. Used to read properties from a device tree image that is not (or not yet) the global tree. On success stores a pointer to the property data in *propertyValue and its length in *propertySize and returns kSuccess; returns kError if the entry is NULL, has no properties, or the property is not found.

functionSecureDTInitPropertyIterator

extern int SecureDTInitPropertyIterator(const DTEntry entry, DTPropertyIterator iter)
------------------------------------------------------------------------------- Iterating Properties ------------------------------------------------------------------------------- Initialize Property Iterator Fill out the property iterator structure. The target entry is defined by entry.

functionSecureDTIterateProperties

extern int SecureDTIterateProperties(
	DTPropertyIterator iterator,
	char const **foundProperty
)
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu pexpert/gen/device_tree.c, pexpert/pexpert/device_tree.h
Iterates the properties of the entry associated with a property iterator (see SecureDTInitPropertyIterator), returning property names one at a time. Each call advances the iterator and stores the next property's name in *foundProperty; the value can then be fetched with SecureDTGetProperty. Returns kSuccess for each property returned, and kIterationDone (with *foundProperty set to NULL) when all properties have been exhausted.

functionSecureDTRestartPropertyIteration

extern int SecureDTRestartPropertyIteration(DTPropertyIterator iterator)
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu pexpert/gen/device_tree.c, pexpert/pexpert/device_tree.h
Resets a property iterator to the beginning of its entry's property list, so the properties can be iterated again with SecureDTIterateProperties. Returns kSuccess.

structDTMemoryMapRange

size 16, align 8
vm_offset_tpaddr
size_tlength

typedefDTMemoryMapRange

typedef struct DTMemoryMapRange DTMemoryMapRange;