TianoCore EDK2 master
Loading...
Searching...
No Matches
NvmExpressBlockIo.c File Reference
#include "NvmExpress.h"

Go to the source code of this file.

Functions

EFI_STATUS ReadSectors (IN NVME_DEVICE_PRIVATE_DATA *Device, IN UINT64 Buffer, IN UINT64 Lba, IN UINT32 Blocks)
 
EFI_STATUS WriteSectors (IN NVME_DEVICE_PRIVATE_DATA *Device, IN UINT64 Buffer, IN UINT64 Lba, IN UINT32 Blocks)
 
EFI_STATUS NvmeRead (IN NVME_DEVICE_PRIVATE_DATA *Device, OUT VOID *Buffer, IN UINT64 Lba, IN UINTN Blocks)
 
EFI_STATUS NvmeWrite (IN NVME_DEVICE_PRIVATE_DATA *Device, IN VOID *Buffer, IN UINT64 Lba, IN UINTN Blocks)
 
EFI_STATUS NvmeFlush (IN NVME_DEVICE_PRIVATE_DATA *Device)
 
VOID EFIAPI AsyncIoCallback (IN EFI_EVENT Event, IN VOID *Context)
 
EFI_STATUS AsyncReadSectors (IN NVME_DEVICE_PRIVATE_DATA *Device, IN NVME_BLKIO2_REQUEST *Request, IN UINT64 Buffer, IN UINT64 Lba, IN UINT32 Blocks, IN BOOLEAN IsLast)
 
EFI_STATUS AsyncWriteSectors (IN NVME_DEVICE_PRIVATE_DATA *Device, IN NVME_BLKIO2_REQUEST *Request, IN UINT64 Buffer, IN UINT64 Lba, IN UINT32 Blocks, IN BOOLEAN IsLast)
 
EFI_STATUS NvmeAsyncRead (IN NVME_DEVICE_PRIVATE_DATA *Device, OUT VOID *Buffer, IN UINT64 Lba, IN UINTN Blocks, IN EFI_BLOCK_IO2_TOKEN *Token)
 
EFI_STATUS NvmeAsyncWrite (IN NVME_DEVICE_PRIVATE_DATA *Device, IN VOID *Buffer, IN UINT64 Lba, IN UINTN Blocks, IN EFI_BLOCK_IO2_TOKEN *Token)
 
EFI_STATUS EFIAPI NvmeBlockIoReset (IN EFI_BLOCK_IO_PROTOCOL *This, IN BOOLEAN ExtendedVerification)
 
EFI_STATUS EFIAPI NvmeBlockIoReadBlocks (IN EFI_BLOCK_IO_PROTOCOL *This, IN UINT32 MediaId, IN EFI_LBA Lba, IN UINTN BufferSize, OUT VOID *Buffer)
 
EFI_STATUS EFIAPI NvmeBlockIoWriteBlocks (IN EFI_BLOCK_IO_PROTOCOL *This, IN UINT32 MediaId, IN EFI_LBA Lba, IN UINTN BufferSize, IN VOID *Buffer)
 
EFI_STATUS EFIAPI NvmeBlockIoFlushBlocks (IN EFI_BLOCK_IO_PROTOCOL *This)
 
EFI_STATUS EFIAPI NvmeBlockIoResetEx (IN EFI_BLOCK_IO2_PROTOCOL *This, IN BOOLEAN ExtendedVerification)
 
