/* Update the SDMA address on the SDMA buffer boundary interrupt. */
EFI_STATUS SdMmcUpdateSdmaAddress(IN SD_MMC_HC_PRIVATE_DATA *Private, IN SD_MMC_HC_TRB *Trb)
/* Update the SDMA address on the SDMA buffer boundary interrupt. */
EFI_STATUS SdMmcUpdateSdmaAddress(IN SD_MMC_HC_PRIVATE_DATA *Private, IN SD_MMC_HC_TRB *Trb)
{
  UINT64      SdmaAddr;
  EFI_STATUS  Status;
  SdmaAddr = SD_MMC_SDMA_ROUND_UP ((UINTN)Trb->DataPhy, SD_MMC_SDMA_BOUNDARY);
  if (Private->ControllerVersion[Trb->Slot] >= SD_MMC_HC_CTRL_VER_400) {
    Status = SdMmcHcRwMmio (
               Private->PciIo,
               Trb->Slot,
               SD_MMC_HC_ADMA_SYS_ADDR,
               FALSE,
               sizeof (UINT64),
               &SdmaAddr
               );
  } else {
    Status = SdMmcHcRwMmio (
               Private->PciIo,
               Trb->Slot,
               SD_MMC_HC_SDMA_ADDR,
               FALSE,
               sizeof (UINT32),
               &SdmaAddr
               );
  }
  if (EFI_ERROR (Status)) {
    return Status;
  }
  Trb->DataPhy = (UINT64)(UINTN)SdmaAddr;
  return EFI_SUCCESS;
}