[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Minios-devel] [UNIKRAFT PATCHv4 4/9] plat/common: Introduce fdt_{address, size}_cells_or_parent helpers



Hi Julien

On 2019/4/10 16:54, Julien Grall wrote:
On 10/04/2019 06:43, Jia He wrote:
Hi Sharan

After I dig more on it, I would like to rework this patch 4/9.

Please see the comments from libfdt author [1]

"

   * #address-cells and #size-cells describe the format of addresses
     for children of this node, not this node itself.  So if you're
     looking to parse 'reg' for this node, you *always* need to look at
     the parent, not just as a fallback.

   * #address-cells and #size-cells are *not* inherited.  If they're
     missing in a node, then the format for its children's addresses is
     2 cell addresses and 2 cell sizes, it is *not* correct to look at
     the next parent up for these properties.
"

As I pointed out earlier on, the Device-Tree spec requires to return 1 is #size-cells is missing. This is different from the libfdt implementation. So ...

Yes, seems at this point the author's comment is different from the latest spec

I will follow the latest spec as you suggested.


So, seems I should

parent = fdt_parent_offset(fdt, nodeoffset);
naddr = fdt_address_cells(parent, nodeoffset);
nsize = fdt_size_cells(parent, nodeoffset);

... this would return the wrong value if #size-cells is no present.

But as told by the author,

"If they're missing in a node, then the format for its children's addresses is
 2 cell addresses and 2 cell sizes"

The fdt_size_cells will return 2(current) or 1(after fixing) when #size-cells

is no present.


---
Cheers,
Justin (Jia He)


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.