diff options
Diffstat (limited to 'MdePkg/Include/Library/FdtLib.h')
-rw-r--r-- | MdePkg/Include/Library/FdtLib.h | 102 |
1 files changed, 100 insertions, 2 deletions
diff --git a/MdePkg/Include/Library/FdtLib.h b/MdePkg/Include/Library/FdtLib.h index a7d26f7..e4cd382 100644 --- a/MdePkg/Include/Library/FdtLib.h +++ b/MdePkg/Include/Library/FdtLib.h @@ -188,6 +188,9 @@ typedef struct { Node >= 0; \
Node = FdtNextSubnode (Fdt, Node))
+#define FdtSetPropString(Fdt, NodeOffset, Name, String) \
+ FdtSetProp ((Fdt), (NodeOffset), (Name), (String), AsciiStrLen (String) + 1)
+
/**
Convert UINT16 data of the FDT blob to little-endian
@@ -421,6 +424,24 @@ FdtSubnodeOffsetNameLen ( );
/**
+ Returns a offset of first node which matches the given name.
+
+ @param[in] Fdt The pointer to FDT blob.
+ @param[in] ParentOffset The offset to the node which start find under.
+ @param[in] Name The name to search the node with the name.
+
+ @return The offset to node offset with given node name.
+
+ **/
+INT32
+EFIAPI
+FdtSubnodeOffset (
+ IN CONST VOID *Fdt,
+ IN INT32 ParentOffset,
+ IN CONST CHAR8 *Name
+ );
+
+/**
Returns the number of memory reserve map entries.
@param[in] Fdt The pointer to FDT blob.
@@ -483,7 +504,7 @@ FdtParentOffset ( **/
INT32
EFIAPI
-FdtNodeOffsetByPropertyValue (
+FdtNodeOffsetByPropValue (
IN CONST VOID *Fdt,
IN INT32 StartOffset,
IN CONST CHAR8 *PropertyName,
@@ -545,6 +566,49 @@ FdtGetProperty ( );
/**
+ Returns a property with the given name from the given node.
+
+ @param[in] Fdt The pointer to FDT blob.
+ @param[in] NodeOffset The offset to the given node.
+ @param[in] Name The name to the property which need be searched
+ @param[in] Length The length to the size of the property found.
+
+ @return The property to the structure of the found property. Since the data
+ come from FDT blob, it's encoding with big-endian.
+
+**/
+FDT_PROPERTY *
+EFIAPI
+FdtGetPropertyW (
+ IN CONST VOID *Fdt,
+ IN INT32 NodeOffset,
+ IN CONST CHAR8 *Name,
+ IN INT32 *Length
+ );
+
+/**
+ Returns the value of a given property.
+
+ @param[in] Fdt The pointer to FDT blob.
+ @param[in] NodeOffset The offset to the given node.
+ @param[in] Name The name to the property which need be searched
+ @param[in] Length The length to the size of the property found.
+
+ @return Pointer to the value of the property.
+ Since the data comes from the FDT blob, it's encoded as big-endian.
+ NULL on error, with error-code stored at Length (if non-NULL).
+
+**/
+CONST VOID *
+EFIAPI
+FdtGetProp (
+ IN CONST VOID *Fdt,
+ IN INT32 NodeOffset,
+ IN CONST CHAR8 *Name,
+ IN INT32 *Length
+ );
+
+/**
Returns a pointer to a node mapped to an alias matching a substring.
@param[in] Fdt The pointer to FDT blob.
@@ -650,6 +714,21 @@ FdtAddSubnode ( );
/**
+ Delete a node (subtree)
+
+ @param[in] Fdt The pointer to FDT blob.
+ @param[in] NodeOffset The offset to the node (subtree) to delete.
+
+ @return Zero for successfully, otherwise failed.
+
+ **/
+INT32
+FdtDelNode (
+ IN VOID *Fdt,
+ IN INT32 NodeOffset
+ );
+
+/**
Add or modify a property in the given node.
@param[in] Fdt The pointer to FDT blob.
@@ -663,7 +742,7 @@ FdtAddSubnode ( **/
INT32
EFIAPI
-FdtSetProperty (
+FdtSetProp (
IN VOID *Fdt,
IN INT32 NodeOffset,
IN CONST CHAR8 *Name,
@@ -784,6 +863,25 @@ FdtGetName ( );
/**
+ Determine the full path of a node.
+
+ @param[in] Fdt The pointer to FDT blob.
+ @param[in] NodeOffset Offset of node to check.
+ @param[in] Buffer The pointer to allocate a pool for FDT blob.
+ @param[in] BufferSize The BufferSize to the pool size.
+
+ @return 0 on success, or negative error code.
+**/
+INT32
+EFIAPI
+FdtGetPath (
+ IN VOID *Fdt,
+ IN INT32 NodeOffset,
+ IN VOID *Buffer,
+ IN UINT32 BufferSize
+ );
+
+/**
FdtNodeDepth() finds the depth of a given node. The root node
has depth 0, its immediate subnodes depth 1 and so forth.
|