TianoCore EDK2 master
Loading...
Searching...
No Matches
FdtLib.h File Reference

Go to the source code of this file.

Data Structures

struct  FDT_HEADER
 
struct  FDT_RESERVE_ENTRY
 
struct  FDT_NODE_HEADER
 
struct  FDT_PROPERTY
 

Macros

#define FDT_ERR_NOTFOUND   1
 
#define FDT_ERR_EXISTS   2
 
#define FDT_ERR_NOSPACE   3
 
#define FDT_ERR_BADOFFSET   4
 
#define FDT_ERR_BADPATH   5
 
#define FDT_ERR_BADPHANDLE   6
 
#define FDT_ERR_BADSTATE   7
 
#define FDT_ERR_TRUNCATED   8
 
#define FDT_ERR_BADMAGIC   9
 
#define FDT_ERR_BADVERSION   10
 
#define FDT_ERR_BADSTRUCTURE   11
 
#define FDT_ERR_BADLAYOUT   12
 
#define FDT_ERR_INTERNAL   13
 
#define FDT_ERR_BADNCELLS   14
 
#define FDT_ERR_BADVALUE   15
 
#define FDT_ERR_BADOVERLAY   16
 
#define FDT_ERR_NOPHANDLES   17
 
#define FDT_ERR_BADFLAGS   18
 
#define FDT_ERR_ALIGNMENT   19
 
#define FDT_ERR_MAX   19
 
#define FDT_TAGSIZE   sizeof(UINT32)
 
#define FDT_MAX_NCELLS   4
 
#define FdtGetHeader(Fdt, Field)    (Fdt32ToCpu (((const FDT_HEADER *)(Fdt))->Field))
 
#define FdtTotalSize(Fdt)   (FdtGetHeader ((Fdt), TotalSize))
 
#define FdtForEachSubnode(Node, Fdt, Parent)
 

Functions

UINT16 EFIAPI Fdt16ToCpu (IN UINT16 Value)
 
UINT16 EFIAPI CpuToFdt16 (IN UINT16 Value)
 
UINT32 EFIAPI Fdt32ToCpu (IN UINT32 Value)
 
UINT32 EFIAPI CpuToFdt32 (IN UINT32 Value)
 
UINT64 EFIAPI Fdt64ToCpu (IN UINT64 Value)
 
UINT64 EFIAPI CpuToFdt64 (IN UINT64 Value)
 
INT32 EFIAPI FdtCheckHeader (IN CONST VOID *Fdt)
 
INT32 EFIAPI FdtOpenInto (IN CONST VOID *Fdt, OUT VOID *Buffer, IN INT32 BufferSize)
 
INT32 EFIAPI FdtPack (IN OUT VOID *Fdt)
 
INT32 EFIAPI FdtCreateEmptyTree (IN VOID *Buffer, IN UINT32 BufferSize)
 
CONST VOID *EFIAPI FdtOffsetPointer (IN CONST VOID *Fdt, IN INT32 Offset, IN UINT32 Length)
 
INT32 EFIAPI FdtNextNode (IN CONST VOID *Fdt, IN INT32 Offset, IN INT32 *Depth)
 
INT32 EFIAPI FdtFirstSubnode (IN CONST VOID *Fdt, IN INT32 Offset)
 
INT32 EFIAPI FdtNextSubnode (IN CONST VOID *Fdt, IN INT32 Offset)
 
INT32 EFIAPI FdtSubnodeOffsetNameLen (IN CONST VOID *Fdt, IN INT32 ParentOffset, IN CONST CHAR8 *Name, IN INT32 NameLength)
 
INTN EFIAPI FdtGetNumberOfReserveMapEntries (IN CONST VOID *Fdt)
 
INTN EFIAPI FdtGetReserveMapEntry (IN CONST VOID *Fdt, IN INTN Index, OUT UINT64 *Addr, OUT UINT64 *Size)
 
