Page 1 of 1

Memory map from device tree

Posted: Sun Apr 06, 2025 10:03 am
by macdonag
Is it possible to derive a memory map using a device tree, avoiding various hard-coded assumptions about regions?

I'm focusing on rpi4, mainly on qemu for now. I'd like to map the MMIO region and the Arm local peripheral regions based on the device tree, but the register blocks all seem to be fragmented, and some smaller than a page.

There doesn't seem to be a way of identifying them as larger regions.

Is this futile? Should I just hardcode per board I want to support?

Re: Memory map from device tree

Posted: Mon Apr 07, 2025 10:16 am
by nullplan
There is a memory node in the device tree, memory@0. According to the device tree source, the memory size will be filled in by the boot loader.

Re: Memory map from device tree

Posted: Tue Apr 08, 2025 12:14 pm
by macdonag
Thanks! I had no idea that the bootloader modified the device tree, but that section makes much more sense now.

Re: Memory map from device tree

Posted: Sat Apr 12, 2025 3:48 pm
by macdonag
So the memory block, as far as I can tell, indicates the memory available, but not other regions such as the MMIO region and the Arm local peripheral regions. Is there any way to extract them from the device tree, other than each individual node's regblock?