/* Check if the Trb is a transaction of the URB. */
BOOLEAN IsTransferRingTrb(IN USB_XHCI_INSTANCE *Xhc, IN TRB_TEMPLATE *Trb, IN URB *Urb)
/* Check if the Trb is a transaction of the URB. */
BOOLEAN IsTransferRingTrb(IN USB_XHCI_INSTANCE *Xhc, IN TRB_TEMPLATE *Trb, IN URB *Urb)
{
  LINK_TRB              *LinkTrb;
  TRB_TEMPLATE          *CheckedTrb;
  UINTN                 Index;
  EFI_PHYSICAL_ADDRESS  PhyAddr;
  CheckedTrb = Urb->TrbStart;
  for (Index = 0; Index < Urb->TrbNum; Index++) {
    if (Trb == CheckedTrb) {
      return TRUE;
    }
    CheckedTrb++;
    if (CheckedTrb->Type == TRB_TYPE_LINK) {
      LinkTrb    = (LINK_TRB *)CheckedTrb;
      PhyAddr    = (EFI_PHYSICAL_ADDRESS)(LinkTrb->PtrLo | LShiftU64 ((UINT64)LinkTrb->PtrHi, 32));
      CheckedTrb = (TRB_TEMPLATE *)(UINTN)UsbHcGetHostAddrForPciAddr (Xhc->MemPool, (VOID *)(UINTN)PhyAddr, sizeof (TRB_TEMPLATE), FALSE);
      ASSERT (CheckedTrb == Urb->Ring->RingSeg0);
    }
  }
  return FALSE;
}