INT32 EFIAPI FdtParentOffset (IN CONST VOID *Fdt, IN INT32 NodeOffset)
 
INT32 EFIAPI FdtNodeOffsetByPropertyValue (IN CONST VOID *Fdt, IN INT32 StartOffset, IN CONST CHAR8 *PropertyName, IN CONST VOID *PropertyValue, IN INT32 PropertyLength)
 
INT32 EFIAPI FdtNodeOffsetByPhandle (IN CONST VOID *Fdt, IN UINT32 Phandle)
 
INT32 EFIAPI FdtStringListContains (IN CONST CHAR8 *StringList, IN INT32 ListLength, IN CONST CHAR8 *String)
 
CONST FDT_PROPERTY *EFIAPI FdtGetProperty (IN CONST VOID *Fdt, IN INT32 NodeOffset, IN CONST CHAR8 *Name, IN INT32 *Length)
 
CONST CHAR8 *EFIAPI FdtGetAliasNameLen (IN CONST VOID *Fdt, IN CONST CHAR8 *Name, IN INT32 Length)
 
INT32 EFIAPI FdtFirstPropertyOffset (IN CONST VOID *Fdt, IN INT32 NodeOffset)
 
INT32 EFIAPI FdtNextPropertyOffset (IN CONST VOID *Fdt, IN INT32 Offset)
 
CONST FDT_PROPERTY *EFIAPI FdtGetPropertyByOffset (IN CONST VOID *Fdt, IN INT32 Offset, IN INT32 *Length)
 
CONST CHAR8 *EFIAPI FdtGetString (IN CONST VOID *Fdt, IN INT32 StrOffset, IN INT32 *Length OPTIONAL)
 
INT32 EFIAPI FdtAddSubnode (IN VOID *Fdt, IN INT32 ParentOffset, IN CONST CHAR8 *Name)
 
INT32 EFIAPI FdtSetProperty (IN VOID *Fdt, IN INT32 NodeOffset, IN CONST CHAR8 *Name, IN CONST VOID *Value, IN UINT32 Length)
 
INT32 EFIAPI FdtSetPropU64 (IN VOID *Fdt, IN INT32 NodeOffset, IN CONST CHAR8 *Name, IN UINT64 Value)
 
INT32 EFIAPI FdtAppendProp (IN VOID *Fdt, IN INT32 NodeOffset, IN CONST CHAR8 *Name, IN CONST VOID *Value, IN UINT32 Length)
 
INT32 FdtDelProp (IN OUT VOID *Fdt, IN INT32 NodeOffset, IN CONST CHAR8 *Name)
 
INT32 EFIAPI FdtPathOffsetNameLen (IN CONST VOID *Fdt, IN CONST CHAR8 *Path, IN INT32 NameLength)
 
INT32 EFIAPI FdtPathOffset (IN CONST VOID *Fdt, IN CONST CHAR8 *Path)
 
CONST CHAR8 *EFIAPI FdtGetName (IN VOID *Fdt, IN INT32 NodeOffset, IN INT32 *Length)
 
INT32 EFIAPI FdtNodeDepth (IN CONST VOID *Fdt, IN INT32 NodeOffset)
 
INT32 EFIAPI FdtNodeOffsetByCompatible (IN CONST VOID *Fdt, IN INT32 StartOffset, IN CONST CHAR8 *Compatible)
 
INT32 EFIAPI FdtAddressCells (IN CONST VOID *Fdt, IN INT32 NodeOffset)
 
INT32 EFIAPI FdtSizeCells (IN CONST VOID *Fdt, IN INT32 NodeOffset)
 
CONST CHAR8 * FdtStrerror (IN INT32 ErrVal)
 

Detailed Description

Flattened Device Tree Library.

All structure data are in big-endian format. Functions are provided for converting data between little-endian and big-endian. For example: Pushing data to FDT blob needs to convert data to big-endian by CpuToFdt*(). Retrieving data from FDT blob needs to convert data to little-endian by Fdt*ToCpu(). Refer to FDT specification: https://www.devicetree.org/specifications/

