TianoCore EDK2 master
|
Go to the source code of this file.
Functions | |
STATIC BOOLEAN EFIAPI | FdtNodeHasName (IN CONST VOID *Fdt, IN INT32 Node, IN CONST VOID *SearchName) |
BOOLEAN EFIAPI | FdtNodeIsCompatible (IN CONST VOID *Fdt, IN INT32 Node, IN CONST VOID *CompatInfo) |
BOOLEAN EFIAPI | FdtNodeHasProperty (IN CONST VOID *Fdt, IN INT32 Node, IN CONST VOID *PropertyName) |
STATIC EFI_STATUS EFIAPI | FdtGetNextCondNode (IN CONST VOID *Fdt, IN OUT INT32 *Node, IN OUT INT32 *Depth, IN NODE_CHECKER_FUNC NodeChecker, IN CONST VOID *Context) |
STATIC EFI_STATUS EFIAPI | FdtGetNextCondNodeInBranch (IN CONST VOID *Fdt, IN INT32 FdtBranch, IN NODE_CHECKER_FUNC NodeChecker, IN CONST VOID *Context, IN OUT INT32 *Node) |
EFI_STATUS EFIAPI | FdtGetNextNamedNodeInBranch (IN CONST VOID *Fdt, IN INT32 FdtBranch, IN CONST CHAR8 *NodeName, IN OUT INT32 *Node) |
EFI_STATUS EFIAPI | FdtGetNextCompatNodeInBranch (IN CONST VOID *Fdt, IN INT32 FdtBranch, IN CONST COMPATIBILITY_INFO *CompatNamesInfo, IN OUT INT32 *Node) |
EFI_STATUS EFIAPI | FdtGetNextPropNodeInBranch (IN CONST VOID *Fdt, IN INT32 FdtBranch, IN CONST CHAR8 *PropName, IN OUT INT32 *Node) |
STATIC EFI_STATUS EFIAPI | FdtCountCondNodeInBranch (IN CONST VOID *Fdt, IN INT32 FdtBranch, IN NODE_CHECKER_FUNC NodeChecker, IN CONST VOID *Context, OUT UINT32 *NodeCount) |
EFI_STATUS EFIAPI | FdtCountNamedNodeInBranch (IN CONST VOID *Fdt, IN INT32 FdtBranch, IN CONST CHAR8 *NodeName, OUT UINT32 *NodeCount) |
EFI_STATUS EFIAPI | FdtCountCompatNodeInBranch (IN CONST VOID *Fdt, IN INT32 FdtBranch, IN CONST COMPATIBILITY_INFO *CompatNamesInfo, OUT UINT32 *NodeCount) |
EFI_STATUS EFIAPI | FdtCountPropNodeInBranch (IN CONST VOID *Fdt, IN INT32 FdtBranch, IN CONST CHAR8 *PropName, OUT UINT32 *NodeCount) |
EFI_STATUS EFIAPI | FdtGetIntcParentNode (IN CONST VOID *Fdt, IN INT32 Node, OUT INT32 *IntcNode) |
EFI_STATUS EFIAPI | FdtGetInterruptCellsInfo (IN CONST VOID *Fdt, IN INT32 IntcNode, OUT INT32 *IntCells) |
EFI_STATUS EFIAPI | FdtGetAddressInfo (IN CONST VOID *Fdt, IN INT32 Node, OUT INT32 *AddressCells, OPTIONAL OUT INT32 *SizeCells OPTIONAL) |
EFI_STATUS EFIAPI | FdtGetParentAddressInfo (IN CONST VOID *Fdt, IN INT32 Node, OUT INT32 *AddressCells, OPTIONAL OUT INT32 *SizeCells OPTIONAL) |
Flattened device tree utility.
Copyright (c) 2021, ARM Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file FdtUtility.c.
EFI_STATUS EFIAPI FdtCountCompatNodeInBranch | ( | IN CONST VOID * | Fdt, |
IN INT32 | FdtBranch, | ||
IN CONST COMPATIBILITY_INFO * | CompatNamesInfo, | ||
OUT UINT32 * | NodeCount | ||
) |
Count the number of nodes in a branch with at least one compatible property.
[in] | Fdt | Pointer to a Flattened Device Tree. |
[in] | FdtBranch | Only search in the sub-nodes of this branch. Write (-1) to search the whole tree. |
[in] | CompatNamesInfo | Table of compatible strings to compare with the compatible property of the node. |
[out] | NodeCount | If success, contains the count of nodes fulfilling the condition. Can be 0. |
EFI_SUCCESS | The function completed successfully. |
EFI_ABORTED | An error occurred. |
EFI_INVALID_PARAMETER | Invalid parameter. |
Definition at line 573 of file FdtUtility.c.
STATIC EFI_STATUS EFIAPI FdtCountCondNodeInBranch | ( | IN CONST VOID * | Fdt, |
IN INT32 | FdtBranch, | ||
IN NODE_CHECKER_FUNC | NodeChecker, | ||
IN CONST VOID * | Context, | ||
OUT UINT32 * | NodeCount | ||
) |
Count the number of Device Tree nodes fulfilling a condition in a Device Tree branch.
The condition to fulfill is checked by the NodeChecker function. Context is passed to NodeChecker.
[in] | Fdt | Pointer to a Flattened Device Tree. |
[in] | FdtBranch | Only search in the sub-nodes of this branch. Write (-1) to search the whole tree. |
[in] | NodeChecker | Function called to check the condition is fulfilled. |
[in] | Context | Context for the NodeChecker. |
[out] | NodeCount | If success, contains the count of nodes fulfilling the condition. Can be 0. |
EFI_SUCCESS | The function completed successfully. |
EFI_ABORTED | An error occurred. |
EFI_INVALID_PARAMETER | Invalid parameter. |
Definition at line 477 of file FdtUtility.c.
EFI_STATUS EFIAPI FdtCountNamedNodeInBranch | ( | IN CONST VOID * | Fdt, |
IN INT32 | FdtBranch, | ||
IN CONST CHAR8 * | NodeName, | ||
OUT UINT32 * | NodeCount | ||
) |
Count the number of nodes in a branch with the input name.
[in] | Fdt | Pointer to a Flattened Device Tree. |
[in] | FdtBranch | Only search in the sub-nodes of this branch. Write (-1) to search the whole tree. |
[in] | NodeName | Node name to search. This is a NULL terminated string. |
[out] | NodeCount | If success, contains the count of nodes fulfilling the condition. Can be 0. |
EFI_SUCCESS | The function completed successfully. |
EFI_ABORTED | An error occurred. |
EFI_INVALID_PARAMETER | Invalid parameter. |
Definition at line 538 of file FdtUtility.c.
EFI_STATUS EFIAPI FdtCountPropNodeInBranch | ( | IN CONST VOID * | Fdt, |
IN INT32 | FdtBranch, | ||
IN CONST CHAR8 * | PropName, | ||
OUT UINT32 * | NodeCount | ||
) |
Count the number of nodes in a branch having the PropName property.
[in] | Fdt | Pointer to a Flattened Device Tree. |
[in] | FdtBranch | Only search in the sub-nodes of this branch. Write (-1) to search the whole tree. |
[in] | PropName | Name of the property to search. This is a NULL terminated string. |
[out] | NodeCount | If success, contains the count of nodes fulfilling the condition. Can be 0. |
EFI_SUCCESS | The function completed successfully. |
EFI_ABORTED | An error occurred. |
EFI_INVALID_PARAMETER | Invalid parameter. |
Definition at line 606 of file FdtUtility.c.
EFI_STATUS EFIAPI FdtGetAddressInfo | ( | IN CONST VOID * | Fdt, |
IN INT32 | Node, | ||
OUT INT32 * | AddressCells, | ||
OPTIONAL OUT INT32 *SizeCells | OPTIONAL | ||
) |
Get the "#address-cells" and/or "#size-cells" property of the node.
According to the Device Tree specification, s2.3.5 "#address-cells and #size-cells": "If missing, a client program should assume a default value of 2 for #address-cells, and a value of 1 for #size-cells."
[in] | Fdt | Pointer to a Flattened Device Tree. |
[in] | Node | Offset of the node having to get the "#address-cells" and "#size-cells" properties from. |
[out] | AddressCells | If success, number of address-cells. If the property is not available, default value is 2. |
[out] | SizeCells | If success, number of size-cells. If the property is not available, default value is 1. |
EFI_SUCCESS | The function completed successfully. |
EFI_ABORTED | An error occurred. |
EFI_INVALID_PARAMETER | Invalid parameter. |
Definition at line 778 of file FdtUtility.c.
EFI_STATUS EFIAPI FdtGetIntcParentNode | ( | IN CONST VOID * | Fdt, |
IN INT32 | Node, | ||
OUT INT32 * | IntcNode | ||
) |
Get the interrupt-controller node handling the interrupts of the input node.
To do this, recursively search a node with either the "interrupt-controller" or the "interrupt-parent" property in the parents of Node.
Devicetree Specification, Release v0.3, 2.4.1 "Properties for Interrupt Generating Devices": Because the hierarchy of the nodes in the interrupt tree might not match the devicetree, the interrupt-parent property is available to make the definition of an interrupt parent explicit. The value is the phandle to the interrupt parent. If this property is missing from a device, its interrupt parent is assumed to be its devicetree parent.
[in] | Fdt | Pointer to a Flattened Device Tree. |
[in] | Node | Offset of the node to start the search. |
[out] | IntcNode | If success, contains the offset of the interrupt-controller node. |
EFI_SUCCESS | The function completed successfully. |
EFI_NOT_FOUND | No interrupt-controller node found. |
EFI_ABORTED | An error occurred. |
EFI_INVALID_PARAMETER | Invalid parameter. |
Definition at line 650 of file FdtUtility.c.
EFI_STATUS EFIAPI FdtGetInterruptCellsInfo | ( | IN CONST VOID * | Fdt, |
IN INT32 | IntcNode, | ||
OUT INT32 * | IntCells | ||
) |
Get the "interrupt-cells" property value of the node.
The "interrupts" property requires to know the number of cells used to encode an interrupt. This information is stored in the interrupt-controller of the input Node.
[in] | Fdt | Pointer to a Flattened Device Tree (Fdt). |
[in] | IntcNode | Offset of an interrupt-controller node. |
[out] | IntCells | If success, contains the "interrupt-cells" property of the IntcNode. |
EFI_SUCCESS | The function completed successfully. |
EFI_INVALID_PARAMETER | Invalid parameter. |
EFI_UNSUPPORTED | Unsupported. |
Definition at line 726 of file FdtUtility.c.
EFI_STATUS EFIAPI FdtGetNextCompatNodeInBranch | ( | IN CONST VOID * | Fdt, |
IN INT32 | FdtBranch, | ||
IN CONST COMPATIBILITY_INFO * | CompatNamesInfo, | ||
IN OUT INT32 * | Node | ||
) |
Get the next node in a branch with at least one compatible property.
The Device tree is traversed in a depth-first search, starting from Node. The input Node is skipped.
[in] | Fdt | Pointer to a Flattened Device Tree. |
[in] | FdtBranch | Only search in the sub-nodes of this branch. Write (-1) to search the whole tree. |
[in] | CompatNamesInfo | Table of compatible strings to compare with the compatible property of the node. |
[in,out] | Node | At entry: Node offset to start the search. This first node is skipped. Write (-1) to search the whole tree. At exit: If success, contains the offset of the next node in the branch being compatible. |
EFI_SUCCESS | The function completed successfully. |
EFI_ABORTED | An error occurred. |
EFI_INVALID_PARAMETER | Invalid parameter. |
EFI_NOT_FOUND | No matching node found. |
Definition at line 398 of file FdtUtility.c.
STATIC EFI_STATUS EFIAPI FdtGetNextCondNode | ( | IN CONST VOID * | Fdt, |
IN OUT INT32 * | Node, | ||
IN OUT INT32 * | Depth, | ||
IN NODE_CHECKER_FUNC | NodeChecker, | ||
IN CONST VOID * | Context | ||
) |
Get the next node in the whole DT fulfilling a condition.
The condition to fulfill is checked by the NodeChecker function. Context is passed to NodeChecker.
The Device tree is traversed in a depth-first search, starting from Node. The input Node is skipped.
[in] | Fdt | Pointer to a Flattened Device Tree. |
[in,out] | Node | At entry: Node offset to start the search. This first node is skipped. Write (-1) to search the whole tree. At exit: If success, contains the offset of the next node fulfilling the condition. |
[in,out] | Depth | Depth is incremented/decremented of the depth difference between the input Node and the output Node. E.g.: If the output Node is a child node of the input Node, contains (+1). |
[in] | NodeChecker | Function called to check if the condition is fulfilled. |
[in] | Context | Context for the NodeChecker. |
EFI_SUCCESS | The function completed successfully. |
EFI_ABORTED | An error occurred. |
EFI_INVALID_PARAMETER | Invalid parameter. |
EFI_NOT_FOUND | No matching node found. |
Definition at line 200 of file FdtUtility.c.
STATIC EFI_STATUS EFIAPI FdtGetNextCondNodeInBranch | ( | IN CONST VOID * | Fdt, |
IN INT32 | FdtBranch, | ||
IN NODE_CHECKER_FUNC | NodeChecker, | ||
IN CONST VOID * | Context, | ||
IN OUT INT32 * | Node | ||
) |
Get the next node in a branch fulfilling a condition.
The condition to fulfill is checked by the NodeChecker function. Context is passed to NodeChecker.
The Device tree is traversed in a depth-first search, starting from Node. The input Node is skipped.
[in] | Fdt | Pointer to a Flattened Device Tree. |
[in] | FdtBranch | Only search in the sub-nodes of this branch. Write (-1) to search the whole tree. |
[in] | NodeChecker | Function called to check if the condition is fulfilled. |
[in] | Context | Context for the NodeChecker. |
[in,out] | Node | At entry: Node offset to start the search. This first node is skipped. Write (-1) to search the whole tree. At exit: If success, contains the offset of the next node in the branch fulfilling the condition. |
EFI_SUCCESS | The function completed successfully. |
EFI_ABORTED | An error occurred. |
EFI_INVALID_PARAMETER | Invalid parameter. |
EFI_NOT_FOUND | No matching node found. |
Definition at line 269 of file FdtUtility.c.
EFI_STATUS EFIAPI FdtGetNextNamedNodeInBranch | ( | IN CONST VOID * | Fdt, |
IN INT32 | FdtBranch, | ||
IN CONST CHAR8 * | NodeName, | ||
IN OUT INT32 * | Node | ||
) |
Get the next node in a branch having a matching name.
The Device tree is traversed in a depth-first search, starting from Node. The input Node is skipped.
[in] | Fdt | Pointer to a Flattened Device Tree. |
[in] | FdtBranch | Only search in the sub-nodes of this branch. Write (-1) to search the whole tree. |
[in] | NodeName | The node name to search. This is a NULL terminated string. |
[in,out] | Node | At entry: Node offset to start the search. This first node is skipped. Write (-1) to search the whole tree. At exit: If success, contains the offset of the next node in the branch having a matching name. |
EFI_SUCCESS | The function completed successfully. |
EFI_ABORTED | An error occurred. |
EFI_INVALID_PARAMETER | Invalid parameter. |
EFI_NOT_FOUND | No matching node found. |
Definition at line 358 of file FdtUtility.c.
EFI_STATUS EFIAPI FdtGetNextPropNodeInBranch | ( | IN CONST VOID * | Fdt, |
IN INT32 | FdtBranch, | ||
IN CONST CHAR8 * | PropName, | ||
IN OUT INT32 * | Node | ||
) |
Get the next node in a branch having the PropName property.
The Device tree is traversed in a depth-first search, starting from Node. The input Node is skipped.
[in] | Fdt | Pointer to a Flattened Device Tree. |
[in] | FdtBranch | Only search in the sub-nodes of this branch. Write (-1) to search the whole tree. |
[in] | PropName | Name of the property to search. This is a NULL terminated string. |
[in,out] | Node | At entry: Node offset to start the search. This first node is skipped. Write (-1) to search the whole tree. At exit: If success, contains the offset of the next node in the branch being compatible. |
EFI_SUCCESS | The function completed successfully. |
EFI_ABORTED | An error occurred. |
EFI_INVALID_PARAMETER | Invalid parameter. |
EFI_NOT_FOUND | No matching node found. |
Definition at line 438 of file FdtUtility.c.
EFI_STATUS EFIAPI FdtGetParentAddressInfo | ( | IN CONST VOID * | Fdt, |
IN INT32 | Node, | ||
OUT INT32 * | AddressCells, | ||
OPTIONAL OUT INT32 *SizeCells | OPTIONAL | ||
) |
Get the "#address-cells" and/or "#size-cells" property of the parent node.
According to the Device Tree specification, s2.3.5 "#address-cells and #size-cells": "If missing, a client program should assume a default value of 2 for #address-cells, and a value of 1 for #size-cells."
[in] | Fdt | Pointer to a Flattened Device Tree. |
[in] | Node | Offset of the node having to get the "#address-cells" and "#size-cells" properties from its parent. |
[out] | AddressCells | If success, number of address-cells. If the property is not available, default value is 2. |
[out] | SizeCells | If success, number of size-cells. If the property is not available, default value is 1. |
EFI_SUCCESS | The function completed successfully. |
EFI_ABORTED | An error occurred. |
EFI_INVALID_PARAMETER | Invalid parameter. |
Definition at line 833 of file FdtUtility.c.
STATIC BOOLEAN EFIAPI FdtNodeHasName | ( | IN CONST VOID * | Fdt, |
IN INT32 | Node, | ||
IN CONST VOID * | SearchName | ||
) |
Check whether a node has the input name.
[in] | Fdt | Pointer to a Flattened Device Tree. |
[in] | Node | Offset of the node to check the name. |
[in] | SearchName | Node name to search. This is a NULL terminated string. |
True | The node has the input name. |
FALSE | Otherwise, or error. |
Definition at line 30 of file FdtUtility.c.
BOOLEAN EFIAPI FdtNodeHasProperty | ( | IN CONST VOID * | Fdt, |
IN INT32 | Node, | ||
IN CONST VOID * | PropertyName | ||
) |
Check whether a node has a property.
[in] | Fdt | Pointer to a Flattened Device Tree. |
[in] | Node | Offset of the node to operate the check on. |
[in] | PropertyName | Name of the property to search. This is a NULL terminated string. |
True | The node has the property. |
FALSE | Otherwise, or error. |
Definition at line 144 of file FdtUtility.c.
BOOLEAN EFIAPI FdtNodeIsCompatible | ( | IN CONST VOID * | Fdt, |
IN INT32 | Node, | ||
IN CONST VOID * | CompatInfo | ||
) |
Iterate through the list of strings in the Context, and check whether at least one string is matching the "compatible" property of the node.
[in] | Fdt | Pointer to a Flattened Device Tree. |
[in] | Node | Offset of the node to operate the check on. |
[in] | CompatInfo | COMPATIBILITY_INFO containing the list of compatible strings to compare with the "compatible" property of the node. |
TRUE | At least one string matched, the node is compatible. |
FALSE | Otherwise, or error. |
Definition at line 90 of file FdtUtility.c.