On Sun, 21 Jul 2019, Mark Cave-Ayland wrote:
On 21/07/2019 15:16, BALATON Zoltan wrote:
OK I came up with the attched patch (on top of your previous series and set-args patch) which is I think about what you've suggested. I kept ob_pci_map for existing callers but renamed it to ob_pci_map_in to keep symmetry between ob_pci_map and ob_pci_unmap with ob_pci_map now only doing mapping as its name suggests (although I think this should still be simpler) and ob_pci_bus_map_in is doing its own address decoding now. The previous ob_pci_map (now called ob_pci_map_in which is a C helper for some of what map-in should do) can be cleaned up as you like. Also cleaned up some white space (tab vs. spaces) but that's excluded from this patch for brevity.
Now I'm really confused - I had a quick look at your patch and compared it with
Good that you're only confused now. :-) I was and still am confused about it all the time so please bear with me.
pci_config_*() words and they show that you can't memory map PCI config space on a Mac. So how did you get to the conclusion earlier in the thread that this was what was required?
Apparently I was confused... Now I realise that this usage of map-in in FCode ROM really wants to map the IO BAR1. My confusion probably comes from that after mapping it it uses config-b[!@] to tweak some regs so I thought it may want config space. (I'm still confused though after reading the description of map-in and addresses in the PCI binding doc. And we probably will need access to config space if we want to implement config-* words in Forth. We could add callbacks to C for those but that's not the nicest way.)
But it does not seem to work yet:
0 > " /pci@f2000000/ATY" open-dev to my-self
ob_pci_bar_map_in idx=1fc5ac54 pci_bus_addr_to_host_addr space=2 ba=0x82000000 ob_pci_map: phys=0x82000000 size=16384 ob_pci_bar_map_in idx=1fc5ac54 pci_bus_addr_to_host_addr space=2 ba=0x81000000 ob_pci_map: phys=0x81000000 size=16777216
?ok
Here we see 2 MMIO BARs being mapped: one of 16K and another of 16M. And this happens as soon as you open the device? I think you'll have to explain more about your command line and how you are getting OpenBIOS to execute the FCode, since I can't tell if this is OpenBIOS or the FCode.
No FCode here, just started OpenBIOS with patched openbios-elf and typed commands that I've seen in the FCode. All this comes from OpenBIOS, don't ask me why it calls this for open-dev.
0 > my-unit? ok 3 > . 7800? ok 2 > . 0? ok 1 > . 0? ok 0 > my-space? ok 1 > . 7800? ok 0 > my-address? ok 2 > . 0? ok 1 > . 0? ok 0 > my-address h# 1000014 my-space + h# 100? ok 4 > .s <4> 0 0 1007814 100 ?ok 4 > " map-in" $call-parent
ob_pci_bar_map_in idx=1fc5ac54 pci_bus_addr_to_host_addr space=1 ba=0x0 ob_pci_map: phys=0xf2000000 size=256
?ok
This is trying to map an IO BAR with 256 bytes, but the phys address isn't going to be correct because OpenBIOS copies arch->io_base into *io_base (and also *mem_base for MMIO) during PCI configuration and advances that copy to hold the start of the next free address.
Where does OpenBIOS copy and advance these values and what do *io_base and *mem_base refer to here? I assume the map-in word runs after the device tree is already constucted so these should already be mapped and map-in might just need to return a virt address for the already mapped bars.
At a very minimum you're going to have to teach the PCI map-in how to use these values instead of making the assumption that the BAR has already been mapped by
Which values?
ob_pci_configure_bar() and the address can be calculated by adding the BAR address to arch->io_base or arch->mem_base according to the space type. This is how pci_bus_addr_to_host_addr() currently works.
My patch called pci_bus_addr_to_host_addr in ob_pci_bus_map_in with the space decoded from phys.hi on the stack yet the virt address came out wrong at the end.
Now I've tried to do instead what SLOF's map-in does:
https://github.com/aik/SLOF/blob/master/slof/fs/pci-config-bridge.fs#L59
and ignore everything except phys.hi and get bar address from that like:
size = POP(); phys[0] = POP(); phys[1] = POP(); phys[2] = POP();
PCI_DPRINTF("%s idx=%p, hi=%"PRIx32", mid=%"PRIx32", lo=%"PRIx32", size=" FMT_ucell"\n", __func__, idx, phys[0], phys[1], phys[2], size); pci_decode_phys_addr(phys, &flags, &space_code, &dev, ®, &addr); /* Check if reg is actually a Base Address Reg */ if (reg < PCI_BASE_ADDR_0 || (reg > PCI_BASE_ADDR_5 && reg != PCI_ROM_ADDRESS)) { PUSH(-1); return; } addr = pci_config_read32(reg, dev); PCI_DPRINTF("%s bar=%"PRIx32"\n", __func__, addr); virt = ob_pci_map(addr, size);
but then bar==-1 (even for MMIO regions which were mapped before) so it looks like it's not mapped at this point so map-in should program the BAR reg or call another function for that?
The other issue is that the PCI enumeration code will already have mapped the ATI BARs once so you'll have to come up with a solution so that if you detect an FCode ROM then the existing PCI configuration code is ignored. Otherwise you'll find that you have mapped the 16M MMIO BAR twice which is going to take quite a bit of MMIO memory and lead to more confusion.
Does it map then unmap the region without freeing the allocated MMIO space? Or if it's still mapped we should just return a pointer to the already mapped space. Could we just get that from assigned-addresses?
Finally one other thing: I'm finding this thread really hard to follow - too much information is spread across too many emails, and the subject line isn't really helping me understand what topic we're following or where I can find related information. May I suggest that it makes sense to break this down into a series of smaller, more concise threads?
I've tried to do that but forgot to update the subject. This thread is now about implementing map-in. The goal is still to run FCode ROMs but first step is to get map-in working.
Thank you, BALATON Zoltan
On Sun, 21 Jul 2019, BALATON Zoltan wrote:
Or if it's still mapped we should just return a pointer to the already mapped space. Could we just get that from assigned-addresses?
Looks like pci-bar>pci-addr in drivers/pci.fs that vga.fs uses does just that (or something similar, I can't understand forth without looking at it for a few hours). Should we ditch this word and build it in map-in then convert vga.fs to use map-in instead of pci-bar>pci-addr pci-map-in which is probably what map-in is supposed to do?
Regards, BALATON Zoltan
On Sun, 21 Jul 2019, BALATON Zoltan wrote:
On Sun, 21 Jul 2019, BALATON Zoltan wrote:
Or if it's still mapped we should just return a pointer to the already mapped space. Could we just get that from assigned-addresses?
Looks like pci-bar>pci-addr in drivers/pci.fs that vga.fs uses does just that (or something similar, I can't understand forth without looking at it for a few hours). Should we ditch this word and build it in map-in then convert vga.fs to use map-in instead of pci-bar>pci-addr pci-map-in which is probably what map-in is supposed to do?
I give up, I think it's either all broken or I can't get my head around how this should work. SLOF reads the BAR address from card config space with config-l@ using the addr.hi part only then translates it either from assigned-addresses or or parent's ranges property (but I could not get the details of this).
I can't do the same in OpenBIOS because BAR seems to be unassigned if I read config reg from map-in and trying to get address from assigned-adresses also look strange for io regions:
/pci:
#address-cells 3 #size-cells 2 #interrupt-cells 1 reg f2000000 02000000 ranges -- 30 : 01 00 00 00 00 00 00 00 00 00 00 00 f2 00 00 00 00 00 00 00 00 80 00 00 02 00 00 00 00 00 00 00 80 00 00 00 80 00 00 00 00 00 00 00 10 00 00 00 bus-range -- 8 : 00 00 00 00 00 00 00 00 available -- 28 : 02 00 00 00 00 00 00 00 82 10 00 00 00 00 00 00 8d f0 00 00 01 00 00 00 00 00 00 00 00 00 20 00 00 00 00 00 00 7f e0 00
I think ranges here is
01000000 00000000 00000000 f2000000 00000000 00800000 02000000 00000000 80000000 80000000 00000000 10000000
don't know what available property means but looks like:
02000000 00000000 82100000 00000000 8df00000 01000000 00000000 00002000 00000000 007fe000
/pci/ATY:
assigned-addresses 42007810 00000000 81000000 00000000 01000000 01007814 00000000 00001000 00000000 00000100 02007818 00000000 82000000 00000000 00004000 reg 00007800 00000000 00000000 00000000 00000000 42007810 00000000 00000000 00000000 01000000 01007814 00000000 00000000 00000000 00000100 02007818 00000000 00000000 00000000 00004000
So reg has no addresses, BAR reg is not set, returns ffffffff. I can get address for mmio BARs from assigned addresses but that's not valid for IO regions which would also need translating adding an offset from parent's ranges? But then why mmio addresses are already translated?
If this is all standard can someone explain in simple terms how all this is supposed to work so we can verify what OpenBIOS does and know what map-in should actually be doing?
Regards, BALATON Zoltan
On Mon, 22 Jul 2019, BALATON Zoltan wrote:
On Sun, 21 Jul 2019, BALATON Zoltan wrote:
On Sun, 21 Jul 2019, BALATON Zoltan wrote:
Or if it's still mapped we should just return a pointer to the already mapped space. Could we just get that from assigned-addresses?
Looks like pci-bar>pci-addr in drivers/pci.fs that vga.fs uses does just that (or something similar, I can't understand forth without looking at it for a few hours). Should we ditch this word and build it in map-in then convert vga.fs to use map-in instead of pci-bar>pci-addr pci-map-in which is probably what map-in is supposed to do?
I give up, I think it's either all broken or I can't get my head around how this should work. SLOF reads the BAR address from card config space with config-l@ using the addr.hi part only then translates it either from assigned-addresses or or parent's ranges property (but I could not get the details of this).
I can't do the same in OpenBIOS because BAR seems to be unassigned if I read config reg from map-in and trying to get address from assigned-adresses also look strange for io regions:
/pci:
#address-cells 3 #size-cells 2 #interrupt-cells 1 reg f2000000 02000000 ranges -- 30 : 01 00 00 00 00 00 00 00 00 00 00 00 f2 00 00 00 00 00 00 00 00 80 00 00 02 00 00 00 00 00 00 00 80 00 00 00 80 00 00 00 00 00 00 00 10 00 00 00 bus-range -- 8 : 00 00 00 00 00 00 00 00 available -- 28 : 02 00 00 00 00 00 00 00 82 10 00 00 00 00 00 00 8d f0 00 00 01 00 00 00 00 00 00 00 00 00 20 00 00 00 00 00 00 7f e0 00
I think ranges here is
01000000 00000000 00000000 f2000000 00000000 00800000 02000000 00000000 80000000 80000000 00000000 10000000
don't know what available property means but looks like:
02000000 00000000 82100000 00000000 8df00000 01000000 00000000 00002000 00000000 007fe000
/pci/ATY:
assigned-addresses 42007810 00000000 81000000 00000000 01000000 01007814 00000000 00001000 00000000 00000100 02007818 00000000 82000000 00000000 00004000 reg 00007800 00000000 00000000 00000000 00000000 42007810 00000000 00000000 00000000 01000000 01007814 00000000 00000000 00000000 00000100 02007818 00000000 00000000 00000000 00004000
Actual memory map as QEMU thinks it is in case that explains the numbers:
memory-region: unin-pci-mmio 0000000000000000-00000000ffffffff (prio 0, i/o): unin-pci-mmio 00000000000a0000-00000000000bffff (prio 1, i/o): vga-lowmem 0000000080000000-000000008007ffff (prio 1, i/o): macio 0000000080000050-000000008000007f (prio 0, i/o): gpio 0000000080008000-0000000080008fff (prio 0, i/o): dbdma 0000000080012000-00000000800120ff (prio 0, i/o): escc-legacy 0000000080012000-0000000080012001 (prio 0, i/o): alias escc-legacy-port @escc 0000000000000000-0000000000000001 0000000080012002-0000000080012003 (prio 0, i/o): alias escc-legacy-port @escc 0000000000000020-0000000000000021 0000000080012004-0000000080012005 (prio 0, i/o): alias escc-legacy-port @escc 0000000000000010-0000000000000011 0000000080012006-0000000080012007 (prio 0, i/o): alias escc-legacy-port @escc 0000000000000030-0000000000000031 0000000080012008-0000000080012009 (prio 0, i/o): alias escc-legacy-port @escc 0000000000000040-0000000000000041 000000008001200a-000000008001200b (prio 0, i/o): alias escc-legacy-port @escc 0000000000000050-0000000000000051 0000000080012080-0000000080012081 (prio 0, i/o): alias escc-legacy-port @escc 0000000000000080-0000000000000081 0000000080012090-0000000080012091 (prio 0, i/o): alias escc-legacy-port @escc 0000000000000090-0000000000000091 00000000800120a0-00000000800120a1 (prio 0, i/o): alias escc-legacy-port @escc 00000000000000a0-00000000000000a1 00000000800120b0-00000000800120b1 (prio 0, i/o): alias escc-legacy-port @escc 00000000000000b0-00000000000000b1 0000000080013000-000000008001303f (prio 0, i/o): escc 0000000080015000-0000000080015fff (prio 0, i/o): timer 0000000080016000-0000000080017fff (prio 0, i/o): via-pmu 0000000080020000-0000000080020fff (prio 0, i/o): pmac-ide 0000000080021000-0000000080021fff (prio 0, i/o): pmac-ide 0000000080040000-000000008007ffff (prio 0, i/o): openpic 0000000080040000-00000000800410ef (prio 0, i/o): glb 00000000800410f0-000000008004130f (prio 0, i/o): tmr 0000000080050000-0000000080051fff (prio 0, i/o): src 0000000080060000-000000008007f0ff (prio 0, i/o): cpu 0000000080080000-00000000800800ff (prio 1, i/o): ohci 0000000080200000-00000000803fffff (prio 1, i/o): sungem 0000000080200000-0000000080201fff (prio 0, i/o): sungem.greg 0000000080202000-0000000080202fff (prio 0, i/o): sungem.txdma 0000000080204000-0000000080205fff (prio 0, i/o): sungem.rxdma 0000000080206000-00000000802061ff (prio 0, i/o): sungem.mac 0000000080206200-000000008020621f (prio 0, i/o): sungem.mif 0000000080209000-000000008020905f (prio 0, i/o): sungem.pcs 0000000081000000-0000000081ffffff (prio 1, ram): vga.vram 0000000082000000-0000000082003fff (prio 1, i/o): ati.mmregs 0000000082010000-000000008201ffff (prio 1, rom): ati-vga.rom
memory-region: system 0000000000000000-ffffffffffffffff (prio 0, i/o): system 0000000000000000-000000001fffffff (prio 0, ram): ppc_core99.ram 0000000080000000-000000008fffffff (prio 0, i/o): alias unin-pci-hole @unin-pci-mmio 0000000080000000-000000008fffffff 00000000f0000510-00000000f0000511 (prio 0, i/o): fwcfg.ctl 00000000f0000512-00000000f0000512 (prio 0, i/o): fwcfg.data 00000000f0800000-00000000f0800fff (prio 0, i/o): unin-agp-conf-idx 00000000f0c00000-00000000f0c00fff (prio 0, i/o): unin-agp-conf-data 00000000f2000000-00000000f27fffff (prio 0, i/o): unin-pci-isa-mmio 00000000f20001ce-00000000f20001d1 (prio 0, i/o): vbe 00000000f20003b4-00000000f20003b5 (prio 0, i/o): vga 00000000f20003ba-00000000f20003ba (prio 0, i/o): vga 00000000f20003c0-00000000f20003cf (prio 0, i/o): vga 00000000f20003d4-00000000f20003d5 (prio 0, i/o): vga 00000000f20003da-00000000f20003da (prio 0, i/o): vga 00000000f2001000-00000000f20010ff (prio 1, i/o): alias ati.io @ati.mmregs 0000000000000000-00000000000000ff 00000000f2800000-00000000f2800fff (prio 0, i/o): unin-pci-conf-idx 00000000f2c00000-00000000f2c00fff (prio 0, i/o): unin-pci-conf-data 00000000f4800000-00000000f4800fff (prio 0, i/o): unin-pci-conf-idx 00000000f4c00000-00000000f4c00fff (prio 0, i/o): unin-pci-conf-data 00000000f8000000-00000000f8000fff (prio 0, i/o): unin 00000000fff00000-00000000ffffffff (prio 0, rom): ppc_core99.bios 00000000fff04000-00000000fff07fff (prio 0, i/o): macio-nvram
It's possible that both QEMU and OpenBIOS have some inconsistencies that may just cancel out each other sometimes.
So reg has no addresses, BAR reg is not set, returns ffffffff. I can get address for mmio BARs from assigned addresses but that's not valid for IO regions which would also need translating adding an offset from parent's ranges? But then why mmio addresses are already translated?
If this is all standard can someone explain in simple terms how all this is supposed to work so we can verify what OpenBIOS does and know what map-in should actually be doing?
Regards, BALATON Zoltan _______________________________________________ OpenBIOS mailing list -- openbios@openbios.org To unsubscribe send an email to openbios-leave@openbios.org
On Mon, 22 Jul 2019, BALATON Zoltan wrote:
SLOF reads the BAR address from card config space with config-l@ using the addr.hi part only then translates it either from assigned-addresses or or parent's ranges property (but I could not get the details of this).
I can't do the same in OpenBIOS because BAR seems to be unassigned if I read config reg from map-in and trying to get address from assigned-adresses also look strange for io regions:
I think we need something like this:
: pci-map-in ( addr.lo addr.mid addr.hi size -- virt ) \ Ignore everything but addr.hi and find assigned addr for BAR drop nip nip " assigned-addresses" active-package get-package-property 0= if begin decode-phys ( bar prop prop-len phys.lo phys.mid phys.hi ) dup 6 pick = if 2drop -rot decode-int drop decode-int drop 2drop ( bar addr.lo ) \ Now translate addr.lo, FIXME this is wrong \ maybe we should look at parent's ranges instead? over 18 rshift 3 and 1 = if " reg" active-package parent get-package-property 0= if ( bar addr.lo prop prop-len reg.addr reg.size ) decode-int -rot decode-int 3drop + then then nip exit else 3drop \ no match, try next then \ Drop the size as we don't need it decode-int drop decode-int drop dup 0= until 3drop -1 \ not found else drop -1 \ could not find assigned-addresses then ;
which returns the correct values for the case I looked at but likely not the proper way to do this and I don't know why for example only io range needs adding an offset. This also has assumptions about node being direct child of a pci bus so probably won't work with bridges. Also how to add this to be a method of the /pci node (without going through a C function that I could do but seems ugly).
I'm still interested if anyone knows how all this should work so instead of putting together pieces from here and there we actually know where we are going.
Regards, BALATON Zoltan
I can’t be much help here, I can use Fcode debug map-in on a powermac G5, or the see command to see map-in, if any of that will be helpful?
On Jul 22, 2019, at 8:24 AM, BALATON Zoltan balaton@eik.bme.hu wrote:
On Mon, 22 Jul 2019, BALATON Zoltan wrote:
SLOF reads the BAR address from card config space with config-l@ using the addr.hi part only then translates it either from assigned-addresses or or parent's ranges property (but I could not get the details of this).
I can't do the same in OpenBIOS because BAR seems to be unassigned if I read config reg from map-in and trying to get address from assigned-adresses also look strange for io regions:
I think we need something like this:
: pci-map-in ( addr.lo addr.mid addr.hi size -- virt ) \ Ignore everything but addr.hi and find assigned addr for BAR drop nip nip " assigned-addresses" active-package get-package-property 0= if begin decode-phys ( bar prop prop-len phys.lo phys.mid phys.hi ) dup 6 pick = if 2drop -rot decode-int drop decode-int drop 2drop ( bar addr.lo ) \ Now translate addr.lo, FIXME this is wrong \ maybe we should look at parent's ranges instead? over 18 rshift 3 and 1 = if " reg" active-package parent get-package-property 0= if ( bar addr.lo prop prop-len reg.addr reg.size ) decode-int -rot decode-int 3drop + then then nip exit else 3drop \ no match, try next then \ Drop the size as we don't need it decode-int drop decode-int drop dup 0= until 3drop -1 \ not found else drop -1 \ could not find assigned-addresses then ;
which returns the correct values for the case I looked at but likely not the proper way to do this and I don't know why for example only io range needs adding an offset. This also has assumptions about node being direct child of a pci bus so probably won't work with bridges. Also how to add this to be a method of the /pci node (without going through a C function that I could do but seems ugly).
I'm still interested if anyone knows how all this should work so instead of putting together pieces from here and there we actually know where we are going.
Regards, BALATON Zoltan _______________________________________________ OpenBIOS mailing list -- openbios@openbios.org To unsubscribe send an email to openbios-leave@openbios.org
On Sun, 21 Jul 2019, Mark Cave-Ayland wrote:
Finally one other thing: I'm finding this thread really hard to follow - too much information is spread across too many emails, and the subject line isn't really helping me understand what topic we're following or where I can find related information. May I suggest that it makes sense to break this down into a series of smaller, more concise threads?
As a reminder here's what the word from FCode ROM is trying to do that I'm trying to get working (it works with SLOF):
8552: new-token ati-map-io \ 0x926 8555: b(:) 8556: my-address 8558: b(lit) 0x1000014 8563: my-space 8565: + 8566: const_0x100 8568: b(") ( len=6 ) " map-in" 8576: ati-call-parent 8578: b(to) var_mapped_io_base 8581: b(lit) 0x4 8586: my-space 8588: + 8589: dup 8590: b(") ( len=9 ) " config-b@" 8601: ati-call-parent 8603: 1 8604: or 8605: swap 8606: b(") ( len=9 ) " config-b!" 8617: ati-call-parent 8619: b(;)
This would map BAR1 and enable IO access (Command reg bit 0) in config space if I got that right. So we need map-in and config-b[!@] words for this. Currently trying to get past map-in.
Regards, BALATON Zoltan
On Sun, 21 Jul 2019, BALATON Zoltan wrote:
On Sun, 21 Jul 2019, Mark Cave-Ayland wrote:
On 21/07/2019 15:16, BALATON Zoltan wrote:
0 > " /pci@f2000000/ATY" open-dev to my-self
ob_pci_bar_map_in idx=1fc5ac54 pci_bus_addr_to_host_addr space=2 ba=0x82000000 ob_pci_map: phys=0x82000000 size=16384 ob_pci_bar_map_in idx=1fc5ac54 pci_bus_addr_to_host_addr space=2 ba=0x81000000 ob_pci_map: phys=0x81000000 size=16777216
?ok
Here we see 2 MMIO BARs being mapped: one of 16K and another of 16M. And this happens as soon as you open the device? I think you'll have to explain more about your command line and how you are getting OpenBIOS to execute the FCode, since I can't tell if this is OpenBIOS or the FCode.
No FCode here, just started OpenBIOS with patched openbios-elf and typed commands that I've seen in the FCode. All this comes from OpenBIOS, don't ask me why it calls this for open-dev.
This comes from open-dev calling (path-resolution) which calls invoke-open which ends up in the vga.fs FCode that maps these bars. This probably should not happen for ati-vga but OpenBIOS does that for all VGA devices.
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.
Regards, BALATON Zoltan
On Tue, 23 Jul 2019, BALATON Zoltan wrote:
On Sun, 21 Jul 2019, BALATON Zoltan wrote:
On Sun, 21 Jul 2019, Mark Cave-Ayland wrote:
On 21/07/2019 15:16, BALATON Zoltan wrote:
0 > " /pci@f2000000/ATY" open-dev to my-self
ob_pci_bar_map_in idx=1fc5ac54 pci_bus_addr_to_host_addr space=2 ba=0x82000000 ob_pci_map: phys=0x82000000 size=16384 ob_pci_bar_map_in idx=1fc5ac54 pci_bus_addr_to_host_addr space=2 ba=0x81000000 ob_pci_map: phys=0x81000000 size=16777216
?ok
Here we see 2 MMIO BARs being mapped: one of 16K and another of 16M. And this happens as soon as you open the device? I think you'll have to explain more about your command line and how you are getting OpenBIOS to execute the FCode, since I can't tell if this is OpenBIOS or the FCode.
No FCode here, just started OpenBIOS with patched openbios-elf and typed commands that I've seen in the FCode. All this comes from OpenBIOS, don't ask me why it calls this for open-dev.
This comes from open-dev calling (path-resolution) which calls invoke-open which ends up in the vga.fs FCode that maps these bars. This probably should not happen for ati-vga but OpenBIOS does that for all VGA devices.
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.
Regards, BALATON Zoltan
On Tue, 23 Jul 2019, BALATON Zoltan wrote:
On Tue, 23 Jul 2019, BALATON Zoltan wrote:
On Sun, 21 Jul 2019, BALATON Zoltan wrote:
On Sun, 21 Jul 2019, Mark Cave-Ayland wrote:
On 21/07/2019 15:16, BALATON Zoltan wrote:
0 > " /pci@f2000000/ATY" open-dev to my-self
> ob_pci_bar_map_in idx=1fc5ac54 > pci_bus_addr_to_host_addr space=2 ba=0x82000000 > ob_pci_map: phys=0x82000000 size=16384 > ob_pci_bar_map_in idx=1fc5ac54 > pci_bus_addr_to_host_addr space=2 ba=0x81000000 > ob_pci_map: phys=0x81000000 size=16777216
?ok
Here we see 2 MMIO BARs being mapped: one of 16K and another of 16M. And this happens as soon as you open the device? I think you'll have to explain more about your command line and how you are getting OpenBIOS to execute the FCode, since I can't tell if this is OpenBIOS or the FCode.
No FCode here, just started OpenBIOS with patched openbios-elf and typed commands that I've seen in the FCode. All this comes from OpenBIOS, don't ask me why it calls this for open-dev.
This comes from open-dev calling (path-resolution) which calls invoke-open which ends up in the vga.fs FCode that maps these bars. This probably should not happen for ati-vga but OpenBIOS does that for all VGA devices.
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?
Is there anyone who actually understands anything about this here to at least give me some hint if I'm going in the right direction at all with this?
Regards, BALATON Zoltan
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
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).
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?
ATB,
Mark.
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
On 23/07/2019 19:47, BALATON Zoltan wrote:
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?
They are effectively pointers to package and instance structures, but again all this is explained in the IEEE-1275 specification if you look for "active package" and "current instance". I'm not sure there's one particular place that you can look.
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.
You could try:
feval("active-package u.");
and:
feval("my-self u."); feval("my-self ihandle>phandle u.");
ATB,
Mark.