Template Version: "@(#)usmp.txt 1.5     07/09/27 SMI"

Ioctl Requests                                          usmp(7I)

NAME
     usmp - user SMP command interface

SYNOPSIS
     #include <sys/scsi/impl/usmp.h>

     ioctl(int fildes, int request, struct usmp_cmd *cmd);

DESCRIPTION

     The smp(7D) driver supports  this ioctl(2), which provides a
     generic user-level interface for sending SMP commands to SMP
     target  devices.  SMP   target  devices  are  generally  SAS
     switches  or  expanders.  Each  usmp(7I)  call  directs  the
     smp(7D)  driver  to express  a  specific  SMP function,  and
     includes the  data transfer to  and from the  designated SMP
     target  device.   The  usmp_cmd  structure   is  defined  in
     <sys/scsi/impl/usmp.h> and includes the following members:

     caddr_t     usmp_req;            /* address of smp request frame */
     caddr_t     usmp_rsp;            /* address of smp response frame */
     size_t      usmp_reqsize;        /* byte size of smp request frame */
     size_t      usmp_rspsize;        /* byte size of smp response frame */
     int         usmp_timeout;        /* command timeout */

     The  fields of  the  usmp_cmd structure  have the  following
     meanings:

     usmp_req     The  address of  the buffer  containing  the smp
                  request frame. The data format should conform to
                  the definition in Serial Attached SCSI protocol.

     usmp_rsp     The address of the  buffer which is used to hold
                  the smp response frame.

     usmp_reqsize The size in byte of the smp request frame buffer.

     usmp_rspsize The  size in  byte  of the  smp response  frame
                  buffer. The  size of  the buffer should  not be
                  less than  eight bytes.  If the buffer  size is
                  less  than  eight   bytes  the  smp(7D)  driver
                  immediately returns EINVAL.  If the buffer size
                  is  less than that  specified for  the specific
                  SMP  function  in   the  Serial  Attached  SCSI
                  protocol definition, then the response data may
                  be truncated.

     usmp_timeout Time in seconds to  allow for completion of the
                  command. If  it is  not set in  user-level, the
                  default value is 60.

     The common  headers of smp  request and response  frames are
     found in two structures: usmp_req and usmp_rsp, bot of which
     are defined  in <sys/scsi/impl/smp_frames.h>. The structures
     include the following fields:

     struct usmp_req {
       uint8_t smpo_frametype;      /* SMP frame type, should be 0x40 */
       uint8_t smpo_function;       /* SMP function being requested */
       uint8_t smpo_reserved;       /* reserved byte */
       uint8_t smpo_reqsize;        /* number of dwords that follow */
       uint8_t smpo_msgframe[1];    /* request bytes based on SMP function
                                       plus 4-byte CRC code */
     }

     struct usmp_rsp {
       uint8_t smpi_frametype;      /* SMP frame type, should be 0x41 */
       uint8_t smpi_function;       /* SMP function being requested */
       uint8_t smpi_result;         /* SMP function result */
       uint8_t smpi_rspsize;        /* number of dwords that follow */
       uint8_t smpi_msgframe[1];    /* response bytes based on SMP function */
     }

IOCTLS
     The  ioctl supported by  the SMP  target driver  through the
     usmp(7I) interface is:

     USMPCMD   The argument is a pointer to a usmp_cmd structure.

ERRORS
     EINVAL  A parameter has an incorrect, or unsupported value.

     ENOMEM  No memory available.

     EIO     An error occurred during the execution of the command.

     ETIME   Command timeout.

     ENODEV  Device has gone.

     EOVERFLOW
             The  response buffer is  shorter than  required, and
             the data is truncated.

     EPERM   A  process without PRIV_SYS_DEVICES  privilege tried
             to execute the USMPCMD ioctl.

     EFAULT  One or  more of  the usmp_cmd, usmp_req  or usmp_rsp
             structures point to an invalid address.

ATTRIBUTES
     See attributes(5) for descriptions of the  following  attributes:

     ____________________________________________________________
    |       ATTRIBUTE TYPE        |       ATTRIBUTE VALUE       |
    |_____________________________|_____________________________|
    | Availability                | SUNWhea                     |
    |_____________________________|_____________________________|

SEE ALSO
     ioctl(2), attributes(5), smp(7D), mpt(7D)

     ANSI Small Computer System Interface-4 (SCSI-4)

NOTES
     usmp commands are designed for topology control,  device accessibility
     and SAS expander and switch configuration. Usage of usmp is
     restricted to processes running with PRIV_SYS_DEVICES privilege,
     regardless of the file permissions on the device node.

     User-level applications are not required to fill in the four
     bytes of SAS CRC code  in the SMP request frame. The smp(7D)
     driver manages this for usmp(7I) if the SAS HBA does not.
