uas.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. };
  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. struct command_iu {
  20. __u8 iu_id;
  21. __u8 rsvd1;
  22. __be16 tag;
  23. __u8 prio_attr;
  24. __u8 rsvd5;
  25. __u8 len;
  26. __u8 rsvd7;
  27. struct scsi_lun lun;
  28. __u8 cdb[16]; /* XXX: Overflow-checking tools may misunderstand */
  29. };
  30. /*
  31. * Also used for the Read Ready and Write Ready IUs since they have the
  32. * same first four bytes
  33. */
  34. struct sense_iu {
  35. __u8 iu_id;
  36. __u8 rsvd1;
  37. __be16 tag;
  38. __be16 status_qual;
  39. __u8 status;
  40. __u8 rsvd7[7];
  41. __be16 len;
  42. __u8 sense[SCSI_SENSE_BUFFERSIZE];
  43. };
  44. struct usb_pipe_usage_descriptor {
  45. __u8 bLength;
  46. __u8 bDescriptorType;
  47. __u8 bPipeID;
  48. __u8 Reserved;
  49. } __attribute__((__packed__));
  50. enum {
  51. CMD_PIPE_ID = 1,
  52. STATUS_PIPE_ID = 2,
  53. DATA_IN_PIPE_ID = 3,
  54. DATA_OUT_PIPE_ID = 4,
  55. UAS_SIMPLE_TAG = 0,
  56. UAS_HEAD_TAG = 1,
  57. UAS_ORDERED_TAG = 2,
  58. UAS_ACA = 4,
  59. };
  60. #endif