130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#ifndef _UAPIBSG_H 230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define _UAPIBSG_H 330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng 430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#include <linux/types.h> 530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng 630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define BSG_PROTOCOL_SCSI 0 730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng 830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define BSG_SUB_PROTOCOL_SCSI_CMD 0 930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define BSG_SUB_PROTOCOL_SCSI_TMF 1 1030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define BSG_SUB_PROTOCOL_SCSI_TRANSPORT 2 1130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng 1230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/* 1330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * For flags member below 1430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * sg.h sg_io_hdr also has bits defined for it's flags member. However 1530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * none of these bits are implemented/used by bsg. The bits below are 1630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * allocated to not conflict with sg.h ones anyway. 1730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */ 1830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define BSG_FLAG_Q_AT_TAIL 0x10 /* default, == 0 at this bit, is Q_AT_HEAD */ 1930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng 2030692c65c4174412c90e79489e98ab85c1a7412fBen Chengstruct sg_io_v4 { 2130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng __s32 guard; /* [i] 'Q' to differentiate from v3 */ 2230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng __u32 protocol; /* [i] 0 -> SCSI , .... */ 2330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng __u32 subprotocol; /* [i] 0 -> SCSI command, 1 -> SCSI task 2430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng management function, .... */ 2530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng 2630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng __u32 request_len; /* [i] in bytes */ 2730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng __u64 request; /* [i], [*i] {SCSI: cdb} */ 2830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng __u64 request_tag; /* [i] {SCSI: task tag (only if flagged)} */ 2930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng __u32 request_attr; /* [i] {SCSI: task attribute} */ 3030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng __u32 request_priority; /* [i] {SCSI: task priority} */ 3130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng __u32 request_extra; /* [i] {spare, for padding} */ 3230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng __u32 max_response_len; /* [i] in bytes */ 3330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng __u64 response; /* [i], [*o] {SCSI: (auto)sense data} */ 3430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng 3530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng /* "dout_": data out (to device); "din_": data in (from device) */ 3630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng __u32 dout_iovec_count; /* [i] 0 -> "flat" dout transfer else 3730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng dout_xfer points to array of iovec */ 3830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng __u32 dout_xfer_len; /* [i] bytes to be transferred to device */ 3930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng __u32 din_iovec_count; /* [i] 0 -> "flat" din transfer */ 4030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng __u32 din_xfer_len; /* [i] bytes to be transferred from device */ 4130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng __u64 dout_xferp; /* [i], [*i] */ 4230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng __u64 din_xferp; /* [i], [*o] */ 4330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng 4430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng __u32 timeout; /* [i] units: millisecond */ 4530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng __u32 flags; /* [i] bit mask */ 4630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng __u64 usr_ptr; /* [i->o] unused internally */ 4730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng __u32 spare_in; /* [i] */ 4830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng 4930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng __u32 driver_status; /* [o] 0 -> ok */ 5030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng __u32 transport_status; /* [o] 0 -> ok */ 5130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng __u32 device_status; /* [o] {SCSI: command completion status} */ 5230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng __u32 retry_delay; /* [o] {SCSI: status auxiliary information} */ 5330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng __u32 info; /* [o] additional information */ 5430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng __u32 duration; /* [o] time to complete, in milliseconds */ 5530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng __u32 response_len; /* [o] bytes of response actually written */ 5630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng __s32 din_resid; /* [o] din_xfer_len - actual_din_xfer_len */ 5730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng __s32 dout_resid; /* [o] dout_xfer_len - actual_dout_xfer_len */ 5830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng __u64 generated_tag; /* [o] {SCSI: transport generated task tag} */ 5930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng __u32 spare_out; /* [o] */ 6030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng 6130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng __u32 padding; 6230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng}; 6330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng 6430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng 6530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#endif /* _UAPIBSG_H */ 66