Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb/uas: move UAS structs / defines into a header file

The protocol specific structures and defines which are used by UAS are
moved into a header files by this patch so it can be accessed by the UAS
gadget as well.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>

authored by

Sebastian Andrzej Siewior and committed by
Sarah Sharp
348748b0 c898add5

+62 -55
+1 -55
drivers/usb/storage/uas.c
··· 15 15 #include <linux/usb.h> 16 16 #include <linux/usb/hcd.h> 17 17 #include <linux/usb/storage.h> 18 + #include <linux/usb/uas.h> 18 19 19 20 #include <scsi/scsi.h> 20 21 #include <scsi/scsi_dbg.h> ··· 23 22 #include <scsi/scsi_device.h> 24 23 #include <scsi/scsi_host.h> 25 24 #include <scsi/scsi_tcq.h> 26 - 27 - /* Common header for all IUs */ 28 - struct iu { 29 - __u8 iu_id; 30 - __u8 rsvd1; 31 - __be16 tag; 32 - }; 33 - 34 - enum { 35 - IU_ID_COMMAND = 0x01, 36 - IU_ID_STATUS = 0x03, 37 - IU_ID_RESPONSE = 0x04, 38 - IU_ID_TASK_MGMT = 0x05, 39 - IU_ID_READ_READY = 0x06, 40 - IU_ID_WRITE_READY = 0x07, 41 - }; 42 - 43 - struct command_iu { 44 - __u8 iu_id; 45 - __u8 rsvd1; 46 - __be16 tag; 47 - __u8 prio_attr; 48 - __u8 rsvd5; 49 - __u8 len; 50 - __u8 rsvd7; 51 - struct scsi_lun lun; 52 - __u8 cdb[16]; /* XXX: Overflow-checking tools may misunderstand */ 53 - }; 54 - 55 - /* 56 - * Also used for the Read Ready and Write Ready IUs since they have the 57 - * same first four bytes 58 - */ 59 - struct sense_iu { 60 - __u8 iu_id; 61 - __u8 rsvd1; 62 - __be16 tag; 63 - __be16 status_qual; 64 - __u8 status; 65 - __u8 rsvd7[7]; 66 - __be16 len; 67 - __u8 sense[SCSI_SENSE_BUFFERSIZE]; 68 - }; 69 25 70 26 /* 71 27 * The r00-r01c specs define this version of the SENSE IU data structure. ··· 36 78 __u8 status; 37 79 __u8 service_response; 38 80 __u8 sense[SCSI_SENSE_BUFFERSIZE]; 39 - }; 40 - 41 - enum { 42 - CMD_PIPE_ID = 1, 43 - STATUS_PIPE_ID = 2, 44 - DATA_IN_PIPE_ID = 3, 45 - DATA_OUT_PIPE_ID = 4, 46 - 47 - UAS_SIMPLE_TAG = 0, 48 - UAS_HEAD_TAG = 1, 49 - UAS_ORDERED_TAG = 2, 50 - UAS_ACA = 4, 51 81 }; 52 82 53 83 struct uas_dev_info {
+61
include/linux/usb/uas.h
··· 1 + #ifndef __USB_UAS_H__ 2 + #define __USB_UAS_H__ 3 + 4 + #include <scsi/scsi.h> 5 + #include <scsi/scsi_cmnd.h> 6 + 7 + /* Common header for all IUs */ 8 + struct iu { 9 + __u8 iu_id; 10 + __u8 rsvd1; 11 + __be16 tag; 12 + }; 13 + 14 + enum { 15 + IU_ID_COMMAND = 0x01, 16 + IU_ID_STATUS = 0x03, 17 + IU_ID_RESPONSE = 0x04, 18 + IU_ID_TASK_MGMT = 0x05, 19 + IU_ID_READ_READY = 0x06, 20 + IU_ID_WRITE_READY = 0x07, 21 + }; 22 + 23 + struct command_iu { 24 + __u8 iu_id; 25 + __u8 rsvd1; 26 + __be16 tag; 27 + __u8 prio_attr; 28 + __u8 rsvd5; 29 + __u8 len; 30 + __u8 rsvd7; 31 + struct scsi_lun lun; 32 + __u8 cdb[16]; /* XXX: Overflow-checking tools may misunderstand */ 33 + }; 34 + 35 + /* 36 + * Also used for the Read Ready and Write Ready IUs since they have the 37 + * same first four bytes 38 + */ 39 + struct sense_iu { 40 + __u8 iu_id; 41 + __u8 rsvd1; 42 + __be16 tag; 43 + __be16 status_qual; 44 + __u8 status; 45 + __u8 rsvd7[7]; 46 + __be16 len; 47 + __u8 sense[SCSI_SENSE_BUFFERSIZE]; 48 + }; 49 + 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 + 56 + UAS_SIMPLE_TAG = 0, 57 + UAS_HEAD_TAG = 1, 58 + UAS_ORDERED_TAG = 2, 59 + UAS_ACA = 4, 60 + }; 61 + #endif