On Dec 31, 2017, at 1:09 PM, Mark Cave-Ayland mark.cave-ayland@ilande.co.uk wrote:
On 31/12/17 12:59, Jd Lyons wrote:
On Dec 30, 2017, at 6:04 AM, Segher Boessenkool <segher@kernel.crashing.org mailto:segher@kernel.crashing.org> wrote:
On Sat, Dec 30, 2017 at 05:44:10AM -0500, Jd Lyons wrote:
On Dec 30, 2017, at 4:21 AM, Segher Boessenkool <segher@kernel.crashing.org mailto:segher@kernel.crashing.org> wrote: On Fri, Dec 29, 2017 at 08:27:54PM -0500, Tarl Neustaedter wrote:
[re-send, copying the list. For whatever reason, it seems messages aren't getting the reply-to: header.]
On 2017-Dec-29 03:58 , Jd Lyons wrote: > 0 > " /pci/@e" open-dev to my-self ok > 0 > my-self . 5fc5ac34 ok > 0 > my-parent . 5fc5abfc ok > 0 > my-space . 0 ok <<---Seems my-space isn't returning a correct value? > 0 > > That's the problem. It appears that simply open-dev and assigning my-self isn't enough. my-space (and my-address and my-unit) aren't getting set up, so all config-space accesses are going to do the wrong thing (they'll go to device 0, which may or may not be the root).
In the Sun/Oracle version, select would properly set things up, it appears no equivalent is available under openbios.
I think you'll have to further debug this by getting the FCode to be pulled in at startup in place of the built-in vga fcode, rather than trying to fiddle things this way.
Or set my-space to return 7000 and keep on fumbling :-)
How would I set my-space to 7000?
Is that specific to pci/@e?
I noticed in SLOF that my-space . returned 1800, however the card was pci/@3.
And that is correct :-)
It is @dev,fn or if fn is 0, it is written as @dev . In the encoded representation, it is 800*dev + 100*fn (dev is 5 bits, fn is 3 bits).
In openbios, it looks like my-space gets its data from >dn.probe-addr in the device node... And it is set via set-args... And then I got lost, not sure how that is supposed to be called.
Looks like we need to change the way openbios handles my-space. SLOF deals with it in the nodes.fs : (my-phandle) ( -- phandle ) my-self ?dup IF ihandle>phandle ELSE get-node dup 0= ABORT" no active node" THEN ; : my-space ( -- phys.hi ) (my-phandle) >space ; I think we also need the >space word, the phandle word, and the ihandle word, I’ll have to track that down too. John, do you want to take a crack at fixing the >dn.probe-addr, or replacing it with something that returns a correct my-space .?
After a bit of poking, it appears that the issue is simply that set-args isn't being called for PCI devices.
The attached patch appears to fix the issue for me - can you confirm that it works for you?
0 > " /pci/QEMU,VGA" open-dev to my-self ok 0 > my-space u. 800 ok
Thanks Mark, that seems to work. my-space . now returns 7000 for /pci/@e.
That seems correct to me?
I’m still catching an exception at the same place, but now, at least, I think, we have the correct instance.
Any insight on what I could/should try next Tarl?
<> ( 0x03d ) 25619: b?branch ( 0x014 ) 0x0026 ( =dec 38) 25620: (unnamed-fcode) [0x9bd] 25621: b(lit) ( 0x010 ) 0xff 25622: and ( 0x023 ) 25623: my-space ( 0x103 ) 25624: + ( 0x01e ) 25625: (unnamed-fcode) [0xa08] 25626: b(lit) ( 0x010 ) 0x6 25627: and ( 0x023 ) 25628: b(lit) ( 0x010 ) 0x4 25629: = ( 0x03c ) 25630: b?branch ( 0x014 ) 0x0009 () 25631: b(') ( 0x011 ) (unnamed-fcode) [0x9c1] 25632: b(to) ( 0x0c3 ) (unnamed-fcode) [0x9c0] 25633: b(>resolve) ( 0x0b2 ) 25634: b(>resolve) ( 0x0b2 ) <<<————Still catching the exception here 25635: (unnamed-fcode) [0xddf]
ATB,
Mark. <openbios-pci-set-args.patch>