Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/807289/?format=api
{ "id": 807289, "url": "http://patchwork.ozlabs.org/api/patches/807289/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/20170829201601.64312-15-sjg@chromium.org/", "project": { "id": 18, "url": "http://patchwork.ozlabs.org/api/projects/18/?format=api", "name": "U-Boot", "link_name": "uboot", "list_id": "u-boot.lists.denx.de", "list_email": "u-boot@lists.denx.de", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20170829201601.64312-15-sjg@chromium.org>", "list_archive_url": null, "date": "2017-08-29T20:15:59", "name": "[U-Boot,v2,14/16] dtoc: Support properties containing multiple phandle values", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "84cc1fecaa95a2ae8754550c4a041f2acaf2c9c0", "submitter": { "id": 6170, "url": "http://patchwork.ozlabs.org/api/people/6170/?format=api", "name": "Simon Glass", "email": "sjg@chromium.org" }, "delegate": { "id": 3184, "url": "http://patchwork.ozlabs.org/api/users/3184/?format=api", "username": "sjg", "first_name": "Simon", "last_name": "Glass", "email": "sjg@chromium.org" }, "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/20170829201601.64312-15-sjg@chromium.org/mbox/", "series": [ { "id": 462, "url": "http://patchwork.ozlabs.org/api/series/462/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/list/?series=462", "date": "2017-08-29T20:15:45", "name": "dtoc: Add support for 64-bit addresses", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/462/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/807289/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/807289/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<u-boot-bounces@lists.denx.de>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org", "Authentication-Results": [ "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)", "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=google.com header.i=@google.com\n\theader.b=\"wPv5O/mZ\"; dkim-atps=neutral" ], "Received": [ "from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xhgKz4kZYz9s72\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 30 Aug 2017 06:32:23 +1000 (AEST)", "by lists.denx.de (Postfix, from userid 105)\n\tid 64D02C22453; Tue, 29 Aug 2017 20:24:06 +0000 (UTC)", "from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 97CCBC225DE;\n\tTue, 29 Aug 2017 20:18:28 +0000 (UTC)", "by lists.denx.de (Postfix, from userid 105)\n\tid CFC8CC22542; Tue, 29 Aug 2017 20:16:32 +0000 (UTC)", "from mail-oi0-f50.google.com (mail-oi0-f50.google.com\n\t[209.85.218.50])\n\tby lists.denx.de (Postfix) with ESMTPS id C3998C225A6\n\tfor <u-boot@lists.denx.de>; Tue, 29 Aug 2017 20:16:27 +0000 (UTC)", "by mail-oi0-f50.google.com with SMTP id r203so36450688oih.0\n\tfor <u-boot@lists.denx.de>; Tue, 29 Aug 2017 13:16:27 -0700 (PDT)", "from kiwi.bld.corp.google.com ([2620:0:10f2:0:e46b:9284:3d4c:e46e])\n\tby smtp.gmail.com with ESMTPSA id\n\tk129sm3830245oif.10.2017.08.29.13.16.21\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tTue, 29 Aug 2017 13:16:24 -0700 (PDT)", "by kiwi.bld.corp.google.com (Postfix, from userid 121222)\n\tid 6F9C313FC5F; Tue, 29 Aug 2017 14:16:21 -0600 (MDT)" ], "X-Spam-Checker-Version": "SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de", "X-Spam-Level": "", "X-Spam-Status": "No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE,\n\tRCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,\n\tT_DKIM_INVALID autolearn=unavailable\n\tautolearn_force=no version=3.4.0", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\n\ts=20161025; \n\th=sender:from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=C2apwSXrbNURxzhxTBmHJxgVKNmqJRVjRhoIY/lcY4g=;\n\tb=wPv5O/mZu3NE13ehDWaSjoqhFXtZE10I/mGv9uYQY+sIWTuif8+dNL4XYr/oiK7udJ\n\tnNKwd9eWPffYtF9A6gcB88dx5CzA0RPE0sgD348HFluGin6+HSvcsJB9vHby/cE9G0ll\n\tQ7ZETdTfAAj43VwcUyI/W6sVDNGJX2Br/mCtd1K6Z6+ogSakA80bi4adntFZ6RpzG4nn\n\tz+dI3xA3+HwJz86toxDngtjhdw9bMtPJzhwTz4lJIWVfQp6dk84aD4lxf0QlADVwNQaT\n\tOLya3V9BW30TjdFlSr/kOwEiCiHezJ3gDqtkYfF8u6uczWhfajXGowluyUJ6QUHlEvNa\n\tXxFA==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:sender:from:to:cc:subject:date:message-id\n\t:in-reply-to:references;\n\tbh=C2apwSXrbNURxzhxTBmHJxgVKNmqJRVjRhoIY/lcY4g=;\n\tb=sLU9hO5gzChoGmaQwRVp5nQh7FRvkEez7oeN/9oUUQTEVIfiWpR371SAZbJYyXRN12\n\t2iICp93P6DDxO8R8Fhyf4ALHfFSRNJT6AccAT7J0wZTrv3ANmXnDEkF+drKFTCL6cDNb\n\t+3lkMIdVkMUPokHH8zLewBk02VW6BpB0yRJJ/55wRTG5c2FX6UzdqgkpmANv8c3JUR+H\n\tyKUAooUomoPlH4qxFIKxw/VEiGQTmDuOkWBIlqFAz0Vt1xZpQhO+i9RlvgLdslub04GG\n\tHR8/HAovOIm7QPNJ6wk2EEFYkZHBCZUJp6uf1oucjmMQlHKgx7ep0jFkUUiwMZNG6qNM\n\txP5A==", "X-Gm-Message-State": "AHYfb5iXz8rLCqN3VKBLe+R/dshEGkKnP+eK8pi5AYC+SeIfZGAy9G/x\n\tiEIZhkapQLNRXrqj", "X-Google-Smtp-Source": "ADKCNb7bzbf9ha2MyQhx8gKa+L9+ynCfUitwrs0MH/D06WStvDMtZ324kvPrLpAm4JxmsWJ2eNk9xg==", "X-Received": "by 10.202.46.70 with SMTP id u67mr1368111oiu.312.1504037786213; \n\tTue, 29 Aug 2017 13:16:26 -0700 (PDT)", "From": "Simon Glass <sjg@chromium.org>", "To": "U-Boot Mailing List <u-boot@lists.denx.de>", "Date": "Tue, 29 Aug 2017 14:15:59 -0600", "Message-Id": "<20170829201601.64312-15-sjg@chromium.org>", "X-Mailer": "git-send-email 2.14.1.342.g6490525c54-goog", "In-Reply-To": "<20170829201601.64312-1-sjg@chromium.org>", "References": "<20170829201601.64312-1-sjg@chromium.org>", "Cc": "Tom Rini <trini@konsulko.com>", "Subject": "[U-Boot] [PATCH v2 14/16] dtoc: Support properties containing\n\tmultiple phandle values", "X-BeenThere": "u-boot@lists.denx.de", "X-Mailman-Version": "2.1.18", "Precedence": "list", "List-Id": "U-Boot discussion <u-boot.lists.denx.de>", "List-Unsubscribe": "<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>", "List-Archive": "<http://lists.denx.de/pipermail/u-boot/>", "List-Post": "<mailto:u-boot@lists.denx.de>", "List-Help": "<mailto:u-boot-request@lists.denx.de?subject=help>", "List-Subscribe": "<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "base64", "Errors-To": "u-boot-bounces@lists.denx.de", "Sender": "\"U-Boot\" <u-boot-bounces@lists.denx.de>" }, "content": "At present dtoc has a very simplistic view of phandles. It assumes that\na property has only a single phandle with a single argument (i.e. two\ncells per property).\n\nThis is not true in many cases. Enhance the implementation to scan all\nphandles in a property and to use the correct number of arguments (which\ncan be 0, 1, 2 or more) when generating the C code. For the struct\ndefinitions, use a struct which can hold the maximum number of arguments\nused by the property.\n\nSigned-off-by: Simon Glass <sjg@chromium.org>\n---\n\nChanges in v2: None\n\n include/dt-structs.h | 5 +++++\n tools/dtoc/dtb_platdata.py | 21 ++++++++++++++-------\n tools/dtoc/dtoc_test_phandle.dts | 17 +++++++++++++++--\n tools/dtoc/test_dtoc.py | 27 ++++++++++++++++++++++++---\n 4 files changed, 58 insertions(+), 12 deletions(-)", "diff": "diff --git a/include/dt-structs.h b/include/dt-structs.h\nindex 9ab4e2524d..76979e73e1 100644\n--- a/include/dt-structs.h\n+++ b/include/dt-structs.h\n@@ -18,6 +18,11 @@ struct phandle_1_arg {\n \tconst void *node;\n \tint arg[1];\n };\n+\n+struct phandle_2_arg {\n+\tconst void *node;\n+\tint arg[2];\n+};\n #include <generated/dt-structs.h>\n #endif\n \ndiff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py\nindex 1920a59f82..cfca45b0ac 100644\n--- a/tools/dtoc/dtb_platdata.py\n+++ b/tools/dtoc/dtb_platdata.py\n@@ -394,11 +394,13 @@ class DtbPlatdata(object):\n if not isinstance(prop.value, list):\n prop.value = [prop.value]\n # Process the list as pairs of (phandle, id)\n- value_it = iter(prop.value)\n- for phandle_cell, _ in zip(value_it, value_it):\n+ pos = 0\n+ for args in info.args:\n+ phandle_cell = prop.value[pos]\n phandle = fdt_util.fdt32_to_cpu(phandle_cell)\n target_node = self._fdt.phandle_to_node[phandle]\n node.phandles.add(target_node)\n+ pos += 1 + args\n \n \n def generate_structs(self, structs):\n@@ -422,7 +424,7 @@ class DtbPlatdata(object):\n struct_name = 'struct phandle_%d_arg' % info.max_args\n self.out('\\t%s%s[%d]' % (tab_to(2, struct_name),\n conv_name_to_c(prop.name),\n- len(prop.value) / 2))\n+ len(info.args)))\n else:\n ptype = TYPE_NAMES[prop.type]\n self.out('\\t%s%s' % (tab_to(2, ptype),\n@@ -461,13 +463,18 @@ class DtbPlatdata(object):\n info = self.get_phandle_argc(prop, node.name)\n if info:\n # Process the list as pairs of (phandle, id)\n- value_it = iter(prop.value)\n- for phandle_cell, id_cell in zip(value_it, value_it):\n+ pos = 0\n+ for args in info.args:\n+ phandle_cell = prop.value[pos]\n phandle = fdt_util.fdt32_to_cpu(phandle_cell)\n- id_num = fdt_util.fdt32_to_cpu(id_cell)\n target_node = self._fdt.phandle_to_node[phandle]\n name = conv_name_to_c(target_node.name)\n- vals.append('{&%s%s, {%d}}' % (VAL_PREFIX, name, id_num))\n+ arg_values = []\n+ for i in range(args):\n+ arg_values.append(str(fdt_util.fdt32_to_cpu(prop.value[pos + 1 + i])))\n+ pos += 1 + args\n+ vals.append('\\t{&%s%s, {%s}}' % (VAL_PREFIX, name,\n+ ', '.join(arg_values)))\n for val in vals:\n self.buf('\\n\\t\\t%s,' % val)\n else:\ndiff --git a/tools/dtoc/dtoc_test_phandle.dts b/tools/dtoc/dtoc_test_phandle.dts\nindex c0a602f296..ba12b0fe65 100644\n--- a/tools/dtoc/dtoc_test_phandle.dts\n+++ b/tools/dtoc/dtoc_test_phandle.dts\n@@ -10,15 +10,28 @@\n \n / {\n \tphandle: phandle-target {\n+\t\tu-boot,dm-pre-reloc;\n+\t\tcompatible = \"target\";\n+\t\tintval = <0>;\n+ #clock-cells = <0>;\n+\t};\n+\n+\tphandle_1: phandle2-target {\n \t\tu-boot,dm-pre-reloc;\n \t\tcompatible = \"target\";\n \t\tintval = <1>;\n- #clock-cells = <1>;\n+\t\t#clock-cells = <1>;\n+\t};\n+\tphandle_2: phandle3-target {\n+\t\tu-boot,dm-pre-reloc;\n+\t\tcompatible = \"target\";\n+\t\tintval = <2>;\n+\t\t#clock-cells = <2>;\n \t};\n \n \tphandle-source {\n \t\tu-boot,dm-pre-reloc;\n \t\tcompatible = \"source\";\n-\t\tclocks = <&phandle 1>;\n+\t\tclocks = <&phandle &phandle_1 11 &phandle_2 12 13 &phandle>;\n \t};\n };\ndiff --git a/tools/dtoc/test_dtoc.py b/tools/dtoc/test_dtoc.py\nindex fbae927cf8..cc009b2a25 100644\n--- a/tools/dtoc/test_dtoc.py\n+++ b/tools/dtoc/test_dtoc.py\n@@ -228,7 +228,7 @@ U_BOOT_DEVICE(pmic_at_9) = {\n self.assertEqual('''#include <stdbool.h>\n #include <libfdt.h>\n struct dtd_source {\n-\\tstruct phandle_1_arg clocks[1];\n+\\tstruct phandle_2_arg clocks[4];\n };\n struct dtd_target {\n \\tfdt32_t\\t\\tintval;\n@@ -243,7 +243,7 @@ struct dtd_target {\n #include <dt-structs.h>\n \n static struct dtd_target dtv_phandle_target = {\n-\\t.intval\\t\\t\\t= 0x1,\n+\\t.intval\\t\\t\\t= 0x0,\n };\n U_BOOT_DEVICE(phandle_target) = {\n \\t.name\\t\\t= \"target\",\n@@ -251,9 +251,30 @@ U_BOOT_DEVICE(phandle_target) = {\n \\t.platdata_size\\t= sizeof(dtv_phandle_target),\n };\n \n+static struct dtd_target dtv_phandle2_target = {\n+\\t.intval\\t\\t\\t= 0x1,\n+};\n+U_BOOT_DEVICE(phandle2_target) = {\n+\\t.name\\t\\t= \"target\",\n+\\t.platdata\\t= &dtv_phandle2_target,\n+\\t.platdata_size\\t= sizeof(dtv_phandle2_target),\n+};\n+\n+static struct dtd_target dtv_phandle3_target = {\n+\\t.intval\\t\\t\\t= 0x2,\n+};\n+U_BOOT_DEVICE(phandle3_target) = {\n+\\t.name\\t\\t= \"target\",\n+\\t.platdata\\t= &dtv_phandle3_target,\n+\\t.platdata_size\\t= sizeof(dtv_phandle3_target),\n+};\n+\n static struct dtd_source dtv_phandle_source = {\n \\t.clocks\\t\\t\\t= {\n-\\t\\t{&dtv_phandle_target, {1}},},\n+\\t\\t\\t{&dtv_phandle_target, {}},\n+\\t\\t\\t{&dtv_phandle2_target, {11}},\n+\\t\\t\\t{&dtv_phandle3_target, {12, 13}},\n+\\t\\t\\t{&dtv_phandle_target, {}},},\n };\n U_BOOT_DEVICE(phandle_source) = {\n \\t.name\\t\\t= \"source\",\n", "prefixes": [ "U-Boot", "v2", "14/16" ] }