Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef __USB_UAS_H__
0003 #define __USB_UAS_H__
0004 
0005 #include <scsi/scsi.h>
0006 #include <scsi/scsi_cmnd.h>
0007 
0008 /* Common header for all IUs */
0009 struct iu {
0010     __u8 iu_id;
0011     __u8 rsvd1;
0012     __be16 tag;
0013 } __attribute__((__packed__));
0014 
0015 enum {
0016     IU_ID_COMMAND       = 0x01,
0017     IU_ID_STATUS        = 0x03,
0018     IU_ID_RESPONSE      = 0x04,
0019     IU_ID_TASK_MGMT     = 0x05,
0020     IU_ID_READ_READY    = 0x06,
0021     IU_ID_WRITE_READY   = 0x07,
0022 };
0023 
0024 enum {
0025     TMF_ABORT_TASK          = 0x01,
0026     TMF_ABORT_TASK_SET      = 0x02,
0027     TMF_CLEAR_TASK_SET      = 0x04,
0028     TMF_LOGICAL_UNIT_RESET  = 0x08,
0029     TMF_I_T_NEXUS_RESET     = 0x10,
0030     TMF_CLEAR_ACA           = 0x40,
0031     TMF_QUERY_TASK          = 0x80,
0032     TMF_QUERY_TASK_SET      = 0x81,
0033     TMF_QUERY_ASYNC_EVENT   = 0x82,
0034 };
0035 
0036 enum {
0037     RC_TMF_COMPLETE         = 0x00,
0038     RC_INVALID_INFO_UNIT    = 0x02,
0039     RC_TMF_NOT_SUPPORTED    = 0x04,
0040     RC_TMF_FAILED           = 0x05,
0041     RC_TMF_SUCCEEDED        = 0x08,
0042     RC_INCORRECT_LUN        = 0x09,
0043     RC_OVERLAPPED_TAG       = 0x0a,
0044 };
0045 
0046 struct command_iu {
0047     __u8 iu_id;
0048     __u8 rsvd1;
0049     __be16 tag;
0050     __u8 prio_attr;
0051     __u8 rsvd5;
0052     __u8 len;
0053     __u8 rsvd7;
0054     struct scsi_lun lun;
0055     __u8 cdb[16];   /* XXX: Overflow-checking tools may misunderstand */
0056 } __attribute__((__packed__));
0057 
0058 struct task_mgmt_iu {
0059     __u8 iu_id;
0060     __u8 rsvd1;
0061     __be16 tag;
0062     __u8 function;
0063     __u8 rsvd2;
0064     __be16 task_tag;
0065     struct scsi_lun lun;
0066 } __attribute__((__packed__));
0067 
0068 /*
0069  * Also used for the Read Ready and Write Ready IUs since they have the
0070  * same first four bytes
0071  */
0072 struct sense_iu {
0073     __u8 iu_id;
0074     __u8 rsvd1;
0075     __be16 tag;
0076     __be16 status_qual;
0077     __u8 status;
0078     __u8 rsvd7[7];
0079     __be16 len;
0080     __u8 sense[SCSI_SENSE_BUFFERSIZE];
0081 } __attribute__((__packed__));
0082 
0083 struct response_iu {
0084     __u8 iu_id;
0085     __u8 rsvd1;
0086     __be16 tag;
0087     __u8 add_response_info[3];
0088     __u8 response_code;
0089 } __attribute__((__packed__));
0090 
0091 struct usb_pipe_usage_descriptor {
0092     __u8  bLength;
0093     __u8  bDescriptorType;
0094 
0095     __u8  bPipeID;
0096     __u8  Reserved;
0097 } __attribute__((__packed__));
0098 
0099 enum {
0100     CMD_PIPE_ID     = 1,
0101     STATUS_PIPE_ID      = 2,
0102     DATA_IN_PIPE_ID     = 3,
0103     DATA_OUT_PIPE_ID    = 4,
0104 
0105     UAS_SIMPLE_TAG      = 0,
0106     UAS_HEAD_TAG        = 1,
0107     UAS_ORDERED_TAG     = 2,
0108     UAS_ACA         = 4,
0109 };
0110 #endif