/* Wait the operation register's bit as specified by Bit to become set (or clear). */
EFI_STATUS XhcPeiWaitOpRegBit(IN PEI_XHC_DEV *Xhc, IN UINT32 Offset, IN UINT32 Bit, IN BOOLEAN WaitToSet, IN UINT32 Timeout)
/* Wait the operation register's bit as specified by Bit to become set (or clear). */
EFI_STATUS XhcPeiWaitOpRegBit(IN PEI_XHC_DEV *Xhc, IN UINT32 Offset, IN UINT32 Bit, IN BOOLEAN WaitToSet, IN UINT32 Timeout)
{
  UINT64  Index;
  for (Index = 0; Index < Timeout * XHC_1_MILLISECOND; Index++) {
    if (XHC_REG_BIT_IS_SET (Xhc, Offset, Bit) == WaitToSet) {
      return EFI_SUCCESS;
    }
    MicroSecondDelay (XHC_1_MICROSECOND);
  }
  return EFI_TIMEOUT;
}