On 11/07/2019 12:01, BALATON Zoltan wrote:
Hello,
I'm trying to port fdt unflattening from SLOF to OpenBIOS but need some help with understanding and implementing equivalent forth words, The SLOF fdt.fs uses set-unit which is defined in
https://github.com/aik/SLOF/blob/master/slof/fs/node.fs
: set-space get-node dup >r node>space ! true r> node>space? ! ; : set-address my-#address-cells 1 ?DO get-node node>space i cells + ! LOOP ; : set-unit set-space set-address ;
These set the unit address manipulating the fields of the node struct as far as I understand.
But I don't know how to do the same in OpenBIOS. OpenBIOS implements the word that returns these values that set-unit is supposed to change in
https://github.com/openbios/openbios/blob/master/forth/device/package.fs#L19...
as
: my-unit ( -- phys.lo ... phys.hi ) ?my-self >in.my-unit my-#acells tuck /l* + swap 0 ?do /l - dup l@ swap loop drop ;
but I don't understand how these are stored in OpenBIOS and how to change them. Could somone who understands forth or know OpenBIOS more suggest an implementation of set-unit for OpenBIOS please?
We'll also need set-node which sets active-package I think so suggestions for that are also welcome.
The unit numbers in OpenBIOS seems to touch quite a few internal variables: my-unit, probe-addr and also reg depending upon the device and its parent bus, but the main issue is that during the PCI bus enumeration we don't maintain the full ihandle chain to the root node which tends to break a lot of the "my-*" words.
This is something that has been on my TODO list for a while, and I do have an incomplete WIP patchset to try and fix this. I'll see if I can find some time soon to fix up the remaining bugs and submit it to the list.
ATB,
Mark.