uas.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. #ifndef __USB_UAS_H__
  2. #define __USB_UAS_H__
  3. #include <scsi/scsi.h>
  4. #include <scsi/scsi_cmnd.h>
  5. /* Common header for all IUs */
  6. struct iu {
  7. __u8 iu_id;
  8. __u8 rsvd1;
  9. __be16 tag;
  10. } __attribute__((__packed__));
  11. enum {
  12. IU_ID_COMMAND = 0x01,
  13. IU_ID_STATUS = 0x03,
  14. IU_ID_RESPONSE = 0x04,
  15. IU_ID_TASK_MGMT = 0x05,
  16. IU_ID_READ_READY = 0x06,
  17. IU_ID_WRITE_READY = 0x07,
  18. };
  19. enum {
  20. TMF_ABORT_TASK = 0x01,
  21. TMF_ABORT_TASK_SET = 0x02,
  22. TMF_CLEAR_TASK_SET = 0x04,
  23. TMF_LOGICAL_UNIT_RESET = 0x08,
  24. TMF_I_T_NEXUS_RESET = 0x10,
  25. TMF_CLEAR_ACA = 0x40,
  26. TMF_QUERY_TASK = 0x80,
  27. TMF_QUERY_TASK_SET = 0x81,
  28. TMF_QUERY_ASYNC_EVENT = 0x82,
  29. };
  30. enum {
  31. RC_TMF_COMPLETE = 0x00,
  32. RC_INVALID_INFO_UNIT = 0x02,
  33. RC_TMF_NOT_SUPPORTED = 0x04,
  34. RC_TMF_FAILED = 0x05,
  35. RC_TMF_SUCCEEDED = 0x08,
  36. RC_INCORRECT_LUN = 0x09,
  37. RC_OVERLAPPED_TAG = 0x0a,
  38. };
  39. struct command_iu {
  40. __u8 iu_id;
  41. __u8 rsvd1;
  42. __be16 tag;
  43. __u8 prio_attr;
  44. __u8 rsvd5;
  45. __u8 len;
  46. __u8 rsvd7;
  47. struct scsi_lun lun;
  48. __u8 cdb[16]; /* XXX: Overflow-checking tools may misunderstand */
  49. } __attribute__((__packed__));
  50. struct task_mgmt_iu {
  51. __u8 iu_id;
  52. __u8 rsvd1;
  53. __be16 tag;
  54. __u8 function;
  55. __u8 rsvd2;
  56. __be16 task_tag;
  57. struct scsi_lun lun;
  58. } __attribute__((__packed__));
  59. /*
  60. * Also used for the Read Ready and Write Ready IUs since they have the
  61. * same first four bytes
  62. */
  63. struct sense_iu {
  64. __u8 iu_id;
  65. __u8 rsvd1;
  66. __be16 tag;
  67. __be16 status_qual;
  68. __u8 status;
  69. __u8 rsvd7[7];
  70. __be16 len;
  71. __u8 sense[SCSI_SENSE_BUFFERSIZE];
  72. } __attribute__((__packed__));
  73. struct response_iu {
  74. __u8 iu_id;
  75. __u8 rsvd1;
  76. __be16 tag;
  77. __u8 add_response_info[3];
  78. __u8 response_code;
  79. } __attribute__((__packed__));
  80. struct usb_pipe_usage_descriptor {
  81. __u8 bLength;
  82. __u8 bDescriptorType;
  83. __u8 bPipeID;
  84. __u8 Reserved;
  85. } __attribute__((__packed__));
  86. enum {
  87. CMD_PIPE_ID = 1,
  88. STATUS_PIPE_ID = 2,
  89. DATA_IN_PIPE_ID = 3,
  90. DATA_OUT_PIPE_ID = 4,
  91. UAS_SIMPLE_TAG = 0,
  92. UAS_HEAD_TAG = 1,
  93. UAS_ORDERED_TAG = 2,
  94. UAS_ACA = 4,
  95. };
  96. #endif