From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 4C51CD81068 for ; Fri, 15 Sep 2023 13:03:28 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=yhHC0c5Iv4B13pG3pQlxYCJJlIbTI0f+eXO8CYQYOtY=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1694783007; v=1; b=WGKCFxv0xjhvmn/T8gcCX9uUzSN3Uv7OcVVgCdMIxJ6d/l/3O1tcrC1nd/q8RBT2zzQK3CTP IsSFE38Fb2j8KefiM9HY3TbvqfKKfQ164JVkX3vB+aYkXYXL+/XCwlBX4M2DXIR/0XTSHTd1E7E M+taNWPUae2vssNXelGHJcfQ= X-Received: by 127.0.0.2 with SMTP id CNNhYY7687511xhbLqNfyuxe; Fri, 15 Sep 2023 06:03:27 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.24]) by mx.groups.io with SMTP id smtpd.web10.16372.1694767090049693642 for ; Fri, 15 Sep 2023 01:38:10 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10833"; a="381926323" X-IronPort-AV: E=Sophos;i="6.02,148,1688454000"; d="scan'208";a="381926323" X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Sep 2023 01:38:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10833"; a="774227372" X-IronPort-AV: E=Sophos;i="6.02,148,1688454000"; d="scan'208";a="774227372" X-Received: from unknown (HELO juichenx-mobl3.gar.corp.intel.com) ([10.227.107.41]) by orsmga008.jf.intel.com with ESMTP; 15 Sep 2023 01:37:49 -0700 From: brucex.wang@intel.com To: devel@edk2.groups.io Cc: "Brucex.Wang" , Benny Lin , Gua Guo , Chasel Chiu , James Lu Subject: [edk2-devel] [PATCH 21/22] MdePkg/BaseFdtLib: Add Fdt function. Date: Fri, 15 Sep 2023 16:37:38 +0800 Message-Id: In-Reply-To: <819cfc6b42a68790a23509e4fcc58ceb70e1965e.1694766831.git.brucex.wang@intel.com> References: <819cfc6b42a68790a23509e4fcc58ceb70e1965e.1694766831.git.brucex.wang@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,brucex.wang@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: l4BdOw968bGWAsqzUqVVQ3Tzx7686176AA= Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=WGKCFxv0; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none) From: "Brucex.Wang" Add FdtGetName() and FdtNodeDepth() function. Cc: Benny Lin Cc: Gua Guo Cc: Chasel Chiu Cc: James Lu Signed-off-by: BruceX Wang --- 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/FdtLi= b.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=0D );=0D =0D +/**=0D + Returns the name of a given node.=0D +=0D + @param[in] Fdt The pointer to FDT blob.=0D + @param[in] NodeOffse Offset of node to check.=0D + @param[in] Length The pointer to an integer variable (will be ov= erwritten) or NULL.=0D +=0D + @return The pointer to the node's name.=0D +=0D +**/=0D +CONST CHAR8 *=0D +EFIAPI=0D +FdtGetName (=0D + IN VOID *Fdt,=0D + IN INT32 NodeOffset,=0D + IN UINT32 *Length=0D + );=0D +=0D +/**=0D + FdtNodeDepth() finds the depth of a given node. The root node=0D + has depth 0, its immediate subnodes depth 1 and so forth.=0D +=0D + @param[in] Fdt The pointer to FDT blob.=0D + @param[in] NodeOffset Offset of node to check.=0D +=0D + @return Depth of the node at NodeOffset.=0D + **/=0D +INT32=0D +EFIAPI=0D +FdtNodeDepth (=0D + IN CONST VOID *Fdt,=0D + IN INT32 NodeOffset=0D + );=0D +=0D #endif /* FDT_LIB_H_ */=0D 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 ( {=0D return fdt_setprop (Fdt, NodeOffset, Name, Value, (int)Length);=0D }=0D +=0D +/**=0D + Returns the name of a given node.=0D +=0D + @param[in] Fdt The pointer to FDT blob.=0D + @param[in] NodeOffset Offset of node to check.=0D + @param[in] Length The pointer to an integer variable (will be ov= erwritten) or NULL.=0D +=0D + @return The pointer to the node's name.=0D +=0D +**/=0D +CONST CHAR8 *=0D +EFIAPI=0D +FdtGetName (=0D + IN VOID *Fdt,=0D + IN INT32 NodeOffset,=0D + IN UINT32 *Length=0D + )=0D +{=0D + return fdt_get_name (Fdt, NodeOffset, (int *)Length);=0D +}=0D +=0D +/**=0D + FdtNodeDepth() finds the depth of a given node. The root node=0D + has depth 0, its immediate subnodes depth 1 and so forth.=0D +=0D + @param[in] Fdt The pointer to FDT blob.=0D + @param[in] NodeOffset Offset of node to check.=0D +=0D + @returns Depth of the node at NodeOffset.=0D +**/=0D +INT32=0D +EFIAPI=0D +FdtNodeDepth (=0D + IN CONST VOID *Fdt,=0D + IN INT32 NodeOffset=0D + )=0D +{=0D + return fdt_node_depth (Fdt, NodeOffset);=0D +}=0D --=20 2.39.1.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#108714): https://edk2.groups.io/g/devel/message/108714 Mute This Topic: https://groups.io/mt/101378800/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-