Example #1
0
/**

  Free entries match the device address and endpoint address

  @Param  Ohc                   UHC private date
  @Param  DeviceAddress         Item to free must match this device address
  @Param  EndPointAddress       Item to free must match this end point address
  @Param  DataToggle            DataToggle for output

  @retval  EFI_SUCCESS          Items match the requirement removed

**/
EFI_STATUS
OhciFreeInterruptContext(
  IN  USB_OHCI_HC_DEV     *Ohc,
  IN  UINT8               DeviceAddress,
  IN  UINT8               EndPointAddress,
  OUT UINT8               *DataToggle
  )
{
  INTERRUPT_CONTEXT_ENTRY  *Entry;
  INTERRUPT_CONTEXT_ENTRY  *TempEntry;
  EFI_TPL                  OriginalTPL;


  OriginalTPL = gBS->RaiseTPL (TPL_NOTIFY);

  while (Ohc->InterruptContextList != NULL &&
    Ohc->InterruptContextList->DeviceAddress == DeviceAddress &&
    Ohc->InterruptContextList->EndPointAddress == EndPointAddress) {
    TempEntry = Ohc->InterruptContextList;
    Ohc->InterruptContextList = Ohc->InterruptContextList->NextEntry;
    if (DataToggle != NULL) {
      *DataToggle = (UINT8) (TempEntry->DataTd->Word0.DataToggle & 0x1);
    }
    OhciFreeInterruptContextEntry (Ohc, TempEntry);
  }

  Entry = Ohc->InterruptContextList;
  if (Entry == NULL) {
    gBS->RestoreTPL (OriginalTPL);
    return EFI_SUCCESS;
  }
  while (Entry->NextEntry != NULL) {
    if (Entry->NextEntry->DeviceAddress == DeviceAddress &&
      Entry->NextEntry->EndPointAddress == EndPointAddress) {
      TempEntry = Entry->NextEntry;
      Entry->NextEntry = Entry->NextEntry->NextEntry;
      if (DataToggle != NULL) {
        *DataToggle = (UINT8) (TempEntry->DataTd->Word0.DataToggle & 0x1);
      }
      OhciFreeInterruptContextEntry (Ohc, TempEntry);
    } else {
      Entry = Entry->NextEntry;
    }
  }

  gBS->RestoreTPL (OriginalTPL);

  return EFI_SUCCESS;
}
Example #2
0
VOID
OhciFreeDynamicIntMemory(
  IN USB_OHCI_HC_DEV      *Ohc
  )
{
  INTERRUPT_CONTEXT_ENTRY *Entry;
  if (Ohc != NULL) {
    while (Ohc->InterruptContextList != NULL) {
      Entry = Ohc->InterruptContextList;
      Ohc->InterruptContextList = Ohc->InterruptContextList->NextEntry;
      OhciFreeInterruptEdByEd (Ohc, Entry->Ed);
      OhciFreeInterruptContextEntry (Ohc, Entry);
    }
  }
}