reading files in /proc/device-tree
Segher Boessenkool
segher at kernel.crashing.org
Thu Sep 30 01:26:22 EST 2004
> I am looking for a way to be able to read data files for nodes under
> /proc/device-tree, from userspace.
> Basically, I have a requirement to be able to find out System RAM
> addressable ranges from userspace. I was told it could be obtained by
> reading
> the memory nodes's reg property from under /proc/device-tree.
Just read the file.
segher at victim:~ $ xxd -g4 /proc/device-tree/memory/reg
00000000 00000000 00000000 80000000 ; 2GB at 0
00000001 00000000 00000000 80000000 ; 2GB at 4GB
(comments are mine, data is faked).
There might be more memory nodes; read them all and take
the union.
Also, the format of the entries is dependent on the
#address-cells and #sized-cells properties.
Hope this helps,
Segher
(oh, and _do_ read the OF specs:
<http://playground.sun.com/1275/home.html>).
More information about the Linuxppc64-dev
mailing list