From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lucio De Re To: 9fans mailing list <9fans@cse.psu.edu> Message-ID: <20040119204639.Z25947@cackle.proxima.alt.za> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: [9fans] I hate Jim! Date: Mon, 19 Jan 2004 20:46:39 +0200 Topicbox-Message-UUID: bc678de2-eacc-11e9-9e20-41e7f4b1d025 In fact, I don't! I was looking for a catchy subject. I have made a minute amount of progress with the SiS 550 AGP/VGA controller, to the extent that I seem to be reflecting the aperture location and size correctly (I have changed the size and it got picked up correctly - the base didn't move, though, I wonder if it ought to have). Little did I know how many things are conspiring against even an old programming hand like me getting a VGA driver working. The SiS 550, according to the developer who produced the XFree86 driver I'm using as the documentation, is entirely undocumented. SiS have supplied unfinished device drivers to the XFree86 project and are almost actively denying access to their technical information. That whinge out the way, I'm assuming that the following questions will not turn out to be so SiS specific that no one will be able to answer them. In the XFree86 driver, I find the following snippet: pSiS->IODBase = pScrn->domainIOBase; /* We "patch" the PIOOffset inside vgaHW in order to force * the vgaHW module to use our relocated i/o ports. */ VGAHWPTR(pScrn)->PIOOffset = pSiS->IODBase + (pSiS->PciInfo->ioBase[2] & 0xFFFC) - 0x380; I took the liberty of moving the first line closer to the point where it is firstly significant for the sake of clarity (I wish the developer had done it, took me a while to put the two sections of the code together). The 0x380 is clearly a magic number relating to VGA registers (primary VGA? or more global, even?): I note that the Plan 9 code uses it as the base for the VGA registers. The XFree86 driver uses offsets from this, with some glaring inconsistencies. What I totally fail to discover or understand, is the "domainIOBase". I presume it is an XFree86 entity, but I can't easily find out how it is established and used. A nudge in the right direction will help, I think. Then, I suppose I have to accept as gospel truth that the I/O ports get relocated. Again, I can't fathom how that happens, or why, or where. Maybe one of you has seen analogous behaviour elsewhere and can explain it. Private mail is perfectly fine. I keep hoping that at the end of this exercise I'll be able to provide documentation that will help in future attempts, but that may be a pipe dream. If it does happen, I'll be keen to include any suggestions from better skilled developers in the final document, so please let me know if that's OK with you. Lastly, at least for the now, I have no idea what this MMIO thing is all about. I get hints that wondrous things can be done with it, but I can't piece enough bits of usage either in the Plan 9 code or in the SiS driver for XFree86 to indicate how to set it up or use it. I feel like I'm totally blind to some perfectly obvious facility. Are there any references that might help me understand this concept? And how it fits into the scheme of VGA management? I get a very vague feeling that it involves being able to used queued I/O as well, but I really have no clue. Now, having made it clear that I really know extremely little about the target jmk set me (I'm not sure I'm not the butt of a very complex joke), let me confirm your scepticism by explaining how far I got. I can now type: echo type sis550 > /dev/vgactl and get back: Looking for a SiS adapter Looking for some I/O details Probably vain quest for map tables PCI aperture sizes: 0xa1 => 8388608 Aperture: at 0x90000000 - Size: 8388608 thereafter: cat /dev/vgactl yields: type sis550 blank time 30 idle 0 state on hwaccel on hwblank off panning off addr 0x90000000 I used Kenji's i81x driver as template, thank you, Kenji. I'll refrain from commenting on the XFree86 code, it's a gift horse. Anyone wants to see the mess I'm trying to disentangle, shout and I'll post it to my web site, I won't offer, it's really not anything to be proud of. Although the fact that my PCI configuration access (read) functions actually worked first time after I discovered you have to read four bytes at the time had me utterly amazed. In short: Help! ++L