/* Reads the response data into the TRB buffer. This function assumes that caller made sure that command has completed. */
EFI_STATUS SdMmcGetResponse(IN SD_MMC_HC_PRIVATE_DATA *Private, IN SD_MMC_HC_TRB *Trb)
/* Reads the response data into the TRB buffer. This function assumes that caller made sure that command has completed. */
EFI_STATUS SdMmcGetResponse(IN SD_MMC_HC_PRIVATE_DATA *Private, IN SD_MMC_HC_TRB *Trb)
{
  EFI_SD_MMC_PASS_THRU_COMMAND_PACKET  *Packet;
  UINT8                                Index;
  UINT32                               Response[4];
  EFI_STATUS                           Status;
  Packet = Trb->Packet;
  if (Packet->SdMmcCmdBlk->CommandType == SdMmcCommandTypeBc) {
    return EFI_SUCCESS;
  }
  for (Index = 0; Index < 4; Index++) {
    Status = SdMmcHcRwMmio (
               Private->PciIo,
               Trb->Slot,
               SD_MMC_HC_RESPONSE + Index * 4,
               TRUE,
               sizeof (UINT32),
               &Response[Index]
               );
    if (EFI_ERROR (Status)) {
      return Status;
    }
  }
  CopyMem (Packet->SdMmcStatusBlk, Response, sizeof (Response));
  return EFI_SUCCESS;
}