Kernel Functions for Drivers ddisegmap(9F)
NAME
ddisegmap, ddisegmapsetup - set up a user mapping using
segdev
SYNOPSIS
#include
#include
#include
int ddisegmap(devt dev, offt offset, struct as *asp,
caddrt *addrp, offt len, uintt prot,
uintt maxprot, uintt flags, credt *credp);
int ddisegmapsetup(devt dev, offt offset, struct as *asp,
caddrt *addrp, offt len, uintt prot,
uintt maxprot, uintt flags, credt *credp,
ddideviceaccattrt *accattrp, uintt rnumber);
INTERFACE LEVEL
These interfaces are obsolete. See devmap(9E) for an alter-
native to ddisegmap(). Use devmapsetup(9F) instead of
ddisegmapsetup().
PARAMETERS
dev The device whose memory is to be mapped.
offset The offset within device memory at which the
mapping begins.
asp An opaque pointer to the user address space into
which the device memory should be mapped.
addrp Pointer to the starting address within the user
address space to which the device memory should
be mapped.
len Length (in bytes) of the memory to be mapped.
prot A bit field that specifies the protections. Some
combinations of possible settings are:
PROTREAD Read access is desired.
SunOS 5.11 Last change: 17 Nov 2003 1
Kernel Functions for Drivers ddisegmap(9F)
PROTWRITE Write access is desired.
PROTEXEC Execute access is desired.
PROTUSER User-level access is desired (the
mapping is being done as a result
of a mmap(2) system call).
PROTAL All access is desired.
maxprot Maximum protection flag possible for attempted
mapping (the PROTWRITE bit may be masked out if
the user opened the special file read-only). If
(maxprot & prot) != prot then there is an access
violation.
flags Flags indicating type of mapping. Possible
values are (other bits may be set):
MAPRIVATE Changes are private.
MAPSHARED Changes should be shared.
MAPFIXED The user specified an address in
*addrp rather than letting the
system pick and address.
credp Pointer to user credential structure.
ddisegmapsetup()
devaccattr Pointer to a ddideviceaccattr(9S) struc-
ture which contains the device access
attributes to apply to this mapping.
rnumber Index number to the register address space
set.
DESCRIPTION
SunOS 5.11 Last change: 17 Nov 2003 2
Kernel Functions for Drivers ddisegmap(9F)
Future releases of Solaris will provide this function for
binary and source compatibility. However, for increased
functionality, use ddidevmapsegmap(9F) instead. See
ddidevmapsegmap(9F) for details.
ddisegmap() and ddisegmapsetup() set up user mappings to
device space. When setting up the mapping, the ddisegmap()
and ddisegmapsetup() routines call the mmap(9E) entry
point to validate the range to be mapped. When a user pro-
cess 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 DI framework.
ddisegmap() is typically used as the segmap(9E) entry in
the cbops(9S) structure for those devices that do not
choose to provide their own segmap(9E) entry point. How-
ever, some drivers may have their own segmap(9E) entry point
to do some initial processing on the parameters and then
call ddisegmap() to establish the default memory mapping.
ddisegmapsetup() is used in the drivers segmap(9E) entry
point to set up the mapping and assign device access attri-
butes to that mapping. rnumber specifies the register set
representing the range of device memory being mapped. See
ddideviceaccattr(9S) for details regarding what device
access attributes are available.
ddisegmapsetup() cannot be used directly in the cbops(9S)
structure and requires a driver to have a segmap(9E) entry
point.
RETURN VALUES
ddisegmap() and ddisegmapsetup() return the following
values:
0 Successful completion.
Non-zero An error occurred. In particular, they return
ENXIO if the range to be mapped is invalid.
CONTEXT
ddisegmap() and ddisegmapsetup() can be called from user
or kernel context only.
SunOS 5.11 Last change: 17 Nov 2003 3
Kernel Functions for Drivers ddisegmap(9F)
ATRIBUTES
See attributes(5) for a description of the following attri-
butes:
ATRIBUTE TYPE ATRIBUTE VALUE
Stability Level Obsolete
SEE ALSO
mmap(2), attributes(5), devmap(9E), mmap(9E), segmap(9E),
devmapsetup(9F), cbops(9S), ddideviceaccattr(9S)
Writing Device Drivers
SunOS 5.11 Last change: 17 Nov 2003 4
|