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 - 2011, Intel Corporation. All rights reserved.<BR>
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #ifndef _EFI_USBMASS_CBI_H_
17 #define _EFI_USBMASS_CBI_H_
19 extern USB_MASS_TRANSPORT mUsbCbi0Transport
;
20 extern USB_MASS_TRANSPORT mUsbCbi1Transport
;
22 #define USB_CBI_MAX_PACKET_NUM 16
23 #define USB_CBI_RESET_CMD_LEN 12
25 // USB CBI retry C/B/I transport times, set by experience
27 #define USB_CBI_MAX_RETRY 3
29 // Time to wait for USB CBI reset to complete, set by experience
31 #define USB_CBI_RESET_DEVICE_STALL (50 * USB_MASS_1_MILLISECOND)
33 // USB CBI transport timeout, set by experience
35 #define USB_CBI_RESET_DEVICE_TIMEOUT (1 * USB_MASS_1_SECOND)
39 // Put Interface at the first field to make it easy to distinguish BOT/CBI Protocol instance
41 EFI_USB_INTERFACE_DESCRIPTOR Interface
;
42 EFI_USB_ENDPOINT_DESCRIPTOR
*BulkInEndpoint
;
43 EFI_USB_ENDPOINT_DESCRIPTOR
*BulkOutEndpoint
;
44 EFI_USB_ENDPOINT_DESCRIPTOR
*InterruptEndpoint
;
45 EFI_USB_IO_PROTOCOL
*UsbIo
;
56 Initializes USB CBI protocol.
58 This function initializes the USB mass storage class CBI protocol.
59 It will save its context which is a USB_CBI_PROTOCOL structure
60 in the Context if Context isn't NULL.
62 @param UsbIo The USB I/O Protocol instance
63 @param Context The buffer to save the context to
65 @retval EFI_SUCCESS The device is successfully initialized.
66 @retval EFI_UNSUPPORTED The transport protocol doesn't support the device.
67 @retval Other The USB CBI initialization fails.
72 IN EFI_USB_IO_PROTOCOL
*UsbIo
,
73 OUT VOID
**Context OPTIONAL
77 Execute USB mass storage command through the CBI0/CBI1 transport protocol.
79 @param Context The USB CBI Protocol.
80 @param Cmd The command to transfer to device
81 @param CmdLen The length of the command
82 @param DataDir The direction of data transfer
83 @param Data The buffer to hold the data
84 @param DataLen The length of the buffer
85 @param Lun Should be 0, this field for bot only
86 @param Timeout The time to wait
87 @param CmdStatus The result of the command execution
89 @retval EFI_SUCCESS The command is executed successfully.
90 @retval Other Failed to execute the command
98 IN EFI_USB_DATA_DIRECTION DataDir
,
103 OUT UINT32
*CmdStatus
107 Reset the USB mass storage device by CBI protocol.
109 This function resets the USB mass storage device by CBI protocol.
110 The reset is defined as a non-data command. Don't use UsbCbiExecCommand
111 to send the command to device because that may introduce recursive loop.
113 @param Context The USB CBI protocol
114 @param ExtendedVerification The flag controlling the rule of reset.
117 @retval EFI_SUCCESS The device is reset.
118 @retval Others Failed to reset the device.
124 IN BOOLEAN ExtendedVerification
128 Clean up the CBI protocol's resource.
130 @param Context The instance of CBI protocol.
132 @retval EFI_SUCCESS The resource is cleaned up.