1*6f52b16cSGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2607ca46eSDavid Howells #ifndef _UAPIBSG_H 3607ca46eSDavid Howells #define _UAPIBSG_H 4607ca46eSDavid Howells 5607ca46eSDavid Howells #include <linux/types.h> 6607ca46eSDavid Howells 7607ca46eSDavid Howells #define BSG_PROTOCOL_SCSI 0 8607ca46eSDavid Howells 9607ca46eSDavid Howells #define BSG_SUB_PROTOCOL_SCSI_CMD 0 10607ca46eSDavid Howells #define BSG_SUB_PROTOCOL_SCSI_TMF 1 11607ca46eSDavid Howells #define BSG_SUB_PROTOCOL_SCSI_TRANSPORT 2 12607ca46eSDavid Howells 13607ca46eSDavid Howells /* 14d1515613SDouglas Gilbert * For flag constants below: 15d1515613SDouglas Gilbert * sg.h sg_io_hdr also has bits defined for it's flags member. These 16d1515613SDouglas Gilbert * two flag values (0x10 and 0x20) have the same meaning in sg.h . For 17d1515613SDouglas Gilbert * bsg the BSG_FLAG_Q_AT_HEAD flag is ignored since it is the deafult. 18607ca46eSDavid Howells */ 19d1515613SDouglas Gilbert #define BSG_FLAG_Q_AT_TAIL 0x10 /* default is Q_AT_HEAD */ 20d1515613SDouglas Gilbert #define BSG_FLAG_Q_AT_HEAD 0x20 21607ca46eSDavid Howells 22607ca46eSDavid Howells struct sg_io_v4 { 23607ca46eSDavid Howells __s32 guard; /* [i] 'Q' to differentiate from v3 */ 24607ca46eSDavid Howells __u32 protocol; /* [i] 0 -> SCSI , .... */ 25607ca46eSDavid Howells __u32 subprotocol; /* [i] 0 -> SCSI command, 1 -> SCSI task 26607ca46eSDavid Howells management function, .... */ 27607ca46eSDavid Howells 28607ca46eSDavid Howells __u32 request_len; /* [i] in bytes */ 29607ca46eSDavid Howells __u64 request; /* [i], [*i] {SCSI: cdb} */ 30607ca46eSDavid Howells __u64 request_tag; /* [i] {SCSI: task tag (only if flagged)} */ 31607ca46eSDavid Howells __u32 request_attr; /* [i] {SCSI: task attribute} */ 32607ca46eSDavid Howells __u32 request_priority; /* [i] {SCSI: task priority} */ 33607ca46eSDavid Howells __u32 request_extra; /* [i] {spare, for padding} */ 34607ca46eSDavid Howells __u32 max_response_len; /* [i] in bytes */ 35607ca46eSDavid Howells __u64 response; /* [i], [*o] {SCSI: (auto)sense data} */ 36607ca46eSDavid Howells 37607ca46eSDavid Howells /* "dout_": data out (to device); "din_": data in (from device) */ 38607ca46eSDavid Howells __u32 dout_iovec_count; /* [i] 0 -> "flat" dout transfer else 39607ca46eSDavid Howells dout_xfer points to array of iovec */ 40607ca46eSDavid Howells __u32 dout_xfer_len; /* [i] bytes to be transferred to device */ 41607ca46eSDavid Howells __u32 din_iovec_count; /* [i] 0 -> "flat" din transfer */ 42607ca46eSDavid Howells __u32 din_xfer_len; /* [i] bytes to be transferred from device */ 43607ca46eSDavid Howells __u64 dout_xferp; /* [i], [*i] */ 44607ca46eSDavid Howells __u64 din_xferp; /* [i], [*o] */ 45607ca46eSDavid Howells 46607ca46eSDavid Howells __u32 timeout; /* [i] units: millisecond */ 47607ca46eSDavid Howells __u32 flags; /* [i] bit mask */ 48607ca46eSDavid Howells __u64 usr_ptr; /* [i->o] unused internally */ 49607ca46eSDavid Howells __u32 spare_in; /* [i] */ 50607ca46eSDavid Howells 51607ca46eSDavid Howells __u32 driver_status; /* [o] 0 -> ok */ 52607ca46eSDavid Howells __u32 transport_status; /* [o] 0 -> ok */ 53607ca46eSDavid Howells __u32 device_status; /* [o] {SCSI: command completion status} */ 54607ca46eSDavid Howells __u32 retry_delay; /* [o] {SCSI: status auxiliary information} */ 55607ca46eSDavid Howells __u32 info; /* [o] additional information */ 56607ca46eSDavid Howells __u32 duration; /* [o] time to complete, in milliseconds */ 57607ca46eSDavid Howells __u32 response_len; /* [o] bytes of response actually written */ 58607ca46eSDavid Howells __s32 din_resid; /* [o] din_xfer_len - actual_din_xfer_len */ 59607ca46eSDavid Howells __s32 dout_resid; /* [o] dout_xfer_len - actual_dout_xfer_len */ 60607ca46eSDavid Howells __u64 generated_tag; /* [o] {SCSI: transport generated task tag} */ 61607ca46eSDavid Howells __u32 spare_out; /* [o] */ 62607ca46eSDavid Howells 63607ca46eSDavid Howells __u32 padding; 64607ca46eSDavid Howells }; 65607ca46eSDavid Howells 66607ca46eSDavid Howells 67607ca46eSDavid Howells #endif /* _UAPIBSG_H */ 68