[OpenBIOS] usb driver to support usb keyboard
Mark Cave-Ayland
mark.cave-ayland at ilande.co.uk
Wed May 7 15:00:54 CEST 2014
On 05/05/14 10:26, BALATON Zoltan wrote:
> On Sun, 4 May 2014, Mark Cave-Ayland wrote:
>> On 03/05/14 10:56, BALATON Zoltan wrote:
>>> On Fri, 3 May 2014, Tarl Neustaedter wrote:
>>>> I'm not volunteering to do the work (lest I hear my boss scream in
>>>> agony), but I suspect this is a case that it just drops in and works.
>>>> Lillian wrote it for the OneLaptop project, and I understand that
>>>> implementation and OpenBios haven't diverged all that much.
>>>
>>> Problem is I don't know where to drop it to try if it works and if it
>>> doesn't I don't know how to debug Forth so I could only shoot in the
>>> dark. I don't even know where to start with this Forth driver.
>
> As this seems to be the preferred way I looked at it again to see if I
> can start trying to integrate the usb2 driver from openfirmwre but I
> still don't see where to start.
>
>> Sadly the PCI code in OpenBIOS is still written in C so there would be
>> some interface work required there.
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.
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.
>> In terms of testing the code, Forth is an interpreted language so you
>> can literally copy/paste from the source files into a serial console
>> and see what happens ;) I suspect that the reality will be slightly
>> different though, for example we know that OpenFirmware has behaviours
>> which aren't implemented in OpenBIOS.
>
> The usb driver is split into 75 *.fth files so it's not obvious what to
> paste in a console. Additionally there are some *.bth files that seem to
> build some FCode modules but these are not working on OpenBIOS as they
> contain words that I did not find in OpenBIOS. So I don't know how to
> get OpenBIOS's Forth at least try to interpret these files to see what
> is missing.
In OpenBIOS, files are added into the build.xml file which generates a
set of Makefiles when running the switch-arch script.
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.
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.
HTH,
Mark.
More information about the OpenBIOS
mailing list