In device tree, can't understand 'ranges' property of PCIe root complex node

Chan Kim ckim at etri.re.kr
Mon Feb 6 07:06:59 EST 2023


Hello all,

For example in linux-5.15.68's arch/arm64/boot/dts/ti/k3-am64-main.dtsi,  

    &cbass_main {

        ... skip ...

        pcie0_rc: pcie at f102000 {
            compatible = "ti,am64-pcie-host", "ti,j721e-pcie-host";
            reg = <0x00 0x0f102000 0x00 0x1000>,
                  <0x00 0x0f100000 0x00 0x400>,
                  <0x00 0x0d000000 0x00 0x00800000>,
                  <0x00 0x68000000 0x00 0x00001000>;

            reg-names = "intd_cfg", "user_cfg", "reg", "cfg";
      ... skip ...   

            #address-cells = <3>;
            #size-cells = <2>;

       ...skip ...

            msi-map = <0x0 &gic_its 0x0 0x10000>;
            ranges = <0x01000000 0x00 0x68001000  0x00 0x68001000  0x00
0x0010000>,
                 <0x02000000 0x00 0x68011000  0x00 0x68011000  0x00
0x7fef000>;
            dma-ranges = <0x02000000 0x0 0x0 0x0 0x0 0x00000010 0x0>;
        };
    };

the 'ranges' property says  
- IO space starting at address 0x68001000 with size 64KiB is mapped to the
parent bus address 0x68001000.    
- a 32 bit memory address space starting with address 0x68011000 and size
0x7fef000 is mapped to parent bus address 0x68011000.  

The device tree document says these addresses are all physical. 
What I can't understand is :   

I know the BIOS will set the BAR addresses during the enumeration process.
This is allocating the endpoint's function to a certain PCIe bus address and
I guess setting BAR can be done without this 'ranges' information(it will
assign free address range for that device according to the device's need).
By the time linux kernel later reads this 'ranges' property, the BIOS (or
bootloader) has already assigned different PCIe address to that device.
Then, how is this 'ranges' property used by the kernel?

Thank you.

Chan Kim







More information about the Kernelnewbies mailing list