Subject: Re: kern/32342: OpenBSD firmware loading framework
To: None <gnats-bugs@netbsd.org>
From: Iain Hibbert <plunky@rya-online.net>
List: netbsd-bugs
Date: 12/19/2005 22:46:16
On Mon, 19 Dec 2005, Jason Thorpe wrote:

> The following reply was made to PR kern/32342; it has been noted by GNATS.
>
> From: Jason Thorpe <thorpej@shagadelic.org>
> To: gnats-bugs@netbsd.org
> Cc: kern-bug-people@netbsd.org, gnats-admin@netbsd.org,
> 	netbsd-bugs@netbsd.org
> Subject: Re: kern/32342: OpenBSD firmware loading framework
> Date: Mon, 19 Dec 2005 14:20:53 -0800
>
>  On Dec 19, 2005, at 2:10 PM, plunky@rya-online.net wrote:
>
>  > 	I want to load driver firmware file from inside the kernel and there
>  > 	is no way currently to do that. Christos Zoulas mentioned on tech-
>  > kern
>  > 	that OpenBSD had a framwork to handle this so I took a look. This is
>  > 	the result, please find below a shar archive containing two new
>  > files:
>  >
>  > 		sys/dev/firmload.c
>  > 		share/man/man9/load_firmware.9
>
>  I'm not sure I like this:
>
>  - Tries to read it all in at once (into a wired kernel buffer
>  allocated from kmem_map).  It would be better to allow a driver to
>  read in pieces at a time, potentially into pageable memory.

that is true - there is an upper limit (seems rather generous currently)
though and I would expect that since its firmware it would be written to
the device then free()d ?  Thats what I just did for my device, not sure
how it has generally been used in OpenBSD..

I also did not especially like the mismatched

load_firmware(..)
free(.., M_DEVBUF)

I think free_firmware() would be preferable, even if just a #define ?

>  - It should be possible to set the directory search path via sysctl,
>  rather than hard-coding "/etc/firmware".

Ah, I thought something like that when I first looked at it, but forgot.
Easy to add, however..

hw.firmware.directory = /etc/firmware
hw.firmware.max_size =

?

iain