/* Checks if the command completed. If the command completed it gets the response and records the command completion in the TRB. */
EFI_STATUS SdMmcCheckCommandComplete(IN SD_MMC_HC_PRIVATE_DATA *Private, IN SD_MMC_HC_TRB *Trb, IN UINT16 IntStatus)
/* Checks if the command completed. If the command completed it gets the response and records the command completion in the TRB. */
EFI_STATUS SdMmcCheckCommandComplete(IN SD_MMC_HC_PRIVATE_DATA *Private, IN SD_MMC_HC_TRB *Trb, IN UINT16 IntStatus)
{
  UINT16      Data16;
  EFI_STATUS  Status;
  if ((IntStatus & BIT0) != 0) {
    Data16 = BIT0;
    Status = SdMmcHcRwMmio (
               Private->PciIo,
               Trb->Slot,
               SD_MMC_HC_NOR_INT_STS,
               FALSE,
               sizeof (Data16),
               &Data16
               );
    if (EFI_ERROR (Status)) {
      return Status;
    }
    Status = SdMmcGetResponse (Private, Trb);
    if (EFI_ERROR (Status)) {
      return Status;
    }
    Trb->CommandComplete = TRUE;
    return EFI_SUCCESS;
  }
  return EFI_NOT_READY;
}