Copyright (c) 2023, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file FdtLib.h.

Macro Definition Documentation

◆ FDT_ERR_ALIGNMENT

#define FDT_ERR_ALIGNMENT   19

Definition at line 124 of file FdtLib.h.

◆ FDT_ERR_BADFLAGS

#define FDT_ERR_BADFLAGS   18

Definition at line 119 of file FdtLib.h.

◆ FDT_ERR_BADLAYOUT

#define FDT_ERR_BADLAYOUT   12

Definition at line 81 of file FdtLib.h.

◆ FDT_ERR_BADMAGIC

#define FDT_ERR_BADMAGIC   9

Definition at line 65 of file FdtLib.h.

◆ FDT_ERR_BADNCELLS

#define FDT_ERR_BADNCELLS   14

Definition at line 97 of file FdtLib.h.

◆ FDT_ERR_BADOFFSET

#define FDT_ERR_BADOFFSET   4

Definition at line 37 of file FdtLib.h.

◆ FDT_ERR_BADOVERLAY

#define FDT_ERR_BADOVERLAY   16

Definition at line 108 of file FdtLib.h.

◆ FDT_ERR_BADPATH

#define FDT_ERR_BADPATH   5

Definition at line 42 of file FdtLib.h.

◆ FDT_ERR_BADPHANDLE

#define FDT_ERR_BADPHANDLE   6

Definition at line 47 of file FdtLib.h.

◆ FDT_ERR_BADSTATE

#define FDT_ERR_BADSTATE   7

Definition at line 53 of file FdtLib.h.

◆ FDT_ERR_BADSTRUCTURE

#define FDT_ERR_BADSTRUCTURE   11

Definition at line 76 of file FdtLib.h.

◆ FDT_ERR_BADVALUE

#define FDT_ERR_BADVALUE   15

Definition at line 102 of file FdtLib.h.

◆ FDT_ERR_BADVERSION

#define FDT_ERR_BADVERSION   10

Definition at line 70 of file FdtLib.h.

◆ FDT_ERR_EXISTS

#define FDT_ERR_EXISTS   2

Definition at line 25 of file FdtLib.h.

◆ FDT_ERR_INTERNAL

#define FDT_ERR_INTERNAL   13

Definition at line 90 of file FdtLib.h.

◆ FDT_ERR_MAX

#define FDT_ERR_MAX   19

Definition at line 129 of file FdtLib.h.

◆ FDT_ERR_NOPHANDLES

#define FDT_ERR_NOPHANDLES   17

Definition at line 114 of file FdtLib.h.

◆ FDT_ERR_NOSPACE

#define FDT_ERR_NOSPACE   3

Definition at line 29 of file FdtLib.h.

◆ FDT_ERR_NOTFOUND

#define FDT_ERR_NOTFOUND   1

Definition at line 23 of file FdtLib.h.

◆ FDT_ERR_TRUNCATED

#define FDT_ERR_TRUNCATED   8

Definition at line 60 of file FdtLib.h.

◆ FDT_MAX_NCELLS

#define FDT_MAX_NCELLS   4

Definition at line 179 of file FdtLib.h.

◆ FDT_TAGSIZE

#define FDT_TAGSIZE   sizeof(UINT32)

Definition at line 176 of file FdtLib.h.

◆ FdtForEachSubnode

#define FdtForEachSubnode (   Node,
  Fdt,
  Parent 
)
Value:
for (Node = FdtFirstSubnode (Fdt, Parent); \
Node >= 0; \
Node = FdtNextSubnode (Fdt, Node))
INT32 EFIAPI FdtFirstSubnode(IN CONST VOID *Fdt, IN INT32 Offset)
Definition: FdtLib.c:240
INT32 EFIAPI FdtNextSubnode(IN CONST VOID *Fdt, IN INT32 Offset)
Definition: FdtLib.c:259

