TianoCore EDK2 master
|
#include "EmmcDxe.h"
Go to the source code of this file.
Functions | |
VOID EFIAPI | AsyncIoCallback (IN EFI_EVENT Event, IN VOID *Context) |
EFI_STATUS | EmmcSelect (IN EMMC_DEVICE *Device, IN UINT16 Rca) |
EFI_STATUS | EmmcSendStatus (IN EMMC_DEVICE *Device, IN UINT16 Rca, OUT UINT32 *DevStatus) |
EFI_STATUS | EmmcGetCsd (IN EMMC_DEVICE *Device, IN UINT16 Rca, OUT EMMC_CSD *Csd) |
EFI_STATUS | EmmcGetCid (IN EMMC_DEVICE *Device, IN UINT16 Rca, OUT EMMC_CID *Cid) |
EFI_STATUS | EmmcGetExtCsd (IN EMMC_DEVICE *Device, OUT EMMC_EXT_CSD *ExtCsd) |
EFI_STATUS | EmmcSetExtCsd (IN EMMC_PARTITION *Partition, IN UINT8 Offset, IN UINT8 Value, IN EFI_BLOCK_IO2_TOKEN *Token, IN BOOLEAN IsEnd) |
EFI_STATUS | EmmcSetBlkCount (IN EMMC_PARTITION *Partition, IN UINT16 BlockNum, IN EFI_BLOCK_IO2_TOKEN *Token, IN BOOLEAN IsEnd) |
EFI_STATUS | EmmcProtocolInOut (IN EMMC_PARTITION *Partition, IN UINT8 SecurityProtocol, IN UINT16 SecurityProtocolSpecificData, IN UINTN PayloadBufferSize, OUT VOID *PayloadBuffer, IN BOOLEAN IsRead, IN UINT64 Timeout, IN EFI_BLOCK_IO2_TOKEN *Token, IN BOOLEAN IsEnd) |
EFI_STATUS | EmmcRwMultiBlocks (IN EMMC_PARTITION *Partition, IN EFI_LBA Lba, IN VOID *Buffer, IN UINTN BufferSize, IN BOOLEAN IsRead, IN EFI_BLOCK_IO2_TOKEN *Token, IN BOOLEAN IsEnd) |
EFI_STATUS | EmmcReadWrite (IN EMMC_PARTITION *Partition, IN UINT32 MediaId, IN EFI_LBA Lba, IN OUT VOID *Buffer, IN UINTN BufferSize, IN BOOLEAN IsRead, IN OUT EFI_BLOCK_IO2_TOKEN *Token) |
EFI_STATUS EFIAPI | EmmcReset (IN EFI_BLOCK_IO_PROTOCOL *This, IN BOOLEAN ExtendedVerification) |
EFI_STATUS EFIAPI | EmmcReadBlocks (IN EFI_BLOCK_IO_PROTOCOL *This, IN UINT32 MediaId, IN EFI_LBA Lba, IN UINTN BufferSize, OUT VOID *Buffer) |
EFI_STATUS EFIAPI | EmmcWriteBlocks (IN EFI_BLOCK_IO_PROTOCOL *This, IN UINT32 MediaId, IN EFI_LBA Lba, IN UINTN BufferSize, IN VOID *Buffer) |
EFI_STATUS EFIAPI | EmmcFlushBlocks (IN EFI_BLOCK_IO_PROTOCOL *This) |
EFI_STATUS EFIAPI | EmmcResetEx (IN EFI_BLOCK_IO2_PROTOCOL *This, IN BOOLEAN ExtendedVerification) |
EFI_STATUS EFIAPI | EmmcReadBlocksEx (IN EFI_BLOCK_IO2_PROTOCOL *This, IN UINT32 MediaId, IN EFI_LBA Lba, IN OUT EFI_BLOCK_IO2_TOKEN *Token, IN UINTN BufferSize, OUT VOID *Buffer) |
EFI_STATUS EFIAPI | EmmcWriteBlocksEx (IN EFI_BLOCK_IO2_PROTOCOL *This, IN UINT32 MediaId, IN EFI_LBA Lba, IN OUT EFI_BLOCK_IO2_TOKEN *Token, IN UINTN BufferSize, IN VOID *Buffer) |
EFI_STATUS EFIAPI | EmmcFlushBlocksEx (IN EFI_BLOCK_IO2_PROTOCOL *This, IN OUT EFI_BLOCK_IO2_TOKEN *Token) |
EFI_STATUS EFIAPI | EmmcSecurityProtocolInOut (IN EFI_STORAGE_SECURITY_COMMAND_PROTOCOL *This, IN UINT32 MediaId, IN UINT64 Timeout, IN UINT8 SecurityProtocolId, IN UINT16 SecurityProtocolSpecificData, IN UINTN PayloadBufferSize, OUT VOID *PayloadBuffer, OUT UINTN *PayloadTransferSize, IN BOOLEAN IsRead) |
EFI_STATUS EFIAPI | EmmcSecurityProtocolIn (IN EFI_STORAGE_SECURITY_COMMAND_PROTOCOL *This, IN UINT32 MediaId, IN UINT64 Timeout, IN UINT8 SecurityProtocolId, IN UINT16 SecurityProtocolSpecificData, IN UINTN PayloadBufferSize, OUT VOID *PayloadBuffer, OUT UINTN *PayloadTransferSize) |
EFI_STATUS EFIAPI | EmmcSecurityProtocolOut (IN EFI_STORAGE_SECURITY_COMMAND_PROTOCOL *This, IN UINT32 MediaId, IN UINT64 Timeout, IN UINT8 SecurityProtocolId, IN UINT16 SecurityProtocolSpecificData, IN UINTN PayloadBufferSize, IN VOID *PayloadBuffer) |
EFI_STATUS | EmmcEraseBlockStart (IN EMMC_PARTITION *Partition, IN EFI_LBA StartLba, IN EFI_BLOCK_IO2_TOKEN *Token, IN BOOLEAN IsEnd) |
EFI_STATUS | EmmcEraseBlockEnd (IN EMMC_PARTITION *Partition, IN EFI_LBA EndLba, IN EFI_BLOCK_IO2_TOKEN *Token, IN BOOLEAN IsEnd) |
EFI_STATUS | EmmcEraseBlock (IN EMMC_PARTITION *Partition, IN EFI_BLOCK_IO2_TOKEN *Token, IN BOOLEAN IsEnd) |
EFI_STATUS | EmmcWriteZeros (IN EMMC_PARTITION *Partition, IN EFI_LBA StartLba, IN UINTN Size) |
EFI_STATUS EFIAPI | EmmcEraseBlocks (IN EFI_ERASE_BLOCK_PROTOCOL *This, IN UINT32 MediaId, IN EFI_LBA Lba, IN OUT EFI_ERASE_BLOCK_TOKEN *Token, IN UINTN Size) |
The helper functions for BlockIo and BlockIo2 protocol.
Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file EmmcBlockIo.c.
Nonblocking I/O callback function when the event is signaled.
[in] | Event | The Event this notify function registered to. |
[in] | Context | Pointer to the context data registered to the Event. |
Definition at line 21 of file EmmcBlockIo.c.
EFI_STATUS EmmcEraseBlock | ( | IN EMMC_PARTITION * | Partition, |
IN EFI_BLOCK_IO2_TOKEN * | Token, | ||
IN BOOLEAN | IsEnd | ||
) |
Erase specified blocks through sync or async I/O request.
[in] | Partition | A pointer to the EMMC_PARTITION instance. |
[in] | Token | A pointer to the token associated with the transaction. |
[in] | IsEnd | A boolean to show whether it's the last cmd in a series of cmds. This parameter is only meaningful in async I/O request. |
EFI_SUCCESS | The request is executed successfully. |
EFI_OUT_OF_RESOURCES | The request could not be executed due to a lack of resources. |
Others | The request could not be executed successfully. |
Definition at line 1850 of file EmmcBlockIo.c.
EFI_STATUS EmmcEraseBlockEnd | ( | IN EMMC_PARTITION * | Partition, |
IN EFI_LBA | EndLba, | ||
IN EFI_BLOCK_IO2_TOKEN * | Token, | ||
IN BOOLEAN | IsEnd | ||
) |
Set the erase end address through sync or async I/O request.
[in] | Partition | A pointer to the EMMC_PARTITION instance. |
[in] | EndLba | The ending logical block address to be erased. |
[in] | Token | A pointer to the token associated with the transaction. |
[in] | IsEnd | A boolean to show whether it's the last cmd in a series of cmds. This parameter is only meaningful in async I/O request. |
EFI_SUCCESS | The request is executed successfully. |
EFI_OUT_OF_RESOURCES | The request could not be executed due to a lack of resources. |
Others | The request could not be executed successfully. |
Definition at line 1743 of file EmmcBlockIo.c.
EFI_STATUS EFIAPI EmmcEraseBlocks | ( | IN EFI_ERASE_BLOCK_PROTOCOL * | This, |
IN UINT32 | MediaId, | ||
IN EFI_LBA | Lba, | ||
IN OUT EFI_ERASE_BLOCK_TOKEN * | Token, | ||
IN UINTN | Size | ||
) |
Erase a specified number of device blocks.
[in] | This | Indicates a pointer to the calling context. |
[in] | MediaId | The media ID that the erase request is for. |
[in] | Lba | The starting logical block address to be erased. The caller is responsible for erasing only legitimate locations. |
[in,out] | Token | A pointer to the token associated with the transaction. |
[in] | Size | The size in bytes to be erased. This must be a multiple of the physical block size of the device. |
EFI_SUCCESS | The erase request was queued if Event is not NULL. The data was erased correctly to the device if the Event is NULL.to the device. |
EFI_WRITE_PROTECTED | The device cannot be erased due to write protection. |
EFI_DEVICE_ERROR | The device reported an error while attempting to perform the erase operation. |
EFI_INVALID_PARAMETER | The erase request contains LBAs that are not valid. |
EFI_NO_MEDIA | There is no media in the device. |
EFI_MEDIA_CHANGED | The MediaId is not for the current media. |
Definition at line 2010 of file EmmcBlockIo.c.
EFI_STATUS EmmcEraseBlockStart | ( | IN EMMC_PARTITION * | Partition, |
IN EFI_LBA | StartLba, | ||
IN EFI_BLOCK_IO2_TOKEN * | Token, | ||
IN BOOLEAN | IsEnd | ||
) |
Set the erase start address through sync or async I/O request.
[in] | Partition | A pointer to the EMMC_PARTITION instance. |
[in] | StartLba | The starting logical block address to be erased. |
[in] | Token | A pointer to the token associated with the transaction. |
[in] | IsEnd | A boolean to show whether it's the last cmd in a series of cmds. This parameter is only meaningful in async I/O request. |
EFI_SUCCESS | The request is executed successfully. |
EFI_OUT_OF_RESOURCES | The request could not be executed due to a lack of resources. |
Others | The request could not be executed successfully. |
Definition at line 1635 of file EmmcBlockIo.c.
EFI_STATUS EFIAPI EmmcFlushBlocks | ( | IN EFI_BLOCK_IO_PROTOCOL * | This | ) |
Flush the Block Device.
This | Indicates a pointer to the calling context. |
EFI_SUCCESS | All outstanding data was written to the device |
EFI_DEVICE_ERROR | The device reported an error while writing back the data |
EFI_NO_MEDIA | There is no media in the device. |
Definition at line 1053 of file EmmcBlockIo.c.
EFI_STATUS EFIAPI EmmcFlushBlocksEx | ( | IN EFI_BLOCK_IO2_PROTOCOL * | This, |
IN OUT EFI_BLOCK_IO2_TOKEN * | Token | ||
) |
Flush the Block Device.
[in] | This | Indicates a pointer to the calling context. |
[in,out] | Token | A pointer to the token associated with the transaction. |
EFI_SUCCESS | All outstanding data was written to the device |
EFI_DEVICE_ERROR | The device reported an error while writing back the data |
EFI_NO_MEDIA | There is no media in the device. |
Definition at line 1215 of file EmmcBlockIo.c.
EFI_STATUS EmmcGetCid | ( | IN EMMC_DEVICE * | Device, |
IN UINT16 | Rca, | ||
OUT EMMC_CID * | Cid | ||
) |
Send command SEND_CID to the device to get the CID register data.
[in] | Device | A pointer to the EMMC_DEVICE instance. |
[in] | Rca | The relative device address to use. |
[out] | Cid | The buffer to store the EMMC_CID register data. |
EFI_SUCCESS | The request is executed successfully. |
EFI_OUT_OF_RESOURCES | The request could not be executed due to a lack of resources. |
Others | The request could not be executed successfully. |
Definition at line 213 of file EmmcBlockIo.c.
EFI_STATUS EmmcGetCsd | ( | IN EMMC_DEVICE * | Device, |
IN UINT16 | Rca, | ||
OUT EMMC_CSD * | Csd | ||
) |
Send command SEND_CSD to the device to get the CSD register data.
[in] | Device | A pointer to the EMMC_DEVICE instance. |
[in] | Rca | The relative device address to use. |
[out] | Csd | The buffer to store the EMMC_CSD register data. |
EFI_SUCCESS | The request is executed successfully. |
EFI_OUT_OF_RESOURCES | The request could not be executed due to a lack of resources. |
Others | The request could not be executed successfully. |
Definition at line 161 of file EmmcBlockIo.c.
EFI_STATUS EmmcGetExtCsd | ( | IN EMMC_DEVICE * | Device, |
OUT EMMC_EXT_CSD * | ExtCsd | ||
) |
Send command SEND_EXT_CSD to the device to get the EXT_CSD register data.
[in] | Device | A pointer to the EMMC_DEVICE instance. |
[out] | ExtCsd | The buffer to store the EXT_CSD register data. |
EFI_SUCCESS | The request is executed successfully. |
EFI_OUT_OF_RESOURCES | The request could not be executed due to a lack of resources. |
Others | The request could not be executed successfully. |
Definition at line 264 of file EmmcBlockIo.c.
EFI_STATUS EmmcProtocolInOut | ( | IN EMMC_PARTITION * | Partition, |
IN UINT8 | SecurityProtocol, | ||
IN UINT16 | SecurityProtocolSpecificData, | ||
IN UINTN | PayloadBufferSize, | ||
OUT VOID * | PayloadBuffer, | ||
IN BOOLEAN | IsRead, | ||
IN UINT64 | Timeout, | ||
IN EFI_BLOCK_IO2_TOKEN * | Token, | ||
IN BOOLEAN | IsEnd | ||
) |
Read blocks through security protocol cmds with the way of sync or async I/O request.
[in] | Partition | A pointer to the EMMC_PARTITION instance. |
[in] | SecurityProtocolId | The value of the "Security Protocol" parameter of the security protocol command to be sent. |
[in] | SecurityProtocolSpecificData | The value of the "Security Protocol Specific" parameter of the security protocol command to be sent. |
[in] | PayloadBufferSize | Size in bytes of the payload data buffer. |
[out] | PayloadBuffer | A pointer to a destination buffer to store the security protocol command specific payload data for the security protocol command. The caller is responsible for having either implicit or explicit ownership of the buffer. |
[in] | IsRead | Indicates it is a read or write operation. |
[in] | Timeout | The timeout value, in 100ns units. |
[in] | Token | A pointer to the token associated with the transaction. |
[in] | IsEnd | A boolean to show whether it's the last cmd in a series of cmds. This parameter is only meaningful in async I/O request. |
EFI_SUCCESS | The request is executed successfully. |
EFI_OUT_OF_RESOURCES | The request could not be executed due to a lack of resources. |
Others | The request could not be executed successfully. |
Definition at line 535 of file EmmcBlockIo.c.
EFI_STATUS EFIAPI EmmcReadBlocks | ( | IN EFI_BLOCK_IO_PROTOCOL * | This, |
IN UINT32 | MediaId, | ||
IN EFI_LBA | Lba, | ||
IN UINTN | BufferSize, | ||
OUT VOID * | Buffer | ||
) |
Read BufferSize bytes from Lba into Buffer.
This | Indicates a pointer to the calling context. |
MediaId | Id of the media, changes every time the media is replaced. |
Lba | The starting Logical Block Address to read from |
BufferSize | Size of Buffer, must be a multiple of device block size. |
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 performing the read. |
EFI_NO_MEDIA | There is no media in the device. |
EFI_MEDIA_CHANGED | The MediaId does not match the current device. |
EFI_BAD_BUFFER_SIZE | The Buffer was not a multiple of the 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 985 of file EmmcBlockIo.c.
EFI_STATUS EFIAPI EmmcReadBlocksEx | ( | IN EFI_BLOCK_IO2_PROTOCOL * | This, |
IN UINT32 | MediaId, | ||
IN EFI_LBA | Lba, | ||
IN OUT EFI_BLOCK_IO2_TOKEN * | Token, | ||
IN UINTN | BufferSize, | ||
OUT VOID * | Buffer | ||
) |
Read BufferSize bytes from Lba into Buffer.
[in] | This | Indicates a pointer to the calling context. |
[in] | MediaId | Id of the media, changes every time the media is replaced. |
[in] | Lba | The starting Logical Block Address to read from. |
[in,out] | Token | A pointer to the token associated with the transaction. |
[in] | BufferSize | Size of Buffer, must be a multiple of device block size. |
[out] | 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 read request was queued if Event is not NULL. The data was read correctly from the device if the Event is NULL. |
EFI_DEVICE_ERROR | The device reported an error while performing the read. |
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. |
EFI_OUT_OF_RESOURCES | The request could not be completed due to a lack of resources. |
Definition at line 1142 of file EmmcBlockIo.c.
EFI_STATUS EmmcReadWrite | ( | IN EMMC_PARTITION * | Partition, |
IN UINT32 | MediaId, | ||
IN EFI_LBA | Lba, | ||
IN OUT VOID * | Buffer, | ||
IN UINTN | BufferSize, | ||
IN BOOLEAN | IsRead, | ||
IN OUT EFI_BLOCK_IO2_TOKEN * | Token | ||
) |
This function transfers data from/to EMMC device.
[in] | Partition | A pointer to the EMMC_PARTITION instance. |
[in] | MediaId | The media ID that the read/write request is for. |
[in] | Lba | The starting logical block address to be read/written. The caller is responsible for reading/writing to only legitimate locations. |
[in,out] | Buffer | A pointer to the destination/source buffer for the data. |
[in] | BufferSize | Size of Buffer, must be a multiple of device block size. |
[in] | IsRead | Indicates it is a read or write operation. |
[in,out] | Token | A pointer to the token associated with the transaction. |
EFI_SUCCESS | The data was read/written correctly to the device. |
EFI_WRITE_PROTECTED | The device can not be read/written to. |
EFI_DEVICE_ERROR | The device reported an error while performing the read/write. |
EFI_NO_MEDIA | There is no media in the device. |
EFI_MEDIA_CHANGED | The MediaId does not match the current device. |
EFI_BAD_BUFFER_SIZE | The Buffer was not a multiple of the block size of the device. |
EFI_INVALID_PARAMETER | The read/write request contains LBAs that are not valid, or the buffer is not on proper alignment. |
Definition at line 803 of file EmmcBlockIo.c.
EFI_STATUS EFIAPI EmmcReset | ( | IN EFI_BLOCK_IO_PROTOCOL * | This, |
IN BOOLEAN | ExtendedVerification | ||
) |
Reset the Block Device.
This | Indicates a pointer to the calling context. |
ExtendedVerification | Driver may perform diagnostics on reset. |
EFI_SUCCESS | The device was reset. |
EFI_DEVICE_ERROR | The device is not functioning properly and could not be reset. |
Definition at line 944 of file EmmcBlockIo.c.
EFI_STATUS EFIAPI EmmcResetEx | ( | IN EFI_BLOCK_IO2_PROTOCOL * | This, |
IN BOOLEAN | ExtendedVerification | ||
) |
Reset the Block Device.
[in] | This | Indicates a pointer to the calling context. |
[in] | ExtendedVerification | Driver may perform diagnostics on reset. |
EFI_SUCCESS | The device was reset. |
EFI_DEVICE_ERROR | The device is not functioning properly and could not be reset. |
Definition at line 1076 of file EmmcBlockIo.c.
EFI_STATUS EmmcRwMultiBlocks | ( | IN EMMC_PARTITION * | Partition, |
IN EFI_LBA | Lba, | ||
IN VOID * | Buffer, | ||
IN UINTN | BufferSize, | ||
IN BOOLEAN | IsRead, | ||
IN EFI_BLOCK_IO2_TOKEN * | Token, | ||
IN BOOLEAN | IsEnd | ||
) |
Read/write multiple blocks through sync or async I/O request.
[in] | Partition | A pointer to the EMMC_PARTITION instance. |
[in] | Lba | The starting logical block address to be read/written. The caller is responsible for reading/writing to only legitimate locations. |
[in] | Buffer | A pointer to the destination/source buffer for the data. |
[in] | BufferSize | Size of Buffer, must be a multiple of device block size. |
[in] | IsRead | Indicates it is a read or write operation. |
[in] | Token | A pointer to the token associated with the transaction. |
[in] | IsEnd | A boolean to show whether it's the last cmd in a series of cmds. This parameter is only meaningful in async I/O request. |
EFI_SUCCESS | The request is executed successfully. |
EFI_OUT_OF_RESOURCES | The request could not be executed due to a lack of resources. |
Others | The request could not be executed successfully. |
Definition at line 664 of file EmmcBlockIo.c.
EFI_STATUS EFIAPI EmmcSecurityProtocolIn | ( | IN EFI_STORAGE_SECURITY_COMMAND_PROTOCOL * | This, |
IN UINT32 | MediaId, | ||
IN UINT64 | Timeout, | ||
IN UINT8 | SecurityProtocolId, | ||
IN UINT16 | SecurityProtocolSpecificData, | ||
IN UINTN | PayloadBufferSize, | ||
OUT VOID * | PayloadBuffer, | ||
OUT UINTN * | PayloadTransferSize | ||
) |
Send a security protocol command to a device that receives data and/or the result of one or more commands sent by SendData.
The ReceiveData function sends a security protocol command to the given MediaId. The security protocol command sent is defined by SecurityProtocolId and contains the security protocol specific data SecurityProtocolSpecificData. The function returns the data from the security protocol command in PayloadBuffer.
For devices supporting the SCSI command set, the security protocol command is sent using the SECURITY PROTOCOL IN command defined in SPC-4.
For devices supporting the ATA command set, the security protocol command is sent using one of the TRUSTED RECEIVE commands defined in ATA8-ACS if PayloadBufferSize is non-zero.
If the PayloadBufferSize is zero, the security protocol command is sent using the Trusted Non-Data command defined in ATA8-ACS.
If PayloadBufferSize is too small to store the available data from the security protocol command, the function shall copy PayloadBufferSize bytes into the PayloadBuffer and return EFI_WARN_BUFFER_TOO_SMALL.
If PayloadBuffer or PayloadTransferSize is NULL and PayloadBufferSize is non-zero, the function shall return EFI_INVALID_PARAMETER.
If the given MediaId does not support security protocol commands, the function shall return EFI_UNSUPPORTED. If there is no media in the device, the function returns EFI_NO_MEDIA. If the MediaId is not the ID for the current media in the device, the function returns EFI_MEDIA_CHANGED.
If the security protocol fails to complete within the Timeout period, the function shall return EFI_TIMEOUT.
If the security protocol command completes without an error, the function shall return EFI_SUCCESS. If the security protocol command completes with an error, the function shall return EFI_DEVICE_ERROR.
This | Indicates a pointer to the calling context. |
MediaId | ID of the medium to receive data from. If there is no block IO protocol supported by the physical device, the value of MediaId is undefined. |
Timeout | The timeout, in 100ns units, to use for the execution of the security protocol command. A Timeout value of 0 means that this function will wait indefinitely for the security protocol command to execute. If Timeout is greater than zero, then this function will return EFI_TIMEOUT if the time required to execute the receive data command is greater than Timeout. |
SecurityProtocolId | The value of the "Security Protocol" parameter of the security protocol command to be sent. |
SecurityProtocolSpecificData | The value of the "Security Protocol Specific" parameter of the security protocol command to be sent. |
PayloadBufferSize | Size in bytes of the payload data buffer. |
PayloadBuffer | A pointer to a destination buffer to store the security protocol command specific payload data for the security protocol command. The caller is responsible for having either implicit or explicit ownership of the buffer. |
PayloadTransferSize | A pointer to a buffer to store the size in bytes of the data written to the payload data buffer. |
EFI_SUCCESS | The security protocol command completed successfully. |
EFI_WARN_BUFFER_TOO_SMALL | The PayloadBufferSize was too small to store the available data from the device. The PayloadBuffer contains the truncated data. |
EFI_UNSUPPORTED | The given MediaId does not support security protocol commands. |
EFI_DEVICE_ERROR | The security protocol command completed with an error. |
EFI_NO_MEDIA | There is no media in the device. |
EFI_MEDIA_CHANGED | The MediaId is not for the current media. |
EFI_INVALID_PARAMETER | The PayloadBuffer or PayloadTransferSize is NULL and PayloadBufferSize is non-zero. |
EFI_TIMEOUT | A timeout occurred while waiting for the security protocol command to execute. |
Definition at line 1496 of file EmmcBlockIo.c.
EFI_STATUS EFIAPI EmmcSecurityProtocolInOut | ( | IN EFI_STORAGE_SECURITY_COMMAND_PROTOCOL * | This, |
IN UINT32 | MediaId, | ||
IN UINT64 | Timeout, | ||
IN UINT8 | SecurityProtocolId, | ||
IN UINT16 | SecurityProtocolSpecificData, | ||
IN UINTN | PayloadBufferSize, | ||
OUT VOID * | PayloadBuffer, | ||
OUT UINTN * | PayloadTransferSize, | ||
IN BOOLEAN | IsRead | ||
) |
Send a security protocol command to a device that receives data and/or the result of one or more commands sent by SendData.
The ReceiveData function sends a security protocol command to the given MediaId. The security protocol command sent is defined by SecurityProtocolId and contains the security protocol specific data SecurityProtocolSpecificData. The function returns the data from the security protocol command in PayloadBuffer.
For devices supporting the SCSI command set, the security protocol command is sent using the SECURITY PROTOCOL IN command defined in SPC-4.
For devices supporting the ATA command set, the security protocol command is sent using one of the TRUSTED RECEIVE commands defined in ATA8-ACS if PayloadBufferSize is non-zero.
If the PayloadBufferSize is zero, the security protocol command is sent using the Trusted Non-Data command defined in ATA8-ACS.
If PayloadBufferSize is too small to store the available data from the security protocol command, the function shall copy PayloadBufferSize bytes into the PayloadBuffer and return EFI_WARN_BUFFER_TOO_SMALL.
If PayloadBuffer or PayloadTransferSize is NULL and PayloadBufferSize is non-zero, the function shall return EFI_INVALID_PARAMETER.
If the given MediaId does not support security protocol commands, the function shall return EFI_UNSUPPORTED. If there is no media in the device, the function returns EFI_NO_MEDIA. If the MediaId is not the ID for the current media in the device, the function returns EFI_MEDIA_CHANGED.
If the security protocol fails to complete within the Timeout period, the function shall return EFI_TIMEOUT.
If the security protocol command completes without an error, the function shall return EFI_SUCCESS. If the security protocol command completes with an error, the function shall return EFI_DEVICE_ERROR.
[in] | This | Indicates a pointer to the calling context. |
[in] | MediaId | ID of the medium to receive data from. If there is no block IO protocol supported by the physical device, the value of MediaId is undefined. |
[in] | Timeout | The timeout, in 100ns units, to use for the execution of the security protocol command. A Timeout value of 0 means that this function will wait indefinitely for the security protocol command to execute. If Timeout is greater than zero, then this function will return EFI_TIMEOUT if the time required to execute the receive data command is greater than Timeout. |
[in] | SecurityProtocolId | The value of the "Security Protocol" parameter of the security protocol command to be sent. |
[in] | SecurityProtocolSpecificData | The value of the "Security Protocol Specific" parameter of the security protocol command to be sent. |
[in] | PayloadBufferSize | Size in bytes of the payload data buffer. |
[out] | PayloadBuffer | A pointer to a destination buffer to store the security protocol command specific payload data for the security protocol command. The caller is responsible for having either implicit or explicit ownership of the buffer. |
[out] | PayloadTransferSize | A pointer to a buffer to store the size in bytes of the data written to the payload data buffer. |
[in] | IsRead | Indicates it is a read or write operation. |
EFI_SUCCESS | The security protocol command completed successfully. |
EFI_WARN_BUFFER_TOO_SMALL | The PayloadBufferSize was too small to store the available data from the device. The PayloadBuffer contains the truncated data. |
EFI_UNSUPPORTED | The given MediaId does not support security protocol commands. |
EFI_DEVICE_ERROR | The security protocol command completed with an error. |
EFI_NO_MEDIA | There is no media in the device. |
EFI_MEDIA_CHANGED | The MediaId is not for the current media. |
EFI_INVALID_PARAMETER | The PayloadBuffer or PayloadTransferSize is NULL and PayloadBufferSize is non-zero. |
EFI_TIMEOUT | A timeout occurred while waiting for the security protocol command to execute. |
Definition at line 1308 of file EmmcBlockIo.c.
EFI_STATUS EFIAPI EmmcSecurityProtocolOut | ( | IN EFI_STORAGE_SECURITY_COMMAND_PROTOCOL * | This, |
IN UINT32 | MediaId, | ||
IN UINT64 | Timeout, | ||
IN UINT8 | SecurityProtocolId, | ||
IN UINT16 | SecurityProtocolSpecificData, | ||
IN UINTN | PayloadBufferSize, | ||
IN VOID * | PayloadBuffer | ||
) |
Send a security protocol command to a device.
The SendData function sends a security protocol command containing the payload PayloadBuffer to the given MediaId. The security protocol command sent is defined by SecurityProtocolId and contains the security protocol specific data SecurityProtocolSpecificData. If the underlying protocol command requires a specific padding for the command payload, the SendData function shall add padding bytes to the command payload to satisfy the padding requirements.
For devices supporting the SCSI command set, the security protocol command is sent using the SECURITY PROTOCOL OUT command defined in SPC-4.
For devices supporting the ATA command set, the security protocol command is sent using one of the TRUSTED SEND commands defined in ATA8-ACS if PayloadBufferSize is non-zero. If the PayloadBufferSize is zero, the security protocol command is sent using the Trusted Non-Data command defined in ATA8-ACS.
If PayloadBuffer is NULL and PayloadBufferSize is non-zero, the function shall return EFI_INVALID_PARAMETER.
If the given MediaId does not support security protocol commands, the function shall return EFI_UNSUPPORTED. If there is no media in the device, the function returns EFI_NO_MEDIA. If the MediaId is not the ID for the current media in the device, the function returns EFI_MEDIA_CHANGED.
If the security protocol fails to complete within the Timeout period, the function shall return EFI_TIMEOUT.
If the security protocol command completes without an error, the function shall return EFI_SUCCESS. If the security protocol command completes with an error, the function shall return EFI_DEVICE_ERROR.
This | Indicates a pointer to the calling context. |
MediaId | ID of the medium to receive data from. If there is no block IO protocol supported by the physical device, the value of MediaId is undefined. |
Timeout | The timeout, in 100ns units, to use for the execution of the security protocol command. A Timeout value of 0 means that this function will wait indefinitely for the security protocol command to execute. If Timeout is greater than zero, then this function will return EFI_TIMEOUT if the time required to execute the receive data command is greater than Timeout. |
SecurityProtocolId | The value of the "Security Protocol" parameter of the security protocol command to be sent. |
SecurityProtocolSpecificData | The value of the "Security Protocol Specific" parameter of the security protocol command to be sent. |
PayloadBufferSize | Size in bytes of the payload data buffer. |
PayloadBuffer | A pointer to a destination buffer to store the security protocol command specific payload data for the security protocol command. |
EFI_SUCCESS | The security protocol command completed successfully. |
EFI_UNSUPPORTED | The given MediaId does not support security protocol commands. |
EFI_DEVICE_ERROR | The security protocol command completed with an error. |
EFI_NO_MEDIA | There is no media in the device. |
EFI_MEDIA_CHANGED | The MediaId is not for the current media. |
EFI_INVALID_PARAMETER | The PayloadBuffer is NULL and PayloadBufferSize is non-zero. |
EFI_TIMEOUT | A timeout occurred while waiting for the security protocol command to execute. |
Definition at line 1593 of file EmmcBlockIo.c.
EFI_STATUS EmmcSelect | ( | IN EMMC_DEVICE * | Device, |
IN UINT16 | Rca | ||
) |
Send command SELECT to the device to select/deselect the device.
[in] | Device | A pointer to the EMMC_DEVICE instance. |
[in] | Rca | The relative device address to use. |
EFI_SUCCESS | The request is executed successfully. |
EFI_OUT_OF_RESOURCES | The request could not be executed due to a lack of resources. |
Others | The request could not be executed successfully. |
Definition at line 71 of file EmmcBlockIo.c.
EFI_STATUS EmmcSendStatus | ( | IN EMMC_DEVICE * | Device, |
IN UINT16 | Rca, | ||
OUT UINT32 * | DevStatus | ||
) |
Send command SEND_STATUS to the device to get device status.
[in] | Device | A pointer to the EMMC_DEVICE instance. |
[in] | Rca | The relative device address to use. |
[out] | DevStatus | The buffer to store the device status. |
EFI_SUCCESS | The request is executed successfully. |
EFI_OUT_OF_RESOURCES | The request could not be executed due to a lack of resources. |
Others | The request could not be executed successfully. |
Definition at line 114 of file EmmcBlockIo.c.
EFI_STATUS EmmcSetBlkCount | ( | IN EMMC_PARTITION * | Partition, |
IN UINT16 | BlockNum, | ||
IN EFI_BLOCK_IO2_TOKEN * | Token, | ||
IN BOOLEAN | IsEnd | ||
) |
Set the number of blocks for a block read/write cmd through sync or async I/O request.
[in] | Partition | A pointer to the EMMC_PARTITION instance. |
[in] | BlockNum | The number of blocks for transfer. |
[in] | Token | A pointer to the token associated with the transaction. |
[in] | IsEnd | A boolean to show whether it's the last cmd in a series of cmds. This parameter is only meaningful in async I/O request. |
EFI_SUCCESS | The request is executed successfully. |
EFI_OUT_OF_RESOURCES | The request could not be executed due to a lack of resources. |
Others | The request could not be executed successfully. |
Definition at line 422 of file EmmcBlockIo.c.
EFI_STATUS EmmcSetExtCsd | ( | IN EMMC_PARTITION * | Partition, |
IN UINT8 | Offset, | ||
IN UINT8 | Value, | ||
IN EFI_BLOCK_IO2_TOKEN * | Token, | ||
IN BOOLEAN | IsEnd | ||
) |
Set the specified EXT_CSD register field through sync or async I/O request.
[in] | Partition | A pointer to the EMMC_PARTITION instance. |
[in] | Offset | The offset of the specified field in EXT_CSD register. |
[in] | Value | The byte value written to the field specified by Offset. |
[in] | Token | A pointer to the token associated with the transaction. |
[in] | IsEnd | A boolean to show whether it's the last cmd in a series of cmds. This parameter is only meaningful in async I/O request. |
EFI_SUCCESS | The request is executed successfully. |
EFI_OUT_OF_RESOURCES | The request could not be executed due to a lack of resources. |
Others | The request could not be executed successfully. |
Definition at line 313 of file EmmcBlockIo.c.
EFI_STATUS EFIAPI EmmcWriteBlocks | ( | IN EFI_BLOCK_IO_PROTOCOL * | This, |
IN UINT32 | MediaId, | ||
IN EFI_LBA | Lba, | ||
IN UINTN | BufferSize, | ||
IN VOID * | Buffer | ||
) |
Write BufferSize bytes from Lba into Buffer.
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. The caller is responsible for writing to only legitimate locations. |
BufferSize | Size of Buffer, must be a multiple of device block size. |
Buffer | A pointer to the source buffer for the data. |
EFI_SUCCESS | The data was written correctly to the device. |
EFI_WRITE_PROTECTED | The device can not be written to. |
EFI_DEVICE_ERROR | The device reported an error while performing the write. |
EFI_NO_MEDIA | There is no media in the device. |
EFI_MEDIA_CHANGED | The MediaId does not match the current device. |
EFI_BAD_BUFFER_SIZE | The Buffer was not a multiple of the 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 1024 of file EmmcBlockIo.c.
EFI_STATUS EFIAPI EmmcWriteBlocksEx | ( | IN EFI_BLOCK_IO2_PROTOCOL * | This, |
IN UINT32 | MediaId, | ||
IN EFI_LBA | Lba, | ||
IN OUT EFI_BLOCK_IO2_TOKEN * | Token, | ||
IN UINTN | BufferSize, | ||
IN VOID * | Buffer | ||
) |
Write BufferSize bytes from Lba into Buffer.
[in] | This | Indicates a pointer to the calling context. |
[in] | MediaId | The media ID that the write request is for. |
[in] | Lba | The starting logical block address to be written. The caller is responsible for writing to only legitimate locations. |
[in,out] | Token | A pointer to the token associated with the transaction. |
[in] | BufferSize | Size of Buffer, must be a multiple of device block size. |
[in] | Buffer | A pointer to the source buffer for the data. |
EFI_SUCCESS | The data was written correctly to the device. |
EFI_WRITE_PROTECTED | The device can not be written to. |
EFI_DEVICE_ERROR | The device reported an error while performing the write. |
EFI_NO_MEDIA | There is no media in the device. |
EFI_MEDIA_CHANGED | The MediaId does not match the current device. |
EFI_BAD_BUFFER_SIZE | The Buffer was not a multiple of the 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 1184 of file EmmcBlockIo.c.
EFI_STATUS EmmcWriteZeros | ( | IN EMMC_PARTITION * | Partition, |
IN EFI_LBA | StartLba, | ||
IN UINTN | Size | ||
) |
Write zeros to specified blocks.
[in] | Partition | A pointer to the EMMC_PARTITION instance. |
[in] | StartLba | The starting logical block address to write zeros. |
[in] | Size | The size in bytes to fill with zeros. This must be a multiple of the physical block size of the device. |
EFI_SUCCESS | The request is executed successfully. |
EFI_OUT_OF_RESOURCES | The request could not be executed due to a lack of resources. |
Others | The request could not be executed successfully. |
Definition at line 1958 of file EmmcBlockIo.c.