All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Warren <swarren@wwwdotorg.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 02/11] lib: fdtdec: fix size cell and address cell parse from DT
Date: Sat, 9 Apr 2016 21:41:38 -0600	[thread overview]
Message-ID: <5709CB72.1000503@wwwdotorg.org> (raw)
In-Reply-To: <CAPnjgZ1NKBhqNrY5ybhmpCViOskR4MrCBhvdtL4ZbEWr8fa96A@mail.gmail.com>

On 04/09/2016 12:35 PM, Simon Glass wrote:
> +Stephen
>
> Hi Mugunthan,
>
> On 7 April 2016 at 09:17, Mugunthan V N <mugunthanvnm@ti.com> wrote:
>> Size cell and address cell should be read from the parent node
>> and should not assume with data structures as an example
>> TI DRA7xx SoC is enabled as 64bit as there is LPAE support
>> but the addresses specified in DT are all 32 bit sizes. So
>> changing the code to read from parent node instead of
>> calculations.
>
> I don't understand this. Can you please reword it and shorten the sentences?

>> diff --git a/lib/fdtdec.c b/lib/fdtdec.c
>> index 70acc29..8a5fb8c 100644
>> --- a/lib/fdtdec.c
>> +++ b/lib/fdtdec.c
>> @@ -88,15 +88,20 @@ fdt_addr_t fdtdec_get_addr_size_fixed(const void *blob, int node,
>>          const fdt32_t *prop_addr, *prop_size, *prop_after_size;
>>          int len;
>>          fdt_addr_t addr;
>> +       int parent;
>>
>>          debug("%s: %s: ", __func__, prop_name);
>>
>> -       if (na > (sizeof(fdt_addr_t) / sizeof(fdt32_t))) {
>> +       parent = fdt_parent_offset(blob, node);
>
> This is a very slow function. I hope this changes is not needed.
>
>> +
>> +       na = fdt_address_cells(blob, parent);
>> +       if (na < 1) {
>>                  debug("(na too large for fdt_addr_t type)\n");
>>                  return FDT_ADDR_T_NONE;
>>          }
>>
>> -       if (ns > (sizeof(fdt_size_t) / sizeof(fdt32_t))) {
>> +       ns = fdt_size_cells(blob, parent);
>> +       if (ns < 0) {
>>                  debug("(ns too large for fdt_size_t type)\n");
>>                  return FDT_ADDR_T_NONE;
>>          }

The entire point of fdtdec_get_addr_size_fixed() is for use-cases where 
na and ns are known and fixed ahead of time, or have already been 
retrieved from the parent node by the caller. This patch is incorrect. I 
expect the correct fix is to call e.g. 
fdtdec_get_addr_size_auto_parent() or 
fdtdec_get_addr_size_auto_noparent() from somewhere, rather than calling 
fdtdec_get_addr_size_fixed().

  reply	other threads:[~2016-04-10  3:41 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-07 15:16 [U-Boot] [PATCH 00/11] cpsw: enable DM_ETH on dra74 and am437x evms Mugunthan V N
2016-04-07 15:17 ` [U-Boot] [PATCH 01/11] drivers: core: device: add support to check dt compatible for a device/machine Mugunthan V N
2016-04-09 18:35   ` Simon Glass
2016-04-07 15:17 ` [U-Boot] [PATCH 02/11] lib: fdtdec: fix size cell and address cell parse from DT Mugunthan V N
2016-04-09 18:35   ` Simon Glass
2016-04-10  3:41     ` Stephen Warren [this message]
2016-04-11  5:52       ` Mugunthan V N
2016-04-07 15:17 ` [U-Boot] [PATCH 03/11] ti_omap5_common: eth: do not define DM_ETH for spl Mugunthan V N
2016-04-09 18:35   ` Simon Glass
2016-04-11  5:54     ` Mugunthan V N
2016-04-11 15:01   ` Tom Rini
2016-04-07 15:17 ` [U-Boot] [PATCH 04/11] drivers: net: cpsw: fix cpsw dp parse when num slaves as 1 Mugunthan V N
2016-04-11 15:01   ` Tom Rini
2016-04-07 15:17 ` [U-Boot] [PATCH 05/11] ARM: omap5: add platform specific ethernet phy modes configurations Mugunthan V N
2016-04-11 15:01   ` Tom Rini
2016-04-07 15:17 ` [U-Boot] [PATCH 06/11] drivers: net: cpsw: add support for reading mac address from efuse Mugunthan V N
2016-04-11 15:01   ` Tom Rini
2016-04-12  4:24     ` Mugunthan V N
2016-04-12 14:51       ` Tom Rini
2016-04-07 15:17 ` [U-Boot] [PATCH 07/11] arm: dts: am4372: add syscon node to cpsw to read mac address Mugunthan V N
2016-04-11 15:01   ` Tom Rini
2016-04-07 15:17 ` [U-Boot] [PATCH 08/11] arm: dts: dra7: " Mugunthan V N
2016-04-11 15:01   ` Tom Rini
2016-04-07 15:17 ` [U-Boot] [PATCH 09/11] defconfig: am437x_gp_evm: enable eth driver model Mugunthan V N
2016-04-11 15:01   ` Tom Rini
2016-04-07 15:17 ` [U-Boot] [PATCH 10/11] defconfig: am437x_sk_evm: " Mugunthan V N
2016-04-11 15:01   ` Tom Rini
2016-04-07 15:17 ` [U-Boot] [PATCH 11/11] defconfig: dra74_evm: " Mugunthan V N
2016-04-11 15:02   ` Tom Rini

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=5709CB72.1000503@wwwdotorg.org \
    --to=swarren@wwwdotorg.org \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.