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

Go to the source code of this file.

Functions

EFI_STATUS EFIAPI AtapiPeimEntry (IN EFI_PEI_FILE_HANDLE FileHandle, IN CONST EFI_PEI_SERVICES **PeiServices)
 
EFI_STATUS EFIAPI AtapiGetNumberOfBlockDevices (IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_RECOVERY_BLOCK_IO_PPI *This, OUT UINTN *NumberBlockDevices)
 
EFI_STATUS EFIAPI AtapiGetBlockDeviceMediaInfo (IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_RECOVERY_BLOCK_IO_PPI *This, IN UINTN DeviceIndex, OUT EFI_PEI_BLOCK_IO_MEDIA *MediaInfo)
 
EFI_STATUS EFIAPI AtapiReadBlocks (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)
 
EFI_STATUS EFIAPI AtapiGetNumberOfBlockDevices2 (IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This, OUT UINTN *NumberBlockDevices)
 
EFI_STATUS EFIAPI AtapiGetBlockDeviceMediaInfo2 (IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This, IN UINTN DeviceIndex, OUT EFI_PEI_BLOCK_IO2_MEDIA *MediaInfo)
 
EFI_STATUS EFIAPI AtapiReadBlocks2 (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)
 
VOID AtapiEnumerateDevices (IN ATAPI_BLK_IO_DEV *AtapiBlkIoDev)
 
BOOLEAN DiscoverAtapiDevice (IN ATAPI_BLK_IO_DEV *AtapiBlkIoDev, IN UINTN DevicePosition, OUT EFI_PEI_BLOCK_IO_MEDIA *MediaInfo, OUT EFI_PEI_BLOCK_IO2_MEDIA *MediaInfo2)
 
EFI_STATUS CheckPowerMode (IN ATAPI_BLK_IO_DEV *AtapiBlkIoDev, IN UINTN DevicePosition, IN UINT8 AtaCommand)
 
BOOLEAN DetectIDEController (IN ATAPI_BLK_IO_DEV *AtapiBlkIoDev, IN UINTN DevicePosition)
 
EFI_STATUS WaitForBSYClear (IN ATAPI_BLK_IO_DEV *AtapiBlkIoDev, IN IDE_BASE_REGISTERS *IdeIoRegisters, IN UINTN TimeoutInMilliSeconds)
 
EFI_STATUS DRDYReady (IN ATAPI_BLK_IO_DEV *AtapiBlkIoDev, IN IDE_BASE_REGISTERS *IdeIoRegisters, IN UINTN TimeoutInMilliSeconds)
 
EFI_STATUS DRQClear (IN ATAPI_BLK_IO_DEV *AtapiBlkIoDev, IN IDE_BASE_REGISTERS *IdeIoRegisters, IN UINTN TimeoutInMilliSeconds)
 
EFI_STATUS DRQClear2 (IN ATAPI_BLK_IO_DEV *AtapiBlkIoDev, IN IDE_BASE_REGISTERS *IdeIoRegisters, IN UINTN TimeoutInMilliSeconds)
 
EFI_STATUS DRQReady (IN ATAPI_BLK_IO_DEV *AtapiBlkIoDev, IN IDE_BASE_REGISTERS *IdeIoRegisters, IN UINTN TimeoutInMilliSeconds)
 
EFI_STATUS DRQReady2 (IN ATAPI_BLK_IO_DEV *AtapiBlkIoDev, IN IDE_BASE_REGISTERS *IdeIoRegisters, IN UINTN TimeoutInMilliSeconds)
 
EFI_STATUS CheckErrorStatus (IN ATAPI_BLK_IO_DEV *AtapiBlkIoDev, IN UINT16 StatusReg)
 
EFI_STATUS ATAPIIdentify (IN ATAPI_BLK_IO_DEV *AtapiBlkIoDev, IN UINTN DevicePosition)
 
EFI_STATUS TestUnitReady (IN ATAPI_BLK_IO_DEV *AtapiBlkIoDev, IN UINTN DevicePosition)
 
