MyWebUniversity.com Home Page
 



OpenSolaris man pages main menu


Kernel Functions for Drivers              devmapdevmemsetup(9F)



NAME
     devmapdevmemsetup, devmapumemsetup - set  driver  memory
     mapping parameters

SYNOPSIS
     #include 
     #include 



     int devmapdevmemsetup(devmapcookiet dhp, devinfot *dip,
          struct devmapcallbackctl *callbackops, uintt rnumber,
          offsett roff,  sizet len, uintt maxprot,
          uintt flags, ddideviceaccattrt *accattrp);


     int devmapumemsetup(devmapcookiet dhp, devinfot *dip,
          struct devmapcallbackctl *callbackops, ddiumemcookiet cookie,
          offsett koff, sizet len, uintt maxprot, uintt flags,
          ddideviceaccattrt *accattrp);


INTERFACE LEVEL
     Solaris DI specific (Solaris DI).

PARAMETERS
     devmapdevmemsetup() parameters:

     dhp            An opaque mapping handle that the system uses
                    to describe the mapping.


     dip            Pointer to the device's devinfo structure.


     callbackops    Pointer to a  devmapcallbackctl(9S)  struc-
                    ture. The structure contains pointers to dev-
                    ice  driver-supplied  functions  that  manage
                    events  on  the device mapping. The framework
                    will copy the structure to the system private
                    memory.


     rnumber        Index number to the  register  address  space
                    set.


     roff           Offset into the register address space.


     len            Length  (in  bytes)  of  the  mapping  to  be
                    mapped.



SunOS 5.11          Last change: 05 Jun 2006                    1






Kernel Functions for Drivers              devmapdevmemsetup(9F)



     maxprot        Maximum   protection   flag   possible    for
                    attempted  mapping. Some combinations of pos-
                    sible settings are:

                    PROTREAD     Read access is allowed.


                    PROTWRITE    Write access is allowed.


                    PROTEXEC     Execute access is allowed.


                    PROTUSER     User-level access  is  allowed.
                                  The mapping is done as a result
                                  of a mmap(2) system call.


                    PROTAL      All access is allowed.



     flags          Used to determine the cache attribute.

                    Possible values of the cache attribute are:

                    IOMEMDATACACHED           The CPU can cache
                                                the    data    it
                                                fetches and  push
                                                it to memory at a
                                                later time.  This
                                                is   the  default
                                                attribute that is
                                                used  if no cache
                                                attributes    are
                                                specified.


                    IOMEMDATAUCWRCOMBINE    The   CPU   never
                                                caches  the data,
                                                but  writes   can
                                                occur    out   of
                                                order or  can  be
                                                combined.  Reord-
                                                ering is implied.

                                                If
                                                IOMEMDATAUCWRCOMBINE
                                                is specified  but
                                                not    supported,
                                                IOMEMDATAUNCACHED
                                                is used instead.



SunOS 5.11          Last change: 05 Jun 2006                    2






Kernel Functions for Drivers              devmapdevmemsetup(9F)



                    IOMEMDATAUNCACHED         The   CPU   never
                                                caches  data, but
                                                has   uncacheable
                                                access to memory.
                                                Strict   ordering
                                                is implied.

                    The cache attributes are mutually  exclusive.
                    Any  combination  of  the  values  leads to a
                    failure.  On  the  SPARC  architecture,  only
                    IOMEMDATACACHED  is meaningful. Others lead
                    to a failure.


     accattrp       Pointer to a ddideviceaccattr()  structure
                    of  the  device. See ddideviceaccattr(9S).
                    The value in devaccattrdataorder is ignored
                    in   the   current   release.  The  value  in
                    devaccattrendianflags is meaningful on the
                    SPARC architecture only.



     devmapumemsetup() parameters:

     dhp            An opaque data structure that the system uses
                    to describe the mapping.


     dip            Pointer to the device's devinfo structure.


     callbackops    Pointer to a  devmapcallbackctl(9S)  struc-
                    ture. The structure contains pointers to dev-
                    ice  driver-supplied  functions  that  manage
                    events on the device mapping.


     cookie         A     kernel     memory      cookie      (see
                    ddiumemalloc(9F)).


     koff           Offset into  the  kernel  memory  defined  by
                    cookie.


     len            Length  (in  bytes)  of  the  mapping  to  be
                    mapped.


     maxprot        Maximum   protection   flag   possible    for
                    attempted   mapping.   Some  combinations  of



