Code scrub for USB Mass Storage Driver.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7243 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/** @file
|
||||
|
||||
Defination for the USB mass storage Control/Bulk/Interrupt transport.
|
||||
Defination for the USB mass storage Control/Bulk/Interrupt (CBI) transport,
|
||||
according to USB Mass Storage Class Control/Bulk/Interrupt (CBI) Transport, Revision 1.1.
|
||||
|
||||
Copyright (c) 2007 - 2008, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
@@ -16,31 +16,33 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#ifndef _EFI_USBMASS_CBI_H_
|
||||
#define _EFI_USBMASS_CBI_H_
|
||||
|
||||
extern USB_MASS_TRANSPORT mUsbCbi0Transport;
|
||||
extern USB_MASS_TRANSPORT mUsbCbi1Transport;
|
||||
|
||||
typedef enum {
|
||||
USB_CBI_MAX_PACKET_NUM = 16,
|
||||
USB_CBI_RESET_CMD_LEN = 12,
|
||||
|
||||
//
|
||||
// Usb Cbi retry C/B/I transport times, set by experience
|
||||
// USB CBI retry C/B/I transport times, set by experience
|
||||
//
|
||||
USB_CBI_MAX_RETRY = 3,
|
||||
|
||||
//
|
||||
// Usb Cbi wait device reset complete, set by experience
|
||||
// Time to wait for USB CBI reset to complete, set by experience
|
||||
//
|
||||
USB_CBI_RESET_DEVICE_STALL = 50 * USB_MASS_1_MILLISECOND,
|
||||
|
||||
//
|
||||
// Usb Cbi transport timeout, set by experience
|
||||
// USB CBI transport timeout, set by experience
|
||||
//
|
||||
USB_CBI_RESET_DEVICE_TIMEOUT = 1 * USB_MASS_1_SECOND
|
||||
}USB_CBI_DATA;
|
||||
} USB_CBI_DATA;
|
||||
|
||||
//
|
||||
// Put Interface at the first field is to make it easy to get by Context, which
|
||||
// could be BOT/CBI Protocol instance
|
||||
//
|
||||
typedef struct {
|
||||
//
|
||||
// Put Interface at the first field to make it easy to distinguish BOT/CBI Protocol instance
|
||||
//
|
||||
EFI_USB_INTERFACE_DESCRIPTOR Interface;
|
||||
EFI_USB_ENDPOINT_DESCRIPTOR *BulkInEndpoint;
|
||||
EFI_USB_ENDPOINT_DESCRIPTOR *BulkOutEndpoint;
|
||||
@@ -55,6 +57,89 @@ typedef struct {
|
||||
} USB_CBI_STATUS;
|
||||
#pragma pack()
|
||||
|
||||
extern USB_MASS_TRANSPORT mUsbCbi0Transport;
|
||||
extern USB_MASS_TRANSPORT mUsbCbi1Transport;
|
||||
/**
|
||||
Initializes USB CBI protocol.
|
||||
|
||||
This function initializes the USB mass storage class CBI protocol.
|
||||
It will save its context which is a USB_CBI_PROTOCOL structure
|
||||
in the Context if Context isn't NULL.
|
||||
|
||||
@param UsbIo The USB I/O Protocol instance
|
||||
@param Context The buffer to save the context to
|
||||
|
||||
@retval EFI_SUCCESS The device is successfully initialized.
|
||||
@retval EFI_UNSUPPORTED The transport protocol doesn't support the device.
|
||||
@retval Other The USB CBI initialization fails.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
UsbCbiInit (
|
||||
IN EFI_USB_IO_PROTOCOL *UsbIo,
|
||||
OUT VOID **Context OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
Execute USB mass storage command through the CBI0/CBI1 transport protocol.
|
||||
|
||||
@param Context The USB CBI Protocol.
|
||||
@param Cmd The command to transfer to device
|
||||
@param CmdLen The length of the command
|
||||
@param DataDir The direction of data transfer
|
||||
@param Data The buffer to hold the data
|
||||
@param DataLen The length of the buffer
|
||||
@param Lun Should be 0, this field for bot only
|
||||
@param Timeout The time to wait
|
||||
@param CmdStatus The result of the command execution
|
||||
|
||||
@retval EFI_SUCCESS The command is executed successfully.
|
||||
@retval Other Failed to execute the command
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
UsbCbiExecCommand (
|
||||
IN VOID *Context,
|
||||
IN VOID *Cmd,
|
||||
IN UINT8 CmdLen,
|
||||
IN EFI_USB_DATA_DIRECTION DataDir,
|
||||
IN VOID *Data,
|
||||
IN UINT32 DataLen,
|
||||
IN UINT8 Lun,
|
||||
IN UINT32 Timeout,
|
||||
OUT UINT32 *CmdStatus
|
||||
);
|
||||
|
||||
/**
|
||||
Reset the USB mass storage device by CBI protocol.
|
||||
|
||||
This function resets the USB mass storage device by CBI protocol.
|
||||
The reset is defined as a non-data command. Don't use UsbCbiExecCommand
|
||||
to send the command to device because that may introduce recursive loop.
|
||||
|
||||
@param Context The USB CBI protocol
|
||||
@param ExtendedVerification The flag controlling the rule of reset.
|
||||
Not used here.
|
||||
|
||||
@retval EFI_SUCCESS The device is reset.
|
||||
@retval Others Failed to reset the device.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
UsbCbiResetDevice (
|
||||
IN VOID *Context,
|
||||
IN BOOLEAN ExtendedVerification
|
||||
);
|
||||
|
||||
/**
|
||||
Clean up the CBI protocol's resource.
|
||||
|
||||
@param Context The instance of CBI protocol.
|
||||
|
||||
@retval EFI_SUCCESS The resource is cleaned up.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
UsbCbiCleanUp (
|
||||
IN VOID *Context
|
||||
);
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user