On Wed, 7 May 2014, Mark Cave-Ayland wrote:
On 07/05/14 17:54, BALATON Zoltan wrote:
I've already looked at pci-database.c for the C driver from coreboot's libpayload. The USB controller was detected but printed "cannot manage" as there was no driver. I could add a callback to call the init function of the driver. I assume for a Forth driver should replace this to call into Forth like the vga driver does.
Yes, that's the one. You can add a dummy callback for testing that does nothing to start with, but that should be enough for it to show up with its device/vendor id when running "show-devs". Does Mac99 use OHCI or UHCI?
It uses OHCI. Did you look at the diff in the tar file I've sent earlier with my try for a usb driver? That includes the callback to handle the device so I think I have this already.
Okay: taking section 3.2.3 of the PCI bindings, as an example you'd need to wrap the config-l@ and config-l! words so that they call OpenBIOS' pci_config_read32() and pci_config_write32() functions to access PCI configuration space.
The ohci driver does not seem to need these words so I don't care about them at first. I'd rather have the driver compile or called first to get some error messages indicating what does it need and then work on those.
I've found this but I don't know how to add files for a driver. The vga driver is in build.xml like this:
<fcode source="vga.fs" name="QEMU,VGA.bin" condition="DRIVER_VGA" />
What should be the name? Can I just come up with something or are there some rules to follow?
Bear in mind that fcode is for compiled files, e.g. the above says take vga.fs and output the binary QEMU,VGA.bin. To add a .fs to the Forth dictionary you need to add them within the <dictionary> tags.
In my understanding the driver for ohci should be an fcode driver so I think I need to compile that. Can I just use QEMU,OHCI as a name?
Definitely start with a small set of files and get the basic PCI configuration accesses working first, and then slowly add in the other files until you get something that works.
I thought about starting with the ohci driver (it's in 9 files plus about the same ammount of others it uses) and try to get it compiled/loaded to see what functions it needs and then work on those.
There's not much I can do about that licensing so feel free to ask now, it's better to know upfront if the patch cannot be accepted. (Although I've checked on gnu.org that the BSD style license should be compatible with GPLv2.)
Okay - would you like to email Stefan and CC me?
I thought the other way around that you write him and maybe cc-me if you want and I try to work on the driver instead.
Regards, BALATON Zoltan