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 - 2008, Intel Corporation
6 All rights reserved. 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_
21 extern USB_MASS_TRANSPORT mUsbCbi0Transport
;
22 extern USB_MASS_TRANSPORT mUsbCbi1Transport
;
25 USB_CBI_MAX_PACKET_NUM
= 16,
26 USB_CBI_RESET_CMD_LEN
= 12,
29 // USB CBI retry C/B/I transport times, set by experience
31 USB_CBI_MAX_RETRY
= 3,
34 // Time to wait for USB CBI reset to complete, set by experience
36 USB_CBI_RESET_DEVICE_STALL
= 50 * USB_MASS_1_MILLISECOND
,
39 // USB CBI transport timeout, set by experience
41 USB_CBI_RESET_DEVICE_TIMEOUT
= 1 * USB_MASS_1_SECOND
46 // Put Interface at the first field to make it easy to distinguish BOT/CBI Protocol instance
48 EFI_USB_INTERFACE_DESCRIPTOR Interface
;
49 EFI_USB_ENDPOINT_DESCRIPTOR
*BulkInEndpoint
;
50 EFI_USB_ENDPOINT_DESCRIPTOR
*BulkOutEndpoint
;
51 EFI_USB_ENDPOINT_DESCRIPTOR
*InterruptEndpoint
;
52 EFI_USB_IO_PROTOCOL
*UsbIo
;
63 Initializes USB CBI protocol.
65 This function initializes the USB mass storage class CBI protocol.
66 It will save its context which is a USB_CBI_PROTOCOL structure
67 in the Context if Context isn't NULL.
69 @param UsbIo The USB I/O Protocol instance
70 @param Context The buffer to save the context to
72 @retval EFI_SUCCESS The device is successfully initialized.
73 @retval EFI_UNSUPPORTED The transport protocol doesn't support the device.
74 @retval Other The USB CBI initialization fails.
79 IN EFI_USB_IO_PROTOCOL
*UsbIo
,
80 OUT VOID
**Context OPTIONAL
84 Execute USB mass storage command through the CBI0/CBI1 transport protocol.
86 @param Context The USB CBI Protocol.
87 @param Cmd The command to transfer to device
88 @param CmdLen The length of the command
89 @param DataDir The direction of data transfer
90 @param Data The buffer to hold the data
91 @param DataLen The length of the buffer
92 @param Lun Should be 0, this field for bot only
93 @param Timeout The time to wait
94 @param CmdStatus The result of the command execution
96 @retval EFI_SUCCESS The command is executed successfully.
97 @retval Other Failed to execute the command
105 IN EFI_USB_DATA_DIRECTION DataDir
,
110 OUT UINT32
*CmdStatus
114 Reset the USB mass storage device by CBI protocol.
116 This function resets the USB mass storage device by CBI protocol.
117 The reset is defined as a non-data command. Don't use UsbCbiExecCommand
118 to send the command to device because that may introduce recursive loop.
120 @param Context The USB CBI protocol
121 @param ExtendedVerification The flag controlling the rule of reset.
124 @retval EFI_SUCCESS The device is reset.
125 @retval Others Failed to reset the device.
131 IN BOOLEAN ExtendedVerification
135 Clean up the CBI protocol's resource.
137 @param Context The instance of CBI protocol.
139 @retval EFI_SUCCESS The resource is cleaned up.