Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
0002 #ifndef _UAPIBSG_H
0003 #define _UAPIBSG_H
0004 
0005 #include <linux/types.h>
0006 
0007 #define BSG_PROTOCOL_SCSI       0
0008 
0009 #define BSG_SUB_PROTOCOL_SCSI_CMD   0
0010 #define BSG_SUB_PROTOCOL_SCSI_TMF   1
0011 #define BSG_SUB_PROTOCOL_SCSI_TRANSPORT 2
0012 
0013 /*
0014  * For flag constants below:
0015  * sg.h sg_io_hdr also has bits defined for it's flags member. These
0016  * two flag values (0x10 and 0x20) have the same meaning in sg.h . For
0017  * bsg the BSG_FLAG_Q_AT_HEAD flag is ignored since it is the deafult.
0018  */
0019 #define BSG_FLAG_Q_AT_TAIL 0x10 /* default is Q_AT_HEAD */
0020 #define BSG_FLAG_Q_AT_HEAD 0x20
0021 
0022 struct sg_io_v4 {
0023     __s32 guard;        /* [i] 'Q' to differentiate from v3 */
0024     __u32 protocol;     /* [i] 0 -> SCSI , .... */
0025     __u32 subprotocol;  /* [i] 0 -> SCSI command, 1 -> SCSI task
0026                    management function, .... */
0027 
0028     __u32 request_len;  /* [i] in bytes */
0029     __u64 request;      /* [i], [*i] {SCSI: cdb} */
0030     __u64 request_tag;  /* [i] {SCSI: task tag (only if flagged)} */
0031     __u32 request_attr; /* [i] {SCSI: task attribute} */
0032     __u32 request_priority; /* [i] {SCSI: task priority} */
0033     __u32 request_extra;    /* [i] {spare, for padding} */
0034     __u32 max_response_len; /* [i] in bytes */
0035     __u64 response;     /* [i], [*o] {SCSI: (auto)sense data} */
0036 
0037         /* "dout_": data out (to device); "din_": data in (from device) */
0038     __u32 dout_iovec_count; /* [i] 0 -> "flat" dout transfer else
0039                    dout_xfer points to array of iovec */
0040     __u32 dout_xfer_len;    /* [i] bytes to be transferred to device */
0041     __u32 din_iovec_count;  /* [i] 0 -> "flat" din transfer */
0042     __u32 din_xfer_len; /* [i] bytes to be transferred from device */
0043     __u64 dout_xferp;   /* [i], [*i] */
0044     __u64 din_xferp;    /* [i], [*o] */
0045 
0046     __u32 timeout;      /* [i] units: millisecond */
0047     __u32 flags;        /* [i] bit mask */
0048     __u64 usr_ptr;      /* [i->o] unused internally */
0049     __u32 spare_in;     /* [i] */
0050 
0051     __u32 driver_status;    /* [o] 0 -> ok */
0052     __u32 transport_status; /* [o] 0 -> ok */
0053     __u32 device_status;    /* [o] {SCSI: command completion status} */
0054     __u32 retry_delay;  /* [o] {SCSI: status auxiliary information} */
0055     __u32 info;     /* [o] additional information */
0056     __u32 duration;     /* [o] time to complete, in milliseconds */
0057     __u32 response_len; /* [o] bytes of response actually written */
0058     __s32 din_resid;    /* [o] din_xfer_len - actual_din_xfer_len */
0059     __s32 dout_resid;   /* [o] dout_xfer_len - actual_dout_xfer_len */
0060     __u64 generated_tag;    /* [o] {SCSI: transport generated task tag} */
0061     __u32 spare_out;    /* [o] */
0062 
0063     __u32 padding;
0064 };
0065 
0066 
0067 #endif /* _UAPIBSG_H */