On Wed, 7 May 2014, Mark Cave-Ayland wrote:
First place I would look at is in drivers/pci.c and drivers/pci-database.c to make sure that the USB host is detected in the firmware tree - it should appear without any properties. Next download the IEEE1275 PCI bindings and have a look at the words there.
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.
Probably the first place to start is getting the PCI config space accesses working; for this you will probably need to implement some Forth wrappers around C for the PCI config space access functions from the PCI bindings.
I don't see this yet. Can you give me some more details like which Forth words should be implemented by wrapping which C functions and an example of such implementation?
In OpenBIOS, files are added into the build.xml file which generates a set of Makefiles when running the switch-arch script.
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?
The .bth files are probably used to create FCode blobs, much in the same way as the toke utility from the OpenBIOS fcode-utils does. Take a look at drivers/build.xml and in particular the vga driver to see how this is done, as this was a driver I converted over from C.
The ohci.bth file looks like this:
---begin--- purpose: Load file for OHCI HCD
command: &tokenize &this build-now
silent on
begin-tokenizing ohci.fc
FCode-version2
" ohci" encode-string " device_type" property
fload ${BP}/dev/usb2/hcd/ohci/loadpkg.fth
end0
end-tokenizing ---end---
and the hcd/ohci/loadpkg.fth referenced here contains more fload commands that load the other parts. What is the equivalent in OpenBIOS's Forth to do this?
Instead of fload, you should be able to use include instead (see forth/bootstrap/start.fs). And for tokenizing, you simply run the Forth source code through fcode-utils' toke command.
OK, I'll try to use include instead of fload and see what errors I get and if I can make sense of them.
Also once you start to get a feel for the work and think it's viable, we should get Stefan to make sure he's okay with the OpenFirmware license with respect to OpenBIOS' GPLv2.
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.)
Regards, BALATON Zoltan