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