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_
19 extern USB_MASS_TRANSPORT mUsbCbi0Transport
;
20 extern USB_MASS_TRANSPORT mUsbCbi1Transport
;
23 USB_CBI_MAX_PACKET_NUM
= 16,
24 USB_CBI_RESET_CMD_LEN
= 12,
27 // USB CBI retry C/B/I transport times, set by experience
29 USB_CBI_MAX_RETRY
= 3,
32 // Time to wait for USB CBI reset to complete, set by experience
34 USB_CBI_RESET_DEVICE_STALL
= 50 * USB_MASS_1_MILLISECOND
,
37 // USB CBI transport timeout, set by experience
39 USB_CBI_RESET_DEVICE_TIMEOUT
= 1 * USB_MASS_1_SECOND
44 // Put Interface at the first field to make it easy to distinguish BOT/CBI Protocol instance
46 EFI_USB_INTERFACE_DESCRIPTOR Interface
;
47 EFI_USB_ENDPOINT_DESCRIPTOR
*BulkInEndpoint
;
48 EFI_USB_ENDPOINT_DESCRIPTOR
*BulkOutEndpoint
;
49 EFI_USB_ENDPOINT_DESCRIPTOR
*InterruptEndpoint
;
50 EFI_USB_IO_PROTOCOL
*UsbIo
;
61 Initializes USB CBI protocol.
63 This function initializes the USB mass storage class CBI protocol.
64 It will save its context which is a USB_CBI_PROTOCOL structure
65 in the Context if Context isn't NULL.
67 @param UsbIo The USB I/O Protocol instance
68 @param Context The buffer to save the context to
70 @retval EFI_SUCCESS The device is successfully initialized.
71 @retval EFI_UNSUPPORTED The transport protocol doesn't support the device.
72 @retval Other The USB CBI initialization fails.
77 IN EFI_USB_IO_PROTOCOL
*UsbIo
,
78 OUT VOID
**Context OPTIONAL
82 Execute USB mass storage command through the CBI0/CBI1 transport protocol.
84 @param Context The USB CBI Protocol.
85 @param Cmd The command to transfer to device
86 @param CmdLen The length of the command
87 @param DataDir The direction of data transfer
88 @param Data The buffer to hold the data
89 @param DataLen The length of the buffer
90 @param Lun Should be 0, this field for bot only
91 @param Timeout The time to wait
92 @param CmdStatus The result of the command execution
94 @retval EFI_SUCCESS The command is executed successfully.
95 @retval Other Failed to execute the command
103 IN EFI_USB_DATA_DIRECTION DataDir
,
108 OUT UINT32
*CmdStatus
112 Reset the USB mass storage device by CBI protocol.
114 This function resets the USB mass storage device by CBI protocol.
115 The reset is defined as a non-data command. Don't use UsbCbiExecCommand
116 to send the command to device because that may introduce recursive loop.
118 @param Context The USB CBI protocol
119 @param ExtendedVerification The flag controlling the rule of reset.
122 @retval EFI_SUCCESS The device is reset.
123 @retval Others Failed to reset the device.
129 IN BOOLEAN ExtendedVerification
133 Clean up the CBI protocol's resource.
135 @param Context The instance of CBI protocol.
137 @retval EFI_SUCCESS The resource is cleaned up.