6 * USB mass storage driver
10 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL
);
14 #include <ipxe/scsi.h>
15 #include <ipxe/interface.h>
17 /** Mass storage class code */
18 #define USB_CLASS_MSC 0x08
20 /** SCSI command set subclass code */
21 #define USB_SUBCLASS_MSC_SCSI 0x06
23 /** Bulk-only transport protocol */
24 #define USB_PROTOCOL_MSC_BULK 0x50
26 /** Mass storage reset command */
27 #define USBBLK_RESET ( USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE | \
28 USB_REQUEST_TYPE ( 255 ) )
30 /** Command block wrapper */
31 struct usbblk_command_wrapper
{
36 /** Data transfer length */
42 /** Command block length */
46 } __attribute__ (( packed
));
48 /** Command block wrapper signature */
49 #define USBBLK_COMMAND_SIGNATURE 0x43425355UL
51 /** Command status wrapper */
52 struct usbblk_status_wrapper
{
61 } __attribute__ (( packed
));
63 /** Command status wrapper signature */
64 #define USBBLK_STATUS_SIGNATURE 0x53425355UL
66 /** A USB mass storage command */
67 struct usbblk_command
{
70 /** Command tag (0 for no command in progress) */
72 /** Offset within data buffer */
76 /** A USB mass storage device */
77 struct usbblk_device
{
78 /** Reference count */
80 /** List of devices */
81 struct list_head list
;
84 struct usb_function
*func
;
85 /** Bulk OUT endpoint */
86 struct usb_endpoint out
;
87 /** Bulk IN endpoint */
88 struct usb_endpoint in
;
90 /** SCSI command-issuing interface */
91 struct interface scsi
;
92 /** SCSI data interface */
93 struct interface data
;
94 /** Command process */
95 struct process process
;
96 /** Device opened flag */
99 /** Current command (if any) */
100 struct usbblk_command cmd
;
103 /** Command tag magic
105 * This is a policy decision.
107 #define USBBLK_TAG_MAGIC 0x18ae0000
109 /** Maximum length of USB data block
111 * This is a policy decision.
113 #define USBBLK_MAX_LEN 2048
115 /** Maximum endpoint fill level
117 * This is a policy decision.
119 #define USBBLK_MAX_FILL 4
121 #endif /* _USBBLK_H */