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 34F6C740045 for ; Mon, 18 Sep 2023 15:17:55 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=oIEKK5L9q+1LYBEflYUNrR7FAGh+NPUdxIO+lAaSWpM=; 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=1695050273; v=1; b=xNWUNmZOqXUt+ObXL3iq/53HK9vZ1NnjGSkcpTuFVYdItBXoI5oSEWBOj2vblqDm06CR9BuX kneVZSfLSf9h5tTGZWr/uIsPrAa2FqH1pdLr4NinymIF5GylZ8FYLkxaKUsdkjwdQ9WnSfnXfM3 Gj3DTum/NcbpjzeTm39g4dSA= X-Received: by 127.0.0.2 with SMTP id yEXzYY7687511xTFCaEDlMIc; Mon, 18 Sep 2023 08:17:53 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.151]) by mx.groups.io with SMTP id smtpd.web10.46041.1695020573414675715 for ; Mon, 18 Sep 2023 00:02:55 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10836"; a="359836098" X-IronPort-AV: E=Sophos;i="6.02,156,1688454000"; d="scan'208";a="359836098" X-Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Sep 2023 00:02:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10836"; a="739017909" X-IronPort-AV: E=Sophos;i="6.02,156,1688454000"; d="scan'208";a="739017909" X-Received: from juichenx-mobl3.gar.corp.intel.com ([10.227.107.41]) by orsmga007.jf.intel.com with ESMTP; 18 Sep 2023 00:02:12 -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 1/2] MdePkg/BaseFdtLib: Add Fdt function. Date: Mon, 18 Sep 2023 15:01:56 +0800 Message-Id: <20230918070157.1507-2-brucex.wang@intel.com> In-Reply-To: <20230918070157.1507-1-brucex.wang@intel.com> References: <20230918070157.1507-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: qzvbQU2A7nEOmgv4VWHKkhQKx7686176AA= 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=xNWUNmZO; 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 (#108795): https://edk2.groups.io/g/devel/message/108795 Mute This Topic: https://groups.io/mt/101435623/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-