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 F381C740047 for ; Mon, 18 Sep 2023 15:17:49 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=HaYxLuL+zZ0/O51CPGP+KYWThgb4aUOmeI9kiLxQSpA=; 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=1695050268; v=1; b=qCm17WBp5vhIMUICqEzXwIQAlEOwqGgCXcskG2zDEZLE+ugLLe20tONw4+GFmyLXpCUl4tuu 4Ah/pRqvnpuAGPS6viLcCxHo6lLJw61kLVBi+QSK3bLTbK3M7CEJSYy7ZK9/iivemGfZmlmmBqF o0dL/t9/wOD5nGJfpYHo5ldE= X-Received: by 127.0.0.2 with SMTP id 1GAcYY7687511xCZMCeWWlOL; Mon, 18 Sep 2023 08:17:48 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.20]) by mx.groups.io with SMTP id smtpd.web11.45986.1695019379286248808 for ; Sun, 17 Sep 2023 23:42:59 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10836"; a="369906083" X-IronPort-AV: E=Sophos;i="6.02,155,1688454000"; d="scan'208";a="369906083" X-Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Sep 2023 23:42:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10836"; a="869450537" X-IronPort-AV: E=Sophos;i="6.02,155,1688454000"; d="scan'208";a="869450537" X-Received: from juichenx-mobl3.gar.corp.intel.com ([10.227.107.41]) by orsmga004.jf.intel.com with ESMTP; 17 Sep 2023 23:42:45 -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:42:33 +0800 Message-Id: <20230918064235.1440-4-brucex.wang@intel.com> In-Reply-To: <20230918064235.1440-1-brucex.wang@intel.com> References: <20230918064235.1440-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: QSTv72PltmUOactxeB7dec83x7686176AA= 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=qCm17WBp; 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 (#108791): https://edk2.groups.io/g/devel/message/108791 Mute This Topic: https://groups.io/mt/101435619/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-