SunOS 5.11          Last change: 05 Jun 2006                    3






Kernel Functions for Drivers              devmapdevmemsetup(9F)



                    possible settings are:

                    PROTREAD     Read access is allowed.


                    PROTWRITE    Write access is allowed.


                    PROTEXEC     Execute access is allowed.


                    PROTUSER     User-level  access  is  allowed
                                  (the mapping is being done as a
                                  result  of  a  mmap(2)   system
                                  call).


                    PROTAL      All access is allowed.



     flags          Must be set to 0.


     accattrp       Pointer to a  ddideviceaccattr(9S)  struc-
                    ture.   Ignored   in   the  current  release.
                    Reserved for future use.


DESCRIPTION
     The devmapdevmemsetup() and devmapumemsetup()  functions
     are  used  in  the  devmap(9E)  entry  point to pass mapping
     parameters from the driver to the system.


     The dhp argument specifies a device mapping handle that  the
     system  uses  to  store all mapping parameters of a physical
     contiguous memory. The system copies the data pointed to  by
     callbackops  to  a  system  private  memory. This allows the
     driver  to  free  the  data  after  returning  from   either
     devmapdevmemsetup()  or devmapumemsetup(). The driver is
     notified of user events on the mappings via the entry points
     defined  by  devmapcallbackctl(9S). The driver is notified
     of the following user events:

     Mapping Setup    User has called mmap(2) to create a mapping
                      to the device memory.


     Access           User has accessed an address in the mapping
                      that has no translations.




SunOS 5.11          Last change: 05 Jun 2006                    4






Kernel Functions for Drivers              devmapdevmemsetup(9F)



     Duplication      User has duplicated the  mapping.  Mappings
                      are   duplicated  when  the  process  calls
                      fork(2).


     Unmapping        User has called munmap(2) on the mapping or
                      is exiting, exit(2).



     See devmapmap(9E), devmapaccess(9E),  devmapdup(9E),  and
     devmapunmap(9E) for details on these entry points.


     By specifying a valid  callbackops  to  the  system,  device
     drivers  can manage events on a device mapping. For example,
     the devmapaccess(9E) entry point allows the drivers to per-
     form  context  switching  by unloading the mappings of other
     processes and to load the mapping of  the  calling  process.
     Device  drivers  may specify NUL to callbackops which means
     the drivers do not want to be notified by the system.


     The maximum protection allowed for the mapping is  specified
     in  maxprot.  accattrp defines the device access attributes.
     See ddideviceaccattr(9S) for more details.


     devmapdevmemsetup() is used for device memory  to  map  in
     the  register  set  given by rnumber and the offset into the
     register address  space  given  by  roff.  The  system  uses
     rnumber  and roff to go up the device tree to get the physi-
     cal address that  corresponds  to  roff.  The  range  to  be
     affected  is defined by len and roff. The range from roff to
     roff ] len must be a physical  contiguous  memory  and  page
     aligned.


     Drivers use devmapumemsetup() for kernel memory to map  in
     the  kernel  memory  described by cookie and the offset into
     the kernel memory space given by koff. cookie  is  a  kernel
     memory  pointer  obtained from ddiumemalloc(9F). If cookie
     is NUL, devmapumemsetup() returns -1.  The  range  to  be
     affected  is defined by len and koff. The range from koff to
     koff ] len must be within the limits of  the  kernel  memory
     described by koff ] len and must be page aligned.


     Drivers use devmapumemsetup() to export the kernel  memory
     allocated  by  ddiumemalloc(9F)  to user space. The system
     selects a user virtual address that is aligned with the ker-
     nel  virtual address being mapped to avoid cache incoherence



SunOS 5.11          Last change: 05 Jun 2006                    5






Kernel Functions for Drivers              devmapdevmemsetup(9F)



     if the mapping is not MAPFIXED.

RETURN VALUES
     0     Successful completion.


     -1    An error occurred.


CONTEXT
     devmapdevmemsetup() and devmapumemsetup() can be  called
     from user, kernel, and interrupt context.

SEE ALSO
     exit(2),   fork(2),    mmap(2),    munmap(2),    devmap(9E),
     ddiumemalloc(9F),                 ddideviceaccattr(9S),
     devmapcallbackctl(9S)


     Writing Device Drivers



































SunOS 5.11          Last change: 05 Jun 2006                    6



OpenSolaris man pages main menu

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