MyWebUniversity.com Home Page
 



OpenSolaris man pages main menu


Kernel Functions for Drivers            devmapdefaultaccess(9F)



NAME
     devmapdefaultaccess - default driver memory  access  func-
     tion

SYNOPSIS
     #include 
     #include 


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


INTERFACE LEVEL
     Solaris DI specific (Solaris DI).

PARAMETERS
     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.


     rw       Type of access.


DESCRIPTION
     devmapdefaultaccess() is a function providing  the  seman-
     tics     of     devmapaccess(9E).    The    drivers    call
     devmapdefaultaccess() to handle the mappings that  do  not
     support   context   switching.   The   drivers  should  call
     devmapdoctxmgt(9F) for the mappings that  support  context
     management.


     devmapdefaultaccess()   can   either   be   called    from
     devmapaccess(9E)  or be used as the devmapaccess(9E) entry
     point. The arguments dhp,  pvtp,  off,  len, type,   and  rw
     are  provided  by the devmapaccess(9E) entry point and must
     not be modified.




SunOS 5.11          Last change: 14 Jan 1997                    1






Kernel Functions for Drivers            devmapdefaultaccess(9F)



RETURN VALUES
     0           Successful completion.


     Non-zero    An error occurred.


CONTEXT
     devmapdefaultaccess() must be  called  from  the  driver's
     devmapaccess(9E) entry point.

EXAMPLES
     Example 1 Using devmapdefaultaccess in devmapaccess.


     The    following    shows    an     example     of     using
     devmapdefaultaccess()   in   the  devmapaccess(9E)  entry
     point.


       ...
       #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.



SunOS 5.11          Last change: 14 Jan 1997                    2






Kernel Functions for Drivers            devmapdefaultaccess(9F)



            */
           if ((diff = off - OFDOCTXMG) >= 0 && diff < CTXMGTSIZE) {
               /*
                * calculates the length for context switching
                */
               if ((len ] off) > (OFDOCTXMGT ] CTXMGTSIZE))
                   return (-1);
               /*
                * perform context switching
                */
               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
     devmapaccess(9E),                     devmapdoctxmgt(9F),
     devmapcallbackctl(9S)


     Writing Device Drivers






















SunOS 5.11          Last change: 14 Jan 1997                    3



OpenSolaris man pages main menu

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