Subject: Re: kern/32342: OpenBSD firmware loading framework
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: Rui Paulo <rpaulo@fnop.net>
List: netbsd-bugs
Date: 12/20/2005 00:15:03
The following reply was made to PR kern/32342; it has been noted by GNATS.

From: Rui Paulo <rpaulo@fnop.net>
To: Jason Thorpe <thorpej@shagadelic.org>
Cc: Iain Hibbert <plunky@rya-online.net>, gnats-bugs@netbsd.org,
	kern-bug-people@netbsd.org, gnats-admin@netbsd.org,
	netbsd-bugs@netbsd.org
Subject: Re: kern/32342: OpenBSD firmware loading framework
Date: Tue, 20 Dec 2005 00:13:41 +0000

 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