From: "Brucex.Wang" <brucex.wang@intel.com>
Add FdtGetName() and FdtNodeDepth() function.
Cc: Benny Lin <benny.lin@intel.com>
Cc: Gua Guo <gua.guo@intel.com>
Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: James Lu <james.lu@intel.com>
Signed-off-by: BruceX Wang <brucex.wang@intel.com>
---
MdePkg/Include/Library/FdtLib.h | 34 +++++++++++++++++++++++++
MdePkg/Library/BaseFdtLib/FdtLib.c | 40 ++++++++++++++++++++++++++++++
2 files changed, 74 insertions(+)
diff --git a/MdePkg/Include/Library/FdtLib.h b/MdePkg/Include/Library/FdtLib.h
index cf5ceba9e9..2bd926b5b4 100644
--- a/MdePkg/Include/Library/FdtLib.h
+++ b/MdePkg/Include/Library/FdtLib.h
@@ -398,4 +398,38 @@ FdtSetProp (
IN UINT32 Length
);
+/**
+ Returns the name of a given node.
+
+ @param[in] Fdt The pointer to FDT blob.
+ @param[in] NodeOffse Offset of node to check.
+ @param[in] Length The pointer to an integer variable (will be overwritten) or NULL.
+
+ @return The pointer to the node's name.
+
+**/
+CONST CHAR8 *
+EFIAPI
+FdtGetName (
+ IN VOID *Fdt,
+ IN INT32 NodeOffset,
+ IN UINT32 *Length
+ );
+
+/**
+ FdtNodeDepth() finds the depth of a given node. The root node
+ has depth 0, its immediate subnodes depth 1 and so forth.
+
+ @param[in] Fdt The pointer to FDT blob.
+ @param[in] NodeOffset Offset of node to check.
+
+ @return Depth of the node at NodeOffset.
+ **/
+INT32
+EFIAPI
+FdtNodeDepth (
+ IN CONST VOID *Fdt,
+ IN INT32 NodeOffset
+ );
+
#endif /* FDT_LIB_H_ */
diff --git a/MdePkg/Library/BaseFdtLib/FdtLib.c b/MdePkg/Library/BaseFdtLib/FdtLib.c
index 090b0b3fd4..1ef99ea882 100644
--- a/MdePkg/Library/BaseFdtLib/FdtLib.c
+++ b/MdePkg/Library/BaseFdtLib/FdtLib.c
@@ -402,3 +402,43 @@ FdtSetProp (
{
return fdt_setprop (Fdt, NodeOffset, Name, Value, (int)Length);
}
+
+/**
+ Returns the name of a given node.
+
+ @param[in] Fdt The pointer to FDT blob.
+ @param[in] NodeOffset Offset of node to check.
+ @param[in] Length The pointer to an integer variable (will be overwritten) or NULL.
+
+ @return The pointer to the node's name.
+
+**/
+CONST CHAR8 *
+EFIAPI
+FdtGetName (
+ IN VOID *Fdt,
+ IN INT32 NodeOffset,
+ IN UINT32 *Length
+ )
+{
+ return fdt_get_name (Fdt, NodeOffset, (int *)Length);
+}
+
+/**
+ FdtNodeDepth() finds the depth of a given node. The root node
+ has depth 0, its immediate subnodes depth 1 and so forth.
+
+ @param[in] Fdt The pointer to FDT blob.
+ @param[in] NodeOffset Offset of node to check.
+
+ @returns Depth of the node at NodeOffset.
+**/
+INT32
+EFIAPI
+FdtNodeDepth (
+ IN CONST VOID *Fdt,
+ IN INT32 NodeOffset
+ )
+{
+ return fdt_node_depth (Fdt, NodeOffset);
+}
--
2.39.1.windows.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#108717): https://edk2.groups.io/g/devel/message/108717
Mute This Topic: https://groups.io/mt/101378804/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Reviewed-by: Benny Lin <benny.lin@intel.com> -----Original Message----- From: Wang, BruceX <brucex.wang@intel.com> Sent: Friday, September 15, 2023 4:58 PM To: devel@edk2.groups.io Cc: Wang, BruceX <brucex.wang@intel.com>; Lin, Benny <benny.lin@intel.com>; Guo, Gua <gua.guo@intel.com>; Chiu, Chasel <chasel.chiu@intel.com>; Lu, James <james.lu@intel.com> Subject: [PATCH v2 1/2] MdePkg/BaseFdtLib: Add Fdt function. From: "Brucex.Wang" <brucex.wang@intel.com> Add FdtGetName() and FdtNodeDepth() function. Cc: Benny Lin <benny.lin@intel.com> Cc: Gua Guo <gua.guo@intel.com> Cc: Chasel Chiu <chasel.chiu@intel.com> Cc: James Lu <james.lu@intel.com> Signed-off-by: BruceX Wang <brucex.wang@intel.com> --- MdePkg/Include/Library/FdtLib.h | 34 +++++++++++++++++++++++++ MdePkg/Library/BaseFdtLib/FdtLib.c | 40 ++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) diff --git a/MdePkg/Include/Library/FdtLib.h b/MdePkg/Include/Library/FdtLib.h index cf5ceba9e9..2bd926b5b4 100644 --- a/MdePkg/Include/Library/FdtLib.h +++ b/MdePkg/Include/Library/FdtLib.h @@ -398,4 +398,38 @@ FdtSetProp ( IN UINT32 Length ); +/**+ Returns the name of a given node.++ @param[in] Fdt The pointer to FDT blob.+ @param[in] NodeOffse Offset of node to check.+ @param[in] Length The pointer to an integer variable (will be overwritten) or NULL.++ @return The pointer to the node's name.++**/+CONST CHAR8 *+EFIAPI+FdtGetName (+ IN VOID *Fdt,+ IN INT32 NodeOffset,+ IN UINT32 *Length+ );++/**+ FdtNodeDepth() finds the depth of a given node. The root node+ has depth 0, its immediate subnodes depth 1 and so forth.++ @param[in] Fdt The pointer to FDT blob.+ @param[in] NodeOffset Offset of node to check.++ @return Depth of the node at NodeOffset.+ **/+INT32+EFIAPI+FdtNodeDepth (+ IN CONST VOID *Fdt,+ IN INT32 NodeOffset+ );+ #endif /* FDT_LIB_H_ */diff --git a/MdePkg/Library/BaseFdtLib/FdtLib.c b/MdePkg/Library/BaseFdtLib/FdtLib.c index 090b0b3fd4..1ef99ea882 100644 --- a/MdePkg/Library/BaseFdtLib/FdtLib.c +++ b/MdePkg/Library/BaseFdtLib/FdtLib.c @@ -402,3 +402,43 @@ FdtSetProp ( { return fdt_setprop (Fdt, NodeOffset, Name, Value, (int)Length); }++/**+ Returns the name of a given node.++ @param[in] Fdt The pointer to FDT blob.+ @param[in] NodeOffset Offset of node to check.+ @param[in] Length The pointer to an integer variable (will be overwritten) or NULL.++ @return The pointer to the node's name.++**/+CONST CHAR8 *+EFIAPI+FdtGetName (+ IN VOID *Fdt,+ IN INT32 NodeOffset,+ IN UINT32 *Length+ )+{+ return fdt_get_name (Fdt, NodeOffset, (int *)Length);+}++/**+ FdtNodeDepth() finds the depth of a given node. The root node+ has depth 0, its immediate subnodes depth 1 and so forth.++ @param[in] Fdt The pointer to FDT blob.+ @param[in] NodeOffset Offset of node to check.++ @returns Depth of the node at NodeOffset.+**/+INT32+EFIAPI+FdtNodeDepth (+ IN CONST VOID *Fdt,+ IN INT32 NodeOffset+ )+{+ return fdt_node_depth (Fdt, NodeOffset);+}-- 2.39.1.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#108703): https://edk2.groups.io/g/devel/message/108703 Mute This Topic: https://groups.io/mt/101375949/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=-=-=-=-=-=-=-=-=-=-=-
Reviewed-by: James Lu <james.lu@intel.com> Thanks, James -----Original Message----- From: Wang, BruceX <brucex.wang@intel.com> Sent: Friday, September 15, 2023 4:58 PM To: devel@edk2.groups.io Cc: Wang, BruceX <brucex.wang@intel.com>; Lin, Benny <benny.lin@intel.com>; Guo, Gua <gua.guo@intel.com>; Chiu, Chasel <chasel.chiu@intel.com>; Lu, James <james.lu@intel.com> Subject: [PATCH v2 1/2] MdePkg/BaseFdtLib: Add Fdt function. From: "Brucex.Wang" <brucex.wang@intel.com> Add FdtGetName() and FdtNodeDepth() function. Cc: Benny Lin <benny.lin@intel.com> Cc: Gua Guo <gua.guo@intel.com> Cc: Chasel Chiu <chasel.chiu@intel.com> Cc: James Lu <james.lu@intel.com> Signed-off-by: BruceX Wang <brucex.wang@intel.com> --- MdePkg/Include/Library/FdtLib.h | 34 +++++++++++++++++++++++++ MdePkg/Library/BaseFdtLib/FdtLib.c | 40 ++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) diff --git a/MdePkg/Include/Library/FdtLib.h b/MdePkg/Include/Library/FdtLib.h index cf5ceba9e9..2bd926b5b4 100644 --- a/MdePkg/Include/Library/FdtLib.h +++ b/MdePkg/Include/Library/FdtLib.h @@ -398,4 +398,38 @@ FdtSetProp ( IN UINT32 Length ); +/**+ Returns the name of a given node.++ @param[in] Fdt The pointer to FDT blob.+ @param[in] NodeOffse Offset of node to check.+ @param[in] Length The pointer to an integer variable (will be overwritten) or NULL.++ @return The pointer to the node's name.++**/+CONST CHAR8 *+EFIAPI+FdtGetName (+ IN VOID *Fdt,+ IN INT32 NodeOffset,+ IN UINT32 *Length+ );++/**+ FdtNodeDepth() finds the depth of a given node. The root node+ has depth 0, its immediate subnodes depth 1 and so forth.++ @param[in] Fdt The pointer to FDT blob.+ @param[in] NodeOffset Offset of node to check.++ @return Depth of the node at NodeOffset.+ **/+INT32+EFIAPI+FdtNodeDepth (+ IN CONST VOID *Fdt,+ IN INT32 NodeOffset+ );+ #endif /* FDT_LIB_H_ */diff --git a/MdePkg/Library/BaseFdtLib/FdtLib.c b/MdePkg/Library/BaseFdtLib/FdtLib.c index 090b0b3fd4..1ef99ea882 100644 --- a/MdePkg/Library/BaseFdtLib/FdtLib.c +++ b/MdePkg/Library/BaseFdtLib/FdtLib.c @@ -402,3 +402,43 @@ FdtSetProp ( { return fdt_setprop (Fdt, NodeOffset, Name, Value, (int)Length); }++/**+ Returns the name of a given node.++ @param[in] Fdt The pointer to FDT blob.+ @param[in] NodeOffset Offset of node to check.+ @param[in] Length The pointer to an integer variable (will be overwritten) or NULL.++ @return The pointer to the node's name.++**/+CONST CHAR8 *+EFIAPI+FdtGetName (+ IN VOID *Fdt,+ IN INT32 NodeOffset,+ IN UINT32 *Length+ )+{+ return fdt_get_name (Fdt, NodeOffset, (int *)Length);+}++/**+ FdtNodeDepth() finds the depth of a given node. The root node+ has depth 0, its immediate subnodes depth 1 and so forth.++ @param[in] Fdt The pointer to FDT blob.+ @param[in] NodeOffset Offset of node to check.++ @returns Depth of the node at NodeOffset.+**/+INT32+EFIAPI+FdtNodeDepth (+ IN CONST VOID *Fdt,+ IN INT32 NodeOffset+ )+{+ return fdt_node_depth (Fdt, NodeOffset);+}-- 2.39.1.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#108702): https://edk2.groups.io/g/devel/message/108702 Mute This Topic: https://groups.io/mt/101375949/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=-=-=-=-=-=-=-=-=-=-=-
Reviewed-by: Gua Guo <gua.guo@intel.com> -----Original Message----- From: Wang, BruceX <brucex.wang@intel.com> Sent: Friday, September 15, 2023 4:58 PM To: devel@edk2.groups.io Cc: Wang, BruceX <brucex.wang@intel.com>; Lin, Benny <benny.lin@intel.com>; Guo, Gua <gua.guo@intel.com>; Chiu, Chasel <chasel.chiu@intel.com>; Lu, James <james.lu@intel.com> Subject: [PATCH v2 1/2] MdePkg/BaseFdtLib: Add Fdt function. From: "Brucex.Wang" <brucex.wang@intel.com> Add FdtGetName() and FdtNodeDepth() function. Cc: Benny Lin <benny.lin@intel.com> Cc: Gua Guo <gua.guo@intel.com> Cc: Chasel Chiu <chasel.chiu@intel.com> Cc: James Lu <james.lu@intel.com> Signed-off-by: BruceX Wang <brucex.wang@intel.com> --- MdePkg/Include/Library/FdtLib.h | 34 +++++++++++++++++++++++++ MdePkg/Library/BaseFdtLib/FdtLib.c | 40 ++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) diff --git a/MdePkg/Include/Library/FdtLib.h b/MdePkg/Include/Library/FdtLib.h index cf5ceba9e9..2bd926b5b4 100644 --- a/MdePkg/Include/Library/FdtLib.h +++ b/MdePkg/Include/Library/FdtLib.h @@ -398,4 +398,38 @@ FdtSetProp ( IN UINT32 Length ); +/**+ Returns the name of a given node.++ @param[in] Fdt The pointer to FDT blob.+ @param[in] NodeOffse Offset of node to check.+ @param[in] Length The pointer to an integer variable (will be overwritten) or NULL.++ @return The pointer to the node's name.++**/+CONST CHAR8 *+EFIAPI+FdtGetName (+ IN VOID *Fdt,+ IN INT32 NodeOffset,+ IN UINT32 *Length+ );++/**+ FdtNodeDepth() finds the depth of a given node. The root node+ has depth 0, its immediate subnodes depth 1 and so forth.++ @param[in] Fdt The pointer to FDT blob.+ @param[in] NodeOffset Offset of node to check.++ @return Depth of the node at NodeOffset.+ **/+INT32+EFIAPI+FdtNodeDepth (+ IN CONST VOID *Fdt,+ IN INT32 NodeOffset+ );+ #endif /* FDT_LIB_H_ */diff --git a/MdePkg/Library/BaseFdtLib/FdtLib.c b/MdePkg/Library/BaseFdtLib/FdtLib.c index 090b0b3fd4..1ef99ea882 100644 --- a/MdePkg/Library/BaseFdtLib/FdtLib.c +++ b/MdePkg/Library/BaseFdtLib/FdtLib.c @@ -402,3 +402,43 @@ FdtSetProp ( { return fdt_setprop (Fdt, NodeOffset, Name, Value, (int)Length); }++/**+ Returns the name of a given node.++ @param[in] Fdt The pointer to FDT blob.+ @param[in] NodeOffset Offset of node to check.+ @param[in] Length The pointer to an integer variable (will be overwritten) or NULL.++ @return The pointer to the node's name.++**/+CONST CHAR8 *+EFIAPI+FdtGetName (+ IN VOID *Fdt,+ IN INT32 NodeOffset,+ IN UINT32 *Length+ )+{+ return fdt_get_name (Fdt, NodeOffset, (int *)Length);+}++/**+ FdtNodeDepth() finds the depth of a given node. The root node+ has depth 0, its immediate subnodes depth 1 and so forth.++ @param[in] Fdt The pointer to FDT blob.+ @param[in] NodeOffset Offset of node to check.++ @returns Depth of the node at NodeOffset.+**/+INT32+EFIAPI+FdtNodeDepth (+ IN CONST VOID *Fdt,+ IN INT32 NodeOffset+ )+{+ return fdt_node_depth (Fdt, NodeOffset);+}-- 2.39.1.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#108700): https://edk2.groups.io/g/devel/message/108700 Mute This Topic: https://groups.io/mt/101375949/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=-=-=-=-=-=-=-=-=-=-=-
© 2016 - 2024 Red Hat, Inc.