1 #ifndef __TARGET_USB_GADGET_H__
2 #define __TARGET_USB_GADGET_H__
4 #include <linux/kref.h>
5 /* #include <linux/usb/uas.h> */
6 #include <linux/usb/composite.h>
7 #include <linux/usb/uas.h>
8 #include <linux/usb/storage.h>
9 #include <target/target_core_base.h>
10 #include <target/target_core_fabric.h>
12 #define USBG_NAMELEN 32
14 #define fuas_to_gadget(f) (f->function.config->cdev->gadget)
15 #define UASP_SS_EP_COMP_LOG_STREAMS 4
16 #define UASP_SS_EP_COMP_NUM_STREAMS (1 << UASP_SS_EP_COMP_LOG_STREAMS)
19 USB_G_STR_INT_UAS
= 0,
23 #define USB_G_ALT_INT_BBB 0
24 #define USB_G_ALT_INT_UAS 1
26 #define USB_G_DEFAULT_SESSION_TAGS 128
28 struct tcm_usbg_nexus
{
29 struct se_session
*tvn_se_sess
;
33 struct mutex tpg_mutex
;
34 /* SAS port target portal group tag for TCM */
36 /* Pointer back to usbg_tport */
37 struct usbg_tport
*tport
;
38 struct workqueue_struct
*workqueue
;
39 /* Returned by usbg_make_tpg() */
40 struct se_portal_group se_tpg
;
42 struct tcm_usbg_nexus
*tpg_nexus
;
43 atomic_t tpg_port_count
;
45 struct usb_function_instance
*fi
;
49 /* Binary World Wide unique Port Name for SAS Target port */
51 /* ASCII formatted WWPN for SAS Target port */
52 char tport_name
[USBG_NAMELEN
];
53 /* Returned by usbg_make_tport() */
54 struct se_wwn tport_wwn
;
64 #define USBG_MAX_CMD 64
67 u8 cmd_buf
[USBG_MAX_CMD
];
69 struct work_struct work
;
72 void *data_buf
; /* used if no sg support available */
74 struct completion write_complete
;
80 struct sense_iu sense_iu
;
82 struct uas_stream
*stream
;
86 unsigned int csw_code
;
92 struct usb_request
*req_in
;
93 struct usb_request
*req_out
;
94 struct usb_request
*req_status
;
98 struct usb_request
*req
;
103 struct usb_request
*req
;
104 struct bulk_cs_wrap csw
;
108 struct usbg_tpg
*tpg
;
109 struct usb_function function
;
113 #define USBG_ENABLED (1 << 0)
114 #define USBG_IS_UAS (1 << 1)
115 #define USBG_USE_STREAMS (1 << 2)
116 #define USBG_IS_BOT (1 << 3)
117 #define USBG_BOT_CMD_PEND (1 << 4)
120 struct usb_ep
*ep_in
;
121 struct usb_ep
*ep_out
;
124 struct usb_ep
*ep_status
;
125 struct usb_ep
*ep_cmd
;
126 struct uas_stream stream
[UASP_SS_EP_COMP_NUM_STREAMS
];
129 struct bot_status bot_status
;
130 struct usb_request
*bot_req_in
;
131 struct usb_request
*bot_req_out
;
134 #endif /* __TARGET_USB_GADGET_H__ */