Writing Device Drivers

Device Context Management

The following functions are used to manage device context:

int devmap_do_ctxmgt(devmap_cookie_t cookie,  	
			void *pvtp, offset_t off, size_t len,u_int type, u_int rw,  	
int (*devmap_contextmgt)(devmap_cookie_t,  	void *, offset_t, size_t, u_int, u_int));

Device drivers call devmap_do_ctxmgt(9F) in the devmap_access(9E) entry point to perform device context switching on a mapping. devmap_do_ctxmgt(9F) passes a pointer to a driver supplied callback function, devmap_contextmgt(9E), to the system that will perform the actual device context switching.

int devmap_default_access(devmap_cookie_t cookie,  
  	void *pvtp, offset_t off, size_t len, u_int type, u_int rw);

devmap_default_access(9F) is a function providing the semantics of devmap_access(9E). The driver calls devmap_default_access(9F) to handle the mappings that do not support context switching. The driver should call devmap_do_ctxmgt(9F) for the mappings that support context management.