Definition at line 186 of file FdtLib.h.

◆ FdtGetHeader

#define FdtGetHeader (   Fdt,
  Field 
)     (Fdt32ToCpu (((const FDT_HEADER *)(Fdt))->Field))

Definition at line 182 of file FdtLib.h.

◆ FdtTotalSize

#define FdtTotalSize (   Fdt)    (FdtGetHeader ((Fdt), TotalSize))

Definition at line 184 of file FdtLib.h.

Function Documentation

◆ CpuToFdt16()

UINT16 EFIAPI CpuToFdt16 ( IN UINT16  Value)

Convert UINT16 data to big-endian for aligned with the FDT blob

Parameters
[in]ValueThe value to align with the FDT blob.
Returns
The value to be converted to big-endian.

Definition at line 40 of file FdtLib.c.

◆ CpuToFdt32()

UINT32 EFIAPI CpuToFdt32 ( IN UINT32  Value)

Convert UINT32 data to big-endian for aligned with the FDT blob

Parameters
[in]ValueThe value to align with the FDT blob.
Returns
The value to be converted to big-endian.

Definition at line 74 of file FdtLib.c.

◆ CpuToFdt64()

UINT64 EFIAPI CpuToFdt64 ( IN UINT64  Value)

Convert UINT64 data to big-endian for aligned with the FDT blob

Parameters
[in]ValueThe value to align with the FDT blob.
Returns
The value to be converted to big-endian.

Definition at line 108 of file FdtLib.c.

◆ Fdt16ToCpu()

UINT16 EFIAPI Fdt16ToCpu ( IN UINT16  Value)

Convert UINT16 data of the FDT blob to little-endian

Parameters
[in]ValueThe value to the blob data.
Returns
The value to be converted to little-endian.

Definition at line 23 of file FdtLib.c.

◆ Fdt32ToCpu()

UINT32 EFIAPI Fdt32ToCpu ( IN UINT32  Value)

Convert UINT32 data of the FDT blob to little-endian

Parameters
[in]ValueThe value to the blob data.
Returns
The value to be converted to little-endian.

Definition at line 57 of file FdtLib.c.

◆ Fdt64ToCpu()

UINT64 EFIAPI Fdt64ToCpu ( IN UINT64  Value)

Convert UINT64 data of the FDT blob to little-endian

Parameters
[in]ValueThe value to the blob data.
Returns
The value to be converted to little-endian.

Definition at line 91 of file FdtLib.c.

◆ FdtAddressCells()

INT32 EFIAPI FdtAddressCells ( IN CONST VOID *  Fdt,
IN INT32  NodeOffset 
)

Retrieve address size for a bus represented in the tree

Parameters
[in]FdtThe pointer to FDT blob.
[in]NodeOffsetOffset of node to check.
Returns
Number of cells in the bus address, or negative error.

Definition at line 787 of file FdtLib.c.

◆ FdtAddSubnode()

INT32 EFIAPI FdtAddSubnode ( IN VOID *  Fdt,
IN INT32  ParentOffset,
IN CONST CHAR8 *  Name 
)

Add a new node to the FDT.

Parameters
[in]FdtThe pointer to FDT blob.
[in]ParentOffsetThe offset to the node offset which want to add in.
[in]NameThe name to name the node.
Returns
The offset to the new node.

Definition at line 570 of file FdtLib.c.

◆ FdtAppendProp()

INT32 EFIAPI FdtAppendProp ( IN VOID *  Fdt,
IN INT32  NodeOffset,
IN CONST CHAR8 *  Name,
IN CONST VOID *  Value,
IN UINT32  Length 
)

Append or create a property in the given node.

Parameters
[in]FdtThe pointer to FDT blob.
[in]NodeOffsetThe offset to the node offset which want to add in.
[in]NameThe name to name the property.
[in]ValueThe value (big-endian) to the property value.
[in]LengthThe length to the size of the property.
Returns
Zero for successfully, otherwise failed.

