TianoCore EDK2 master
|
#include "UsbMass.h"
Go to the source code of this file.
Implementation of the command set of USB Mass Storage Specification for Bootability, Revision 1.0.
Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file UsbMassBoot.c.
EFI_STATUS UsbBootDetectMedia | ( | IN USB_MASS_DEVICE * | UsbMass | ) |
Detect whether the removable media is present and whether it has changed.
UsbMass | The device to check. |
EFI_SUCCESS | The media status is successfully checked. |
Other | Failed to detect media. |
Definition at line 682 of file UsbMassBoot.c.
EFI_STATUS UsbBootExecCmd | ( | IN USB_MASS_DEVICE * | UsbMass, |
IN VOID * | Cmd, | ||
IN UINT8 | CmdLen, | ||
IN EFI_USB_DATA_DIRECTION | DataDir, | ||
IN VOID * | Data, | ||
IN UINT32 | DataLen, | ||
IN UINT32 | Timeout | ||
) |
Execute the USB mass storage bootability commands.
This function executes the USB mass storage bootability commands. If execution failed, retrieve the error by REQUEST_SENSE, then update the device's status, such as ReadyOnly.
UsbMass | The device to issue commands to |
Cmd | The command to execute |
CmdLen | The length of the command |
DataDir | The direction of data transfer |
Data | The buffer to hold the data |
DataLen | The length of expected data |
Timeout | The timeout used to transfer |
EFI_SUCCESS | Command is executed successfully |
Others | Command execution failed. |
Definition at line 170 of file UsbMassBoot.c.
EFI_STATUS UsbBootExecCmdWithRetry | ( | IN USB_MASS_DEVICE * | UsbMass, |
IN VOID * | Cmd, | ||
IN UINT8 | CmdLen, | ||
IN EFI_USB_DATA_DIRECTION | DataDir, | ||
IN VOID * | Data, | ||
IN UINT32 | DataLen, | ||
IN UINT32 | Timeout | ||
) |
Execute the USB mass storage bootability commands with retrial.
This function executes USB mass storage bootability commands. If the device isn't ready, wait for it. If the device is ready and error occurs, retry the command again until it exceeds the limit of retrial times.
UsbMass | The device to issue commands to |
Cmd | The command to execute |
CmdLen | The length of the command |
DataDir | The direction of data transfer |
Data | The buffer to hold the data |
DataLen | The length of expected data |
Timeout | The timeout used to transfer |
EFI_SUCCESS | The command is executed successfully. |
EFI_NO_MEDIA | The device media is removed. |
Others | Command execution failed after retrial. |
Definition at line 239 of file UsbMassBoot.c.
EFI_STATUS UsbBootGetParams | ( | IN USB_MASS_DEVICE * | UsbMass | ) |
Get the parameters for the USB mass storage media.
This function get the parameters for the USB mass storage media, It is used both to initialize the media during the Start() phase of Driver Binding Protocol and to re-initialize it when the media is changed. Although the RemoveableMedia is unlikely to change, it is also included here.
UsbMass | The device to retrieve disk gemotric. |
EFI_SUCCESS | The disk gemotric is successfully retrieved. |
Other | Failed to get the parameters. |
Definition at line 624 of file UsbMassBoot.c.
EFI_STATUS UsbBootInquiry | ( | IN USB_MASS_DEVICE * | UsbMass | ) |
Execute INQUIRY Command to request information regarding parameters of the device be sent to the host computer.
UsbMass | The device to inquire. |
EFI_SUCCESS | INQUIRY Command is executed successfully. |
Others | INQUIRY Command is not executed successfully. |
Definition at line 355 of file UsbMassBoot.c.
EFI_STATUS UsbBootIsUnitReady | ( | IN USB_MASS_DEVICE * | UsbMass | ) |
Execute TEST UNIT READY command to check if the device is ready.
UsbMass | The device to test |
EFI_SUCCESS | The device is ready. |
Others | Device not ready. |
Definition at line 322 of file UsbMassBoot.c.
EFI_STATUS UsbBootReadCapacity | ( | IN USB_MASS_DEVICE * | UsbMass | ) |
Execute READ CAPACITY command to request information regarding the capacity of the installed medium of the device.
This function executes READ CAPACITY command to get the capacity of the USB mass storage media, including the presence, block size, and last block number.
UsbMass | The device to retireve disk gemotric. |
EFI_SUCCESS | The disk geometry is successfully retrieved. |
EFI_NOT_READY | The returned block size is zero. |
Other | READ CAPACITY command execution failed. |
Definition at line 496 of file UsbMassBoot.c.
EFI_STATUS UsbBootReadCapacity16 | ( | IN USB_MASS_DEVICE * | UsbMass | ) |
Execute READ CAPACITY 16 bytes command to request information regarding the capacity of the installed medium of the device.
This function executes READ CAPACITY 16 bytes command to get the capacity of the USB mass storage media, including the presence, block size, and last block number.
UsbMass | The device to retireve disk gemotric. |
EFI_SUCCESS | The disk geometry is successfully retrieved. |
EFI_NOT_READY | The returned block size is zero. |
Other | READ CAPACITY 16 bytes command execution failed. |
Definition at line 415 of file UsbMassBoot.c.
EFI_STATUS UsbBootReadWriteBlocks | ( | IN USB_MASS_DEVICE * | UsbMass, |
IN BOOLEAN | Write, | ||
IN UINT32 | Lba, | ||
IN UINTN | TotalBlock, | ||
IN OUT UINT8 * | Buffer | ||
) |
Read or write some blocks from the device.
UsbMass | The USB mass storage device to access |
Write | TRUE for write operation. |
Lba | The start block number |
TotalBlock | Total block number to read or write |
Buffer | The buffer to read to or write from |
EFI_SUCCESS | Data are read into the buffer or writen into the device. |
Others | Failed to read or write all the data |
Definition at line 810 of file UsbMassBoot.c.
EFI_STATUS UsbBootReadWriteBlocks16 | ( | IN USB_MASS_DEVICE * | UsbMass, |
IN BOOLEAN | Write, | ||
IN UINT64 | Lba, | ||
IN UINTN | TotalBlock, | ||
IN OUT UINT8 * | Buffer | ||
) |
Read or write some blocks from the device by SCSI 16 byte cmd.
UsbMass | The USB mass storage device to access |
Write | TRUE for write operation. |
Lba | The start block number |
TotalBlock | Total block number to read or write |
Buffer | The buffer to read to or write from |
EFI_SUCCESS | Data are read into the buffer or writen into the device. |
Others | Failed to read or write all the data |
Definition at line 896 of file UsbMassBoot.c.
EFI_STATUS UsbBootRequestSense | ( | IN USB_MASS_DEVICE * | UsbMass | ) |
Execute REQUEST SENSE Command to retrieve sense data from device.
UsbMass | The device whose sense data is requested. |
EFI_SUCCESS | The command is executed successfully. |
EFI_DEVICE_ERROR | Failed to request sense. |
EFI_NO_RESPONSE | The device media doesn't response this request. |
EFI_INVALID_PARAMETER | The command has some invalid parameters. |
EFI_WRITE_PROTECTED | The device is write protected. |
EFI_MEDIA_CHANGED | The device media has been changed. |
Definition at line 26 of file UsbMassBoot.c.
EFI_STATUS UsbClearEndpointStall | ( | IN EFI_USB_IO_PROTOCOL * | UsbIo, |
IN UINT8 | EndpointAddr | ||
) |
Use the USB clear feature control transfer to clear the endpoint stall condition.
UsbIo | The USB I/O Protocol instance |
EndpointAddr | The endpoint to clear stall for |
EFI_SUCCESS | The endpoint stall condition is cleared. |
Others | Failed to clear the endpoint stall condition. |
Definition at line 977 of file UsbMassBoot.c.
EFI_STATUS UsbScsiModeSense | ( | IN USB_MASS_DEVICE * | UsbMass | ) |
Retrieves SCSI mode sense information via MODE SENSE(6) command.
UsbMass | The device whose sense data is requested. |
EFI_SUCCESS | SCSI mode sense information retrieved successfully. |
Other | Command execution failed. |
Definition at line 564 of file UsbMassBoot.c.