From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0073.outbound.protection.outlook.com [104.47.36.73]) by dpdk.org (Postfix) with ESMTP id 22DC27CB4 for ; Tue, 4 Jul 2017 16:35:37 +0200 (CEST) Received: from CY1PR03CA0025.namprd03.prod.outlook.com (10.174.128.35) by BLUPR03MB471.namprd03.prod.outlook.com (10.141.78.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1220.11; Tue, 4 Jul 2017 14:35:35 +0000 Received: from BN1BFFO11FD040.protection.gbl (2a01:111:f400:7c10::1:140) by CY1PR03CA0025.outlook.office365.com (2603:10b6:600::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1220.11 via Frontend Transport; Tue, 4 Jul 2017 14:35:34 +0000 Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Received: from az84smr01.freescale.net (192.88.158.2) by BN1BFFO11FD040.mail.protection.outlook.com (10.58.144.103) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1199.9 via Frontend Transport; Tue, 4 Jul 2017 14:35:34 +0000 Received: from Tophie.ap.freescale.net ([10.232.14.39]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id v64EZM6m016426; Tue, 4 Jul 2017 07:35:31 -0700 From: Shreyansh Jain To: CC: , Date: Tue, 4 Jul 2017 20:13:55 +0530 Message-ID: <1499179471-19145-5-git-send-email-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1499179471-19145-1-git-send-email-shreyansh.jain@nxp.com> References: <1497591668-3320-1-git-send-email-shreyansh.jain@nxp.com> <1499179471-19145-1-git-send-email-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131436525345019186; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.158.2; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(336005)(39840400002)(39400400002)(39860400002)(39850400002)(39410400002)(39450400003)(39380400002)(2980300002)(1110001)(1109001)(339900001)(199003)(189002)(9170700003)(47776003)(36756003)(8936002)(50466002)(5003940100001)(189998001)(2906002)(5660300001)(50986999)(81166006)(33646002)(76176999)(8676002)(305945005)(48376002)(356003)(68736007)(626005)(53936002)(77096006)(104016004)(2950100002)(6666003)(6916009)(69596002)(106466001)(50226002)(8656002)(110136004)(38730400002)(105606002)(4326008)(86362001)(54906002)(85426001)(2351001)(498600001)(2004002); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR03MB471; H:az84smr01.freescale.net; FPR:; SPF:Fail; MLV:ovrnspm; A:1; MX:1; PTR:InfoDomainNonexistent; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN1BFFO11FD040; 1:0epie8NNsTdvhy6e3f0A2xZTBkArdQw2NY5kyQaBv?= =?us-ascii?Q?0C8U26jWrINc9+KbC/oMIsvE2zrgDToj0WlfC4RtPqTifm3+h31oMatR5maG?= =?us-ascii?Q?iDMDX3QSmRm3PJl5J14F3UZZgG2hGZovzTltjYQWXH5KY1Pd2dydrl1Ymjge?= =?us-ascii?Q?c2a1+dyOwKFwz54CwzkXlD/fCH4Jde0x7BkUticpthCa3Dt/tVhW5q1RhtWK?= =?us-ascii?Q?XO8SPHnPjhW5t8UyZuBOlld7ce/RUlwee/IDLy+3y+T/CYH1bmATLWsqpbsZ?= =?us-ascii?Q?xyI9SqW/P5wyCJR+iw1h222heniX/TIpuXvGHixlrfT1/ASfosTKTprbDzeZ?= =?us-ascii?Q?Itf6SB4DgxJnIWLbaqmUrStrsxWSeJVDevF0mvaHNwOIxB/0PYsmANGgh3Zh?= =?us-ascii?Q?HE2uB6hdS5EgIlu1yULZOmDq4X1yOWUuMepov+9wXOdVLVebN8jxiK1Uz1vE?= =?us-ascii?Q?4KKMI3jNyz2KqzjY4hgCmC97k2ZiCr/ONpOtB95is7y6sMw7XMvnpDsY1sqP?= =?us-ascii?Q?yhHBjoPpCyXgbzNYa4Q12lTLDmbyMxWYkFO9AIRTOyFZSkiPHqxyYQE9UnNJ?= =?us-ascii?Q?DiFxqCPZtOZ9FAyVetqrgLlLIyp+rOzA1iXhovUmUVdHynGZwrOTvyr6hg4D?= =?us-ascii?Q?ub6L9aGI0QzUg0gmNJjOLbN1CRK6vQGF6wQusvFhjNmsSJ45hpCra0nGHU/b?= =?us-ascii?Q?ySPEZApUQT2HueRRY+XGcBPms9y5e9BzQbqZioAgkJ8eKTNqWT0xrVLoF1kI?= =?us-ascii?Q?m8p6nUMf98Li6ufq1E2TMKzos+Il/kFRF+wAPhxyjDudlKy2GZvxwtUccMle?= =?us-ascii?Q?Qpj69Qqv22fSOn8y1rG+kcaIcT++OIcMtllYsYw4OxVdXHbvFCNwHRQwx7eS?= =?us-ascii?Q?BvlV/VWroDv1ALEK2InbbOtf//+1MrZGArD+1W3bOPe8ZfZiOvWcVFTAYrzZ?= =?us-ascii?Q?JeVHeQGRz8OmEEv/iRBDJHNm1fAUxWhzIiVk4IWwPg1GvOnEoBAu04c+zXMF?= =?us-ascii?Q?73+5BOl6fwcfaZaF1oCku7YDcPl23XrVD9fPGOeUiaimdnZ2otrHoXPHnVlo?= =?us-ascii?Q?60Frfs7Cea4i5XpNyIe1ahxSDgsY3irl2oCNacsIcF09i1jnQ=3D=3D?= MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3f3e76cd-6a8b-4eb4-9532-08d4c2e9ee2a X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(300000503095)(300135400095)(2017052603031)(201703131430075)(201703131517081)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:BLUPR03MB471; X-Microsoft-Exchange-Diagnostics: 1; BLUPR03MB471; 3:z6YLgFAoRqwk8K3GfmDn8MvSvcintCSOYFFhslTvLss5y94kTlW9umm68tI3ohZ9FBXIW7OTtZpIfMfb7Nuf24u66OPSedlwlwhQRsoP84DTJ5fQzPhKCRqldqpZOm3c7qdHqoeL2CNE050NvIBsvlcRMduoHzcRwCevWOZ7IhM1/gkbKimNgJOdz+moiiApch7YUswrDG8vq105Q5JqyEjYteLAeUzRTfue28rsYRTEidVvb4v4EK/e90YNwxtfojA9f7O5rqojxcMmj0yDsLuog9QNUWdhrjjwq5TbljFZJ+Ih9HRA5Fgxv+6KbagXNqiElbul65hw8mVICEwuKiTyIk/NIws4W4cFAhiBobY3fkBEIe0muxdIOOywg/tx93icOH6AFhAxI3b+bgAUp0uLSJKb1wEhgVTO8KQmL0XgSxq0OgNIxcNQvDFyhldRTQD/LVh5Xfx0yuY0gDgPHlRRg5vqNMICwJvFwk96nIg1N7XAYRMztsWI7FX5gSndRZ4Y4Vjnw9NNQu930wbIdwImGF2iRQ5369kTsVdOvzdcprtrAuIFa8eYIktkg9g8yALAL3Z06GR+OPkwGDS9runTD0Tr72No2XTVNwdXet0gR15oUtCBYkVGOhIGmZLje0z2+NmT3NR9s/xw3uN4jBNLafTbvUS9LSm51dwPlpN+EY9wKJSotm9/y5lCYlhPl3Ft0lnFGGjzf8MNfo7P4Cq1TRbdjpjqM9f1vbMLkF0el2HGVkvZzbuLYwc3wAfGUOmLTExWFTp71DUEsDuvjkY6g9JPEfW540Awz/OLRjxOa9ICGQdaZXOwXMEAjFKHEqF9ZCQdVf6TRlWsq7jYnHLGfjhfrbd2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03MB471; 31:y3dzj+TYu/iBeakgKiT4Puxd8AsxhT0kdFpXk+zsCBkA7k13CNF4R/4zy8UHKVcx9gnfXwj82ECWRzzIW6S0KZHMCdKYI6wT8syH3wPPkqsVQ0FL0k/eWdDtIx+/dQF3rKn4yHhdu7pR9o045jmKr2WN9uRHCHfRqhR4VzJl05+BapuE+IL9j2LAzRwN+gKsuyyY+TBGoGAIpTitdZH1sLjgV/QDtAKUR1iqhEix54Ef3wkcWc56TjP+dzQ5YVXckP48uTC5j/kcJ7wb8W+GuPLe60nB+6xqhp7hbBRMsKxqx/BpyZLi17VfxGmYf+Dh5b4Qai4QqEutyU4fSdivYrkRdz9a+DT68YKgwk0Dsqv/p7LFefnSzY1tAIBTM36FlSm1iTf1WxlPdCoHk/xZbIeer5ZnTgsruvqLx0lqAV6D+VI4ivhhQjTmncQqpEGdIyVXhG4tyt28mcisknTl6pc1anQAVk3iGJDJia4bW/PM7cfXhBA0Z8N06/5O933Ed2tVVKb7zvMFchyin71sh0p1a2yexbGG6ok8gC/tCTpTR+O/9wLFh2x/UvrDYh9Z7FEyfHDS7lwE4TqflWRDMX/PZF/8BortkoJCeqRbLAB6us3qTJ7EtCLxnFDdkV/wh3FQKzw1GBjdAE9JVS8+2/7W2mKs5WnUSiOmX4OFJZikojwxLPZnPrTHJ9vGG4ev X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(236129657087228)(185117386973197)(48057245064654)(148574349560750)(158140799945019); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6095135)(601004)(2401047)(5005006)(13016025)(13018025)(8121501046)(3002001)(93006095)(93001095)(100000703101)(100105400095)(10201501046)(6055026)(6096035)(201703131430075)(201703131433075)(201703131448075)(201703161259150)(201703151042153)(20161123565025)(20161123561025)(20161123559100)(20161123563025)(20161123556025)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BLUPR03MB471; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BLUPR03MB471; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR03MB471; 4:Skvc4lDnepPfGTkEHti45TCfSBgDJy6mMol1xid97B1?= =?us-ascii?Q?3gY5koN/RsZOOBPZ2KZiNv1ZX+wuvg3YgLCLzTKMJxMYxL72M5O9qkdxfFsE?= =?us-ascii?Q?lEyFHOVkO0NTO1exEU2cKoUmqpLqwJxShrWRffXB+bl/6c9XVRLKqi0KmfAX?= =?us-ascii?Q?U5c3oWobpAoPHPXD9EEqcC9XftYRNjq9hfGTWsm8htfgqHNfvkzl38+3nURp?= =?us-ascii?Q?Tc9g5OEmJsBjnaxfBJnklfL0QYBIx4O+CWvWKR0xL4YpYYDvNFMfAUwEG0na?= =?us-ascii?Q?8mCusMrDnNcU9aDI+xPPTl4Ba+H9NHj2Qs/XU77cfzM7RhtPdTqoTfg+HtvK?= =?us-ascii?Q?0PfC7GurCjCF1L3N0/bhyhY9eFQ7hEgWLVsxuILNHO5IW3DzP2g9xAK3EVvu?= =?us-ascii?Q?Gj/I0lVcY0+Rwp+JRrtKvfwzk5FG7XBZM/bAsmQ3t/LF1naZfr5RleVtEg/d?= =?us-ascii?Q?nuYPX3Ryz7/HV8BLwVY/gppgwOz64TC0bQ14JwtpGvQo/TzrCYNA8/7iEFw9?= =?us-ascii?Q?brjVzWeXt2gN/tBqgJbFDbYVAdqNbqZbaITSn2325sLIZ3k5KyYpymKTHqCz?= =?us-ascii?Q?hwWgrSbHnc2K1/t8eQjtl5P8lpcGBZGfB0ar6TqwJK18VWdnxCtFc9NAmPrH?= =?us-ascii?Q?j+nxN/1t7vSzlr4Sx4F9etpMcHRXfKZqhDyqWCkoCLw6QVBZwV4zXvck+w8f?= =?us-ascii?Q?FSyaq9Nd17OEPTweb7WqBafReKzaZK9I3l6hiKgy/mjj/tALPX90YfaWWaZm?= =?us-ascii?Q?c38ozOsskUn6JwdcGLfKDzaVU927B+AjEWEGdHTGRu4wNsIR7EZLTM10/3e2?= =?us-ascii?Q?DFMtpWUxrSthRb0mImyDIWaptc2uzYS3nWJFas66R0R9Nf63Mk2ocIStetHQ?= =?us-ascii?Q?4RjYAleYXCMFFPVOMJfCObf7GJ1F8Wq9FQueqkDWG1RTvvZSpvbUJ22rZBPD?= =?us-ascii?Q?txa0O4o2D/i1i8BmSQ4Hl+R0fWuLBCqeBNxsstW3zITQt6hoc++5eAgdGxJj?= =?us-ascii?Q?1p/hNjqX1Ne31oyqtCdhUfIQusUBmsZ/Bv9me27AQC5GvkkBS1uvoHj/peb8?= =?us-ascii?Q?3gGMV8fHEaGdcmToyKcyIpV1bIVw8tX/+xw1FiEN4XSu8TFaJKHPhsxBkduT?= =?us-ascii?Q?TeGQpSwgFRo+hOpXq9JRochN5znC8yQmU3jhQAB4Mfz0+JXD/bLxOPbrUvJK?= =?us-ascii?Q?qnSdbzYdYjTywfKVa3FZevpdmC78p2BqjZ/dyPwed/knbDXwGJIzG6dexsy1?= =?us-ascii?Q?M6O9356eiBB2w5ttP+Hs5MugnC0YkH8K/NnjpFajE6Qgg4xeBHaenAhkinF4?= =?us-ascii?Q?zF+1+oCX+oU4dsjVuxi0hztBwgYM8zvl0UTiWX4RKeeFs/MmVQu0A8rOZzSl?= =?us-ascii?Q?nJSsKO0gPcrWUoM1Nsb/XyDhU4YJLRfMUErW4fu08V3i1?= X-Forefront-PRVS: 0358535363 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR03MB471; 23:VVbxJ/AOEYv1XHB29l1Q4mKJ4Z4Z4oQWTnDhLdVfoG?= =?us-ascii?Q?GLHXe7nRsD1VeMSfJIDtO1WAho67tyyhUCKMtp5qHdyIxNmowbLUpKi1UH+T?= =?us-ascii?Q?lVnoMl/tNOAWJdF6OCzUifV2rquL27nGAK1Y+EiNxZAgAUN4+K7iLDv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5sE1XF+xWqnoV7HpOKs+ZNZ7Jd63zBPYU/IE+/xGySxY= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jul 2017 14:35:34.2679 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR03MB471 Subject: [dpdk-dev] [PATCH v2 04/40] bus/dpaa: add OF parser for device scanning X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jul 2017 14:35:38 -0000 This layer is used by Bus driver's scan function. Devices are parsed using OF parser and added to DPAA device list. Signed-off-by: Geoff Thorpe Signed-off-by: Shreyansh Jain --- drivers/bus/dpaa/Makefile | 7 + drivers/bus/dpaa/base/fman/of.c | 576 ++++++++++++++++++++++++++++++++++++++++ drivers/bus/dpaa/include/of.h | 191 +++++++++++++ 3 files changed, 774 insertions(+) create mode 100644 drivers/bus/dpaa/base/fman/of.c create mode 100644 drivers/bus/dpaa/include/of.h diff --git a/drivers/bus/dpaa/Makefile b/drivers/bus/dpaa/Makefile index f44f3c4..cc685d1 100644 --- a/drivers/bus/dpaa/Makefile +++ b/drivers/bus/dpaa/Makefile @@ -45,7 +45,12 @@ CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) endif +CFLAGS +=-Wno-pointer-arith +CFLAGS +=-Wno-cast-qual +CFLAGS += -D _GNU_SOURCE + CFLAGS += -I$(RTE_BUS_DPAA)/ +CFLAGS += -I$(RTE_BUS_DPAA)/include CFLAGS += -I$(RTE_SDK)/lib/librte_eal/linuxapp/eal CFLAGS += -I$(RTE_SDK)/lib/librte_eal/common/include @@ -59,5 +64,7 @@ LIBABIVER := 1 SRCS-$(CONFIG_RTE_LIBRTE_DPAA_BUS) += \ dpaa_bus.c +SRCS-$(CONFIG_RTE_LIBRTE_DPAA_BUS) += \ + base/fman/of.c \ include $(RTE_SDK)/mk/rte.lib.mk diff --git a/drivers/bus/dpaa/base/fman/of.c b/drivers/bus/dpaa/base/fman/of.c new file mode 100644 index 0000000..6cc3987 --- /dev/null +++ b/drivers/bus/dpaa/base/fman/of.c @@ -0,0 +1,576 @@ +/*- + * This file is provided under a dual BSD/GPLv2 license. When using or + * redistributing this file, you may do so under either license. + * + * BSD LICENSE + * + * Copyright 2010-2016 Freescale Semiconductor Inc. + * Copyright 2017 NXP. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the above-listed copyright holders nor the + * names of any contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * GPL LICENSE SUMMARY + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License ("GPL") as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include + +static int alive; +static struct dt_dir root_dir; +static const char *base_dir; +static COMPAT_LIST_HEAD(linear); + +static int +of_open_dir(const char *relative_path, struct dirent ***d) +{ + int ret; + char full_path[PATH_MAX]; + + snprintf(full_path, PATH_MAX, "%s/%s", base_dir, relative_path); + ret = scandir(full_path, d, 0, versionsort); + if (ret < 0) + DPAA_BUS_LOG(ERR, "Failed to open directory %s", + full_path); + return ret; +} + +static void +of_close_dir(struct dirent **d, int num) +{ + while (num--) + free(d[num]); + free(d); +} + +static int +of_open_file(const char *relative_path) +{ + int ret; + char full_path[PATH_MAX]; + + snprintf(full_path, PATH_MAX, "%s/%s", base_dir, relative_path); + ret = open(full_path, O_RDONLY); + if (ret < 0) + DPAA_BUS_LOG(ERR, "Failed to open directory %s", + full_path); + return ret; +} + +static void +process_file(struct dirent *dent, struct dt_dir *parent) +{ + int fd; + struct dt_file *f = malloc(sizeof(*f)); + + if (!f) { + DPAA_BUS_LOG(DEBUG, "Unable to allocate memory for file node"); + return; + } + f->node.is_file = 1; + snprintf(f->node.node.name, NAME_MAX, "%s", dent->d_name); + snprintf(f->node.node.full_name, PATH_MAX, "%s/%s", + parent->node.node.full_name, dent->d_name); + f->parent = parent; + fd = of_open_file(f->node.node.full_name); + if (fd < 0) { + DPAA_BUS_LOG(DEBUG, "Unable to open file node"); + free(f); + return; + } + f->len = read(fd, f->buf, OF_FILE_BUF_MAX); + close(fd); + if (f->len < 0) { + DPAA_BUS_LOG(DEBUG, "Unable to read file node"); + free(f); + return; + } + list_add_tail(&f->node.list, &parent->files); +} + +static const struct dt_dir * +node2dir(const struct device_node *n) +{ + struct dt_node *dn = container_of((struct device_node *)n, + struct dt_node, node); + const struct dt_dir *d = container_of(dn, struct dt_dir, node); + + assert(!dn->is_file); + return d; +} + +/* process_dir() calls iterate_dir(), but the latter will also call the former + * when recursing into sub-directories, so a predeclaration is needed. + */ +static int process_dir(const char *relative_path, struct dt_dir *dt); + +static int +iterate_dir(struct dirent **d, int num, struct dt_dir *dt) +{ + int loop; + /* Iterate the directory contents */ + for (loop = 0; loop < num; loop++) { + struct dt_dir *subdir; + int ret; + /* Ignore dot files of all types (especially "..") */ + if (d[loop]->d_name[0] == '.') + continue; + switch (d[loop]->d_type) { + case DT_REG: + process_file(d[loop], dt); + break; + case DT_DIR: + subdir = malloc(sizeof(*subdir)); + if (!subdir) { + perror("malloc"); + return -ENOMEM; + } + snprintf(subdir->node.node.name, NAME_MAX, "%s", + d[loop]->d_name); + snprintf(subdir->node.node.full_name, PATH_MAX, + "%s/%s", dt->node.node.full_name, + d[loop]->d_name); + subdir->parent = dt; + ret = process_dir(subdir->node.node.full_name, subdir); + if (ret) + return ret; + list_add_tail(&subdir->node.list, &dt->subdirs); + break; + default: + DPAA_BUS_LOG(DEBUG, "Ignoring invalid dt entry %s/%s", + dt->node.node.full_name, d[loop]->d_name); + } + } + return 0; +} + +static int +process_dir(const char *relative_path, struct dt_dir *dt) +{ + struct dirent **d; + int ret, num; + + dt->node.is_file = 0; + INIT_LIST_HEAD(&dt->subdirs); + INIT_LIST_HEAD(&dt->files); + ret = of_open_dir(relative_path, &d); + if (ret < 0) + return ret; + num = ret; + ret = iterate_dir(d, num, dt); + of_close_dir(d, num); + return (ret < 0) ? ret : 0; +} + +static void +linear_dir(struct dt_dir *d) +{ + struct dt_file *f; + struct dt_dir *dd; + + d->compatible = NULL; + d->status = NULL; + d->lphandle = NULL; + d->a_cells = NULL; + d->s_cells = NULL; + d->reg = NULL; + list_for_each_entry(f, &d->files, node.list) { + if (!strcmp(f->node.node.name, "compatible")) { + if (d->compatible) + DPAA_BUS_LOG(DEBUG, "Duplicate compatible in" + " %s", d->node.node.full_name); + d->compatible = f; + } else if (!strcmp(f->node.node.name, "status")) { + if (d->status) + DPAA_BUS_LOG(DEBUG, "Duplicate status in %s", + d->node.node.full_name); + d->status = f; + } else if (!strcmp(f->node.node.name, "linux,phandle")) { + if (d->lphandle) + DPAA_BUS_LOG(DEBUG, "Duplicate lphandle in %s", + d->node.node.full_name); + d->lphandle = f; + } else if (!strcmp(f->node.node.name, "#address-cells")) { + if (d->a_cells) + DPAA_BUS_LOG(DEBUG, "Duplicate a_cells in %s", + d->node.node.full_name); + d->a_cells = f; + } else if (!strcmp(f->node.node.name, "#size-cells")) { + if (d->s_cells) + DPAA_BUS_LOG(DEBUG, "Duplicate s_cells in %s", + d->node.node.full_name); + d->s_cells = f; + } else if (!strcmp(f->node.node.name, "reg")) { + if (d->reg) + DPAA_BUS_LOG(DEBUG, "Duplicate reg in %s", + d->node.node.full_name); + d->reg = f; + } + } + + list_for_each_entry(dd, &d->subdirs, node.list) { + list_add_tail(&dd->linear, &linear); + linear_dir(dd); + } +} + +int +of_init_path(const char *dt_path) +{ + int ret; + + base_dir = dt_path; + + /* This needs to be singleton initialization */ + DPAA_BUS_WARN(alive, "Double-init of device-tree driver!"); + + /* Prepare root node (the remaining fields are set in process_dir()) */ + root_dir.node.node.name[0] = '\0'; + root_dir.node.node.full_name[0] = '\0'; + INIT_LIST_HEAD(&root_dir.node.list); + root_dir.parent = NULL; + + /* Kick things off... */ + ret = process_dir("", &root_dir); + if (ret) { + DPAA_BUS_LOG(ERR, "Unable to parse device tree"); + return ret; + } + + /* Now make a flat, linear list of directories */ + linear_dir(&root_dir); + alive = 1; + return 0; +} + +static void +destroy_dir(struct dt_dir *d) +{ + struct dt_file *f, *tmpf; + struct dt_dir *dd, *tmpd; + + list_for_each_entry_safe(f, tmpf, &d->files, node.list) { + list_del(&f->node.list); + free(f); + } + list_for_each_entry_safe(dd, tmpd, &d->subdirs, node.list) { + destroy_dir(dd); + list_del(&dd->node.list); + free(dd); + } +} + +void +of_finish(void) +{ + DPAA_BUS_WARN(!alive, "Double-finish of device-tree driver!"); + + destroy_dir(&root_dir); + INIT_LIST_HEAD(&linear); + alive = 0; +} + +static const struct dt_dir * +next_linear(const struct dt_dir *f) +{ + if (f->linear.next == &linear) + return NULL; + return list_entry(f->linear.next, struct dt_dir, linear); +} + +static int +check_compatible(const struct dt_file *f, const char *compatible) +{ + const char *c = (char *)f->buf; + unsigned int len, remains = f->len; + + while (remains) { + len = strlen(c); + if (!strcmp(c, compatible)) + return 1; + + if (remains < len + 1) + break; + + c += (len + 1); + remains -= (len + 1); + } + return 0; +} + +const struct device_node * +of_find_compatible_node(const struct device_node *from, + const char *type __always_unused, + const char *compatible) +{ + const struct dt_dir *d; + + DPAA_BUS_WARN(!alive, "Device-tree driver not initialised!"); + + if (list_empty(&linear)) + return NULL; + if (!from) + d = list_entry(linear.next, struct dt_dir, linear); + else + d = node2dir(from); + for (d = next_linear(d); d && (!d->compatible || + !check_compatible(d->compatible, + compatible)); + d = next_linear(d)) + ; + if (d) + return &d->node.node; + return NULL; +} + +const void * +of_get_property(const struct device_node *from, const char *name, + size_t *lenp) +{ + const struct dt_dir *d; + const struct dt_file *f; + + DPAA_BUS_WARN(!alive, "Device-tree driver not initialised!"); + + d = node2dir(from); + list_for_each_entry(f, &d->files, node.list) + if (!strcmp(f->node.node.name, name)) { + if (lenp) + *lenp = f->len; + return f->buf; + } + return NULL; +} + +bool +of_device_is_available(const struct device_node *dev_node) +{ + const struct dt_dir *d; + + DPAA_BUS_WARN(!alive, "Device-tree driver not initialised!"); + d = node2dir(dev_node); + if (!d->status) + return true; + if (!strcmp((char *)d->status->buf, "okay")) + return true; + if (!strcmp((char *)d->status->buf, "ok")) + return true; + return false; +} + +const struct device_node * +of_find_node_by_phandle(phandle ph) +{ + const struct dt_dir *d; + + DPAA_BUS_WARN(!alive, "Device-tree driver not initialised!"); + list_for_each_entry(d, &linear, linear) + if (d->lphandle && (d->lphandle->len == 4) && + !memcmp(d->lphandle->buf, &ph, 4)) + return &d->node.node; + return NULL; +} + +const struct device_node * +of_get_parent(const struct device_node *dev_node) +{ + const struct dt_dir *d; + + DPAA_BUS_WARN(!alive, "Device-tree driver not initialised!"); + + if (!dev_node) + return NULL; + d = node2dir(dev_node); + if (!d->parent) + return NULL; + return &d->parent->node.node; +} + +const struct device_node * +of_get_next_child(const struct device_node *dev_node, + const struct device_node *prev) +{ + const struct dt_dir *p, *c; + + DPAA_BUS_WARN(!alive, "Device-tree driver not initialised!"); + + if (!dev_node) + return NULL; + p = node2dir(dev_node); + if (prev) { + c = node2dir(prev); + DPAA_BUS_WARN((c->parent != p), "Parent/child mismatch"); + if (c->parent != p) + return NULL; + if (c->node.list.next == &p->subdirs) + /* prev was the last child */ + return NULL; + c = list_entry(c->node.list.next, struct dt_dir, node.list); + return &c->node.node; + } + /* Return first child */ + if (list_empty(&p->subdirs)) + return NULL; + c = list_entry(p->subdirs.next, struct dt_dir, node.list); + return &c->node.node; +} + +uint32_t +of_n_addr_cells(const struct device_node *dev_node) +{ + const struct dt_dir *d; + + DPAA_BUS_WARN(!alive, "Device-tree driver not initialised"); + if (!dev_node) + return OF_DEFAULT_NA; + d = node2dir(dev_node); + while ((d = d->parent)) + if (d->a_cells) { + unsigned char *buf = + (unsigned char *)&d->a_cells->buf[0]; + assert(d->a_cells->len == 4); + return ((uint32_t)buf[0] << 24) | + ((uint32_t)buf[1] << 16) | + ((uint32_t)buf[2] << 8) | + (uint32_t)buf[3]; + } + return OF_DEFAULT_NA; +} + +uint32_t +of_n_size_cells(const struct device_node *dev_node) +{ + const struct dt_dir *d; + + DPAA_BUS_WARN(!alive, "Device-tree driver not initialised!"); + if (!dev_node) + return OF_DEFAULT_NA; + d = node2dir(dev_node); + while ((d = d->parent)) + if (d->s_cells) { + unsigned char *buf = + (unsigned char *)&d->s_cells->buf[0]; + assert(d->s_cells->len == 4); + return ((uint32_t)buf[0] << 24) | + ((uint32_t)buf[1] << 16) | + ((uint32_t)buf[2] << 8) | + (uint32_t)buf[3]; + } + return OF_DEFAULT_NS; +} + +const uint32_t * +of_get_address(const struct device_node *dev_node, size_t idx, + uint64_t *size, uint32_t *flags __rte_unused) +{ + const struct dt_dir *d; + const unsigned char *buf; + uint32_t na = of_n_addr_cells(dev_node); + uint32_t ns = of_n_size_cells(dev_node); + + if (!dev_node) + d = &root_dir; + else + d = node2dir(dev_node); + if (!d->reg) + return NULL; + assert(d->reg->len % ((na + ns) * 4) == 0); + assert(d->reg->len / ((na + ns) * 4) > (unsigned int) idx); + buf = (const unsigned char *)&d->reg->buf[0]; + buf += (na + ns) * idx * 4; + if (size) + for (*size = 0; ns > 0; ns--, na++) + *size = (*size << 32) + + (((uint32_t)buf[4 * na] << 24) | + ((uint32_t)buf[4 * na + 1] << 16) | + ((uint32_t)buf[4 * na + 2] << 8) | + (uint32_t)buf[4 * na + 3]); + return (const uint32_t *)buf; +} + +uint64_t +of_translate_address(const struct device_node *dev_node, + const uint32_t *addr) +{ + uint64_t phys_addr, tmp_addr; + const struct device_node *parent; + const uint32_t *ranges; + size_t rlen; + uint32_t na, pna; + + DPAA_BUS_WARN(!alive, "Device-tree driver not initialised!"); + assert(dev_node != NULL); + + na = of_n_addr_cells(dev_node); + phys_addr = of_read_number(addr, na); + + dev_node = of_get_parent(dev_node); + if (!dev_node) + return 0; + else if (node2dir(dev_node) == &root_dir) + return phys_addr; + + do { + pna = of_n_addr_cells(dev_node); + parent = of_get_parent(dev_node); + if (!parent) + return 0; + + ranges = of_get_property(dev_node, "ranges", &rlen); + /* "ranges" property is missing. Translation breaks */ + if (!ranges) + return 0; + /* "ranges" property is empty. Do 1:1 translation */ + else if (rlen == 0) + continue; + else + tmp_addr = of_read_number(ranges + na, pna); + + na = pna; + dev_node = parent; + phys_addr += tmp_addr; + } while (node2dir(parent) != &root_dir); + + return phys_addr; +} + +bool +of_device_is_compatible(const struct device_node *dev_node, + const char *compatible) +{ + const struct dt_dir *d; + + DPAA_BUS_WARN(!alive, "Device-tree driver not initialised!"); + if (!dev_node) + d = &root_dir; + else + d = node2dir(dev_node); + if (d->compatible && check_compatible(d->compatible, compatible)) + return true; + return false; +} diff --git a/drivers/bus/dpaa/include/of.h b/drivers/bus/dpaa/include/of.h new file mode 100644 index 0000000..e422a53 --- /dev/null +++ b/drivers/bus/dpaa/include/of.h @@ -0,0 +1,191 @@ +/*- + * This file is provided under a dual BSD/GPLv2 license. When using or + * redistributing this file, you may do so under either license. + * + * BSD LICENSE + * + * Copyright 2010-2016 Freescale Semiconductor, Inc. + * Copyright 2017 NXP. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the above-listed copyright holders nor the + * names of any contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * GPL LICENSE SUMMARY + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License ("GPL") as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __OF_H +#define __OF_H + +#include + +#ifndef OF_INIT_DEFAULT_PATH +#define OF_INIT_DEFAULT_PATH "/proc/device-tree" +#endif + +#define OF_DEFAULT_NA 1 +#define OF_DEFAULT_NS 1 + +#define OF_FILE_BUF_MAX 256 + +/** + * Layout of Device Tree: + * dt_dir + * |- dt_dir + * | |- dt_dir + * | | |- dt_dir + * | | | |- dt_file + * | | | ``- dt_file + * | | ``- dt_file + * | `-dt_file` + * ``- dt_file + * + * +------------------+ + * |dt_dir | + * |+----------------+| + * ||dt_node || + * ||+--------------+|| + * |||device_node ||| + * ||+--------------+|| + * || list_dt_nodes || + * |+----------------+| + * | list of subdir | + * | list of files | + * +------------------+ + */ + +/** + * Device description on of a device node in device tree. + */ +struct device_node { + char name[NAME_MAX]; + char full_name[PATH_MAX]; +}; + +/** + * List of device nodes available in a device tree layout + */ +struct dt_node { + struct device_node node; /**< Property of node */ + int is_file; /**< FALSE==dir, TRUE==file */ + struct list_head list; /**< Nodes within a parent subdir */ +}; + +/** + * Types we use to represent directories and files + */ +struct dt_file; +struct dt_dir { + struct dt_node node; + struct list_head subdirs; + struct list_head files; + struct list_head linear; + struct dt_dir *parent; + struct dt_file *compatible; + struct dt_file *status; + struct dt_file *lphandle; + struct dt_file *a_cells; + struct dt_file *s_cells; + struct dt_file *reg; +}; + +struct dt_file { + struct dt_node node; + struct dt_dir *parent; + ssize_t len; + uint64_t buf[OF_FILE_BUF_MAX >> 3]; /** ASDF: Why? */ +}; + +const struct device_node *of_find_compatible_node( + const struct device_node *from, + const char *type __always_unused, + const char *compatible) + __attribute__((nonnull(3))); + +#define for_each_compatible_node(dev_node, type, compatible) \ + for (dev_node = of_find_compatible_node(NULL, type, compatible); \ + dev_node != NULL; \ + dev_node = of_find_compatible_node(dev_node, type, compatible)) + +const void *of_get_property(const struct device_node *from, const char *name, + size_t *lenp) __attribute__((nonnull(2))); +bool of_device_is_available(const struct device_node *dev_node); + +const struct device_node *of_find_node_by_phandle(phandle ph); + +const struct device_node *of_get_parent(const struct device_node *dev_node); + +const struct device_node *of_get_next_child(const struct device_node *dev_node, + const struct device_node *prev); + +#define for_each_child_node(parent, child) \ + for (child = of_get_next_child(parent, NULL); child != NULL; \ + child = of_get_next_child(parent, child)) + +uint32_t of_n_addr_cells(const struct device_node *dev_node); +uint32_t of_n_size_cells(const struct device_node *dev_node); + +const uint32_t *of_get_address(const struct device_node *dev_node, size_t idx, + uint64_t *size, uint32_t *flags); + +uint64_t of_translate_address(const struct device_node *dev_node, + const u32 *addr) __attribute__((nonnull)); + +bool of_device_is_compatible(const struct device_node *dev_node, + const char *compatible); + +/* of_init() must be called prior to initialisation or use of any driver + * subsystem that is device-tree-dependent. Eg. Qman/Bman, config layers, etc. + * The path should usually be "/proc/device-tree". + */ +int of_init_path(const char *dt_path); + +/* of_finish() allows a controlled tear-down of the device-tree layer, eg. if a + * full reload is desired without a process exit. + */ +void of_finish(void); + +/* Use of this wrapper is recommended. */ +static inline int of_init(void) +{ + return of_init_path(OF_INIT_DEFAULT_PATH); +} + +/* Read a numeric property according to its size and return it as a 64-bit + * value. + */ +static inline uint64_t of_read_number(const __be32 *cell, int size) +{ + uint64_t r = 0; + + while (size--) + r = (r << 32) | be32toh(*(cell++)); + return r; +} + +#endif /* __OF_H */ -- 2.7.4