Definition at line 645 of file FdtLib.c.

◆ FdtCheckHeader()

INT32 EFIAPI FdtCheckHeader ( IN CONST VOID *  Fdt)

Verify the header of the Flattened Device Tree

Parameters
[in]FdtThe pointer to FDT blob.
Returns
Zero for successfully, otherwise failed.

Definition at line 125 of file FdtLib.c.

◆ FdtCreateEmptyTree()

INT32 EFIAPI FdtCreateEmptyTree ( IN VOID *  Buffer,
IN UINT32  BufferSize 
)

Create a empty Flattened Device Tree.

Parameters
[in]BufferThe pointer to allocate a pool for FDT blob.
[in]BufferSizeThe BufferSize to the pool size.
Returns
Zero for successfully, otherwise failed.

Definition at line 143 of file FdtLib.c.

◆ FdtDelProp()

INT32 FdtDelProp ( IN OUT VOID *  Fdt,
IN INT32  NodeOffset,
IN CONST CHAR8 *  Name 
)

Delete a property.

This function will delete data from the blob, and will therefore change the offsets of some existing nodes.

Parameters
[in]

out] Fdt Pointer to the device tree blob.

Parameters
[in]NodeOffsetOffset of the node whose property to nop.
[in]NameName of the property to nop.
Returns
Zero for successfully, otherwise failed.

Definition at line 670 of file FdtLib.c.

◆ FdtFirstPropertyOffset()

INT32 EFIAPI FdtFirstPropertyOffset ( IN CONST VOID *  Fdt,
IN INT32  NodeOffset 
)

Returns a offset of first property in the given node.

Parameters
[in]FdtThe pointer to FDT blob.
[in]NodeOffsetThe offset to the node which need be searched.
Returns
The offset to first property offset in the given node.

Definition at line 489 of file FdtLib.c.

◆ FdtFirstSubnode()

INT32 EFIAPI FdtFirstSubnode ( IN CONST VOID *  Fdt,
IN INT32  Offset 
)

Returns a offset of first node under the given node.

Parameters
[in]FdtThe pointer to FDT blob.
[in]OffsetThe offset to previous node.
Returns
The offset to next node offset.

Definition at line 240 of file FdtLib.c.

◆ FdtGetAliasNameLen()

CONST CHAR8 *EFIAPI FdtGetAliasNameLen ( IN CONST VOID *  Fdt,
IN CONST CHAR8 *  Name,
IN INT32  Length 
)

Returns a pointer to a node mapped to an alias matching a substring.

Parameters
[in]FdtThe pointer to FDT blob.
[in]NameThe alias name string.
[in]LengthThe length to the size of the property found.
Returns
A pointer to the expansion of the alias matching the substring, or NULL if alias not found.

Definition at line 469 of file FdtLib.c.

◆ FdtGetName()

CONST CHAR8 *EFIAPI FdtGetName ( IN VOID *  Fdt,
IN INT32  NodeOffset,
IN INT32 *  Length 
)

Returns the name of a given node.

Parameters
[in]FdtThe pointer to FDT blob.
[in]NodeOffseOffset of node to check.
[in]LengthThe pointer to an integer variable (will be overwritten) or NULL.
Returns
The pointer to the node's name.

Returns the name of a given node.

Parameters
[in]FdtThe pointer to FDT blob.
[in]NodeOffsetOffset of node to check.
[in]LengthThe pointer to an integer variable (will be overwritten) or NULL.
Returns
The pointer to the node's name.

Definition at line 729 of file FdtLib.c.

◆ FdtGetNumberOfReserveMapEntries()

INTN EFIAPI FdtGetNumberOfReserveMapEntries ( IN CONST VOID *  Fdt)

Returns the number of memory reserve map entries.