EFI_STATUS AtapiPacketCommandIn (IN ATAPI_BLK_IO_DEV *AtapiBlkIoDev, IN UINTN DevicePosition, IN ATAPI_PACKET_COMMAND *Packet, IN UINT16 *Buffer, IN UINT32 ByteCount, IN UINTN TimeoutInMilliSeconds)
 
EFI_STATUS Inquiry (IN ATAPI_BLK_IO_DEV *AtapiBlkIoDev, IN UINTN DevicePosition, OUT EFI_PEI_BLOCK_IO_MEDIA *MediaInfo, OUT EFI_PEI_BLOCK_IO2_MEDIA *MediaInfo2)
 
EFI_STATUS DetectMedia (IN ATAPI_BLK_IO_DEV *AtapiBlkIoDev, IN UINTN DevicePosition, IN OUT EFI_PEI_BLOCK_IO_MEDIA *MediaInfo, IN OUT EFI_PEI_BLOCK_IO2_MEDIA *MediaInfo2)
 
EFI_STATUS ResetDevice (IN ATAPI_BLK_IO_DEV *AtapiBlkIoDev, IN UINTN DevicePosition, IN BOOLEAN Extensive)
 
EFI_STATUS RequestSense (IN ATAPI_BLK_IO_DEV *AtapiBlkIoDev, IN UINTN DevicePosition, IN ATAPI_REQUEST_SENSE_DATA *SenseBuffers, IN OUT UINT8 *SenseCounts)
 
EFI_STATUS ReadCapacity (IN ATAPI_BLK_IO_DEV *AtapiBlkIoDev, IN UINTN DevicePosition, IN OUT EFI_PEI_BLOCK_IO_MEDIA *MediaInfo, IN OUT EFI_PEI_BLOCK_IO2_MEDIA *MediaInfo2)
 
EFI_STATUS ReadSectors (IN ATAPI_BLK_IO_DEV *AtapiBlkIoDev, IN UINTN DevicePosition, IN VOID *Buffer, IN EFI_PEI_LBA StartLba, IN UINTN NumberOfBlocks, IN UINTN BlockSize)
 
BOOLEAN IsNoMedia (IN ATAPI_REQUEST_SENSE_DATA *SenseData, IN UINTN SenseCounts)
 
BOOLEAN IsDeviceStateUnclear (IN ATAPI_REQUEST_SENSE_DATA *SenseData, IN UINTN SenseCounts)
 
BOOLEAN IsMediaError (IN ATAPI_REQUEST_SENSE_DATA *SenseData, IN UINTN SenseCounts)
 
BOOLEAN IsDriveReady (IN ATAPI_REQUEST_SENSE_DATA *SenseData, IN UINTN SenseCounts, OUT BOOLEAN *NeedRetry)
 

Detailed Description

PEIM to produce gEfiPeiVirtualBlockIoPpiGuid & gEfiPeiVirtualBlockIo2PpiGuid PPI for ATA controllers in the platform.

This PPI can be consumed by PEIM which produce gEfiPeiDeviceRecoveryModulePpiGuid for Atapi CD ROM device.

Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file AtapiPeim.c.

Function Documentation

◆ AtapiEnumerateDevices()

VOID AtapiEnumerateDevices ( IN ATAPI_BLK_IO_DEV AtapiBlkIoDev)

Enumerate Atapi devices.

This function is used to enumerate Atatpi device in Ide channel.

Parameters
[in]AtapiBlkIoDevA pointer to atapi block IO device

Definition at line 515 of file AtapiPeim.c.

◆ AtapiGetBlockDeviceMediaInfo()

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

Parameters
[in]PeiServicesGeneral-purpose services that are available to every PEIM
[in]ThisIndicates the EFI_PEI_RECOVERY_BLOCK_IO_PPI instance.
[in]DeviceIndexSpecifies 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]MediaInfoThe media information of the specified block media. The caller is responsible for the ownership of this data structure.
Return values
EFI_SUCCESSMedia information about the specified block device was obtained successfully.
EFI_DEVICE_ERRORCannot get the media information due to a hardware error.
OthersOther failure occurs.

Definition at line 158 of file AtapiPeim.c.

◆ AtapiGetBlockDeviceMediaInfo2()

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

