MyWebUniversity.com Home Page
 



OpenSolaris man pages main menu


Kernel Functions for Drivers                 ddiumemiosetup(9F)



NAME
     ddiumemiosetup - Setup I/O requests to application memory

SYNOPSIS
     #include 
     #include 



     struct buf *ddiumemiosetup(ddiumemcookiet cookie,offt off,
          sizet len, int direction, devt dev, daddrt blkno,
          int (*iodone) (struct buf *), int sleepflag);


INTERFACE LEVEL
     Solaris DI specific (Solaris DI)

PARAMETERS
     cookie        The  kernel   memory   cookie   allocated   by
                   ddiumemlock(9F).


     off           Offset from the start of the cookie.


     len           Length of the I/O request in bytes.


     direction     Must be set to BREAD for reads from the  dev-
                   ice or BWRITE for writes to the device.


     dev           Device number


     blkno         Block number on device.


     iodone        Specific biodone(9F) routine.


     sleepflag     Determines  whether  caller  can   sleep   for
                   memory.  Possible  flags are DIUMEMSLEP to
                   allow sleeping until memory is  available,  or
                   DIUMEMNOSLEP to return NUL immediately if
                   memory is not available.


DESCRIPTION
     The ddiumemiosetup(9F) function  is  used  by  drivers  to
     setup  I/O  requests  to  application  memory which has been
     locked down using ddiumemlock(9F).



SunOS 5.11           Last change: 4 Feb 2003                    1






Kernel Functions for Drivers                 ddiumemiosetup(9F)



     The ddiumemiosetup(9F) function returns  a  pointer  to  a
     buf(9S) structure corresponding to the memory cookie cookie.
     Drivers can setup multiple buffer structures  simultaneously
     active  using the same memory cookie. The buf(9S) structures
     can span all or part of the region represented by the cookie
     and  can  overlap  each  other. The buf(9S) structure can be
     passed  to  ddidmabufbindhandle(9F)  to   initiate   DMA
     transfers to or from the locked down memory.


     The off  parameter specifies the offset from  the  start  of
     the  cookie.  The  len  parameter  represents  the length of
     region to be mapped by the buffer. The  direction  parameter
     must  be  set  to  either BREAD or BWRITE, to indicate the
     action that will be performed by the device. (Note that this
     direction is in the opposite sense of the VM system's direc-
     tion  of  DIUMEMLOCKREAD  and  DIUMEMLOCKWRITE.)   The
     direction  must  be compatible with the flags used to create
     the memory cookie  in  ddiumemlock(9F).  For  example,  if
     ddiumemlock()  is  called  with the flags parameter set to
     DIUMEMLOCKREAD,    the     direction     parameter     in
     ddiumemiosetup() should be set to BWRITE.


     The dev parameter specifies the device to which  the  buffer
     is  to  perform I/O.The blkno parameter represents the block
     number on the device. It will be  assigned  to  the  bblkno
     field of the returned buffer structure. The iodone parameter
     enables the driver to identify a specific  biodone(9F)  rou-
     tine  to  be  called by the driver when the I/O is complete.
     The sleepflag  parameter determines if the caller can  sleep
     for  memory.  DIUMEMSLEP  allocations  may sleep but are
     guaranteed to succeed. DIUMEMNOSLEP allocations  do  not
     sleep  but may fail (return NUL) if memory is currently not
     available.


     After the I/O has completed and the buffer structure  is  no
     longer  needed,  the  driver  calls freerbuf(9F) to free the
     buffer structure.

RETURN VALUES
     The ddiumemiosetup(9F) function returns a pointer  to  the
     initialized buffer header, or NUL if no space is available.

CONTEXT
     The ddiumemiosetup(9F) function can  be  called  from  any
     context   only  if  flag  is  set  to  DIUMEMNOSLEP.  If
     DIUMEMSLEP is set, ddiumemiosetup(9F)  can  be  called
     from user and kernel context only.





SunOS 5.11           Last change: 4 Feb 2003                    2






Kernel Functions for Drivers                 ddiumemiosetup(9F)



SEE ALSO
     ddiumemlock(9F),              ddidmabufbindhandle(9F),
     freerbuf(9F), physio(9F), buf(9S)




















































SunOS 5.11           Last change: 4 Feb 2003                    3



OpenSolaris man pages main menu

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