Subject: Re: kern/32342: OpenBSD firmware loading framework
To: Iain Hibbert <plunky@rya-online.net>
From: Jason Thorpe <thorpej@shagadelic.org>
List: netbsd-bugs
Date: 12/19/2005 15:59:48
On Dec 19, 2005, at 3:48 PM, Iain Hibbert wrote:

> 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..?

I'm thinking more like:

	error = firmware_open("cz", ..., &handle);

	...

	error = firmware_read(handle, offset, buf, buflen);

	...

	error = firmware_close(handle);

Driver allocates and frees its own buffers.  Perhaps we provide  
firmware_*() routines for buffer management (pageable vs. non- 
pageable memory, etc.)

-- thorpej