From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Warren Date: Tue, 04 Aug 2015 09:23:27 -0600 Subject: [U-Boot] [PATCH] fdt: Fix fdtdec_get_addr_size() for 64-bit In-Reply-To: <20150804142628.GA3812@ulmo.nvidia.com> References: <1437670290-25660-1-git-send-email-swarren@wwwdotorg.org> <20150804142628.GA3812@ulmo.nvidia.com> Message-ID: <55C0D8EF.2060702@wwwdotorg.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 08/04/2015 08:26 AM, Thierry Reding wrote: ... [ discussion of new fdtdec_get_addr_size() implementation] > So what this does is really fix parsing of address and size cells in the > general case, though it would still fail for values of #address-cells or > #size-cells bigger than 2 (because we don't have a datatype that would > be able to contain such large values). > > Note that there's also still a corner case that this doesn't handle. The > DT specification states, if I remember correctly, that #address-cells > and #size-cells are inherited. That means with the current code we will > wrongly parse something like this: > > / { > ... > #address-cells = <1>; > #size-cells = <1>; > ... > bus at XXXXXXXX { > ... > device at XXXXXXXX { > ... > reg = <0xXXXXXXXX 0x1000>; > ... > }; > ... > }; > ... > }; > > According to the DT specification the bus at XXXXXXXX node would inherit > #address-cells = <1> and #size-cells = <1> from the root node. However > with libfdt what really happens is that since bus at XXXXXXXX does not have > either property it will default to 2 in both cases. I'm not sure if this > really is a problem. Typically nodes are not nested that deeply, or if > they are then, typically, they explicitly contain #address-cells and > #size-cells properties. I don't think #address-cells/#size-cells do actually get inherited. Admittedly some other properties (e.g. interrupt-parent) do, but according to: https://lists.ozlabs.org/pipermail/linuxppc-dev/2008-January/049113.html [PATCH] powerpc: #address-cells & #size-cells properties not inherited ... and my vague memory, these two don't. You can search Google for e.g. "#address-cells inherited" and find a number of similar assertions.