From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thierry Reding Date: Tue, 4 Aug 2015 17:36:26 +0200 Subject: [U-Boot] [PATCH] fdt: Fix fdtdec_get_addr_size() for 64-bit In-Reply-To: <55C0D8EF.2060702@wwwdotorg.org> References: <1437670290-25660-1-git-send-email-swarren@wwwdotorg.org> <20150804142628.GA3812@ulmo.nvidia.com> <55C0D8EF.2060702@wwwdotorg.org> Message-ID: <20150804153625.GG3812@ulmo.nvidia.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Tue, Aug 04, 2015 at 09:23:27AM -0600, Stephen Warren wrote: > 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. Okay, that's good. It means there's not even a corner case. =) Thierry -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: