map(D2X)map(D2X)NAMEmap - support virtual mapping for memory-mapped device
SYNOPSIS
#include <sys/types.h>
#include <sys/mman.h>
#include <sys/ddi.h>
#include <ksys/ddmap.h>
int prefixmap(dev_t dev, vhandl_t *vt, off_t off, size_t len, uint prot);
Arguments
dev Device whose memory is to be mapped.
vt A pointer to the kernel-resident data structure that describes the
virtual space to which the device memory will be mapped. The driver
needs this pointer when calling kernel service routines (i.e.,
v_mapphys(D3X)).
off Offset within device memory at which mapping begins.
len The length (in bytes) of the device memory to be mapped into the
user's address space.
prot Protection flags from mman.h.
DESCRIPTION
The map entry point provides a way to support drivers for memory-mapped
devices. A memory-mapped device has memory that can be mapped into a
process's address space. The mmap(2) system call allows this device
memory to be mapped into user space for direct access by the user
application (this way no kernel buffering or system call overhead is
incurred).
Return Values
If the protection and offset are valid for the device, the driver should
return 0. Otherwise, the appropriate error number should be returned.
USAGE
This entry point is optional, and valid for memory-mapped device drivers
only.
Valid values for prot are:
PROT_READ
Page can be read.
PROT_WRITE
Page can be written.
Page 1
map(D2X)map(D2X)
PROT_EXEC
Page can be executed.
PROT_ALL
All of the above.
The driver should treat vt as opaque and should not try to directly set
any of the member values. To map physical addresses into user address
space, drivers should use the v_mapphys(D3X) function. Use
v_gethandle(D3X) if the driver must remember several virtual handles.
Synchronization Constraints
The map routine has user context and can sleep.
REFERENCESunmap(D2X), v_getaddr(D3X), v_getlen(D3X), v_gethandle(D3X),
v_mapphys(D3X)
Page 2