TianoCore EDK2 master
|
#include "UfsBlockIoPei.h"
Go to the source code of this file.
Variables | |
UFS_PEIM_HC_PRIVATE_DATA | gUfsHcPeimTemplate |
Copyright (c) 2014 - 2024, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file UfsBlockIoPei.c.
EFI_STATUS EFIAPI InitializeUfsBlockIoPeim | ( | IN EFI_PEI_FILE_HANDLE | FileHandle, |
IN CONST EFI_PEI_SERVICES ** | PeiServices | ||
) |
The user code starts with this function.
FileHandle | Handle of the file being invoked. |
PeiServices | Describes the list of possible PEI Services. |
EFI_SUCCESS | The driver is successfully initialized. |
Others | Can't initialize the driver. |
Definition at line 1080 of file UfsBlockIoPei.c.
EFI_STATUS EFIAPI UfsBlockIoPeimGetDeviceNo | ( | IN EFI_PEI_SERVICES ** | PeiServices, |
IN EFI_PEI_RECOVERY_BLOCK_IO_PPI * | This, | ||
OUT UINTN * | NumberBlockDevices | ||
) |
Gets the count of block I/O devices that one specific block driver detects.
This function is used for getting the count of block I/O devices that one specific block driver detects. To the PEI ATAPI driver, it returns the number of all the detected ATAPI devices it detects during the enumeration process. To the PEI legacy floppy driver, it returns the number of all the legacy devices it finds during its enumeration process. If no device is detected, then the function will return zero.
[in] | PeiServices | General-purpose services that are available to every PEIM. |
[in] | This | Indicates the EFI_PEI_RECOVERY_BLOCK_IO_PPI instance. |
[out] | NumberBlockDevices | The number of block I/O devices discovered. |
EFI_SUCCESS | The operation performed successfully. |
Definition at line 511 of file UfsBlockIoPei.c.
EFI_STATUS EFIAPI UfsBlockIoPeimGetDeviceNo2 | ( | IN EFI_PEI_SERVICES ** | PeiServices, |
IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI * | This, | ||
OUT UINTN * | NumberBlockDevices | ||
) |
Gets the count of block I/O devices that one specific block driver detects.
This function is used for getting the count of block I/O devices that one specific block driver detects. To the PEI ATAPI driver, it returns the number of all the detected ATAPI devices it detects during the enumeration process. To the PEI legacy floppy driver, it returns the number of all the legacy devices it finds during its enumeration process. If no device is detected, then the function will return zero.
[in] | PeiServices | General-purpose services that are available to every PEIM. |
[in] | This | Indicates the EFI_PEI_RECOVERY_BLOCK_IO2_PPI instance. |
[out] | NumberBlockDevices | The number of block I/O devices discovered. |
EFI_SUCCESS | The operation performed successfully. |
Definition at line 822 of file UfsBlockIoPei.c.
EFI_STATUS EFIAPI UfsBlockIoPeimGetMediaInfo | ( | IN EFI_PEI_SERVICES ** | PeiServices, |
IN EFI_PEI_RECOVERY_BLOCK_IO_PPI * | This, | ||
IN UINTN | DeviceIndex, | ||
OUT EFI_PEI_BLOCK_IO_MEDIA * | MediaInfo | ||
) |
Gets a block device's media information.
This function will provide the caller with the specified block device's media information. If the media changes, calling this function will update the media information accordingly.
[in] | PeiServices | General-purpose services that are available to every PEIM |
[in] | This | Indicates the EFI_PEI_RECOVERY_BLOCK_IO_PPI instance. |
[in] | DeviceIndex | Specifies the block device to which the function wants to talk. Because the driver that implements Block I/O PPIs will manage multiple block devices, the PPIs that want to talk to a single device must specify the device index that was assigned during the enumeration process. This index is a number from one to NumberBlockDevices. |
[out] | MediaInfo | The media information of the specified block media. The caller is responsible for the ownership of this data structure. |
EFI_SUCCESS | Media information about the specified block device was obtained successfully. |
EFI_DEVICE_ERROR | Cannot get the media information due to a hardware error. |
Definition at line 569 of file UfsBlockIoPei.c.
EFI_STATUS EFIAPI UfsBlockIoPeimGetMediaInfo2 | ( | IN EFI_PEI_SERVICES ** | PeiServices, |
IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI * | This, | ||
IN UINTN | DeviceIndex, | ||
OUT EFI_PEI_BLOCK_IO2_MEDIA * | MediaInfo | ||
) |
Gets a block device's media information.
This function will provide the caller with the specified block device's media information. If the media changes, calling this function will update the media information accordingly.
[in] | PeiServices | General-purpose services that are available to every PEIM |
[in] | This | Indicates the EFI_PEI_RECOVERY_BLOCK_IO2_PPI instance. |
[in] | DeviceIndex | Specifies the block device to which the function wants to talk. Because the driver that implements Block I/O PPIs will manage multiple block devices, the PPIs that want to talk to a single device must specify the device index that was assigned during the enumeration process. This index is a number from one to NumberBlockDevices. |
[out] | MediaInfo | The media information of the specified block media. The caller is responsible for the ownership of this data structure. |
EFI_SUCCESS | Media information about the specified block device was obtained successfully. |
EFI_DEVICE_ERROR | Cannot get the media information due to a hardware error. |
Definition at line 880 of file UfsBlockIoPei.c.
EFI_STATUS EFIAPI UfsBlockIoPeimReadBlocks | ( | IN EFI_PEI_SERVICES ** | PeiServices, |
IN EFI_PEI_RECOVERY_BLOCK_IO_PPI * | This, | ||
IN UINTN | DeviceIndex, | ||
IN EFI_PEI_LBA | StartLBA, | ||
IN UINTN | BufferSize, | ||
OUT VOID * | Buffer | ||
) |
Reads the requested number of blocks from the specified block device.
The function reads the requested number of blocks from the device. All the blocks are read, or an error is returned. If there is no media in the device, the function returns EFI_NO_MEDIA.
[in] | PeiServices | General-purpose services that are available to every PEIM. |
[in] | This | Indicates the EFI_PEI_RECOVERY_BLOCK_IO_PPI instance. |
[in] | DeviceIndex | Specifies the block device to which the function wants to talk. Because the driver that implements Block I/O PPIs will manage multiple block devices, PPIs that want to talk to a single device must specify the device index that was assigned during the enumeration process. This index is a number from one to NumberBlockDevices. |
[in] | StartLBA | The starting logical block address (LBA) to read from on the device |
[in] | BufferSize | The size of the Buffer in bytes. This number must be a multiple of the intrinsic block size of the device. |
[out] | Buffer | A pointer to the destination buffer for the data. The caller is responsible for the 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_INVALID_PARAMETER | The read request contains LBAs that are not valid, or the buffer is not properly aligned. |
EFI_NO_MEDIA | There is no media in the device. |
EFI_BAD_BUFFER_SIZE | The BufferSize parameter is not a multiple of the intrinsic block size of the device. |
Definition at line 695 of file UfsBlockIoPei.c.
EFI_STATUS EFIAPI UfsBlockIoPeimReadBlocks2 | ( | IN EFI_PEI_SERVICES ** | PeiServices, |
IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI * | This, | ||
IN UINTN | DeviceIndex, | ||
IN EFI_PEI_LBA | StartLBA, | ||
IN UINTN | BufferSize, | ||
OUT VOID * | Buffer | ||
) |
Reads the requested number of blocks from the specified block device.
The function reads the requested number of blocks from the device. All the blocks are read, or an error is returned. If there is no media in the device, the function returns EFI_NO_MEDIA.
[in] | PeiServices | General-purpose services that are available to every PEIM. |
[in] | This | Indicates the EFI_PEI_RECOVERY_BLOCK_IO2_PPI instance. |
[in] | DeviceIndex | Specifies the block device to which the function wants to talk. Because the driver that implements Block I/O PPIs will manage multiple block devices, PPIs that want to talk to a single device must specify the device index that was assigned during the enumeration process. This index is a number from one to NumberBlockDevices. |
[in] | StartLBA | The starting logical block address (LBA) to read from on the device |
[in] | BufferSize | The size of the Buffer in bytes. This number must be a multiple of the intrinsic block size of the device. |
[out] | Buffer | A pointer to the destination buffer for the data. The caller is responsible for the 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_INVALID_PARAMETER | The read request contains LBAs that are not valid, or the buffer is not properly aligned. |
EFI_NO_MEDIA | There is no media in the device. |
EFI_BAD_BUFFER_SIZE | The BufferSize parameter is not a multiple of the intrinsic block size of the device. |
Definition at line 945 of file UfsBlockIoPei.c.
EFI_STATUS EFIAPI UfsEndOfPei | ( | IN EFI_PEI_SERVICES ** | PeiServices, |
IN EFI_PEI_NOTIFY_DESCRIPTOR * | NotifyDescriptor, | ||
IN VOID * | Ppi | ||
) |
One notified function to cleanup the allocated DMA buffers at the end of PEI.
[in] | PeiServices | Pointer to PEI Services Table. |
[in] | NotifyDescriptor | Pointer to the descriptor for the Notification event that caused this function to execute. |
[in] | Ppi | Pointer to the PPI data associated with this function. |
EFI_SUCCESS | The function completes successfully |
Definition at line 984 of file UfsBlockIoPei.c.
EFI_STATUS UfsFinishDeviceInitialization | ( | IN UFS_PEIM_HC_PRIVATE_DATA * | Private | ) |
Finishes device initialization by setting fDeviceInit flag and waiting until device responds by clearing it.
[in] | Private | Pointer to the UFS_PEIM_HC_PRIVATE_DATA. |
EFI_SUCCESS | The operation succeeds. |
Others | The operation fails. |
Definition at line 1030 of file UfsBlockIoPei.c.
EFI_STATUS UfsPeimParsingSenseKeys | ( | IN EFI_PEI_BLOCK_IO2_MEDIA * | Media, |
IN EFI_SCSI_SENSE_DATA * | SenseData, | ||
OUT BOOLEAN * | NeedRetry | ||
) |
Parsing Sense Keys from sense data.
Media | The pointer of EFI_PEI_BLOCK_IO_MEDIA |
SenseData | The pointer of EFI_SCSI_SENSE_DATA |
NeedRetry | The pointer of action which indicates what is need to retry |
EFI_DEVICE_ERROR | Indicates that error occurs |
EFI_SUCCESS | Successfully to complete the parsing |
Definition at line 430 of file UfsBlockIoPei.c.
EFI_STATUS UfsPeimRead10 | ( | IN UFS_PEIM_HC_PRIVATE_DATA * | Private, |
IN UINTN | Lun, | ||
IN UINTN | StartLba, | ||
IN UINT32 | SectorNum, | ||
OUT VOID * | DataBuffer, | ||
OUT UINT32 * | DataLength, | ||
OUT VOID *SenseData | OPTIONAL, | ||
OUT UINT8 * | SenseDataLength | ||
) |
Execute READ (10) SCSI command on a specific UFS device.
[in] | Private | A pointer to UFS_PEIM_HC_PRIVATE_DATA data structure. |
[in] | Lun | The lun on which the SCSI cmd executed. |
[in] | StartLba | The start LBA. |
[in] | SectorNum | The sector number to be read. |
[out] | DataBuffer | A pointer to data buffer. |
[out] | DataLength | The length of output data. |
[out] | SenseData | A pointer to output sense data. |
[out] | SenseDataLength | The length of output sense data. |
EFI_SUCCESS | The command executed successfully. |
EFI_DEVICE_ERROR | A device error occurred while attempting to send SCSI Request Packet. |
EFI_TIMEOUT | A timeout occurred while waiting for the SCSI Request Packet to execute. |
Definition at line 312 of file UfsBlockIoPei.c.
EFI_STATUS UfsPeimRead16 | ( | IN UFS_PEIM_HC_PRIVATE_DATA * | Private, |
IN UINTN | Lun, | ||
IN UINTN | StartLba, | ||
IN UINT32 | SectorNum, | ||
OUT VOID * | DataBuffer, | ||
OUT UINT32 * | DataLength, | ||
OUT VOID *SenseData | OPTIONAL, | ||
OUT UINT8 * | SenseDataLength | ||
) |
Execute READ (16) SCSI command on a specific UFS device.
[in] | Private | A pointer to UFS_PEIM_HC_PRIVATE_DATA data structure. |
[in] | Lun | The lun on which the SCSI cmd executed. |
[in] | StartLba | The start LBA. |
[in] | SectorNum | The sector number to be read. |
[out] | DataBuffer | A pointer to data buffer. |
[out] | DataLength | The length of output data. |
[out] | SenseData | A pointer to output sense data. |
[out] | SenseDataLength | The length of output sense data. |
EFI_SUCCESS | The command executed successfully. |
EFI_DEVICE_ERROR | A device error occurred while attempting to send SCSI Request Packet. |
EFI_TIMEOUT | A timeout occurred while waiting for the SCSI Request Packet to execute. |
Definition at line 374 of file UfsBlockIoPei.c.
EFI_STATUS UfsPeimReadCapacity | ( | IN UFS_PEIM_HC_PRIVATE_DATA * | Private, |
IN UINTN | Lun, | ||
OUT VOID * | DataBuffer, | ||
OUT UINT32 * | DataLength, | ||
OUT VOID *SenseData | OPTIONAL, | ||
OUT UINT8 * | SenseDataLength | ||
) |
Execute READ CAPACITY(10) SCSI command on a specific UFS device.
[in] | Private | A pointer to UFS_PEIM_HC_PRIVATE_DATA data structure. |
[in] | Lun | The lun on which the SCSI cmd executed. |
[out] | DataBuffer | A pointer to READ_CAPACITY data buffer. |
[out] | DataLength | The length of output READ_CAPACITY data. |
[out] | SenseData | A pointer to output sense data. |
[out] | SenseDataLength | The length of output sense data. |
EFI_SUCCESS | The command executed successfully. |
EFI_DEVICE_ERROR | A device error occurred while attempting to send SCSI Request Packet. |
EFI_TIMEOUT | A timeout occurred while waiting for the SCSI Request Packet to execute. |
Definition at line 196 of file UfsBlockIoPei.c.
EFI_STATUS UfsPeimReadCapacity16 | ( | IN UFS_PEIM_HC_PRIVATE_DATA * | Private, |
IN UINTN | Lun, | ||
OUT VOID * | DataBuffer, | ||
OUT UINT32 * | DataLength, | ||
OUT VOID *SenseData | OPTIONAL, | ||
OUT UINT8 * | SenseDataLength | ||
) |
Execute READ CAPACITY(16) SCSI command on a specific UFS device.
[in] | Private | A pointer to UFS_PEIM_HC_PRIVATE_DATA data structure. |
[in] | Lun | The lun on which the SCSI cmd executed. |
[out] | DataBuffer | A pointer to READ_CAPACITY data buffer. |
[out] | DataLength | The length of output READ_CAPACITY data. |
[out] | SenseData | A pointer to output sense data. |
[out] | SenseDataLength | The length of output sense data. |
EFI_SUCCESS | The command executed successfully. |
EFI_DEVICE_ERROR | A device error occurred while attempting to send SCSI Request Packet. |
EFI_TIMEOUT | A timeout occurred while waiting for the SCSI Request Packet to execute. |
Definition at line 252 of file UfsBlockIoPei.c.
EFI_STATUS UfsPeimTestUnitReady | ( | IN UFS_PEIM_HC_PRIVATE_DATA * | Private, |
IN UINTN | Lun, | ||
OUT VOID *SenseData | OPTIONAL, | ||
OUT UINT8 * | SenseDataLength | ||
) |
Execute TEST UNITY READY SCSI command on a specific UFS device.
[in] | Private | A pointer to UFS_PEIM_HC_PRIVATE_DATA data structure. |
[in] | Lun | The lun on which the SCSI cmd executed. |
[out] | SenseData | A pointer to output sense data. |
[out] | SenseDataLength | The length of output sense data. |
EFI_SUCCESS | The command executed successfully. |
EFI_DEVICE_ERROR | A device error occurred while attempting to send SCSI Request Packet. |
EFI_TIMEOUT | A timeout occurred while waiting for the SCSI Request Packet to execute. |
Definition at line 148 of file UfsBlockIoPei.c.
UFS_PEIM_HC_PRIVATE_DATA gUfsHcPeimTemplate |
Definition at line 13 of file UfsBlockIoPei.c.