Subject: Re: kern/32342: OpenBSD firmware loading framework
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: Jason Thorpe <thorpej@shagadelic.org>
List: netbsd-bugs
Date: 12/20/2005 00:00:04
The following reply was made to PR kern/32342; it has been noted by GNATS.

From: Jason Thorpe <thorpej@shagadelic.org>
To: Iain Hibbert <plunky@rya-online.net>
Cc: 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: Mon, 19 Dec 2005 15:59:48 -0800

 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