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