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 - 2010, 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
;
24 #define USB_CBI_MAX_PACKET_NUM 16
25 #define USB_CBI_RESET_CMD_LEN 12
27 // USB CBI retry C/B/I transport times, set by experience
29 #define USB_CBI_MAX_RETRY 3
31 // Time to wait for USB CBI reset to complete, set by experience
33 #define USB_CBI_RESET_DEVICE_STALL (50 * USB_MASS_1_MILLISECOND)
35 // USB CBI transport timeout, set by experience
37 #define USB_CBI_RESET_DEVICE_TIMEOUT (1 * USB_MASS_1_SECOND)
41 // Put Interface at the first field to make it easy to distinguish BOT/CBI Protocol instance
43 EFI_USB_INTERFACE_DESCRIPTOR Interface
;
44 EFI_USB_ENDPOINT_DESCRIPTOR
*BulkInEndpoint
;
45 EFI_USB_ENDPOINT_DESCRIPTOR
*BulkOutEndpoint
;
46 EFI_USB_ENDPOINT_DESCRIPTOR
*InterruptEndpoint
;
47 EFI_USB_IO_PROTOCOL
*UsbIo
;
58 Initializes USB CBI protocol.
60 This function initializes the USB mass storage class CBI protocol.
61 It will save its context which is a USB_CBI_PROTOCOL structure
62 in the Context if Context isn't NULL.
64 @param UsbIo The USB I/O Protocol instance
65 @param Context The buffer to save the context to
67 @retval EFI_SUCCESS The device is successfully initialized.
68 @retval EFI_UNSUPPORTED The transport protocol doesn't support the device.
69 @retval Other The USB CBI initialization fails.
74 IN EFI_USB_IO_PROTOCOL
*UsbIo
,
75 OUT VOID
**Context OPTIONAL
79 Execute USB mass storage command through the CBI0/CBI1 transport protocol.
81 @param Context The USB CBI Protocol.
82 @param Cmd The command to transfer to device
83 @param CmdLen The length of the command
84 @param DataDir The direction of data transfer
85 @param Data The buffer to hold the data
86 @param DataLen The length of the buffer
87 @param Lun Should be 0, this field for bot only
88 @param Timeout The time to wait
89 @param CmdStatus The result of the command execution
91 @retval EFI_SUCCESS The command is executed successfully.
92 @retval Other Failed to execute the command
100 IN EFI_USB_DATA_DIRECTION DataDir
,
105 OUT UINT32
*CmdStatus
109 Reset the USB mass storage device by CBI protocol.
111 This function resets the USB mass storage device by CBI protocol.
112 The reset is defined as a non-data command. Don't use UsbCbiExecCommand
113 to send the command to device because that may introduce recursive loop.
115 @param Context The USB CBI protocol
116 @param ExtendedVerification The flag controlling the rule of reset.
119 @retval EFI_SUCCESS The device is reset.
120 @retval Others Failed to reset the device.
126 IN BOOLEAN ExtendedVerification
130 Clean up the CBI protocol's resource.
132 @param Context The instance of CBI protocol.
134 @retval EFI_SUCCESS The resource is cleaned up.