EFI_STATUS EFIAPI NvmeBlockIoReadBlocksEx (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 NvmeBlockIoWriteBlocksEx (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 NvmeBlockIoFlushBlocksEx (IN EFI_BLOCK_IO2_PROTOCOL *This, IN OUT EFI_BLOCK_IO2_TOKEN *Token)
 
EFI_STATUS TrustTransferNvmeDevice (IN OUT NVME_CONTROLLER_PRIVATE_DATA *Private, IN OUT VOID *Buffer, IN UINT8 SecurityProtocolId, IN UINT16 SecurityProtocolSpecificData, IN UINTN TransferLength, IN BOOLEAN IsTrustSend, IN UINT64 Timeout, OUT UINTN *TransferLengthOut)
 
EFI_STATUS EFIAPI NvmeStorageSecurityReceiveData (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 NvmeStorageSecuritySendData (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)
 

Detailed Description

NvmExpressDxe driver is used to manage non-volatile memory subsystem which follows NVM Express specification.

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

Definition in file NvmExpressBlockIo.c.

Function Documentation

◆ AsyncIoCallback()

VOID EFIAPI AsyncIoCallback ( IN EFI_EVENT  Event,
IN VOID *  Context 
)

Nonblocking I/O callback funtion when the event is signaled.

Parameters
[in]EventThe Event this notify function registered to.
[in]ContextPointer to the context data registered to the Event.

Definition at line 370 of file NvmExpressBlockIo.c.

◆ AsyncReadSectors()

EFI_STATUS AsyncReadSectors ( IN NVME_DEVICE_PRIVATE_DATA Device,
IN NVME_BLKIO2_REQUEST Request,
IN UINT64  Buffer,
IN UINT64  Lba,
IN UINT32  Blocks,
IN BOOLEAN  IsLast 
)

Read some sectors from the device in an asynchronous manner.

Parameters
DeviceThe pointer to the NVME_DEVICE_PRIVATE_DATA data structure.
RequestThe pointer to the NVME_BLKIO2_REQUEST data structure.
BufferThe buffer used to store the data read from the device.
LbaThe start block number.
BlocksTotal block number to be read.
IsLastThe last subtask of an asynchronous read request.
Return values
EFI_SUCCESSAsynchronous read request has been queued.
OthersFail to send the asynchronous request.

Definition at line 440 of file NvmExpressBlockIo.c.

◆ AsyncWriteSectors()

EFI_STATUS AsyncWriteSectors ( IN NVME_DEVICE_PRIVATE_DATA Device,
IN NVME_BLKIO2_REQUEST Request,
IN UINT64  Buffer,
IN UINT64  Lba,
IN UINT32  Blocks,
IN BOOLEAN  IsLast 
)

Write some sectors from the device in an asynchronous manner.

Parameters
DeviceThe pointer to the NVME_DEVICE_PRIVATE_DATA data structure.
RequestThe pointer to the NVME_BLKIO2_REQUEST data structure.
BufferThe buffer used to store the data written to the device.
LbaThe start block number.
BlocksTotal block number to be written.
IsLastThe last subtask of an asynchronous write request.
Return values
EFI_SUCCESSAsynchronous write request has been queued.
OthersFail to send the asynchronous request.

Definition at line 579 of file NvmExpressBlockIo.c.

◆ NvmeAsyncRead()

EFI_STATUS NvmeAsyncRead ( IN NVME_DEVICE_PRIVATE_DATA Device,
OUT VOID *  Buffer,
IN UINT64  Lba,
IN UINTN  Blocks,
IN EFI_BLOCK_IO2_TOKEN Token 
)

Read some blocks from the device in an asynchronous manner.

Parameters
DeviceThe pointer to the NVME_DEVICE_PRIVATE_DATA data structure.
BufferThe buffer used to store the data read from the device.
LbaThe start block number.
BlocksTotal block number to be read.
TokenA pointer to the token associated with the transaction.
Return values
EFI_SUCCESSData are read from the device.
OthersFail to read all the data.

Definition at line 719 of file NvmExpressBlockIo.c.

◆ NvmeAsyncWrite()

EFI_STATUS NvmeAsyncWrite ( IN NVME_DEVICE_PRIVATE_DATA Device,
IN VOID *  Buffer,
IN UINT64  Lba,
IN UINTN  Blocks,
IN EFI_BLOCK_IO2_TOKEN Token 
)

Write some blocks from the device in an asynchronous manner.

Parameters
DeviceThe pointer to the NVME_DEVICE_PRIVATE_DATA data structure.
BufferThe buffer used to store the data written to the device.
LbaThe start block number.
BlocksTotal block number to be written.
TokenA pointer to the token associated with the transaction.
Return values
EFI_SUCCESSData are written to the device.
OthersFail to write all the data.

Definition at line 847 of file NvmExpressBlockIo.c.

◆ NvmeBlockIoFlushBlocks()

EFI_STATUS EFIAPI NvmeBlockIoFlushBlocks ( IN EFI_BLOCK_IO_PROTOCOL This)

Flush the Block Device.

Parameters
ThisIndicates a pointer to the calling context.
Return values
EFI_SUCCESSAll outstanding data was written to the device.
EFI_DEVICE_ERRORThe device reported an error while writing back the data.
EFI_NO_MEDIAThere is no media in the device.

Definition at line 1186 of file NvmExpressBlockIo.c.

◆ NvmeBlockIoFlushBlocksEx()

EFI_STATUS EFIAPI NvmeBlockIoFlushBlocksEx ( IN EFI_BLOCK_IO2_PROTOCOL This,
IN OUT EFI_BLOCK_IO2_TOKEN Token 
)

Flush the Block Device.

If EFI_DEVICE_ERROR, EFI_NO_MEDIA,_EFI_WRITE_PROTECTED or EFI_MEDIA_CHANGED is returned and non-blocking I/O is being used, the Event associated with this request will not be signaled.

Parameters
[in]ThisIndicates a pointer to the calling context.
[in,out]TokenA pointer to the token associated with the transaction.
Return values
EFI_SUCCESSThe flush request was queued if Event is not NULL. All outstanding data was written correctly to the device if the Event is NULL.
EFI_DEVICE_ERRORThe device reported an error while writting back the data.
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_OUT_OF_RESOURCESThe request could not be completed due to a lack of resources.

Definition at line 1525 of file NvmExpressBlockIo.c.

◆ NvmeBlockIoReadBlocks()

EFI_STATUS EFIAPI NvmeBlockIoReadBlocks ( 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.

Parameters
ThisIndicates a pointer to the calling context.
MediaIdId of the media, changes every time the media is replaced.
LbaThe starting Logical Block Address to read from.
BufferSizeSize of Buffer, must be a multiple of device block size.
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 performing the read.
EFI_NO_MEDIAThere is no media in the device.
EFI_MEDIA_CHANGEDThe MediaId does not matched the current device.
EFI_BAD_BUFFER_SIZEThe Buffer was not a multiple of the 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 1027 of file NvmExpressBlockIo.c.

◆ NvmeBlockIoReadBlocksEx()

EFI_STATUS EFIAPI NvmeBlockIoReadBlocksEx ( 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.

This function reads the requested number of blocks from the device. All the blocks are read, or an error is returned. If EFI_DEVICE_ERROR, EFI_NO_MEDIA,_or EFI_MEDIA_CHANGED is returned and non-blocking I/O is being used, the Event associated with this request will not be signaled.

Parameters
[in]ThisIndicates a pointer to the calling context.
[in]MediaIdId of the media, changes every time the media is replaced.
[in]LbaThe starting Logical Block Address to read from.
[in,out]TokenA pointer to the token associated with the transaction.
[in]BufferSizeSize of Buffer, must be a multiple of device block size.
[out]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 read request was queued if Token->Event is not NULL.The data was read correctly from the device if the Token->Event is NULL.
EFI_DEVICE_ERRORThe device reported an error while performing the read.
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.
EFI_OUT_OF_RESOURCESThe request could not be completed due to a lack of resources.

Definition at line 1313 of file NvmExpressBlockIo.c.

◆ NvmeBlockIoReset()

EFI_STATUS EFIAPI NvmeBlockIoReset ( IN EFI_BLOCK_IO_PROTOCOL This,
IN BOOLEAN  ExtendedVerification 
)

Reset the Block Device.

Parameters
ThisIndicates a pointer to the calling context.
ExtendedVerificationDriver may perform diagnostics on reset.
Return values
EFI_SUCCESSThe device was reset.
EFI_DEVICE_ERRORThe device is not functioning properly and could not be reset.

Definition at line 972 of file NvmExpressBlockIo.c.

◆ NvmeBlockIoResetEx()

EFI_STATUS EFIAPI NvmeBlockIoResetEx ( IN EFI_BLOCK_IO2_PROTOCOL This,
IN BOOLEAN  ExtendedVerification 
)

Reset the block device hardware.

Parameters
[in]ThisIndicates a pointer to the calling context.
[in]ExtendedVerificationIndicates that the driver may perform a more exhausive verfication operation of the device during reset.
Return values
EFI_SUCCESSThe device was reset.
EFI_DEVICE_ERRORThe device is not functioning properly and could not be reset.

Definition at line 1227 of file NvmExpressBlockIo.c.

◆ NvmeBlockIoWriteBlocks()

EFI_STATUS EFIAPI NvmeBlockIoWriteBlocks ( 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.

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. The caller is responsible for writing to only legitimate locations.
BufferSizeSize of Buffer, must be a multiple of device block size.
BufferA pointer to the source buffer for the data.
Return values
EFI_SUCCESSThe data was written correctly to the device.
EFI_WRITE_PROTECTEDThe device can not be written to.
EFI_DEVICE_ERRORThe device reported an error while performing the write.
EFI_NO_MEDIAThere is no media in the device.
EFI_MEDIA_CHNAGEDThe MediaId does not matched the current device.
EFI_BAD_BUFFER_SIZEThe Buffer was not a multiple of the 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 1111 of file NvmExpressBlockIo.c.

◆ NvmeBlockIoWriteBlocksEx()

EFI_STATUS EFIAPI NvmeBlockIoWriteBlocksEx ( 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.

This function writes the requested number of blocks to the device. All blocks are written, or an error is returned.If EFI_DEVICE_ERROR, EFI_NO_MEDIA, EFI_WRITE_PROTECTED or EFI_MEDIA_CHANGED is returned and non-blocking I/O is being used, the Event associated with this request will not be signaled.

Parameters
[in]ThisIndicates a pointer to the calling context.
[in]MediaIdThe media ID that the write request is for.
[in]LbaThe starting logical block address to be written. The caller is responsible for writing to only legitimate locations.
[in,out]TokenA pointer to the token associated with the transaction.
[in]BufferSizeSize of Buffer, must be a multiple of device block size.
[in]BufferA pointer to the source buffer for the data.
Return values
EFI_SUCCESSThe write request was queued if Event is not NULL. The data was written correctly to the device if the Event is NULL.
EFI_WRITE_PROTECTEDThe device can not be written to.
EFI_NO_MEDIAThere is no media in the device.
EFI_MEDIA_CHNAGEDThe MediaId does not matched the current device.
EFI_DEVICE_ERRORThe device reported an error while performing the write.
EFI_BAD_BUFFER_SIZEThe Buffer was not a multiple of the block size of the device.
EFI_INVALID_PARAMETERThe write request contains LBAs that are not valid, or the buffer is not on proper alignment.
EFI_OUT_OF_RESOURCESThe request could not be completed due to a lack of resources.

Definition at line 1426 of file NvmExpressBlockIo.c.

◆ NvmeFlush()

EFI_STATUS NvmeFlush ( IN NVME_DEVICE_PRIVATE_DATA Device)

Flushes all modified data to the device.

Parameters
DeviceThe pointer to the NVME_DEVICE_PRIVATE_DATA data structure.
Return values
EFI_SUCCESSDatum are written into the buffer.
OthersFail to write all the datum.

Definition at line 326 of file NvmExpressBlockIo.c.

◆ NvmeRead()

EFI_STATUS NvmeRead ( IN NVME_DEVICE_PRIVATE_DATA Device,
OUT VOID *  Buffer,
IN UINT64  Lba,
IN UINTN  Blocks 
)

Read some blocks from the device.

Parameters
DeviceThe pointer to the NVME_DEVICE_PRIVATE_DATA data structure.
BufferThe buffer used to store the data read from the device.
LbaThe start block number.
BlocksTotal block number to be read.
Return values
EFI_SUCCESSDatum are read from the device.
OthersFail to read all the datum.

Definition at line 157 of file NvmExpressBlockIo.c.

◆ NvmeStorageSecurityReceiveData()

EFI_STATUS EFIAPI NvmeStorageSecurityReceiveData ( 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.

Parameters
ThisIndicates a pointer to the calling context.
MediaIdID 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.
TimeoutThe 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.
SecurityProtocolIdThe value of the "Security Protocol" parameter of the security protocol command to be sent.
SecurityProtocolSpecificDataThe value of the "Security Protocol Specific" parameter of the security protocol command to be sent.
PayloadBufferSizeSize in bytes of the payload data buffer.
PayloadBufferA 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.
PayloadTransferSizeA pointer to a buffer to store the size in bytes of the data written to the payload data buffer.
Return values
EFI_SUCCESSThe security protocol command completed successfully.
EFI_WARN_BUFFER_TOO_SMALLThe PayloadBufferSize was too small to store the available data from the device. The PayloadBuffer contains the truncated data.
EFI_UNSUPPORTEDThe given MediaId does not support security protocol commands.
EFI_DEVICE_ERRORThe security protocol command completed with an error.
EFI_NO_MEDIAThere is no media in the device.
EFI_MEDIA_CHANGEDThe MediaId is not for the current media.
EFI_INVALID_PARAMETERThe PayloadBuffer or PayloadTransferSize is NULL and PayloadBufferSize is non-zero.
EFI_TIMEOUTA timeout occurred while waiting for the security protocol command to execute.

Definition at line 1739 of file NvmExpressBlockIo.c.

◆ NvmeStorageSecuritySendData()

EFI_STATUS EFIAPI NvmeStorageSecuritySendData ( 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.

Parameters
ThisIndicates a pointer to the calling context.
MediaIdID 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.
TimeoutThe 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 send data command is greater than Timeout.
SecurityProtocolIdThe value of the "Security Protocol" parameter of the security protocol command to be sent.
SecurityProtocolSpecificDataThe value of the "Security Protocol Specific" parameter of the security protocol command to be sent.
PayloadBufferSizeSize in bytes of the payload data buffer.
PayloadBufferA pointer to a destination buffer to store the security protocol command specific payload data for the security protocol command.
Return values
EFI_SUCCESSThe security protocol command completed successfully.
EFI_UNSUPPORTEDThe given MediaId does not support security protocol commands.
EFI_DEVICE_ERRORThe security protocol command completed with an error.
EFI_NO_MEDIAThere is no media in the device.
EFI_MEDIA_CHANGEDThe MediaId is not for the current media.
EFI_INVALID_PARAMETERThe PayloadBuffer is NULL and PayloadBufferSize is non-zero.
EFI_TIMEOUTA timeout occurred while waiting for the security protocol command to execute.

Definition at line 1848 of file NvmExpressBlockIo.c.

◆ NvmeWrite()

EFI_STATUS NvmeWrite ( IN NVME_DEVICE_PRIVATE_DATA Device,
IN VOID *  Buffer,
IN UINT64  Lba,
IN UINTN  Blocks 
)

Write some blocks to the device.

Parameters
DeviceThe pointer to the NVME_DEVICE_PRIVATE_DATA data structure.
BufferThe buffer to be written into the device.
LbaThe start block number.
BlocksTotal block number to be written.
Return values
EFI_SUCCESSDatum are written into the buffer.
OthersFail to write all the datum.

Definition at line 243 of file NvmExpressBlockIo.c.

◆ ReadSectors()

EFI_STATUS ReadSectors ( IN NVME_DEVICE_PRIVATE_DATA Device,
IN UINT64  Buffer,
IN UINT64  Lba,
IN UINT32  Blocks 
)

Read some sectors from the device.

Parameters
DeviceThe pointer to the NVME_DEVICE_PRIVATE_DATA data structure.
BufferThe buffer used to store the data read from the device.
LbaThe start block number.
BlocksTotal block number to be read.
Return values
EFI_SUCCESSDatum are read from the device.
OthersFail to read all the datum.

Definition at line 25 of file NvmExpressBlockIo.c.

◆ TrustTransferNvmeDevice()

EFI_STATUS TrustTransferNvmeDevice ( IN OUT NVME_CONTROLLER_PRIVATE_DATA Private,
IN OUT VOID *  Buffer,
IN UINT8  SecurityProtocolId,
IN UINT16  SecurityProtocolSpecificData,
IN UINTN  TransferLength,
IN BOOLEAN  IsTrustSend,
IN UINT64  Timeout,
OUT UINTN TransferLengthOut 
)

Trust transfer data from/to NVMe device.

This function performs one NVMe transaction to do a trust transfer from/to NVMe device.

Parameters
PrivateThe pointer to the NVME_CONTROLLER_PRIVATE_DATA data structure.
BufferThe pointer to the current transaction buffer.
SecurityProtocolIdThe value of the "Security Protocol" parameter of the security protocol command to be sent.
SecurityProtocolSpecificDataThe value of the "Security Protocol Specific" parameter of the security protocol command to be sent.
TransferLengthThe block number or sector count of the transfer.
IsTrustSendIndicates whether it is a trust send operation or not.
TimeoutThe 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.
TransferLengthOutA pointer to a buffer to store the size in bytes of the data written to the buffer. Ignore it when IsTrustSend is TRUE.
Return values
EFI_SUCCESSThe data transfer is complete successfully.
Returns
others Some error occurs when transferring data.

Definition at line 1597 of file NvmExpressBlockIo.c.

◆ WriteSectors()

EFI_STATUS WriteSectors ( IN NVME_DEVICE_PRIVATE_DATA Device,
IN UINT64  Buffer,
IN UINT64  Lba,
IN UINT32  Blocks 
)

Write some sectors to the device.

Parameters
DeviceThe pointer to the NVME_DEVICE_PRIVATE_DATA data structure.
BufferThe buffer to be written into the device.
LbaThe start block number.
BlocksTotal block number to be written.
Return values
EFI_SUCCESSDatum are written into the buffer.
OthersFail to write all the datum.

Definition at line 88 of file NvmExpressBlockIo.c.