On Tue, 23 Jul 2019, Mark Cave-Ayland wrote:
On 23/07/2019 17:20, BALATON Zoltan wrote:
Here already getting assigned-addresses fails because apparently active-package is not the /pci/ATY node? How to make sense of the handle values to know where they point? I can only compare the above and during open-dev active-package seems to be fff5eaec, open-dev returns 1fc5ac30 which is set to my-self, then when FCode rom calls map-in active-package seems to be fff4d10c but what do these mean? Can anyone make sense of this? I've run out of ideas.
I'm afraid all I can do at the moment is recommend that you read the relevant parts of the IEEE-1275 specification to understand the concepts of "active package" and "current instance", since these are the fundamental to being able to understand how device tree packages are accessed in Forth (and therefore OpenBIOS).
OK, which are the relevant parts? I don't want to search for them so if someone can more exactly point me to some relevant parts of docs or a concise description or even rephrase the most important parts that are good to know here would help. I find standard docs hard to understand and really don't want to learn more about this than absolutely necessary. Already spent more time with it than I wanted to. (I think I've seen some figures about this in the OpenFirmware docs Howard has referenced before that may explain it better but I wasn't interested enough to check yet. Probably I can't avoid that later when I get to trying to make FDT unflattening work if no one else can help with that.)
However getting more familiar with these terms would probably not explain why my-self is not what's expected during the execution of the vga.fs code that calls map-in during open-dev. This breaks unless I set my-self to 0 in pci-map-in to force using active-package in decode-phys that returns the wrong number of addresses otherwise but this work around then breaks during the FCode ROM's calling map-in (while using my-self at that point would probably be correct) so I think the 0-ing of my-self should not be needed and it's really either vga.fs is broken or calling it during open-dev so that's not somthing I understand or can fix. Since you've added this I hoped that you have a better understanding on how this works and why it breaks.
The one part I can answer from above is that you can convert an ihandle (current instance handle) to a phandle (package handle) via the ihandle>phandle Forth word if that helps at all?
Maybe it would help if I knew which is which? So active-package is a phandle while my-self is an instance, thus ihandle? What makes an instance from a package? And where these are expected to point?
Also I'm less interested in converting between these but more to find out where these point to during the execution when it works and when it breaks. So the question is more that given one of these numbers how do I get a name or path that identifies what it's pointing to during debugging? Then I could add fwords to the C callback to print these every time map-in is called so we can see what active-package and my-self are pointing to at that point and we may find out if they are correct or where those are set. There must be an easy way to do this that someone who already knows can tell me so I don't have to read all the docs first to find out.
Regards, BALATON Zoltan