TianoCore EDK2 master
|
Go to the source code of this file.
Data Structures | |
struct | USB_BOT_CBW |
struct | USB_BOT_CSW |
struct | USB_BOT_PROTOCOL |
Macros | |
#define | USB_BOT_RESET_REQUEST 0xFF |
Bulk-Only Mass Storage Reset. | |
#define | USB_BOT_GETLUN_REQUEST 0xFE |
Get Max Lun. | |
#define | USB_BOT_CBW_SIGNATURE 0x43425355 |
dCBWSignature, tag the packet as CBW | |
#define | USB_BOT_CSW_SIGNATURE 0x53425355 |
dCSWSignature, tag the packet as CSW | |
#define | USB_BOT_MAX_LUN 0x0F |
Lun number is from 0 to 15. | |
#define | USB_BOT_MAX_CMDLEN 16 |
Maximum number of command from command set. | |
#define | USB_BOT_COMMAND_OK 0x00 |
Command passed, good status. | |
#define | USB_BOT_COMMAND_FAILED 0x01 |
Command failed. | |
#define | USB_BOT_COMMAND_ERROR 0x02 |
Phase error, need to reset the device. | |
#define | USB_BOT_RECV_CSW_RETRY 3 |
#define | USB_BOT_RESET_DEVICE_STALL (100 * USB_MASS_1_MILLISECOND) |
#define | USB_BOT_SEND_CBW_TIMEOUT (3 * USB_MASS_1_SECOND) |
#define | USB_BOT_RECV_CSW_TIMEOUT (3 * USB_MASS_1_SECOND) |
#define | USB_BOT_RESET_DEVICE_TIMEOUT (3 * USB_MASS_1_SECOND) |
Functions | |
EFI_STATUS | UsbBotInit (IN EFI_USB_IO_PROTOCOL *UsbIo, OUT VOID **Context OPTIONAL) |
EFI_STATUS | UsbBotExecCommand (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) |
EFI_STATUS | UsbBotResetDevice (IN VOID *Context, IN BOOLEAN ExtendedVerification) |
EFI_STATUS | UsbBotGetMaxLun (IN VOID *Context, OUT UINT8 *MaxLun) |
EFI_STATUS | UsbBotCleanUp (IN VOID *Context) |
Variables | |
USB_MASS_TRANSPORT | mUsbBotTransport |
Definition for the USB mass storage Bulk-Only Transport protocol, based on the "Universal Serial Bus Mass Storage Class Bulk-Only Transport" Revision 1.0, September 31, 1999.
Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file UsbMassBot.h.
#define USB_BOT_CBW_SIGNATURE 0x43425355 |
dCBWSignature, tag the packet as CBW
Definition at line 21 of file UsbMassBot.h.
#define USB_BOT_COMMAND_ERROR 0x02 |
Phase error, need to reset the device.
Definition at line 31 of file UsbMassBot.h.
#define USB_BOT_COMMAND_FAILED 0x01 |
Command failed.
Definition at line 30 of file UsbMassBot.h.
#define USB_BOT_COMMAND_OK 0x00 |
Command passed, good status.
Definition at line 29 of file UsbMassBot.h.
#define USB_BOT_CSW_SIGNATURE 0x53425355 |
dCSWSignature, tag the packet as CSW
Definition at line 22 of file UsbMassBot.h.
#define USB_BOT_GETLUN_REQUEST 0xFE |
Get Max Lun.
Definition at line 20 of file UsbMassBot.h.
#define USB_BOT_MAX_CMDLEN 16 |
Maximum number of command from command set.
Definition at line 24 of file UsbMassBot.h.
#define USB_BOT_MAX_LUN 0x0F |
Lun number is from 0 to 15.
Definition at line 23 of file UsbMassBot.h.
#define USB_BOT_RECV_CSW_RETRY 3 |
Definition at line 36 of file UsbMassBot.h.
#define USB_BOT_RECV_CSW_TIMEOUT (3 * USB_MASS_1_SECOND) |
Definition at line 47 of file UsbMassBot.h.
#define USB_BOT_RESET_DEVICE_STALL (100 * USB_MASS_1_MILLISECOND) |
Definition at line 41 of file UsbMassBot.h.
#define USB_BOT_RESET_DEVICE_TIMEOUT (3 * USB_MASS_1_SECOND) |
Definition at line 48 of file UsbMassBot.h.
#define USB_BOT_RESET_REQUEST 0xFF |
Bulk-Only Mass Storage Reset.
Definition at line 19 of file UsbMassBot.h.
#define USB_BOT_SEND_CBW_TIMEOUT (3 * USB_MASS_1_SECOND) |
Definition at line 46 of file UsbMassBot.h.
EFI_STATUS UsbBotCleanUp | ( | IN VOID * | Context | ) |
Clean up the resource used by this BOT protocol.
Context | The context of the BOT protocol, that is, USB_BOT_PROTOCOL. |
EFI_SUCCESS | The resource is cleaned up. |
Definition at line 598 of file UsbMassBot.c.
EFI_STATUS UsbBotExecCommand | ( | 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 | ||
) |
Call the USB Mass Storage Class BOT protocol to issue the command/data/status circle to execute the commands.
Context | The context of the BOT protocol, that is, USB_BOT_PROTOCOL |
Cmd | The high level command |
CmdLen | The command length |
DataDir | The direction of the data transfer |
Data | The buffer to hold data |
DataLen | The length of the data |
Lun | The number of logic unit |
Timeout | The time to wait command |
CmdStatus | The result of high level command execution |
EFI_SUCCESS | The command is executed successfully. |
Other | Failed to execute command |
Definition at line 393 of file UsbMassBot.c.
EFI_STATUS UsbBotGetMaxLun | ( | IN VOID * | Context, |
OUT UINT8 * | MaxLun | ||
) |
Get the max LUN (Logical Unit Number) of USB mass storage device.
Context | The context of the BOT protocol, that is, USB_BOT_PROTOCOL |
MaxLun | Return pointer to the max number of LUN. (e.g. MaxLun=1 means LUN0 and LUN1 in all.) |
EFI_SUCCESS | Max LUN is got successfully. |
Others | Fail to execute this request. |
Definition at line 536 of file UsbMassBot.c.
EFI_STATUS UsbBotInit | ( | IN EFI_USB_IO_PROTOCOL * | UsbIo, |
OUT VOID **Context | OPTIONAL | ||
) |
Initializes USB BOT protocol.
This function initializes the USB mass storage class BOT protocol. It will save its context which is a USB_BOT_PROTOCOL structure in the Context if Context isn't NULL.
UsbIo | The USB I/O Protocol instance |
Context | The buffer to save the context to |
EFI_SUCCESS | The device is successfully initialized. |
EFI_UNSUPPORTED | The transport protocol doesn't support the device. |
Other | The USB BOT initialization fails. |
Definition at line 40 of file UsbMassBot.c.
EFI_STATUS UsbBotResetDevice | ( | IN VOID * | Context, |
IN BOOLEAN | ExtendedVerification | ||
) |
Reset the USB mass storage device by BOT protocol.
Context | The context of the BOT protocol, that is, USB_BOT_PROTOCOL. |
ExtendedVerification | If FALSE, just issue Bulk-Only Mass Storage Reset request. If TRUE, additionally reset parent hub port. |
EFI_SUCCESS | The device is reset. |
Others | Failed to reset the device.. |
Definition at line 460 of file UsbMassBot.c.
|
extern |
Definition at line 15 of file UsbMassBot.c.