Parameters
[in]FdtThe pointer to FDT blob.
Returns
The number of entries in the reserve map.

Definition at line 277 of file FdtLib.c.

◆ FdtGetProperty()

CONST FDT_PROPERTY *EFIAPI FdtGetProperty ( IN CONST VOID *  Fdt,
IN INT32  NodeOffset,
IN CONST CHAR8 *  Name,
IN INT32 *  Length 
)

Returns a property with the given name from the given node.

Parameters
[in]FdtThe pointer to FDT blob.
[in]NodeOffsetThe offset to the given node.
[in]NameThe name to the property which need be searched
[in]LengthThe length to the size of the property found.
Returns
The property to the structure of the found property. Since the data come from FDT blob, it's encoding with big-endian.

Definition at line 446 of file FdtLib.c.

◆ FdtGetPropertyByOffset()

CONST FDT_PROPERTY *EFIAPI FdtGetPropertyByOffset ( IN CONST VOID *  Fdt,
IN INT32  Offset,
IN INT32 *  Length 
)

Returns a property from the given offset of the property.

Parameters
[in]FdtThe pointer to FDT blob.
[in]OffsetThe offset to the given offset of the property.
[in]LengthThe length to the size of the property found.
Returns
The property to the structure of the given property offset.

Definition at line 528 of file FdtLib.c.

◆ FdtGetReserveMapEntry()

INTN EFIAPI FdtGetReserveMapEntry ( IN CONST VOID *  Fdt,
IN INTN  Index,
OUT EFI_PHYSICAL_ADDRESS Addr,
OUT UINT64 *  Size 
)

Returns a memory reserve map entry.

Parameters
[in]*FdtThe pointer to FDT blob.
[in]IndexIndex of reserve map entry.
[out]AddrPointer to 64-bit variable to hold the start address
[out]*SizePointer to 64-bit variable to hold size of reservation
Returns
0 on success, or negative error code.

Definition at line 297 of file FdtLib.c.

◆ FdtGetString()

CONST CHAR8 *EFIAPI FdtGetString ( IN CONST VOID *  Fdt,
IN INT32  StrOffset,
IN INT32 *Length  OPTIONAL 
)

Returns a string by the given string offset.

Parameters
[in]FdtThe pointer to FDT blob.
[in]StrOffsetThe offset to the location in the strings block of FDT.
[in]LengthThe length to the size of string which need be retrieved.
Returns
The string to the given string offset.

Definition at line 549 of file FdtLib.c.

◆ FdtNextNode()

INT32 EFIAPI FdtNextNode ( IN CONST VOID *  Fdt,
IN INT32  Offset,
IN INT32 *  Depth 
)

Returns a offset of next node from the given node.

Parameters
[in]FdtThe pointer to FDT blob.
[in]OffsetThe offset to previous node.
[in]DepthThe depth to the level of tree hierarchy.
Returns
The offset to next node offset.

Definition at line 220 of file FdtLib.c.

◆ FdtNextPropertyOffset()

INT32 EFIAPI FdtNextPropertyOffset ( IN CONST VOID *  Fdt,
IN INT32  Offset 
)

Returns a offset of next property from the given property.

Parameters
[in]FdtThe pointer to FDT blob.
[in]OffsetThe offset to previous property.
Returns
The offset to next property offset.

Definition at line 508 of file FdtLib.c.

◆ FdtNextSubnode()

INT32 EFIAPI FdtNextSubnode ( IN CONST VOID *  Fdt,
IN INT32  Offset 
)

Returns a offset of next node from the given node.

Parameters
[in]FdtThe pointer to FDT blob.
[in]OffsetThe offset to previous node.
Returns
The offset to next node offset.

Definition at line 259 of file FdtLib.c.

◆ FdtNodeDepth()

INT32 EFIAPI FdtNodeDepth ( IN CONST VOID *  Fdt,
IN INT32  NodeOffset 
)

