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 828F07803CF for ; Mon, 18 Sep 2023 15:17:46 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=5k977cDNV1j43ur34rDX/VeNajtpQt/r1H502kBBYGA=; 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=1695050265; v=1; b=n9ZgCpYcD6EO65W0UwsiyY/6nLB8TSr0M3jw2uNV67TanKsLswiPGp4yW1n95myfSzTh1gmf G0S43zHzqqnrACSz5ZxhXVayo5pGkzq4fBFjZjwJf/gtxcagiaYDgRZ05B7oJX6BxqyVvUWTyyF OiMKE1n3SUZlwC2ggWOgnU1o= X-Received: by 127.0.0.2 with SMTP id IsRwYY7687511xJrjqLi64Yr; Mon, 18 Sep 2023 08:17:45 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.24]) by mx.groups.io with SMTP id smtpd.web10.45821.1695019066711439455 for ; Sun, 17 Sep 2023 23:37:53 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10836"; a="382319921" X-IronPort-AV: E=Sophos;i="6.02,155,1688454000"; d="scan'208";a="382319921" X-Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Sep 2023 23:37:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10836"; a="860930887" X-IronPort-AV: E=Sophos;i="6.02,155,1688454000"; d="scan'208";a="860930887" X-Received: from juichenx-mobl3.gar.corp.intel.com ([10.227.107.41]) by fmsmga002.fm.intel.com with ESMTP; 17 Sep 2023 23:37:51 -0700 From: brucex.wang@intel.com To: devel@edk2.groups.io Cc: brucex.wang@intel.com, Benny Lin , Gua Guo , Chasel Chiu , James Lu Subject: [edk2-devel] [PATCH v4 3/4] MdePkg/BaseFdtLib: Add Fdt function. Date: Mon, 18 Sep 2023 14:37:18 +0800 Message-Id: <20230918063719.1395-4-brucex.wang@intel.com> In-Reply-To: <20230918063719.1395-1-brucex.wang@intel.com> References: <20230918063719.1395-1-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: mHfxwewMjaYjJNBv52ZkG383x7686176AA= 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=n9ZgCpYc; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io 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..d9300a18e3 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 (#108786): https://edk2.groups.io/g/devel/message/108786 Mute This Topic: https://groups.io/mt/101435615/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-