TianoCore EDK2 master
|
#include "UsbMass.h"
Go to the source code of this file.
Macros | |
#define | USB_MASS_TRANSPORT_COUNT 3 |
Variables | |
USB_MASS_TRANSPORT * | mUsbMassTransport [USB_MASS_TRANSPORT_COUNT] |
EFI_DRIVER_BINDING_PROTOCOL | gUSBMassDriverBinding |
USB Mass Storage Driver that manages USB Mass Storage Device and produces Block I/O Protocol.
Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file UsbMassImpl.c.
#define USB_MASS_TRANSPORT_COUNT 3 |
Definition at line 11 of file UsbMassImpl.c.
EFI_STATUS EFIAPI USBMassDriverBindingStart | ( | IN EFI_DRIVER_BINDING_PROTOCOL * | This, |
IN EFI_HANDLE | Controller, | ||
IN EFI_DEVICE_PATH_PROTOCOL * | RemainingDevicePath | ||
) |
Starts the USB mass storage device with this driver.
This function consumes USB I/O Protocol, initializes USB mass storage device, installs Block I/O Protocol, and submits Asynchronous Interrupt Transfer to manage the USB mass storage device.
This | The USB mass storage driver binding protocol. |
Controller | The USB mass storage device to start on |
RemainingDevicePath | The remaining device path. |
EFI_SUCCESS | This driver supports this device. |
EFI_UNSUPPORTED | This driver does not support this device. |
EFI_DEVICE_ERROR | This driver cannot be started due to device Error. |
EFI_OUT_OF_RESOURCES | Can't allocate memory resources. |
EFI_ALREADY_STARTED | This driver has been started. |
Definition at line 791 of file UsbMassImpl.c.
EFI_STATUS EFIAPI USBMassDriverBindingStop | ( | IN EFI_DRIVER_BINDING_PROTOCOL * | This, |
IN EFI_HANDLE | Controller, | ||
IN UINTN | NumberOfChildren, | ||
IN EFI_HANDLE * | ChildHandleBuffer | ||
) |
Stop controlling the device.
This | The USB mass storage driver binding |
Controller | The device controller controlled by the driver. |
NumberOfChildren | The number of children of this device |
ChildHandleBuffer | The buffer of children handle. |
EFI_SUCCESS | The driver stopped from controlling the device. |
EFI_DEVICE_ERROR | The device could not be stopped due to a device error. |
EFI_UNSUPPORTED | Block I/O Protocol is not installed on Controller. |
Others | Failed to stop the driver |
Definition at line 907 of file UsbMassImpl.c.
EFI_STATUS EFIAPI USBMassDriverBindingSupported | ( | IN EFI_DRIVER_BINDING_PROTOCOL * | This, |
IN EFI_HANDLE | Controller, | ||
IN EFI_DEVICE_PATH_PROTOCOL * | RemainingDevicePath | ||
) |
Check whether the controller is a supported USB mass storage.
This | The USB mass storage driver binding protocol. |
Controller | The controller handle to check. |
RemainingDevicePath | The remaining device path. |
EFI_SUCCESS | The driver supports this controller. |
other | This device isn't supported. |
Definition at line 707 of file UsbMassImpl.c.
EFI_STATUS EFIAPI UsbMassFlushBlocks | ( | IN EFI_BLOCK_IO_PROTOCOL * | This | ) |
Flushes all modified data to a physical block device.
This function implements EFI_BLOCK_IO_PROTOCOL.FlushBlocks(). USB mass storage device doesn't support write cache, so return EFI_SUCCESS directly.
This | Indicates a pointer to the calling context. |
EFI_SUCCESS | All outstanding data were written correctly to the device. |
EFI_DEVICE_ERROR | The device reported an error while attempting to write data. |
EFI_NO_MEDIA | There is no media in the device. |
Definition at line 319 of file UsbMassImpl.c.
EFI_STATUS UsbMassInitMedia | ( | IN USB_MASS_DEVICE * | UsbMass | ) |
Initialize the media parameter data for EFI_BLOCK_IO_MEDIA of Block I/O Protocol.
UsbMass | The USB mass storage device |
EFI_SUCCESS | The media parameters are updated successfully. |
Others | Failed to get the media parameters. |
Definition at line 336 of file UsbMassImpl.c.
EFI_STATUS UsbMassInitMultiLun | ( | IN EFI_DRIVER_BINDING_PROTOCOL * | This, |
IN EFI_HANDLE | Controller, | ||
IN USB_MASS_TRANSPORT * | Transport, | ||
IN VOID * | Context, | ||
IN EFI_DEVICE_PATH_PROTOCOL * | DevicePath, | ||
IN UINT8 | MaxLun | ||
) |
Initialize data for device that supports multiple LUNSs.
This | The Driver Binding Protocol instance. |
Controller | The device to initialize. |
Transport | Pointer to USB_MASS_TRANSPORT. |
Context | Parameter for USB_MASS_DEVICE.Context. |
DevicePath | The remaining device path. |
MaxLun | The max LUN number. |
EFI_SUCCESS | At least one LUN is initialized successfully. |
EFI_NOT_FOUND | Fail to initialize any of multiple LUNs. |
Definition at line 473 of file UsbMassImpl.c.
EFI_STATUS UsbMassInitNonLun | ( | IN EFI_DRIVER_BINDING_PROTOCOL * | This, |
IN EFI_HANDLE | Controller, | ||
IN USB_MASS_TRANSPORT * | Transport, | ||
IN VOID * | Context | ||
) |
Initialize data for device that does not support multiple LUNSs.
This | The Driver Binding Protocol instance. |
Controller | The device to initialize. |
Transport | Pointer to USB_MASS_TRANSPORT. |
Context | Parameter for USB_MASS_DEVICE.Context. |
EFI_SUCCESS | Initialization succeeds. |
Other | Initialization fails. |
Definition at line 611 of file UsbMassImpl.c.
EFI_STATUS UsbMassInitTransport | ( | IN EFI_DRIVER_BINDING_PROTOCOL * | This, |
IN EFI_HANDLE | Controller, | ||
OUT USB_MASS_TRANSPORT ** | Transport, | ||
OUT VOID ** | Context, | ||
OUT UINT8 * | MaxLun | ||
) |
Initialize the USB Mass Storage transport.
This function tries to find the matching USB Mass Storage transport protocol for USB device. If found, initializes the matching transport.
This | The USB mass driver's driver binding. |
Controller | The device to test. |
Transport | The pointer to pointer to USB_MASS_TRANSPORT. |
Context | The parameter for USB_MASS_DEVICE.Context. |
MaxLun | Get the MaxLun if is BOT dev. |
EFI_SUCCESS | The initialization is successful. |
EFI_UNSUPPORTED | No matching transport protocol is found. |
Others | Failed to initialize dev. |
Definition at line 387 of file UsbMassImpl.c.
EFI_STATUS EFIAPI UsbMassReadBlocks | ( | IN EFI_BLOCK_IO_PROTOCOL * | This, |
IN UINT32 | MediaId, | ||
IN EFI_LBA | Lba, | ||
IN UINTN | BufferSize, | ||
OUT VOID * | Buffer | ||
) |
Reads the requested number of blocks from the device.
This function implements EFI_BLOCK_IO_PROTOCOL.ReadBlocks(). It reads the requested number of blocks from the device. All the blocks are read, or an error is returned.
This | Indicates a pointer to the calling context. |
MediaId | The media ID that the read request is for. |
Lba | The starting logical block address to read from on the device. |
BufferSize | The size of the Buffer in bytes. This must be a multiple of the intrinsic block size of the device. |
Buffer | A pointer to the destination buffer for the data. The caller is responsible for either having implicit or explicit ownership of the buffer. |
EFI_SUCCESS | The data was read correctly from the device. |
EFI_DEVICE_ERROR | The device reported an error while attempting to perform the read operation. |
EFI_NO_MEDIA | There is no media in the device. |
EFI_MEDIA_CHANGED | The MediaId is not for the current media. |
EFI_BAD_BUFFER_SIZE | The BufferSize parameter is not a multiple of the intrinsic block size of the device. |
EFI_INVALID_PARAMETER | The read request contains LBAs that are not valid, or the buffer is not on proper alignment. |
Definition at line 96 of file UsbMassImpl.c.
EFI_STATUS EFIAPI UsbMassReset | ( | IN EFI_BLOCK_IO_PROTOCOL * | This, |
IN BOOLEAN | ExtendedVerification | ||
) |
Reset the block device.
This function implements EFI_BLOCK_IO_PROTOCOL.Reset(). It resets the block device hardware. ExtendedVerification is ignored in this implementation.
This | Indicates a pointer to the calling context. |
ExtendedVerification | Indicates that the driver may perform a more exhaustive verification operation of the device during reset. |
EFI_SUCCESS | The block device was reset. |
EFI_DEVICE_ERROR | The block device is not functioning correctly and could not be reset. |
Definition at line 47 of file UsbMassImpl.c.
EFI_STATUS EFIAPI USBMassStorageEntryPoint | ( | IN EFI_HANDLE | ImageHandle, |
IN EFI_SYSTEM_TABLE * | SystemTable | ||
) |
Entrypoint of USB Mass Storage Driver.
This function is the entrypoint of USB Mass Storage Driver. It installs Driver Binding Protocol together with Component Name Protocols.
ImageHandle | The firmware allocated handle for the EFI image. |
SystemTable | A pointer to the EFI System Table. |
EFI_SUCCESS | The entry point is executed successfully. |
Definition at line 1089 of file UsbMassImpl.c.
EFI_STATUS EFIAPI UsbMassWriteBlocks | ( | IN EFI_BLOCK_IO_PROTOCOL * | This, |
IN UINT32 | MediaId, | ||
IN EFI_LBA | Lba, | ||
IN UINTN | BufferSize, | ||
IN VOID * | Buffer | ||
) |
Writes a specified number of blocks to the device.
This function implements EFI_BLOCK_IO_PROTOCOL.WriteBlocks(). It writes a specified number of blocks to the device. All blocks are written, or an error is returned.
This | Indicates a pointer to the calling context. |
MediaId | The media ID that the write request is for. |
Lba | The starting logical block address to be written. |
BufferSize | The size of the Buffer in bytes. This must be a multiple of the intrinsic block size of the device. |
Buffer | Pointer to the source buffer for the data. |
EFI_SUCCESS | The data were written correctly to the device. |
EFI_WRITE_PROTECTED | The device cannot be written to. |
EFI_NO_MEDIA | There is no media in the device. |
EFI_MEDIA_CHANGED | The MediaId is not for the current media. |
EFI_DEVICE_ERROR | The device reported an error while attempting to perform the write operation. |
EFI_BAD_BUFFER_SIZE | The BufferSize parameter is not a multiple of the intrinsic block size of the device. |
EFI_INVALID_PARAMETER | The write request contains LBAs that are not valid, or the buffer is not on proper alignment. |
Definition at line 211 of file UsbMassImpl.c.
EFI_DRIVER_BINDING_PROTOCOL gUSBMassDriverBinding |
Definition at line 21 of file UsbMassImpl.c.
USB_MASS_TRANSPORT* mUsbMassTransport[USB_MASS_TRANSPORT_COUNT] |
Definition at line 15 of file UsbMassImpl.c.