Parameters
[in]PeiServicesGeneral-purpose services that are available to every PEIM
[in]ThisIndicates the EFI_PEI_RECOVERY_BLOCK_IO2_PPI instance.
[in]DeviceIndexSpecifies 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]MediaInfoThe media information of the specified block media. The caller is responsible for the ownership of this data structure.
Return values
EFI_SUCCESSMedia information about the specified block device was obtained successfully.
EFI_DEVICE_ERRORCannot get the media information due to a hardware error.
OthersOther failure occurs.

Definition at line 401 of file AtapiPeim.c.

◆ AtapiGetNumberOfBlockDevices()

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

Parameters
[in]PeiServicesGeneral-purpose services that are available to every PEIM.
[in]ThisIndicates the EFI_PEI_RECOVERY_BLOCK_IO_PPI instance.
[out]NumberBlockDevicesThe number of block I/O devices discovered.
Return values
EFI_SUCCESSOperation performed successfully.

Definition at line 111 of file AtapiPeim.c.

◆ AtapiGetNumberOfBlockDevices2()

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

Parameters
[in]PeiServicesGeneral-purpose services that are available to every PEIM.
[in]ThisIndicates the EFI_PEI_RECOVERY_BLOCK_IO2_PPI instance.
[out]NumberBlockDevicesThe number of block I/O devices discovered.
Return values
EFI_SUCCESSOperation performed successfully.

Definition at line 351 of file AtapiPeim.c.

◆ ATAPIIdentify()

EFI_STATUS ATAPIIdentify ( IN ATAPI_BLK_IO_DEV AtapiBlkIoDev,
IN UINTN  DevicePosition 
)

Idendify Atapi devices.

Parameters
[in]AtapiBlkIoDevA pointer to atapi block IO device.
[in]DevicePositionAn integer to signify device position.
Return values
EFI_SUCCESSIdentify successfully.
EFI_DEVICE_ERRORDevice cannot be identified successfully.

Definition at line 1211 of file AtapiPeim.c.

◆ AtapiPacketCommandIn()

EFI_STATUS AtapiPacketCommandIn ( IN ATAPI_BLK_IO_DEV AtapiBlkIoDev,
IN UINTN  DevicePosition,
IN ATAPI_PACKET_COMMAND Packet,
IN UINT16 *  Buffer,
IN UINT32  ByteCount,
IN UINTN  TimeoutInMilliSeconds 
)

Send out ATAPI commands conforms to the Packet Command with PIO Data In Protocol.

Parameters
[in]AtapiBlkIoDevA pointer to atapi block IO device.
[in]DevicePositionAn integer to signify device position.
[in]PacketA pointer to ATAPI command packet.
[in]BufferBuffer to contain requested transfer data from device.
[in]ByteCountRequested transfer data length.
[in]TimeoutInMilliSecondsTime out value, in unit of milliseconds.
Return values
EFI_SUCCESSCommand executed successfully.
EFI_DEVICE_ERRORDevice cannot be executed command successfully.

Definition at line 1415 of file AtapiPeim.c.

◆ AtapiPeimEntry()

EFI_STATUS EFIAPI AtapiPeimEntry ( IN EFI_PEI_FILE_HANDLE  FileHandle,
IN CONST EFI_PEI_SERVICES **  PeiServices 
)

Initializes the Atapi Block Io PPI.

Parameters
[in]FileHandleHandle of the file being invoked.
[in]PeiServicesDescribes the list of possible PEI Services.
Return values
EFI_SUCCESSOperation performed successfully.
EFI_OUT_OF_RESOURCESNot enough memory to allocate.

Definition at line 28 of file AtapiPeim.c.

◆ AtapiReadBlocks()

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

