MyWebUniversity.com Home Page
 



OpenSolaris man pages main menu


Driver Entry Points                             devmapaccess(9E)



NAME
     devmapaccess - device mapping access entry point

SYNOPSIS
     #include 
     #include 



     int prefixdevmapaccess(devmapcookiet dhp, void *pvtp,
          offsett off, sizet len, uintt type, uintt rw);


INTERFACE LEVEL
     Solaris DI specific (Solaris DI).

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


     pvtp     Driver private mapping data.


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


     len      Length (in bytes) of the memory being accessed.


     type     Type of access operation.  Possible values are:

              DEVMAPACES     Memory access.


              DEVMAPLOCK       Lock the memory being accessed.


              DEVMAPUNLOCK     Unlock the memory being accessed.



     rw       Direction of access.  Possible values are:

              DEVMAPREAD      Read access attempted.


              DEVMAPWRITE     Write access attempted.






SunOS 5.11          Last change: 17 Jan 1997                    1






Driver Entry Points                             devmapaccess(9E)



              DEVMAPEXEC      Execution access attempted.



DESCRIPTION
     The devmapaccess() entry point is an optional routine.   It
     notifies  drivers  whenever  an  access is made to a mapping
     described by  dhp that has not been validated or  does   not
     have  sufficient  protection  for  the  access.   The system
     expects devmapaccess() to call either  devmapdoctxmgt(9F)
     or  devmapdefaultaccess(9F)  to  load  the  memory address
     translations before it returns. For  mappings  that  support
     context    switching,     device    drivers    should   call
     devmapdoctxmgt(9F). For mappings that do not support  con-
     text      switching,     the     drivers     should     call
     devmapdefaultaccess(9F).


     In  devmapaccess(), drivers perform memory  access  related
     operations  such  as context switching, checking the availa-
     bility of the memory  object, and locking and unlocking  the
     memory  object  being  accessed.  The  devmapaccess() entry
     point is set to  NUL if no operations need to be performed.


     pvtp is a pointer to the driver's private mapping data  that
     was  allocated  and  initialized in the devmapmap(9E) entry
     point.


     off and len define the range to be affected  by  the  opera-
     tions in devmapaccess(). type defines the type of operation
     that device drivers should perform on the memory object.  If
     type  is  either  DEVMAPLOCK  or  DEVMAPUNLOCK, the length
     passed      to      either      devmapdoctxmgt(9F)      or
     devmapdefaultaccess(9F) must be same as  len. rw specifies
     the direction of access on the memory object.


     A non-zero return value from  devmapaccess() may result  in
     a SIGSEGV or SIGBUS signal being delivered to the process.

RETURN VALUES
     devmapaccess() returns the following values:

     0           Successful completion.


     Non-zero    An  error  occurred.   The  return  value   from
                 devmapdoctxmgt(9F)                          or
                 devmapdefaultaccess(9F) should be returned.




SunOS 5.11          Last change: 17 Jan 1997                    2






Driver Entry Points                             devmapaccess(9E)



EXAMPLES
     Example 1 devmapaccess() entry point


     The following is an example  of  the  devmapaccess()  entry
     point.    If   the   mapping   supports  context  switching,
     devmapaccess()   calls   devmapdoctxmgt(9F).   Otherwise,
     devmapaccess() calls devmapdefaultaccess(9F).


       ...
       #define OFDOCTXMGT  0x40000000
       #define OFNORMAL     0x40100000
       #define CTXMGTSIZE    0x100000
       #define NORMALSIZE    0x100000

       /*
        * Driver devmapcontextmgt(9E) callback function.
        */
       static int
       xxcontextmgt(devmapcookiet dhp, void *pvtp, offsett offset,
          sizet length, uintt type, uintt rw)
       {
          ......
          /*
           * see devmapcontextmgt(9E) for an example
           */
       }

       /*
        * Driver devmapaccess(9E) entry point
        */
       static int
       xxdevmapaccess(devmapcookiet dhp, void *pvtp, offsett off,
          sizet len, uintt type, uintt rw)
       {
          offsett diff;
          int err;

          /*
           * check if off is within the range that supports
           * context management.
           */
          if ((diff = off - OFDOCTXMG) >= 0 && diff < CTXMGTSIZE) {
              /*
               * calculates the length for context switching
               */
              if ((len ] off) > (OFDOCTXMGT ] CTXMGTSIZE))
                  return (-1);
              /*
               * perform context switching
               */



SunOS 5.11          Last change: 17 Jan 1997                    3






Driver Entry Points                             devmapaccess(9E)



              err = devmapdoctxmgt(dhp, pvtp, off, len, type,
                  rw, xxcontextmgt);
           /*
            * check if  off is within the range that does normal
            * memory mapping.
            */
           } else if ((diff = off - OFNORMAL) >= 0 && diff < NORMALSIZE) {
              if ((len ] off) > (OFNORMAL ] NORMALSIZE))
                  return (-1);
              err = devmapdefaultaccess(dhp, pvtp, off, len, type, rw);
           } else
              return (-1);

          return (err);
       }


SEE ALSO
     devmapmap(9E),                   devmapdefaultaccess(9F),
     devmapdoctxmgt(9F), devmapcallbackctl(9S)


     Writing Device Drivers
































SunOS 5.11          Last change: 17 Jan 1997                    4



OpenSolaris man pages main menu

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