From: David Gibson <david@gibson.dropbear.id.au>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Frank Rowand <frowand.list@gmail.com>,
Rob Herring <robh+dt@kernel.org>,
Pantelis Antoniou <pantelis.antoniou@konsulko.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Masahiro Yamada <masahiroy@kernel.org>,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
Bill Mills <bill.mills@linaro.org>,
anmar.oueja@linaro.org
Subject: Re: [PATCH V5 3/5] scripts: dtc: Remove the unused fdtdump.c file
Date: Thu, 21 Jan 2021 11:44:57 +1100 [thread overview]
Message-ID: <20210121004457.GD5174@yekko.fritz.box> (raw)
In-Reply-To: <f63b3fd7fadf8912e8e7e8653df45b5b78f5d005.1611124778.git.viresh.kumar@linaro.org>
[-- Attachment #1: Type: text/plain, Size: 5383 bytes --]
On Wed, Jan 20, 2021 at 12:36:45PM +0530, Viresh Kumar wrote:
> This was copied from external DTC repository long back and isn't used
> anymore. Over that the dtc tool can be used to generate the dts source
> back from the dtb. Remove the unused fdtdump.c file.
>
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Doesn't this make updating the kernel dtc from upstream needlessly
more difficult?
> ---
> scripts/dtc/fdtdump.c | 163 ------------------------------------------
> 1 file changed, 163 deletions(-)
> delete mode 100644 scripts/dtc/fdtdump.c
>
> diff --git a/scripts/dtc/fdtdump.c b/scripts/dtc/fdtdump.c
> deleted file mode 100644
> index 7d460a50b513..000000000000
> --- a/scripts/dtc/fdtdump.c
> +++ /dev/null
> @@ -1,163 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0
> -/*
> - * fdtdump.c - Contributed by Pantelis Antoniou <pantelis.antoniou AT gmail.com>
> - */
> -
> -#include <stdint.h>
> -#include <stdio.h>
> -#include <stdlib.h>
> -#include <string.h>
> -#include <ctype.h>
> -
> -#include <fdt.h>
> -#include <libfdt_env.h>
> -
> -#include "util.h"
> -
> -#define ALIGN(x, a) (((x) + ((a) - 1)) & ~((a) - 1))
> -#define PALIGN(p, a) ((void *)(ALIGN((unsigned long)(p), (a))))
> -#define GET_CELL(p) (p += 4, *((const uint32_t *)(p-4)))
> -
> -static void print_data(const char *data, int len)
> -{
> - int i;
> - const char *p = data;
> -
> - /* no data, don't print */
> - if (len == 0)
> - return;
> -
> - if (util_is_printable_string(data, len)) {
> - printf(" = \"%s\"", (const char *)data);
> - } else if ((len % 4) == 0) {
> - printf(" = <");
> - for (i = 0; i < len; i += 4)
> - printf("0x%08x%s", fdt32_to_cpu(GET_CELL(p)),
> - i < (len - 4) ? " " : "");
> - printf(">");
> - } else {
> - printf(" = [");
> - for (i = 0; i < len; i++)
> - printf("%02x%s", *p++, i < len - 1 ? " " : "");
> - printf("]");
> - }
> -}
> -
> -static void dump_blob(void *blob)
> -{
> - struct fdt_header *bph = blob;
> - uint32_t off_mem_rsvmap = fdt32_to_cpu(bph->off_mem_rsvmap);
> - uint32_t off_dt = fdt32_to_cpu(bph->off_dt_struct);
> - uint32_t off_str = fdt32_to_cpu(bph->off_dt_strings);
> - struct fdt_reserve_entry *p_rsvmap =
> - (struct fdt_reserve_entry *)((char *)blob + off_mem_rsvmap);
> - const char *p_struct = (const char *)blob + off_dt;
> - const char *p_strings = (const char *)blob + off_str;
> - uint32_t version = fdt32_to_cpu(bph->version);
> - uint32_t totalsize = fdt32_to_cpu(bph->totalsize);
> - uint32_t tag;
> - const char *p, *s, *t;
> - int depth, sz, shift;
> - int i;
> - uint64_t addr, size;
> -
> - depth = 0;
> - shift = 4;
> -
> - printf("/dts-v1/;\n");
> - printf("// magic:\t\t0x%x\n", fdt32_to_cpu(bph->magic));
> - printf("// totalsize:\t\t0x%x (%d)\n", totalsize, totalsize);
> - printf("// off_dt_struct:\t0x%x\n", off_dt);
> - printf("// off_dt_strings:\t0x%x\n", off_str);
> - printf("// off_mem_rsvmap:\t0x%x\n", off_mem_rsvmap);
> - printf("// version:\t\t%d\n", version);
> - printf("// last_comp_version:\t%d\n",
> - fdt32_to_cpu(bph->last_comp_version));
> - if (version >= 2)
> - printf("// boot_cpuid_phys:\t0x%x\n",
> - fdt32_to_cpu(bph->boot_cpuid_phys));
> -
> - if (version >= 3)
> - printf("// size_dt_strings:\t0x%x\n",
> - fdt32_to_cpu(bph->size_dt_strings));
> - if (version >= 17)
> - printf("// size_dt_struct:\t0x%x\n",
> - fdt32_to_cpu(bph->size_dt_struct));
> - printf("\n");
> -
> - for (i = 0; ; i++) {
> - addr = fdt64_to_cpu(p_rsvmap[i].address);
> - size = fdt64_to_cpu(p_rsvmap[i].size);
> - if (addr == 0 && size == 0)
> - break;
> -
> - printf("/memreserve/ %llx %llx;\n",
> - (unsigned long long)addr, (unsigned long long)size);
> - }
> -
> - p = p_struct;
> - while ((tag = fdt32_to_cpu(GET_CELL(p))) != FDT_END) {
> -
> - /* printf("tag: 0x%08x (%d)\n", tag, p - p_struct); */
> -
> - if (tag == FDT_BEGIN_NODE) {
> - s = p;
> - p = PALIGN(p + strlen(s) + 1, 4);
> -
> - if (*s == '\0')
> - s = "/";
> -
> - printf("%*s%s {\n", depth * shift, "", s);
> -
> - depth++;
> - continue;
> - }
> -
> - if (tag == FDT_END_NODE) {
> - depth--;
> -
> - printf("%*s};\n", depth * shift, "");
> - continue;
> - }
> -
> - if (tag == FDT_NOP) {
> - printf("%*s// [NOP]\n", depth * shift, "");
> - continue;
> - }
> -
> - if (tag != FDT_PROP) {
> - fprintf(stderr, "%*s ** Unknown tag 0x%08x\n", depth * shift, "", tag);
> - break;
> - }
> - sz = fdt32_to_cpu(GET_CELL(p));
> - s = p_strings + fdt32_to_cpu(GET_CELL(p));
> - if (version < 16 && sz >= 8)
> - p = PALIGN(p, 8);
> - t = p;
> -
> - p = PALIGN(p + sz, 4);
> -
> - printf("%*s%s", depth * shift, "", s);
> - print_data(t, sz);
> - printf(";\n");
> - }
> -}
> -
> -
> -int main(int argc, char *argv[])
> -{
> - char *buf;
> -
> - if (argc < 2) {
> - fprintf(stderr, "supply input filename\n");
> - return 5;
> - }
> -
> - buf = utilfdt_read(argv[1]);
> - if (buf)
> - dump_blob(buf);
> - else
> - return 10;
> -
> - return 0;
> -}
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2021-01-21 2:35 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-20 7:06 [PATCH V5 0/5] dt: build overlays Viresh Kumar
2021-01-20 7:06 ` [PATCH V5 1/5] scripts: dtc: Fetch fdtoverlay.c from external DTC project Viresh Kumar
2021-01-20 7:06 ` [PATCH V5 2/5] scripts: dtc: Build fdtoverlay tool Viresh Kumar
2021-01-20 7:06 ` [PATCH V5 3/5] scripts: dtc: Remove the unused fdtdump.c file Viresh Kumar
2021-01-21 0:44 ` David Gibson [this message]
2021-01-21 4:17 ` Viresh Kumar
2021-01-21 6:26 ` David Gibson
2021-01-21 14:18 ` Rob Herring
2021-01-20 7:06 ` [PATCH V5 4/5] kbuild: Add support to build overlays (%.dtbo) Viresh Kumar
2021-01-20 8:58 ` Masahiro Yamada
2021-01-20 9:55 ` Viresh Kumar
2021-01-20 11:04 ` Masahiro Yamada
2021-01-20 11:27 ` Viresh Kumar
2021-01-21 0:49 ` David Gibson
2021-01-21 4:13 ` Viresh Kumar
2021-01-21 5:40 ` Frank Rowand
2021-01-21 6:25 ` David Gibson
2021-01-20 7:06 ` [PATCH V5 5/5] of: unittest: Statically apply overlays using fdtoverlay Viresh Kumar
2021-01-21 0:51 ` David Gibson
2021-01-21 5:14 ` Frank Rowand
2021-01-21 5:34 ` Viresh Kumar
2021-01-21 5:45 ` Frank Rowand
2021-01-21 5:50 ` Viresh Kumar
2021-01-21 6:36 ` David Gibson
2021-01-21 6:34 ` David Gibson
2021-01-21 6:57 ` Viresh Kumar
2021-01-21 23:39 ` David Gibson
2021-01-22 3:10 ` Viresh Kumar
2021-01-22 4:27 ` David Gibson
2021-01-21 5:34 ` Frank Rowand
2021-01-21 5:43 ` Viresh Kumar
2021-01-21 5:55 ` Frank Rowand
2021-01-21 5:58 ` Viresh Kumar
2021-01-21 7:04 ` Frank Rowand
2021-01-21 23:41 ` David Gibson
2021-01-21 6:37 ` David Gibson
2021-01-20 15:43 ` [PATCH V5 0/5] dt: build overlays Rob Herring
2021-01-21 4:14 ` Viresh Kumar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210121004457.GD5174@yekko.fritz.box \
--to=david@gibson.dropbear.id.au \
--cc=anmar.oueja@linaro.org \
--cc=bill.mills@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=frowand.list@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=pantelis.antoniou@konsulko.com \
--cc=robh+dt@kernel.org \
--cc=vincent.guittot@linaro.org \
--cc=viresh.kumar@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).