Parameters
[in]PeiServicesGeneral-purpose services that are available to every PEIM.
[in]ThisIndicates the EFI_PEI_RECOVERY_BLOCK_IO_PPI instance.
[in]DeviceIndexSpecifies 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.
[in]StartLBAThe starting logical block address (LBA) to read from on the device
[in]BufferSizeThe size of the Buffer in bytes. This number must be a multiple of the intrinsic block size of the device.
[out]BufferA pointer to the destination buffer for the data. The caller is responsible for the 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_INVALID_PARAMETERThe read request contains LBAs that are not valid, or the buffer is not properly aligned.
EFI_NO_MEDIAThere is no media in the device.
EFI_BAD_BUFFER_SIZEThe BufferSize parameter is not a multiple of the intrinsic block size of the device.

Definition at line 258 of file AtapiPeim.c.

◆ AtapiReadBlocks2()

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

Parameters
[in]PeiServicesGeneral-purpose services that are available to every PEIM.
[in]ThisIndicates the EFI_PEI_RECOVERY_BLOCK_IO2_PPI instance.
[in]DeviceIndexSpecifies 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.
[in]StartLBAThe starting logical block address (LBA) to read from on the device
[in]BufferSizeThe size of the Buffer in bytes. This number must be a multiple of the intrinsic block size of the device.
[out]BufferA pointer to the destination buffer for the data. The caller is responsible for the 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_INVALID_PARAMETERThe read request contains LBAs that are not valid, or the buffer is not properly aligned.
EFI_NO_MEDIAThere is no media in the device.
EFI_BAD_BUFFER_SIZEThe BufferSize parameter is not a multiple of the intrinsic block size of the device.

Definition at line 474 of file AtapiPeim.c.

◆ CheckErrorStatus()

EFI_STATUS CheckErrorStatus ( IN ATAPI_BLK_IO_DEV AtapiBlkIoDev,
IN UINT16  StatusReg 
)

Check if there is an error in Status Register.

Parameters
[in]AtapiBlkIoDevA pointer to atapi block IO device.
[in]StatusRegThe address to IDE IO registers.
Return values
EFI_SUCCESSOperation success.
EFI_DEVICE_ERRORDevice error.

Definition at line 1184 of file AtapiPeim.c.

◆ CheckPowerMode()

EFI_STATUS CheckPowerMode ( IN ATAPI_BLK_IO_DEV AtapiBlkIoDev,
IN UINTN  DevicePosition,
IN UINT8  AtaCommand 
)

Check power mode of Atapi devices.

Parameters
[in]AtapiBlkIoDevA pointer to atapi block IO device.
[in]DevicePositionAn integer to signify device position.
[in]AtaCommandThe Ata Command passed in.
Return values
EFI_SUCCESSThe Atapi device support power mode.
EFI_NOT_FOUNDThe Atapi device not found.
EFI_TIMEOUTAtapi command transaction is time out.
EFI_ABORTEDAtapi command abort.

Definition at line 675 of file AtapiPeim.c.

◆ DetectIDEController()

BOOLEAN DetectIDEController ( IN ATAPI_BLK_IO_DEV AtapiBlkIoDev,
IN UINTN  DevicePosition 
)

Detect if an IDE controller exists in specified position.

Parameters
[in]AtapiBlkIoDevA pointer to atapi block IO device.
[in]DevicePositionAn integer to signify device position.
Return values
TRUEThe Atapi device exists.
FALSEThe Atapi device does not present.

Definition at line 806 of file AtapiPeim.c.

◆ DetectMedia()

EFI_STATUS DetectMedia ( IN ATAPI_BLK_IO_DEV AtapiBlkIoDev,
IN UINTN  DevicePosition,
IN OUT EFI_PEI_BLOCK_IO_MEDIA MediaInfo,
IN OUT EFI_PEI_BLOCK_IO2_MEDIA MediaInfo2 
)

Used before read/write blocks from/to ATAPI device media. Since ATAPI device media is removable, it is necessary to detect whether media is present and get current present media's information.

Parameters
[in]AtapiBlkIoDevA pointer to atapi block IO device.
[in]DevicePositionAn integer to signify device position.
[in,out]MediaInfoThe media information of the specified block media.
[in,out]MediaInfo2The media information 2 of the specified block media.
Return values
EFI_SUCCESSCommand executed successfully.
EFI_DEVICE_ERRORSome device errors happen.
EFI_OUT_OF_RESOURCESCan not allocate required resources.

