get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/29248/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 29248,
    "url": "http://patches.dpdk.org/api/patches/29248/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20170928113344.12248-5-shreyansh.jain@nxp.com/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20170928113344.12248-5-shreyansh.jain@nxp.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20170928113344.12248-5-shreyansh.jain@nxp.com",
    "date": "2017-09-28T11:33:08",
    "name": "[dpdk-dev,v5,04/40] bus/dpaa: add OF parser for device scanning",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "26c80d3018d214728c0e42ac24ab89ecaf2b0b35",
    "submitter": {
        "id": 497,
        "url": "http://patches.dpdk.org/api/people/497/?format=api",
        "name": "Shreyansh Jain",
        "email": "shreyansh.jain@nxp.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20170928113344.12248-5-shreyansh.jain@nxp.com/mbox/",
    "series": [],
    "comments": "http://patches.dpdk.org/api/patches/29248/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/29248/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 033E41B19F;\n\tThu, 28 Sep 2017 13:23:14 +0200 (CEST)",
            "from NAM01-BY2-obe.outbound.protection.outlook.com\n\t(mail-by2nam01on0064.outbound.protection.outlook.com [104.47.34.64])\n\tby dpdk.org (Postfix) with ESMTP id 517211AEF4\n\tfor <dev@dpdk.org>; Thu, 28 Sep 2017 13:23:06 +0200 (CEST)",
            "from MWHPR03CA0017.namprd03.prod.outlook.com (10.175.133.155) by\n\tBN3PR03MB2353.namprd03.prod.outlook.com (10.166.74.148) with\n\tMicrosoft SMTP Server (version=TLS1_2,\n\tcipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id\n\t15.20.77.7; Thu, 28 Sep 2017 11:23:03 +0000",
            "from BL2FFO11FD031.protection.gbl (2a01:111:f400:7c09::153) by\n\tMWHPR03CA0017.outlook.office365.com (2603:10b6:300:117::27) with\n\tMicrosoft SMTP Server (version=TLS1_2,\n\tcipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.56.9 via\n\tFrontend Transport; Thu, 28 Sep 2017 11:23:02 +0000",
            "from tx30smr01.am.freescale.net (192.88.168.50) by\n\tBL2FFO11FD031.mail.protection.outlook.com (10.173.160.71) with\n\tMicrosoft SMTP Server (version=TLS1_0,\n\tcipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.56.11\n\tvia Frontend Transport; Thu, 28 Sep 2017 11:23:02 +0000",
            "from Tophie.ap.freescale.net ([10.232.14.39])\n\tby tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id\n\tv8SBMpFe016035; Thu, 28 Sep 2017 04:23:00 -0700"
        ],
        "Authentication-Results": "spf=fail (sender IP is 192.88.168.50)\n\tsmtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed)\n\theader.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com;",
        "Received-SPF": "Fail (protection.outlook.com: domain of nxp.com does not\n\tdesignate 192.88.168.50 as permitted sender)\n\treceiver=protection.outlook.com; \n\tclient-ip=192.88.168.50; helo=tx30smr01.am.freescale.net;",
        "From": "Shreyansh Jain <shreyansh.jain@nxp.com>",
        "To": "<dev@dpdk.org>",
        "CC": "<ferruh.yigit@intel.com>, <hemant.agrawal@nxp.com>",
        "Date": "Thu, 28 Sep 2017 17:03:08 +0530",
        "Message-ID": "<20170928113344.12248-5-shreyansh.jain@nxp.com>",
        "X-Mailer": "git-send-email 2.9.3",
        "In-Reply-To": "<20170928113344.12248-1-shreyansh.jain@nxp.com>",
        "References": "<20170909112132.13936-1-shreyansh.jain@nxp.com>\n\t<20170928113344.12248-1-shreyansh.jain@nxp.com>",
        "X-EOPAttributedMessage": "0",
        "X-Matching-Connectors": "131510713824568911;\n\t(91ab9b29-cfa4-454e-5278-08d120cd25b8); ()",
        "X-Forefront-Antispam-Report": "CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI;\n\tSFV:NSPM;\n\tSFS:(10009020)(6009001)(7966004)(336005)(39860400002)(346002)(39380400002)(376002)(2980300002)(1110001)(1109001)(339900001)(199003)(189002)(33646002)(189998001)(5003940100001)(47776003)(81156014)(81166006)(8936002)(356003)(8676002)(2950100002)(6916009)(76176999)(53936002)(50986999)(2351001)(2906002)(77096006)(105606002)(106466001)(305945005)(498600001)(36756003)(68736007)(50466002)(50226002)(48376002)(97736004)(1076002)(4326008)(86362001)(54906003)(104016004)(316002)(85426001)(8656003)(16586007)(5660300001)(2004002);\n\tDIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR03MB2353;\n\tH:tx30smr01.am.freescale.net; \n\tFPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; ",
        "X-Microsoft-Exchange-Diagnostics": [
            "1; BL2FFO11FD031;\n\t1:YgkwHFKWflmB5ZcLp4Tz9mUD67yIwC7uxIDPUsvm10K8ZFeop5cH5pnKqC8m/QggOUteeJA0jA4I+WSyCDGau5vedcZPbauf8V2qRd+fwoRnIN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iM5pl/cQxyMoOY+dfzXqJMIrC/gJLUH6921c3C/oivOIEuczvwLuK8csyJVytzhNwxXlagORILDr5vxCJoGy6uWnlY09VU9hOj/nlLspWZXE8CEo+TsyvessKSYvF99ynFNbhYLszbVvrgYxALbVoJIUNS14VUB9hS2ecYCSS10PGvaDzI3Apbrnv439u4w0n5RgvFFLwOCZu0U92AuV5Q="
        ],
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "X-MS-PublicTrafficType": "Email",
        "X-MS-Office365-Filtering-Correlation-Id": "050cb8cd-2ff0-40d1-e64f-08d506634822",
        "X-Microsoft-Antispam": "UriScan:; BCL:0; PCL:0;\n\tRULEID:(22001)(2017052603199)(201703131430075)(201703131517081);\n\tSRVR:BN3PR03MB2353; ",
        "X-MS-TrafficTypeDiagnostic": "BN3PR03MB2353:",
        "X-Exchange-Antispam-Report-Test": "UriScan:(185117386973197);",
        "X-Microsoft-Antispam-PRVS": "<BN3PR03MB23530FA763EC68882FE39FA490790@BN3PR03MB2353.namprd03.prod.outlook.com>",
        "X-Exchange-Antispam-Report-CFA-Test": "BCL:0; PCL:0;\n\tRULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6095135)(2401047)(5005006)(8121501046)(10201501046)(3002001)(93006095)(93001095)(100000703101)(100105400095)(6055026)(6096035)(20161123556025)(20161123559100)(20161123565025)(20161123561025)(201703131430075)(201703131433075)(201703131441075)(201703131448075)(201703161259150)(20161123563025)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);\n\tSRVR:BN3PR03MB2353; BCL:0; PCL:0;\n\tRULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095);\n\tSRVR:BN3PR03MB2353; ",
        "X-Forefront-PRVS": "0444EB1997",
        "SpamDiagnosticOutput": "1:99",
        "SpamDiagnosticMetadata": "NSPM",
        "X-MS-Exchange-CrossTenant-OriginalArrivalTime": "28 Sep 2017 11:23:02.2852\n\t(UTC)",
        "X-MS-Exchange-CrossTenant-Id": "5afe0b00-7697-4969-b663-5eab37d5f47e",
        "X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp": "TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;\n\tIp=[192.88.168.50]; \n\tHelo=[tx30smr01.am.freescale.net]",
        "X-MS-Exchange-CrossTenant-FromEntityHeader": "HybridOnPrem",
        "X-MS-Exchange-Transport-CrossTenantHeadersStamped": "BN3PR03MB2353",
        "Subject": "[dpdk-dev] [PATCH v5 04/40] bus/dpaa: add OF parser for device\n\tscanning",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "This layer is used by Bus driver's scan function. Devices are parsed\nusing OF parser and added to DPAA device list.\n\nSigned-off-by: Geoff Thorpe <geoff.thorpe@nxp.com>\nSigned-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>\n---\n drivers/bus/dpaa/Makefile       |   7 +\n drivers/bus/dpaa/base/fman/of.c | 576 ++++++++++++++++++++++++++++++++++++++++\n drivers/bus/dpaa/include/of.h   | 190 +++++++++++++\n 3 files changed, 773 insertions(+)\n create mode 100644 drivers/bus/dpaa/base/fman/of.c\n create mode 100644 drivers/bus/dpaa/include/of.h",
    "diff": "diff --git a/drivers/bus/dpaa/Makefile b/drivers/bus/dpaa/Makefile\nindex 28694c0..30a3a5d 100644\n--- a/drivers/bus/dpaa/Makefile\n+++ b/drivers/bus/dpaa/Makefile\n@@ -38,7 +38,11 @@ LIB = librte_bus_dpaa.a\n \n CFLAGS := -I$(SRCDIR) $(CFLAGS)\n CFLAGS += -O3 $(WERROR_FLAGS)\n+CFLAGS += -Wno-pointer-arith\n+CFLAGS += -Wno-cast-qual\n+CFLAGS += -D _GNU_SOURCE\n CFLAGS += -I$(RTE_BUS_DPAA)/\n+CFLAGS += -I$(RTE_BUS_DPAA)/include\n CFLAGS += -I$(RTE_SDK)/lib/librte_eal/linuxapp/eal\n CFLAGS += -I$(RTE_SDK)/lib/librte_eal/common/include\n \n@@ -52,6 +56,9 @@ LIBABIVER := 1\n SRCS-$(CONFIG_RTE_LIBRTE_DPAA_BUS) += \\\n \tdpaa_bus.c\n \n+SRCS-$(CONFIG_RTE_LIBRTE_DPAA_BUS) += \\\n+\tbase/fman/of.c \\\n+\n # Link Pthread\n LDLIBS += -lpthread\n \ndiff --git a/drivers/bus/dpaa/base/fman/of.c b/drivers/bus/dpaa/base/fman/of.c\nnew file mode 100644\nindex 0000000..b2d7c02\n--- /dev/null\n+++ b/drivers/bus/dpaa/base/fman/of.c\n@@ -0,0 +1,576 @@\n+/*-\n+ * This file is provided under a dual BSD/GPLv2 license. When using or\n+ * redistributing this file, you may do so under either license.\n+ *\n+ *   BSD LICENSE\n+ *\n+ * Copyright 2010-2016 Freescale Semiconductor Inc.\n+ * Copyright 2017 NXP.\n+ *\n+ * Redistribution and use in source and binary forms, with or without\n+ * modification, are permitted provided that the following conditions are met:\n+ * * Redistributions of source code must retain the above copyright\n+ * notice, this list of conditions and the following disclaimer.\n+ * * Redistributions in binary form must reproduce the above copyright\n+ * notice, this list of conditions and the following disclaimer in the\n+ * documentation and/or other materials provided with the distribution.\n+ * * Neither the name of the above-listed copyright holders nor the\n+ * names of any contributors may be used to endorse or promote products\n+ * derived from this software without specific prior written permission.\n+ *\n+ *   GPL LICENSE SUMMARY\n+ *\n+ * ALTERNATIVELY, this software may be distributed under the terms of the\n+ * GNU General Public License (\"GPL\") as published by the Free Software\n+ * Foundation, either version 2 of that License or (at your option) any\n+ * later version.\n+ *\n+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE\n+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n+ * POSSIBILITY OF SUCH DAMAGE.\n+ */\n+\n+#include <of.h>\n+#include <rte_dpaa_logs.h>\n+\n+static int alive;\n+static struct dt_dir root_dir;\n+static const char *base_dir;\n+static COMPAT_LIST_HEAD(linear);\n+\n+static int\n+of_open_dir(const char *relative_path, struct dirent ***d)\n+{\n+\tint ret;\n+\tchar full_path[PATH_MAX];\n+\n+\tsnprintf(full_path, PATH_MAX, \"%s/%s\", base_dir, relative_path);\n+\tret = scandir(full_path, d, 0, versionsort);\n+\tif (ret < 0)\n+\t\tDPAA_BUS_LOG(ERR, \"Failed to open directory %s\",\n+\t\t\t     full_path);\n+\treturn ret;\n+}\n+\n+static void\n+of_close_dir(struct dirent **d, int num)\n+{\n+\twhile (num--)\n+\t\tfree(d[num]);\n+\tfree(d);\n+}\n+\n+static int\n+of_open_file(const char *relative_path)\n+{\n+\tint ret;\n+\tchar full_path[PATH_MAX];\n+\n+\tsnprintf(full_path, PATH_MAX, \"%s/%s\", base_dir, relative_path);\n+\tret = open(full_path, O_RDONLY);\n+\tif (ret < 0)\n+\t\tDPAA_BUS_LOG(ERR, \"Failed to open directory %s\",\n+\t\t\t     full_path);\n+\treturn ret;\n+}\n+\n+static void\n+process_file(struct dirent *dent, struct dt_dir *parent)\n+{\n+\tint fd;\n+\tstruct dt_file *f = malloc(sizeof(*f));\n+\n+\tif (!f) {\n+\t\tDPAA_BUS_LOG(DEBUG, \"Unable to allocate memory for file node\");\n+\t\treturn;\n+\t}\n+\tf->node.is_file = 1;\n+\tsnprintf(f->node.node.name, NAME_MAX, \"%s\", dent->d_name);\n+\tsnprintf(f->node.node.full_name, PATH_MAX, \"%s/%s\",\n+\t\t parent->node.node.full_name, dent->d_name);\n+\tf->parent = parent;\n+\tfd = of_open_file(f->node.node.full_name);\n+\tif (fd < 0) {\n+\t\tDPAA_BUS_LOG(DEBUG, \"Unable to open file node\");\n+\t\tfree(f);\n+\t\treturn;\n+\t}\n+\tf->len = read(fd, f->buf, OF_FILE_BUF_MAX);\n+\tclose(fd);\n+\tif (f->len < 0) {\n+\t\tDPAA_BUS_LOG(DEBUG, \"Unable to read file node\");\n+\t\tfree(f);\n+\t\treturn;\n+\t}\n+\tlist_add_tail(&f->node.list, &parent->files);\n+}\n+\n+static const struct dt_dir *\n+node2dir(const struct device_node *n)\n+{\n+\tstruct dt_node *dn = container_of((struct device_node *)n,\n+\t\t\t\t\t  struct dt_node, node);\n+\tconst struct dt_dir *d = container_of(dn, struct dt_dir, node);\n+\n+\tassert(!dn->is_file);\n+\treturn d;\n+}\n+\n+/* process_dir() calls iterate_dir(), but the latter will also call the former\n+ * when recursing into sub-directories, so a predeclaration is needed.\n+ */\n+static int process_dir(const char *relative_path, struct dt_dir *dt);\n+\n+static int\n+iterate_dir(struct dirent **d, int num, struct dt_dir *dt)\n+{\n+\tint loop;\n+\t/* Iterate the directory contents */\n+\tfor (loop = 0; loop < num; loop++) {\n+\t\tstruct dt_dir *subdir;\n+\t\tint ret;\n+\t\t/* Ignore dot files of all types (especially \"..\") */\n+\t\tif (d[loop]->d_name[0] == '.')\n+\t\t\tcontinue;\n+\t\tswitch (d[loop]->d_type) {\n+\t\tcase DT_REG:\n+\t\t\tprocess_file(d[loop], dt);\n+\t\t\tbreak;\n+\t\tcase DT_DIR:\n+\t\t\tsubdir = malloc(sizeof(*subdir));\n+\t\t\tif (!subdir) {\n+\t\t\t\tperror(\"malloc\");\n+\t\t\t\treturn -ENOMEM;\n+\t\t\t}\n+\t\t\tsnprintf(subdir->node.node.name, NAME_MAX, \"%s\",\n+\t\t\t\t d[loop]->d_name);\n+\t\t\tsnprintf(subdir->node.node.full_name, PATH_MAX,\n+\t\t\t\t \"%s/%s\", dt->node.node.full_name,\n+\t\t\t\t d[loop]->d_name);\n+\t\t\tsubdir->parent = dt;\n+\t\t\tret = process_dir(subdir->node.node.full_name, subdir);\n+\t\t\tif (ret)\n+\t\t\t\treturn ret;\n+\t\t\tlist_add_tail(&subdir->node.list, &dt->subdirs);\n+\t\t\tbreak;\n+\t\tdefault:\n+\t\t\tDPAA_BUS_LOG(DEBUG, \"Ignoring invalid dt entry %s/%s\",\n+\t\t\t\t     dt->node.node.full_name, d[loop]->d_name);\n+\t\t}\n+\t}\n+\treturn 0;\n+}\n+\n+static int\n+process_dir(const char *relative_path, struct dt_dir *dt)\n+{\n+\tstruct dirent **d;\n+\tint ret, num;\n+\n+\tdt->node.is_file = 0;\n+\tINIT_LIST_HEAD(&dt->subdirs);\n+\tINIT_LIST_HEAD(&dt->files);\n+\tret = of_open_dir(relative_path, &d);\n+\tif (ret < 0)\n+\t\treturn ret;\n+\tnum = ret;\n+\tret = iterate_dir(d, num, dt);\n+\tof_close_dir(d, num);\n+\treturn (ret < 0) ? ret : 0;\n+}\n+\n+static void\n+linear_dir(struct dt_dir *d)\n+{\n+\tstruct dt_file *f;\n+\tstruct dt_dir *dd;\n+\n+\td->compatible = NULL;\n+\td->status = NULL;\n+\td->lphandle = NULL;\n+\td->a_cells = NULL;\n+\td->s_cells = NULL;\n+\td->reg = NULL;\n+\tlist_for_each_entry(f, &d->files, node.list) {\n+\t\tif (!strcmp(f->node.node.name, \"compatible\")) {\n+\t\t\tif (d->compatible)\n+\t\t\t\tDPAA_BUS_LOG(DEBUG, \"Duplicate compatible in\"\n+\t\t\t\t\t     \" %s\", d->node.node.full_name);\n+\t\t\td->compatible = f;\n+\t\t} else if (!strcmp(f->node.node.name, \"status\")) {\n+\t\t\tif (d->status)\n+\t\t\t\tDPAA_BUS_LOG(DEBUG, \"Duplicate status in %s\",\n+\t\t\t\t\t     d->node.node.full_name);\n+\t\t\td->status = f;\n+\t\t} else if (!strcmp(f->node.node.name, \"linux,phandle\")) {\n+\t\t\tif (d->lphandle)\n+\t\t\t\tDPAA_BUS_LOG(DEBUG, \"Duplicate lphandle in %s\",\n+\t\t\t\t\t     d->node.node.full_name);\n+\t\t\td->lphandle = f;\n+\t\t} else if (!strcmp(f->node.node.name, \"#address-cells\")) {\n+\t\t\tif (d->a_cells)\n+\t\t\t\tDPAA_BUS_LOG(DEBUG, \"Duplicate a_cells in %s\",\n+\t\t\t\t\t     d->node.node.full_name);\n+\t\t\td->a_cells = f;\n+\t\t} else if (!strcmp(f->node.node.name, \"#size-cells\")) {\n+\t\t\tif (d->s_cells)\n+\t\t\t\tDPAA_BUS_LOG(DEBUG, \"Duplicate s_cells in %s\",\n+\t\t\t\t\t     d->node.node.full_name);\n+\t\t\td->s_cells = f;\n+\t\t} else if (!strcmp(f->node.node.name, \"reg\")) {\n+\t\t\tif (d->reg)\n+\t\t\t\tDPAA_BUS_LOG(DEBUG, \"Duplicate reg in %s\",\n+\t\t\t\t\t     d->node.node.full_name);\n+\t\t\td->reg = f;\n+\t\t}\n+\t}\n+\n+\tlist_for_each_entry(dd, &d->subdirs, node.list) {\n+\t\tlist_add_tail(&dd->linear, &linear);\n+\t\tlinear_dir(dd);\n+\t}\n+}\n+\n+int\n+of_init_path(const char *dt_path)\n+{\n+\tint ret;\n+\n+\tbase_dir = dt_path;\n+\n+\t/* This needs to be singleton initialization */\n+\tDPAA_BUS_HWWARN(alive, \"Double-init of device-tree driver!\");\n+\n+\t/* Prepare root node (the remaining fields are set in process_dir()) */\n+\troot_dir.node.node.name[0] = '\\0';\n+\troot_dir.node.node.full_name[0] = '\\0';\n+\tINIT_LIST_HEAD(&root_dir.node.list);\n+\troot_dir.parent = NULL;\n+\n+\t/* Kick things off... */\n+\tret = process_dir(\"\", &root_dir);\n+\tif (ret) {\n+\t\tDPAA_BUS_LOG(ERR, \"Unable to parse device tree\");\n+\t\treturn ret;\n+\t}\n+\n+\t/* Now make a flat, linear list of directories */\n+\tlinear_dir(&root_dir);\n+\talive = 1;\n+\treturn 0;\n+}\n+\n+static void\n+destroy_dir(struct dt_dir *d)\n+{\n+\tstruct dt_file *f, *tmpf;\n+\tstruct dt_dir *dd, *tmpd;\n+\n+\tlist_for_each_entry_safe(f, tmpf, &d->files, node.list) {\n+\t\tlist_del(&f->node.list);\n+\t\tfree(f);\n+\t}\n+\tlist_for_each_entry_safe(dd, tmpd, &d->subdirs, node.list) {\n+\t\tdestroy_dir(dd);\n+\t\tlist_del(&dd->node.list);\n+\t\tfree(dd);\n+\t}\n+}\n+\n+void\n+of_finish(void)\n+{\n+\tDPAA_BUS_HWWARN(!alive, \"Double-finish of device-tree driver!\");\n+\n+\tdestroy_dir(&root_dir);\n+\tINIT_LIST_HEAD(&linear);\n+\talive = 0;\n+}\n+\n+static const struct dt_dir *\n+next_linear(const struct dt_dir *f)\n+{\n+\tif (f->linear.next == &linear)\n+\t\treturn NULL;\n+\treturn list_entry(f->linear.next, struct dt_dir, linear);\n+}\n+\n+static int\n+check_compatible(const struct dt_file *f, const char *compatible)\n+{\n+\tconst char *c = (char *)f->buf;\n+\tunsigned int len, remains = f->len;\n+\n+\twhile (remains) {\n+\t\tlen = strlen(c);\n+\t\tif (!strcmp(c, compatible))\n+\t\t\treturn 1;\n+\n+\t\tif (remains < len + 1)\n+\t\t\tbreak;\n+\n+\t\tc += (len + 1);\n+\t\tremains -= (len + 1);\n+\t}\n+\treturn 0;\n+}\n+\n+const struct device_node *\n+of_find_compatible_node(const struct device_node *from,\n+\t\t\tconst char *type __always_unused,\n+\t\t\tconst char *compatible)\n+{\n+\tconst struct dt_dir *d;\n+\n+\tDPAA_BUS_HWWARN(!alive, \"Device-tree driver not initialised!\");\n+\n+\tif (list_empty(&linear))\n+\t\treturn NULL;\n+\tif (!from)\n+\t\td = list_entry(linear.next, struct dt_dir, linear);\n+\telse\n+\t\td = node2dir(from);\n+\tfor (d = next_linear(d); d && (!d->compatible ||\n+\t\t\t\t       !check_compatible(d->compatible,\n+\t\t\t\t       compatible));\n+\t\t\td = next_linear(d))\n+\t\t;\n+\tif (d)\n+\t\treturn &d->node.node;\n+\treturn NULL;\n+}\n+\n+const void *\n+of_get_property(const struct device_node *from, const char *name,\n+\t\tsize_t *lenp)\n+{\n+\tconst struct dt_dir *d;\n+\tconst struct dt_file *f;\n+\n+\tDPAA_BUS_HWWARN(!alive, \"Device-tree driver not initialised!\");\n+\n+\td = node2dir(from);\n+\tlist_for_each_entry(f, &d->files, node.list)\n+\t\tif (!strcmp(f->node.node.name, name)) {\n+\t\t\tif (lenp)\n+\t\t\t\t*lenp = f->len;\n+\t\t\treturn f->buf;\n+\t\t}\n+\treturn NULL;\n+}\n+\n+bool\n+of_device_is_available(const struct device_node *dev_node)\n+{\n+\tconst struct dt_dir *d;\n+\n+\tDPAA_BUS_HWWARN(!alive, \"Device-tree driver not initialised!\");\n+\td = node2dir(dev_node);\n+\tif (!d->status)\n+\t\treturn true;\n+\tif (!strcmp((char *)d->status->buf, \"okay\"))\n+\t\treturn true;\n+\tif (!strcmp((char *)d->status->buf, \"ok\"))\n+\t\treturn true;\n+\treturn false;\n+}\n+\n+const struct device_node *\n+of_find_node_by_phandle(phandle ph)\n+{\n+\tconst struct dt_dir *d;\n+\n+\tDPAA_BUS_HWWARN(!alive, \"Device-tree driver not initialised!\");\n+\tlist_for_each_entry(d, &linear, linear)\n+\t\tif (d->lphandle && (d->lphandle->len == 4) &&\n+\t\t    !memcmp(d->lphandle->buf, &ph, 4))\n+\t\t\treturn &d->node.node;\n+\treturn NULL;\n+}\n+\n+const struct device_node *\n+of_get_parent(const struct device_node *dev_node)\n+{\n+\tconst struct dt_dir *d;\n+\n+\tDPAA_BUS_HWWARN(!alive, \"Device-tree driver not initialised!\");\n+\n+\tif (!dev_node)\n+\t\treturn NULL;\n+\td = node2dir(dev_node);\n+\tif (!d->parent)\n+\t\treturn NULL;\n+\treturn &d->parent->node.node;\n+}\n+\n+const struct device_node *\n+of_get_next_child(const struct device_node *dev_node,\n+\t\t  const struct device_node *prev)\n+{\n+\tconst struct dt_dir *p, *c;\n+\n+\tDPAA_BUS_HWWARN(!alive, \"Device-tree driver not initialised!\");\n+\n+\tif (!dev_node)\n+\t\treturn NULL;\n+\tp = node2dir(dev_node);\n+\tif (prev) {\n+\t\tc = node2dir(prev);\n+\t\tDPAA_BUS_HWWARN((c->parent != p), \"Parent/child mismatch\");\n+\t\tif (c->parent != p)\n+\t\t\treturn NULL;\n+\t\tif (c->node.list.next == &p->subdirs)\n+\t\t\t/* prev was the last child */\n+\t\t\treturn NULL;\n+\t\tc = list_entry(c->node.list.next, struct dt_dir, node.list);\n+\t\treturn &c->node.node;\n+\t}\n+\t/* Return first child */\n+\tif (list_empty(&p->subdirs))\n+\t\treturn NULL;\n+\tc = list_entry(p->subdirs.next, struct dt_dir, node.list);\n+\treturn &c->node.node;\n+}\n+\n+uint32_t\n+of_n_addr_cells(const struct device_node *dev_node)\n+{\n+\tconst struct dt_dir *d;\n+\n+\tDPAA_BUS_HWWARN(!alive, \"Device-tree driver not initialised\");\n+\tif (!dev_node)\n+\t\treturn OF_DEFAULT_NA;\n+\td = node2dir(dev_node);\n+\twhile ((d = d->parent))\n+\t\tif (d->a_cells) {\n+\t\t\tunsigned char *buf =\n+\t\t\t\t(unsigned char *)&d->a_cells->buf[0];\n+\t\t\tassert(d->a_cells->len == 4);\n+\t\t\treturn ((uint32_t)buf[0] << 24) |\n+\t\t\t\t((uint32_t)buf[1] << 16) |\n+\t\t\t\t((uint32_t)buf[2] << 8) |\n+\t\t\t\t(uint32_t)buf[3];\n+\t\t}\n+\treturn OF_DEFAULT_NA;\n+}\n+\n+uint32_t\n+of_n_size_cells(const struct device_node *dev_node)\n+{\n+\tconst struct dt_dir *d;\n+\n+\tDPAA_BUS_HWWARN(!alive, \"Device-tree driver not initialised!\");\n+\tif (!dev_node)\n+\t\treturn OF_DEFAULT_NA;\n+\td = node2dir(dev_node);\n+\twhile ((d = d->parent))\n+\t\tif (d->s_cells) {\n+\t\t\tunsigned char *buf =\n+\t\t\t\t(unsigned char *)&d->s_cells->buf[0];\n+\t\t\tassert(d->s_cells->len == 4);\n+\t\t\treturn ((uint32_t)buf[0] << 24) |\n+\t\t\t\t((uint32_t)buf[1] << 16) |\n+\t\t\t\t((uint32_t)buf[2] << 8) |\n+\t\t\t\t(uint32_t)buf[3];\n+\t\t}\n+\treturn OF_DEFAULT_NS;\n+}\n+\n+const uint32_t *\n+of_get_address(const struct device_node *dev_node, size_t idx,\n+\t       uint64_t *size, uint32_t *flags __rte_unused)\n+{\n+\tconst struct dt_dir *d;\n+\tconst unsigned char *buf;\n+\tuint32_t na = of_n_addr_cells(dev_node);\n+\tuint32_t ns = of_n_size_cells(dev_node);\n+\n+\tif (!dev_node)\n+\t\td = &root_dir;\n+\telse\n+\t\td = node2dir(dev_node);\n+\tif (!d->reg)\n+\t\treturn NULL;\n+\tassert(d->reg->len % ((na + ns) * 4) == 0);\n+\tassert(d->reg->len / ((na + ns) * 4) > (unsigned int) idx);\n+\tbuf = (const unsigned char *)&d->reg->buf[0];\n+\tbuf += (na + ns) * idx * 4;\n+\tif (size)\n+\t\tfor (*size = 0; ns > 0; ns--, na++)\n+\t\t\t*size = (*size << 32) +\n+\t\t\t\t(((uint32_t)buf[4 * na] << 24) |\n+\t\t\t\t((uint32_t)buf[4 * na + 1] << 16) |\n+\t\t\t\t((uint32_t)buf[4 * na + 2] << 8) |\n+\t\t\t\t(uint32_t)buf[4 * na + 3]);\n+\treturn (const uint32_t *)buf;\n+}\n+\n+uint64_t\n+of_translate_address(const struct device_node *dev_node,\n+\t\t     const uint32_t *addr)\n+{\n+\tuint64_t phys_addr, tmp_addr;\n+\tconst struct device_node *parent;\n+\tconst uint32_t *ranges;\n+\tsize_t rlen;\n+\tuint32_t na, pna;\n+\n+\tDPAA_BUS_HWWARN(!alive, \"Device-tree driver not initialised!\");\n+\tassert(dev_node != NULL);\n+\n+\tna = of_n_addr_cells(dev_node);\n+\tphys_addr = of_read_number(addr, na);\n+\n+\tdev_node = of_get_parent(dev_node);\n+\tif (!dev_node)\n+\t\treturn 0;\n+\telse if (node2dir(dev_node) == &root_dir)\n+\t\treturn phys_addr;\n+\n+\tdo {\n+\t\tpna = of_n_addr_cells(dev_node);\n+\t\tparent = of_get_parent(dev_node);\n+\t\tif (!parent)\n+\t\t\treturn 0;\n+\n+\t\tranges = of_get_property(dev_node, \"ranges\", &rlen);\n+\t\t/* \"ranges\" property is missing. Translation breaks */\n+\t\tif (!ranges)\n+\t\t\treturn 0;\n+\t\t/* \"ranges\" property is empty. Do 1:1 translation */\n+\t\telse if (rlen == 0)\n+\t\t\tcontinue;\n+\t\telse\n+\t\t\ttmp_addr = of_read_number(ranges + na, pna);\n+\n+\t\tna = pna;\n+\t\tdev_node = parent;\n+\t\tphys_addr += tmp_addr;\n+\t} while (node2dir(parent) != &root_dir);\n+\n+\treturn phys_addr;\n+}\n+\n+bool\n+of_device_is_compatible(const struct device_node *dev_node,\n+\t\t\tconst char *compatible)\n+{\n+\tconst struct dt_dir *d;\n+\n+\tDPAA_BUS_HWWARN(!alive, \"Device-tree driver not initialised!\");\n+\tif (!dev_node)\n+\t\td = &root_dir;\n+\telse\n+\t\td = node2dir(dev_node);\n+\tif (d->compatible && check_compatible(d->compatible, compatible))\n+\t\treturn true;\n+\treturn false;\n+}\ndiff --git a/drivers/bus/dpaa/include/of.h b/drivers/bus/dpaa/include/of.h\nnew file mode 100644\nindex 0000000..2984b1e\n--- /dev/null\n+++ b/drivers/bus/dpaa/include/of.h\n@@ -0,0 +1,190 @@\n+/*-\n+ * This file is provided under a dual BSD/GPLv2 license. When using or\n+ * redistributing this file, you may do so under either license.\n+ *\n+ *   BSD LICENSE\n+ *\n+ * Copyright 2010-2016 Freescale Semiconductor, Inc.\n+ * Copyright 2017 NXP.\n+ *\n+ * Redistribution and use in source and binary forms, with or without\n+ * modification, are permitted provided that the following conditions are met:\n+ * * Redistributions of source code must retain the above copyright\n+ * notice, this list of conditions and the following disclaimer.\n+ * * Redistributions in binary form must reproduce the above copyright\n+ * notice, this list of conditions and the following disclaimer in the\n+ * documentation and/or other materials provided with the distribution.\n+ * * Neither the name of the above-listed copyright holders nor the\n+ * names of any contributors may be used to endorse or promote products\n+ * derived from this software without specific prior written permission.\n+ *\n+ *   GPL LICENSE SUMMARY\n+ *\n+ * ALTERNATIVELY, this software may be distributed under the terms of the\n+ * GNU General Public License (\"GPL\") as published by the Free Software\n+ * Foundation, either version 2 of that License or (at your option) any\n+ * later version.\n+ *\n+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE\n+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n+ * POSSIBILITY OF SUCH DAMAGE.\n+ */\n+\n+#ifndef __OF_H\n+#define\t__OF_H\n+\n+#include <compat.h>\n+\n+#ifndef OF_INIT_DEFAULT_PATH\n+#define OF_INIT_DEFAULT_PATH \"/proc/device-tree\"\n+#endif\n+\n+#define OF_DEFAULT_NA 1\n+#define OF_DEFAULT_NS 1\n+\n+#define OF_FILE_BUF_MAX 256\n+\n+/**\n+ * Layout of Device Tree:\n+ * dt_dir\n+ *  |- dt_dir\n+ *  |   |- dt_dir\n+ *  |   |  |- dt_dir\n+ *  |   |  |  |- dt_file\n+ *  |   |  |  ``- dt_file\n+ *  |   |  ``- dt_file\n+ *  |   `-dt_file`\n+ *  ``- dt_file\n+ *\n+ *  +------------------+\n+ *  |dt_dir            |\n+ *  |+----------------+|\n+ *  ||dt_node         ||\n+ *  ||+--------------+||\n+ *  |||device_node   |||\n+ *  ||+--------------+||\n+ *  || list_dt_nodes  ||\n+ *  |+----------------+|\n+ *  | list of subdir   |\n+ *  | list of files    |\n+ *  +------------------+\n+ */\n+\n+/**\n+ * Device description on of a device node in device tree.\n+ */\n+struct device_node {\n+\tchar name[NAME_MAX];\n+\tchar full_name[PATH_MAX];\n+};\n+\n+/**\n+ * List of device nodes available in a device tree layout\n+ */\n+struct dt_node {\n+\tstruct device_node node; /**< Property of node */\n+\tint is_file; /**< FALSE==dir, TRUE==file */\n+\tstruct list_head list; /**< Nodes within a parent subdir */\n+};\n+\n+/**\n+ * Types we use to represent directories and files\n+ */\n+struct dt_file;\n+struct dt_dir {\n+\tstruct dt_node node;\n+\tstruct list_head subdirs;\n+\tstruct list_head files;\n+\tstruct list_head linear;\n+\tstruct dt_dir *parent;\n+\tstruct dt_file *compatible;\n+\tstruct dt_file *status;\n+\tstruct dt_file *lphandle;\n+\tstruct dt_file *a_cells;\n+\tstruct dt_file *s_cells;\n+\tstruct dt_file *reg;\n+};\n+\n+struct dt_file {\n+\tstruct dt_node node;\n+\tstruct dt_dir *parent;\n+\tssize_t len;\n+\tuint64_t buf[OF_FILE_BUF_MAX >> 3];\n+};\n+\n+const struct device_node *of_find_compatible_node(\n+\t\t\t\t\tconst struct device_node *from,\n+\t\t\t\t\tconst char *type __always_unused,\n+\t\t\t\t\tconst char *compatible)\n+\t__attribute__((nonnull(3)));\n+\n+#define for_each_compatible_node(dev_node, type, compatible) \\\n+\tfor (dev_node = of_find_compatible_node(NULL, type, compatible); \\\n+\t\tdev_node != NULL; \\\n+\t\tdev_node = of_find_compatible_node(dev_node, type, compatible))\n+\n+const void *of_get_property(const struct device_node *from, const char *name,\n+\t\t\t    size_t *lenp) __attribute__((nonnull(2)));\n+bool of_device_is_available(const struct device_node *dev_node);\n+\n+const struct device_node *of_find_node_by_phandle(phandle ph);\n+\n+const struct device_node *of_get_parent(const struct device_node *dev_node);\n+\n+const struct device_node *of_get_next_child(const struct device_node *dev_node,\n+\t\t\t\t\t    const struct device_node *prev);\n+\n+#define for_each_child_node(parent, child) \\\n+\tfor (child = of_get_next_child(parent, NULL); child != NULL; \\\n+\t\t\tchild = of_get_next_child(parent, child))\n+\n+uint32_t of_n_addr_cells(const struct device_node *dev_node);\n+uint32_t of_n_size_cells(const struct device_node *dev_node);\n+\n+const uint32_t *of_get_address(const struct device_node *dev_node, size_t idx,\n+\t\t\t       uint64_t *size, uint32_t *flags);\n+\n+uint64_t of_translate_address(const struct device_node *dev_node,\n+\t\t\t      const u32 *addr) __attribute__((nonnull));\n+\n+bool of_device_is_compatible(const struct device_node *dev_node,\n+\t\t\t     const char *compatible);\n+\n+/* of_init() must be called prior to initialisation or use of any driver\n+ * subsystem that is device-tree-dependent. Eg. Qman/Bman, config layers, etc.\n+ * The path should usually be \"/proc/device-tree\".\n+ */\n+int of_init_path(const char *dt_path);\n+\n+/* of_finish() allows a controlled tear-down of the device-tree layer, eg. if a\n+ * full reload is desired without a process exit.\n+ */\n+void of_finish(void);\n+\n+/* Use of this wrapper is recommended. */\n+static inline int of_init(void)\n+{\n+\treturn of_init_path(OF_INIT_DEFAULT_PATH);\n+}\n+\n+/* Read a numeric property according to its size and return it as a 64-bit\n+ * value.\n+ */\n+static inline uint64_t of_read_number(const __be32 *cell, int size)\n+{\n+\tuint64_t r = 0;\n+\n+\twhile (size--)\n+\t\tr = (r << 32) | be32toh(*(cell++));\n+\treturn r;\n+}\n+\n+#endif\t/*  __OF_H */\n",
    "prefixes": [
        "dpdk-dev",
        "v5",
        "04/40"
    ]
}