/* Free an allocated URB. It is possible for it to be partially inited. */
VOID EhcFreeUrb(IN PEI_USB2_HC_DEV *Ehc, IN PEI_URB *Urb)
/* Free an allocated URB. It is possible for it to be partially inited. */
VOID EhcFreeUrb(IN PEI_USB2_HC_DEV *Ehc, IN PEI_URB *Urb)
{
  if (Urb->RequestPhy != NULL) {
    IoMmuUnmap (Ehc->IoMmu, Urb->RequestMap);
  }
  if (Urb->DataMap != NULL) {
    IoMmuUnmap (Ehc->IoMmu, Urb->DataMap);
  }
  if (Urb->Qh != NULL) {
    EhcFreeQtds (Ehc, &Urb->Qh->Qtds);
    UsbHcFreeMem (Ehc, Ehc->MemPool, Urb->Qh, sizeof (PEI_EHC_QH));
  }
}