How long is this memory section specified in this .dtb file?

0

I feel like I'm not understanding how to interpret the format of dtb/dts files, and was hoping you could help. After running these commands:

qemu-system-riscv64 -machine virt -machine dumpdtb=riscv64-virt.dtb
dtc -I dtb -O dts -o riscv-virt.dts riscv-virt.dtb

The resulting riscv-virt.dts contains the definition of the memory for the machine:

/dts-v1/;

/ {
    #address-cells = <0x02>;
    #size-cells = <0x02>;
    compatible = "riscv-virtio";
    model = "riscv-virtio,qemu";

    ...other memory definitions...

    memory@80000000 {
        device_type = "memory";
        reg = <0x0 0x80000000 0x0 0x8000000>;
    };
};

I have a few questions:

  1. Why are there multiple pairs of reg definitions? Based on this link, it appears the second 0x0 0x8000000 overwrites what was just set in the previous pair, 0x0 0x80000000.
  2. How long is this memory bank? Which value tells me this?
  3. The first line says memory@80000000, but then the reg commands start at 0x0. Does the memory start at 0x0 or 0x80000000?

Basically, I just feel like I don't understand how to interpret this. In plain English, what is being defined here?

qemu
riscv
device-tree
asked on Stack Overflow Apr 7, 2019 by twilco • edited Apr 7, 2019 by twilco

1 Answer

0

In dts-specification p. 13 u can read it partially. Reg is given in (address,length) pairs. In your case address and length are given in 64 byte, which is done by using 2! 32-bit values. Thus the address is 0x80000000, and the size 0x8000000

Edit: The variables #address-cells and #size-cells specify how many cells (32-bit values) are used for either address and size. In an original dts it is always specified within the device's mother node. Maybe you can find it within your decompiled dts

answered on Stack Overflow Apr 7, 2019 by guenni_90 • edited Apr 7, 2019 by guenni_90

User contributions licensed under CC BY-SA 3.0