devmap_contextmgt() is a driver-supplied function that performs device context switching on a mapping. Device drivers pass devmap_contextmgt() as an argument
to devmap_do_ctxmgt(9F) in the devmap_access(9E) entry point. The system will call devmap_contextmgt() when memory is accessed. The system expects
devmap_contextmgt() to load the memory address translations of the mapping by calling devmap_load(9F) before returning.
dhp uniquely identifies the mapping and is used as an argument to devmap_load(9F) to validate the mapping. off and len define the range to be affected by the operations in devmap_contextmgt().
The driver must check if there is already a mapping established at off that needs to be unloaded. If a mapping exists at off, devmap_contextmgt() must call devmap_unload(9F) on the current
mapping. devmap_unload(9F) must be followed by devmap_load() on the mapping that generated this call to devmap_contextmgt(). devmap_unload(9F) unloads the current mapping so that a call to devmap_access(9E), which causes the system to call devmap_contextmgt(), will be generated the next time the mapping is accessed.
pvtp is a pointer to the driver's private mapping data that was allocated and initialized in the devmap_map(9E) entry point. type defines the type of operation that device drivers should perform on the memory object. If type
is either DEVMAP_LOCK or DEVMAP_UNLOCK, the length passed to either devmap_unload(9F) or devmap_load(9F) must be same as len. rw specifies the access direction on the memory object.
A non-zero return value from devmap_contextmgt() will be returned to devmap_access(9E) and will cause the corresponding operation to fail. The failure may result in a SIGSEGV or SIGBUS
signal being delivered to the process.
|