Definition at line 1720 of file AtapiPeim.c.

◆ DiscoverAtapiDevice()

BOOLEAN DiscoverAtapiDevice ( IN ATAPI_BLK_IO_DEV AtapiBlkIoDev,
IN UINTN  DevicePosition,
OUT EFI_PEI_BLOCK_IO_MEDIA MediaInfo,
OUT EFI_PEI_BLOCK_IO2_MEDIA MediaInfo2 
)

Detect Atapi devices.

Parameters
[in]AtapiBlkIoDevA pointer to atapi block IO device.
[in]DevicePositionAn integer to signify device position.
[out]MediaInfoThe media information of the specified block media.
[out]MediaInfo2The media information 2 of the specified block media.
Return values
TRUEAtapi device exists in specified position.
FALSEAtapi device does not exist in specified position.

Definition at line 635 of file AtapiPeim.c.

◆ DRDYReady()

EFI_STATUS DRDYReady ( IN ATAPI_BLK_IO_DEV AtapiBlkIoDev,
IN IDE_BASE_REGISTERS IdeIoRegisters,
IN UINTN  TimeoutInMilliSeconds 
)

Wait specified time interval to poll for DRDY bit set in the Status register.

Parameters
[in]AtapiBlkIoDevA pointer to atapi block IO device.
[in]IdeIoRegistersA pointer to IDE IO registers.
[in]TimeoutInMilliSecondsTime specified in milliseconds.
Return values
EFI_SUCCESSDRDY bit is set in the specified time interval.
EFI_TIMEOUTDRDY bit is not set in the specified time interval.

Definition at line 895 of file AtapiPeim.c.

◆ DRQClear()

EFI_STATUS DRQClear ( IN ATAPI_BLK_IO_DEV AtapiBlkIoDev,
IN IDE_BASE_REGISTERS IdeIoRegisters,
IN UINTN  TimeoutInMilliSeconds 
)

Wait specified time interval to poll for DRQ bit clear in the Status Register.

Parameters
[in]AtapiBlkIoDevA pointer to atapi block IO device.
[in]IdeIoRegistersA pointer to IDE IO registers.
[in]TimeoutInMilliSecondsTime specified in milliseconds.
Return values
EFI_SUCCESSDRQ bit is cleared in the specified time interval.
EFI_TIMEOUTDRQ bit is not cleared in the specified time interval.

Definition at line 951 of file AtapiPeim.c.

◆ DRQClear2()

EFI_STATUS DRQClear2 ( IN ATAPI_BLK_IO_DEV AtapiBlkIoDev,
IN IDE_BASE_REGISTERS IdeIoRegisters,
IN UINTN  TimeoutInMilliSeconds 
)

Wait specified time interval to poll for DRQ bit clear in the Alternate Status Register.

Parameters
[in]AtapiBlkIoDevA pointer to atapi block IO device.
[in]IdeIoRegistersA pointer to IDE IO registers.
[in]TimeoutInMilliSecondsTime specified in milliseconds.
Return values
EFI_SUCCESSDRQ bit is cleared in the specified time interval.
EFI_TIMEOUTDRQ bit is not cleared in the specified time interval.

Definition at line 1008 of file AtapiPeim.c.

◆ DRQReady()

EFI_STATUS DRQReady ( IN ATAPI_BLK_IO_DEV AtapiBlkIoDev,
IN IDE_BASE_REGISTERS IdeIoRegisters,
IN UINTN  TimeoutInMilliSeconds 
)

Wait specified time interval to poll for DRQ bit set in the Status Register.

Parameters
[in]AtapiBlkIoDevA pointer to atapi block IO device.
[in]IdeIoRegistersA pointer to IDE IO registers.
[in]TimeoutInMilliSecondsTime specified in milliseconds.
Return values
EFI_SUCCESSDRQ bit is set in the specified time interval.
EFI_TIMEOUTDRQ bit is not set in the specified time interval.
EFI_ABORTEDOperation Aborted.

Definition at line 1066 of file AtapiPeim.c.

◆ DRQReady2()

