14#define XHCI_VENDOR_ETRON_FIRMWARE 0x4000
15#define XHCI_VENDOR_ETRON_CONTROL 0x4074
16#define XHCI_VENDOR_TI_FIRMWARE 0xC120
17#define XHCI_VENDOR_FRESCO_CONTROL 0x8090
18#define XHCI_VENDOR_PPT_BULK 0x8094
19#define XHCI_VENDOR_FRESCO_SHADOW 0x80DC
20#define XHCI_VENDOR_PME 0x80A4
21#define XHCI_VENDOR_SSIC_PORT 0x883C
22#define XHCI_SSIC_PROG_DONE 0x40000000
23#define XHCI_SSIC_PROG_UNUSED 0x80000000
24#define XHCI_VENDOR_SAVED_BIT 0x02000000
29#define XHCI_HANDOFF_WAITS 20
30#define XHCI_HANDOFF_WAIT_MS 100
31#define XHCI_CNR_WAITS 100
32#define XHCI_CNR_WAIT_MS 100
33#define XHCI_HALT_WAITS 16
34#define XHCI_RESET_WAITS 100
35#define XHCI_RESET_MAX_STEP_MS 16
36#define XHCI_RESET_SLOW_MS 50
37#define XHCI_RUN_STALLS 50
38#define XHCI_RUN_STALL_US 100
39#define XHCI_RUN_WAITS 7
40#define XHCI_RUN_WAIT_MS 5
41#define XHCI_STATE_WAITS 20
58 _In_ WDFCMRESLIST Translated)
61 ULONG Count = WdfCmResourceListGetCount(Translated);
76 DPRINT1(
"Mapping %lu register bytes at 0x%I64x failed\n",
87 DPRINT1(
"No memory resource for the register BAR\n");
94 _In_ WDFCMRESLIST Translated)
158 if (
Id->PciVendorId == 0x1B6F)
163 else if (
Id->PciVendorId == 0x104C || Qualcomm)
197 DPRINT1(
"HCSPARAMS1 0x%08lx reports no device slots\n",
Value);
207 DPRINT1(
"HCSPARAMS1 0x%08lx reports no ports\n",
Value);
275 DPRINT(
"xHCI %x.%02x: %lu slots, %lu interrupters, %lu ports, %lu scratchpads, HCC 0x%08lx/0x%08lx\n",
324 DPRINT1(
"Extended capability read at 0x%lx outside the BAR\n",
Offset);
338 DPRINT1(
"Extended capability write at 0x%lx outside the BAR\n",
Offset);
731 DPRINT1(
"BIOS kept ownership of the controller\n");
735 DPRINT1(
"BIOS kept ownership of the controller, continuing\n");
744 DPRINT1(
"No USB legacy support capability, skipping the BIOS handoff\n");
751 DPRINT1(
"Controller still running after the BIOS handoff\n");
758 DPRINT1(
"Stopping the controller after the BIOS handoff failed 0x%lx\n",
Status);
820 DPRINT1(
"Controller not ready before reset\n");
826 DPRINT1(
"Reset refused, controller not halted\n");
841 DPRINT1(
"Host controller reset did not finish in %lu ms\n", Elapsed);
857 DPRINT1(
"Controller not ready after reset\n");
878 DPRINT1(
"Start refused, controller not halted\n");
920 DPRINT1(
"State save or restore refused, controller running\n");
926 DPRINT1(
"State save or restore already in progress, USBSTS 0x%08lx\n", Usbsts);
948 DPRINT1(
"Save/Restore Error reported, USBSTS 0x%08lx\n", Usbsts);
953 if (!(Usbsts & BusyBit))
958 DPRINT1(
"State save or restore timed out, USBSTS 0x%08lx\n", Usbsts);
static _Out_opt_ PULONGLONG Start
#define WRITE_REGISTER_ULONG(r, v)
#define READ_REGISTER_ULONG(r)
BOOLEAN HasErrata(_In_ XhciErrata Bit) const
BOOLEAN IsAccessible() const
VOID SetErrata(_In_ XhciErrata Bit)
ULONG ReadOperational32(_In_ ULONG Offset) const
ULONG ReadCapability32(_In_ ULONG Offset) const
NTSTATUS ParseCapabilities()
BOOLEAN ContiguousFrameId() const
BOOLEAN Addressing64() const
NTSTATUS CheckStateOperationAllowed() const
UCHAR VersionMajor() const
ULONG DebugCapabilityOffset() const
VOID Write64(_In_ PUCHAR Address, _In_ ULONG64 Value)
NTSTATUS ResetController(_In_ BOOLEAN AllowRunning)
ULONG ReadRuntime32(_In_ ULONG Offset) const
NTSTATUS Prepare(_In_ XhciController *Controller, _In_ WDFCMRESLIST Translated)
VOID WriteRuntime64(_In_ ULONG Offset, _In_ ULONG64 Value)
ULONG ReadPort32(_In_ ULONG Port, _In_ ULONG Offset) const
VOID ProgramSsicPortUnused(_In_ BOOLEAN PowerDown)
ULONG FindExtendedCapability(_In_ ULONG Id, _In_ ULONG Start) const
UCHAR VersionMinor() const
ULONG SupportedStreams() const
BOOLEAN m_MseLengthUsable
ULONG LegacySupportOffset() const
ULONG64 Read64(_In_ PUCHAR Address) const
VOID WriteByte(_In_ ULONG Offset, _In_ UCHAR Value)
NTSTATUS WaitForStateOperation(_In_ ULONG BusyBit)
VOID WriteExtended32(_In_ ULONG Offset, _In_ ULONG Value)
ULONG ScratchpadCount() const
USHORT InterfaceVersion() const
ULONG MaxInterrupters() const
ULONG CurrentFrame(_In_ ULONG Increment) const
VOID ApplyD0Workarounds()
ULONG64 ReadOperational64(_In_ ULONG Offset) const
UCHAR ReadByte(_In_ ULONG Offset) const
ULONG EventRingSegmentTableMax() const
ULONG MaxEventRingSegments() const
NTSTATUS MapRegisters(_In_ WDFCMRESLIST Translated)
ULONG ReadExtended32(_In_ ULONG Offset) const
BOOLEAN InRange(_In_ ULONG Offset, _In_ ULONG Size) const
VOID WriteOperational64(_In_ ULONG Offset, _In_ ULONG64 Value)
XhciController * m_Controller
VOID WriteRuntime32(_In_ ULONG Offset, _In_ ULONG Value)
VOID ReadFirmwareVersion()
VOID WritePort32(_In_ ULONG Port, _In_ ULONG Offset, _In_ ULONG Value)
ULONG m_MaxEventRingSegments
ULONG64 ReadRuntime64(_In_ ULONG Offset) const
BOOLEAN MseLengthUsable() const
VOID RingDoorbell(_In_ ULONG Index, _In_ ULONG Value)
ULONG ContextSize() const
VOID WriteOperational32(_In_ ULONG Offset, _In_ ULONG Value)
VOID ModifyCapability32(_In_ ULONG Offset, _In_ ULONG Clear, _In_ ULONG Set)
#define NT_SUCCESS(StatCode)
#define _strnicmp(_String1, _String2, _MaxCount)
#define KeDelayExecutionThread(mode, foo, t)
IN OUT PLONG IN OUT PLONG Addend IN OUT PLONG IN LONG Increment
#define XHCI_FIRMWARE_UNKNOWN
VOID NTAPI MmUnmapIoSpace(IN PVOID BaseAddress, IN SIZE_T NumberOfBytes)
PVOID NTAPI MmMapIoSpace(IN PHYSICAL_ADDRESS PhysicalAddress, IN SIZE_T NumberOfBytes, IN MEMORY_CACHING_TYPE CacheType)
#define XHCI_VENDOR_FRESCO_CONTROL
#define XHCI_SSIC_PROG_UNUSED
static VOID NTAPI XhciSleepMs(_In_ ULONG Milliseconds)
#define XHCI_RESET_MAX_STEP_MS
#define XHCI_RUN_STALL_US
#define XHCI_VENDOR_PPT_BULK
#define XHCI_VENDOR_ETRON_FIRMWARE
#define XHCI_VENDOR_ETRON_CONTROL
#define XHCI_VENDOR_TI_FIRMWARE
#define XHCI_VENDOR_SSIC_PORT
#define XHCI_VENDOR_SAVED_BIT
#define XHCI_VENDOR_FRESCO_SHADOW
#define XHCI_HANDOFF_WAIT_MS
#define XHCI_HANDOFF_WAITS
#define XHCI_SSIC_PROG_DONE
#define XHCI_RESET_SLOW_MS
static const ULONG XhciVendorBitRegisters[]
unsigned __int64 * PULONG64
#define KeStallExecutionProcessor(MicroSeconds)
_In_ ULONG _In_ ULONG Offset
#define STATUS_ADAPTER_HARDWARE_ERROR
#define CmResourceTypeMemory
PACPI_METHOD_ARGUMENT Next
_Must_inspect_result_ _In_ WDFDEVICE _In_ PUCX_CONTROLLER_CONFIG _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ UCXCONTROLLER * Controller
@ UcxControllerParentBusTypeAcpi
#define STATUS_INVALID_PARAMETER
#define STATUS_UNSUCCESSFUL
#define STATUS_INSUFFICIENT_RESOURCES
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
NTKERNELAPI VOID NTAPI WRITE_REGISTER_UCHAR(IN PUCHAR Register, IN UCHAR Value)
NTKERNELAPI UCHAR NTAPI READ_REGISTER_UCHAR(IN PUCHAR Register)
#define XHCI_LEGSUP_OWNED
#define XHCI_EXTCAP_DEBUG
#define XHCI_CAP_HCSPARAMS1
#define XHCI_EXTCAP_ID_MASK
#define XHCI_HCS1_MAX_INTRS_SHIFT
#define XHCI_DNCTRL_FUNCTION_WAKE
#define XHCI_HCS2_ERST_MAX_MASK
#define XHCI_HCS3_U2_LATENCY_SHIFT
#define XHCI_LEGCTLSTS_KEEP_MASK
#define XHCI_HCC1_XECP_SHIFT
#define XHCI_HCIVERSION_MAJOR_SHIFT
#define XHCI_INTERRUPTER_STRIDE
#define XHCI_LEGSUP_CTLSTS
#define XHCI_CAP_HCSPARAMS3
#define XHCI_CAP_HCSPARAMS2
#define XHCI_HCIVERSION_MINOR_SHIFT
#define XHCI_USBCMD_HCRST
#define XHCI_HCS1_MAX_PORTS_SHIFT
#define XHCI_LEGSUP_BIOS_OWNED_BYTE
#define XHCI_CAPLENGTH_MASK
#define XHCI_HCC1_MAX_PSA_MASK
#define XHCI_HCS2_SCRATCH_HI_MASK
#define XHCI_HCS2_ERST_MAX_SHIFT
#define XHCI_MFINDEX_MASK
#define XHCI_HCS1_MAX_SLOTS_MASK
#define XHCI_HCS1_MAX_INTRS_MASK
#define XHCI_CAP_HCCPARAMS2
#define XHCI_RUNTIME_INTERRUPTER_BASE
#define XHCI_EXTCAP_LEGACY
#define XHCI_HCS2_SCRATCH_HI_SHIFT
#define XHCI_OP_PORT_STRIDE
#define XHCI_HCC1_MAX_PSA_SHIFT
#define XHCI_LEGSUP_OS_OWNED_BYTE
#define XHCI_EXTCAP_NEXT_MASK
#define XHCI_OP_PORT_BASE
#define XHCI_HCS2_SCRATCH_LO_SHIFT
#define XHCI_CAP_HCCPARAMS1
#define XHCI_DOORBELL_STRIDE
#define XHCI_EXTCAP_NEXT_SHIFT
#define XHCI_HCS3_U1_LATENCY_MASK
#define XHCI_CAP_LENGTH_VERSION
FORCEINLINE LARGE_INTEGER NTAPI XhciRelativeMs(_In_ ULONG Milliseconds)