TianoCore EDK2 master
Loading...
Searching...
No Matches
UsbMassImpl.h File Reference

Go to the source code of this file.

Macros

#define USB_MASS_SIGNATURE   SIGNATURE_32 ('U', 's', 'b', 'M')
 
#define USB_MASS_DEVICE_FROM_BLOCK_IO(a)    CR (a, USB_MASS_DEVICE, BlockIo, USB_MASS_SIGNATURE)
 
#define USB_MASS_DEVICE_FROM_DISK_INFO(a)    CR (a, USB_MASS_DEVICE, DiskInfo, USB_MASS_SIGNATURE)
 

Functions

EFI_STATUS EFIAPI USBMassDriverBindingSupported (IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
 
EFI_STATUS EFIAPI USBMassDriverBindingStart (IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
 
EFI_STATUS EFIAPI USBMassDriverBindingStop (IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer)
 
EFI_STATUS EFIAPI UsbMassReset (IN EFI_BLOCK_IO_PROTOCOL *This, IN BOOLEAN ExtendedVerification)
 
EFI_STATUS EFIAPI UsbMassReadBlocks (IN EFI_BLOCK_IO_PROTOCOL *This, IN UINT32 MediaId, IN EFI_LBA Lba, IN UINTN BufferSize, OUT VOID *Buffer)
 
EFI_STATUS EFIAPI UsbMassWriteBlocks (IN EFI_BLOCK_IO_PROTOCOL *This, IN UINT32 MediaId, IN EFI_LBA Lba, IN UINTN BufferSize, IN VOID *Buffer)
 
EFI_STATUS EFIAPI UsbMassFlushBlocks (IN EFI_BLOCK_IO_PROTOCOL *This)
 
EFI_STATUS EFIAPI UsbMassStorageGetDriverName (IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
 
EFI_STATUS EFIAPI UsbMassStorageGetControllerName (IN EFI_COMPONENT_NAME_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE ChildHandle OPTIONAL, IN CHAR8 *Language, OUT CHAR16 **ControllerName)
 

Variables

EFI_COMPONENT_NAME_PROTOCOL gUsbMassStorageComponentName
 
EFI_COMPONENT_NAME2_PROTOCOL gUsbMassStorageComponentName2
 

Detailed Description

Definitions of functions for Driver Binding Protocol and Block I/O Protocol, and other internal definitions.

Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file UsbMassImpl.h.

Macro Definition Documentation

◆ USB_MASS_DEVICE_FROM_BLOCK_IO

#define USB_MASS_DEVICE_FROM_BLOCK_IO (   a)     CR (a, USB_MASS_DEVICE, BlockIo, USB_MASS_SIGNATURE)

Definition at line 15 of file UsbMassImpl.h.

◆ USB_MASS_DEVICE_FROM_DISK_INFO

#define USB_MASS_DEVICE_FROM_DISK_INFO (   a)     CR (a, USB_MASS_DEVICE, DiskInfo, USB_MASS_SIGNATURE)

Definition at line 18 of file UsbMassImpl.h.

◆ USB_MASS_SIGNATURE

#define USB_MASS_SIGNATURE   SIGNATURE_32 ('U', 's', 'b', 'M')

Definition at line 13 of file UsbMassImpl.h.

Function Documentation

◆ USBMassDriverBindingStart()

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.

Parameters
ThisThe USB mass storage driver binding protocol.
ControllerThe USB mass storage device to start on
RemainingDevicePathThe remaining device path.
Return values
EFI_SUCCESSThis driver supports this device.
EFI_UNSUPPORTEDThis driver does not support this device.
EFI_DEVICE_ERRORThis driver cannot be started due to device Error.
EFI_OUT_OF_RESOURCESCan't allocate memory resources.
EFI_ALREADY_STARTEDThis driver has been started.

Definition at line 791 of file UsbMassImpl.c.

◆ USBMassDriverBindingStop()

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.

Parameters
ThisThe USB mass storage driver binding
ControllerThe device controller controlled by the driver.
NumberOfChildrenThe number of children of this device
ChildHandleBufferThe buffer of children handle.
Return values
EFI_SUCCESSThe driver stopped from controlling the device.
EFI_DEVICE_ERRORThe device could not be stopped due to a device error.
EFI_UNSUPPORTEDBlock I/O Protocol is not installed on Controller.
OthersFailed to stop the driver

Definition at line 907 of file UsbMassImpl.c.

◆ USBMassDriverBindingSupported()

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.

Parameters
ThisThe USB mass storage driver binding protocol.
ControllerThe controller handle to check.
RemainingDevicePathThe remaining device path.
Return values
EFI_SUCCESSThe driver supports this controller.
otherThis device isn't supported.

Definition at line 707 of file UsbMassImpl.c.

◆ UsbMassFlushBlocks()

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.

Parameters
ThisIndicates a pointer to the calling context.
Return values
EFI_SUCCESSAll outstanding data were written correctly to the device.
EFI_DEVICE_ERRORThe device reported an error while attempting to write data.
EFI_NO_MEDIAThere is no media in the device.

Definition at line 319 of file UsbMassImpl.c.

◆ UsbMassReadBlocks()

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.

Parameters
ThisIndicates a pointer to the calling context.
MediaIdThe media ID that the read request is for.
LbaThe starting logical block address to read from on the device.
BufferSizeThe size of the Buffer in bytes. This must be a multiple of the intrinsic block size of the device.
BufferA pointer to the destination buffer for the data. The caller is responsible for either having implicit or explicit ownership of the buffer.
Return values
EFI_SUCCESSThe data was read correctly from the device.
EFI_DEVICE_ERRORThe device reported an error while attempting to perform the read operation.
EFI_NO_MEDIAThere is no media in the device.
EFI_MEDIA_CHANGEDThe MediaId is not for the current media.
EFI_BAD_BUFFER_SIZEThe BufferSize parameter is not a multiple of the intrinsic block size of the device.
EFI_INVALID_PARAMETERThe read request contains LBAs that are not valid, or the buffer is not on proper alignment.

Definition at line 96 of file UsbMassImpl.c.

◆ UsbMassReset()

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.

Parameters
ThisIndicates a pointer to the calling context.
ExtendedVerificationIndicates that the driver may perform a more exhaustive verification operation of the device during reset.
Return values
EFI_SUCCESSThe block device was reset.
EFI_DEVICE_ERRORThe block device is not functioning correctly and could not be reset.

Definition at line 47 of file UsbMassImpl.c.

◆ UsbMassStorageGetControllerName()

EFI_STATUS EFIAPI UsbMassStorageGetControllerName ( IN EFI_COMPONENT_NAME_PROTOCOL This,
IN EFI_HANDLE  ControllerHandle,
IN EFI_HANDLE ChildHandle  OPTIONAL,
IN CHAR8 *  Language,
OUT CHAR16 **  ControllerName 
)

Retrieves a Unicode string that is the user readable name of the controller that is being managed by a driver.

This function retrieves the user readable name of the controller specified by ControllerHandle and ChildHandle in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the controller name is returned in ControllerName, and EFI_SUCCESS is returned. If the driver specified by This is not currently managing the controller specified by ControllerHandle and ChildHandle, then EFI_UNSUPPORTED is returned. If the driver specified by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned.

Parameters
ThisA pointer to the EFI_COMPONENT_NAME2_PROTOCOL or EFI_COMPONENT_NAME_PROTOCOL instance.
ControllerHandleThe handle of a controller that the driver specified by This is managing. This handle specifies the controller whose name is to be returned.
ChildHandleThe handle of the child controller to retrieve the name of. This is an optional parameter that may be NULL. It will be NULL for device drivers. It will also be NULL for a bus drivers that wish to retrieve the name of the bus controller. It will not be NULL for a bus driver that wishes to retrieve the name of a child controller.
LanguageA pointer to a Null-terminated ASCII string array indicating the language. This is the language of the driver name that the caller is requesting, and it must match one of the languages specified in SupportedLanguages. The number of languages supported by a driver is up to the driver writer. Language is specified in RFC 4646 or ISO 639-2 language code format.
ControllerNameA pointer to the Unicode string to return. This Unicode string is the name of the controller specified by ControllerHandle and ChildHandle in the language specified by Language from the point of view of the driver specified by This.
Return values
EFI_SUCCESSThe Unicode string for the user readable name in the language specified by Language for the driver specified by This was returned in DriverName.
EFI_INVALID_PARAMETERControllerHandle is NULL.
EFI_INVALID_PARAMETERChildHandle is not NULL and it is not a valid EFI_HANDLE.
EFI_INVALID_PARAMETERLanguage is NULL.
EFI_INVALID_PARAMETERControllerName is NULL.
EFI_UNSUPPORTEDThe driver specified by This is not currently managing the controller specified by ControllerHandle and ChildHandle.
EFI_UNSUPPORTEDThe driver specified by This does not support the language specified by Language.

Definition at line 146 of file ComponentName.c.

◆ UsbMassStorageGetDriverName()

EFI_STATUS EFIAPI UsbMassStorageGetDriverName ( IN EFI_COMPONENT_NAME_PROTOCOL This,
IN CHAR8 *  Language,
OUT CHAR16 **  DriverName 
)

Retrieves a Unicode string that is the user readable name of the driver.

This function retrieves the user readable name of a driver in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the driver name is returned in DriverName, and EFI_SUCCESS is returned. If the driver specified by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned.

Parameters
ThisA pointer to the EFI_COMPONENT_NAME2_PROTOCOL or EFI_COMPONENT_NAME_PROTOCOL instance.
LanguageA pointer to a Null-terminated ASCII string array indicating the language. This is the language of the driver name that the caller is requesting, and it must match one of the languages specified in SupportedLanguages. The number of languages supported by a driver is up to the driver writer. Language is specified in RFC 4646 or ISO 639-2 language code format.
DriverNameA pointer to the Unicode string to return. This Unicode string is the name of the driver specified by This in the language specified by Language.
Return values
EFI_SUCCESSThe Unicode string for the Driver specified by This and the language specified by Language was returned in DriverName.
EFI_INVALID_PARAMETERLanguage is NULL.
EFI_INVALID_PARAMETERDriverName is NULL.
EFI_UNSUPPORTEDThe driver specified by This does not support the language specified by Language.

Definition at line 71 of file ComponentName.c.

◆ UsbMassWriteBlocks()

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.

Parameters
ThisIndicates a pointer to the calling context.
MediaIdThe media ID that the write request is for.
LbaThe starting logical block address to be written.
BufferSizeThe size of the Buffer in bytes. This must be a multiple of the intrinsic block size of the device.
BufferPointer to the source buffer for the data.
Return values
EFI_SUCCESSThe data were written correctly to the device.
EFI_WRITE_PROTECTEDThe device cannot be written to.
EFI_NO_MEDIAThere is no media in the device.
EFI_MEDIA_CHANGEDThe MediaId is not for the current media.
EFI_DEVICE_ERRORThe device reported an error while attempting to perform the write operation.
EFI_BAD_BUFFER_SIZEThe BufferSize parameter is not a multiple of the intrinsic block size of the device.
EFI_INVALID_PARAMETERThe write request contains LBAs that are not valid, or the buffer is not on proper alignment.

Definition at line 211 of file UsbMassImpl.c.

Variable Documentation

◆ gUsbMassStorageComponentName

EFI_COMPONENT_NAME_PROTOCOL gUsbMassStorageComponentName
extern

Definition at line 14 of file ComponentName.c.

◆ gUsbMassStorageComponentName2

EFI_COMPONENT_NAME2_PROTOCOL gUsbMassStorageComponentName2
extern

Definition at line 23 of file ComponentName.c.