MyWebUniversity.com Home Page
 



OpenSolaris man pages main menu


Kernel Functions for Drivers                     devmapsetup(9F)



NAME
     devmapsetup, ddidevmapsegmap - set up a user  mapping  to
     device memory using the devmap framework

SYNOPSIS
     #include 
     #include 



     int devmapsetup(devt dev, offsett off, ddiashandlet as,
          caddrt *addrp, sizetlen, uintt prot, uintt maxprot,
          uintt flags, credt *cred);


     int ddidevmapsegmap(devt dev, offt off, ddiashandlet as,
          caddrt *addrp, offtlen, uintt prot, uintt maxprot,
          uintt flags, credt *cred);


INTERFACE LEVEL
     Solaris DI specific (Solaris DI).

PARAMETERS
     dev         Device whose memory is to be mapped.


     off         User offset within the logical device memory  at
                 which the mapping begins.


     as          An opaque  data  structure  that  describes  the
                 address  space  into  which  the  device  memory
                 should be mapped.


     addrp       Pointer to the starting address in  the  address
                 space  into  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
                 possible settings combinations are:

                 PROTREAD      Read access is desired.


                 PROTWRITE     Write access is desired.




SunOS 5.11          Last change: 22 Jan 1997                    1






Kernel Functions for Drivers                     devmapsetup(9F)



                 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.


     flags       Flags indicating type of mapping. The  following
                 flags can be specified:

                 MAPRIVATE     Changes are private.


                 MAPSHARED      Changes should be shared.


                 MAPFIXED       The user specified an address in
                                 *addrp  rather  than letting the
                                 system choose an address.



     cred        Pointer to the user credential structure.


DESCRIPTION
     devmapsetup() and ddidevmapsegmap() allow device  drivers
     to  use the devmap framework to set up user mappings to dev-
     ice memory.  The devmap framework  provides  several  advan-
     tages over the default device mapping framework that is used
     by ddisegmap(9F) or  ddisegmapsetup(9F).  Device  drivers
     should use the devmap framework, if the driver wants to:

         o    use an optimal MU  pagesize  to  minimize  address
              translations,

         o    conserve kernel resources,

         o    receive callbacks to manage events on the mapping,

         o    export kernel memory to applications,




SunOS 5.11          Last change: 22 Jan 1997                    2






Kernel Functions for Drivers                     devmapsetup(9F)



         o    set up device contexts for the user mapping if  the
              device requires context switching,

         o    assign device access attributes to  the  user  map-
              ping, or

         o    change the maximum protection for the mapping.


     devmapsetup() must be called in the segmap(9E) entry  point
     to    establish    the    mapping   for   the   application.
     ddidevmapsegmap() can be called in, or  be  used  as,  the
     segmap(9E)    entry    point.    The   differences   between
     devmapsetup() and ddidevmapsegmap() are in the data  type
     used for off and len.


     When   setting   up   the   mapping,    devmapsetup()   and
     ddidevmapsegmap() call the devmap(9E) entry point to vali-
     date 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.

RETURN VALUES
     0           Successful completion.


     Non-zero    An  error  occurred.   The   return   value   of
                 devmapsetup() and ddidevmapsegmap() should be
                 used directly in the  segmap(9E) entry point.


CONTEXT
     devmapsetup() and ddidevmapsegmap() can  be  called  from
     user or kernel context only.

SEE ALSO
     mmap(2),     devmap(9E),     segmap(9E),     ddisegmap(9F),
     ddisegmapsetup(9F), cbops(9S)


     Writing Device Drivers










SunOS 5.11          Last change: 22 Jan 1997                    3



OpenSolaris man pages main menu

Contact us      |       About us      |       Term of use      |       Copyright © 2000-2010 MyWebUniversity.com ™