FdtNodeDepth() finds the depth of a given node. The root node has depth 0, its immediate subnodes depth 1 and so forth.

Parameters
[in]FdtThe pointer to FDT blob.
[in]NodeOffsetOffset of node to check.
Returns
Depth of the node at NodeOffset.

FdtNodeDepth() finds the depth of a given node. The root node has depth 0, its immediate subnodes depth 1 and so forth.

Parameters
[in]FdtThe pointer to FDT blob.
[in]NodeOffsetOffset of node to check.
Returns
Depth of the node at NodeOffset.

Definition at line 749 of file FdtLib.c.

◆ FdtNodeOffsetByCompatible()

INT32 EFIAPI FdtNodeOffsetByCompatible ( IN CONST VOID *  Fdt,
IN INT32  StartOffset,
IN CONST CHAR8 *  Compatible 
)

Find nodes with a given 'compatible' value.

Parameters
[in]FdtThe pointer to FDT blob.
[in]StartOffsetOnly find nodes after this offset.
[in]CompatibleThe string to match against.
Return values
Theoffset of the first node after StartOffset.

Definition at line 768 of file FdtLib.c.

◆ FdtNodeOffsetByPhandle()

INT32 EFIAPI FdtNodeOffsetByPhandle ( IN CONST VOID *  Fdt,
IN UINT32  Phandle 
)

Returns a offset of first node which includes the given property name and value.

Parameters
[in]FdtThe pointer to FDT blob.
[in]PhandlePhandle value to search for.
Returns
The offset to node with matching Phandle value.

Definition at line 404 of file FdtLib.c.

◆ FdtNodeOffsetByPropertyValue()

INT32 EFIAPI FdtNodeOffsetByPropertyValue ( IN CONST VOID *  Fdt,
IN INT32  StartOffset,
IN CONST CHAR8 *  PropertyName,
IN CONST VOID *  PropertyValue,
IN INT32  PropertyLength 
)

Returns a offset of first node which includes the given property name and value.

Parameters
[in]FdtThe pointer to FDT blob.
[in]StartOffsetThe offset to the starting node to find.
[in]PropertyNameThe property name to search the node including the named property.
[in]PropertyValueThe property value (big-endian) to check the same property value.
[in]PropertyLengthThe length of the value in PropertValue.
Returns
The offset to node offset with given property.

Definition at line 383 of file FdtLib.c.

◆ FdtOffsetPointer()

CONST VOID *EFIAPI FdtOffsetPointer ( IN CONST VOID *  Fdt,
IN INT32  Offset,
IN UINT32  Length 
)

Returns a pointer to the node at a given offset.

Parameters
[in]FdtThe pointer to FDT blob.
[in]OffsetThe offset to node.
[in]LengthMaximum length of node.
Returns
pointer to node.

Definition at line 199 of file FdtLib.c.

◆ FdtOpenInto()

INT32 EFIAPI FdtOpenInto ( IN CONST VOID *  Fdt,
OUT VOID *  Buffer,
IN INT32  BufferSize 
)

Unpack FDT blob into new buffer

Parameters
[in]FdtThe pointer to FDT blob.
[out]BufferPointer to destination buffer.
[in]BufferSizeThe size of destination buffer.
Returns
Zero for successfully, otherwise failed.

Definition at line 163 of file FdtLib.c.

◆ FdtPack()

INT32 EFIAPI FdtPack ( IN OUT VOID *  Fdt)

Pack FDT blob in place.

Parameters
[in]

out] Fdt The pointer to FDT blob.

Returns
Zero.

Definition at line 181 of file FdtLib.c.

◆ FdtParentOffset()

INT32 EFIAPI FdtParentOffset ( IN CONST VOID *  Fdt,
IN INT32  NodeOffset 
)

Find the parent of a given node.

Parameters
[in]FdtThe pointer to FDT blob.
[in]NodeOffsetThe offset to the node to find the parent for.
Returns
Structure block offset, or negative return value.

