Memory map from device tree

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
macdonag
Posts: 3
Joined: Sun Apr 06, 2025 9:54 am

Memory map from device tree

Post 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?
nullplan
Member
Member
Posts: 1867
Joined: Wed Aug 30, 2017 8:24 am

Re: Memory map from device tree

Post 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.
Carpe diem!
macdonag
Posts: 3
Joined: Sun Apr 06, 2025 9:54 am

Re: Memory map from device tree

Post by macdonag »

Thanks! I had no idea that the bootloader modified the device tree, but that section makes much more sense now.
macdonag
Posts: 3
Joined: Sun Apr 06, 2025 9:54 am

Re: Memory map from device tree

Post 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?
Post Reply