grendello
Posts: 4
Joined: Wed Sep 30, 2015 7:46 pm

Silly question about Device Tree definitions for RPI4

Tue Jul 09, 2019 8:46 pm

Hey guys,

I was browsing through the device tree sources for rpi4 when I noticed that the ranges property for the device's soc node has a different format:

Code: Select all

       
soc {
    ranges = <0x7e000000  0x0 0xfe000000  0x01800000>,
             <0x7c000000  0x0 0xfc000000  0x02000000>,
             <0x40000000  0x0 0xff800000  0x00800000>;
Bot the Device Tree specification v0.2, section 2.3.8, and Linux own documentation agree that ranges is a list of triplets with the following meanings:

Code: Select all

child-bus-address, parent-bus-address, length
If interpreted according to this, the rpi4 entry gives weird results (if regarded as 4 triplets) and if they are 3 quadruplets - what is the meaning of the extra field? I'm sure I'm missing something obvious, somewhere, but I couldn't find any info on how to interpret the above ranges. Could anyone shed some light as I'd love to understand what I'm reading :)

grendello
Posts: 4
Joined: Wed Sep 30, 2015 7:46 pm

Re: Silly question about Device Tree definitions for RPI4

Tue Jul 09, 2019 9:36 pm

Self-replying, but oh well. I've just found this page which explains the format. It turns out that the number of cells comprising an address is dictated by the #address-cells directive (and #size-cells for the size field of the triple) and so in this case, the parent bus address (the 2nd and 3rd integer) consists of two cells while the size consists of just one cell. Mystery solved :D

Edit: it is also explained in section 2.3.5 of the DT specification... ;)

Return to “Bare metal, Assembly language”