ddi_segmap, ddi_segmap_setup - set up a user mapping using seg_dev
#include <sys/conf.h> #include <sys/ddi.h> #include <sys/sunddi.h> int ddi_segmap(dev_t dev, off_t offset, struct as *asp, caddr_t *addrp, off_t len, uint_t prot, uint_t maxprot, uint_t flags, cred_t *credp);
int ddi_segmap_setup(dev_t dev, off_t offset, struct as *asp, caddr_t *addrp, off_t len, uint_t prot, uint_t maxprot, uint_t flags, cred_t *credp, ddi_device_acc_attr_t *accattrp, uint_t rnumber);
These interfaces are obsolete. See devmap(9E) for an alternative to ddi_segmap(). Use devmap_setup(9F) instead of ddi_segmap_setup().
dev
offset
asp
addrp
len
prot
PROT_READ
PROT_WRITE
PROT_EXEC
PROT_USER
PROT_ALL
maxprot
flags
MAP_PRIVATE
MAP_SHARED
MAP_FIXED
credp
dev_acc_attr
rnumber
Future releases of Solaris will provide this function for binary and source compatibility. However, for increased functionality, use ddi_devmap_segmap(9F) instead. See ddi_devmap_segmap(9F) for details.
ddi_segmap() and ddi_segmap_setup() set up user mappings to device space. When setting up the mapping, the ddi_segmap() and ddi_segmap_setup() routines call the mmap(9E) entry point to validate the range to be mapped. When a user process accesses the mapping, the drivers mmap(9E) entry point is again called to retrieve the page frame number that needs to be loaded. The mapping translations for that page are then loaded on behalf of the driver by the DDI framework.
ddi_segmap() is typically used as the segmap(9E) entry in the cb_ops(9S) structure for those devices that do not choose to provide their own segmap(9E) entry point. However, some drivers may have their own segmap(9E) entry point to do some initial processing on the parameters and then call ddi_segmap() to establish the default memory mapping.
ddi_segmap_setup() is used in the drivers segmap(9E) entry point to set up the mapping and assign device access attributes to that mapping.
rnumber specifies the register set representing the range of device memory being mapped. See ddi_device_acc_attr(9S) for
details regarding what device access attributes are available.
ddi_segmap_setup() cannot be used directly in the cb_ops(9S) structure and requires a driver to have a segmap(9E) entry point.
ddi_segmap() and ddi_segmap_setup() return the following values:
0
Non-zero
ddi_segmap() and ddi_segmap_setup() can be called from user or kernel context only.
See attributes(5) for a description of the following attributes:
|
mmap(2), attributes(5), devmap(9E), mmap(9E), segmap(9E), devmap_setup(9F), cb_ops(9S), ddi_device_acc_attr(9S)
Writing Device Drivers
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |