On Sun, 14 Jul 2019, BALATON Zoltan wrote:
On Sun, 14 Jul 2019, Mark Cave-Ayland wrote:
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 not for PCI devices but for unflattenning an FDT to get the initial device tree (instead of creating it in OpenBIOS so we can get rid of all the ifdefs and knowledge about platforms to simplify OpenBIOS like already done in SLOF). This unflattened initial device tree then can be amended with PCI devices the same way as done now, no libfdt is used in OpenBIOS, the unflattening us done in Forth and manipulation is then done on the forth device tree. So what you talk about may not be needed here. I need the opposite of my-unit instead:
: set-unit ( phys.lo ... phys.hi -- )
that should set addresses somehow (of the current device I think, see definitions from SLOF above). I've looked up my-#acells that seem to be the source of this info:
https://github.com/openbios/openbios/blob/master/forth/device/property.fs#L1...
\ HELPER: get #address-cell value (from parent) \ Legal values are 1..4 (we may optionally support longer addresses) : my-#acells ( -- #address-cells ) my-self ?dup if >in.device-node @ else active-package then ?dup if >dn.parent @ then ?dup if " #address-cells" rot get-package-property if 2 exit then \ we don't have to support more than 4 (and 0 is illegal) decode-int nip nip 4 min 1 max else 2 then ;
So I think we should somehow set #address-cells. It would help if I
OK I was wrong, #address-cells are only the number of the addresses in the list so it does not need to change. I still could not figure out how to do this in OpenBIOS but added a dummy word to get further for now and see what else is missing. I've found some simpler words that I could copy or find equivalents then found that SLOF fdt.fs uses claim which seems to be undefined in OpenBIOS. OpenBIOS does have claim in the client interface but not otherwise? SLOF has it implemented here:
https://github.com/aik/SLOF/blob/master/slof/fs/claim.fs
For openbios we probably would need to call back in C ofmem_* funcs somehow? Does anyone have an idea about this?
understood what space and adresses are and know forth but instead of reading all open firmware standards and a forth tutorial I hope there are people here who already know these and can help to implement this word in OpenBIOS which may be faster then me learning everything first. If one could explain the necessary pieces like what are space and addresses (or where exactly are these described in the standard) and how are these stored in OpenBIOS and where to change them or what the above forth words do then I may be able to try to come up with a set-unit definition but without some ropes I can't do it.
Is there a simple tutorial about the meaning of space, addresses, unit, etc. in Open Firmware or can someone explain it here or is the only way to get this is to read the standard? (Even after reading the standard I would need explanation on how it's stored in OpenBIOS though.)
Regards, BALATON Zoltan