/* Create a command transfer TRB to support XHCI command interfaces. */
URB* XhcPeiCreateCmdTrb(IN PEI_XHC_DEV *Xhc, IN TRB_TEMPLATE *CmdTrb)
/* Create a command transfer TRB to support XHCI command interfaces. */
URB* XhcPeiCreateCmdTrb(IN PEI_XHC_DEV *Xhc, IN TRB_TEMPLATE *CmdTrb)
{
  URB  *Urb;
  Urb = AllocateZeroPool (sizeof (URB));
  if (Urb == NULL) {
    return NULL;
  }
  Urb->Signature = XHC_URB_SIG;
  Urb->Ring = &Xhc->CmdRing;
  XhcPeiSyncTrsRing (Xhc, Urb->Ring);
  Urb->TrbNum   = 1;
  Urb->TrbStart = Urb->Ring->RingEnqueue;
  CopyMem (Urb->TrbStart, CmdTrb, sizeof (TRB_TEMPLATE));
  Urb->TrbStart->CycleBit = Urb->Ring->RingPCS & BIT0;
  Urb->TrbEnd             = Urb->TrbStart;
  return Urb;
}