The devmap_map() entry point is an optional routine that allows drivers to perform additional processing or to allocate private resources during the mapping setup time. For example,
in order for device drivers to support context switching, the drivers allocate private mapping data and associate the private data with the mapping parameters in the devmap_map() entry
point.
The system calls devmap_map() after the user mapping to device physical memory has been established. (For example, after the devmap(9E) entry point is called.)
devmap_map() receives a pointer to the driver private data for this mapping in pvtp. The system expects the driver to allocate its private data and set *pvtp to the allocated data. The driver must store off and len, which define the range of the mapping, in its private data. Later, when the system
calls devmap_unmap(9E), the driver will use the off and len stored in pvtp to check if the entire mapping, or just a part of it, is being unmapped. If only a part of the mapping is being unmapped, the driver must allocate
a new private data for the remaining mapping before freeing the old private data. The driver will receive *pvtp in subsequent event notification callbacks.
If the driver support context switching, it should store the mapping handle dhp in its private data *pvtp for later use in devmap_unload(9F).
For a driver that supports context switching, flags indicates whether or not the driver should allocate a private context for the mapping. For example, a driver may allocate
a memory region to store the device context if flags is set to MAP_PRIVATE.
|