/* One notified function to stop the Host Controller when gBS->ExitBootServices() called. */
VOID EFIAPI XhcExitBootService(EFI_EVENT Event, VOID *Context)
/* One notified function to stop the Host Controller when gBS->ExitBootServices() called. */
VOID EFIAPI XhcExitBootService(EFI_EVENT Event, VOID *Context)
{
  USB_XHCI_INSTANCE    *Xhc;
  EFI_PCI_IO_PROTOCOL  *PciIo;
  Xhc   = (USB_XHCI_INSTANCE *)Context;
  PciIo = Xhc->PciIo;
  gBS->SetTimer (Xhc->PollTimer, TimerCancel, 0);
  XhcHaltHC (Xhc, XHC_GENERIC_TIMEOUT);
  if (Xhc->PollTimer != NULL) {
    gBS->CloseEvent (Xhc->PollTimer);
  }
  XhcClearBiosOwnership (Xhc);
  PciIo->Attributes (
           PciIo,
           EfiPciIoAttributeOperationSet,
           Xhc->OriginalPciAttributes,
           NULL
           );
}