Subject: Re: Firmware upload - generalize it?
To: None <tech-kern@NetBSD.org>
From: Martin Husemann <martin@duskware.de>
List: tech-kern
Date: 05/28/2005 17:06:16
On Fri, May 27, 2005 at 11:54:11PM -0700, marius aamodt eriksen wrote:
> see
> 
>   http://www.openbsd.org/cgi-bin/man.cgi?query=loadfirmware&apropos=0&sektion=0&manpath=OpenBSD+Current&arch=i386&format=html
> 
> for details.

Either I can't parse that man page correctly or it is completely not what
I was thinking of (the minor issue of placing the firmware images left
aside for now).

What I would do is:

 - create two kernel functions fwdownload_register_hook and 
   fwdownload_remove_hook. Drivers register their download function
   with this - passing the device name and a token (most cases: softc pointer)
 - create a /dev/fwdownload and a driver that only understands a very simple
   ioctl (much like the isdn stuff)
 - create a userland tool that loads a file, passes it via that ioctl through
   the above device to it's target device drivers fwdownload hook.
   You would then call:

      /usr/sbin/fwdownload ffb0 /usr/local/lib/afb.ucode

   and the ffb driver gets it's hook function called with all the data from
   the given file.

Note, however, that this is far more than I realy want to do for the ffb case.
The current "afbinit" program is userspace only - it mmaps() a part of the
ffb and does it's magic in userland. The idea to have the X server (since it
is the only application needing that firmware) handle it, sounds good too - 
and as Antti noted is basically the same thing we do for isdn cards now.

Martin