EFI_STATUS DRQReady2 ( IN ATAPI_BLK_IO_DEV AtapiBlkIoDev,
IN IDE_BASE_REGISTERS IdeIoRegisters,
IN UINTN  TimeoutInMilliSeconds 
)

Wait specified time interval to poll for DRQ bit set in the Alternate Status Register.

Parameters
[in]AtapiBlkIoDevA pointer to atapi block IO device.
[in]IdeIoRegistersA pointer to IDE IO registers.
[in]TimeoutInMilliSecondsTime specified in milliseconds.
Return values
EFI_SUCCESSDRQ bit is set in the specified time interval.
EFI_TIMEOUTDRQ bit is not set in the specified time interval.
EFI_ABORTEDOperation Aborted.

Definition at line 1128 of file AtapiPeim.c.

◆ Inquiry()

EFI_STATUS Inquiry ( IN ATAPI_BLK_IO_DEV AtapiBlkIoDev,
IN UINTN  DevicePosition,
OUT EFI_PEI_BLOCK_IO_MEDIA MediaInfo,
OUT EFI_PEI_BLOCK_IO2_MEDIA MediaInfo2 
)

Sends out ATAPI Inquiry Packet Command to the specified device. This command will return INQUIRY data of the device.

Parameters
[in]AtapiBlkIoDevA pointer to atapi block IO device.
[in]DevicePositionAn integer to signify device position.
[out]MediaInfoThe media information of the specified block media.
[out]MediaInfo2The media information 2 of the specified block media.
Return values
EFI_SUCCESSCommand executed successfully.
EFI_DEVICE_ERRORDevice cannot be executed command successfully.
EFI_UNSUPPORTEDUnsupported device type.

Definition at line 1623 of file AtapiPeim.c.

◆ IsDeviceStateUnclear()

BOOLEAN IsDeviceStateUnclear ( IN ATAPI_REQUEST_SENSE_DATA SenseData,
IN UINTN  SenseCounts 
)

Check if device state is unclear according to sense data.

Parameters
[in]SenseDataPointer to sense data.
[in]SenseCountsCount of sense data.
Return values
TRUEDevice state is unclear
FALSEDevice state is clear

Definition at line 2315 of file AtapiPeim.c.

◆ IsDriveReady()

BOOLEAN IsDriveReady ( IN ATAPI_REQUEST_SENSE_DATA SenseData,
IN UINTN  SenseCounts,
OUT BOOLEAN *  NeedRetry 
)

Check if drive is ready according to sense data.

Parameters
[in]SenseDataPointer to sense data.
[in]SenseCountsCount of sense data.
[out]NeedRetryIndicate if retry is needed.
Return values
TRUEDrive ready
FALSEDrive not ready

Definition at line 2428 of file AtapiPeim.c.

◆ IsMediaError()

BOOLEAN IsMediaError ( IN ATAPI_REQUEST_SENSE_DATA SenseData,
IN UINTN  SenseCounts 
)

Check if there is media error according to sense data.

Parameters
[in]SenseDataPointer to sense data.
[in]SenseCountsCount of sense data.
Return values
TRUEMedia error
FALSENo media error

Definition at line 2355 of file AtapiPeim.c.

◆ IsNoMedia()

BOOLEAN IsNoMedia ( IN ATAPI_REQUEST_SENSE_DATA SenseData,
IN UINTN  SenseCounts 
)

Check if there is media according to sense data.

Parameters
[in]SenseDataPointer to sense data.
[in]SenseCountsCount of sense data.
Return values
TRUENo media
FALSEMedia exists

Definition at line 2280 of file AtapiPeim.c.

◆ ReadCapacity()

EFI_STATUS ReadCapacity ( IN ATAPI_BLK_IO_DEV AtapiBlkIoDev,
IN UINTN  DevicePosition,
IN OUT EFI_PEI_BLOCK_IO_MEDIA MediaInfo,
IN OUT EFI_PEI_BLOCK_IO2_MEDIA MediaInfo2 
)

Sends out ATAPI Read Capacity Packet Command to the specified device. This command will return the information regarding the capacity of the media in the device.

