Subject: Re: kern/32342: OpenBSD firmware loading framework
To: Jason Thorpe <thorpej@shagadelic.org>
From: Rui Paulo <rpaulo@fnop.net>
List: netbsd-bugs
Date: 12/20/2005 00:13:41
On 2005.12.19 15:59:48 -0800, Jason Thorpe wrote:
| 
| 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.)

I like this interface. Are you planning to work on it ?

		-- Rui Paulo