2 Defination for the USB mass storage Control/Bulk/Interrupt (CBI) transport,
3 according to USB Mass Storage Class Control/Bulk/Interrupt (CBI) Transport, Revision 1.1.
5 Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #ifndef _EFI_USBMASS_CBI_H_
11 #define _EFI_USBMASS_CBI_H_
13 extern USB_MASS_TRANSPORT mUsbCbi0Transport
;
14 extern USB_MASS_TRANSPORT mUsbCbi1Transport
;
16 #define USB_CBI_MAX_PACKET_NUM 16
17 #define USB_CBI_RESET_CMD_LEN 12
19 // USB CBI retry C/B/I transport times, set by experience
21 #define USB_CBI_MAX_RETRY 3
23 // Time to wait for USB CBI reset to complete, set by experience
25 #define USB_CBI_RESET_DEVICE_STALL (50 * USB_MASS_1_MILLISECOND)
27 // USB CBI transport timeout, set by experience
29 #define USB_CBI_RESET_DEVICE_TIMEOUT (1 * USB_MASS_1_SECOND)
33 // Put Interface at the first field to make it easy to distinguish BOT/CBI Protocol instance
35 EFI_USB_INTERFACE_DESCRIPTOR Interface
;
36 EFI_USB_ENDPOINT_DESCRIPTOR
*BulkInEndpoint
;
37 EFI_USB_ENDPOINT_DESCRIPTOR
*BulkOutEndpoint
;
38 EFI_USB_ENDPOINT_DESCRIPTOR
*InterruptEndpoint
;
39 EFI_USB_IO_PROTOCOL
*UsbIo
;
50 Initializes USB CBI protocol.
52 This function initializes the USB mass storage class CBI protocol.
53 It will save its context which is a USB_CBI_PROTOCOL structure
54 in the Context if Context isn't NULL.
56 @param UsbIo The USB I/O Protocol instance
57 @param Context The buffer to save the context to
59 @retval EFI_SUCCESS The device is successfully initialized.
60 @retval EFI_UNSUPPORTED The transport protocol doesn't support the device.
61 @retval Other The USB CBI initialization fails.
66 IN EFI_USB_IO_PROTOCOL
*UsbIo
,
67 OUT VOID
**Context OPTIONAL
71 Execute USB mass storage command through the CBI0/CBI1 transport protocol.
73 @param Context The USB CBI Protocol.
74 @param Cmd The command to transfer to device
75 @param CmdLen The length of the command
76 @param DataDir The direction of data transfer
77 @param Data The buffer to hold the data
78 @param DataLen The length of the buffer
79 @param Lun Should be 0, this field for bot only
80 @param Timeout The time to wait
81 @param CmdStatus The result of the command execution
83 @retval EFI_SUCCESS The command is executed successfully.
84 @retval Other Failed to execute the command
92 IN EFI_USB_DATA_DIRECTION DataDir
,
101 Reset the USB mass storage device by CBI protocol.
103 This function resets the USB mass storage device by CBI protocol.
104 The reset is defined as a non-data command. Don't use UsbCbiExecCommand
105 to send the command to device because that may introduce recursive loop.
107 @param Context The USB CBI protocol
108 @param ExtendedVerification The flag controlling the rule of reset.
111 @retval EFI_SUCCESS The device is reset.
112 @retval Others Failed to reset the device.
118 IN BOOLEAN ExtendedVerification
122 Clean up the CBI protocol's resource.
124 @param Context The instance of CBI protocol.
126 @retval EFI_SUCCESS The resource is cleaned up.