DEVMAP_SETUP(9F) | Kernel Functions for Drivers | DEVMAP_SETUP(9F) |
devmap_setup, ddi_devmap_segmap - set up a user mapping to device memory using the devmap framework
#include <sys/ddi.h> #include <sys/sunddi.h> int devmap_setup(dev_t dev, offset_t off, ddi_as_handle_t as,
caddr_t *addrp, size_tlen, uint_t prot, uint_t maxprot,
uint_t flags, cred_t *cred);
int ddi_devmap_segmap(dev_t dev, off_t off, ddi_as_handle_t as,
caddr_t *addrp, off_tlen, uint_t prot, uint_t maxprot,
uint_t flags, cred_t *cred);
illumos DDI specific (illumos DDI).
dev
off
as
addrp
len
prot
PROT_READ
PROT_WRITE
PROT_EXEC
PROT_USER
PROT_ALL
maxprot
flags
MAP_PRIVATE
MAP_SHARED
MAP_FIXED
cred
devmap_setup() and ddi_devmap_segmap() allow device drivers to use the devmap framework to set up user mappings to device memory. The devmap framework provides several advantages over the default device mapping framework that is used by ddi_segmap(9F) or ddi_segmap_setup(9F). Device drivers should use the devmap framework, if the driver wants to:
devmap_setup() must be called in the segmap(9E) entry point to establish the mapping for the application. ddi_devmap_segmap() can be called in, or be used as, the segmap(9E) entry point. The differences between devmap_setup() and ddi_devmap_segmap() are in the data type used for off and len.
When setting up the mapping, devmap_setup() and ddi_devmap_segmap() call the devmap(9E) entry point to validate the range to be mapped. The devmap(9E) entry point also translates the logical offset (as seen by the application) to the corresponding physical offset within the device address space. If the driver does not provide its own devmap(9E) entry point, EINVAL will be returned to the mmap(2) system call.
0
Non-zero
devmap_setup() and ddi_devmap_segmap() can be called from user or kernel context only.
mmap(2), devmap(9E), segmap(9E), ddi_segmap(9F), ddi_segmap_setup(9F), cb_ops(9S)
Writing Device Drivers
January 22, 1997 | OmniOS |