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 23:48:39
On Mon, 19 Dec 2005, Jason Thorpe wrote:

> The following reply was made to PR kern/32342; it has been noted by GNATS.
>
>  On Dec 19, 2005, at 2:49 PM, Rui Paulo wrote:
>
>  > On 2005.12.19 14:20:53 -0800, Jason Thorpe wrote:
>  > |
>  > Is there any device driver in our tree that tries to load the firmware
>  > in pieces at a time ? I know this could change in the future.
>
>  dev/pci/cz.c

the firmware image (dev/microcode/cyclades-z/cyzfirm.h) is in one chunk
though. Wow thats a big chunk of firmware (does that get paged out?)

ubt/ubtbcmfw.c actually does load firmware in chunks and feeds it to the
usb driver piecemeal. However, for the bt3c device it would probably like
to read it all at once in any case (its <4k) as its an ASCII file and
needs to be parsed before writing it (in 15 word blocks) to the device.

hm.

1. It seems to me that it would be better to read such a firmware file one
time and free it after use than to waste a chunk of memory (even if paged
out) for ever.

2.

int
load_firmware(const char *, int (*func)(void *, uint8_t *, size_t), size_t, void *)


	load_firmware("filename", load_func, chunk_size, arg);

		if chunk_size == 0
			len = file size;
		else
			len = min(chunk_size, residual)

	load_func(arg, ptr, len)

would enable both options..?

iain