The DRQReady() and DRQReady2() functions only differ in that they poll different status registers for BSY, ERR, and DRQ: the former looks at the Status Register (clearing interrupt status), while the latter looks at the Alternate Status Register (not clearing interrupt status).
They both correctly return a unique status code, EFI_NOT_READY, for the BSY==0 && ERR==0 && DRQ==0 case; that is, when the device reports "command complete". However, the functions' leading comments don't explain this case, so it's easy to miss in callers. Update the comments. Cc: Feng Tian <feng.t...@intel.com> Cc: Star Zeng <star.z...@intel.com> Cc: John Snow <js...@redhat.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <ler...@redhat.com> --- MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.c | 31 ++++++++++++++++---- 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.c b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.c index f74e5ca..b06f988 100644 --- a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.c +++ b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.c @@ -463,17 +463,26 @@ DRQClear2 ( is called after the command is sent to the device and before required data is transferred. @param PciIo A pointer to EFI_PCI_IO_PROTOCOL data structure. @param IdeRegisters A pointer to EFI_IDE_REGISTERS data structure. @param Timeout The time to complete the command, uses 100ns as a unit. - @retval EFI_SUCCESS DRQ bit set within the time out. - @retval EFI_TIMEOUT DRQ bit not set within the time out. - @retval EFI_ABORTED DRQ bit not set caused by the command abort. + @retval EFI_SUCCESS BSY bit cleared and DRQ bit set within the + timeout. + + @retval EFI_TIMEOUT BSY bit not cleared within the timeout. + + @retval EFI_ABORTED Polling abandoned due to command abort. + + @retval EFI_DEVICE_ERROR Polling abandoned due to a non-abort error. + + @retval EFI_NOT_READY BSY bit cleared within timeout, and device + reported "command complete" by clearing DRQ + bit. @note Read Status Register will clear interrupt status. **/ EFI_STATUS EFIAPI DRQReady ( @@ -538,17 +547,27 @@ DRQReady ( DRQ is set when the device is ready to transfer data. So this function is called after the command is sent to the device and before required data is transferred. @param PciIo A pointer to EFI_PCI_IO_PROTOCOL data structure. @param IdeRegisters A pointer to EFI_IDE_REGISTERS data structure. @param Timeout The time to complete the command, uses 100ns as a unit. - @retval EFI_SUCCESS DRQ bit set within the time out. - @retval EFI_TIMEOUT DRQ bit not set within the time out. - @retval EFI_ABORTED DRQ bit not set caused by the command abort. + @retval EFI_SUCCESS BSY bit cleared and DRQ bit set within the + timeout. + + @retval EFI_TIMEOUT BSY bit not cleared within the timeout. + + @retval EFI_ABORTED Polling abandoned due to command abort. + + @retval EFI_DEVICE_ERROR Polling abandoned due to a non-abort error. + + @retval EFI_NOT_READY BSY bit cleared within timeout, and device + reported "command complete" by clearing DRQ + bit. + @note Read Alternate Status Register will not clear interrupt status. **/ EFI_STATUS EFIAPI DRQReady2 ( IN EFI_PCI_IO_PROTOCOL *PciIo, -- 1.8.3.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel