/* Get the MMIO base of the UFS host controller. */
EFI_STATUS EFIAPI UfsHcGetMmioBar(IN EDKII_UFS_HOST_CONTROLLER_PROTOCOL *This, OUT UINTN *MmioBar)
/* Get the MMIO base of the UFS host controller. */
EFI_STATUS EFIAPI UfsHcGetMmioBar(IN EDKII_UFS_HOST_CONTROLLER_PROTOCOL *This, OUT UINTN *MmioBar)
{
  UFS_HOST_CONTROLLER_PRIVATE_DATA   *Private;
  EFI_PCI_IO_PROTOCOL                *PciIo;
  EFI_STATUS                         Status;
  UINT8                              BarIndex;
  EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR  *BarDesc;
  if ((This == NULL) || (MmioBar == NULL)) {
    return EFI_INVALID_PARAMETER;
  }
  BarDesc  = NULL;
  Private  = UFS_HOST_CONTROLLER_PRIVATE_DATA_FROM_UFSHC (This);
  PciIo    = Private->PciIo;
  BarIndex = Private->BarIndex;
  Status = PciIo->GetBarAttributes (
                    PciIo,
                    BarIndex,
                    NULL,
                    (VOID **)&BarDesc
                    );
  if (EFI_ERROR (Status)) {
    return Status;
  }
  *MmioBar = (UINTN)BarDesc->AddrRangeMin;
  FreePool (BarDesc);
  return Status;
}