On Tue, 23 Jul 2019, BALATON Zoltan wrote:
I've experimented with the pci-map-in forth implementation I've posted last but it fails when called from open-dev like above because decode-phys seems to return only addr.hi in this case instead of the lo, mid, hi triplet. No idea why is that or how to find out what did decode-phys returned as apparently it returns different number of values depending on how or when it's called.
decode-phys returns only 1 address becuase my-#acells returns 1 instead of 3 when that happens but I don't know why.
my-#acells looks at my-self or active-package so probably my-self is not what I expected but I don't know how to verify it. How to get the number of a node that is to be put to my-self when open-dev is not working (as I'm trying to debug that right now)? The call-package word that is called from $call-parent seems to set my-self and also the path-resolution called from open-dev messes with it so I can't follow what's happening and why my pci-map-in word gets only one addr from decode-phys when called as the map-in method (while gets lo,mid,hi when called directly last time I tested). Is my-self the /pci node in this case so I should use something else instead of decode-phys here?
I could not figure this out so I've tried to hack around it by saving and restoring my-self in pci-map-in to force decode-phys to look at active-package instead. See attached patch.
This fixes calls from vga.fs during open-dev but does not work with the FCode ROM calling it:
0 > debug pci-map-in Stepper keys: <space>/<enter> Up Down Trace Rstack Forth ok 0 > " /pci/ATY" open-dev
ob_pci_bar_map_in idx=1fc5ac24
<7> 1 -a1514 1fc5aba4 -7e000000 0 2007818 4000 ( 1 fff5eaec 1fc5aba4 82000000 0 2007818 4000 ) fff56d38: drop ( 1 fff5eaec 1fc5aba4 82000000 0 2007818 ) \ Pressed t here to enable tracing fff56d3c: nip ( 1 fff5eaec 1fc5aba4 82000000 2007818 ) fff56d40: nip ( 1 fff5eaec 1fc5aba4 2007818 ) fff56d44: my-self ( 1 fff5eaec 1fc5aba4 2007818 1fc5abf8 ) fff56d48: swap ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 ) fff56d4c: 0 ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 0 ) fff56d50: (lit) ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 0 fff3c73c ) fff56d58: (to) ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 ) fff56d5c: (") ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 fff56d64 12 ) fff56d78: active-package ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 fff56d64 12 fff5eaec ) fff56d7c: get-package-property ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 fff5ed1c 3c 0 ) fff56d80: 0= ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 fff5ed1c 3c ffffffff ) fff56d84: do?branch ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 fff5ed1c 3c ) fff56d8c: (begin) ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 fff5ed1c 3c ) fff56d90: decode-phys ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 fff5ed28 30 81000000 0 42007810 ) fff56d94: dup ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 fff5ed28 30 81000000 0 42007810 42007810 ) fff56d98: (lit) ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 fff5ed28 30 81000000 0 42007810 42007810 fffffff ) fff56da0: and ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 fff5ed28 30 81000000 0 42007810 2007810 ) fff56da4: (lit) ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 fff5ed28 30 81000000 0 42007810 2007810 6 ) fff56dac: pick ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 fff5ed28 30 81000000 0 42007810 2007810 2007818 ) fff56db0: (lit) ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 fff5ed28 30 81000000 0 42007810 2007810 2007818 fffffff ) fff56db8: and ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 fff5ed28 30 81000000 0 42007810 2007810 2007818 ) fff56dbc: = ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 fff5ed28 30 81000000 0 42007810 0 ) fff56dc0: do?branch ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 fff5ed28 30 81000000 0 42007810 ) fff56e64: 3drop ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 fff5ed28 30 ) fff56e68: decode-int ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 fff5ed2c 2c 0 ) fff56e6c: drop ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 fff5ed2c 2c ) fff56e70: decode-int ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 fff5ed30 28 1000000 ) fff56e74: drop ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 fff5ed30 28 ) fff56e78: dup ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 fff5ed30 28 28 ) fff56e7c: 0= ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 fff5ed30 28 0 ) fff56e80: (until) ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 fff5ed30 28 0 ) fff56e84: do?branch ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 fff5ed30 28 ) fff56d90: decode-phys ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 fff5ed3c 1c 1000 0 1007814 ) fff56d94: dup ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 fff5ed3c 1c 1000 0 1007814 1007814 ) fff56d98: (lit) ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 fff5ed3c 1c 1000 0 1007814 1007814 fffffff ) fff56da0: and ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 fff5ed3c 1c 1000 0 1007814 1007814 ) fff56da4: (lit) ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 fff5ed3c 1c 1000 0 1007814 1007814 6 ) fff56dac: pick ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 fff5ed3c 1c 1000 0 1007814 1007814 2007818 ) fff56db0: (lit) ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 fff5ed3c 1c 1000 0 1007814 1007814 2007818 fffffff ) fff56db8: and ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 fff5ed3c 1c 1000 0 1007814 1007814 2007818 ) fff56dbc: = ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 fff5ed3c 1c 1000 0 1007814 0 ) fff56dc0: do?branch ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 fff5ed3c 1c 1000 0 1007814 ) fff56e64: 3drop ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 fff5ed3c 1c ) fff56e68: decode-int ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 fff5ed40 18 0 ) fff56e6c: drop ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 fff5ed40 18 ) fff56e70: decode-int ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 fff5ed44 14 100 ) fff56e74: drop ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 fff5ed44 14 ) fff56e78: dup ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 fff5ed44 14 14 ) fff56e7c: 0= ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 fff5ed44 14 0 ) fff56e80: (until) ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 fff5ed44 14 0 ) fff56e84: do?branch ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 fff5ed44 14 ) fff56d90: decode-phys ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 fff5ed50 8 82000000 0 2007818 ) fff56d94: dup ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 fff5ed50 8 82000000 0 2007818 2007818 ) fff56d98: (lit) ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 fff5ed50 8 82000000 0 2007818 2007818 fffffff ) fff56da0: and ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 fff5ed50 8 82000000 0 2007818 2007818 ) fff56da4: (lit) ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 fff5ed50 8 82000000 0 2007818 2007818 6 ) fff56dac: pick ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 fff5ed50 8 82000000 0 2007818 2007818 2007818 ) fff56db0: (lit) ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 fff5ed50 8 82000000 0 2007818 2007818 2007818 fffffff ) fff56db8: and ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 fff5ed50 8 82000000 0 2007818 2007818 2007818 ) fff56dbc: = ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 fff5ed50 8 82000000 0 2007818 ffffffff ) fff56dc0: do?branch ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 fff5ed50 8 82000000 0 2007818 ) fff56dc8: 2drop ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 fff5ed50 8 82000000 ) fff56dcc: -rot ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 82000000 fff5ed50 8 ) fff56dd0: decode-int ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 82000000 fff5ed54 4 0 ) fff56dd4: drop ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 82000000 fff5ed54 4 ) fff56dd8: decode-int ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 82000000 fff5ed58 0 4000 ) fff56ddc: drop ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 82000000 fff5ed58 0 ) fff56de0: 2drop ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 82000000 ) fff56de4: over ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 82000000 2007818 ) fff56de8: (lit) ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 82000000 2007818 18 ) fff56df0: rshift ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 82000000 2 ) fff56df4: 3 ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 82000000 2 3 ) fff56df8: and ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 82000000 2 ) fff56dfc: 1 ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 82000000 2 1 ) fff56e00: = ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 82000000 0 ) fff56e04: do?branch ( 1 fff5eaec 1fc5aba4 1fc5abf8 2007818 82000000 ) fff56e44: nip ( 1 fff5eaec 1fc5aba4 1fc5abf8 82000000 ) fff56e48: swap ( 1 fff5eaec 1fc5aba4 82000000 1fc5abf8 ) fff56e4c: (lit) ( 1 fff5eaec 1fc5aba4 82000000 1fc5abf8 fff3c73c ) fff56e54: (to) ( 1 fff5eaec 1fc5aba4 82000000 ) fff56e58: exit <4> 1 -a1514 1fc5aba4 -7e000000
ob_pci_bar_map_in idx=1fc5ac24
<7> 1 -a1514 1fc5aba4 -7f000000 0 42007810 1000000 ( 1 fff5eaec 1fc5aba4 81000000 0 42007810 1000000 ) fff56d38: drop ( 1 fff5eaec 1fc5aba4 81000000 0 42007810 ) fff56d3c: nip ( 1 fff5eaec 1fc5aba4 81000000 42007810 ) fff56d40: nip ( 1 fff5eaec 1fc5aba4 42007810 ) fff56d44: my-self ( 1 fff5eaec 1fc5aba4 42007810 1fc5abf8 ) fff56d48: swap ( 1 fff5eaec 1fc5aba4 1fc5abf8 42007810 ) fff56d4c: 0 ( 1 fff5eaec 1fc5aba4 1fc5abf8 42007810 0 ) fff56d50: (lit) ( 1 fff5eaec 1fc5aba4 1fc5abf8 42007810 0 fff3c73c ) fff56d58: (to) ( 1 fff5eaec 1fc5aba4 1fc5abf8 42007810 ) fff56d5c: (") ( 1 fff5eaec 1fc5aba4 1fc5abf8 42007810 fff56d64 12 ) fff56d78: active-package ( 1 fff5eaec 1fc5aba4 1fc5abf8 42007810 fff56d64 12 fff5eaec ) fff56d7c: get-package-property ( 1 fff5eaec 1fc5aba4 1fc5abf8 42007810 fff5ed1c 3c 0 ) fff56d80: 0= ( 1 fff5eaec 1fc5aba4 1fc5abf8 42007810 fff5ed1c 3c ffffffff ) fff56d84: do?branch ( 1 fff5eaec 1fc5aba4 1fc5abf8 42007810 fff5ed1c 3c ) fff56d8c: (begin) ( 1 fff5eaec 1fc5aba4 1fc5abf8 42007810 fff5ed1c 3c ) fff56d90: decode-phys ( 1 fff5eaec 1fc5aba4 1fc5abf8 42007810 fff5ed28 30 81000000 0 42007810 ) fff56d94: dup ( 1 fff5eaec 1fc5aba4 1fc5abf8 42007810 fff5ed28 30 81000000 0 42007810 42007810 ) fff56d98: (lit) ( 1 fff5eaec 1fc5aba4 1fc5abf8 42007810 fff5ed28 30 81000000 0 42007810 42007810 fffffff ) fff56da0: and ( 1 fff5eaec 1fc5aba4 1fc5abf8 42007810 fff5ed28 30 81000000 0 42007810 2007810 ) fff56da4: (lit) ( 1 fff5eaec 1fc5aba4 1fc5abf8 42007810 fff5ed28 30 81000000 0 42007810 2007810 6 ) fff56dac: pick ( 1 fff5eaec 1fc5aba4 1fc5abf8 42007810 fff5ed28 30 81000000 0 42007810 2007810 42007810 ) fff56db0: (lit) ( 1 fff5eaec 1fc5aba4 1fc5abf8 42007810 fff5ed28 30 81000000 0 42007810 2007810 42007810 fffffff ) fff56db8: and ( 1 fff5eaec 1fc5aba4 1fc5abf8 42007810 fff5ed28 30 81000000 0 42007810 2007810 2007810 ) fff56dbc: = ( 1 fff5eaec 1fc5aba4 1fc5abf8 42007810 fff5ed28 30 81000000 0 42007810 ffffffff ) fff56dc0: do?branch ( 1 fff5eaec 1fc5aba4 1fc5abf8 42007810 fff5ed28 30 81000000 0 42007810 ) fff56dc8: 2drop ( 1 fff5eaec 1fc5aba4 1fc5abf8 42007810 fff5ed28 30 81000000 ) fff56dcc: -rot ( 1 fff5eaec 1fc5aba4 1fc5abf8 42007810 81000000 fff5ed28 30 ) fff56dd0: decode-int ( 1 fff5eaec 1fc5aba4 1fc5abf8 42007810 81000000 fff5ed2c 2c 0 ) fff56dd4: drop ( 1 fff5eaec 1fc5aba4 1fc5abf8 42007810 81000000 fff5ed2c 2c ) fff56dd8: decode-int ( 1 fff5eaec 1fc5aba4 1fc5abf8 42007810 81000000 fff5ed30 28 1000000 ) fff56ddc: drop ( 1 fff5eaec 1fc5aba4 1fc5abf8 42007810 81000000 fff5ed30 28 ) fff56de0: 2drop ( 1 fff5eaec 1fc5aba4 1fc5abf8 42007810 81000000 ) fff56de4: over ( 1 fff5eaec 1fc5aba4 1fc5abf8 42007810 81000000 42007810 ) fff56de8: (lit) ( 1 fff5eaec 1fc5aba4 1fc5abf8 42007810 81000000 42007810 18 ) fff56df0: rshift ( 1 fff5eaec 1fc5aba4 1fc5abf8 42007810 81000000 42 ) fff56df4: 3 ( 1 fff5eaec 1fc5aba4 1fc5abf8 42007810 81000000 42 3 ) fff56df8: and ( 1 fff5eaec 1fc5aba4 1fc5abf8 42007810 81000000 2 ) fff56dfc: 1 ( 1 fff5eaec 1fc5aba4 1fc5abf8 42007810 81000000 2 1 ) fff56e00: = ( 1 fff5eaec 1fc5aba4 1fc5abf8 42007810 81000000 0 ) fff56e04: do?branch ( 1 fff5eaec 1fc5aba4 1fc5abf8 42007810 81000000 ) fff56e44: nip ( 1 fff5eaec 1fc5aba4 1fc5abf8 81000000 ) fff56e48: swap ( 1 fff5eaec 1fc5aba4 81000000 1fc5abf8 ) fff56e4c: (lit) ( 1 fff5eaec 1fc5aba4 81000000 1fc5abf8 fff3c73c ) fff56e54: (to) ( 1 fff5eaec 1fc5aba4 81000000 ) fff56e58: exit <4> 1 -a1514 1fc5aba4 -7f000000 ok 1 > .s <1> 1fc5ac30 ok 1 > to my-self ok 0 > load hd:\ati.rom
ob_pci_decode_unit idx=1fc5acf4 ob_pci_decode_unit idx=1fc5acf4 addr=00000000 00000000 00006000 ob_pci_encode_unit space=0 dev=12 fn=0 buf=c
ok 0 > load-base 40 + 1 byte-load
ob_pci_bar_map_in idx=1fc5ac24
<12> -1 1 0 -1 0 0 -1 -bf5b8 0 0 0 0 0 0 0 0 1007814 100 ( ffffffff 1 0 ffffffff 0 0 ffffffff fff40a48 0 0 0 0 0 0 0 0 1007814 100 ) fff56d38: drop ( ffffffff 1 0 ffffffff 0 0 ffffffff fff40a48 0 0 0 0 0 0 0 0 1007814 ) fff56d3c: nip ( ffffffff 1 0 ffffffff 0 0 ffffffff fff40a48 0 0 0 0 0 0 0 1007814 ) fff56d40: nip ( ffffffff 1 0 ffffffff 0 0 ffffffff fff40a48 0 0 0 0 0 0 1007814 ) fff56d44: my-self ( ffffffff 1 0 ffffffff 0 0 ffffffff fff40a48 0 0 0 0 0 0 1007814 1fc5abf8 ) fff56d48: swap ( ffffffff 1 0 ffffffff 0 0 ffffffff fff40a48 0 0 0 0 0 0 1fc5abf8 1007814 ) fff56d4c: 0 ( ffffffff 1 0 ffffffff 0 0 ffffffff fff40a48 0 0 0 0 0 0 1fc5abf8 1007814 0 ) fff56d50: (lit) ( ffffffff 1 0 ffffffff 0 0 ffffffff fff40a48 0 0 0 0 0 0 1fc5abf8 1007814 0 fff3c73c ) fff56d58: (to) ( ffffffff 1 0 ffffffff 0 0 ffffffff fff40a48 0 0 0 0 0 0 1fc5abf8 1007814 ) fff56d5c: (") ( ffffffff 1 0 ffffffff 0 0 ffffffff fff40a48 0 0 0 0 0 0 1fc5abf8 1007814 fff56d64 12 ) fff56d78: active-package ( ffffffff 1 0 ffffffff 0 0 ffffffff fff40a48 0 0 0 0 0 0 1fc5abf8 1007814 fff56d64 12 fff4d10c ) fff56d7c: get-package-property ( ffffffff 1 0 ffffffff 0 0 ffffffff fff40a48 0 0 0 0 0 0 1fc5abf8 1007814 ffffffff ) fff56d80: 0= ( ffffffff 1 0 ffffffff 0 0 ffffffff fff40a48 0 0 0 0 0 0 1fc5abf8 1007814 0 ) fff56d84: do?branch ( ffffffff 1 0 ffffffff 0 0 ffffffff fff40a48 0 0 0 0 0 0 1fc5abf8 1007814 ) fff56ea8: drop ( ffffffff 1 0 ffffffff 0 0 ffffffff fff40a48 0 0 0 0 0 0 1fc5abf8 ) fff56eac: (lit) ( ffffffff 1 0 ffffffff 0 0 ffffffff fff40a48 0 0 0 0 0 0 1fc5abf8 fff3c73c ) fff56eb4: (to) ( ffffffff 1 0 ffffffff 0 0 ffffffff fff40a48 0 0 0 0 0 0 ) fff56eb8: -1 ( ffffffff 1 0 ffffffff 0 0 ffffffff fff40a48 0 0 0 0 0 0 ffffffff ) fff56ebc: (semis) <f> -1 1 0 -1 0 0 -1 -bf5b8 0 0 0 0 0 0 -1
byte-load: exception caught! ok 0 >
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.
Regards, BALATON Zoltan