500{
508 ULONG MiniPortStatus;
511 ULONG DisableSelectiveSuspend = 0;
512 ULONG DisableCcDetect = 0;
513 ULONG IdleEpSupport = 0;
514 ULONG IdleEpSupportEx = 0;
517 ULONG TotalBusBandwidth = 0;
522
523 DPRINT(
"USBPORT_StartDevice: FdoDevice - %p, UsbPortResources - %p\n",
524 FdoDevice,
525 UsbPortResources);
526
529
532 goto ExitWithError;
533
536 &PciConfig,
537 0,
539
541 {
542 DPRINT1(
"USBPORT_StartDevice: Failed to get pci config information!\n");
543 goto ExitWithError;
544 }
545
552
554
563
567
569
570 if (!DmaAdapter)
571 {
572 DPRINT1(
"USBPORT_StartDevice: Failed to get DmaAdapter!\n");
574 goto ExitWithError;
575 }
576
579 goto ExitWithError;
580
583 goto ExitWithError;
584
587
593
595 goto ExitWithError;
596
614
616
619 FdoDevice);
620
623 FdoDevice);
624
627 FdoDevice);
628
636
644
650
652
657
660 &DisableSelectiveSuspend,
661 &DisableCcDetect,
662 &IdleEpSupport,
663 &IdleEpSupportEx,
664 &SoftRetry);
665
666 if (DisableSelectiveSuspend)
668
669 if (!DisableSelectiveSuspend &&
671 {
673 }
674
675 MiniportFlags =
Packet->MiniPortFlags;
676
679
682
686
690 L"EnIdleEndpointSupport",
691 &IdleEpSupport,
692 sizeof(IdleEpSupport));
693
697 L"EnIdleEndpointSupportEx",
698 &IdleEpSupportEx,
699 sizeof(IdleEpSupportEx));
700
705 &SoftRetry,
706 sizeof(SoftRetry));
707
711 L"CommonBuffer2GBLimit",
712 sizeof(
L"CommonBuffer2GBLimit"),
713 &Limit2GB,
714 sizeof(Limit2GB));
715
717
721 {
723
725 {
726 if (IsCompanion)
727 {
729 }
730 else
731 {
733 }
734 }
735 }
736
737 if (DisableCcDetect)
738 {
740 }
741
742 TotalBusBandwidth =
Packet->MiniPortBusBandwidth;
744
748 L"TotalBusBandwidth",
749 sizeof(
L"TotalBusBandwidth"),
750 &TotalBusBandwidth,
751 sizeof(TotalBusBandwidth));
752
753 if (TotalBusBandwidth !=
FdoExtension->TotalBusBandwidth)
754 {
756 }
757
759 {
762 }
763
767
769 {
770 DPRINT1(
"USBPORT_StartDevice: Allocate ActiveIrpTable failed!\n");
771 goto ExitWithError;
772 }
773
775
779
781 {
782 DPRINT1(
"USBPORT_StartDevice: Allocate PendingIrpTable failed!\n");
783 goto ExitWithError;
784 }
785
787
791 0,
792 UsbPortResources->InterruptVector,
793 UsbPortResources->InterruptLevel,
794 UsbPortResources->InterruptLevel,
795 UsbPortResources->InterruptMode,
796 UsbPortResources->ShareVector,
797 UsbPortResources->InterruptAffinity,
798 0);
799
800
802 {
803 DPRINT1(
"USBPORT_StartDevice: IoConnectInterrupt failed!\n");
804 goto ExitWithError;
805 }
806
808
809 if (
Packet->MiniPortExtensionSize)
810 {
812 }
813
814 if (
Packet->MiniPortResourcesSize)
815 {
817 Packet->MiniPortResourcesSize);
818
819 if (!HeaderBuffer)
820 {
821 DPRINT1(
"USBPORT_StartDevice: Failed to AllocateCommonBuffer!\n");
823 goto ExitWithError;
824 }
825
828
830 }
831 else
832 {
834 }
835
837 UsbPortResources);
838
839 if (UsbPortResources->LegacySupport)
840 {
842 LegacyBIOS = 1;
843 }
844 else
845 {
846 LegacyBIOS = 0;
847 }
848
852 L"DetectedLegacyBIOS",
853 &LegacyBIOS,
854 sizeof(LegacyBIOS));
855
856 if (MiniPortStatus)
857 {
858 DPRINT1(
"USBPORT_StartDevice: Failed to Start MiniPort. MiniPortStatus - %x\n",
859 MiniPortStatus);
860
862 {
865 }
866
868 {
871 }
872
873 goto ExitWithError;
874 }
875 else
876 {
879 }
880
883
885 FdoDevice,
886 &GUID_DEVINTERFACE_USB_HOST_CONTROLLER,
888
890 {
891 DPRINT1(
"USBPORT_StartDevice: RegisterDeviceInterface failed!\n");
892 goto ExitWithError;
893 }
894
896
898
899 DPRINT(
"USBPORT_StartDevice: Exit Status - %p\n",
Status);
901
902ExitWithError:
905
906 DPRINT1(
"USBPORT_StartDevice: ExitWithError Status - %lx\n",
Status);
908}
NTKERNELAPI NTSTATUS NTAPI IoCsqInitialize(_Out_ PIO_CSQ Csq, _In_ PIO_CSQ_INSERT_IRP CsqInsertIrp, _In_ PIO_CSQ_REMOVE_IRP CsqRemoveIrp, _In_ PIO_CSQ_PEEK_NEXT_IRP CsqPeekNextIrp, _In_ PIO_CSQ_ACQUIRE_LOCK CsqAcquireLock, _In_ PIO_CSQ_RELEASE_LOCK CsqReleaseLock, _In_ PIO_CSQ_COMPLETE_CANCELED_IRP CsqCompleteCanceledIrp)
Set up a CSQ struct to initialize the queue.
VOID NTAPI KeInitializeDpc(IN PKDPC Dpc, IN PKDEFERRED_ROUTINE DeferredRoutine, IN PVOID DeferredContext)
NTSTATUS NTAPI USBPORT_IsCompanionController(IN PDEVICE_OBJECT DeviceObject, IN BOOLEAN *IsCompanion)
BOOLEAN NTAPI USBPORT_IsSelectiveSuspendEnabled(IN PDEVICE_OBJECT FdoDevice)
NTSTATUS NTAPI USBPORT_QueryCapabilities(IN PDEVICE_OBJECT FdoDevice, IN PDEVICE_CAPABILITIES Capabilities)
NTSTATUS NTAPI USBPORT_QueryPciBusInterface(IN PDEVICE_OBJECT FdoDevice)
NTSTATUS NTAPI USBPORT_GetDefaultBIOSx(IN PDEVICE_OBJECT FdoDevice, IN PULONG UsbBIOSx, IN PULONG DisableSelectiveSuspend, IN PULONG DisableCcDetect, IN PULONG IdleEpSupport, IN PULONG IdleEpSupportEx, IN PULONG SoftRetry)
NTSTATUS NTAPI USBPORT_CreateLegacySymbolicLink(IN PDEVICE_OBJECT FdoDevice)
NTSTATUS NTAPI USBPORT_StopDevice(IN PDEVICE_OBJECT FdoDevice)
VOID NTAPI USBPORT_HcWakeDpc(IN PRKDPC Dpc, IN PVOID DeferredContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
VOID NTAPI USBPORT_ReleaseIdleLock(IN PIO_CSQ Csq, IN KIRQL Irql)
VOID NTAPI USBPORT_RemoveBadRequest(IN PIO_CSQ Csq, IN PIRP Irp)
VOID NTAPI USBPORT_InsertIdleIrp(IN PIO_CSQ Csq, IN PIRP Irp)
PIRP NTAPI USBPORT_PeekNextBadRequest(IN PIO_CSQ Csq, IN PIRP Irp, IN PVOID PeekContext)
PIRP NTAPI USBPORT_PeekNextIdleIrp(IN PIO_CSQ Csq, IN PIRP Irp, IN PVOID PeekContext)
VOID NTAPI USBPORT_InsertBadRequest(IN PIO_CSQ Csq, IN PIRP Irp)
VOID NTAPI USBPORT_CompleteCanceledBadRequest(IN PIO_CSQ Csq, IN PIRP Irp)
VOID NTAPI USBPORT_ReleaseBadRequestLock(IN PIO_CSQ Csq, IN KIRQL Irql)
VOID NTAPI USBPORT_CompleteCanceledIdleIrp(IN PIO_CSQ Csq, IN PIRP Irp)
VOID NTAPI USBPORT_AcquireBadRequestLock(IN PIO_CSQ Csq, IN PKIRQL Irql)
VOID NTAPI USBPORT_AcquireIdleLock(IN PIO_CSQ Csq, IN PKIRQL Irql)
VOID NTAPI USBPORT_RemoveIdleIrp(IN PIO_CSQ Csq, IN PIRP Irp)
#define KeInitializeSpinLock(sl)
VOID NTAPI IoDisconnectInterrupt(PKINTERRUPT InterruptObject)
NTSTATUS NTAPI IoConnectInterrupt(OUT PKINTERRUPT *InterruptObject, IN PKSERVICE_ROUTINE ServiceRoutine, IN PVOID ServiceContext, IN PKSPIN_LOCK SpinLock, IN ULONG Vector, IN KIRQL Irql, IN KIRQL SynchronizeIrql, IN KINTERRUPT_MODE InterruptMode, IN BOOLEAN ShareVector, IN KAFFINITY ProcessorEnableMask, IN BOOLEAN FloatingSave)
PDMA_ADAPTER NTAPI IoGetDmaAdapter(IN PDEVICE_OBJECT PhysicalDeviceObject, IN PDEVICE_DESCRIPTION DeviceDescription, IN OUT PULONG NumberOfMapRegisters)
NTSTATUS NTAPI IoGetDeviceProperty(IN PDEVICE_OBJECT DeviceObject, IN DEVICE_REGISTRY_PROPERTY DeviceProperty, IN ULONG BufferLength, OUT PVOID PropertyBuffer, OUT PULONG ResultLength)
#define USB_MINIPORT_FLAGS_POLLING
#define USB_MINIPORT_FLAGS_DISABLE_SS
#define USB_MINIPORT_FLAGS_WAKE_SUPPORT
VOID NTAPI USBPORT_TransferFlushDpc(IN PRKDPC Dpc, IN PVOID DeferredContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
PUSBPORT_COMMON_BUFFER_HEADER NTAPI USBPORT_AllocateCommonBuffer(IN PDEVICE_OBJECT FdoDevice, IN SIZE_T BufferLength)
VOID NTAPI USBPORT_IsrDpc(IN PRKDPC Dpc, IN PVOID DeferredContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
VOID NTAPI USBPORT_StopWorkerThread(IN PDEVICE_OBJECT FdoDevice)
BOOLEAN NTAPI USBPORT_InterruptService(IN PKINTERRUPT Interrupt, IN PVOID ServiceContext)
VOID NTAPI USBPORT_FreeCommonBuffer(IN PDEVICE_OBJECT FdoDevice, IN PUSBPORT_COMMON_BUFFER_HEADER HeaderBuffer)
NTSTATUS NTAPI USBPORT_CreateWorkerThread(IN PDEVICE_OBJECT FdoDevice)
VOID NTAPI USBPORT_MiniportInterrupts(IN PDEVICE_OBJECT FdoDevice, IN BOOLEAN IsEnable)
VOID NTAPI USBPORT_WorkerRequestDpc(IN PRKDPC Dpc, IN PVOID DeferredContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
BOOLEAN NTAPI USBPORT_StartTimer(IN PDEVICE_OBJECT FdoDevice, IN ULONG Time)
#define USBPORT_FLAG_HC_WAKE_SUPPORT
#define USBPORT_MPFLAG_INTERRUPTS_ENABLED
#define USBPORT_FLAG_HC_POLLING
#define USBPORT_FLAG_LEGACY_SUPPORT
#define USBPORT_FLAG_BIOS_DISABLE_SS
#define USBPORT_FLAG_HC_STARTED
#define USBPORT_FLAG_COMPANION_HC
#define USBPORT_FLAG_SELECTIVE_SUSPEND
#define USBPORT_FLAG_INT_CONNECTED
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG _Out_ PULONG ResultLength
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PLONGLONG _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesRead
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_ PCUNICODE_STRING DeviceDescription
#define PCI_WHICHSPACE_CONFIG
#define DEVICE_DESCRIPTION_VERSION
@ DevicePropertyBusNumber
#define PCI_COMMON_HDR_LENGTH