Parameters
[in]AtapiBlkIoDevA pointer to atapi block IO device.
[in]DevicePositionAn integer to signify device position.
[in,out]MediaInfoThe media information of the specified block media.
[in,out]MediaInfo2The media information 2 of the specified block media.
Return values
EFI_SUCCESSCommand executed successfully.
EFI_DEVICE_ERRORSome device errors happen.

Definition at line 2076 of file AtapiPeim.c.

◆ ReadSectors()

EFI_STATUS ReadSectors ( IN ATAPI_BLK_IO_DEV AtapiBlkIoDev,
IN UINTN  DevicePosition,
IN VOID *  Buffer,
IN EFI_PEI_LBA  StartLba,
IN UINTN  NumberOfBlocks,
IN UINTN  BlockSize 
)

Perform read from disk in block unit.

Parameters
[in]AtapiBlkIoDevA pointer to atapi block IO device.
[in]DevicePositionAn integer to signify device position.
[in]BufferBuffer to contain read data.
[in]StartLbaStarting LBA address.
[in]NumberOfBlocksNumber of blocks to read.
[in]BlockSizeSize of each block.
Return values
EFI_SUCCESSCommand executed successfully.
EFI_DEVICE_ERRORSome device errors happen.

Definition at line 2182 of file AtapiPeim.c.

◆ RequestSense()

EFI_STATUS RequestSense ( IN ATAPI_BLK_IO_DEV AtapiBlkIoDev,
IN UINTN  DevicePosition,
IN ATAPI_REQUEST_SENSE_DATA SenseBuffers,
IN OUT UINT8 *  SenseCounts 
)

Sends out ATAPI Request Sense Packet Command to the specified device.

Parameters
[in]AtapiBlkIoDevA pointer to atapi block IO device.
[in]DevicePositionAn integer to signify device position.
[in]SenseBuffersPointer to sense buffer.
[in,out]SenseCountsLength of sense buffer.
Return values
EFI_SUCCESSCommand executed successfully.
EFI_DEVICE_ERRORSome device errors happen.

Definition at line 1979 of file AtapiPeim.c.

◆ ResetDevice()

EFI_STATUS ResetDevice ( IN ATAPI_BLK_IO_DEV AtapiBlkIoDev,
IN UINTN  DevicePosition,
IN BOOLEAN  Extensive 
)

Reset specified Atapi device.

Parameters
[in]AtapiBlkIoDevA pointer to atapi block IO device.
[in]DevicePositionAn integer to signify device position.
[in]ExtensiveIf TRUE, use ATA soft reset, otherwise use Atapi soft reset.
Return values
EFI_SUCCESSCommand executed successfully.
EFI_DEVICE_ERRORSome device errors happen.

Definition at line 1882 of file AtapiPeim.c.

◆ TestUnitReady()

EFI_STATUS TestUnitReady ( IN ATAPI_BLK_IO_DEV AtapiBlkIoDev,
IN UINTN  DevicePosition 
)

Sends out ATAPI Test Unit Ready Packet Command to the specified device to find out whether device is accessible.

Parameters
[in]AtapiBlkIoDevA pointer to atapi block IO device.
[in]DevicePositionAn integer to signify device position.
Return values
EFI_SUCCESSTestUnit command executed successfully.
EFI_DEVICE_ERRORDevice cannot be executed TestUnit command successfully.

Definition at line 1379 of file AtapiPeim.c.

◆ WaitForBSYClear()

EFI_STATUS WaitForBSYClear ( IN ATAPI_BLK_IO_DEV AtapiBlkIoDev,
IN IDE_BASE_REGISTERS IdeIoRegisters,
IN UINTN  TimeoutInMilliSeconds 
)

Wait specified time interval to poll for BSY bit clear in the Status Register.

Parameters
[in]AtapiBlkIoDevA pointer to atapi block IO device.
[in]IdeIoRegistersA pointer to IDE IO registers.
[in]TimeoutInMilliSecondsTime specified in milliseconds.
Return values
EFI_SUCCESSBSY bit is cleared in the specified time interval.
EFI_TIMEOUTBSY bit is not cleared in the specified time interval.

Definition at line 850 of file AtapiPeim.c.