Skip to contentSkip to conversation

Weirdness of ofnode_get_addr_size()

DISCUSSION Jan Kiszka 4 participants 5 messages May 2, 2021 – May 4, 2021

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

Hi,

I'm trying to make some sense of ofnode_get_addr_size() in order to fix
[1] properly.

First, the documentation if this functions says "This does no address translation". But the node-pointer path happily calls of_translate_address(), as the result of a6a45cd32539. For not offset-bases path, it calls fdtdec_get_addr_size() which does no translation.

Related to [1]: The node-pointer path cleanly calls of_n_addr/size_cells() in order to retrieve the configured number of cells. But the offset-based path simply calls fdtdec_get_addr_size() which assumes that the number of cells is derived from the physical address width of that platform.

So, what is that functions actually supposed to do?

Jan

[1] https://www.mail-archive.com/u-boot at lists.denx.de/msg405446.html

#1 lore raw
Quoted 17 lines · Jan Kiszka

Hi,

I'm trying to make some sense of ofnode_get_addr_size() in order to fix
[1] properly.

First, the documentation if this functions says "This does no address translation". But the node-pointer path happily calls of_translate_address(), as the result of a6a45cd32539. For not offset-bases path, it calls fdtdec_get_addr_size() which does no translation.

Related to [1]: The node-pointer path cleanly calls of_n_addr/size_cells() in order to retrieve the configured number of cells. But the offset-based path simply calls fdtdec_get_addr_size() which assumes that the number of cells is derived from the physical address width of that platform.

Quoted 6 lines

So, what is that functions actually supposed to do?

Jan

[1] https://www.mail-archive.com/u-boot at lists.denx.de/msg405446.html

Ping - any comments welcome so that the bug(s) can be fixed, specifically [1].

Jan

Signature · 2 lines
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux
#2 lore raw
In reply to Jan Kiszka

Hi Jan,

Quoted 12 lines · Jan Kiszka

Hi,

I'm trying to make some sense of ofnode_get_addr_size() in order to fix
[1] properly.

First, the documentation if this functions says "This does no address translation". But the node-pointer path happily calls of_translate_address(), as the result of a6a45cd32539. For not offset-bases path, it calls fdtdec_get_addr_size() which does no translation.

Quoted 7 lines

Related to [1]: The node-pointer path cleanly calls of_n_addr/size_cells() in order to retrieve the configured number of cells. But the offset-based path simply calls fdtdec_get_addr_size() which assumes that the number of cells is derived from the physical address width of that platform.

So, what is that functions actually supposed to do?

+Dario Binacchi +Mario Six

I suspect the code has got ahead of the docs.

d64b9cdcd47 fdt: translate address if #size-cells = <0> e8d5291824e core: ofnode: Fix translation for #size-cells == 0

Regards,
Simon

Quoted 4 lines

Jan

[1] https://www.mail-archive.com/u-boot at lists.denx.de/msg405446.html

#3 lore raw

Hi Jan,

Quoted 24 lines

Il 04/05/2021 17:26 Simon Glass <[email protected]> ha scritto:

Hi Jan,

Quoted 18 lines · Jan Kiszka

Hi,

I'm trying to make some sense of ofnode_get_addr_size() in order to fix
[1] properly.

First, the documentation if this functions says "This does no address translation". But the node-pointer path happily calls of_translate_address(), as the result of a6a45cd32539. For not offset-bases path, it calls fdtdec_get_addr_size() which does no translation.

Related to [1]: The node-pointer path cleanly calls of_n_addr/size_cells() in order to retrieve the configured number of cells. But the offset-based path simply calls fdtdec_get_addr_size() which assumes that the number of cells is derived from the physical address width of that platform.

Quoted 7 lines
Quoted 1 line

So, what is that functions actually supposed to do?

+Dario Binacchi +Mario Six

I suspect the code has got ahead of the docs.

d64b9cdcd47 fdt: translate address if #size-cells = <0>

I submitted a patch to revert the commit:
https://patchwork.ozlabs.org/project/uboot/patch/20210501150527.10273-6-dariobin at libero.it/

Thanks and regards,
Dario

Quoted 9 lines

e8d5291824e core: ofnode: Fix translation for #size-cells == 0

Regards,
Simon

Quoted 4 lines

Jan

[1] https://www.mail-archive.com/u-boot at lists.denx.de/msg405446.html

author
#4 lore raw
Quoted 28 lines · Dario Binacchi

Hi Jan,

Quoted 26 lines

Il 04/05/2021 17:26 Simon Glass <[email protected]> ha scritto:

Hi Jan,

Quoted 19 lines · Jan Kiszka

Hi,

I'm trying to make some sense of ofnode_get_addr_size() in order to fix
[1] properly.

First, the documentation if this functions says "This does no address translation". But the node-pointer path happily calls of_translate_address(), as the result of a6a45cd32539. For not offset-bases path, it calls fdtdec_get_addr_size() which does no translation.

Related to [1]: The node-pointer path cleanly calls of_n_addr/size_cells() in order to retrieve the configured number of cells. But the offset-based path simply calls fdtdec_get_addr_size() which assumes that the number of cells is derived from the physical address width of that platform.

So, what is that functions actually supposed to do?

Quoted 9 lines
Quoted 5 lines

+Dario Binacchi +Mario Six

I suspect the code has got ahead of the docs.

d64b9cdcd47 fdt: translate address if #size-cells = <0>

I submitted a patch to revert the commit:
https://patchwork.ozlabs.org/project/uboot/patch/20210501150527.10273-6-dariobin at libero.it/

But of_translate_address is still part of ofnode_get_addr_size, just called under less conditions.

And that is only one of the inconsistencies, at least as it looks to me.

Jan