Definition at line 361 of file FdtLib.c.

◆ FdtPathOffset()

INT32 EFIAPI FdtPathOffset ( IN CONST VOID *  Fdt,
IN CONST CHAR8 *  Path 
)

Finds a tree node by its full path.

Parameters
[in]FdtThe pointer to FDT blob.
[in]PathFull path of the node to locate.
Returns
structure block offset of the node with the requested path (>=0), on success

Definition at line 709 of file FdtLib.c.

◆ FdtPathOffsetNameLen()

INT32 EFIAPI FdtPathOffsetNameLen ( IN CONST VOID *  Fdt,
IN CONST CHAR8 *  Path,
IN INT32  NameLength 
)

Finds a tree node by substring

Parameters
[in]FdtThe pointer to FDT blob.
[in]PathFull path of the node to locate.
[in]NameLengthThe length of the name to check only.
Returns
structure block offset of the node with the requested path (>=0), on success

Definition at line 690 of file FdtLib.c.

◆ FdtSetProperty()

INT32 EFIAPI FdtSetProperty ( IN VOID *  Fdt,
IN INT32  NodeOffset,
IN CONST CHAR8 *  Name,
IN CONST VOID *  Value,
IN UINT32  Length 
)

Add or modify a property in the given node.

Parameters
[in]FdtThe pointer to FDT blob.
[in]NodeOffsetThe offset to the node offset which want to add in.
[in]NameThe name to name the property.
[in]ValueThe value (big-endian) to the property value.
[in]LengthThe length to the size of the property.
Returns
Zero for successfully, otherwise failed.

Definition at line 593 of file FdtLib.c.

◆ FdtSetPropU64()

INT32 EFIAPI FdtSetPropU64 ( IN VOID *  Fdt,
IN INT32  NodeOffset,
IN CONST CHAR8 *  Name,
IN UINT64  Value 
)

Set a property to a 64-bit integer.

Parameters
[in]FdtThe pointer to FDT blob.
[in]NodeOffsetThe offset to the node offset which want to add in.
[in]NameThe name to name the property.
[in]ValueThe value (big-endian) to the property value.
Returns
Zero for successfully, otherwise failed.

Definition at line 617 of file FdtLib.c.

◆ FdtSizeCells()

INT32 EFIAPI FdtSizeCells ( IN CONST VOID *  Fdt,
IN INT32  NodeOffset 
)

Retrieve address range size for a bus represented in the tree

Parameters
[in]FdtThe pointer to FDT blob.
[in]NodeOffsetOffset of node to check.
Returns
Number of cells in the bus size, or negative error.

Definition at line 805 of file FdtLib.c.

◆ FdtStrerror()

CONST CHAR8 * FdtStrerror ( IN INT32  ErrVal)

Definition at line 817 of file FdtLib.c.

◆ FdtStringListContains()

INT32 EFIAPI FdtStringListContains ( IN CONST CHAR8 *  StringList,
IN INT32  ListLength,
IN CONST CHAR8 *  String 
)

Look for a string in a stringlist

Parameters
[in]StringListPointer to stringlist to search.
[in]ListLengthLength of StringList.
[in]StringPointer to string to search for.
Returns
1 if found.

Definition at line 423 of file FdtLib.c.

◆ FdtSubnodeOffsetNameLen()

INT32 EFIAPI FdtSubnodeOffsetNameLen ( IN CONST VOID *  Fdt,
IN INT32  ParentOffset,
IN CONST CHAR8 *  Name,
IN INT32  NameLength 
)

Returns a offset of first node which includes the given name.

Parameters
[in]FdtThe pointer to FDT blob.
[in]ParentOffsetThe offset to the node which start find under.
[in]NameThe name to search the node with the name.
[in]NameLengthThe length of the name to check only.
Returns
The offset to node offset with given node name.

Definition at line 320 of file FdtLib.c.